Skip to content

Instantly share code, notes, and snippets.

@Sumeet-Gandhi
Created August 25, 2019 04:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sumeet-Gandhi/98fdfbdb25e87425aa60908057083bed to your computer and use it in GitHub Desktop.
Save Sumeet-Gandhi/98fdfbdb25e87425aa60908057083bed to your computer and use it in GitHub Desktop.
exchange online connect
$UserCredential = Get-Credential
Import-Module MSOnline
Connect-MsolService –Credential $UserCredential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session -DisableNameChecking -AllowClobber
Set-OwaMailboxPolicy -Identity Default -AdditionalStorageProvidersAvailable $false
Remove-PSSession $Session
$userid=read-host 'Enter username'
$password=Read-Host -AsSecureString 'Enter password'
$cred=New-Object System.Management.Automation.PSCredential $userid,$password
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $Session -AllowClobber
Set-OwaMailboxPolicy -AdditionalStorageProvidersAvailable $false -Identity "Hide OWA IM"
Set-OwaMailboxPolicy -AdditionalStorageProvidersAvailable $false -Identity "Owa AP group creation disabled policy"
Remove-PSSession $Session
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment