ADScripts/Active-Users.ps1

6 lines
506 B
PowerShell

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