Powershell skript pro atribut objektu uzivatele

Skript pro zobrazeni urciteho atributu uzivatele v AD (napr. pro Telephone Notes atribut pouzijte INFO, tedy: </p>

return &aduser.info)</font></h2>

function get-ldapuser ($username, $querydc) {
$domain = new-object DirectoryServices.DirectoryEntry ("LDAP://$querydc)
$searcher = new-object DirectoryServices.DirectorySearcher($domain)
$searcher.filter = "(&(objectclass=user)(samaccountname=$username))"
$searcher.findone().getDirectoryEntry()
}
</p>

$prefdc = "DCServerName.DomainName.com"
$lookupid = "loginname"
$aduser = get-ldapuser $lookupid $prefdc

return &aduser.nameoftheobjectattribute

</div> </div> </div>

Written on January 13, 2010