if I use get-website on an IIS machine everythign works fine. If I want to use the remoting capability in PowerShell v2 I get an error. I have PS v2 CTP 3 installed on client and IIS machine.
PS> Invoke-Command -Session $rsweb1 -ScriptBlock { Get-WebSite }
name : Default Web Site
id : 1
serverAutoStart : True
state : Started
bindings : Microsoft.IIs.PowerShell.Framework.ConfigurationElement
PSComputerName : web01
RunspaceId : f00a8440-0607-40fe-84d6-d1103a90e25b
PSShowComputerName : True
Attributes : {Microsoft.IIs.PowerShell.Framework.ConfigurationAttribute, Microsoft.IIs.PowerShell.Framework.Con
figurationAttribute, Microsoft.IIs.PowerShell.Framework.ConfigurationAttribute, Microsoft.IIs.Powe
rShell.Framework.ConfigurationAttribute}
ChildElements : {Microsoft.IIs.PowerShell.Framework.ConfigurationElement Microsoft.IIs.PowerShell.Framework.Config
urationElement Microsoft.IIs.PowerShell.Framework.ConfigurationElement Microsoft.IIs.PowerShell.Fr
amework.ConfigurationElement Microsoft.IIs.PowerShell.Framework.ConfigurationElement, Microsoft.II
s.PowerShell.Framework.ConfigurationElement, Microsoft.IIs.PowerShell.Framework.ConfigurationEleme
nt, Microsoft.IIs.PowerShell.Framework.ConfigurationElement...}
ElementTagName : site
Methods : {Microsoft.IIs.PowerShell.Framework.ConfigurationMethod, Microsoft.IIs.PowerShell.Framework.Config
urationMethod}
Schema : Microsoft.IIs.PowerShell.Framework.ConfigurationElementSchema
Invoke-Command : The data is invalid. (Exception from HRESULT: 0x8007000D)
At line:1 char:15
+ Invoke-Command <<<< -Session $rsweb1 -ScriptBlock { Get-WebSite }
+ CategoryInfo : NotSpecified: (:) [Get-Website], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.IIs.PowerShell.Provider.GetWebsite
Command
If I use
PS> Invoke-Command -Session $rsweb1 -ScriptBlock { Get-WebSite | Format-table }
Name ID State Physical Path Bindings
---- -- ----- ------------- --------
Default Web Site 1 Started %SystemDrive%\inetpub\wwwroot http *:80:
net.tcp 808:*
net.pipe *
net.msmq localhost
msmq.formatname localhost
the results are OK
I getthe same error with
Invoke-Command -Session $rsweb1 -ScriptBlock { Get-ChildItem iis:\sites }