VMware Cloud Community
Gortee
Hot Shot
Hot Shot
Jump to solution

Usign PowerCLI to set Virtual Machine Console Options for Remote Users

I really miss onxy....   Such a wonderful tool.  I am looking for a script to change the Virtual Machine Console Options for Remote Users as documented here:

vSphere Documentation Center

Anyone have a clue how to set these variables?

Thanks,

J

Joseph Griffiths http://blog.jgriffiths.org @Gortees VCDX-DCV #143
1 Solution

Accepted Solutions
MKguy
Virtuoso
Virtuoso
Jump to solution

The relevant VM configuration parameters are RemoteDisplay.maxConnections and tools.guest.desktop.autolock.


You can edit these settings with the (Get|New|Set|Remove)-AdvancedSetting cmdlets. E.g. run:
Get-VM MyVM1 | New-AdvancedSetting -Name "RemoteDisplay.maxConnections" -Value 3 -Confirm:$false -Force

Get-VM MyVM1 | New-AdvancedSetting -Name "tools.guest.desktop.autolock" -Value "true" -Confirm:$false -Force

-- http://alpacapowered.wordpress.com

View solution in original post

Reply
0 Kudos
4 Replies
Jalapeno420
Enthusiast
Enthusiast
Jump to solution

Try this:

(get-vm vmName).ExtensionData.Config.MaxMksConnections

(get-vm vmName).ExtensionData.Config.GuestAutoLockEnabled

MKguy
Virtuoso
Virtuoso
Jump to solution

The relevant VM configuration parameters are RemoteDisplay.maxConnections and tools.guest.desktop.autolock.


You can edit these settings with the (Get|New|Set|Remove)-AdvancedSetting cmdlets. E.g. run:
Get-VM MyVM1 | New-AdvancedSetting -Name "RemoteDisplay.maxConnections" -Value 3 -Confirm:$false -Force

Get-VM MyVM1 | New-AdvancedSetting -Name "tools.guest.desktop.autolock" -Value "true" -Confirm:$false -Force

-- http://alpacapowered.wordpress.com
Reply
0 Kudos
RvdNieuwendijk
Leadership
Leadership
Jump to solution

If you want to use the vSphere API, like Onyx does, you can use for example:

$spec = New-Object VMware.Vim.VirtualMachineConfigSPec

$spec.MaxMksConnections = 2

$spec.GuestAutoLockEnabled = $true

$vm = Get-VM -name VM1

$vm.ExtensionData.ReconfigVM_Task($spec)


If you do not want to limit the number of simultaneous connections to a VM, you have to set the MaxMksConnections to -1.

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Gortee
Hot Shot
Hot Shot
Jump to solution

Works perfectly thanks for the help and speed of help.

Joseph Griffiths http://blog.jgriffiths.org @Gortees VCDX-DCV #143
Reply
0 Kudos