Hi All,
I found this script on the internet but this one searches a domain controller for a user.
I want search my global catalog for a user. I found the some information at msdn but
I am not that experienced in programming so I do not know how to translate it to
powershell. I guess the first couple of line need to be adjusted. Can somebody help me out?
Regards
Martijn
$struser = "BOSCH Herbert"
$dom = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$root = $dom.GetDirectoryEntry()
$search = [System.DirectoryServices.DirectorySearcher]$root
$search.Filter = "(cn=$struser)"
$result = $search.FindOne()
if ($result -ne $null)
{
$user = $result.GetDirectoryEntry()
Write-Host $user.distinguishedName " exists"
}
else {Write-Host $struser " Does not exist"}