What Class to use for wmi in perl

Posted on 2006-05-18
Last Modified: 2008-01-09
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);
Question by:MatthewF
    LVL 19

    Expert Comment

    This module should help
    use Win32::TieRegistry( Delimiter=>"\" );

    Author Comment

    I am looking to use WMI
    LVL 19

    Expert Comment

    As far as I can see, WMI is just for windows process information, it doesn't have any functions for registry access.

    Author Comment

    I am fairly certain wmi can pull registry access.
    LVL 6

    Expert Comment

    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
    LVL 6

    Expert Comment

    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");


    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.

    LVL 1

    Accepted Solution

    PAQed with no points refunded (of 345)

    Community Support Moderator

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Suggested Solutions

    Title # Comments Views Activity
    Strange perl issue 6 116
    add a syntax to a csv file 8 83
    Awk Question 2 106
    Regex rule to match two different url 5 0
    Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
    In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now