Support Forums
Perl SysInfo Script - Created by Ace - Printable Version

+- Support Forums (https://www.supportforums.net)
+-- Forum: Categories (https://www.supportforums.net/forumdisplay.php?fid=87)
+--- Forum: Coding Support Forums (https://www.supportforums.net/forumdisplay.php?fid=18)
+---- Forum: Perl Programming Support (https://www.supportforums.net/forumdisplay.php?fid=31)
+---- Thread: Perl SysInfo Script - Created by Ace (/showthread.php?tid=21646)



Perl SysInfo Script - Created by Ace - AceInfinity - 08-22-2011

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