Hello All - I have written a script where in I need a particular companies license and license options in the below format
AccountSkuId ::: <license_option> i.e like "MyDomain:ENTERPRISEPACK ::: EXCHANGE_S_ENTERPRISE"
Script when executed as PS1 directly on powershell gets desired output. It looks like below
$Subscriptions = Get-MsolAccountSku; $AccountSKUInfo = $Subscriptions.AccountSkuId; foreach($Subscription in $Subscriptions) { $SubscriptionServiceStatus = $Subscription.ServiceStatus; foreach($SubscriptionServiceStat in $SubscriptionServiceStatus) { $AccountLicenseOptions = $SubscriptionServiceStat.ServicePlan; foreach($AccountLicenseOption in $AccountLicenseOptions) { $AccountServiceName = $AccountLicenseOption.ServiceName $RequiredValue = $AccountSKUInfo + ":::" +$AccountServiceName; $RequiredValue; } } }
However when I execute the same script within C# application, I get below error
<<
System.Management.Automation.ParseException was unhandled
HResult=-2146233087
Message=At line:11 char:46
+
$RequiredValue = $AccountSKUInfo:::$AccountServiceName;
+
~
Missing property name after reference operator.
>>
Is there something I am missing? please help.