So, I totally had this great big long post made, and it was going to go into how to set up groups… And it was going to be awful because of how many things can go wrong with that part… Then I remembered that we don’t have any contacts on our local AD… And it would just be that much more awful to try to run the group script without contacts. (It’d be like forgetting the rum in your pina colada… Yeah, you can do it, but you aren’t going to have nearly as much fun.)

With contacts you are faced with an interesting problem of, your local AD doesn’t have Exchange so it doesn’t really like contacts. It doesn’t know what to do with them. But they are still possible, and you can even search for them, you just have to use the Get-ADObject command instead of the Get-ADWhatever command. This script is pretty simple, so I don’t really think it needs a lot of introduction. If you have any questions you can email/comment below.

$contacts = Get-Contact
foreach ($contact in $contacts) {
    $email = $contact.WindowsEmailAddress
    New-ADObject -Name $contact.Identity -DisplayName $contact.DisplayName -Type Contact -Path "OU=Contact,OU=GirIndustriesUsers,DC=Girindustries,DC=Com" -OtherAttributes @{'mail' = $email }

EDIT: !!!

I forgot about resource mailboxes… If you have something declared as a resource mailbox in O365, you can synchronize it up with a user account. So basically, just create it in the cloud, then use the script to make it on premise… This requires you specify the mailbox type, this needs to follow the standard for get-mailbox (I.E. SharedMailbox, EquipmentMailbox, Roommailbox, and Moosemailbox. ((Wait.. there is no Moosemailbox… YET!)))

$rooms = Get-Mailbox -RecipientTypeDetails $mailboxType
foreach ($room in $rooms) {
    $UPN = $room.WindowsLiveID
    $test = Get-ADUser -Filter { userPrincipalName -like $UPN }
    if ($test -eq $null) {
        [array]$proxyAddresses = $room.emailAddresses
        New-ADUser -Name $room.Name -DisplayName $room.Name -Path $path -samAccountName $room.Alias -OtherAttributes @{'proxyAddresses' = $proxyAddresses }

This is a five part series!

Part 1
Part 2
Part 3
Part 4
Part 5

Leave a Reply

Your email address will not be published. Required fields are marked *