Quantcast
Channel: Azure Active Directory forum
Viewing all articles
Browse latest Browse all 16000

Issue with Powershell script to get license and license options information using c#

$
0
0

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.


Viewing all articles
Browse latest Browse all 16000

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>