Kommentar
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Provides a relationship between an application pool and its worker processes.
Syntax
class ApplicationPoolContainsProcess : ObjectContainerAssociation
Methods
This class contains no methods.
Properties
The following table lists the properties exposed by the ApplicationPoolContainsProcess class.
| Name | Description |
|---|---|
Container |
(Inherited from ObjectContainerAssociation.) A read-only ApplicationPool object that represents an IIS application pool. A key property. |
Element |
(Inherited from ObjectContainerAssociation.) A read-only WorkerProcess object that represents a Windows Process Activation Service (WAS) worker process. A key property. |
Subclasses
This class contains no subclasses.
Remarks
A WorkerProcess object is transient; it may cease to exist when its application pool is recycled or when it reaches its idle time-out. Be prepared for this possibility if you write a script that interacts with a WorkerProcess object over any significant length of time.
Example
The following example returns the ID for every worker process in each application pool on a server.
' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")
' Return all application pools that are present on the server.
Set colAppPools = oWebAdmin.ExecQuery("SELECT * FROM ApplicationPool")
' Return the name of each application pool.
For Each oAppPool In colAppPools
WScript.Echo "Application Pool Name: " & oAppPool.Name
' Get all worker processes in the application pool.
Set oProcesses = oAppPool.Associators_("ApplicationPoolContainsProcess")
' Return the ID of each worker process in the application pool.
For Each oProcess In oProcesses
WScript.Echo "Worker Process ID: " & oProcess.ID
Next
Next
Note the following line from the preceding code example.
Set colAppPools = oWebAdmin.ExecQuery("SELECT * FROM ApplicationPool")
Instead of using the ExecQuery method, you can alternatively use the WMI InstancesOf method, as follows:
Set colAppPools = oWebAdmin.InstancesOf("ApplicationPool")
The latter approach enables you to achieve the same result without specifying a query syntax.
With either approach, the script produces an output similar to the following:
Application Pool Name: DefaultAppPool
Application Pool Name: Classic .NET AppPool
Application Pool Name: NewAppPool1
Application Pool Name: NewAppPool2
Application Pool Name: NewAppPool3
Inheritance Hierarchy
ApplicationPoolContainsProcess
Requirements
| Type | Description |
|---|---|
| Client | - IIS 7.0 on Windows Vista - IIS 7.5 on Windows 7 - IIS 8.0 on Windows 8 - IIS 10.0 on Windows 10 |
| Server | - IIS 7.0 on Windows Server 2008 - IIS 7.5 on Windows Server 2008 R2 - IIS 8.0 on Windows Server 2012 - IIS 8.5 on Windows Server 2012 R2 - IIS 10.0 on Windows Server 2016 |
| Product | - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0 |
| MOF file | WebAdministration.mof |
See Also
ApplicationPool Class
ObjectContainerAssociation Class
ProcessModelSettings Class
WorkerProcess Class