Hi,
I apologise if this has been asked previously. I did a search and couldn't find anything.
I have a script that loops though a number of IP addresses and connects to each host one at a time to retrieve information (not all hosts belong to a vCenter)
I'm trying to get license details.
In the script I can do:
$lm = Get-View -Id 'LicenseManager-ha-license-manager'
I can then do
PowerCLI C:\PSScripts> $lm
Source :
SourceAvailable : False
Diagnostics :
FeatureInfo : {}
LicensedEdition :
Licenses : {VMware vSphere 5 Essentials}
LicenseAssignmentManager :
Evaluation : VMware.Vim.LicenseManagerEvaluationInfo
LinkedView :
MoRef : LicenseManager-ha-license-manager
Client : VMware.Vim.VimClientImpl
and
PowerCLI C:\PSScripts> $lm.Licenses
LicenseKey : JJ214-44LDN-6894D-0UE06-CTA45
EditionKey : esxExpress.vram
Name : VMware vSphere 5 Essentials
Total : 66
Used : 2
CostUnit : cpuPackage
Properties : {ProductName, ProductVersion, feature, feature...}
Labels :
DynamicType :
DynamicProperty :
But I can't do
$lm.Licenses.Name
I get no data back.
I can do:
PowerCLI C:\PSScripts> $lm.Licenses | select Name
Name
----
VMware vSphere 5 Essentials
but how do I then put "VMware vSphere 5 Essentials" into a variable?
I hope that makes sense?
Thanks
Joe
I can do:
PowerCLI C:\PSScripts> $lm.Licenses | select Name
Name
----
VMware vSphere 5 Essentials
but how do I then put "VMware vSphere 5 Essentials" into a variable?
You can just create a new variable from that command:
$lmname = $lm.Licenses | select Name
Hi
Thanks for that.
However, if I get do it that way, then the contents of the variable becomes "@{Name=VMware vSphere 5 Essentials}" rather than "VMware vSphere 5 Essentials" when put into a CSV file.
Joe
No problem, to resolve that you would then just select it using:
$lmname.name