【发布时间】:2020-04-03 04:52:22
【问题描述】:
我安装了 PowerShell 7.0 并开始了一些测试。以下脚本在 PowerShell 5.1 中正常工作。
Import-Module WebAdministration
Set-ItemProperty "IIS:\Sites\TestSite" -Name physicalPath -Value "D:\Dev\Test\Website\WebSiteDown"
在 PowerShell 7.0 中,我尝试更改导入以使用更新的“IISAdministration”模块而不是旧的“WebAdministration”。两个模块都出现同样的错误。
Set-ItemProperty: D:\Dev\OProTrunk\Website\WebSiteDown\OctopusCommand\Test.ps1:3
Line |
3 | Set-ItemProperty "IIS:\Sites\TestSite" -Name physicalPath -Value …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot find drive. A drive with the name 'IIS' does not exist.
两者都以管理员身份运行,以便能够更新网站物理路径。是否需要使用 PowerShell 7.0 格式化不同的属性?
【问题讨论】:
标签: powershell