
The command below returns the user account with security identifier (SID) S-1-5-2. In an LDAP server like ODSEE a query for uidusername objectclass returns a list of the objectclasses assigned to the user. $expFileName = $runDate + "_" + $scriptName + "_Export. About Properties User Powershell Ldap Query. Write-Host "The parameters were:"$boundparams There were $($unt) command line parameters used" $boundparams = $MyInvocation.BoundParameters $($hash) - is the MD5 CheckSum of the following any commandline parameters used Write-Host last modified: $scriptlastmodified $hash = CertUtil -hashfile $MyInvocation.M圜ommand.Name MD5 $logFile = $runDate + "_" + $ScriptName + "_ErrorLog.txt" New-Item -Path $jobPath -ItemType directory | Out-Null $jobPath = $PSScriptRoot + "\jobs\" + $jobName + "\" $scriptlastmodified = (Get-item -Path $scriptpath).LastWriteTime $scriptcontents = $MyInvocation.M圜ommand.ScriptBlock $scriptpath = $MyInvocation.M圜ommand.Path $scriptName = ($MyInvocation.M圜ommand.Name).Split(".") $runDate = $StartDate.ToString("yyyy.MM.dd.HHmmss") $LastLogonRes = "" |select Server, Name, LastLogon $tempRes.LastLogon = ::FromFileTime($res.lastLogon) $res = Get-ADObject -Identity $dn.distinguishedName -Server $server -Properties lastLogon |select lastLogon $tempRes = "" |select Server, Name, LastLogon $dn = Get-ADUser $user |select distinguishedName Get-Job | Receive-Job | Select-Object * -ExcludeProperty RunspaceId | out-gridview Import-Module ActiveDirectoryįunction Get-ADUserLastLogon($userName)
#Powershell ldap query user properties how to
For more information about the how to determine the properties for computer objects, see the Properties parameter description. Powershell Query to get all the users from AD with attributes.
