otrdiena, 2019. gada 12. marts

Powershell script to Get all AD users in unicode UTF8 format



Script is mention to run on Domain Controller, otherwise you need to enable PowerShell and Import Active Directory Modules.
c:\temp directory must be created before running script
At first you need to read aut all properties to determine, which you want to see in final list.

Get-ADUser -identity giors -properties *|Export-CSV c:\tmp\giors.csv 

where giors is my username. I need to determine, which user accounts is expired so I add LastLogonDate and PasswordLastSet
Simple Export-CSV export in plain ANSI text, to convert to UTF8 add -Encoding UTF8

Get-ADUser -Filter * -SearchBase "DC=domain,DC=com" -properties *|select CanonicalName,SamAccountName,Name,LastLogonDate,LockedOut,PasswordLastSet,whenChanged|Export-CSV -Encoding UTF8 c:\tmp\allusersinUTF.
csv


Nav komentāru:

Ierakstīt komentāru