Provide PowerShell 3.0 Add-On Connections for Office 365

Posted on

PowerShell_Logo_lg

The below is provided as-is and not supported in any way.  The below is a set of PowerShell commands, which are used to instruct the PowerShell0 ISE to load these commands each time the ISE is launched:

  1. Create a new folder in your Documents folder called WindowsPowerShel
  2. Open notepad and copy the below into the notepad file
    1. Once copied, save the file with a .ps1 extension

 

$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add(“Connect to Exchange Online”,

{

if($msolCredentials -eq $null)

{

$msolCredentials = Get-Credential

}

$EXOL = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $msolCredentials -Authentication Basic -AllowRedirection

Import-PSSession $EXOL

},

“Control+Alt+Z”

)

$psISE.CurrentPowerShellTab.AddOnsMenu.SubMenus.Add(“Connect to Office 365”,

{

if($msolCredentials -eq $null)

{

$msolCredentials = Get-Credential

}

$getModuleResults = Get-Module

If (!$getModuleResults) {Import-Module MSOnline -ErrorAction SilentlyContinue}

Else {$getModuleResults | ForEach-Object {If (!($_.Name -eq “MSOnline”)){Import-Module MSOnline -ErrorAction SilentlyContinue}}}

Connect-MsolService -Credential $msolCredentials

},

“Control+Alt+X”

)

$msolCredentials = $null

Whatcha thinkin?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s