SMS_DEF.MOF and Win32_TerminalServiceSetting

Author Message
johnnyc121

  • Total Posts : 2
  • Scores: 2
  • Reward points : 100
  • Joined: 6/21/2011
  • Status: offline
SMS_DEF.MOF and Win32_TerminalServiceSetting Tuesday, June 21, 2011 12:39 PM (permalink)
0
[Helpful answer received] / [List Solutions Only]
I'm working on updating my SMS_DEF.MOF file to capture the status of Terminal Services on all of our servers, in particular, if they are running Remote Desktop for Administration or if they are running Terminal Services.  The Win32_TerminalServiceSetting has this information, however, it is in 2 different places depending on the OS:

Win2003 - root\cimv2
Win2008 - root\cimv2\TerminalServices

I've tried creating 2 separate classes in my SMS_DEF.MOF file, but that doesn't seem to work since they are the same class name, looks like it only takes the data from the last one.  For example, if I put the Win2008 class information last, it will capture the data fine for Win2008 machines, but then it does not work for the Win2003 servers, even if the Win2003 version is listed above it.

I've included the snippet for the 2008 version below, the only difference on the 2003 version is that I'm not referencing a namespace to look in, since it is in the default location.  Any assistance would be much appreciated.  Thanks!

//#pragma namespace("\\\\.\\root\\cimv2\\SMS")
//#pragma deleteclass("Terminal_Server_2008", NOFAIL)

//[SMS_Report (TRUE),
// SMS_Group_Name ("Terminal_Server_2008"),
// SMS_Class_ID ("CUSTOM|Terminal_Server_2008|1.0"),
// Namespace("\\\\\\\\.\\\\root\\\\CIMV2\\\\TerminalServices")]

//class Win32_TerminalServiceSetting : SMS_Class_Template
//{
//[SMS_Report(TRUE),key] string ServerName;
//[SMS_Report(TRUE)] uint32 TerminalServerMode;
//[SMS_Report(TRUE)] string LicensingName;
//};

John
 
#1
    skissinger

    • Total Posts : 4645
    • Scores: 448
    • Reward points : 75260
    • Joined: 9/13/2001
    • Location: Sherry Kissinger
    • Status: offline
    Re:SMS_DEF.MOF and Win32_TerminalServiceSetting Tuesday, June 21, 2011 1:07 PM (permalink)
    0
    You'll probably have to have both a configuration.mof edit, and sms_def.mof edits.  I had similar issues with getting installed SQL information out of WMI, because it was similar WMI classes (in my case, sqladvancedserviceproperty); I couldn't directly edit sms_def.mof and get both from the different namespaces.

    What I had to do was leverage configuration.mof, and have Configuration.mof make me some custom classes (completely made up class names), and then sms_def.mof read *those*.

    Here's the snippets on how that was done for SQL.  Hopefully you can see the logic of how that works:

    http://myitforum.com/cs2/...ardware-inventory.aspx

    If not, feel free to reply here again.

    Edit: PS, if you get the mof edit working, please blog it.  (If you don't have a blog, let me know if I can blog it on your behalf).
    <message edited by skissinger on Tuesday, June 21, 2011 1:10 PM>
    mofmaster@myitforum.com
    My Blog
    Microsoft MVP - ConfigMgr
     
    #2
      johnnyc121

      • Total Posts : 2
      • Scores: 2
      • Reward points : 100
      • Joined: 6/21/2011
      • Status: offline
      Re:SMS_DEF.MOF and Win32_TerminalServiceSetting Tuesday, June 21, 2011 3:41 PM (permalink)
      5
      [This post was marked as helpful]
      Thanks Sherry, your information was helpful, got me on the right track.  Now I've got it working and it's checking both OSes correctly.  Here are the mof edits I made:

      Configuration.mof
      ======================================================
      //---------------------------------------------
      // TS 2008 Properties
      //---------------------------------------------
       
      [Union, ViewSources{"select ServerName,TerminalServerMode,LicensingName from Win32_TerminalServiceSetting"},ViewSpaces{"\\\\.\\root\\cimv2\\TerminalServices"}, dynamic,Provider("MS_VIEW_INSTANCE_PROVIDER")]
       
      class ts_win2008
       

          [PropertySources{"ServerName"},key  ] string ServerName;
          [PropertySources{"TerminalServerMode"}  ] uint32 TerminalServerMode;
          [PropertySources{"LicensingName"}  ] string LicensingName;
      };
       
      //---------------------------------------------
      // TS 2003 Properties
      //---------------------------------------------
       
      [Union, ViewSources{"select ServerName,TerminalServerMode,LicensingName from Win32_TerminalServiceSetting"},ViewSpaces{"\\\\.\\root\\cimv2"}, dynamic,Provider("MS_VIEW_INSTANCE_PROVIDER")]
       
      class ts_win2003
       

          [PropertySources{"ServerName"},key  ] string ServerName;
          [PropertySources{"TerminalServerMode"}  ] uint32 TerminalServerMode;
          [PropertySources{"LicensingName"}  ] string LicensingName;
      };

      sms_def.mof
      ==============================

      //                            Terminal Server 2008 Information                        Class Created:  6/15/2011

      [dynamic, provider("MS_VIEW_INSTANCE_PROVIDER"),
       SMS_Report (TRUE),
       SMS_Group_Name ("TS_Win2008"),
       SMS_Class_ID ("CUSTOM|TS_Win2008|1.0")]

      class ts_win2008 : SMS_Class_Template
      {
      [SMS_Report(TRUE),key] string ServerName;
      [SMS_Report(TRUE)] uint32 TerminalServerMode;
      [SMS_Report(TRUE)] string LicensingName;
      };


      //                            Terminal Server 2003 Information                        Class Created:  6/15/2011

      [dynamic, provider("MS_VIEW_INSTANCE_PROVIDER"),
       SMS_Report (TRUE),
       SMS_Group_Name ("TS_Win2003"),
       SMS_Class_ID ("CUSTOM|TS_Win2003|1.0")]

      class ts_win2003 : SMS_Class_Template
      {
      [SMS_Report(TRUE),key] string ServerName;
      [SMS_Report(TRUE)] uint32 TerminalServerMode;
      [SMS_Report(TRUE)] string LicensingName;
      };

       
      #3
        skissinger

        • Total Posts : 4645
        • Scores: 448
        • Reward points : 75260
        • Joined: 9/13/2001
        • Location: Sherry Kissinger
        • Status: offline
        Re:SMS_DEF.MOF and Win32_TerminalServiceSetting Tuesday, June 21, 2011 10:39 PM (permalink)
        0
        Thanks, blogged this on your behalf (and completely selfishly, so that if/when I need this mof edit in the future, I know I can find it again).  :)
        mofmaster@myitforum.com
        My Blog
        Microsoft MVP - ConfigMgr
         
        #4
          Online Bookmarks Sharing: Share/Bookmark

          Jump to:

          Current active users

          There are 0 members and 2 guests.

          Icon Legend and Permission

          • New Messages
          • No New Messages
          • Hot Topic w/ New Messages
          • Hot Topic w/o New Messages
          • Locked w/ New Messages
          • Locked w/o New Messages
          • Read Message
          • Post New Thread
          • Reply to message
          • Post New Poll
          • Submit Vote
          • Post reward post
          • Delete my own posts
          • Delete my own threads
          • Rate post

          2000-2012 ASPPlayground.NET Forum Version 3.9