powershell - Check whether O365 product license is enabled -


i need configure o365 licences via powershell have no problem add if statement before check whether product enabled before modifying otherwise fails.

currently have following modify (enable services) enabled office 365 enterprise e3 product:

$o365ente3 = new-msollicenseoptions -accountskuid tenent:enterprisepack  set-msoluserlicense -userprincipalname $upn -licenseoptions $o365ente3 

what need run check whether tenent:enterprisepack enabled first?

cheers jamie

to check whether enterprise pack there,you can use below snippet (tested in powershell v5):

$user = get-msoluser -userprincipalname $upn  if($user.licenses.accountsku.skupartnumber -contains 'enterprisepack'){     write-output "enterprise pack there" } else{     write-output "no enterprise pack" } 

Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -