From c3ed3490f09a90a353ae75299d4eeb3cbf8152f4 Mon Sep 17 00:00:00 2001 From: asmtron <49522124+asmtron@users.noreply.github.com> Date: Sun, 13 Sep 2020 13:23:00 +0000 Subject: [PATCH] Fix for Windows home editions Windows home editions are missing the command "%windir%\system32\query.exe" to query the rdp-tcp session. The workaround on windows home editions is to check the windows registry value HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\fDenyTSConnections --- bin/autoupdate.bat | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/bin/autoupdate.bat b/bin/autoupdate.bat index 4c68688..623ebeb 100644 --- a/bin/autoupdate.bat +++ b/bin/autoupdate.bat @@ -104,13 +104,25 @@ REM ------------------------------------------ REM 2) check if listener session rdp-tcp exist REM ------------------------------------------ set rdp_tcp_session="" -for /f "tokens=1-2* usebackq" %%a in ( - `query session rdp-tcp` -) do ( - set rdp_tcp_session=%%a - set rdp_tcp_session_id=%%b +set rdp_tcp_session_id=0 +if exist %windir%\system32\query.exe ( + for /f "tokens=1-2* usebackq" %%a in ( + `query session rdp-tcp` + ) do ( + set rdp_tcp_session=%%a + set /a rdp_tcp_session_id=%%b 2>NULL + ) +) else ( + for /f "tokens=2* usebackq" %%a in ( + `reg query "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v "fDenyTSConnections" 2^>nul` + ) do ( + if "%%a"=="REG_DWORD" ( + set rdp_tcp_session=AllowTSConnection + if "%%b"=="0x0" (set rdp_tcp_session_id=1) + ) + ) ) -if %rdp_tcp_session%=="" ( +if %rdp_tcp_session_id%==0 ( echo [-] Listener session rdp-tcp NOT found^^! call :install ) else (