I have to be missing something here. I've been googling for the past hour and I cannot seem to find a single thing to put a virtual machine in maintenance mode via CLI. Sure, I see something to put a host in maintenance mode, and I see plenty of things to start and stop a VM, yet for some reason I can't find anything to put the VM itself in maintenance mode.
In particular, I want to put a specific virtual machine from a linked-clone pool into maintenance mode. Would anyone have any references/ideas for me to use to accomplish this? I appreciate any help!
Hmmm, I'm a bit new myself to vpshere, so I'll explain the best I can. It might be a VDI application - not sure. What I can say is that we have several pools set up as linked-clones. I know I can use PowerCLI to connect to VCenter, and then use Get-VM to get a list of all the virtual machines on that VCenter. However, I'm not sure how to choose any machines among that list and put it in maintenance mode through CLI.
The virtual machine I am talking to is in a linked-clone pool...not sure if that answers your question!
That functionality should be available in the Vmware.VimAutomation.HorizonView module.
As Alan explained in Getting started with PowerCLI 6.5 and Horizon View, you have through that module access to the complete Horizon View API.
At first sight, and I haven't tried or tested this yet, it looks like the Desktop_Update method might do this.
I suspect that it's a matter of setting the Enabled property to $false.
But I haven't tried that yet, a weekend project :smileygrin:
I cannot get this functionality to work:
$hvm=get-hvmachine -machinename pleaseputmeintomaintenancemode
$mm=get-mapentry managedMachineData $hvm.managedmachinedata
Exception calling "Machine_Update" with "3" argument(s): "ExceptionType : VMware.Hv.InvalidArgument
ErrorMessage : Cannot update member with read-only fields.
ParameterName : managedMachineData"```
How else are we supposed to put a host into maintenance mode? I can't find this anywhere else in the API documentation: