[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 590
  • Last Modified:

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);
0
MatthewF
Asked:
MatthewF
  • 2
  • 2
  • 2
  • +1
1 Solution
 
Kim RyanIT ConsultantCommented:
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"}
0
 
MatthewFAuthor Commented:
I am looking to use WMI
0
 
Kim RyanIT ConsultantCommented:
As far as I can see, WMI is just for windows process information, it doesn't have any functions for registry access.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
MatthewFAuthor Commented:
I am fairly certain wmi can pull registry access.
0
 
tone28Commented:
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
0
 
tone28Commented:
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
0
 
DarthModCommented:
PAQed with no points refunded (of 345)

DarthMod
Community Support Moderator
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now