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
This commit is contained in:
asmtron 2020-09-13 13:23:00 +00:00 committed by GitHub
parent 4e4870391c
commit c3ed3490f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 6 deletions

View File

@ -104,13 +104,25 @@ REM ------------------------------------------
REM 2) check if listener session rdp-tcp exist REM 2) check if listener session rdp-tcp exist
REM ------------------------------------------ REM ------------------------------------------
set rdp_tcp_session="" set rdp_tcp_session=""
for /f "tokens=1-2* usebackq" %%a in ( set rdp_tcp_session_id=0
if exist %windir%\system32\query.exe (
for /f "tokens=1-2* usebackq" %%a in (
`query session rdp-tcp` `query session rdp-tcp`
) do ( ) do (
set rdp_tcp_session=%%a set rdp_tcp_session=%%a
set rdp_tcp_session_id=%%b 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^^! echo [-] Listener session rdp-tcp NOT found^^!
call :install call :install
) else ( ) else (