I am trying to write a console application to manage user license options in Office 365. I am using runspace in conjunction with the MSOL powershell module. Basically i am able to manage all the users licence requirements with exception of the -DisabledPlans when i pass a list of disabled plans in the commandparameter.
The following is the PowerShell command which works fine and disables all the plans as expected
New-MsolLicenseOptions -AccountSkuId ACME:ENTERPRISEPACK -DisabledPlans OFFICESUBSCRIPTION,SHAREPOINTWAC,EXCHANGE_S_ENTERPRISE,SHAREPOINTENTERPRISE
I build this runspace commandparamater as follows
Command licenseOptions = new Command("New-MsolLicenseOptions");
licenseOptions.Parameters.Add((new CommandParameter("AccountSkuId", "ACME:ENTERPRISEPACK")));
licenseOptions.Parameters.Add((new CommandParameter("DisabledPlans",
"OFFICESUBSCRIPTION,SHAREPOINTWAC,EXCHANGE_S_ENTERPRISE,SHAREPOINTENTERPRISE,YAMMER_ENTERPRISE")));
When i build the commandparameter above in runspace and execute i receive the following {"Unable to assign this license because the license options are invalid."}
however when i use the following commandparameter it successfully disables the serviceplan
Command licenseOptions = new Command("New-MsolLicenseOptions");
licenseOptions.Parameters.Add((new CommandParameter("AccountSkuId", "ACME:ENTERPRISEPACK")));
licenseOptions.Parameters.Add((new CommandParameter("DisabledPlans", "EXCHANGE_S_ENTERPRISE")));
I have been debugging and i can see that only one item exists in the disabled list object with a value of OFFICESUBSCRIPTION,SHAREPOINTWAC,EXCHANGE_S_ENTERPRISE,SHAREPOINTENTERPRISE,YAMMER_ENTERPRISE
where i would be expecting a item for each entry. I think it maybe how the runspace commandparameter is interpreting the separators.
Cheers in advance