在ad上用ps跑下面脚本就行。
$FilePath = [Environment]::GetFolderPath("Desktop")+"\AD_Computers.csv"
Get-ADComputer `
-Filter * `
-Property * | `
Select-Object `
-Property `
"Name", `
"CanonicalName", `
"DNSHostName", `
"Description", `
"Enabled", `
"IPv4Address", `
"OperatingSystem", `
"OperatingSystemVersion", `
"Created", `
"LastLogonDate"| `
export-csv `
-path $FilePath `
-NoTypeInformation `
-encoding UTF8
$FilePath = [Environment]::GetFolderPath("Desktop")+"\AD_User.csv"
Get-ADUser `
-Filter * `
–Properties `
"SamAccountName", `
"CN", `
"DisplayName" , `
"Description" ,`
"Enabled", `
"LastLogonDate", `
"PasswordNeverExpires", `
"PasswordLastSet" , `
"msDS-UserPasswordExpiryTimeComputed" | `
Select-Object `
-Property `
"SamAccountName", `
"CN", `
"DisplayName" , `
"Description" ,`
"Enabled", `
"LastLogonDate" , `
"PasswordNeverExpires", `
"PasswordLastSet" , `
@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}} | `
export-csv `
-path $FilePath `
-NoTypeInformation `
-encoding UTF8