The post Example: set an advanced parameter value in VMware via vSphere PowerCLI appeared first on ma.ttias.be.
If you manage any kind of VMware environment, chances are you've heard of the vSphere PowerCLI. It's a Windows PowerShell extension that offers direct management of your hypervisors, VMs or configuration through a powerful CLI interface.
It's a VMware automators' wet dream.
I'll completely ignore the installation part of PowerCLI and dive right into an example. Here's how to connect to a vCenter Server and set an advanced parameter on a particular VM.
$ Connect-Viserver -Server your.vcenter.server.tld -User your_username -Password your_password Name Port User ---- ---- ---- your.vcenter.server.tld 443 your_username
This output means you're connected (and authenticated) to your vCenter. The next commands in your shell will now be sent to that connection.
$ get-vm YOUR-VM-NAME | New-AdvancedSetting -Name snapshot.asyncConsolidate.forceSync -Value TRUE -confirm:$False
The above will find the VM named "YOUR-VM-NAME" and set the advanced parameter "snapshot.asyncConsolidate.forceSync" to the value TRUE, without asking for an explicit confirmation.
This way, you can set almost any kind of VMX parameter without shutting down the VM first.
The post Example: set an advanced parameter value in VMware via vSphere PowerCLI appeared first on ma.ttias.be.