Link to home
Start Free TrialLog in
Avatar of MatthewF
MatthewFFlag for Afghanistan

asked on

What Class to use for wmi in perl

What is the Perl class to use to get the variable back of a registry key, ie

HKLM\SYSTEM\CURRENTCONTROLSET\SERVICES\CPQTEAMMP. I need the snippet to get these variables back. Ie

$objWMI = Win32::OLE->GetObject("winmgmts://$strComputer/root/cimv2");


$colNAs = $objWMI->InstancesOf(‘xxxxxxx);
Avatar of Kim Ryan
Kim Ryan
Flag of Australia image

This module should help http://search.cpan.org/~adamk/Win32-TieRegistry-0.25/
 
use Win32::TieRegistry( Delimiter=>"\" );
$one_key= $Registry->{"HKLM\SYSTEM\CURRENTCONTROLSET\SERVICES\CPQTEAMMP"}
Avatar of MatthewF

ASKER

I am looking to use WMI
As far as I can see, WMI is just for windows process information, it doesn't have any functions for registry access.
I am fairly certain wmi can pull registry access.
Avatar of tone28
tone28

Yeah, WMI can pull registry info. I am not in a place I can check it but unless someone already posts it I will post it later. That is, the actual code you can use for an example
Well, I played around with this for a while but did not get it working.




use Win32::OLE 'in';
use Win32::OLE::Variant;
$hklm = 0x80000002;

$key = "Software";


my $objwmi = Win32::OLE->GetObject("winmgmts:\\\\.\\root\\default:StdRegProv");

$objwmi->EnumKey($hklm,$key,$array);

foreach my $k(in $array) {
    print "Result ",$k, "\n";
}


I think I need to create a Variant that EnumKey will take for $array so that I can then file through them.

This is not a solution but a start. I will look further until a better answer is given or I get this working.

Tone
ASKER CERTIFIED SOLUTION
Avatar of DarthMod
DarthMod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial