- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hey Alan,
I made a few tweaks to your function call, not sure if you would think its better/worse. I just didnt like that FE loop stuck in there. Let me know what you think, now if we could only get a "Remove-VMAdvancedConfiguration" to work ![]()
Also I changed the display to show "Setting" instead of Key but that obviously could be changed back
-----
Function Get-VMAdvancedConfiguration {
<#
.SYNOPSIS
Lists advanced configuration setting (VMX Setting) for a VM
or multiple VMs
.DESCRIPTION
The function will list a VMX setting for a VM
or multiple VMs
.PARAMETER VM
A virtual machine or multiple virtual machines
.EXAMPLE 1
PS> Get-VM MyVM1 | Get-VMAdvancedConfiguration
.EXAMPLE 2
PS> Get-VMAdvancedConfiguration MyVM2 -Setting RemoteDisplay.maxConnections
#>
param(
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
$vm,
[String]$setting
)
process{
If ($setting){(((Get-VM $VM).ExtensionData).Config).ExtraConfig | Where { $_.Key -match $setting } | Select @{n="Setting";e="Key"}, Value}
Else {(((Get-VM $VM).ExtensionData).Config).ExtraConfig | Select @{n="Setting";e="Key"}, Value}
}
}