Share via


Creating Web Application Pool Using PowerShell

Last evening I came across an issue while creating a Web Application Pool using PowerShell

Error Information:

Command: New-WebApppool -Name .NetExample

new-item : Parent node has no children of type appPool.
**Parameter name: path
At line:1 char:1

  • New-WebAppPool -Name .NetExample

    + CategoryInfo          : InvalidArgument: (:) [New-Item], ArgumentException
    + FullyQualifiedErrorId : Parent node has no children of type appPool.
Parameter name: path,Microsoft.PowerShell.Commands.NewItemCommand**

Fine, then I tried:

Command:

New-WebAppPool -Name ".NetExample"

new-item : Parent node has no children of type appPool.
**Parameter name: path
At line:1 char:1

  • New-WebAppPool -Name .NetExample

    + CategoryInfo          : InvalidArgument: (:) [New-Item], ArgumentException
    + FullyQualifiedErrorId : Parent node has no children of type appPool.
Parameter name: path,Microsoft.PowerShell.Commands.NewItemCommand**

Solution-1: Remove "." in the web app pool name instead used dot or in other way no special character.

Command:

New-WebAppPool -Name Dotnetexample

Bingo!!! Got it working !!!

PS C:\ New-WebAppPool -Name DotNetExample
**
Name                     State        Applications                                
----                     -----        ------------                                
DotNetExample            Started    **          

Solution-2: Using "." Special Character.

Code : This worked like charm!!!

[system.reflection.assembly]::Loadwithpartialname("Microsoft.Web.Administration")
$servermgr = New-Object Microsoft.web.administration.servermanager
$servermgr.ApplicationPools.Add(".NETExample")
$servermgr.CommitChanges()

                              

Website Traffic Statistics