Support Forums

Full Version: Perl SysInfo Script - Created by Ace
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Here's one of my most recent scripts using the Win32::Registry module to read values and data from the registry for stored information provided for the current status of your system including Windows install information.

[yt]http://www.youtube.com/watch?v=1JHw-PayRIk&fmt=8[/yt]

Code:
#!/usr/bin/perl
use Win32::Registry;

$sublocation = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
$main::HKEY_LOCAL_MACHINE->Open($sublocation, $null) || die "Open: $!"; $null->GetValues(\%ID);

print "\n\            #--Ace\'s Basic SysInfo Script--\#\n";
print "\n------------------\\System Information\\------------------\n\n";
foreach $key_ (keys %ID) {
    if ($key_ eq "RegisteredOwner") {
        $entry = $ID{$key_};
        print "$$entry[0] = $$entry[2]\n";
    } elsif ($key_ eq "ProductId") {
        $entry = $ID{$key_};
        print "$$entry[0] = $$entry[2]\n";
    } elsif ($key_ eq "SystemRoot") {
        $entry = $ID{$key_};
        print "$$entry[0] = $$entry[2]\n";
    } elsif ($key_ eq "ProductName") {
        $entry = $ID{$key_};
        print "$$entry[0] = $$entry[2]\n";
    } elsif ($key_ eq "CSDVersion") {
        $entry = $ID{$key_};
        print "$$entry[0] = $$entry[2]\n";
    } elsif ($key_ eq "CurrentBuild") {
        $entry = $ID{$key_};
        print "$$entry[0] = $$entry[2]\n";
    }
}
print "\n--------------------------------------------------------\n\n";