相关疑难解决方法(0)

获取"无法找到驱动器.名为'IIS'的驱动器不存在."

我编写了一个PowerShell脚本来自动部署IIS网站,但是当我将参数传递给脚本时,我收到以下错误:

找不到驱动器.名为"IIS"的驱动器不存在.

我的脚本(iss_website_version_update.ps1)如下所示,但请注意它还没有完成:

param(
[array]$iishostlist=$(throw "Parameter missing: -name iishostlist"),
[array]$websiteName=$(throw "Parameter missing: -name websiteName")
)

For($i=0;$i -lt $iishostlist.Count; $i++){
For($j=0;$j -lt  $websiteName.Count; $j++){
    $start = get-date
    $tempSession = new-pssession  -ComputerName  $($iishostlist[$i])
    Invoke-Command -Session $tempSession -ScriptBlock {
        C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -command Import-Module WebAdministration;set-location IIS:\;(Stop-Website $($websiteName[$j]))
        }
    .......
Run Code Online (Sandbox Code Playgroud)

请让我知道为什么命令set-location IIS:\;中的子命令 Invoke-Command不被识别?

iis powershell namespaces

37
推荐指数
3
解决办法
4万
查看次数

标签 统计

iis ×1

namespaces ×1

powershell ×1