fbpx
Office 365 Powershell: Anywhere and Easy
By Steve Bowman
Published May 14, 2015
Estimated Reading Time: 2 minutes

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

Post Tags:
Article By Steve Bowman
Steve Bowman is a Partner at Model Technology as well as their Vice President of Sales and Marketing. Steve is a father, husband, Franciscan, and lover of technology. He's bilingual in business and technology and have over 30 years of experience in selling enterprise technology solutions in a variety of industries.

Related Posts