As employees come on-board or leave the company, I have an app that uses the Powershell Set-CASMailbox
cmdlet to enable or disable the mailbox settings in Exchange Online.
If the employee has no license, or they have an E1, E2, or E3 license, it works fine. If they have an F3, the settings are not changed. There is no error issued.
If this is normal behaviour, is it possible to update the app to get the current license and temporarily remove it?
This works as long as there is no F3 license (VB)
Try
strReturnValue = ConnectToExchangeOnline()
Catch ex As Exception
strReturnValue = "Error connecting to Exchange Online. Error: " & ex.Message & vbCr
Return strReturnValue
End Try
' Clear out the previous commands
gpsShellOnline.Commands.Clear()
' Load the command to set the mailbox
gpsShellOnline.AddCommand("Set-CasMailbox")
gpsShellOnline.AddParameter("ActiveSyncEnabled", False)
gpsShellOnline.AddParameter("EwsEnabled", False)
gpsShellOnline.AddParameter("Identity", strUserPrincipalName)
gpsShellOnline.AddParameter("ImapEnabled", False)
gpsShellOnline.AddParameter("MAPIEnabled", False)
gpsShellOnline.AddParameter("OWAEnabled", False)
gpsShellOnline.AddParameter("PopEnabled", False)
gpsShellOnline.AddParameter("SmtpClientAuthenticationDisabled", True)
' And execute the command
Try
gpsResults = gpsShellOnline.Invoke()
Catch ex As Exception
strReturnValue = "Error disabling e-mail access on-line for " & WindowsUsername & ". Error: " & ex.Message & vbCr
Return strReturnValue
End Try