Disable OWA For Devices through Office 365 Powershell commands

When I was working in my last position we ran an Office 365 environment. It had all the features you could ever ask for and very few of the complications one is faced with in a local Exchange environment. Failover was taken care of for us, High Availability didn't involve 6 in house/colocation servers and when an outage did occur I didn't have to wade ankle deep into the shit storm that was an office without email. One slight annoyance, however, was when Gates and Co.  decided to roll out new services. More often than not such new features were like a surprise birthday party. You were absolutely elated to see everyone there, but then you realized they invited Gary the office cynic (the views of this writer do not reflect those of all other staff, many of us love Gary and would be more than happy to invite him to our next party - ed.).  One such example of this was Microsoft's implementation of "OWA for devices"

In our environment we only allowed approved users to access their email from outside the office. These users would have to request access and this access had to go through the proper channels in order to be approved. So imagine our surprise when we discovered several of our non approved staff members were accessing email from their mobile devices. Upon further investigation it turned out that these users were gaining access through a new Microsoft email application amply named Outlook. This email application used "OWA for mobile devices" to access Office 365 which bypassed the activesync approval method we had been using. Being the good guy that I am, and the only systems administrator in the office, I decided to take it upon myself to correct the situation. 

To begin with I logged into Office 365 through my desktop Powershell installation. For those of you new to the Powershell game this is easily done by first running Powershell from your desktop as administrator and then running this command: 

  •  $MyCredential = Get-Credential
You will be prompted for your login credentials. Use the administrator account you would usually use for your Office 365 login.

Big shoutout to Kris Powell at adminarsenal for this awesome GIF.
 Next we will establish the session with the Office 365 exchange servers...
And then we will import the Office 365 session that will be necessary for us to proceed. 
  • Import-PSSession $Session
To disable "OWA for devices" is actually a pretty simple command at this point. To disable the service for all devices in your environment type the command below and then hit enter. 
  • Get-CasMailbox | set-casmailbox -OWAForDevicesEnabled $False
Just as a secondary step I checked that the command had worked by going into the Office 365 "Exchange admin center". 

Before the command is run, underneath recipients, after highlighting a user you should find "Disable OWA for devices" in the far right column. 

 If everything worked with our command you should now see this box display "Enable OWA for Devices" 

Next PostNewer Post Previous PostOlder Post Home


Post a Comment