VI toolkit is a powerful tool. Guess we could do all kind of stuff in VI using it. Below is a simple script which would change the resource settings (ie. shares to normal & limit to unlimited).
clear
#Connect-VIServer localhost
$vm = Get-Cluster "clustername" | get-vm | Get-View
$res = New-Object vmware.Vim.virtualmachineconfigspec
$res.CpuAllocation = New-Object vmware.Vim.ResourceAllocationInfo
$res.CpuAllocation.Shares = New-Object vmware.Vim.SharesInfo
$res.CpuAllocation.Shares.Level = "normal"
$res.CpuAllocation.Limit = "-1"
$res.MemoryAllocation = New-Object vmware.Vim.ResourceAllocationInfo
$res.MemoryAllocation.Shares = New-Object vmware.Vim.SharesInfo
$res.MemoryAllocation.Shares.Level = "normal"
$res.MemoryAllocation.Limit = "-1"
foreach ($v in $vm)
{
$v.reconfigvm_task($res)
}
No comments:
Post a Comment