Can't get powershell to assign Office 365 license in script.

To make things short, my co-worker and I have made a Powershell script that creates a new user and deploys them in the correct OU with DG added when put into a certain group. The only big problem I have in this mess, is having the script at the end assign a office 365 license.

$cred = Get-Credential

Connect-MsolService -Credential = $cred 
   
Get-MsolUser -UserPrincipalName $UserID@Company.com | Set-MsolUser UsageLocation US | Set-MsolUserLicense AddLicenses "Company:EXCHANGEENTERPRISE"

This is popup I get when the whole scrip runs.

Supply Values for the following parameters:
Get-MsolUser UserPrincipalName $UserID@Company.com | Set-MsolUser UsageLocation US | Set-MsolUserLicense AddLicenses "Company:EXCHANGEENTERPRISE"





September 11th, 2015 2:08pm

Hi

I would agree with Mike and please check the article below for more information about assign office 365 license to users:

http://windowsitpro.com/office-365/office-365-licensing-windows-powershell

Hope it helps.

Best Regards,

Elaine

Free Windows Admin Tool Kit Click here and download it now
September 14th, 2015 6:11am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics