Page 1 of 1

User-specific connection

Posted: Sun Jan 29, 2023 9:04 pm
by jtenos
On the Windows client, if multiple people are using the computer, when one is connected and the signs off, their VPN connection is still open when a different user logs in.

Is there any way to make the VPN client run specific to only a single user, or to automatically disconnect when that user logs out?

I’m not seeing any options for that.

Re: User-specific connection

Posted: Sun Jan 29, 2023 10:47 pm
by solo

Code: Select all

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts\Logoff\0\0]
"Script"="C:\Logoff.bat"
"Parameters"=""
"ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

Logoff.bat
----------
"C:\Program Files\SoftEther VPN Client\vpncmd.exe" localhost /client /cmd AccountDisconnect con-name
Otherwise, read How to assign user logoff scripts and AccountDisconnect.

Re: User-specific connection

Posted: Mon Jan 30, 2023 2:14 am
by jtenos
Thanks. The command works fine, but I think it's not working for me since I'm on Windows 11 Home - no group policy and those keys didn't exist.

I tried Task Scheduler, but apparently that won't work on logoff.

Apparently there are some hacky workarounds, but I don't want to mess with that. Maybe I'll put it on log in of the next user rather than on log out.

Thanks

Re: User-specific connection

Posted: Mon Jan 30, 2023 2:33 am
by solo
jtenos wrote:
Mon Jan 30, 2023 2:14 am
I'm on Windows 11 Home - no group policy
Then edit and import this "Logoff.reg"

Code: Select all

REGEDIT4

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts\Logoff\0\0]
"Script"="C:\Logoff.bat"
"Parameters"=""
"ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00