Office 365 Powershell: Anywhere and Easy

Plenty of organizations are moving to O365 these days. Extending your directory services outside of your on-premise environment can put Admins on edge. I wanted to take some time to share some Powershell that helps make administering Cloud Identities a lot less intimidating.

 

Who wants to RDP to a Dirsync server to manage O365? I sure don’t. Adding Microsoft Office Sign On Assistant and the following Script allows you to manage the cloud from where it was intended…anywhere. Start by grabbing and installing the bits for MOSS: http://www.microsoft.com/en-us/download/details.aspx?id=28177 This is pretty light weight and a wizard based installation. Fire up Powershell and remotely connect to the cloud with the following script:

 

#Import O365 cmdlets and setup your Credentials for Connecting to O365 Import-Module Msonline $Cred = Get-Credential $Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $Cred -Authentication Basic -AllowRedirection Import-PSSession $Session Connect-MsolService –Credential $Cred

 

Create a ps1 from the code above and execute it. You should be prompted for some credentials with a prompt that looks similar to this:

 

credential

 

Put your UPN/Password in for your Global Admin Account. Now you have a powershell session that can be leveraged to manage O365. The possibilities from here are near endless. I plan on speaking through some specific O365 provisioning scenarios in future blogs (Feel Free to Suggest Any Specific Scenarios in the Comments 🙂 ), but to wrap up today’s blog I am going to share some licensing/configuration scripts to bulk enable/configure/license all unlicensed users that have been dirsync’d.  First, we start by acquiring your MsolSku information (License) with the following command:

 

#Discover your License Info

Get-MsolAccountSku

 

#Below is the result of the Get-MsolAccountSku command

 

AccountSkuId                     ActiveUnits     WarningUnits     ConsumedUnits

————                              ———–           ————             ————-

companyname:SKUname    1000                          0                               0

 

Now that we have our License info, we can execute the following to configure all your unlicensed users with the following commands:

 

#Enable Login, Set Location, Set License

Get-Msoluser -UnlicensedUsersOnly | Set-MsolUser -UsageLocation US

Get-Msoluser -UnlicensedUsersOnly | Set-MsolUser -BlockCredential $false

Get-Msoluser -UnlicensedUsersOnly | Set-MsoluserLicense -AddLicenses “company:SKUname”

 

Let it rip and you have some users ready to use O365 🙂

 

Dp

By |2016-04-12T11:06:26+00:00May 14th, 2015|Office 365, PowerShell, Uncategorized|0 Comments

About the Author:

steve bowman

Model Technology

Let us help you get your end point and data center strategy on cruise control!  Ask about our Calibration Assessment.

CONTACT US

  • 12125 Woodcrest Executive Drive, Ste. 204 Creve Coeur, MO 63141
  • (314) 254-4138
  • sales@model-technology.com

RECENT TWEETS