Connecting to Office 365 with PowerShell

This is just s simple script for connecting to Office 365 with PowerShell.


# Import Required PowerShell Modules
# Note - the Script Requires PowerShell 3.0!

Import-Module MSOnline 

# Office 365 Admin Credentials
$CloudUsername = 'username'
$CloudPassword = ConvertTo-SecureString 'password' -AsPlainText -Force
$CloudCred = New-Object System.Management.Automation.PSCredential $CloudUsername, $CloudPassword 

# Connect to Office 365
Connect-MsolService -Credential $CloudCred

Leave a Reply

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 )

Connecting to %s