diff --git a/windows/win_iis_webapppool.ps1 b/windows/win_iis_webapppool.ps1 index 6dcf7ec192c..858a151f2a3 100644 --- a/windows/win_iis_webapppool.ps1 +++ b/windows/win_iis_webapppool.ps1 @@ -101,12 +101,15 @@ try { # Result $pool = Get-Item IIS:\AppPools\$name -$result.info = @{ - name = $pool.Name - state = $pool.State - attributes = New-Object psobject @{} -}; - -$pool.Attributes | ForEach { $result.info.attributes.Add($_.Name, $_.Value)}; +if ($pool) +{ + $result.info = @{ + name = $pool.Name + state = $pool.State + attributes = New-Object psobject @{} + }; + + $pool.Attributes | ForEach { $result.info.attributes.Add($_.Name, $_.Value)}; +} Exit-Json $result