ADScripts/Active-Users.ps1
2023-09-14 11:13:58 -06:00

6 lines
474 B
PowerShell

$ADUsers = Get-ADUser -Filter '(mail -like "*mpe.ca")' -Properties mail,title,office -SearchBase 'OU=MPEUsers,DC=mpe,DC=ca' | `
where name -NotMatch 'Mailbox|Migration|Federated|Boardroom|Presentation|Survey|Conferences|room|safety|helpdesk|sask|quality|vacation|holiday' | select surname, GivenName, name, mail, title,samaccountname
$ADUsers | Select-Object name,title,mail,GivenName,surname | sort-object name | Export-Csv -Path '.\Active-Users.CSV' -NoTypeInformation