Sample script that searches Active Directory for all the users allowed to log on to the computer atl-ws-01. The userWorkstations attribute is not replicated to the Global Catalog; you cannot connect to a Global Catalog server and search across the forest for users allowed to use a specific workstation. Note that this attribute is not automatically populated any time you create a user account.

$strFilter = "(&(objectCategory=User)(userWorkstations=*atl-ws-01*))"

$objDomain = New-Object System.DirectoryServices.DirectoryEntry

$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = $objDomain
$objSearcher.PageSize = 1000
$objSearcher.Filter = $strFilter

$colProplist = "name"
foreach ($i in $colPropList){$objSearcher.PropertiesToLoad.Add($i)}

$colResults = $objSearcher.FindAll()

foreach ($objResult in $colResults)
    {$objItem = $objResult.Properties; $}