{"id":46691,"date":"2025-07-30T03:57:13","date_gmt":"2025-07-29T19:57:13","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/46691.html"},"modified":"2025-07-30T03:57:13","modified_gmt":"2025-07-29T19:57:13","slug":"%e5%91%8a%e5%88%ab%e6%89%8b%e5%8a%a8%e8%bf%81%e7%a7%bb%ef%bc%9a%e4%bd%bf%e7%94%a8-powershell-%e4%b8%80%e9%94%ae%e5%af%bc%e5%87%ba-iis-%e9%85%8d%e7%bd%ae%ef%bc%8c%e8%ae%a9%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/46691.html","title":{"rendered":"\u544a\u522b\u624b\u52a8\u8fc1\u79fb\uff1a\u4f7f\u7528 PowerShell \u4e00\u952e\u5bfc\u51fa IIS \u914d\u7f6e\uff0c\u8ba9\u670d\u52a1\u5668\u8fc1\u79fb\u66f4\u8f7b\u677e"},"content":{"rendered":"<p>\u5927\u5bb6\u597d&#xff0c;\u4eca\u5929\u6211\u4eec\u6765\u804a\u4e00\u4e2a\u8fd0\u7ef4\u548c\u5f00\u53d1\u540c\u5b66\u7ecf\u5e38\u4f1a\u9047\u5230\u7684\u201c\u751c\u871c\u7684\u70e6\u607c\u201d\u2014\u2014\u670d\u52a1\u5668\u8fc1\u79fb\u3002\u7279\u522b\u662f\u5f53\u6211\u4eec\u9762\u5bf9\u4e00\u53f0\u914d\u7f6e\u4e86\u591a\u4e2a\u7f51\u7ad9\u3001\u5e94\u7528\u6c60\u548c SSL \u8bc1\u4e66\u7684 IIS \u670d\u52a1\u5668\u65f6&#xff0c;\u624b\u52a8\u8bb0\u5f55\u548c\u5728\u65b0\u670d\u52a1\u5668\u4e0a\u91cd\u65b0\u914d\u7f6e&#xff0c;\u4e0d\u4ec5\u8017\u65f6\u8017\u529b&#xff0c;\u8fd8\u6781\u6613\u51fa\u9519\u3002<\/p>\n<p>\u60f3\u8c61\u4e00\u4e0b&#xff0c;\u56e0\u4e3a\u9057\u6f0f\u4e86\u4e00\u4e2a\u5173\u952e\u7684\u7ed1\u5b9a\u6216\u73af\u5883\u53d8\u91cf&#xff0c;\u5bfc\u81f4\u7f51\u7ad9\u5728\u65b0\u670d\u52a1\u5668\u4e0a\u65e0\u6cd5\u542f\u52a8&#xff0c;\u90a3\u79cd\u5728\u6df1\u591c\u6392\u67e5\u95ee\u9898\u7684\u611f\u89c9&#xff0c;\u76f8\u4fe1\u8c01\u4e5f\u4e0d\u60f3\u4f53\u9a8c\u3002<\/p>\n<p>\u5e78\u8fd0\u7684\u662f&#xff0c;Windows Server \u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u81ea\u52a8\u5316\u5de5\u5177\u2014\u2014PowerShell\u3002\u901a\u8fc7\u5b83&#xff0c;\u6211\u4eec\u53ef\u4ee5\u5c06\u7e41\u7410\u7684\u914d\u7f6e\u5bfc\u51fa\u5de5\u4f5c\u53d8\u6210\u4e00\u4e2a\u53ef\u4ee5\u4e00\u952e\u6267\u884c\u7684\u811a\u672c\u3002\u8fd9\u7bc7\u6587\u7ae0\u5c06\u5e26\u5927\u5bb6\u4e00\u6b65\u6b65\u6784\u5efa\u4e00\u4e2a\u5b9e\u7528\u7684 PowerShell \u811a\u672c&#xff0c;\u7528\u4e8e\u81ea\u52a8\u5316\u6536\u96c6\u548c\u6253\u5305 IIS \u7684\u6838\u5fc3\u914d\u7f6e\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250729195707-688927936f97b.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h5>\u4e3a\u4ec0\u4e48\u9009\u62e9\u81ea\u52a8\u5316&#xff1f;<\/h5>\n<p>\u5728\u6df1\u5165\u811a\u672c\u4e4b\u524d&#xff0c;\u6211\u4eec\u5148\u660e\u786e\u4e00\u4e0b\u4e3a\u4ec0\u4e48\u81ea\u52a8\u5316\u662f\u6700\u4f73\u9009\u62e9&#xff1a;<\/p>\n<ul>\n<li>\u51c6\u786e\u6027&#xff1a;\u811a\u672c\u4f1a\u5fe0\u5b9e\u5730\u6267\u884c\u6bcf\u4e00\u4e2a\u547d\u4ee4&#xff0c;\u5f7b\u5e95\u907f\u514d\u56e0\u624b\u52a8\u64cd\u4f5c\u5bfc\u81f4\u7684\u4eba\u4e3a\u9519\u8bef\u3002<\/li>\n<li>\u6548\u7387&#xff1a;\u53ea\u9700\u8fd0\u884c\u4e00\u4e2a\u811a\u672c&#xff0c;\u51e0\u5206\u949f\u5185\u5c31\u80fd\u5b8c\u6210\u8fc7\u53bb\u53ef\u80fd\u9700\u8981\u6570\u5c0f\u65f6\u7684\u624b\u52a8\u5de5\u4f5c\u3002<\/li>\n<li>\u53ef\u91cd\u590d\u6027&#xff1a;\u65e0\u8bba\u662f\u8fc1\u79fb\u6d4b\u8bd5\u73af\u5883\u8fd8\u662f\u751f\u4ea7\u73af\u5883&#xff0c;\u811a\u672c\u90fd\u80fd\u63d0\u4f9b\u4e00\u81f4\u7684\u8f93\u51fa&#xff0c;\u4fdd\u8bc1\u4e86\u8fc1\u79fb\u8fc7\u7a0b\u7684\u6807\u51c6\u5316\u3002<\/li>\n<li>\u914d\u7f6e\u5373\u6587\u6863&#xff1a;\u5bfc\u51fa\u7684\u914d\u7f6e\u6587\u4ef6\u672c\u8eab\u5c31\u662f\u4e00\u4efd\u5b8c\u7f8e\u7684\u670d\u52a1\u5668\u914d\u7f6e\u6587\u6863&#xff0c;\u4fbf\u4e8e\u5ba1\u8ba1\u548c\u672a\u6765\u67e5\u9605\u3002<\/li>\n<\/ul>\n<h5>\u51c6\u5907\u5de5\u4f5c<\/h5>\n<p>\u5728\u8fd0\u884c\u811a\u672c\u4e4b\u524d&#xff0c;\u8bf7\u786e\u4fdd\u6ee1\u8db3\u4ee5\u4e0b\u6761\u4ef6&#xff1a;<\/p>\n<li>\u7ba1\u7406\u5458\u6743\u9650&#xff1a;\u9700\u8981\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c PowerShell&#xff0c;\u56e0\u4e3a\u8bbf\u95ee IIS \u914d\u7f6e\u548c\u5bfc\u51fa\u8bc1\u4e66\u9700\u8981\u63d0\u5347\u7684\u6743\u9650\u3002<\/li>\n<li>PowerShell \u6267\u884c\u7b56\u7565&#xff1a;\u4e3a\u4e86\u80fd\u591f\u8fd0\u884c\u672c\u5730\u811a\u672c&#xff0c;\u53ef\u80fd\u9700\u8981\u8c03\u6574\u6267\u884c\u7b56\u7565\u3002\u53ef\u4ee5\u5728\u7ba1\u7406\u5458 PowerShell \u7a97\u53e3\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4&#xff1a;<span class=\"token function\">Set-ExecutionPolicy<\/span> <span class=\"token operator\">&#8211;<\/span>ExecutionPolicy RemoteSigned <span class=\"token operator\">&#8211;<\/span>Scope <span class=\"token keyword\">Process<\/span>\n<p>\u8fd9\u5c06\u5728\u5f53\u524d\u4f1a\u8bdd\u4e2d\u5141\u8bb8\u8fd0\u884c\u672a\u7b7e\u540d\u7684\u672c\u5730\u811a\u672c\u3002<\/li>\n<li>WebAdministration \u6a21\u5757&#xff1a;\u5982\u679c\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u4e86 IIS&#xff0c;\u90a3\u4e48 WebAdministration \u6a21\u5757\u901a\u5e38\u5df2\u7ecf\u53ef\u7528\u3002\u811a\u672c\u5c06\u5229\u7528\u6b64\u6a21\u5757\u6765\u4e0e IIS \u8fdb\u884c\u4ea4\u4e92\u3002<\/li>\n<h5>\u6838\u5fc3\u811a\u672c\u89e3\u6790<\/h5>\n<p>\u6211\u4eec\u7684\u76ee\u6807\u662f\u521b\u5efa\u4e00\u4e2a\u811a\u672c&#xff0c;\u5b83\u80fd\u505a\u5230&#xff1a;<\/p>\n<li>\u5bfc\u51fa\u5b8c\u6574\u7684 IIS \u914d\u7f6e&#xff08;\u7ad9\u70b9\u3001\u5e94\u7528\u6c60\u3001\u7ed1\u5b9a\u7b49&#xff09;\u3002<\/li>\n<li>\u5bfc\u51fa\u6240\u6709\u4e0e\u7f51\u7ad9\u7ed1\u5b9a\u7684 SSL \u8bc1\u4e66&#xff08;\u8fd9\u662f\u6700\u5bb9\u6613\u88ab\u9057\u5fd8\u7684\u90e8\u5206&#xff01;&#xff09;\u3002<\/li>\n<li>\u5c06\u6240\u6709\u5bfc\u51fa\u7684\u6587\u4ef6\u6253\u5305\u6210\u4e00\u4e2a\u72ec\u7acb\u7684 .zip \u6587\u4ef6&#xff0c;\u65b9\u4fbf\u4f20\u8f93\u3002<\/li>\n<p>\u4e0b\u9762\u5c31\u662f\u6211\u4eec\u7cbe\u5fc3\u8bbe\u8ba1\u7684 PowerShell \u811a\u672c\u3002<\/p>\n<p><span class=\"token comment\">&lt;#<br \/>\n.SYNOPSIS<br \/>\n    Automates the export of IIS configurations and associated SSL certificates.<\/p>\n<p>.DESCRIPTION<br \/>\n    This script performs a comprehensive backup of an IIS server&#039;s configuration. It exports:<br \/>\n    1. The entire applicationHost.config using appcmd.<br \/>\n    2. A list of all websites and application pools to CSV files for easy review.<br \/>\n    3. All SSL certificates found in the local machine&#039;s personal store, secured with a password.<br \/>\n    Finally, it compresses all exported files into a single ZIP archive for easy migration.<\/p>\n<p>.NOTES<br \/>\n    Author: Your Tech Blogger<br \/>\n    Version: 1.0<br \/>\n    Run this script with Administrator privileges.<br \/>\n#&gt;<\/span><\/p>\n<p><span class=\"token comment\"># &#8212; 1. \u521d\u59cb\u5316\u53d8\u91cf\u548c\u73af\u5883 &#8212;<\/span><\/p>\n<p><span class=\"token comment\"># \u8bbe\u7f6e\u5bfc\u51fa\u6587\u4ef6\u7684\u6839\u76ee\u5f55<\/span><br \/>\n<span class=\"token variable\">$exportBasePath<\/span> &#061; <span class=\"token string\">&#034;C:\\\\IIS_Export_<span class=\"token function\">$<span class=\"token punctuation\">(<\/span><span class=\"token function\">Get-Date<\/span> <span class=\"token operator\">&#8211;<\/span>Format <span class=\"token string\">&#039;yyyyMMdd_HHmm&#039;<\/span><span class=\"token punctuation\">)<\/span><\/span>&#034;<\/span><br \/>\n<span class=\"token comment\"># \u8bbe\u7f6e\u5bfc\u51fa\u8bc1\u4e66\u65f6\u4f7f\u7528\u7684\u5bc6\u7801\u3002\u8bf7\u52a1\u5fc5\u4fee\u6539\u4e3a\u4e00\u4e2a\u5f3a\u5bc6\u7801&#xff01;<\/span><br \/>\n<span class=\"token variable\">$certificatePassword<\/span> &#061; <span class=\"token string\">&#034;YourStrongPasswordHere!&#034;<\/span> <\/p>\n<p><span class=\"token comment\"># \u68c0\u67e5\u5e76\u521b\u5efa\u5bfc\u51fa\u76ee\u5f55<\/span><br \/>\n<span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token operator\">-not<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token function\">Test-Path<\/span> <span class=\"token operator\">&#8211;<\/span>Path <span class=\"token variable\">$exportBasePath<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u521b\u5efa\u5bfc\u51fa\u76ee\u5f55: <span class=\"token variable\">$exportBasePath<\/span>&#034;<\/span><br \/>\n    <span class=\"token function\">New-Item<\/span> <span class=\"token operator\">&#8211;<\/span>Path <span class=\"token variable\">$exportBasePath<\/span> <span class=\"token operator\">&#8211;<\/span>ItemType Directory <span class=\"token punctuation\">|<\/span> <span class=\"token function\">Out-Null<\/span><br \/>\n<span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">else<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u5bfc\u51fa\u76ee\u5f55\u5df2\u5b58\u5728&#xff0c;\u5c06\u4f7f\u7528: <span class=\"token variable\">$exportBasePath<\/span>&#034;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#034;<\/span><br \/>\n<span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u5f00\u59cb\u5bfc\u51fa IIS \u914d\u7f6e&#8230;&#034;<\/span><br \/>\n<span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u5bfc\u51fa\u76ee\u5f55: <span class=\"token variable\">$exportBasePath<\/span>&#034;<\/span><br \/>\n<span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#034;<\/span><\/p>\n<p><span class=\"token comment\"># &#8212; 2. \u5bfc\u51fa\u5b8c\u6574\u7684 IIS \u914d\u7f6e &#8212;<\/span><\/p>\n<p><span class=\"token comment\"># \u4f7f\u7528 appcmd.exe&#xff0c;\u8fd9\u662f\u5bfc\u51fa\u548c\u6062\u590d IIS \u914d\u7f6e\u6700\u53ef\u9760\u7684\u5de5\u5177<\/span><br \/>\n<span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u6b63\u5728\u5bfc\u51fa applicationHost.config&#8230;&#034;<\/span><br \/>\n&amp; <span class=\"token variable\">$env<\/span>:windir\\\\system32\\\\inetsrv\\\\appcmd<span class=\"token punctuation\">.<\/span>exe list config <span class=\"token operator\">&#8211;<\/span>xml &gt; <span class=\"token string\">&#034;<span class=\"token variable\">$exportBasePath<\/span>\\\\applicationHost.config.xml&#034;<\/span><br \/>\n<span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>$?<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u2705 \u6210\u529f: \u5b8c\u6574\u7684 IIS \u914d\u7f6e\u5df2\u5bfc\u51fa\u3002&#034;<\/span> <span class=\"token operator\">&#8211;<\/span>ForegroundColor Green<br \/>\n<span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">else<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u274c \u5931\u8d25: \u5bfc\u51fa IIS \u914d\u7f6e\u65f6\u51fa\u9519\u3002&#034;<\/span> <span class=\"token operator\">&#8211;<\/span>ForegroundColor Red<br \/>\n    <span class=\"token keyword\">exit<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\"># &#8212; 3. \u5bfc\u51fa\u7f51\u7ad9\u548c\u5e94\u7528\u6c60\u5217\u8868 (\u7528\u4e8e\u6587\u6863\u548c\u5ba1\u67e5) &#8212;<\/span><\/p>\n<p><span class=\"token comment\"># \u5bfc\u5165 WebAdministration \u6a21\u5757<\/span><br \/>\n<span class=\"token function\">Import-Module<\/span> WebAdministration<\/p>\n<p><span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u6b63\u5728\u5bfc\u51fa\u7f51\u7ad9\u5217\u8868&#8230;&#034;<\/span><br \/>\n<span class=\"token function\">Get-Website<\/span> <span class=\"token punctuation\">|<\/span> <span class=\"token function\">Select-Object<\/span> Name<span class=\"token punctuation\">,<\/span> Id<span class=\"token punctuation\">,<\/span> State<span class=\"token punctuation\">,<\/span> PhysicalPath<span class=\"token punctuation\">,<\/span><br \/>\n    &#064;<span class=\"token punctuation\">{<\/span>n&#061;<span class=\"token string\">&#039;Bindings&#039;<\/span><span class=\"token punctuation\">;<\/span>e&#061;<span class=\"token punctuation\">{<\/span><span class=\"token variable\">$_<\/span><span class=\"token punctuation\">.<\/span>bindings<span class=\"token punctuation\">.<\/span>collection <span class=\"token punctuation\">|<\/span> <span class=\"token operator\">%<\/span> <span class=\"token punctuation\">{<\/span><span class=\"token string\">&#034;<span class=\"token function\">$<span class=\"token punctuation\">(<\/span><span class=\"token variable\">$_<\/span><span class=\"token punctuation\">.<\/span>protocol<span class=\"token punctuation\">)<\/span><\/span>:\/\/<span class=\"token function\">$<span class=\"token punctuation\">(<\/span><span class=\"token variable\">$_<\/span><span class=\"token punctuation\">.<\/span>bindinginformation<span class=\"token punctuation\">)<\/span><\/span>&#034;<\/span><span class=\"token punctuation\">}<\/span> <span class=\"token punctuation\">|<\/span> <span class=\"token function\">Out-String<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">}<\/span> <span class=\"token punctuation\">|<\/span><br \/>\n    <span class=\"token function\">Export-Csv<\/span> <span class=\"token operator\">&#8211;<\/span>Path <span class=\"token string\">&#034;<span class=\"token variable\">$exportBasePath<\/span>\\\\Websites_List.csv&#034;<\/span> <span class=\"token operator\">&#8211;<\/span>NoTypeInformation <span class=\"token operator\">&#8211;<\/span>Encoding UTF8<br \/>\n<span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u2705 \u6210\u529f: \u7f51\u7ad9\u5217\u8868\u5df2\u5bfc\u51fa\u5230 Websites_List.csv\u3002&#034;<\/span> <span class=\"token operator\">&#8211;<\/span>ForegroundColor Green<\/p>\n<p><span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u6b63\u5728\u5bfc\u51fa\u5e94\u7528\u6c60\u5217\u8868&#8230;&#034;<\/span><br \/>\n<span class=\"token function\">Get-WebAppPool<\/span> <span class=\"token punctuation\">|<\/span> <span class=\"token function\">Select-Object<\/span> Name<span class=\"token punctuation\">,<\/span> State<span class=\"token punctuation\">,<\/span> ManagedRuntimeVersion<span class=\"token punctuation\">,<\/span> ManagedPipelineMode<span class=\"token punctuation\">,<\/span><br \/>\n    &#064;<span class=\"token punctuation\">{<\/span>n&#061;<span class=\"token string\">&#039;Identity&#039;<\/span><span class=\"token punctuation\">;<\/span>e&#061;<span class=\"token punctuation\">{<\/span><span class=\"token variable\">$_<\/span><span class=\"token punctuation\">.<\/span>processmodel<span class=\"token punctuation\">.<\/span>identitytype<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">,<\/span><br \/>\n    &#064;<span class=\"token punctuation\">{<\/span>n&#061;<span class=\"token string\">&#039;Username&#039;<\/span><span class=\"token punctuation\">;<\/span>e&#061;<span class=\"token punctuation\">{<\/span><span class=\"token variable\">$_<\/span><span class=\"token punctuation\">.<\/span>processmodel<span class=\"token punctuation\">.<\/span>username<span class=\"token punctuation\">}<\/span><span class=\"token punctuation\">}<\/span> <span class=\"token punctuation\">|<\/span><br \/>\n    <span class=\"token function\">Export-Csv<\/span> <span class=\"token operator\">&#8211;<\/span>Path <span class=\"token string\">&#034;<span class=\"token variable\">$exportBasePath<\/span>\\\\AppPools_List.csv&#034;<\/span> <span class=\"token operator\">&#8211;<\/span>NoTypeInformation <span class=\"token operator\">&#8211;<\/span>Encoding UTF8<br \/>\n<span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u2705 \u6210\u529f: \u5e94\u7528\u6c60\u5217\u8868\u5df2\u5bfc\u51fa\u5230 AppPools_List.csv\u3002&#034;<\/span> <span class=\"token operator\">&#8211;<\/span>ForegroundColor Green<\/p>\n<p><span class=\"token comment\"># &#8212; 4. \u5bfc\u51fa SSL \u8bc1\u4e66 &#8212;<\/span><\/p>\n<p><span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u6b63\u5728\u5bfc\u51fa SSL \u8bc1\u4e66&#8230;&#034;<\/span><br \/>\n<span class=\"token comment\"># \u5c06\u5bc6\u7801\u8f6c\u6362\u4e3a\u5b89\u5168\u5b57\u7b26\u4e32&#xff0c;\u8fd9\u662f Export-PfxCertificate \u7684\u8981\u6c42<\/span><br \/>\n<span class=\"token variable\">$securePassword<\/span> &#061; <span class=\"token function\">ConvertTo-SecureString<\/span> <span class=\"token operator\">&#8211;<\/span>String <span class=\"token variable\">$certificatePassword<\/span> <span class=\"token operator\">&#8211;<\/span>AsPlainText <span class=\"token operator\">&#8211;<\/span>Force<\/p>\n<p><span class=\"token comment\"># \u83b7\u53d6\u4e2a\u4eba\u8bc1\u4e66\u5b58\u50a8\u533a (My\/Personal) \u4e2d\u7684\u6240\u6709\u8bc1\u4e66<\/span><br \/>\n<span class=\"token variable\">$certs<\/span> &#061; <span class=\"token function\">Get-ChildItem<\/span> <span class=\"token operator\">&#8211;<\/span>Path Cert:\\\\LocalMachine\\\\My<\/p>\n<p><span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token variable\">$certs<\/span><span class=\"token punctuation\">.<\/span>Count <span class=\"token operator\">-eq<\/span> 0<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u26a0\ufe0f \u8b66\u544a: \u5728\u672c\u5730\u8ba1\u7b97\u673a\u7684\u4e2a\u4eba\u5b58\u50a8\u4e2d\u672a\u627e\u5230\u4efb\u4f55\u8bc1\u4e66\u3002&#034;<\/span> <span class=\"token operator\">&#8211;<\/span>ForegroundColor Yellow<br \/>\n<span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">else<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">foreach<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token variable\">$cert<\/span> in <span class=\"token variable\">$certs<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token comment\"># \u53ea\u5bfc\u51fa\u5305\u542b\u79c1\u94a5\u7684\u8bc1\u4e66&#xff0c;\u56e0\u4e3a\u8fd9\u4e9b\u662f\u7528\u4e8e HTTPS \u7ed1\u5b9a\u7684\u8bc1\u4e66<\/span><br \/>\n        <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token variable\">$cert<\/span><span class=\"token punctuation\">.<\/span>HasPrivateKey<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token variable\">$exportPath<\/span> &#061; <span class=\"token function\">Join-Path<\/span> <span class=\"token operator\">&#8211;<\/span>Path <span class=\"token variable\">$exportBasePath<\/span> <span class=\"token operator\">&#8211;<\/span>ChildPath <span class=\"token string\">&#034;<span class=\"token function\">$<span class=\"token punctuation\">(<\/span><span class=\"token variable\">$cert<\/span><span class=\"token punctuation\">.<\/span>Thumbprint<span class=\"token punctuation\">)<\/span><\/span>.pfx&#034;<\/span><br \/>\n            <span class=\"token keyword\">try<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n                <span class=\"token function\">Export-PfxCertificate<\/span> <span class=\"token operator\">&#8211;<\/span>Cert <span class=\"token variable\">$cert<\/span> <span class=\"token operator\">&#8211;<\/span>FilePath <span class=\"token variable\">$exportPath<\/span> <span class=\"token operator\">&#8211;<\/span>Password <span class=\"token variable\">$securePassword<\/span><br \/>\n                <span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u2705 \u6210\u529f: \u5df2\u5bfc\u51fa\u8bc1\u4e66 <span class=\"token function\">$<span class=\"token punctuation\">(<\/span><span class=\"token variable\">$cert<\/span><span class=\"token punctuation\">.<\/span>Subject<span class=\"token punctuation\">)<\/span><\/span> (\u6307\u7eb9: <span class=\"token function\">$<span class=\"token punctuation\">(<\/span><span class=\"token variable\">$cert<\/span><span class=\"token punctuation\">.<\/span>Thumbprint<span class=\"token punctuation\">)<\/span><\/span>)&#034;<\/span> <span class=\"token operator\">&#8211;<\/span>ForegroundColor Green<br \/>\n            <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">catch<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n                <span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u274c \u5931\u8d25: \u5bfc\u51fa\u8bc1\u4e66 <span class=\"token function\">$<span class=\"token punctuation\">(<\/span><span class=\"token variable\">$cert<\/span><span class=\"token punctuation\">.<\/span>Subject<span class=\"token punctuation\">)<\/span><\/span> \u65f6\u51fa\u9519\u3002\u9519\u8bef\u4fe1\u606f: <span class=\"token function\">$<span class=\"token punctuation\">(<\/span><span class=\"token variable\">$_<\/span><span class=\"token punctuation\">.<\/span>Exception<span class=\"token punctuation\">.<\/span>Message<span class=\"token punctuation\">)<\/span><\/span>&#034;<\/span> <span class=\"token operator\">&#8211;<\/span>ForegroundColor Red<br \/>\n            <span class=\"token punctuation\">}<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\"># &#8212; 5. \u6253\u5305\u6240\u6709\u6587\u4ef6 &#8212;<\/span><\/p>\n<p><span class=\"token variable\">$zipFilePath<\/span> &#061; <span class=\"token string\">&#034;C:\\\\IIS_Export_<span class=\"token function\">$<span class=\"token punctuation\">(<\/span><span class=\"token function\">Get-Date<\/span> <span class=\"token operator\">&#8211;<\/span>Format <span class=\"token string\">&#039;yyyyMMdd_HHmm&#039;<\/span><span class=\"token punctuation\">)<\/span><\/span>.zip&#034;<\/span><br \/>\n<span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#034;<\/span><br \/>\n<span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u6b63\u5728\u5c06\u6240\u6709\u5bfc\u51fa\u7684\u6587\u4ef6\u538b\u7f29\u5230: <span class=\"token variable\">$zipFilePath<\/span>&#034;<\/span><\/p>\n<p><span class=\"token function\">Compress-Archive<\/span> <span class=\"token operator\">&#8211;<\/span>Path <span class=\"token string\">&#034;<span class=\"token variable\">$exportBasePath<\/span>\\\\*&#034;<\/span> <span class=\"token operator\">&#8211;<\/span>DestinationPath <span class=\"token variable\">$zipFilePath<\/span> <span class=\"token operator\">&#8211;<\/span>Force<\/p>\n<p><span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>$?<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u2705 \u6210\u529f: \u6240\u6709\u6587\u4ef6\u5df2\u6210\u529f\u6253\u5305&#xff01;&#034;<\/span> <span class=\"token operator\">&#8211;<\/span>ForegroundColor Green<br \/>\n    <span class=\"token comment\"># (\u53ef\u9009) \u6e05\u7406\u4e34\u65f6\u5bfc\u51fa\u6587\u4ef6\u5939<\/span><br \/>\n    <span class=\"token comment\"># Remove-Item -Path $exportBasePath -Recurse -Force<\/span><br \/>\n    <span class=\"token comment\"># Write-Host &#034;\u5df2\u6e05\u7406\u4e34\u65f6\u6587\u4ef6\u5939: $exportBasePath&#034;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">else<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u274c \u5931\u8d25: \u521b\u5efa ZIP \u538b\u7f29\u5305\u65f6\u51fa\u9519\u3002&#034;<\/span> <span class=\"token operator\">&#8211;<\/span>ForegroundColor Red<br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;&#034;<\/span><br \/>\n<span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;&#x1f389; IIS \u914d\u7f6e\u5bfc\u51fa\u5b8c\u6210&#xff01;&#x1f389;&#034;<\/span><br \/>\n<span class=\"token function\">Write-Host<\/span> <span class=\"token string\">&#034;\u8fc1\u79fb\u5305\u5df2\u4fdd\u5b58\u5230: <span class=\"token variable\">$zipFilePath<\/span>&#034;<\/span><\/p>\n<h5>\u5982\u4f55\u4f7f\u7528\u811a\u672c<\/h5>\n<li>\u4fdd\u5b58\u811a\u672c&#xff1a;\u5c06\u4e0a\u9762\u7684\u4ee3\u7801\u590d\u5236\u5e76\u4fdd\u5b58\u5230\u4e00\u4e2a\u6587\u4ef6\u4e2d&#xff0c;\u4f8b\u5982 Export-IIS-Config.ps1\u3002<\/li>\n<li>\u4fee\u6539\u5bc6\u7801&#xff1a;\u6253\u5f00\u811a\u672c\u6587\u4ef6&#xff0c;\u5c06 $certificatePassword \u53d8\u91cf\u7684\u503c\u4fee\u6539\u4e3a\u4e00\u4e2a\u6211\u4eec\u81ea\u5df1\u8bbe\u5b9a\u7684\u3001\u8db3\u591f\u5f3a\u5ea6\u7684\u5bc6\u7801\u3002\u8bf7\u52a1\u5fc5\u8bb0\u4f4f\u8fd9\u4e2a\u5bc6\u7801&#xff0c;\u56e0\u4e3a\u5728\u65b0\u670d\u52a1\u5668\u4e0a\u5bfc\u5165\u8bc1\u4e66\u65f6\u9700\u8981\u7528\u5230\u5b83\u3002<\/li>\n<li>\u8fd0\u884c\u811a\u672c&#xff1a;\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u6253\u5f00 PowerShell&#xff0c;\u5bfc\u822a\u5230\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55&#xff0c;\u7136\u540e\u8fd0\u884c\u5b83&#xff1a;<span class=\"token punctuation\">.<\/span>\\\\<span class=\"token function\">Export-IIS<\/span><span class=\"token operator\">&#8211;<\/span>Config<span class=\"token punctuation\">.<\/span>ps1<br \/>\n&#096;&#096;&#096;4<span class=\"token punctuation\">.<\/span>  <span class=\"token operator\">*<\/span><span class=\"token operator\">*<\/span>\u83b7\u53d6\u7ed3\u679c<span class=\"token operator\">*<\/span><span class=\"token operator\">*<\/span>&#xff1a;\u811a\u672c\u6267\u884c\u5b8c\u6bd5\u540e&#xff0c;\u6211\u4eec\u4f1a\u5728 C \u76d8\u6839\u76ee\u5f55\u4e0b\u627e\u5230\u4e00\u4e2a\u540d\u4e3a &#096;IIS_Export_YYYYMMDD_HHMM<span class=\"token punctuation\">.<\/span>zip&#096; \u7684\u538b\u7f29\u5305\u3002\u8fd9\u4e2a\u5305\u91cc\u5305\u542b\u4e86\u6211\u4eec\u8fc1\u79fb\u6240\u9700\u7684\u6240\u6709\u914d\u7f6e\u4fe1\u606f\u3002<\/p>\n<\/li>\n<h5>\u8fc1\u79fb\u5230\u65b0\u670d\u52a1\u5668&#xff1a;\u6062\u590d\u914d\u7f6e\u7684\u8981\u70b9<\/h5>\n<p>\u6709\u4e86\u5bfc\u51fa\u7684\u914d\u7f6e\u5305&#xff0c;\u5728\u65b0\u670d\u52a1\u5668\u4e0a\u6062\u590d\u5c31\u53d8\u5f97\u7b80\u5355\u591a\u4e86&#xff0c;\u4f46\u4ecd\u9700\u6ce8\u610f\u4ee5\u4e0b\u51e0\u70b9&#xff1a;<\/p>\n<li>\u5b89\u88c5 IIS \u89d2\u8272&#xff1a;\u786e\u4fdd\u65b0\u670d\u52a1\u5668\u4e0a\u5df2\u7ecf\u5b89\u88c5\u4e86\u4e0e\u65e7\u670d\u52a1\u5668\u76f8\u540c\u6216\u66f4\u9ad8\u7248\u672c\u7684 IIS&#xff0c;\u5e76\u4e14\u5305\u542b\u4e86\u6240\u6709\u5fc5\u9700\u7684\u89d2\u8272\u670d\u52a1&#xff08;\u5982 ASP.NET\u3001WebSocket \u7b49&#xff09;\u3002<\/li>\n<li>\u5bfc\u5165\u8bc1\u4e66&#xff1a;\u5c06 .pfx \u6587\u4ef6\u62f7\u8d1d\u5230\u65b0\u670d\u52a1\u5668&#xff0c;\u7136\u540e\u901a\u8fc7 IIS \u7ba1\u7406\u5668\u6216\u8bc1\u4e66\u7ba1\u7406\u63a7\u5236\u53f0&#xff08;certlm.msc&#xff09;&#xff0c;\u4f7f\u7528\u6211\u4eec\u4e4b\u524d\u8bbe\u7f6e\u7684\u5bc6\u7801&#xff0c;\u5c06\u5b83\u4eec\u9010\u4e00\u5bfc\u5165\u5230\u201c\u672c\u5730\u8ba1\u7b97\u673a -&gt; \u4e2a\u4eba -&gt; \u8bc1\u4e66\u201d\u5b58\u50a8\u533a\u3002<\/li>\n<li>\u6062\u590d\u914d\u7f6e&#xff1a;\u5c06 applicationHost.config.xml \u6587\u4ef6\u62f7\u8d1d\u5230\u65b0\u670d\u52a1\u5668\u3002\u4f7f\u7528 appcmd \u547d\u4ee4\u6765\u6062\u590d\u914d\u7f6e\u3002\u6ce8\u610f&#xff1a; \u76f4\u63a5\u8986\u76d6 applicationHost.config \u6587\u4ef6\u6709\u98ce\u9669&#xff0c;\u63a8\u8350\u4f7f\u7528 appcmd \u7684\u589e\u91cf\u6062\u590d\u529f\u80fd\u3002<span class=\"token comment\"># \u5207\u6362\u5230 inetsrv \u76ee\u5f55<\/span><br \/>\ncd <span class=\"token variable\">$env<\/span>:windir\\\\system32\\\\inetsrv\\\\<\/p>\n<p><span class=\"token comment\"># \u6062\u590d\u914d\u7f6e\u524d&#xff0c;\u5f3a\u70c8\u5efa\u8bae\u5148\u5907\u4efd\u65b0\u670d\u52a1\u5668\u7684\u5f53\u524d\u914d\u7f6e&#xff01;<\/span><br \/>\n<span class=\"token punctuation\">.<\/span>\\\\appcmd<span class=\"token punctuation\">.<\/span>exe add backup <span class=\"token string\">&#034;Before-Migration-Restore&#034;<\/span><\/p>\n<p><span class=\"token comment\"># \u4ece\u6211\u4eec\u7684\u5bfc\u51fa\u6587\u4ef6\u4e2d\u6062\u590d\u914d\u7f6e<\/span><br \/>\n<span class=\"token punctuation\">.<\/span>\\\\appcmd<span class=\"token punctuation\">.<\/span>exe restore config <span class=\"token operator\">-in<\/span>:<span class=\"token string\">&#034;C:\\\\Path\\\\To\\\\Your\\\\applicationHost.config.xml&#034;<\/span><\/p>\n<\/li>\n<li>\u68c0\u67e5\u7269\u7406\u8def\u5f84&#xff1a;appcmd \u4e0d\u4f1a\u5e2e\u6211\u4eec\u8fc1\u79fb\u7f51\u7ad9\u7684\u7269\u7406\u6587\u4ef6&#xff08;.dll\u3001.html\u3001\u56fe\u7247\u7b49&#xff09;\u3002\u6211\u4eec\u9700\u8981\u624b\u52a8\u5c06\u7f51\u7ad9\u6587\u4ef6\u62f7\u8d1d\u5230\u65b0\u670d\u52a1\u5668&#xff0c;\u5e76\u786e\u4fdd applicationHost.config \u4e2d\u6307\u5b9a\u7684 physicalPath \u4e0e\u5b9e\u9645\u8def\u5f84\u4e00\u81f4\u3002\u5982\u679c\u4e0d\u4e00\u81f4&#xff0c;\u9700\u8981\u624b\u52a8\u4fee\u6539\u6216\u901a\u8fc7 IIS \u7ba1\u7406\u5668\u91cd\u65b0\u6307\u5b9a\u3002<\/li>\n<h5>\u603b\u7ed3<\/h5>\n<p>\u81ea\u52a8\u5316\u662f\u73b0\u4ee3 IT \u8fd0\u7ef4\u7684\u57fa\u77f3\u3002\u901a\u8fc7 PowerShell&#xff0c;\u6211\u4eec\u53ef\u4ee5\u5c06\u590d\u6742\u3001\u6613\u9519\u7684 IIS \u8fc1\u79fb\u4efb\u52a1\u8f6c\u53d8\u4e3a\u4e00\u4e2a\u7b80\u5355\u3001\u53ef\u9760\u7684\u81ea\u52a8\u5316\u6d41\u7a0b\u3002\u4eca\u5929\u5206\u4eab\u7684\u8fd9\u4e2a\u811a\u672c\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u8d77\u70b9&#xff0c;\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u7279\u5b9a\u9700\u6c42\u8fdb\u884c\u4fee\u6539\u548c\u6269\u5c55&#xff0c;\u6bd4\u5982\u589e\u52a0\u5bf9\u7279\u5b9a\u5e94\u7528\u7a0b\u5e8f\u914d\u7f6e\u6587\u4ef6&#xff08;web.config&#xff09;\u6216\u6ce8\u518c\u8868\u9879\u7684\u5907\u4efd\u3002<\/p>\n<p>\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u5e2e\u52a9\u5927\u5bb6\u4e0b\u6b21\u9762\u5bf9\u670d\u52a1\u5668\u8fc1\u79fb\u65f6&#xff0c;\u80fd\u591f\u66f4\u52a0\u4ece\u5bb9\u548c\u81ea\u4fe1\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb935\u6b21\uff0c\u70b9\u8d5e17\u6b21\uff0c\u6536\u85cf30\u6b21\u3002\u81ea\u52a8\u5316\u662f\u73b0\u4ee3 IT \u8fd0\u7ef4\u7684\u57fa\u77f3\u3002\u901a\u8fc7 PowerShell\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u590d\u6742\u3001\u6613\u9519\u7684 IIS \u8fc1\u79fb\u4efb\u52a1\u8f6c\u53d8\u4e3a\u4e00\u4e2a\u7b80\u5355\u3001\u53ef\u9760\u7684\u81ea\u52a8\u5316\u6d41\u7a0b\u3002\u4eca\u5929\u5206\u4eab\u7684\u8fd9\u4e2a\u811a\u672c\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u8d77\u70b9\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u7279\u5b9a\u9700\u6c42\u8fdb\u884c\u4fee\u6539\u548c\u6269\u5c55\uff0c\u6bd4\u5982\u589e\u52a0\u5bf9\u7279\u5b9a\u5e94\u7528\u7a0b\u5e8f\u914d\u7f6e\u6587\u4ef6\uff08`web.config`\uff09\u6216\u6ce8\u518c\u8868\u9879\u7684\u5907\u4efd\u3002<\/p>\n","protected":false},"author":2,"featured_media":46690,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[4456,149,43,271,44],"topic":[],"class_list":["post-46691","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-powershell","tag-windows","tag-43","tag-271","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u544a\u522b\u624b\u52a8\u8fc1\u79fb\uff1a\u4f7f\u7528 PowerShell \u4e00\u952e\u5bfc\u51fa IIS \u914d\u7f6e\uff0c\u8ba9\u670d\u52a1\u5668\u8fc1\u79fb\u66f4\u8f7b\u677e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/46691.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u544a\u522b\u624b\u52a8\u8fc1\u79fb\uff1a\u4f7f\u7528 PowerShell \u4e00\u952e\u5bfc\u51fa IIS \u914d\u7f6e\uff0c\u8ba9\u670d\u52a1\u5668\u8fc1\u79fb\u66f4\u8f7b\u677e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb935\u6b21\uff0c\u70b9\u8d5e17\u6b21\uff0c\u6536\u85cf30\u6b21\u3002\u81ea\u52a8\u5316\u662f\u73b0\u4ee3 IT \u8fd0\u7ef4\u7684\u57fa\u77f3\u3002\u901a\u8fc7 PowerShell\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u590d\u6742\u3001\u6613\u9519\u7684 IIS \u8fc1\u79fb\u4efb\u52a1\u8f6c\u53d8\u4e3a\u4e00\u4e2a\u7b80\u5355\u3001\u53ef\u9760\u7684\u81ea\u52a8\u5316\u6d41\u7a0b\u3002\u4eca\u5929\u5206\u4eab\u7684\u8fd9\u4e2a\u811a\u672c\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u8d77\u70b9\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u7279\u5b9a\u9700\u6c42\u8fdb\u884c\u4fee\u6539\u548c\u6269\u5c55\uff0c\u6bd4\u5982\u589e\u52a0\u5bf9\u7279\u5b9a\u5e94\u7528\u7a0b\u5e8f\u914d\u7f6e\u6587\u4ef6\uff08`web.config`\uff09\u6216\u6ce8\u518c\u8868\u9879\u7684\u5907\u4efd\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/46691.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-29T19:57:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250729195707-688927936f97b.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/46691.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/46691.html\",\"name\":\"\u544a\u522b\u624b\u52a8\u8fc1\u79fb\uff1a\u4f7f\u7528 PowerShell \u4e00\u952e\u5bfc\u51fa IIS \u914d\u7f6e\uff0c\u8ba9\u670d\u52a1\u5668\u8fc1\u79fb\u66f4\u8f7b\u677e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-07-29T19:57:13+00:00\",\"dateModified\":\"2025-07-29T19:57:13+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/46691.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/46691.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/46691.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u544a\u522b\u624b\u52a8\u8fc1\u79fb\uff1a\u4f7f\u7528 PowerShell \u4e00\u952e\u5bfc\u51fa IIS \u914d\u7f6e\uff0c\u8ba9\u670d\u52a1\u5668\u8fc1\u79fb\u66f4\u8f7b\u677e\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u544a\u522b\u624b\u52a8\u8fc1\u79fb\uff1a\u4f7f\u7528 PowerShell \u4e00\u952e\u5bfc\u51fa IIS \u914d\u7f6e\uff0c\u8ba9\u670d\u52a1\u5668\u8fc1\u79fb\u66f4\u8f7b\u677e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/46691.html","og_locale":"zh_CN","og_type":"article","og_title":"\u544a\u522b\u624b\u52a8\u8fc1\u79fb\uff1a\u4f7f\u7528 PowerShell \u4e00\u952e\u5bfc\u51fa IIS \u914d\u7f6e\uff0c\u8ba9\u670d\u52a1\u5668\u8fc1\u79fb\u66f4\u8f7b\u677e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb935\u6b21\uff0c\u70b9\u8d5e17\u6b21\uff0c\u6536\u85cf30\u6b21\u3002\u81ea\u52a8\u5316\u662f\u73b0\u4ee3 IT \u8fd0\u7ef4\u7684\u57fa\u77f3\u3002\u901a\u8fc7 PowerShell\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u590d\u6742\u3001\u6613\u9519\u7684 IIS \u8fc1\u79fb\u4efb\u52a1\u8f6c\u53d8\u4e3a\u4e00\u4e2a\u7b80\u5355\u3001\u53ef\u9760\u7684\u81ea\u52a8\u5316\u6d41\u7a0b\u3002\u4eca\u5929\u5206\u4eab\u7684\u8fd9\u4e2a\u811a\u672c\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u8d77\u70b9\uff0c\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u7279\u5b9a\u9700\u6c42\u8fdb\u884c\u4fee\u6539\u548c\u6269\u5c55\uff0c\u6bd4\u5982\u589e\u52a0\u5bf9\u7279\u5b9a\u5e94\u7528\u7a0b\u5e8f\u914d\u7f6e\u6587\u4ef6\uff08`web.config`\uff09\u6216\u6ce8\u518c\u8868\u9879\u7684\u5907\u4efd\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/46691.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-07-29T19:57:13+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250729195707-688927936f97b.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/46691.html","url":"https:\/\/www.wsisp.com\/helps\/46691.html","name":"\u544a\u522b\u624b\u52a8\u8fc1\u79fb\uff1a\u4f7f\u7528 PowerShell \u4e00\u952e\u5bfc\u51fa IIS \u914d\u7f6e\uff0c\u8ba9\u670d\u52a1\u5668\u8fc1\u79fb\u66f4\u8f7b\u677e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-07-29T19:57:13+00:00","dateModified":"2025-07-29T19:57:13+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/46691.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/46691.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/46691.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u544a\u522b\u624b\u52a8\u8fc1\u79fb\uff1a\u4f7f\u7528 PowerShell \u4e00\u952e\u5bfc\u51fa IIS \u914d\u7f6e\uff0c\u8ba9\u670d\u52a1\u5668\u8fc1\u79fb\u66f4\u8f7b\u677e"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/46691","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=46691"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/46691\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/46690"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=46691"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=46691"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=46691"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=46691"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}