Fast Way to Get User Attributes from AD Without using Get-ADUser
Get-ADUser is slow and cumbersome to get information from, and required the AD module to be installed on the computer. Here is a faster way to get information from AD, without that PowerShell Module.
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = New-Object System.DirectoryServices.DirectoryEntry
$objSearcher.Filter = "(&(objectCategory=User)(SamAccountname=$($loggedinUser)))"
$objSearcher.SearchScope = "Subtree"
$obj = $objSearcher.FindOne()
#Use the attributes found in AD to get properties, with example used below
$FullName =$obj.Properties["cn"]
$JobTitle =$obj.Properties["description"]
$StreetAddress =$obj.Properties["streetAddress"]
$City =$obj.Properties["l"]
$State =$obj.Properties["st"]
$ZipCode =$obj.Properties["postalCode"]
$PhoneNumber =$obj.Properties["homePhone"]
$FaxNumber =$obj.Properties["facsimileTelephoneNumber"]
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = New-Object System.DirectoryServices.DirectoryEntry
$objSearcher.Filter = "(&(objectCategory=User)(SamAccountname=$($loggedinUser)))"
$objSearcher.SearchScope = "Subtree"
$obj = $objSearcher.FindOne()
#Use the attributes found in AD to get properties, with example used below
$FullName =$obj.Properties["cn"]
$JobTitle =$obj.Properties["description"]
$StreetAddress =$obj.Properties["streetAddress"]
$City =$obj.Properties["l"]
$State =$obj.Properties["st"]
$ZipCode =$obj.Properties["postalCode"]
$PhoneNumber =$obj.Properties["homePhone"]
$FaxNumber =$obj.Properties["facsimileTelephoneNumber"]
The two most outstanding providers of Live Dealer video games within the US market are Ezugi and Evolution. Here are some more blackjack phrases you might come across. Any assembly or group event held at the World’s Biggest Casino is certain to be unforgettable. Contact our skilled staff at present to get started planning your next event at present. Take a minute to orient yourself with our interactive on line 강원랜드 쪽박걸 casino map, so find a way to|you presumably can} make the most of|take benefit of|benefit from} your expertise at the World's Biggest Casino. When you have have} 10 factors, double-down when the vendor reveals 2 and 9.
ReplyDelete