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 10:10am

Hi,

Retype your dashes and quotation marks. They look like em/en and the quotes are bent.

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

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

Other recent topics Other recent topics