Wednesday, June 21, 2017

How to log off the Virtual Machine without any services interruption on the same?

I was working with the VM and always my pulse secure connection was disconnected hence my application was down, So I got the batch file which is logging off the system properly without disconnecting the VPN connection. 

The batch job text is written below:

========================================

@ECHO OFF
C:\Windows\System32\tscon.exe rdp-tcp#0 /dest:console 
C:\Windows\System32\tscon.exe rdp-tcp#1 /dest:console 
C:\Windows\System32\tscon.exe rdp-tcp#2 /dest:console 
C:\Windows\System32\tscon.exe rdp-tcp#3 /dest:console 
C:\Windows\System32\tscon.exe rdp-tcp#4 /dest:console

========================================

And Save the above text as any bat file like "SoftLogOff.bat" and save in the VM system.

While logging off you should double-click on this bat file and then the system will be logged off.

Thank you.


How to restrict second user on Virtual Machine entry while first one is logged on


I find a method that the second user cannot "kick of" the first user.

Do you only want one user access the remote desktop at one time? If so, you can set the Group Policy to limit the number of the connections.

Open the Group Policy Editor, Locate to:
Computer Configuration\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Connections

On the right pane, double-click Limite number of connections, click Enable, set the RD Maximus Connections allowed to 1.

In this way, the group policy restricts the second user to log on the remote desktop if someone is using the remote desktop.