How to get the IIS Application Pool names using PowerShell?

PowerShellMicrosoft TechnologiesSoftware & Coding

To get the IIS application pool names using PowerShell, you need to use the IIS PSDrive but for that, we need the IIS PowerShell module WebAdministration or IISAdministration on the server we are running the command.

If the WebAdministration module is already installed, use the below command to import the module.

Import-Module WebAdministration -Verbose

Once you Import the above module, you can see the IIS PSDrive will be activated in the current session.

To get all the application Pools run the below command,

Get-ChildItem IIS:\AppPools\

Output

Name                     State        Applications
----                     -----        ------------
.NET v2.0                Started
.NET v2.0 Classic        Started
.NET v4.5                Started
.NET v4.5 Classic        Started
Classic .NET AppPool     Started
DefaultAppPool           Started      Default Web Site

To retrieve the particular app pool name use the Get-Item command,

Get-Item IIS:\AppPools\DefaultAppPool

Output

Name                     State        Applications
----                     -----        ------------
DefaultAppPool           Started      Default Web Site

Another simple method is by using the Get-IISAppPool command of the IISAdministration module.

Import-Module IISAdministration -Verbose

Use the Get-IISAppPool command.

Name                 Status       CLR Ver  Pipeline Mode  Start Mode
----                 ------       -------  -------------  ----------
DefaultAppPool       Started      v4.0     Integrated     OnDemand
Classic .NET AppPool Started      v2.0     Classic        OnDemand
.NET v2.0 Classic    Started      v2.0     Classic        OnDemand
.NET v2.0            Started      v2.0     Integrated     OnDemand
.NET v4.5 Classic    Started      v4.0     Classic        OnDemand
.NET v4.5            Started      v4.0     Integrated     OnDemand

For the particular app pool use the -Name property,

Get-IISAppPool -Name DefaultAppPool
raja
Published on 28-Apr-2021 13:34:52
Advertisements