【发布时间】:2019-06-15 10:00:41
【问题描述】:
调用封装停止 IIS 应用程序池的函数。为什么 Stop-WebAppPool 的“名称”参数会有问题?我唯一能看到的是因为它在一个脚本块内?
错误:
无法验证参数“名称”上的参数。参数为空。 为参数提供一个有效值,然后尝试运行 再次命令。
function StopAppPool() {
param(
[string] $siteName = "",
[string] $serverName = ""
);
$session = New-PSSession -ComputerName $serverName
Invoke-Command -ComputerName $serverName -ScriptBlock { Stop-WebAppPool -Name $siteName }
}
# -- entry here
StopAppPool -siteName "my.test-server.web" -serverName "DEV-MYTEST1"
【问题讨论】:
标签: powershell powershell-remoting