Thread Computer Model auslesen (Windows)
(11 answers)
Opened by toclim at 2010-11-22 13:24
Ohne es testen zu können:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 #!/usr/bin/perl use warnings; use strict; use Data::Dumper; use Win32::OLE('in'); use constant wbemFlagReturnImmediately => 0x10; use constant wbemFlagForwardOnly => 0x20; my @computers = ("Computer1"); 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 Name FROM Win32_ComputerSystemProduct", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly); my @objItems=in($colItems); my $Name = $objItems[0]->{Name}; print "Name: $Name\n"; } |