Posted in
Windows Powershell |
No Comment | 2,403 views | 30/06/2015 19:58
These are IIS Application Pool Rapid Fail Protection properties that you can get using CIM via PowerShell.
1
2
3
4
5
6
7
8
9
10
11
12
| # WebSite AppPool Information
$WebSiteAppPools = Get-CimInstance -Namespace "root\MicrosoftIISv2" -ClassName "IIsApplicationPoolSetting" -OperationTimeoutSec 15 -EA Stop
$WebSiteAppPool = $WebSiteAppPools[0];
# IIS AppPool Rapid Fail Protection Information
[string]$WebSiteAppPoolRapidFailProtection = $WebSiteAppPool.RapidFailProtection
[string]$WebSiteAppPoolRapidFailProtectionInterval = $WebSiteAppPool.RapidFailProtectionInterval
[string]$WebSiteAppPoolRapidFailProtectionMaxCrashes = $WebSiteAppPool.RapidFailProtectionMaxCrashes
[string]$WebSiteAppPoolShutdownTimeLimit = $WebSiteAppPool.ShutdownTimeLimit
[string]$WebSiteAppPoolSMPAffinitized = $WebSiteAppPool.SMPAffinitized
[string]$WebSiteAppPoolSMPProcessorAffinityMask = $WebSiteAppPool.SMPProcessorAffinityMask |
# WebSite AppPool Information
$WebSiteAppPools = Get-CimInstance -Namespace "root\MicrosoftIISv2" -ClassName "IIsApplicationPoolSetting" -OperationTimeoutSec 15 -EA Stop
$WebSiteAppPool = $WebSiteAppPools[0];
# IIS AppPool Rapid Fail Protection Information
[string]$WebSiteAppPoolRapidFailProtection = $WebSiteAppPool.RapidFailProtection
[string]$WebSiteAppPoolRapidFailProtectionInterval = $WebSiteAppPool.RapidFailProtectionInterval
[string]$WebSiteAppPoolRapidFailProtectionMaxCrashes = $WebSiteAppPool.RapidFailProtectionMaxCrashes
[string]$WebSiteAppPoolShutdownTimeLimit = $WebSiteAppPool.ShutdownTimeLimit
[string]$WebSiteAppPoolSMPAffinitized = $WebSiteAppPool.SMPAffinitized
[string]$WebSiteAppPoolSMPProcessorAffinityMask = $WebSiteAppPool.SMPProcessorAffinityMask
You can find more properties in my blog.
Posted in
Windows Powershell |
No Comment | 1,749 views | 19/06/2015 14:46
These are IIS Application Pool Recycling properties that you can get using CIM via PowerShell.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| # WebSite AppPool Information
$WebSiteAppPools = Get-CimInstance -Namespace "root\MicrosoftIISv2" -ClassName "IIsApplicationPoolSetting" -OperationTimeoutSec 15 -EA Stop
$WebSiteAppPool = $WebSiteAppPools[0];
# IIS AppPool Recycling Information
[string]$WebSiteAppPoolAppPoolRecycleConfigChange = $WebSiteAppPool.AppPoolRecycleConfigChange
[string]$WebSiteAppPoolAppPoolRecycleIsapiUnhealthy = $WebSiteAppPool.AppPoolRecycleIsapiUnhealthy
[string]$WebSiteAppPoolAppPoolRecycleMemory = $WebSiteAppPool.AppPoolRecycleMemory
[string]$WebSiteAppPoolAppPoolRecycleOnDemand = $WebSiteAppPool.AppPoolRecycleOnDemand
[string]$WebSiteAppPoolAppPoolRecyclePrivateMemory = $WebSiteAppPool.AppPoolRecyclePrivateMemory
[string]$WebSiteAppPoolAppPoolRecycleRequests = $WebSiteAppPool.AppPoolRecycleRequests
[string]$WebSiteAppPoolAppPoolRecycleSchedule = $WebSiteAppPool.AppPoolRecycleSchedule
[string]$WebSiteAppPoolAppPoolRecycleTime = $WebSiteAppPool.AppPoolRecycleTime |
# WebSite AppPool Information
$WebSiteAppPools = Get-CimInstance -Namespace "root\MicrosoftIISv2" -ClassName "IIsApplicationPoolSetting" -OperationTimeoutSec 15 -EA Stop
$WebSiteAppPool = $WebSiteAppPools[0];
# IIS AppPool Recycling Information
[string]$WebSiteAppPoolAppPoolRecycleConfigChange = $WebSiteAppPool.AppPoolRecycleConfigChange
[string]$WebSiteAppPoolAppPoolRecycleIsapiUnhealthy = $WebSiteAppPool.AppPoolRecycleIsapiUnhealthy
[string]$WebSiteAppPoolAppPoolRecycleMemory = $WebSiteAppPool.AppPoolRecycleMemory
[string]$WebSiteAppPoolAppPoolRecycleOnDemand = $WebSiteAppPool.AppPoolRecycleOnDemand
[string]$WebSiteAppPoolAppPoolRecyclePrivateMemory = $WebSiteAppPool.AppPoolRecyclePrivateMemory
[string]$WebSiteAppPoolAppPoolRecycleRequests = $WebSiteAppPool.AppPoolRecycleRequests
[string]$WebSiteAppPoolAppPoolRecycleSchedule = $WebSiteAppPool.AppPoolRecycleSchedule
[string]$WebSiteAppPoolAppPoolRecycleTime = $WebSiteAppPool.AppPoolRecycleTime
You can find more properties in my blog.
Posted in
Windows Powershell |
No Comment | 1,243 views | 17/06/2015 17:40
These are IIS Website Script Map properties that you can get using CIM via PowerShell.
1
2
3
4
5
6
7
8
9
10
11
| # Get WebSites
$WebSites = Get-CimInstance -Namespace "root\MicrosoftIISv2" -ClassName "IIsWebServerSetting" -OperationTimeoutSec 15 -EA Stop
$WebSite = $WebSites[0];
# WebSite Script Map Information
$WebSiteScriptMap = $WebSite.ScriptMaps[0]
[string]$WebSiteScriptMapExtensions = $WebSiteScriptMap.Extensions
[string]$WebSiteScriptMapFlags = $WebSiteScriptMap.Flags
[string]$WebSiteScriptMapIncludedVerbs = $WebSiteScriptMap.IncludedVerbs
[string]$WebSiteScriptMapScriptProcessor = $WebSiteScriptMap.ScriptProcessor |
# Get WebSites
$WebSites = Get-CimInstance -Namespace "root\MicrosoftIISv2" -ClassName "IIsWebServerSetting" -OperationTimeoutSec 15 -EA Stop
$WebSite = $WebSites[0];
# WebSite Script Map Information
$WebSiteScriptMap = $WebSite.ScriptMaps[0]
[string]$WebSiteScriptMapExtensions = $WebSiteScriptMap.Extensions
[string]$WebSiteScriptMapFlags = $WebSiteScriptMap.Flags
[string]$WebSiteScriptMapIncludedVerbs = $WebSiteScriptMap.IncludedVerbs
[string]$WebSiteScriptMapScriptProcessor = $WebSiteScriptMap.ScriptProcessor
You can find more properties in my blog.
Posted in
Windows Powershell |
2 Comments | 8,450 views | 15/06/2015 12:28
Some WMI queries may be effected from system performance, so queries may run very long times. In some cases, I see that wmi query hangs, so PowerShell script is not able to continue. In that cases, we should use timeout parameter.
Since CIM is the new method for us, we should go with CIM. For example this is our WMI query:
Get-WmiObject -Class "Win32_PerfFormattedData_PerfProc_Process" |
Get-WmiObject -Class "Win32_PerfFormattedData_PerfProc_Process"
If you run this on PowerShell, you will notice that it will takes for a while. So lets run same query with CIM:
Get-CimInstance -Class "Win32_PerfFormattedData_PerfProc_Process" -OperationTimeoutSec 15 |
Get-CimInstance -Class "Win32_PerfFormattedData_PerfProc_Process" -OperationTimeoutSec 15
As you see, CIM and WMI query is almost same. But additionally I’ve added OperationTimeoutSec parameters to avoid from hangs. That gives us ability to cancel query if it takes more than 15 seconds. You can change it anytime you want.