![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | 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 Specs![]() |
![]() |
| 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 | |||