• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1709
  • Last Modified:

powershell to pull All AD accounts

Can you please let me know how to get All Enabled user accounts with their names, surnames, usernames? you can change below code

Search-ADAccount -AccountInactive -TimeSpan 30.00:00:00 -UsersOnly | where {$_.Enabled -eq $true -and $_.Name -notlike "SystemMailbox*" -and $_.Name -notlike "SVC_*"} | Get-ADuser -pr LastLogonTimestamp | Select Name,GivenName,Surname,samaccountname,@{N='LastLogon'; E={[DateTime]::FromFileTime($_.LastLogonTimestamp)}},Enabled | Export-csv C:\temp\test1.csv -nti


report needs to exclude anything with "svc_" system mailbox"
thanks
0
kuzum
Asked:
kuzum
1 Solution
 
SubsunCommented:
Try..
Get-ADuser -f * | where {$_.Enabled -eq $true -and $_.Name -notlike "SystemMailbox*" -and $_.Name -notlike "SVC_*"} | Select Name,GivenName,Surname,samaccountname,Enabled | Export-csv C:\temp\test1.csv -nti

Open in new window

0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now