{"id":1186,"date":"2026-09-09T16:41:07","date_gmt":"2026-09-09T08:41:07","guid":{"rendered":"https:\/\/www.x4s.cn\/?p=1186"},"modified":"2026-09-09T16:41:07","modified_gmt":"2026-09-09T08:41:07","slug":"%e9%80%9a%e8%bf%87psexec%e5%bc%80%e5%90%af%e8%bf%9c%e7%a8%8b%e6%a1%8c%e9%9d%a2%ef%bc%8c%e5%b9%b6%e5%8f%96%e6%b6%88%e4%bb%85%e5%85%81%e8%ae%b8%e8%bf%90%e8%a1%8c%e4%bd%bf%e7%94%a8%e7%bd%91%e7%bb%9c","status":"publish","type":"post","link":"https:\/\/www.x4s.cn\/?p=1186","title":{"rendered":"\u901a\u8fc7psexec\u5f00\u542f\u8fdc\u7a0b\u684c\u9762\uff0c\u5e76\u53d6\u6d88\u4ec5\u5141\u8bb8\u8fd0\u884c\u4f7f\u7528\u7f51\u7edc\u7ea7\u522b\u8eab\u4efd\u9a8c\u8bc1\u7684\u8fdc\u7a0b\u684c\u9762\u7684\u8ba1\u7b97\u673a\u8fde\u63a5"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u5728\u4f01\u4e1a\u57df\u73af\u5883\u4e2d\uff0c\u4f7f\u7528 PsExec \u8fdc\u7a0b\u4fee\u6539\u6ce8\u518c\u8868\u5e76\u914d\u7f6e\u9632\u706b\u5899\uff0c\u662f\u6279\u91cf\u5f00\u542f\u8fdc\u7a0b\u684c\u9762\uff08RDP\uff09\u5e76\u5173\u95ed\u7f51\u7edc\u7ea7\u522b\u8eab\u4efd\u9a8c\u8bc1\uff08NLA\uff09\u7684\u6807\u51c6\u505a\u6cd5\u3002<br>\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5728\u76ee\u6807\u673a\u5668\u4e0a\u6267\u884c\uff1a<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">D:\\PSTools\\PsExec.exe \\F202300823 -u &#8220;.\\localroot&#8221; -p &#8220;Cmpw2026#chg$06&#8221; -s -h powershell -Command &#8220;Write-Host &#8216;\u6b63\u5728\u5f00\u542f\u8fdc\u7a0b\u684c\u9762&#8230;&#8217;; Set-ItemProperty -Path &#8216;HKLM:\\System\\CurrentControlSet\\Control\\Terminal Server&#8217; -Name fDenyTSConnections -Value 0; Write-Host &#8216;\u6b63\u5728\u5173\u95ed NLA \u9650\u5236&#8230;&#8217;; Set-ItemProperty -Path &#8216;HKLM:\\System\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp&#8217; -Name UserAuthentication -Value 0; Write-Host &#8216;\u6b63\u5728\u653e\u884c\u9632\u706b\u5899 3389 \u7aef\u53e3&#8230;&#8217;; New-NetFirewallRule -DisplayName &#8216;Allow RDP&#8217; -Direction Inbound -Protocol TCP -LocalPort 3389 -Action Allow -ErrorAction SilentlyContinue; Write-Host &#8216;\u6b63\u5728\u91cd\u542f\u8fdc\u7a0b\u684c\u9762\u670d\u52a1&#8230;&#8217;; Restart-Service -Name TermService -Force; Write-Host &#8216;\u914d\u7f6e\u5b8c\u6210\uff01'&#8221;<br><br><strong>1\u3001 \u547d\u4ee4\u6267\u884c\u903b\u8f91\u8bf4\u660e\uff1a<\/strong><br>\u5f00\u542f\u8fdc\u7a0b\u684c\u9762\uff1a\u4fee\u6539\u6ce8\u518c\u8868 fDenyTSConnections \u7684\u503c\u4e3a 0\uff0c\u5141\u8bb8\u8fdc\u7a0b\u8fde\u63a5\u3002<br>\u5173\u95ed NLA \u9650\u5236\uff1a\u4fee\u6539\u6ce8\u518c\u8868 UserAuthentication \u7684\u503c\u4e3a 0\uff0c\u53d6\u6d88\u52fe\u9009\u201c\u4ec5\u5141\u8bb8\u8fd0\u884c\u4f7f\u7528\u7f51\u7edc\u7ea7\u522b\u8eab\u4efd\u9a8c\u8bc1\u7684\u8fdc\u7a0b\u684c\u9762\u7684\u8ba1\u7b97\u673a\u8fde\u63a5\u201d\u3002<br>\u653e\u884c\u9632\u706b\u5899\uff1a\u521b\u5efa\u5165\u7ad9\u89c4\u5219\uff0c\u5141\u8bb8 TCP 3389 \u7aef\u53e3\u7684\u901a\u4fe1\u3002<br>\u91cd\u542f\u670d\u52a1\uff1a\u5f3a\u5236\u91cd\u542f TermService\uff08\u8fdc\u7a0b\u684c\u9762\u670d\u52a1\uff09\uff0c\u4f7f\u6ce8\u518c\u8868\u548c NLA \u7684\u4fee\u6539\u7acb\u5373\u751f\u6548\uff0c\u65e0\u9700\u91cd\u542f\u7535\u8111\u3002<br><br><strong>2\u3001\u5982\u679c\u4e0a\u8ff0 PowerShell \u547d\u4ee4\u62a5\u9519<\/strong><br>\u5728\u67d0\u4e9b\u7cbe\u7b80\u7248\u7cfb\u7edf\u6216\u7279\u6b8a\u6743\u9650\u73af\u5883\u4e0b\uff0cNew-NetFirewallRule \u6216 Restart-Service \u53ef\u80fd\u4f1a\u62a5\u9519\u3002\u5982\u679c\u9047\u5230\u8fd9\u79cd\u60c5\u51b5\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u7eaf CMD \u547d\u4ee4\u4f5c\u4e3a\u5907\u7528\u65b9\u6848\uff1a<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">D:\\PSTools\\PsExec.exe \\F202300823 -u &#8220;.\\localroot&#8221; -p &#8220;Cmpw2026#chg$06&#8221; -s -h cmd \/c &#8220;reg add HKLM\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server \/v fDenyTSConnections \/t REG_DWORD \/d 0 \/f &amp; reg add HKLM\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp \/v UserAuthentication \/t REG_DWORD \/d 0 \/f &amp; netsh advfirewall firewall set rule group=\u8fdc\u7a0b\u684c\u9762 new enable=Yes &amp; net stop TermService \/y &amp; net start TermService&#8221;<br><br>\u6267\u884c\u6210\u529f\u540e\uff0c\u4f60\u5c31\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 mstsc \u901a\u8fc7 IP \u5730\u5740\u548c\u8d26\u53f7\u5bc6\u7801\u8fde\u63a5\u8fd9\u53f0\u673a\u5668\u4e86\uff01<br><br>\u4e09\u3001\u6279\u91cf\u5f00\u542f\u8fdc\u7a0b\u684c\u9762\u7684\u4e24\u4e2a\u811a\u672c\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u786e\u4fdd\u4f60\u7684 D:\\PSTools\\ \u76ee\u5f55\u4e0b\u6709 PsExec.exe \u548c up950.txt\uff08\u6bcf\u884c\u4e00\u4e2a\u8ba1\u7b97\u673a\u540d\u6216IP\uff09\u3002<br>\u4e3a\u4e86\u65b9\u4fbf\u67e5\u770b\u7ed3\u679c\uff0c\u5efa\u8bae\u5c06\u4ee5\u4e0b\u811a\u672c\u4fdd\u5b58\u4e3a .bat \u6587\u4ef6\uff08\u4f8b\u5982 Batch_RDP.bat\uff09\uff0c\u7136\u540e\u53f3\u952e\u201c\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\u201d\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><br><strong>1\u3001\u7248\u672c\u4e00\uff1a\u6807\u51c6 PowerShell \u7248\uff08\u63a8\u8350\uff09<\/strong><br>\u8fd9\u4e2a\u7248\u672c\u4f7f\u7528 PowerShell \u539f\u751f\u547d\u4ee4\uff0c\u903b\u8f91\u6e05\u6670\uff0c\u4e14\u4f1a\u81ea\u52a8\u5904\u7406\u201c\u9632\u706b\u5899\u89c4\u5219\u5df2\u5b58\u5728\u201d\u7684\u62a5\u9519\u3002<br><br>@echo off<br>chcp 65001 >nul<br>echo ==========================================<br>echo \u6279\u91cf\u5f00\u542f\u8fdc\u7a0b\u684c\u9762\u5e76\u5173\u95edNLA\u9650\u5236<br>echo ==========================================<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">set PSEXEC=D:\\PSTools\\PsExec.exe<br>set LIST=D:\\PSTools\\up950.txt<br>set USER=.\\localroot<br>set PASS=Cmpw2026#chg$06<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">if not exist &#8220;%LIST%&#8221; (<br>echo [\u9519\u8bef] \u627e\u4e0d\u5230\u5217\u8868\u6587\u4ef6: %LIST%<br>pause<br>exit \/b<br>)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">for \/f &#8220;usebackq delims=&#8221; %%i in (&#8220;%LIST%&#8221;) do (<br>echo.<br>echo [\u6b63\u5728\u5904\u7406] %%i &#8230;<br>%PSEXEC% \\%%i -u &#8220;%USER%&#8221; -p &#8220;%PASS%&#8221; -s -h powershell -Command &#8220;Write-Host &#8216;\u6b63\u5728\u5f00\u542f\u8fdc\u7a0b\u684c\u9762&#8230;&#8217;; Set-ItemProperty -Path &#8216;HKLM:\\System\\CurrentControlSet\\Control\\Terminal Server&#8217; -Name fDenyTSConnections -Value 0; Write-Host &#8216;\u6b63\u5728\u5173\u95edNLA\u9650\u5236&#8230;&#8217;; Set-ItemProperty -Path &#8216;HKLM:\\System\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp&#8217; -Name UserAuthentication -Value 0; Write-Host &#8216;\u6b63\u5728\u653e\u884c\u9632\u706b\u58993389\u7aef\u53e3&#8230;&#8217;; New-NetFirewallRule -DisplayName &#8216;Allow RDP&#8217; -Direction Inbound -Protocol TCP -LocalPort 3389 -Action Allow -ErrorAction SilentlyContinue; Write-Host &#8216;\u6b63\u5728\u91cd\u542f\u8fdc\u7a0b\u684c\u9762\u670d\u52a1&#8230;&#8217;; Restart-Service -Name TermService -Force; Write-Host &#8216;\u914d\u7f6e\u5b8c\u6210\uff01'&#8221;<br>)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">echo.<br>echo ==========================================<br>echo \u6240\u6709\u673a\u5668\u5904\u7406\u5b8c\u6bd5\uff01<br>echo ==========================================<br>pause<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><br>2\u3001<strong>\u7248\u672c\u4e8c\uff1a\u7eaf CMD \u5907\u7528\u7248\uff08\u9632\u62a5\u9519\uff09<\/strong><br>\u5982\u679c\u67d0\u4e9b\u8001\u65e7\u673a\u5668\u6216\u7cbe\u7b80\u7248\u7cfb\u7edf\u6267\u884c PowerShell \u62a5\u9519\uff0c\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2a\u7eaf CMD \u7248\u672c\u3002\u5b83\u4f7f\u7528 netsh \u548c reg \u547d\u4ee4\uff0c\u517c\u5bb9\u6027\u6781\u5f3a\u3002<br>@echo off<br>chcp 65001 >nul<br>echo ==========================================<br>echo \u6279\u91cf\u5f00\u542f\u8fdc\u7a0b\u684c\u9762\u5e76\u5173\u95edNLA\u9650\u5236 (CMD\u7248)<br>echo ==========================================<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">set PSEXEC=D:\\PSTools\\PsExec.exe<br>set LIST=D:\\PSTools\\up950.txt<br>set USER=.\\localroot<br>set PASS=Cmpw2026#chg$06<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">if not exist &#8220;%LIST%&#8221; (<br>echo [\u9519\u8bef] \u627e\u4e0d\u5230\u5217\u8868\u6587\u4ef6: %LIST%<br>pause<br>exit \/b<br>)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">for \/f &#8220;usebackq delims=&#8221; %%i in (&#8220;%LIST%&#8221;) do (<br>echo.<br>echo [\u6b63\u5728\u5904\u7406] %%i &#8230;<br>%PSEXEC% \\%%i -u &#8220;%USER%&#8221; -p &#8220;%PASS%&#8221; -s -h cmd \/c &#8220;reg add HKLM\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server \/v fDenyTSConnections \/t REG_DWORD \/d 0 \/f &amp; reg add HKLM\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp \/v UserAuthentication \/t REG_DWORD \/d 0 \/f &amp; netsh advfirewall firewall set rule group=\u8fdc\u7a0b\u684c\u9762 new enable=Yes &amp; net stop TermService \/y &amp; net start TermService&#8221;<br>)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">echo.<br>echo ==========================================<br>echo \u6240\u6709\u673a\u5668\u5904\u7406\u5b8c\u6bd5\uff01<br>echo ==========================================<br>pause<br><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3\u3001\u811a\u672c\u6838\u5fc3\u903b\u8f91\u8bf4\u660e\uff1a<\/strong><br>usebackq delims=\uff1a\u9632\u6b62\u8ba1\u7b97\u673a\u540d\u4e2d\u5305\u542b\u7a7a\u683c\u6216\u7279\u6b8a\u5b57\u7b26\u65f6\u88ab\u622a\u65ad\u3002<br>-s -h\uff1a\u4ee5 SYSTEM \u6743\u9650\u8fd0\u884c\uff0c\u5e76\u9690\u85cf\u76ee\u6807\u673a\u5668\u7684\u63a7\u5236\u53f0\u7a97\u53e3\uff0c\u907f\u514d\u6253\u6270\u76ee\u6807\u673a\u5668\u7684\u5f53\u524d\u7528\u6237\u3002<br>Restart-Service -Name TermService -Force\uff1a\u4fee\u6539\u6ce8\u518c\u8868\u540e\uff0c\u5fc5\u987b\u91cd\u542f\u8be5\u670d\u52a1\u624d\u80fd\u7acb\u5373\u751f\u6548\uff0c\u5426\u5219\u53ef\u80fd\u9700\u8981\u7b49\u5f88\u4e45\u6216\u91cd\u542f\u7535\u8111\u3002<br>\u4f60\u53ef\u4ee5\u5148\u62ff F202300823 \u6d4b\u8bd5\u4e00\u4e0b\u8fd9\u4e24\u4e2a\u811a\u672c\uff0c\u770b\u770b\u54ea\u4e2a\u6267\u884c\u66f4\u987a\u7545\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u4f01\u4e1a\u57df\u73af\u5883\u4e2d\uff0c\u4f7f\u7528 PsExec \u8fdc\u7a0b\u4fee\u6539\u6ce8\u518c\u8868\u5e76\u914d\u7f6e\u9632\u706b\u5899\uff0c\u662f\u6279\u91cf\u5f00\u542f\u8fdc\u7a0b\u684c\u9762\uff08RDP\uff09\u5e76\u5173\u95ed\u7f51\u7edc\u7ea7\u522b\u8eab\u4efd<br \/><a class=\"moretag\" href=\"https:\/\/www.x4s.cn\/?p=1186\">+ Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":1151,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1186","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-it"],"_links":{"self":[{"href":"https:\/\/www.x4s.cn\/index.php?rest_route=\/wp\/v2\/posts\/1186","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.x4s.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.x4s.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.x4s.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.x4s.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1186"}],"version-history":[{"count":1,"href":"https:\/\/www.x4s.cn\/index.php?rest_route=\/wp\/v2\/posts\/1186\/revisions"}],"predecessor-version":[{"id":1187,"href":"https:\/\/www.x4s.cn\/index.php?rest_route=\/wp\/v2\/posts\/1186\/revisions\/1187"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.x4s.cn\/index.php?rest_route=\/wp\/v2\/media\/1151"}],"wp:attachment":[{"href":"https:\/\/www.x4s.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.x4s.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.x4s.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}