#list all properties of a user object
Get-QADUser -ReturnPropertyNamesOnly -IncludeAllProperties
# Get a list of properties and store it in an array$properties = Get-QADUser -ReturnPropertyNamesOnly -IncludeAllProperties# Get the actual user object and the outputGet-QADUser "jane doe" -IncludeAllProperties Format-List $properties
(instead of the user name you can use DN, SID, GUID, UPN, username or Domain\username).
thanks to Dmitry Sotnikov
# output for joe user displayname,sAMAccountName,mail,scriptPath,Department
Get-QADUser 'User Joshph P' Format-List displayname,sAMAccountName,mail,scriptPath,Department
Get-QADUser joeuser1Format-List displayname,info,sAMAccountName,mail,scriptPath,Department
# Updating user properties
#Set Notes/info the Joe Useruser account:
cls
Get-QADUser joeuser1Format-List displayname,info,sAMAccountName,mail,scriptPath,Department
Set-QADUser joeuser1-info 'Elvis Rules!!!'
Get-QADUser joeuser1Format-List displayname,info,sAMAccountName,mail,scriptPath,Department
All information gathered from here PowerGUI Community : A quick intro to the Management Shell ...
#--------------------------------------------------------------------------------------
Function GetUserDetails ([adsi]$user){
$user=[ADSI](get-wmiobject -class ds_user -namespace root\directory\ldap -filter "DS_samaccountname='$env:username'").adsipath
write-host "Hello " + $user.givenname}
#--------------------------------------------------------------------------------------
Function Start { trap {reportError} $btnExit.Text = "close" GetUserDetails $user write-host "Bye " + $user.sn #(1 / $null)}
#---------------------------------------------------
$aDSPath=(
get-wmiobject -class ds_user
-namespace root\directory\ldap
-filter "DS_samaccountname='$env:username'"
).adsipath
The above is NOT an ADSI query. It's a WMI query - notice the "getWMIObjecti". Open WBEMTEST and connect to the "root\directory\ldap" namespave then browse to the "ds_user" wmi class and you will see all of the properties as named by WMI.
Monday, July 16, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment