I am using powershell to automate configuring websites in my IIS. I have the following code that creates a web application pool for me
#Creating a new Application Pool
New-WebAppPool "NewAppPool"
But before creating the pool, I want to check whether pool exists or not.How do I go about doing this?
Please note : There is no IIS Drive on my system. And hence commands which have IIS mentioned in the path like the following fail :
$IISPath = "IIS:\AppPools"
cd $IISPath
if (Test-Path ".\NewAppPool") { Write-Host "NewAppPool exists." }