-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGet-AppPool.ps1
62 lines (33 loc) · 934 Bytes
/
Get-AppPool.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<#
.Synopsis
Get IIS application pool status
.DESCRIPTION
The function would provide IIS application pool status
.EXAMPLE
Get-AppPool -Server server1,server2 -Pool powershell
.FUNCTIONALITY
It uses Microsoft.Web.Administration assembly to get the status
#>
function Get-AppPool {
[CmdletBinding()]
param
(
[string[]]$Server,
[String]$Pool
)
#region loadAssembly
[Reflection.Assembly]::LoadWithPartialName('Microsoft.Web.Administration')
#endregion loadAssembly
foreach ($s in $server)
{
$sm = [Microsoft.Web.Administration.ServerManager]::OpenRemote($s)
$apppools = $sm.ApplicationPools["$pool"]
$status = $apppools.state
$info = @{
'Pool Name'=$pool;
'Status'=$status;
'Server'=$S;
}
Write-Output (New-Object –Typename PSObject –Prop $info)
}
}