-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPowerShell_ADUser_ReportInfo.ps1
More file actions
24 lines (23 loc) · 1.05 KB
/
PowerShell_ADUser_ReportInfo.ps1
File metadata and controls
24 lines (23 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#Reporting Scripts
Get-ADUser `
#-SearchBase 'REMOVED_FOR_SECURITY' `
-Filter {Enabled -eq $true} -Properties * | `
Where-Object "targetAddress" -ne $null | `
Where-Object "PasswordNeverExpires" -ne $true | `
Select-Object GivenName, `
Surname, `
SamAccountName, `
EmailAddress, `
targetAddress, `
Title, `
Department, `
@{Name="LastLogon TimeStamp";Expression={[datetime]::FromFileTime($_.'lastLogonTimeStamp')}}, `
@{Name="Last Logon";Expression={[datetime]::FromFileTime($_.'lastLogon')}}, `
# PasswordExpired, `
whenCreated, `
@{Name='Manager';Expression={(Get-ADUser $_.Manager).GivenName + " " + (Get-ADUser $_.Manager).Surname}} | `
Where-Object "GivenName" -ne $null | `
Where-Object "SurName" -ne $null |`
Sort-Object @{Expression='GivenName'; Ascending=$true } | `
Format-Table
#Export-Csv "C:\DIRECTORY\DATE_FILE-NAME.csv"