Difference between revisions of "Active Directory (PowerShell)"

Jump to navigation Jump to search
m
STILL DRAFT: Minor update
m (→‎Get-Users examples: Added further example)
m (STILL DRAFT: Minor update)
Line 40: Line 40:
$users | Select-Object Name, Enabled, CanonicalName, Country, Created, LastLogonDate, mail | export-csv -Path users.csv
$users | Select-Object Name, Enabled, CanonicalName, Country, Created, LastLogonDate, mail | export-csv -Path users.csv
</source>
</source>
* '''LastLogonDate''' - Be aware that the last logon date field typically has an accuracy/tolerance of 14 days, AD intentionally doesn't update the field at every logon from the user/device object so as to reduce the amount of data replication between domain controllers
== Computers ==
=== <code>Get-ADComputer</code> examples ===
<source lang="powershell">
$devices = Get-ADComputer -Filter * -SearchBase "DC=domain,DC=com" -Properties IPv4Address, OperatingSystem,  Created, LastLogonDate
</source>
* '''LastLogonDate''' - Be aware that the last logon date field typically has an accuracy/tolerance of 14 days, AD intentionally doesn't update the field at every logon from the user/device object so as to reduce the amount of data replication between domain controllers


== Errors ==
== Errors ==

Navigation menu