我需要远程添加一个应用程序池,并且我试图使用以下内容:
$script = {
Import-Module WebAdministration;
New-Item IIS:\AppPools\$IRTPoolName;
}
Invoke-Command -ComputerName $targetName -ScriptBlock $script -credential $cred -UseSSL问题是,一旦我运行它,我就会得到一个提示:
type:
我在身份验证方面没有任何问题,我可以调用其他命令,比如一个简单的dir,但不能调用那个命令。有什么想法吗?
发布于 2014-05-06 01:02:16
new-item cmdlet要求您指定一个类型,因为它不知道$IRTPoolName是什么。
Invoke-Command -ComputerName $targetName -ScriptBlock {
Param($IRTPoolName)
Import-Module WebAdministration
New-Item IIS:\AppPools\$IRTPoolName
} -ArgumentList $IRTPoolName -credential $cred -UseSSLhttp://www.powershellmagazine.com/2013/01/23/pstip-passing-local-variables-to-a-remote-session-in-powershell-3-0/
https://stackoverflow.com/questions/23483626
复制相似问题