klren0312 / daliy_knowledge

知识积累,正确使用方式是watch
22 stars 4 forks source link

win11开启远程桌面 #804

Open klren0312 opened 5 months ago

klren0312 commented 5 months ago

1. 下载rdpwraper

https://github.com/stascorp/rdpwrap/releases/tag/v1.6.2

1、RDPWInst.exe 使用管理员身份运行

2、install.bat 使用管理员身份运行

3、管理员运行RDPConf.exe 查看状态, 需要全绿色 1705382648435

最后一个如果没有绿色, 则需要执行下面的bat文件

2. 创建bat文件, 加入下面内容并执行, 更新配置文件

@echo off & title 更新RDPWrap.ini

set INI_Path="C:\Program Files\RDP Wrapper\rdpwrap.ini"
set INI_Dir="C:\Program Files\RDP Wrapper"

::检查权限
setlocal enabledelayedexpansion>nul
net session>nul
if !ERRORLEVEL! EQU 2 (
    set "args=!args: ="^&chr^(32^)^&"%!"

    set "args="/C"&chr(32)&chr(34)&chr(94)&chr(34)&"%~f0""
    mshta "vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe", !args!, NULL, "runas", NULL)(window.close)"&&exit
)

echo.正在停止远程桌面服务……
echo Y | net stop UmRdpService
echo Y | net stop TermService

::删除旧配置文件
:DeleteFile
del %INI_Path%
if exist %INI_Path% (
    echo.文件 %INI_Path% 仍被占用,请手动关闭占用该文件的程序。
    start "" %INI_Dir%
    pause
    goto :DeleteFile
)

echo.正在下载配置文件……
curl "https://raw.gitmirror.com/sebaxakerhtc/rdpwrap.ini/master/rdpwrap.ini">%INI_Path%

echo.正在重启远程桌面服务……
C:\WINDOWS\System32\svchost.exe -k NetworkService
net start TermService

echo.更新完成!按任意键以结束。
pause>nul

参考资料

https://zhuanlan.zhihu.com/p/600706130

https://blog.csdn.net/NXY666/article/details/121152969