Import-Module ActiveDirectory
Get-ADUser -Filter * -SearchBase
"OU=Netherlands,OU=EMEA,OU=Manpower,DC=CORP,DC=ROOT,DC=GLOBAL" -SearchScope 2
-Properties
lastlogondate,mail,enabled,description,accountexpirationdate,whenchanged,whencreate
d,manager,department,company -ErrorAction SilentlyContinue | select
samaccountname,name,mail,enabled,description,accountexpirationdate,whencreated,when
changed,lastlogondate,manager,department,company,distinguishedname | sort name |
export-csv "D:\NL-Report\Security-AllNLUsers_Date.csv" -NoTypeInformation
***********************************************************************************
********************************
Gomathi script:
Get-ADUser -Filter * -SearchBase
"OU=Netherlands,OU=EMEA,OU=Manpower,DC=CORP,DC=ROOT,DC=GLOBAL" -SearchScope 2
-Properties
samaccountname,lastlogondate,whencreated,whenchanged,accountexpirationdate,enabled,
displayname,givenName,surname,mail,userPrincipalName,description,employeeID,company
,title,mobile,department,manager,distinguishedname -ErrorAction SilentlyContinue |
select
samaccountname,lastlogondate,whencreated,whenchanged,accountexpirationdate,enabled,
displayname,givenName,surname,mail,userPrincipalName,description,employeeID,company
,title,mobile,department,manager,distinguishedname | sort name | export-csv
"C:\Temp\ou.csv" -NoTypeInformation
***********************************************************************************
********************************
Myscript
Get-ADUser -Filter * -SearchBase
"OU=Netherlands,OU=EMEA,OU=Manpower,DC=CORP,DC=ROOT,DC=GLOBAL" -SearchScope 2
-Properties
samaccountname,lastlogondate,whencreated,whenchanged,accountexpirationdate,enabled,
displayname,givenName,surname,mail,userPrincipalName,description,employeeID,company
,title,mobile,department,manager,distinguishedname -ErrorAction SilentlyContinue |
select
samaccountname,lastlogondate,whencreated,whenchanged,accountexpirationdate,enabled,
displayname,givenName,surname,mail,userPrincipalName,description,employeeID,company
,title,mobile,department,manager,distinguishedname | sort name | export-csv "D:\NL-
Report\Security-AllNLUsers_Date-2.csv" -NoTypeInformation