Function Test-AppCommandPropertyExistsOnAppPool { <# .SYNOPSIS Set the property on an app pool using the appcmd.exe tool .PARAMETER Property [string] The property to set .PARAMETER AppPoolName [string] The name of the web application pool #> [CmdletBinding()] Param( [Parameter(Mandatory=$true, Position=0)] [Alias("Name")] [string]$Property, [Parameter(Mandatory=$true, Position=1)] [string]$AppPoolName ) ## TODO: cbrand ~ Replace with a call to a function to find this in the right place $appCmdPath = (Join-Path $env:systemroot "\system32\inetsrv\appcmd.exe") $returnValue = $false $propertiesFoundOn = @(& $appCmdPath list apppool $Property) foreach($PropertyReturned in $propertiesFoundOn) { if ($PropertyReturned -match $AppPoolName) { $returnValue = $false } } return $returnValue }