BostonTechGuy
Enthusiast
Enthusiast

Disable VAAI using Loop - I think its Syntax Problem

Hello,

I needed to perform a quick emergency disable of all the VAAI at our Datacenter. EMC software upgrade was failing "supposedly" due to it.  Regardless of the outcome.. I was unable to loop the disable commands for all the VAAI settings.  Kept getting errors.  Basically I pulled all the Hosts from the datacenter one by one and performed the disable command.  It took couple of hours to disable.  There must be a better way to go faster or to get a proper loop.

This is the PowerCLI script you see everywhere on the internet to disable VAAI

Get-Datacenter "MYDATACENTER" | Get-VMHost | Set-VMHostAdvancedConfiguration -Name DataMover.HardwareAcceleratedMove -Value 0

Get-Datacenter "MYDATACENTER" | Get-VMHost | Set-VMHostAdvancedConfiguration -Name DataMover.HardwareAcceleratedInit -Value 0

Get-Datacenter "MYDATACENTER" | Get-VMHost | Set-VMHostAdvancedConfiguration -Name VMFS3.HardwareAcceleratedLocking -Value 0

This works fine.. just super slow and pulls each Host for each line.  I wanted to loop this and it was crashing every time.

Here is the loop that I tried to finally use...

Get-Datacenter "MYDATACNETER" | Get-VMHost | % {

Set-VMHostAdvancedConfiguration -Name DataMover.HardwareAcceleratedMove -Value 0 | `

Set-VMHostAdvancedConfiguration -Name DataMover.HardwareAcceleratedInit -Value 0 | `

Set-VMHostAdvancedConfiguration -Name VMFS3.HardwareAcceleratedLocking -Value 0

}

It would crash... Pretty my logic is correct but Syntax is wrong.  What did I miss here?

Thanks,

Boston TechGuy

Tags (2)
0 Kudos
4 Replies
vijayrana968
Virtuoso
Virtuoso

Don't use pipelines after each 'Set-VMHostAdvancedConfiguration'

Try this.

Get-Datacenter "MYDATACNETER" | Get-VMHost | % {

Set-VMHostAdvancedConfiguration -Name DataMover.HardwareAcceleratedMove -Value 0

Set-VMHostAdvancedConfiguration -Name DataMover.HardwareAcceleratedInit -Value 0

Set-VMHostAdvancedConfiguration -Name VMFS3.HardwareAcceleratedLocking -Value 0

}

If issue persists, paste complete error here.

0 Kudos
LucD
Leadership
Leadership

I think you need to do it like this (mention the VMHost)

Get-Datacenter "MYDATACNETER" | Get-VMHost | % {

    Set-VMHostAdvancedConfiguration -VMHost $_ -Name DataMover.HardwareAcceleratedMove -Value 0 -Confirm:$false

    Set-VMHostAdvancedConfiguration -VMHost $_ -Name DataMover.HardwareAcceleratedInit -Value 0 -Confirm:$false

    Set-VMHostAdvancedConfiguration -VMHost $_ -Name VMFS3.HardwareAcceleratedLocking -Value 0 -Confirm:$false

}


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

0 Kudos
BostonTechGuy
Enthusiast
Enthusiast

Thanks Luc.  I figured this was the syntax I was getting incorrect. Going to test it out on some hosts.

Thanks,

Boston TechGuy

0 Kudos
BostonTechGuy
Enthusiast
Enthusiast

Giving a quick update - I have not had the chance to test the code.  Planning on doing so tomorrow. Thanks, Boston Tech Guy

0 Kudos