Active Directory: Does Specified User Exist?

This code has been in my drafts box for 2 years. I figured I'd just go ahead and publish it, though I'm unsure of the context now.

$dom = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain() $root = $dom.GetDirectoryEntry() $search = [System.DirectoryServices.DirectorySearcher]$root $search.Filter = "(objectcategory=domainDNS)" $result = $search.FindOne() $domain = $result.GetDirectoryEntry() $domain |fl *

if ($result -ne $null) { $user = $result.GetDirectoryEntry() Write-Host $user.name " exists" } else {Write-Host $struser " Does not exist"}