/ Published in: Perl
Refer to http://msdn.microsoft.com/en-us/library/aa394512(VS.85).aspx
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/usr/bin/perl -w # use bin\perl.exe wmi.pl to run. # have fun! # 2009/6/17 twitter.com/vinocui # # useful links: # (WMI space definition) http://msdn.microsoft.com/en-us/library/aa394084(VS.85).aspx # (OLE usage on CPAN) http://cpan.uwinnipeg.ca/htdocs/Win32-OLE/Win32/OLE.html#Object_methods_and_properties # use Win32::OLE; #my $wmi = Win32::OLE->GetObject("winmgmts://./root/cimv2") or die "failed to retrieve cimv2."; # winmgmts means to access WMI service. my $list, my $v; # http://msdn.microsoft.com/en-us/library/aa394373(VS.85).aspx # Minimum supported client Windows 2000 Professional # Minimum supported server Windows 2000 Server foreach $v (Win32::OLE::in $list){ } # http://msdn.microsoft.com/en-us/library/aa394239(VS.85).aspx # Windows Server 2003, Windows XP, Windows 2000, and Windows NT 4.0: # If a computer has multiple operating systems installed, this class only returns an # instance for the currently active operating system. foreach $v (Win32::OLE::in $list){ } # http://msdn.microsoft.com/en-us/library/aa394512(VS.85).aspx # Windows Server 2003, Windows XP, Windows 2000, and Windows NT 4.0: This class is supported. foreach $v (Win32::OLE::in $list){ } 0;