About      |       Articles      |      Services      |      Software      |      Contact

Latest Free SharePoint Software

ARB Security Solutions regularly releases free SharePoint software, including WebParts, Client Applications, Framework Extensions, and other Miscellaneous Components.
The most recent freeware is:

Title: Simple SharePoint Rollup WebPart
Date Published: 10/22/2009

Previous Two Free WebPart Releases:

SecureCenter For SharePoint

By SharePoint security integrators, for SharePoint security integrators.

SharePoint Security Assurance Program™

For externally facing SharePoint deployments, security is an acutely important deployment concern. Learn how through daily security scanning, you can ensure external business users and partners that they can collaborate in confidence!

Security Assurance WebPart:



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:

C#:
  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/Bookmark

1 Comment »

  1. You do realize that lines 4 through 7 can be exactly replaced by:
    foreach (ManagementObject l_oChildMo in l_oWmi.GetInstances()) {
    ?

    Comment by Erich Stehr — November 14, 2007 @ 3:48 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment