Are there properties available in Get-View that are similar to Get-AdvancedSetting | Where {$_.Name -like "*tools*"}
The below cmdlet is able to give me these specific info related to vmtools of a VM
Name Value Type Description
---- ----- ---- -----------
tools.guest.desktop.autolock FALSE VM
tools.remindInstall FALSE VM
toolsInstallManager.lastInstallError 21009 VM
toolsInstallManager.updateCounter 11 VM
vmware.tools.internalversion 10305 VM
vmware.tools.requiredversion 10346 VM
guestinfo.toolsInstallErrCode 1601 VM
guestinfo.vmtools.buildNumber 8267844 VM
guestinfo.vmtools.description VMware Tools 10.2.1 build 8267844 VM
guestinfo.vmtools.versionNumber 10305 VM
guestinfo.vmtools.versionString 10.2.1 VM
I'm looking to integrate the above info into the below script
@{Name="Running OS";E={$_.Guest.GuestFullName}},
@{Name="ToolsUpgradePolicy"; Expression={$_.Config.Tools.ToolsUpgradePolicy}}
@{Name="LastInstallError";E={(Get-AdvancedSetting -Entity $_.Name | Where-Object {$_.Name -eq "toolsInstallManager.lastInstallError"}).Value}},
@{Name="InstallErrCode";E={(Get-AdvancedSetting -Entity $_.Name | Where-Object {$_.Name -eq "guestinfo.toolsInstallErrCode"}).Value}},
@{Name="Description";E={(Get-AdvancedSetting -Entity $_.Name | Where-Object {$_.Name -eq "guestinfo.vmtools.description"}).Value}},
@{Name="LastInstallError";E={(Get-AdvancedSetting -Entity $_.Name | Where-Object {$_.Name -eq "toolsInstallManager.updateCounter"}).Value}} | Out-gridview
This only works for the 1st VM and it fails for the 2nd VM, therefore I'm unable to use the Get-AdvancedSetting cmdlet
At line:1 char:97
+ ... rAction SilentlyContinue | % { Get-View $_.id } | Select-Object name,
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (VMware.Vim.VirtualMachine:PSObject) [Select-Object], PSArgumentException
+ FullyQualifiedErrorId : AlreadyExistingUserSpecifiedPropertyNoExpand,Microsoft.PowerShell.Commands.SelectObjectCommand
You can use the Get-View cmdlet immediately with the ViewType parameter.
With the Filter hash table, you can select the VMs based on their DisplayName.
Note that the Value in this hash table is a RegEx
PS: your error is caused by the fact that you use the same name LastInstallError twice
Select Name,
@{Name="Running OS";E={$_.Guest.GuestFullName}},
@{Name="ToolsUpgradePolicy"; Expression={$_.Config.Tools.ToolsUpgradePolicy}},
@{Name="LastInstallError";E={($_.Config.ExtraConfig | Where-Object {$_.Key -eq "toolsInstallManager.lastInstallError"}).Value}},
@{Name="InstallErrCode";E={($_.Config.ExtraConfig | Where-Object {$_.Key -eq "guestinfo.toolsInstallErrCode"}).Value}},
@{Name="Description";E={($_.Config.ExtraConfig | Where-Object {$_.Key -eq "guestinfo.vmtools.description"}).Value}},
@{Name="UpdateCounter";E={($_.Config.ExtraConfig | Where-Object {$_.Key -eq "toolsInstallManager.updateCounter"}).Value}} |
Out-gridview
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can use the Get-View cmdlet immediately with the ViewType parameter.
With the Filter hash table, you can select the VMs based on their DisplayName.
Note that the Value in this hash table is a RegEx
PS: your error is caused by the fact that you use the same name LastInstallError twice
Select Name,
@{Name="Running OS";E={$_.Guest.GuestFullName}},
@{Name="ToolsUpgradePolicy"; Expression={$_.Config.Tools.ToolsUpgradePolicy}},
@{Name="LastInstallError";E={($_.Config.ExtraConfig | Where-Object {$_.Key -eq "toolsInstallManager.lastInstallError"}).Value}},
@{Name="InstallErrCode";E={($_.Config.ExtraConfig | Where-Object {$_.Key -eq "guestinfo.toolsInstallErrCode"}).Value}},
@{Name="Description";E={($_.Config.ExtraConfig | Where-Object {$_.Key -eq "guestinfo.vmtools.description"}).Value}},
@{Name="UpdateCounter";E={($_.Config.ExtraConfig | Where-Object {$_.Key -eq "toolsInstallManager.updateCounter"}).Value}} |
Out-gridview
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Brilliant. Thanks LucD