I use powershell to automate the configuration of websites in my IIS. I have the following code that creates a web application pool for me
New-WebAppPool "NewAppPool"
But before creating the pool, I want to check if the pool exists or not. How should I do it?
Please note: there is no IIS disk on my system. And therefore, commands that have IIS are mentioned in the path, for example, the following fail :
$IISPath = "IIS:\AppPools"
cd $IISPath
if (Test-Path ".\NewAppPool") { Write-Host "NewAppPool exists." }
source
share