Powershell

From Piszczynski
Revision as of 10:56, 20 May 2019 by piszczynski>Aleks (Created page with " == Handy Powershell == Export details of users in a specific OU: $OUpath = 'OU=CKH Leavers & Disabled Accounts,OU=CKH Users,DC=ckh,DC=local' $ExportPath = 'c:\users\alek...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Handy Powershell

Export details of users in a specific OU:


$OUpath = 'OU=CKH Leavers & Disabled Accounts,OU=CKH Users,DC=ckh,DC=local'

$ExportPath = 'c:\users\alekscms\disabledaccounts.csv'

Get-ADUser -Filter * -SearchBase $OUpath | Select-object DistinguishedName,Name,UserPrincipalName,sAMAccountName | Export-Csv -NoType $ExportPath