Search
Home IIS.NET Forums IIS 5 & IIS 6 Configuration & Scripting Application Pool state with WMI and C#
Last post Mar 11, 2008 06:43 AM by thomad
1 Post
Mar 10, 2008 11:04 AM|LINK
Hi,
I can Start, Stop and Recycle Application Pool with WMI and C# but I can't have the Application Pool Status.
My Code for start/stop/recycle is :
ConnectionOptions co = new ConnectionOptions();
co.Username = Configuration.user;
co.Password = Configuration.pwd;
co.Impersonation = ImpersonationLevel.Impersonate;
co.Authentication = AuthenticationLevel.PacketPrivacy;
string objPath = "IISApplicationPool.Name='W3SVC/AppPools/" + appPool + "'";
ManagementScope scope = new ManagementScope(@"\\" + server + @"\root\MicrosoftIISV2", co);using (ManagementObject mc = new ManagementObject(objPath))
{
mc.Scope = scope;
switch (act)
case eAction.Start :
mc.InvokeMethod("Start", null, null);
break;
case eAction.Stop :
mc.InvokeMethod("Stop", null, null);
case eAction.Recycle:
mc.InvokeMethod("Recycle", null, null);
}
Can you help to get Application Pool status please ?
Thank You
I Use IIS6 - FrameWork 3.5
552 Posts
Mar 11, 2008 06:43 AM|LINK
AppPoolState is the property you are looking for.
Geminium75
1 Post
Application Pool state with WMI and C#
Mar 10, 2008 11:04 AM|LINK
Hi,
I can Start, Stop and Recycle Application Pool with WMI and C# but I can't have the Application Pool Status.
My Code for start/stop/recycle is :
{{mc.InvokeMethod("Start", null, null);mc.InvokeMethod("Stop", null, null);mc.InvokeMethod("Recycle", null, null);Can you help to get Application Pool status please ?
Thank You
I Use IIS6 - FrameWork 3.5
thomad
552 Posts
Re: Application Pool state with WMI and C#
Mar 11, 2008 06:43 AM|LINK
AppPoolState is the property you are looking for.
Group Program Manager
Internet Information Services
Microsoft Corp.