myITforum and Windows IT Pro Forums

 Need help with custom mof

Author Message
msingri

  • Total Posts : 16
  • Scores: 0
  • Reward points : 3200
  • Joined: 4/24/2017
  • Status: offline
Need help with custom mof Thursday, July 13, 2017 6:33 PM (permalink)
0
Hi Everyone,
 
I am creating a custom class to fetch product edition for SCCM 2012. I am updating configuration.mof. In order to identify this product on V_GR_ADD_REMOVE_PROGRAMS, I am trying to pull in additional information (DisplayName, DIsplayVersion, Publisher) which is one of the entries under HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall. 
 
I am running into two issues:
  • I need data from only one of the entries under uninstall, is there a way to use wild cards within the custom class to do this? 
  • The other issue is, lets say I had to loop through each entry in uninstall, I am trying to compare a string with the property within the class and that throws an error at compilation (Expected property or method name at line with if condition). 
Below is my custom class:
#pragma deleteclass("Sn_Software_Asset_Management_Edition", NOFAIL)
[ dynamic,  provider("RegProv"),  ClassContext("local|HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall")]
Class Custom_Edition{
    [key] string KeyName="Custom_Edition"; [PropertyContext("DisplayName")]       
        string    DisplayName;   
    [PropertyContext("Publisher")  ]       
        string    Publisher;   
    [PropertyContext("DisplayVersion")]        
       string    Version;
    if (DisplayName == "Adobe Acrobat DC") {
      [PropertyContext("Local|HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432node\\Adobe\\Adobe Acrobat\\DC\\Installer|ENU_GUID"),Dynamic,Provider("RegPropProv")] string Edition;
    } else { string Edition; }
};
 
I want to capture the edition only if its Adobe Acrobat DC, otherwise do nothing. How can I achieve this? If this is not the right way to doing this, what is the alternative solution?
 
Any help is much appreciated.
 
Thanks,
Medha
<message edited by msingri on Thursday, July 13, 2017 6:40 PM>
 
#1
    gjones

    • Total Posts : 2802
    • Scores: 146
    • Reward points : 232080
    • Joined: 6/5/2001
    • Location: Ottawa, Ontario, Canada
    • Status: offline
    Re:Need help with custom mof Friday, July 14, 2017 7:55 AM (permalink)
    0
    What you are trying to do would be better as a script. Then create a custom class for the results in WMI. Keep in mind that you will need to run this script at least weekly to keep the results current.
     
    #2
      skissinger

      • Total Posts : 5126
      • Scores: 504
      • Reward points : 198720
      • Joined: 9/13/2001
      • Location: Sherry Kissinger
      • Status: offline
      Re:Need help with custom mof Monday, July 17, 2017 12:10 PM (permalink)
      0
      Here's what I would do.  Console.  Administration.  Client Settings.  Default Client Settings, right-click properties.
      Hardware Inventory, click on 'Set Classes...'
      Search for SMS_SoftwareTag
      Enable that class, the whole thing.
      OK OK
      Wait.  How long you wait depends upon your environment, and how frequently you run hardware inventory.
      It might be days or even a week or more--it's your environment.
       
      Then check sql like...
      select st.productname0, st.displayversion0, st.UniqueID0, s.netbios_name0
      from v_gs_software_tag st
      join v_r_system s on s.resourceid=st.resourceid
      where SoftwareLicensor0 like '%adobe%'
       
      Using the "uniqueID" field, you can cross reference with Adobe's information here:
       
      http://www.adobe.com/devnet-docs/acrobatetk/tools/AdminGuide/identify.html#identifying-dc-installs
       
      but... I suspect that still won't be good enough.  Because the SoftwareTag results, for DC versions, don't report back the serial number, which is a key identifier according to Adobe.  So even with doing the software Tag... You'll probably want to use a ConfigItem + Mof Edit like this:  https://mnscug.org/blogs/sherry-kissinger/419-gather-some-adobe-serial-numbers-and-version-using-configmgr-compliance-settings-and-hardware-inventory
       
      However, start with the Software Tag first.  Even though it might not be good enough for Adobe products, you might find it's useful for other products you need to identify.
      mofmaster@myitforum.com
      My Blog
      Microsoft MVP 2007-2015 - ConfigMgr
       
      #3
        msingri

        • Total Posts : 16
        • Scores: 0
        • Reward points : 3200
        • Joined: 4/24/2017
        • Status: offline
        Re:Need help with custom mof Tuesday, July 18, 2017 6:40 PM (permalink)
        0
        Hi gjones,
         
        Looks like the script is working for me, I just have to figure out an how to schedule a execution of it automatically. Thank you for the pointing me in this direction.
         
        Thanks,
        Medha
         
        #4
          msingri

          • Total Posts : 16
          • Scores: 0
          • Reward points : 3200
          • Joined: 4/24/2017
          • Status: offline
          Re:Need help with custom mof Tuesday, July 18, 2017 6:42 PM (permalink)
          0
          Hi Sherry,
           
          Thank you for the detailed information on Adobe, I will take a look at it in depth. I do have Software Tag enabled but dont see relevant information I need yet, but will continue to gather this if I need something in future.
           
          Thanks,
          Medha
           
          #5
            Online Bookmarks Sharing: Share/Bookmark

            Jump to:

            Current active users

            There are 0 members and 3 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-2017 ASPPlayground.NET Forum Version 3.9