Powershell New-WebApplication

Viewed 15014
[Void][Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Administration")

New-WebApplication -Name 'testApp' -Site 'Default Web Site' -PhysicalPath c:\test -ApplicationPool DefaultAppPool 

That is the contents of test.ps1. When I run .\test.ps1 I get the following error.

New-WebApplication : Cannot retrieve the dynamic parameters for the cmdlet. Retrieving the COM class factory for compon ent with CLSID {688EEEE5-6A7E-422F-B2E1-6AF00DC944A6} failed due to the following error: 80040154. At C:\code\work\users\mchevett\test.ps1:6 char:19 + New-WebApplication <<<< -Name 'testApp' -Site 'Default Web Site' -PhysicalPath c:\test -ApplicationPool DefaultAppPo ol + CategoryInfo : InvalidArgument: (:) [New-WebApplication], ParameterBindingException + FullyQualifiedErrorId : GetDynamicParametersException,Microsoft.IIs.PowerShell.Provider.NewWebApplicationCommand

This error message is not helping me at all. Any ideas how to get a better error message? Thanks for reading!

2 Answers

Changing Platform target to "x64" in project solution build properties worked for me:

screenshot of configuration page

Related