LucD
Leadership
Leadership

You will have to use the ConfigureStorageDrsForPod_Task method to change the settings for SDRS.

In the StorageDrsConfigSpec object you can disable this.

Combined with your Where-clause this could be something like this

$storMgr = Get-View StorageResourceManager

$pod
= Get-DatastoreCluster -Name $datastorecluster
$spec
= New-Object VMware.Vim.StorageDrsConfigSpec $pod.ExtensionData.PodStorageDrsEntry.StorageDrsConfig.VmConfig | where {(Get-View $_.VM | Select -ExpandProperty Name) -like "*_replica"} | %{   $entry = New-Object VMware.Vim.StorageDrsVmConfigSpec
  $entry.Operation = "edit"
  $entry.Info = $_
 
$entry.Info.Enabled = $false
  $spec.vmConfigSpec += $entry
} $storMgr.ConfigureStorageDrsForPod($pod.ExtensionData.MoRef,$spec,$true)

Note that the Get-DatastoreCluster cmdlet can be used to replace my function


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos