18 lines
533 B
PowerShell
18 lines
533 B
PowerShell
$CSVPath = '.\AD Scripts\CSV\users.csv' #fusemail CSV Export
|
|
|
|
$FusemailUsers = Import-Csv $CSVPath
|
|
$ADUsers = Get-ADUser -Filter '(mail -like "*mpe.ca")' -Properties mail,title,office | `
|
|
where name -NotMatch 'Mailbox|Migration|Federated|Boardroom|Presentation|Survey|Conferences' | select surname, GivenName, name, mail, title,samaccountname
|
|
|
|
# Create User Shell Structure
|
|
|
|
foreach ($FUser in $FusemailUsers) {
|
|
try {
|
|
$FUserAD = Get-ADUser $FUser.User
|
|
}
|
|
catch {
|
|
$FUser.'Mailbox Address'
|
|
}
|
|
|
|
|
|
} |