Создал(а) 'rdpusers.cmd'

This commit is contained in:
pavel.muhortov 2022-12-12 15:54:43 +03:00
parent ada5e19312
commit 72ceed61e9

35
rdpusers.cmd Normal file
View File

@ -0,0 +1,35 @@
@echo off
goto :Start
--------------------------------------------------
RDS Shadow Connection
Positional parameters:
[1] <host> - hostname or address with sessions for connect
Administrator rights required
--------------------------------------------------
:Start
set host=localhost
if "%~1" NEQ "" set host=%~1
:Admin_Check
openfiles >nul 2>&1
if %errorLevel% == 0 (
set code=0
) else (
set code=5
cls
echo Restart this as Administrator!
pause
goto :Exit
)
:Session_Choice
quser /server:%host%
set /p rid="Enter RDP user ID for connect: "
start "" mstsc /shadow:%rid% /v:%host% /control /noConsentPrompt
:Exit
exit %code%