Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Need windows system info

by softworkz (Monk)
on Mar 10, 2005 at 20:09 UTC ( #438406=note: print w/ replies, xml ) Need Help??


in reply to Re: Need windows system info
in thread Need windows system info

I think this will pretty much should get you started

use strict; use Win32::OLE('in'); use constant wbemFlagReturnImmediately => 0x10; use constant wbemFlagForwardOnly => 0x20; my @computers = ("PUTYOURCOMPUTERNAMEHERE"); foreach my $computer (@computers) { print "\n"; print "==========================================\n"; print "Computer: $computer\n"; print "==========================================\n"; my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$computer\\ +root\\CIMV2") or die "WMI connection failed.\n"; my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_Opera +tingSystem", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly); foreach my $objItem (in $colItems) { print "BootDevice: $objItem->{BootDevice}\n"; print "BuildNumber: $objItem->{BuildNumber}\n"; print "BuildType: $objItem->{BuildType}\n"; print "CreationClassName: $objItem->{CreationClassName}\n"; print "CSCreationClassName: $objItem->{CSCreationClassName}\n"; print "CSDVersion: $objItem->{CSDVersion}\n"; print "FreePhysicalMemory: $objItem->{FreePhysicalMemory}\n"; print "FreeVirtualMemory: $objItem->{FreeVirtualMemory}\n"; print "InstallDate: $objItem->{InstallDate}\n"; print "LastBootUpTime: $objItem->{LastBootUpTime}\n"; print "LocalDateTime: $objItem->{LocalDateTime}\n"; print "Manufacturer: $objItem->{Manufacturer}\n"; print "Name: $objItem->{Name}\n"; print "NumberOfProcesses: $objItem->{NumberOfProcesses}\n"; print "NumberOfUsers: $objItem->{NumberOfUsers}\n"; print "Organization: $objItem->{Organization}\n"; print "OSType: $objItem->{OSType}\n"; print "RegisteredUser: $objItem->{RegisteredUser}\n"; print "SerialNumber: $objItem->{SerialNumber}\n"; print "ServicePackMajorVersion: $objItem->{ServicePackMajorVersi +on}\n"; print "ServicePackMinorVersion: $objItem->{ServicePackMinorVersi +on}\n"; print "Status: $objItem->{Status}\n"; print "SystemDevice: $objItem->{SystemDevice}\n"; print "SystemDirectory: $objItem->{SystemDirectory}\n"; print "Version: $objItem->{Version}\n"; print "WindowsDirectory: $objItem->{WindowsDirectory}\n"; print "\n"; } system("ipconfig /all"); }sub WMIDateStringToDate(strDate) { return "blah"; }


Comment on Re^2: Need windows system info
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2014-07-14 10:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (257 votes), past polls