Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Re: Find AD user with specific home directory

Reply
 
Old 03-28-2007   #1 (permalink)
phaldmmor


 
 

Re: Find AD user with specific home directory

Hi Richs,

Thanks for your help, my script is working fine now.
I am really happy with it

Grtz Fabian


"phaldmmor" <Phaldmmor@community.nospam> wrote in message
news:5F68D66E-9CC4-4898-8FA5-13548379030E@microsoft.com...
>I want try to find users with a specific server name in the homedirectory
>in my Active Directory.
> Tryed servel scripts, but none of them seem to work and I can't get
> figured out what is wrong.
> Result are that not 1 single user is found, but I am sure they are there.
>
> Scripts I tryed are :
>
> # Define root
> $root = New-Object DirectoryServices.DirectoryEntry
> 'LDAP://ortec.intranet/DC=ortec;DC=intranet'
>
> # Now create a searcher and set base to base of user Container
> $Searcher = New-Object DirectoryServices.DirectorySearcher
> $Searcher.SearchRoot = $root
>
> #Now find all users and display them
> $users= $searcher.findall()
> Write-Host "There are $($users.count) users in the $($root.name) container
> in ORTEC:`n"
>
> foreach ($user in $users){
> $up=$user.properties
> if ($up.properties -contains "gd")
> {Write-Host "User: $($up.name) `nHomedirectory:
> $($up.homedirectory)`n"}
> else {Write-Host "No Mach"}
> }
>
> And an other script I have tryed :
>
> # Define root
> $Root = New-Object DirectoryServices.DirectoryEntry
> 'LDAP://ortec.intranet/DC=ortec;DC=intranet'
>
> # Now create a searcher and set base to base of user Container
> $Searcher = New-Object DirectoryServices.DirectorySearcher
> $Searcher.SearchRoot = $root
>
> #Now find all users and display them
> $users= $searcher.findall() | where {$_.properties.homedirectory -contains
> "\\gdfile1"}
> Write-Host "There are $($users.count) users in the $($root.name) container
> in ORTEC:`n"
>
> foreach ($user in $users){
> $up=$user.properties
>
> #only do it for users...
>
> if ($user.homedirectory -contains "\\gdfile1"){
>
> Write-Host "User: $($up.name) `nDN: $($up.distinguishedname)`n"
> }
> }
>
>
>



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
User Home Directory PowerShell
RE: Find AD user with specific home directory PowerShell
RE: Find users in AD with a specific home directory PowerShell
RE: Find users in AD with a specific home directory PowerShell
RE: Find AD user with specific home directory PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46