# Numbering a list of App Pools

**URL:** <https://forums.powershell.org/t/numbering-a-list-of-app-pools/15998>\
**Category:** PowerShell Help\
**Created:** [March 17, 2021, 2:33pm UTC](https://forums.powershell.org/t/numbering-a-list-of-app-pools/15998 "2021-03-17T14:33:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![KHaydel](https://avatars.discourse-cdn.com/v4/letter/k/b77776/32.png) [@KHaydel](https://forums.powershell.org/u/KHaydel)\
**Post date:** [March 17, 2021, 2:33pm UTC](https://forums.powershell.org/t/numbering-a-list-of-app-pools/15998/1 "2021-03-17T14:33:46Z")

</div>

Hello Everyone,

I am by no means a PowerShell guru and could use some help.

I would like to list the available App Pools (Get-IISAppPool) on a server and assign a number (1, 2, 3, etc.) or letter (A, B, C, etc.) to each listed App Pool.

My desire is to be able to list the App Pools for a user and let them select a number or letter, by which the rest of the script would perform an action based on the number or letter selected.

Thanks in advance for your help.

---

<div class="post-metadata">

**Author:** ![ferc](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/ferc/32/2135_2.png) [@ferc](https://forums.powershell.org/u/ferc)\
**Post date:** [March 17, 2021, 3:32pm UTC](https://forums.powershell.org/t/numbering-a-list-of-app-pools/15998/2 "2021-03-17T15:32:13Z")

</div>

I am not familiar with Get-IISAppPool but assuming it has a name property and that is what you want to show in the list, you can try something like this. The user selects a number so you can use it as index for the array that stores the App Pools, but you must substract 1 because arrays start at 0 and it wouldn’t seem natural to have a menu that starts with 0.

```auto
$AppPools = Get-IISAppPool
$Index = 0

$AppPools |
ForEach-Object -Process {
    $Index ++
    Write-Host "$($Index). $($_.Name)"
}

$Selection = Read-Host "`nSelect a number"

$SelectedAppPool = $AppPools[($Selection - 1)]

$SelectedAppPool

```

---

<div class="post-metadata">

**Author:** ![KHaydel](https://avatars.discourse-cdn.com/v4/letter/k/b77776/32.png) [@KHaydel](https://forums.powershell.org/u/KHaydel)\
**Post date:** [March 18, 2021, 3:23pm UTC](https://forums.powershell.org/t/numbering-a-list-of-app-pools/15998/3 "2021-03-18T15:23:02Z")

</div>

That works great. Thank you for your help.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:27pm UTC](https://forums.powershell.org/t/numbering-a-list-of-app-pools/15998/4 "2024-05-16T20:27:01Z")

</div>


