Silvion
asked on
Powershell - Create User Mailboxes and Apply a Address Book Policy and remove Email Alias.
Hi all,
Please excuse my ignorance, i'm haven't done a lot with powershell.
I have a roughly 300 user accounts in AD and need to create their mailboxes in exchange.
I would like to create a mailboxes for each user in the OU, assign X address book policy and remove their secondary @internal email alias on their account. This is what i have come up with, am i on the right track?
TIA,
Patrick.
Please excuse my ignorance, i'm haven't done a lot with powershell.
I have a roughly 300 user accounts in AD and need to create their mailboxes in exchange.
I would like to create a mailboxes for each user in the OU, assign X address book policy and remove their secondary @internal email alias on their account. This is what i have come up with, am i on the right track?
Import-module activedirectory
$users = Get-ADUser -LDAPfilter '(name=*)' -searchBase {DC=Staff,DC=Users,DC=DOMAIN,DC=INTERNAL.DOMAIN.TAS.EDU.AU}
foreach($user in $users)
{
Enable-Mailbox -Identity $user.SamAccountName -Database <DBName>
Update-EmailAddressPolicy -Identity "Staff Only Policy"
}
TIA,
Patrick.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
There was one part i had to chance but i forgot what it was now. But thank you for your help - That was fantastic. Appreciate it.