<div dir="ltr" style="text-align: left;">
<h3> ;</h3>
<h3>The Windows PowerShell cmdlets for Office 365 management and deployment have to be installed on your local machine, if you want to manage e.g. Office 365 licences. </h3>
<ol>
<li>Download the appropriate version of the Microsoft Online Services Sign-in Assistant depending on your operating system version: http://technet.microsoft.com/en-us/library/hh974317.aspx. </li>
<p></p>
<li>Install the downloaded software on your local machine.</li>
</ol>
<h3> ;</h3>
<h3> ;Connect to Office 365 / Exchange Online</h3>
<ol>
<li>Open the Windows PowerShell.</li>
<p></p>
<li>Execute the follwoing command if the Microsoft Online Services Sign-in Assistant has been installed: <code>Import-Module MSOnline</code></li>
<p></p>
<li>Execute the following command <code>$LiveCred = Get-Credential</code> and enter the admin credentials in the popup dialog.</li>
<p></p>
<li>Execute the following commands:<br /><code>$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection<br />Import-PSSession $Session </code> </li>
<p></p>
<li>You are connected now. If the Microsoft Online Services Sign-in Assistant has been installed, execute the following command: <br /><code>Connect-MsolService –Credential $LiveCred</code></li>
</ol>
<p></p>
<h3>Enter credentials without popup dialog</h3>
<p>You can enter the credentials directly in the script without using a popup dialog. This method may be used to automate PowerShell commands.</p>
<ol>
<li>Use the following commands instead of <code>$LiveCred = Get-Credential</code> and replace the credentials:<br /> <code>$Username = "admin@yourdomain.edu"<br />$Password = ConvertTo-SecureString ‘YourPassword’ -AsPlainText -Force<br />$LiveCred = New-Object System.Management.Automation.PSCredential $Username, $Password ; ;</code></li>
</ol>
<p><code><span style="font-family: Arial,Helvetica,sans-serif;"><span style="font-size: small;"><b>Can write Following code in powershell to establish connection ; </b></span></span></code></p>
<p><code><code><br />Set-ExecutionPolicy Unrestricted<br />Import-Module MSOnline<br />$O365Cred = Get-Credential<br />$O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $O365Cred -Authentication Basic -AllowRedirection<br />Import-PSSession $O365Session<br />Connect-MsolService –Credential $O365Cred<br /><code> ;</code> </code></code></p>
<ol></ol>
</div>

