MOF changes (Full Version)

All Forums >> [Management Products] >> Microsoft Systems Management Server >> SMS 2003



Message


lbriggs -> MOF changes (5/5/2008 3:43:35 PM)

I'm creating a mini mof file to query a particule set of registry keys pertaining to the builds in our environment.  The data is currently stored in the location HKLM\SOFTWARE\MyCompany\Build\Config\NAMEOFBUILD\

The data stored under the NAMEOFBUILD subkey is a bunch of values pertaining to the software in that build.  I'm not interested in that, only the name of the subkey 'NAMEOFBUILD'.  I have the following MOF file written, but it doesn't appear to be doing anything:

//----------------------
// Build Information
//----------------------
#pragma namespace ("\\\\.\\root\\cimv2")
#pragma deleteclass ("win32Reg_Build",NOFAIL)
[ dynamic,
 provider("RegProv"),
 ClassContext("local|HKEY_LOCAL_MACHINE\\SOFTWARE\\MyCompany\\Build\\CONFIG")
]
class Win32Reg_Build
{
   [key]                               string    ScheduledJobs;
};
#pragma namespace ("\\\\.\\root\\cimv2\\sms")
#pragma deleteclass ("win32Reg_Build",NOFAIL)
[ SMS_Report     (TRUE),
 SMS_Group_Name ("Build Info"),
 SMS_Class_ID   ("MICROSOFT|BUILD_INFO|1.0") ]
class Win32Reg_Build : SMS_Class_Template
{
   [SMS_Report (TRUE), key ] string ScheduledJobs;
};
//----------------------
// Build Information
//----------------------


After compiling locally with mofcomp, I inspect the class and have a null value for ScheduledJobs.  Am I missing something here?  Or is it not possible to query on just the subkey without asking for values under it.

*looks around for SKissinger*




skissinger -> RE: MOF changes (5/5/2008 5:47:29 PM)

Not really sure what you mean by 'inspect the class'.  If you mean you used wbemtest and looked at what might be stored in root\cimv2\sms\win32reg_build; yes... that'll be empty.  It's just a placeholder.

Without seeing your .reg, I'd maybe change it to:

quote:

//----------------------
// Build Information
//----------------------
#pragma namespace ("\\\\.\\root\\cimv2")
#pragma deleteclass ("win32Reg_Build",NOFAIL)
[DYNPROPS]
class win32Reg_Build
{
   [key]  string    KeyName;
   string   ScheduledJobs;
};
[DYNPROPS]
instance of win32Reg_Build
{
KeyName = "Build";
[PropertyContext("local|HKEY_LOCAL_MACHINE\\Software\\MyCompany\\Build\\Config|ScheduledJobs"),
Dynamic,Provider("RegPropProv")] ScheduledJobs;
};
#pragma namespace ("\\\\.\\root\\cimv2\\sms")
#pragma deleteclass ("win32Reg_Build",NOFAIL)
[ SMS_Report     (TRUE),
SMS_Group_Name ("Build Info"),
SMS_Class_ID   ("MICROSOFT|BUILD_INFO|1.0") ]
class Win32Reg_Build : SMS_Class_Template
{
  [SMS_Report (TRUE), key ] string KeyName;
  [SMS_Report (TRUE) ] string ScheduledJobs;
};



But test test test.  It's just a thought; and again I don't know what your regkey really looks like...




lbriggs -> RE: MOF changes (5/5/2008 10:17:36 PM)

Thanks for the tip.  I'll try it again in the morning, along with a sample regkey for clarification.

And yes, by 'inspect the class' I was using wbemtest.  If that is always empty, how can I verify that everything is working and actually view the data in WMI?




lbriggs -> RE: MOF changes (5/6/2008 7:20:52 AM)

RegKey example:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\HIG\Build\CONFIG]

[HKEY_LOCAL_MACHINE\SOFTWARE\HIG\Build\CONFIG\XPSP2-HIG Core]
"EnCase Servlet"="Scheduled by  on 12-04-07 @ 16:06:11"
"Altiris NS Client 6 SP3 R5"="Scheduled by  on 12-04-07 @ 16:06:11"
"Microsoft SMS 2003 SP3 Client"="Scheduled by  on 12-04-07 @ 16:06:11"
"SU Service"="Scheduled by  on 12-04-07 @ 16:06:11"
"Microsoft Visio Viewer 2003"="Scheduled by  on 12-04-07 @ 16:06:11"
"Adobe Acrobat Reader 7.0.5"="Scheduled by  on 12-04-07 @ 16:06:11"
"Placeholder"="Scheduled by  on 12-04-07 @ 16:06:11"
"Lotus Sametime 6.5FP1"="Scheduled by  on 12-04-07 @ 16:06:11"
"Macromedia Authorware Plugin 7"="Scheduled by  on 12-04-07 @ 16:06:11"
"Adobe Flash Player 9.0"="Scheduled by  on 12-04-07 @ 16:06:11"
"Macromedia Shockwave Plugin 10"="Scheduled by  on 12-04-07 @ 16:06:11"
"XStream Software RapidPlayer 3"="Scheduled by  on 12-04-07 @ 16:06:11"
"Citrix Web Client 9.1"="Scheduled by  on 12-04-07 @ 16:06:11"
"HIG System Information Tool 1.0.0"="Scheduled by  on 12-04-07 @ 16:06:11"
"Microsoft Compatibility Pack For Office 2007"="Scheduled by  on 12-04-07 @ 16:06:11"
"Altiris Application Metering 6.1.31"="Scheduled by  on 12-04-07 @ 16:06:11"
"Opnet Capture Agent 3.1"="Scheduled by  on 12-04-07 @ 16:06:11"
"Symantec AntivirusClient 10"="Scheduled by  on 12-04-07 @ 16:06:11"





skissinger -> RE: MOF changes (5/6/2008 8:08:40 AM)

Hmm... I can't think of a way to dynamically grab that data.  It looks like the keynames are unique for each entry: "Lotus Sametime 6.5Fp1", etc.  You'd have to code each key into your MOF, and then update your mof every time you add another one.  I suspect it is way too late to change your registry branding... but the mof would need keynames that don't change, perhaps something like this; then it could be modeled after the add/remove programs snippet:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\HIG\Build\CONFIG]

[HKEY_LOCAL_MACHINE\SOFTWARE\HIG\Build\CONFIG\XPSP2-HIG Core]

 
[HKEY_LOCAL_MACHINE\SOFTWARE\HIG\Build\CONFIG\XPSP2-HIG Core\EnCaseServLet]

"TAG"="Scheduled by  on 12-04-07 @ 16:06:11"
 
[HKEY_LOCAL_MACHINE\SOFTWARE\HIG\Build\CONFIG\XPSP2-HIG Core\Altiris NS Client 6 SP3 R5]

"TAG"="Scheduled by  on 12-04-07 @ 16:06:11"





lbriggs -> RE: MOF changes (5/6/2008 10:05:52 AM)

So there is no way to grab just the keyname, in this example 'XPSP2-HIG Core' ?  That's all I'm after.




skissinger -> RE: MOF changes (5/6/2008 8:45:27 PM)

If all you want is the name of the subkey under CONFIG, whatever that may be, yes.  I'd model it after the Add/remove Programs sample, where it's pulling in the subkey name under \uninstall




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.5458984