what is the powercli command to move all manual startup vms to automatic in a particular Esxi Server.
You can do something like this, but be aware that VMHostAutoStartPolicy needs to be enabled to be able to do that.
You can check with Get-VMHostStartPolicy and eventually change with Set-VMHostSTartPolicy.
Get-VMHost -Name $esxName |
Get-VM | Get-VMStartPolicy | where{$_.StartAction -eq 'None'} |
Set-VMStartPolicy -StartAction PowerOn -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You can do something like this, but be aware that VMHostAutoStartPolicy needs to be enabled to be able to do that.
You can check with Get-VMHostStartPolicy and eventually change with Set-VMHostSTartPolicy.
Get-VMHost -Name $esxName |
Get-VM | Get-VMStartPolicy | where{$_.StartAction -eq 'None'} |
Set-VMStartPolicy -StartAction PowerOn -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD,
Getting below error:
Where-Object : Cannot validate argument on parameter 'Property'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At C:\Users\Administrator\Documents\WindowsPowerShell\VMAuto-Start.ps1:3 char:35
+ Get-VM | Get-VMStartPolicy | where{}$_.StartAction -eq 'None' |
+ ~~
+ CategoryInfo : InvalidData: (:) [Where-Object], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.WhereObjectCommand
Oops, typo.
The code above is corrected
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference