Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: running command line from Perl

by soonix (Canon)
on May 18, 2022 at 13:16 UTC ( [id://11143971]=note: print w/replies, xml ) Need Help??


in reply to running command line from Perl

using DBD::WMI:
use strict; use warnings; use DBI; my $dbh = DBI->connect('dbi:WMI:'); my $sth = $dbh->prepare('SELECT * FROM Win32_ComputerSystemProduct'); $sth->execute(); while (my @row = $sth->fetchrow) { print $row[0]->{UUID}, "\n"; }

Replies are listed 'Best First'.
Re^2: running command line from Perl
by cavac (Parson) on May 19, 2022 at 07:08 UTC

    Nice one! My first reaction was "someone wrote a DBD module to query some Windows API". But of course, there is a DBD for stuff like that. There always is.

    perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'
      > "someone wrote a DBD module to query some Windows API"

      FYI: The dominant "Windows API" of WMI is WQL which is kind of SQL, so it's not really that surprising

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

        Didn't know that. I'm mostly on Linux these days. Probably spending less than 50 hours per year fiddling with Windows ;-)

        perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11143971]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-04-24 16:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found