Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iis 通过Invoke命令创建网站时引发异常_Iis_Powershell - Fatal编程技术网

Iis 通过Invoke命令创建网站时引发异常

Iis 通过Invoke命令创建网站时引发异常,iis,powershell,Iis,Powershell,我在呼叫指挥部 Invoke-Command -computername remotepc { Import-Module WebAdministration; New-Website -Name www.somesite.com -ApplicationPool www.somesite.com -hostHeader www.somesite.com -physicalPath c:\inetpub\wwwroot } 已在远程计算机上的IIS中成功创建网站。但是,当powershe

我在呼叫指挥部

Invoke-Command  -computername remotepc { 
Import-Module WebAdministration; 
New-Website -Name www.somesite.com -ApplicationPool www.somesite.com -hostHeader www.somesite.com -physicalPath c:\inetpub\wwwroot }
已在远程计算机上的IIS中成功创建网站。但是,当powershell返回时,将显示一条异常消息:

Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING))
    + CategoryInfo          : NotSpecified: (:) [New-Website], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.IIs.PowerShell.Provider.NewWebsite
   Command
有人知道我为什么会收到此消息以及我如何解决此问题吗?

您能试试:

$var = New-Website ...
不确定,但
新建网站
返回PowerShell远程会话尝试序列化失败的对象