You are on page 1of 3

Power shell Command

Connect Power shell to Office 365 Exchange Online

1. Click Start, point to All Programs, click Accessories, click Windows Power Shell, and then click Windows Power Shell. 2. Copy and Run the following Blue Font command: 3. Set-ExecutionPolicy RemoteSigned(Only First time)
4.

5. In the Windows Power Shell Credential Request window, type the credentials of an account in your cloud-based organization. Then, click OK. 6. Run the following command:

$LiveCred = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ Credential $LiveCred -Authentication Basic -AllowRedirection
Note: The Allow Redirection parameter enables cloud-based organizations in datacenters all over the world to connect Windows Power Shell to the cloud-based service by using the same URL. 7. Run the following command:

Import-PSSession $Session

Commands that are used in the cloud-based service will now be imported into the clientside session of your local computer, as tracked by a progress bar. When this process is complete, you can run these commands. Disconnect Windows Power Shell from the cloud-based service When you're finished using the server-side session, always disconnect Windows Power Shell by running the following command:

Remove-PSSession <session variable>


Prerequisite o Windows 7 Sp1 or later Version o Windows Server 2008 R 2 Later Version o Power Shell 2.0 or Later Version

Export User Info o User Info User Name (First Name Last Name) Email Address

Install Windows Azure Ad Module


Copy and Paste Link to your Web Browser http://technet.microsoft.com/en-us/library/jj151815.aspx#bkmk_installmodule

Copy and Run the Following Command


1. Connect-MsolService. (To Connect to Office Services)

2. Get-MsolUser | Get-Member | Out-GridView (To View the Format) 3. Get-MsolUser | Where-Object { $_.isLicensed -eq "TRUE" } (To View in the Power shell) 4. Get-MsolUser | Where-Object { $_.isLicensed -eq "TRUE" } | Export-Csv c:\LicensedUsers.csv (To Export Licensed User in CSV File) 5. Get-MsolUser | Where-Object { $_.isLicensed -eq "TRUE" } | Select-Object UserPrincipalName, DisplayName, Country, Department | Export-Csv c:\LicensedUsers.csv (To Export User in Csv File With Condition)

You might also like