kamagra how much to take

Hello ManagementObjectEnumerator

I totally didn’t know that there was a ManagementObjectEnumerator class, but I found out there was today which made me all sorts of happy. What I was trying to do was to just display a list of the application pools of the current host machine’s IIS instance within this small WinForms app I have that performs some warm-up functions for SharePoint. I needed to target application pools because we have a complex recycling theme, and I needed scheduled post-warm up functions. What I ended up doing in order to list them was just this:

  1. string l_strClassPath = @"\\" + hostname + @"\root\microsoftiisv2:IIsApplicationPoolSetting";
  2. using (ManagementClass l_oWmi = new ManagementClass(l_strClassPath))
  3. {
  4. using (ManagementObjectCollection.ManagementObjectEnumerator l_oMoEnumerator = l_oWmi.GetInstances().GetEnumerator())
  5. {
  6. while (l_oMoEnumerator.MoveNext())
  7. {
  8. ManagementObject l_oChildMO = ((ManagementObject)l_oMoEnumerator.Current);
  9. char[] l_aSplitChar = "/".ToCharArray();
  10. tbApplicationPoolList.Items.Add(l_oChildMO.ToString().Split(l_aSplitChar)[(l_oChildMO.ToString().Split(l_aSplitChar).Length - 1)].Replace("\"", ""));
  11. }
  12. }
  13. }

I like that!

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>