| 129 | rodolico | 1 | # perl
 | 
        
           |  |  | 2 |   | 
        
           |  |  | 3 | # https://gallery.technet.microsoft.com/827da133-e0b1-4d09-85c2-56ed0b92774d
 | 
        
           |  |  | 4 |   | 
        
           |  |  | 5 | # simply exit if this is not Windows
 | 
        
           |  |  | 6 | BEGIN {
 | 
        
           |  |  | 7 | $^O eq "MSWin32" || exit;
 | 
        
           |  |  | 8 | }
 | 
        
           |  |  | 9 |   | 
        
           |  |  | 10 | our $VERSION = '0.1';
 | 
        
           |  |  | 11 |   | 
        
           |  |  | 12 | use Win32::OLE('in'); 
 | 
        
           |  |  | 13 | use constant wbemFlagReturnImmediately => 0x10; 
 | 
        
           |  |  | 14 | use constant wbemFlagForwardOnly => 0x20; 
 | 
        
           |  |  | 15 |   | 
        
           |  |  | 16 | $computer = "."; 
 | 
        
           |  |  | 17 | $objWMIService = Win32::OLE->GetObject 
 | 
        
           |  |  | 18 |     ("winmgmts:\\\\$computer\\root\\CIMV2") or die "WMI connection failed.\n"; 
 | 
        
           |  |  | 19 | $colItems = $objWMIService->ExecQuery 
 | 
        
           |  |  | 20 |     ("SELECT * FROM Win32_ComputerSystem","WQL",wbemFlagReturnImmediately | wbemFlagForwardOnly); 
 | 
        
           |  |  | 21 |   | 
        
           |  |  | 22 | foreach my $objItem (in $colItems) 
 | 
        
           |  |  | 23 | { 
 | 
        
           |  |  | 24 |       print "Admin Password Status: $objItem->{AdminPasswordStatus}\n"; 
 | 
        
           |  |  | 25 |       print "Automatic Reset Boot Option: $objItem->{AutomaticResetBootOption}\n"; 
 | 
        
           |  |  | 26 |       print "Automatic Reset Capability: $objItem->{AutomaticResetCapability}\n"; 
 | 
        
           |  |  | 27 |       print "Boot Option On Limit: $objItem->{BootOptionOnLimit}\n"; 
 | 
        
           |  |  | 28 |       print "Boot Option On WatchDog: $objItem->{BootOptionOnWatchDog}\n"; 
 | 
        
           |  |  | 29 |       print "Boot ROM Supported: $objItem->{BootROMSupported}\n"; 
 | 
        
           |  |  | 30 |       print "Bootup State: $objItem->{BootupState}\n"; 
 | 
        
           |  |  | 31 |       print "Caption: $objItem->{Caption}\n"; 
 | 
        
           |  |  | 32 |       print "Chassis Bootup State: $objItem->{ChassisBootupState}\n"; 
 | 
        
           |  |  | 33 |       print "Creation Class Name: $objItem->{CreationClassName}\n"; 
 | 
        
           |  |  | 34 |       print "Current Time Zone: $objItem->{CurrentTimeZone}\n"; 
 | 
        
           |  |  | 35 |       print "Daylight In Effect: $objItem->{DaylightInEffect}\n"; 
 | 
        
           |  |  | 36 |       print "Description: $objItem->{Description}\n"; 
 | 
        
           |  |  | 37 |       print "Domain: $objItem->{Domain}\n"; 
 | 
        
           |  |  | 38 |       print "Domain Role: $objItem->{DomainRole}\n"; 
 | 
        
           |  |  | 39 |       print "Enable Daylight Savings Time: $objItem->{EnableDaylightSavingsTime}\n"; 
 | 
        
           |  |  | 40 |       print "Front Panel Reset Status: $objItem->{FrontPanelResetStatus}\n"; 
 | 
        
           |  |  | 41 |       print "Infrared Supported: $objItem->{InfraredSupported}\n"; 
 | 
        
           |  |  | 42 |       print "Initial Load Info: " . join(",", (in $objItem->{InitialLoadInfo})) . "\n"; 
 | 
        
           |  |  | 43 |       print "Install Date: $objItem->{InstallDate}\n"; 
 | 
        
           |  |  | 44 |       print "Keyboard Password Status: $objItem->{KeyboardPasswordStatus}\n"; 
 | 
        
           |  |  | 45 |       print "Last Load Info: $objItem->{LastLoadInfo}\n"; 
 | 
        
           |  |  | 46 |       print "Manufacturer: $objItem->{Manufacturer}\n"; 
 | 
        
           |  |  | 47 |       print "Model: $objItem->{Model}\n"; 
 | 
        
           |  |  | 48 |       print "Name: $objItem->{Name}\n"; 
 | 
        
           |  |  | 49 |       print "Name Format: $objItem->{NameFormat}\n"; 
 | 
        
           |  |  | 50 |       print "Network Server Mode Enabled: $objItem->{NetworkServerModeEnabled}\n"; 
 | 
        
           |  |  | 51 |       print "Number Of Processors: $objItem->{NumberOfProcessors}\n"; 
 | 
        
           |  |  | 52 |       print "OEM Logo Bitmap: " . join(",", (in $objItem->{OEMLogoBitmap})) . "\n"; 
 | 
        
           |  |  | 53 |       print "OEM String Array: " . join(",", (in $objItem->{OEMStringArray})) . "\n"; 
 | 
        
           |  |  | 54 |       print "Part Of Domain: $objItem->{PartOfDomain}\n"; 
 | 
        
           |  |  | 55 |       print "Pause After Reset: $objItem->{PauseAfterReset}\n"; 
 | 
        
           |  |  | 56 |       print "Power Management Capabilities: " . join(",", (in $objItem->{PowerManagementCapabilities})) . "\n"; 
 | 
        
           |  |  | 57 |       print "Power Management Supported: $objItem->{PowerManagementSupported}\n"; 
 | 
        
           |  |  | 58 |       print "PowerOn Password Status: $objItem->{PowerOnPasswordStatus}\n"; 
 | 
        
           |  |  | 59 |       print "Power State: $objItem->{PowerState}\n"; 
 | 
        
           |  |  | 60 |       print "Power Supply State: $objItem->{PowerSupplyState}\n"; 
 | 
        
           |  |  | 61 |       print "Primary Owner Contact: $objItem->{PrimaryOwnerContact}\n"; 
 | 
        
           |  |  | 62 |       print "Primary Owner Name: $objItem->{PrimaryOwnerName}\n"; 
 | 
        
           |  |  | 63 |       print "Reset Capability: $objItem->{ResetCapability}\n"; 
 | 
        
           |  |  | 64 |       print "Reset Count: $objItem->{ResetCount}\n"; 
 | 
        
           |  |  | 65 |       print "Reset Limit: $objItem->{ResetLimit}\n"; 
 | 
        
           |  |  | 66 |       print "Roles: " . join(",", (in $objItem->{Roles})) . "\n"; 
 | 
        
           |  |  | 67 |       print "Status: $objItem->{Status}\n"; 
 | 
        
           |  |  | 68 |       print "Support Contact Description: " . join(",", (in $objItem->{SupportContactDescription})) . "\n"; 
 | 
        
           |  |  | 69 |       print "System Startup Delay: $objItem->{SystemStartupDelay}\n"; 
 | 
        
           |  |  | 70 |       print "System Startup Options: " . join(",", (in $objItem->{SystemStartupOptions})) . "\n"; 
 | 
        
           |  |  | 71 |       print "System Startup Setting: $objItem->{SystemStartupSetting}\n"; 
 | 
        
           |  |  | 72 |       print "System Type: $objItem->{SystemType}\n"; 
 | 
        
           |  |  | 73 |       print "Thermal State: $objItem->{ThermalState}\n"; 
 | 
        
           |  |  | 74 |       print "Total Physical Memory: $objItem->{TotalPhysicalMemory}\n"; 
 | 
        
           |  |  | 75 |       print "User Name: $objItem->{UserName}\n"; 
 | 
        
           |  |  | 76 |       print "WakeUp Type: $objItem->{WakeUpType}\n"; 
 | 
        
           |  |  | 77 |       print "Workgroup: $objItem->{Workgroup}\n"; 
 | 
        
           |  |  | 78 |       print "\n"; 
 | 
        
           |  |  | 79 | } 
 | 
        
           |  |  | 80 |   | 
        
           |  |  | 81 | <STDIN>;
 |