This is the script found here: VMware Knowledge Base
I want to execute this without running on ALL VMs. How would i add a " Get-Content $ChangeMonitorcontrol | ForEach-Object " to the script below pointing it to a txt file of VM names?
ForEach ($vm in (Get-VM)){
$vmv = Get-VM $vm | Get-View
$name = $vmv.Name
$guestid = $vmv.Summary.Config.GuestId
$vmx = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmx.extraConfig += New-Object VMware.Vim.OptionValue
$vmx.extraConfig[0].key = "monitor_control.enable_softResetClearTSC"
$vmx.extraConfig[0].value = "TRUE"
if ($guestid -like "windows8*Guest") {
($vmv).ReconfigVM_Task($vmx)
}
}
any ideas on this anyone?
Hello.. Can someone help me with this?
This needs to be moved to PowerCLI (if a moderator can do that).
Discussion moved from ESXi to VMware PowerCLI
Create a text file vmlist.txt which contains the VM's names, and replace your script's first line with:
$vmlist = Get-Content -Path .\vmlist.txt
foreach ($vm in $vmlist) {
André
You can do something like this.
Move the static object outside of the loop, use Get-View and use a combined filter.
$vmx = New-Object VMware.Vim.VirtualMachineConfigSpec
$extra = New-Object VMware.Vim.OptionValue
$extra.key = "monitor_control.enable_softResetClearTSC"
$extra.value = "TRUE"
$vmx.ExtraConfig += $extra
$vmFilter = @{
Name = (Get-Content $ChangeMonitorcontrol ) -join '|'
'Summary.Config.GuestID'='windows8.*Guest'
}
Get-View -ViewType VirtualMachine -Filter $vmFilter | %{
$_.ReconfigVM_Task($vmx)
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
How would i get this value for all VMs Running Windows Server 2012 in the vCenter? In other words, I want to show a report of all VMs and output if it has the value or NOT.
The purpose is to know which VMs dont have the value.
Do you have VMware Tools installed on all your VMs?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes all running VMware Tools.
Try something like this
Select Name,
@{N='enable_softResetClearTSC';E={
$TSC = $_.ExtensionData.Config.ExtraConfig | where{$_.Key -eq 'monitor_control.enable_softResetClearTSC'}
if($TSC){$TSC.value}else{'Not present'}}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference