Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 230663

Re: Retrieve vcenter license key

$
0
0

Hello-

 

You can just add in a calculated property to have the current vCenter name included with the corresponding license info, like:

 

## array of names of vCenters to which to connect
$arrVCList="myvc0.mydom.com","myvc1.mydom.com"

&{
foreach ($strVCin$arrVCList) {
   
## connect to this vCenter name
    $oThisVC=Connect-VIServer-Server$strVC
   
## get this vC's license mgr
    $viewLicMgr=Get-View$oThisVC.ExtensionData.Content.LicenseManager -PropertyLicenses
   
## select some things
    $viewLicMgr.Licenses | select @{n="vCenterName"; e={$oThisVC.Name}},*
   
Disconnect-VIserver$oThisVC-Confirm:$false | Out-Null
}} |
Export-CsvD:\Scripts\License\licenses.csv-NoTypeInformation-UseCulture

 

I changed it up a bit to keep things in the pipeline a bit more (vs. stuffing the license info into a variable).  That get it?


Viewing all articles
Browse latest Browse all 230663

Trending Articles



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