Powershell import-module webadministration
- by David
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