Powershell import-module webadministration

Posted by David on Server Fault See other posts from Server Fault or by David
Published on 2010-03-30T09:42:40Z Indexed on 2010/03/30 9:43 UTC
Read the original article Hit count: 470

Filed under:
|
|

Every time I execute this command invoke-command -computername REMOTEPC -scriptblock { import-module WebAdministration; new-item "$env:systemdrive\inetpub\testsite" -type directory; New-WebSite -Name TestSite -Port 81 -PhysicalPath "$env:systemdrive\inetpub\testsite" }

I get the following error

Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING)) + CategoryInfo : NotSpecified: (:) [Get-ChildItem], COMException + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.PowerShell.Commands.GetChildItemCommand

The website is created successfully as far as I can see.

The following command gives the same error when enumerating the testsite

Invoke-Command -computername REMOTEPC { import-module webadministration; dir -path IIS:\Sites\ }

Name ID State Physical Path Bindings PSComputerName Default Web Site 1 Started http *:80: REMOTEPC

Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING)) + CategoryInfo : NotSpecified: (:) [Get-ChildItem], COMException + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.PowerShell.Commands.GetChildItemCo mmand

Any suggestions would be appreciated

© Server Fault or respective owner

Related posts about powershell

Related posts about iis