Merge pull request #1116 from marcind/devel
Fix IIS module null refs when removing objects on a server running PowerShell 4
This commit is contained in:
commit
445daf372d
1 changed files with 10 additions and 7 deletions
|
@ -101,12 +101,15 @@ try {
|
||||||
|
|
||||||
# Result
|
# Result
|
||||||
$pool = Get-Item IIS:\AppPools\$name
|
$pool = Get-Item IIS:\AppPools\$name
|
||||||
$result.info = @{
|
if ($pool)
|
||||||
|
{
|
||||||
|
$result.info = @{
|
||||||
name = $pool.Name
|
name = $pool.Name
|
||||||
state = $pool.State
|
state = $pool.State
|
||||||
attributes = New-Object psobject @{}
|
attributes = New-Object psobject @{}
|
||||||
};
|
};
|
||||||
|
|
||||||
$pool.Attributes | ForEach { $result.info.attributes.Add($_.Name, $_.Value)};
|
$pool.Attributes | ForEach { $result.info.attributes.Add($_.Name, $_.Value)};
|
||||||
|
}
|
||||||
|
|
||||||
Exit-Json $result
|
Exit-Json $result
|
||||||
|
|
Loading…
Reference in a new issue