search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Posted in Windows Powershell | No Comment | 2,181 views | 12/07/2015 11:42

These are IIS Application Pool 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 General Information
[string]$WebSiteAppPoolName = $WebSiteAppPool.Name
[string]$WebSiteAppPoolAppPoolAutoStart = $WebSiteAppPool.AppPoolAutoStart
[string]$WebSiteAppPoolAppPoolCommand = $WebSiteAppPool.AppPoolCommand
[string]$WebSiteAppPoolAppPoolIdentityType = $WebSiteAppPool.AppPoolIdentityType
[string]$WebSiteAppPoolAppPoolQueueLength = $WebSiteAppPool.AppPoolQueueLength
[string]$WebSiteAppPoolWAMUserName = $WebSiteAppPool.WAMUserName
[string]$WebSiteAppPoolWAMUserPass = $WebSiteAppPool.WAMUserPass
[string]$WebSiteAppPoolWin32Error = $WebSiteAppPool.Win32Error

You can find more properties in my blog.


Posted in Windows Powershell | No Comment | 2,962 views | 09/07/2015 18:05

You can use Compare-Object to compare two different arrays:

1
2
3
4
5
[array]$OldModules = @(1,2,3,4,5,6);
[array]$CurrentModules= @(1,2,4,5,6);
 
# Compare Modules
Compare-Object $OldModules $CurrentModules

If output of compare-object is null, it means two arrays are identical.


Posted in Windows Powershell | No Comment | 1,457 views | 07/07/2015 17:19

These are IIS Website properties that you can get using CIM via PowerShell.

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
# Get WebSites
$WebSites = Get-CimInstance -Namespace "root\MicrosoftIISv2" -ClassName "IIsWebServerSetting" -OperationTimeoutSec 15 -EA Stop
 
$WebSite = $WebSites[0];
 
# WebSite General Information
[string]$WebSiteId = $WebSite.Name.Split("/")[-1]
[string]$WebSiteName = $WebSite.ServerComment
[string]$WebSiteAppPool = $WebSite.AppPoolId
[string]$WebSiteMaxBandwidth = $WebSite.MaxBandwidth
[string]$WebSiteMaxConnections = $WebSite.MaxConnections
[string]$WebSiteConnectionTimeout = $WebSite.ConnectionTimeout
[string]$WebSiteCertCheckMode = $WebSite.CertCheckMode
[string]$WebSiteCGITimeout = $WebSite.CGITimeout
[string]$WebSiteCreateCGIWithNewConsole = $WebSite.CreateCGIWithNewConsole
[string]$WebSiteCreateProcessAsUser = $WebSite.CreateProcessAsUser
[string]$WebSiteClusterEnabled = $WebSite.ClusterEnabled
[string]$WebSiteContentIndexed = $WebSite.ContentIndexed
[string]$WebSiteDoStaticCompression = $WebSite.DoStaticCompression
[string]$WebSiteDoDynamicCompression = $WebSite.DoDynamicCompression
[string]$WebSiteFrontPageWeb = $WebSite.FrontPageWeb
[string]$WebSiteDisableSocketPooling = $WebSite.DisableSocketPooling
[string]$WebSiteDisableStaticFileCache = $WebSite.DisableStaticFileCache
[string]$WebSiteEnableReverseDns = $WebSite.EnableReverseDns
[string]$WebSiteShutdownTimeLimit = $WebSite.ShutdownTimeLimit
[string]$WebSiteSSIExecDisable = $WebSite.SSIExecDisable
[string]$WebSiteSSLAlwaysNegoClientCert = $WebSite.SSLAlwaysNegoClientCert
[string]$WebSiteUploadReadAheadSize = $WebSite.UploadReadAheadSize
[string]$WebSiteUseDigestSSP = $WebSite.UseDigestSSP

You can find more properties in my blog.


Posted in Windows Powershell | No Comment | 2,379 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

You can find more properties in my blog.


Posted in Windows Powershell | No Comment | 1,723 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

You can find more properties in my blog.


Posted in Windows Powershell | No Comment | 1,236 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

You can find more properties in my blog.


Posted in Windows Powershell | 2 Comments | 7,611 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"

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

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.