Found a wonderful script but cannot seem to get it to work for all VMs in my environment. I am sure there is some syntax wrong, just cannot seem to locate what it is specifically. No error is generated.
Connect-VIServer
{
$key = "keyboard.typematicMinDelay"
$value = "2000000"
$vm = Get-View (Get-VM VMName).Id
$vmConfigSpec = new-object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.extraconfig += New-Object VMware.Vim.optionvalue
$vmConfigSpec.extraconfig[0].Key=$key
$vmConfigSpec.extraconfig[0].Value=$value
$vm.ReconfigVM($vmConfigSpec)
}
When you're using PowerCLI 4.x, you can do it like this
$Spec = new-object VMware.Vim.VirtualMachineConfigSpec
$Spec.extraconfig += New-Object VMware.Vim.optionvalue
$Spec.extraconfig[0].Key= "keyboard.typematicMinDelay"
$Spec.extraconfig[0].Value= "2000000"Get-VM | % {
$_.Extensiondata.ReconfigVM($Spec)
}
To check the setting, you can do
Get-VM | select Name,
@{N="MinDelay";E={($_.Extensiondata.Config.ExtraConfig | where {$_.Key -eq "keyboard.typematicMinDelay"}).Value}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Revised as follows. Still not working.
Get-VM | % { Get-View $_.ID} | `
% {
$Spec = new-object VMware.Vim.VirtualMachineConfigSpec
$Spec.extraconfig += New-Object VMware.Vim.optionvalue
$Spec.extraconfig[0].Key=keyboard.typematicMinDelay
$Spec.extraconfig[0].Value=2000000
Get-View($_.ReconfigVM_Task($Spec))
}
When I pull Get-VM | % { Get-View $_.ID} I dont see the new values.
Capability : VMware.Vim.VirtualMachineCapability
Config : VMware.Vim.VirtualMachineConfigInfo
Layout : VMware.Vim.VirtualMachineFileLayout
LayoutEx : VMware.Vim.VirtualMachineFileLayoutEx
Storage : VMware.Vim.VirtualMachineStorageInfo
EnvironmentBrowser : EnvironmentBrowser-envbrowser-463
ResourcePool : ResourcePool-resgroup-7
ParentVApp :
ResourceConfig : VMware.Vim.ResourceConfigSpec
Runtime : VMware.Vim.VirtualMachineRuntimeInfo
Guest : VMware.Vim.GuestInfo
Summary : VMware.Vim.VirtualMachineSummary
Datastore : {Datastore-datastore-57484}
Network : {Network-network-68972, Network-network-237}
Snapshot :
RootSnapshot : {}
GuestHeartbeatStatus : green
Parent : Folder-group-v17
CustomValue : {}
OverallStatus : green
ConfigStatus : green
ConfigIssue : {}
EffectiveRole : {-1}
Permission : {}
Name : SERVER
DisabledMethod : {Destroy_Task, UnregisterVM, RevertToCurrentSnapshot_Task, RemoveAllSnapshots_Task...}
RecentTask : {Task-task-21003}
DeclaredAlarmState : {alarm-17.vm-463, alarm-19.vm-463, alarm-21.vm-463, alarm-22.vm-463...}
TriggeredAlarmState : {}
AlarmActionsEnabled : True
Tag : {}
Value : {}
AvailableField : {}
MoRef : VirtualMachine-vm-463
Client : VMware.Vim.VimClient
When you're using PowerCLI 4.x, you can do it like this
$Spec = new-object VMware.Vim.VirtualMachineConfigSpec
$Spec.extraconfig += New-Object VMware.Vim.optionvalue
$Spec.extraconfig[0].Key= "keyboard.typematicMinDelay"
$Spec.extraconfig[0].Value= "2000000"Get-VM | % {
$_.Extensiondata.ReconfigVM($Spec)
}
To check the setting, you can do
Get-VM | select Name,
@{N="MinDelay";E={($_.Extensiondata.Config.ExtraConfig | where {$_.Key -eq "keyboard.typematicMinDelay"}).Value}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You never cease to amaze me.