Hello there,
I need some help writing a quick powercli script that works with 6.5/6.7 to disable the vm overrides. I want to uncheck the following two and use the cluster settings.
Thanks for the help!
Kindly,
Kelly
Have a look at Re: Setting SDRS VM Overrides per VM?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for the link. Yes, I did try scouring the web to do similar and can't find what I need. It used to work with 6.0 and now it does not. It seems the 3 argument is an issue with 6.5/6.7. Some code unchecks one of the two options and not the other and I struggle to truly understand the spec new vs edit. I've tried every combo I can think of and am coming up short.
exception calling "ConfigureStorageDrsForPod" with "3" argument(s): "
Required parameter pod is missing
while parsing call information for method ConfigureStorageDrsForPod_Task
--
Thanks,
Kelly
I also tried this to loop through the datastore clusters and disable the settings without much luck.
--
$dscls = get-datastorecluster | sort -property name
foreach ($dscl in $dscls) {
$ds = $dscl.name
write "ds = $ds"
$pod=Get-View -ViewType 'StoragePod' | ? { $_.name -eq $ds}
$pod_Mor=$pod.MoRef;
$vmOverrides=$pod.PodStorageDrsEntry.StorageDrsConfig.VmConfig;
foreach ($vmOverride in $vmOverrides) {
$vmMo=Get-View $vmOverride.Vm
if($vmOverride.Enabled -eq $false){
$spec = New-Object VMware.Vim.StorageDrsConfigSpec
$spec.vmConfigSpec = New-Object VMware.Vim.StorageDrsVmConfigSpec[] (1)
$spec.vmConfigSpec[0] = New-Object VMware.Vim.StorageDrsVmConfigSpec
$spec.vmConfigSpec[0].operation = 'add'
$spec.vmConfigSpec[0].info = New-Object VMware.Vim.StorageDrsVmConfigInfo
$spec.vmConfigSpec[0].info.enabled=$true
$spec.vmConfigSpec[0].info.vm=$vmOverride.Vm;
$_this = Get-View -Id 'StorageResourceManager-StorageResourceManager'
$_this.ConfigureStorageDrsForPod_Task($pod_Mor, $spec, $true)
Write-Host "SDRS is re-enabled on this VM :" $vmMo.Name
$row.VMName =$vmMo.Name
$report += $row
}
}
}
Could you have a look in the vpxd log at the time you ran that code?
There is probably detailed list of the Spec but also an indication of the error.
This might help what goes wrong
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hello There
Thanks. I will check the vpxd. Is there something specific I am looking for? Are you able to review the attached doc that you can copy/paste here to disable both?
I really appreciate the feedback and quick response.
Kindly,
Kelly
Try finding a reference to the method ConfigureStorageDrsForPod_Task
Sorry, I don't seem to find an attached document.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
It's set to Default (Manual) and the automated schedule seems to override and causes a storage vMotion anyway.
__________________________________________________________________________________________
Not too sure what this reply is about.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference