{"id":30260,"date":"2023-05-29T11:48:21","date_gmt":"2023-05-29T03:48:21","guid":{"rendered":"http:\/\/www.idc.net\/help\/?p=30260"},"modified":"2023-05-29T11:48:21","modified_gmt":"2023-05-29T03:48:21","slug":"windows%e7%b3%bb%e7%bb%9f%e6%9b%b4%e6%94%b9%e8%ae%a1%e7%ae%97%e6%9c%ba%e4%b8%8a%e7%9a%84%e8%bf%9c%e7%a8%8b%e6%a1%8c%e9%9d%a2%e7%9a%84%e4%be%a6%e5%90%ac%e7%ab%af%e5%8f%a3","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/30260\/","title":{"rendered":"Windows\u7cfb\u7edf\u66f4\u6539\u8ba1\u7b97\u673a\u4e0a\u7684\u8fdc\u7a0b\u684c\u9762\u7684\u4fa6\u542c\u7aef\u53e3"},"content":{"rendered":"<p><main id=\"main\" class=\"\" dir=\"ltr\" lang=\"zh-cn\" role=\"main\" data-bi-name=\"content\"><\/p>\n<div class=\"content \">\n<blockquote><p>\u9002\u7528\u8303\u56f4\uff1aWindows Server 2022\u3001Windows 10\u3001Windows 8.1\u3001Windows 8\u3001Windows Server 2019\u3001Windows Server 2016\u3001Windows Server 2012 R2\u3001Windows Server 2008 R2<\/p><\/blockquote>\n<p>\u901a\u8fc7\u8fdc\u7a0b\u684c\u9762\u5ba2\u6237\u7aef\u8fde\u63a5\u5230\u8ba1\u7b97\u673a\uff08Windows \u5ba2\u6237\u7aef\u6216 Windows Server\uff09\u65f6\uff0c\u8ba1\u7b97\u673a\u4e0a\u7684\u8fdc\u7a0b\u684c\u9762\u529f\u80fd\u4f1a\u901a\u8fc7\u5b9a\u4e49\u7684\u4fa6\u542c\u7aef\u53e3\uff08\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e3a 3389\uff09\u201c\u4fa6\u542c\u201d\u8fde\u63a5\u8bf7\u6c42\u3002 \u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u6ce8\u518c\u8868\u6765\u66f4\u6539 Windows \u8ba1\u7b97\u673a\u4e0a\u7684\u4fa6\u542c\u7aef\u53e3\u3002<\/p>\n<ol>\n<li>\u542f\u52a8\u6ce8\u518c\u8868\u7f16\u8f91\u5668\u3002 \uff08\u5728\u201c\u641c\u7d22\u201d\u6846\u4e2d\u952e\u5165 regedit\u3002\uff09<\/li>\n<li>\u5bfc\u822a\u5230\u4ee5\u4e0b\u6ce8\u518c\u8868\u5b50\u9879\uff1a<strong>HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp<\/strong><\/li>\n<li>\u67e5\u627e\u7aef\u53e3\u53f7<\/li>\n<li>\u5355\u51fb\u201c\u7f16\u8f91\u201d&gt;\u201c\u4fee\u6539\u201d\uff0c\u7136\u540e\u5355\u51fb\u201c\u5341\u8fdb\u5236\u201d\u3002<\/li>\n<li>\u952e\u5165\u65b0\u7aef\u53e3\u53f7\uff0c\u7136\u540e\u5355\u51fb\u201c\u786e\u5b9a\u201d \u3002<\/li>\n<li>\u5173\u95ed\u6ce8\u518c\u8868\u7f16\u8f91\u5668\uff0c\u7136\u540e\u91cd\u65b0\u542f\u52a8\u8ba1\u7b97\u673a\u3002<\/li>\n<\/ol>\n<p>\u4e0b\u6b21\u4f7f\u7528\u8fdc\u7a0b\u684c\u9762\u8fde\u63a5\u8fde\u63a5\u5230\u6b64\u8ba1\u7b97\u673a\u65f6\uff0c\u5fc5\u987b\u952e\u5165\u65b0\u7aef\u53e3\u3002 \u5982\u679c\u6b63\u5728\u4f7f\u7528\u9632\u706b\u5899\uff0c\u8bf7\u786e\u4fdd\u5c06\u9632\u706b\u5899\u914d\u7f6e\u4e3a\u5141\u8bb8\u8fde\u63a5\u5230\u65b0\u7aef\u53e3\u53f7\u3002<\/p>\n<p>\u53ef\u8fd0\u884c\u4ee5\u4e0b PowerShell \u547d\u4ee4\u6765\u67e5\u770b\u5f53\u524d\u7aef\u53e3\uff1a<\/p>\n<div id=\"code-try-0\" class=\"codeHeader\" data-bi-name=\"code-header\"><\/div>\n<pre class=\"has-inner-focus\" tabindex=\"0\" role=\"group\" aria-label=\"\u53ef\u6c34\u5e73\u6eda\u52a8\u7684\u4ee3\u7801\"><code class=\"lang-powershell\" data-author-content=\"Get-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp' -name &quot;PortNumber&quot;\r\n\"><span class=\"hljs-pscommand\">Get-ItemProperty<\/span><span class=\"hljs-parameter\"> -Path<\/span> <span class=\"hljs-string\">'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp'<\/span><span class=\"hljs-parameter\"> -name<\/span> <span class=\"hljs-string\">\"PortNumber\"<\/span>\r\n<\/code><\/pre>\n<p>\u4f8b\u5982\uff1a<\/p>\n<div id=\"code-try-1\" class=\"codeHeader\" data-bi-name=\"code-header\">\n<div class=\"successful-copy-alert position-absolute right-0 top-0 left-0 bottom-0 display-flex align-items-center justify-content-center has-text-success-invert has-background-success is-transparent\" aria-hidden=\"true\"><\/div>\n<\/div>\n<pre class=\"has-inner-focus\" tabindex=\"0\" role=\"group\" aria-label=\"\u53ef\u6c34\u5e73\u6eda\u52a8\u7684\u4ee3\u7801\"><code class=\"lang-powershell\" data-author-content=\"PortNumber   : 3389\r\nPSPath       : Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp\r\nPSParentPath : Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\r\nPSChildName  : RDP-Tcp\r\nPSDrive      : HKLM\r\nPSProvider   : Microsoft.PowerShell.Core\\Registry\r\n\">PortNumber   : <span class=\"hljs-number\">3389<\/span>\r\nPSPath       : Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\<span class=\"hljs-pscommand\">RDP-Tcp<\/span>\r\nPSParentPath : Microsoft.PowerShell.Core\\Registry::HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\r\nPSChildName  : <span class=\"hljs-pscommand\">RDP-Tcp<\/span>\r\nPSDrive      : HKLM\r\nPSProvider   : Microsoft.PowerShell.Core\\Registry\r\n<\/code><\/pre>\n<p>\u8fd8\u53ef\u8fd0\u884c\u4ee5\u4e0b PowerShell \u547d\u4ee4\u6765\u66f4\u6539 RDP \u7aef\u53e3\u3002 \u5728\u6b64\u547d\u4ee4\u4e2d\uff0c\u6211\u4eec\u4f1a\u5c06\u65b0\u7684 RDP \u7aef\u53e3\u6307\u5b9a\u4e3a 3390\u3002<\/p>\n<p>\u82e5\u8981\u5411\u6ce8\u518c\u8868\u6dfb\u52a0\u65b0\u7684 RDP \u7aef\u53e3\uff1a<\/p>\n<div id=\"code-try-2\" class=\"codeHeader\" data-bi-name=\"code-header\">\n<div class=\"successful-copy-alert position-absolute right-0 top-0 left-0 bottom-0 display-flex align-items-center justify-content-center has-text-success-invert has-background-success is-transparent\" aria-hidden=\"true\"><\/div>\n<\/div>\n<pre class=\"has-inner-focus\" tabindex=\"0\" role=\"group\" aria-label=\"\u53ef\u6c34\u5e73\u6eda\u52a8\u7684\u4ee3\u7801\"><code class=\"lang-powershell\" data-author-content=\"$portvalue = 3390\r\n\r\nSet-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp' -name &quot;PortNumber&quot; -Value $portvalue \r\n\r\nNew-NetFirewallRule -DisplayName 'RDPPORTLatest-TCP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol TCP -LocalPort $portvalue \r\nNew-NetFirewallRule -DisplayName 'RDPPORTLatest-UDP-In' -Profile 'Public' -Direction Inbound -Action Allow -Protocol UDP -LocalPort $portvalue \r\n\"><span class=\"hljs-variable\">$portvalue<\/span> = <span class=\"hljs-number\">3390<\/span>\r\n\r\n<span class=\"hljs-pscommand\">Set-ItemProperty<\/span><span class=\"hljs-parameter\"> -Path<\/span> <span class=\"hljs-string\">'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\WinStations\\RDP-Tcp'<\/span><span class=\"hljs-parameter\"> -name<\/span> <span class=\"hljs-string\">\"PortNumber\"<\/span><span class=\"hljs-parameter\"> -Value<\/span> <span class=\"hljs-variable\">$portvalue<\/span> \r\n\r\n<span class=\"hljs-pscommand\">New-NetFirewallRule<\/span><span class=\"hljs-parameter\"> -DisplayName<\/span> <span class=\"hljs-string\">'RDPPORTLatest-TCP-In'<\/span><span class=\"hljs-parameter\"> -Profile<\/span> <span class=\"hljs-string\">'Public'<\/span><span class=\"hljs-parameter\"> -Direction<\/span> Inbound<span class=\"hljs-parameter\"> -Action<\/span> Allow<span class=\"hljs-parameter\"> -Protocol<\/span> TCP<span class=\"hljs-parameter\"> -LocalPort<\/span> <span class=\"hljs-variable\">$portvalue<\/span> \r\n<span class=\"hljs-pscommand\">New-NetFirewallRule<\/span><span class=\"hljs-parameter\"> -DisplayName<\/span> <span class=\"hljs-string\">'RDPPORTLatest-UDP-In'<\/span><span class=\"hljs-parameter\"> -Profile<\/span> <span class=\"hljs-string\">'Public'<\/span><span class=\"hljs-parameter\"> -Direction<\/span> Inbound<span class=\"hljs-parameter\"> -Action<\/span> Allow<span class=\"hljs-parameter\"> -Protocol<\/span> UDP<span class=\"hljs-parameter\"> -LocalPort<\/span> <span class=\"hljs-variable\">$portvalue<\/span> \r\n<\/code><\/pre>\n<\/div>\n<div id=\"assertive-live-region\" class=\"visually-hidden\" role=\"alert\" aria-live=\"assertive\" aria-relevant=\"additions\" aria-atomic=\"true\"><\/div>\n<div id=\"polite-live-region\" class=\"visually-hidden\" role=\"status\" aria-live=\"polite\" aria-relevant=\"additions\" aria-atomic=\"true\"><\/div>\n<p><\/main><\/p>\n<section id=\"recommendations-section\" class=\"display-none-print margin-bottom-md margin-bottom-none-desktop\" data-bi-name=\"recommendations\">\n<h2 id=\"recommended-content\" class=\"title is-3 margin-top-sm\"><\/h2>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>\u9002\u7528\u8303\u56f4\uff1aWindows Server 2022\u3001Windows 10\u3001Windows 8.1\u3001Windows [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,7018],"tags":[],"class_list":["post-30260","post","type-post","status-publish","format-standard","hentry","category-windows","category-7018"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/30260","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=30260"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/30260\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=30260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=30260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=30260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}