How to use Powershell with office 365 Exchange online: Today we are going to discuss how to use powershell with Office 365; So Powershell is a task automation and configuration management framework. Powershell also provides full access to COM and WMI and it performs as an administrative task on local and remote both Windows system as well as WS-Management and CIM enabling management of remote Linux. Cmdlets allow you to do things in the Office 365 with PowerShell environment like add users, managing Office 365 license assignments and know which mailboxes are inactive. Administrative tasks are normally performed by cmdlets in Powershell, which are specialised. Powershell also providing hosting API with which Powershell runtime can be situated inside other applications. PowerShell allows to Exchange Online administrators that manage the services and other tasks quickly and in an efficient manner through the command line.
Important things to know before using Powershell with office 365 Exchange online
- Expected time to be completed: five minutes.
- Supporting Windows:
- Windows 10
- Windows 8/Windows 8.1
- Windows Server 2012/2012 R2
- Windows 7 Service Pack 1 (SP1) (T&C)
- Windows Server 2008 R2 SP1 (T&C)
- To run the scripts Windows PowerShell needs to configure and if it is not so then, you will get an error connecting process given below:
|“Files cannot be loaded because running scripts is disabled on this system. Provide a valid certificate with which to sign the files”.|
- To run signed scripts to enable Windows PowerShell you will have to run the below command in an elevated (Run as administrator) Windows PowerShell window (open it by selectingRun as administrator). You should also note that it is need to be configured only once on your computer.
Connect to Exchange Online
- First, open PowerShell windows and run with below command. You will need to provide your user name and password of office 365 in the Credential Requestdialog box (Windows PowerShell) and click on “OK” button.
$UserCredential = Get-Credential
- Then, Run the below command.
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Note: 21Vianet customer of China using windows 365 uses the link: https://partner.outlook.cn/PowerShell.
- Then, Run given below command.
Note: Once you finished the session then, disconnect the remote PowerShell. If you did not disconnect the session then you will have to wait for the sessions expire. To disconnect the session of remote PowerShell, you will need to run the below command.
Note: This webpage is dedicated to the “How to use Powershell with office 365 Exchange online”. So, you can bookmark this page and visit again later to know about ‘How to use Powershell with office 365 Exchange online’.