35 lines
		
	
	
		
			653 B
		
	
	
	
		
			Batchfile
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			653 B
		
	
	
	
		
			Batchfile
		
	
	
	
	
	
| @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% |