Gortee
Hot Shot
Hot Shot

Usign PowerCLI to set Virtual Machine Console Options for Remote Users

Jump to solution

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

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

0 Kudos
4 Replies
Jalapeno420
Enthusiast
Enthusiast

Try this:

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

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

MKguy
Virtuoso
Virtuoso

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

0 Kudos
RvdNieuwendijk
Leadership
Leadership

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

Works perfectly thanks for the help and speed of help.

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