Get-ADUser -Filter {Enabled -eq $true} -Properties Name,Manager,LastLogon,DistinguishedName |
Select-Object Name,samAccountName,DistinguishedName,@{n='LastLogon';e={[DateTime]::FromFileTime($_.LastLogon).ToString('g')}} |
Export-Csv -NoTypeInformation -Path LastLogonEnabledOnly.csv
Get a list of remote desktop sessions via Command Line
qwinsta # or query session
0 Comments