- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Most probably you are connected to more than 1 vCenter.
Check the content of $global:defaultviservers.
To avoid the error while having multiple connections open, use the Server parameter.
Like this for example
$vcName = ([System.Uri]$dCenter.ExtensionData.Client.ServiceUrl).Host
$dscName = "$($dCenter.Name)_DSC1"
$dsc = New-DatastoreCluster -Name $dscName -Location $dCenter
$dsc = $dsc | Set-DatastoreCluster -SdrsAutomationLevel FullyAutomated
$SRMan = Get-View StorageResourceManager -Server $vcName
$spec = New-Object VMware.Vim.StorageDrsConfigSpec
$spec.PodConfigSpec = New-Object VMware.Vim.StorageDrsPodConfigSpec
$lbSpec = New-Object VMware.Vim.StorageDrsSpaceLoadBalanceConfig
$ioSpec = new-object VMware.Vim.StorageDrsIoLoadBalanceConfig
$spec.PodConfigSpec.DefaultIntraVmAffinity = $true
$spec.PodConfigSpec.LoadBalanceInterval = 480
$spec.PodConfigSpec.Enabled = $true
$lbSpec.MinSpaceUtilizationDifference = 10
$lbSpec.SpaceUtilizationThreshold = 89
$spec.PodConfigSpec.SpaceLoadBalanceConfig = $lbSpec
$ioSpec.IoLatencyThreshold = 10
$ioSpec.IoLoadImbalanceThreshold = 10
$ioSpec.ReservablePercentThreshold = 60
$ioSpec.ReservableThresholdMode = "automated"
$spec.PodConfigSpec.IoLoadBalanceConfig = $ioSpec
$spec.PodConfigSpec.IoLoadBalanceEnabled = $true
$SRMan.ConfigureStorageDrsForPod($dsc.ExtensionData.MoRef, $spec, $true)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference