VMware Cloud Community
RUG201110141
Enthusiast
Enthusiast
Jump to solution

listing configuration parameters of a virtual machine

I would like to be able to retrieve the list of configuration parameters of a virtual machine, specifically the ones under Options > Advanced > General > Configuration Parameters when you go to edit settings of a virtual machine.  I found this article in the powershell community - http://communities.vmware.com/docs/DOC-18653 (Retrieve and Set VM Advanced Configuration (VMX) settings).  I run the script according to the example by first connecting to vCenter with the vSphere PowerCLI and then executing Get-VM vm-name | Get-VMAdvancedConfiguration.  It appears to run and gives not errors, but returns nothing.  I know that this virtual machine has settings under the Configuration Parameters also so I know it's either not the script I'm looking for or I'm doing something wrong.  Is there a way to retrieve this information via powershell.  I would like to provide this information to auditors.

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

That is caused by the Select-Object you used on the first line.

I'm not sure how you want to display the results, but this is just one way of doing it


$vms
= Get-VM -Location Clustername
foreach
($vm in $vms){   $vm.ExtensionData.Config.ExtraConfig |
  Select @{N="VM";E={$vm.Name}},Key,Value
}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
5 Replies
LucD
Leadership
Leadership
Jump to solution

That function sets advanced configuration parameters.

To retrieve advanced configuration parameters you can do

(Get-VM -Name vm-name).ExtensionData.Config.ExtraConfig


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
RUG201110141
Enthusiast
Enthusiast
Jump to solution

I'm trying to return a list of configuration parameters for some vm's in a specific cluster.  So here is what I've done:

$vms = Get-VM -Location ClusterName | Select-Object -Property Name

foreach ($vm in $vms)

{Get-VM -Name $vm).ExtensionData.Config.ExtraConfig}

There is a problem with this because the result from the first line returns the column name along with the list off all the machines in the cluster so the variable of $vm looks like the following:

@{Name=MachineName1}

@{Name=MachineName2}

@{Name=MachineName3}

Is there anyway of just providing the list of machine names without have the column name prepending to the variable?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

That is caused by the Select-Object you used on the first line.

I'm not sure how you want to display the results, but this is just one way of doing it


$vms
= Get-VM -Location Clustername
foreach
($vm in $vms){   $vm.ExtensionData.Config.ExtraConfig |
  Select @{N="VM";E={$vm.Name}},Key,Value
}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
RUG201110141
Enthusiast
Enthusiast
Jump to solution

Thanks for you help.  Out-File is good enough is good enough for displaying it for me.

Reply
0 Kudos
IgnitionUSMC
Contributor
Contributor
Jump to solution

Here is how I solved that, roughly similar. This allowed me, with the final variable, the ability to manipulate the data at large once all VMs had been scanned

$GetVMs = Get-VM -Location ClusterName
$Report=@()
foreach ($vm in $GetVMs){
      $Report+=$vm.ExtensionData.Config.ExtraConfig |Select @{N="VM";E={$vm.Name}},@{N="Setting";E="Key"},Value
}
$Report

This way when I compare it to "known good settings"... aka compare against the hardening guide I can tweak the report as needed. Basically does the same thing as Lucd though

Reply
0 Kudos