Sunday, 2 October 2016

How to connect Office365 Server PowerShell admin console?

Or, Connecting Office365 Server PowerShell admin console.

Steps:
1. Open Windows PowerShell (Run as Administrator)
2. Run below command sequentially (one by one).
-----------------------------------------------------------------------------------------------------------------
 Set-ExecutionPolicy RemoteSigned
---------------------------------------------------------------------------------------------------------------
 $LiveCred = Get-Credential
----------------------------------------------------------------------------------------------------------------
 Note:  (in the pop-up window, please enter Office365 global admin credentials, preferably administrator@yourdomain.com)  
-----------------------------------------------------------------------------------------------------------------
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri  https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic –AllowRedirection
-----------------------------------------------------------------------------------------------------------------
Import-PSSession $Session
 ----------------------------------------------------------------------------------------------------------------

(All above mentioned commands are highlighted in below screenshot sequentially)











Now you can execute any administrative command from here as you are connected to your Office365 Server successfully.

2 comments:

  1. Dear Sir,

    i am getting below error while trying to connect. Please help..

    PS C:\Windows\system32> Set-ExecutionPolicy RemoteSigned

    PS C:\Windows\system32> $LiveCred = Get-Credential
    cmdlet Get-Credential at command pipeline position 1
    Supply values for the following parameters:

    PS C:\Windows\system32> $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $livecred -Authentication Basic -AllowRedirection
    WARNING: Your connection has been redirected to the following URI: "https://ps.o
    utlook.com/PowerShell-LiveID?PSVersion=5.1.14409.1012 "
    New-PSSession : [ps.outlook.com] Connecting to remote server ps.outlook.com
    failed with the following error message : [ClientAccessServer=BMXPR01CA0021,Bac
    kEndServer=ma1pr01mb0714.indprd01.prod.outlook.com,RequestId=2559595f-aa38-4bde
    -bb86-fa2d712ba138,TimeStamp=9/21/2017 11:54:28 AM] Access Denied For more
    information, see the about_Remote_Troubleshooting Help topic.
    At line:1 char:12
    + $Session = New-PSSession -ConfigurationName Microsoft.Exchange -Conne ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:Re
    moteRunspace) [New-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : -2144108477,PSSessionOpenFailed

    PS C:\Windows\system32>

    ReplyDelete
    Replies
    1. Run PowerShell as Administrator and then see... also, check if you have rights to login to O365 console..

      Delete