Working with many Office365 clients, I receive queries on how to go about provisioning users and mailboxes for an Exchange hybrid deployment. To begin with, let’s assume a couple things. We have a Windows 2012 R2 member server with Azure AD Connect (AAD Connect) version 1.1.105.00 (or newer) and the Azure AD Module for PowerShell installed;…
Tag: 365
Add Alternate Email Address or Recovery Email Address for Office365 Administrator
In Office365, depending on the admin role of an account you may want to add an alternate email address for password recovery. This is a basically a self-service password reset for Administrators of Office365. Quick way to do this is with PowerShell:
1 2 3 4 5 6 7 8 9 10 11 12 |
#Connect to Office365 Import-Module MSOnline Connect-MsolService $O365Cred = Get-Credential $O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic -AllowRedirection Import-PSSession $O365Session #Check if the user has an Alternate Email Address (Recovery Address) Get-MsolUser -UserPrincipalName mwasay@domain.com | select -ExpandProperty AlternateEmailaddresses #Check if the user has an Alternate Email Address (Recovery Address) Set-MsolUser -UserPrincipalName mwasay@domain.com -AlternateEmailAddresses mwasay@domain2.com |
If this setting is unset for an administrator, Office365 gives you a…
Hack: Microsoft Outlook AutoComplete
Outlook maintains the AutoComplete list. The list is used by both the automatic name-checking feature and the automatic completion feature. The AutoComplete list, also known as the nickname cache, is generated automatically when you send email messages from Outlook. The list contains SMTP addresses, LegacyExchangeDN entries, and display names for people to whom you have…
Find out ‘in cloud’ Distribution Groups
Microsoft Teams was announced yesterday and many want to jump right in. I noticed when users wanted to create teams, new distribution groups started getting added. I wanted to find out my ‘In cloud’ distribution groups and was surprised there was no property for the item. I was able to find out the groups…
Migrate Office365 Photos to AD
Many of my customers have Office365 and have been using Skype for Business for sometime now. It is likely that your organization users have uploaded their profile picture. Now only if there was a way to sync those pictures back to your AD – so it looks neat & nice. There is a way!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
#MigrateOffice365PhotosToAD.ps1 function Get-Office365Photo($EmailAddress,$Credential) { $wc = New-Object System.Net.WebClient $wc.credentials = $Credential # Build the URL that'll return the jpeg of the user's photo $url = "https://outlook.office365.com/ews/exchange.asmx/s/GetUserPhoto?email=$EmailAddress&size=HR96x96" # Build a path to export it to (.\[email protected]) $outPath = "$pwd\$EmailAddress.jpg" try { # Download the image and save it to the current directory $wc.DownloadFile($url,$outPath) return $outPath } catch { throw $_ } } function Upload-ADPhoto($Username,$FilePath) { # Import the photo into a variable as a byte array $photo = [byte[]](Get-Content $FilePath -Encoding byte) # Replace the current value of thumbnailPhoto with the byte array from above Set-ADUser $Username -Replace @{ThumbnailPhoto=$photo} } # Get the credential to allow us to download the images $Cred = Get-Credential -Message "Please enter your Office 365 Credentials" # Get every mail-enabled AD user $users = Get-ADUser -ldapfilter '(mail=*)' -properties mail # For each of the mail-enabled users... foreach ($user in $users) { try { # Download the photo $photoPath = Get-Office365Photo -EmailAddress $user.mail -Credential $Cred # Upload the photo Upload-ADPhoto -Username $user -FilePath $photoPath } catch { Write-Warning "Unable to update image for $($user.mail)" } } |
…