Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Win32::OLE -remote access to WMI

Status
Not open for further replies.

svar

Programmer
Aug 12, 2001
350
GR
I need to access the WMI remotely and get a few attributes
I found the following script in

use vars qw( $Log $Message $Name $Value );
use strict;
use Win32::OLE qw( in );
my @OS_TYPE = qw(
Unknown Other Mac_OS ATTUNIX DGUX DECNT Digital_Unix
OpenVMS HPUX AIX MVS OS400 OS/2 JavaVM MSDOS
Windows_3x Windows_95 Windows_98 Windows_NT Windows_CE
NCR3000 NetWare OSF DC/OS Reliant_UNIX SCO UnixWare
SCO_OpenServer Sequent IRIX Solaris SunOS U6000 ASERIES
TandemNSK TandemNT BS2000 LINUX Lynx XENIX VM/ESA
Interactive_UNIX BSDUNIX FreeBSD NetBSD GNU_Hurd OS9
MACH_Kernel Inferno QNX EPOC IxWorks VxWorks MiNT
BeOS HP_MPE NextStep PalmPilot Rhapsody
);
# BEGIN CALLOUT A
my $Class = "Win32_OperatingSystem";
(my $Machine = shift @ARGV || "." ) =~ s/^[\\\/]+//;

# next is the part that fails
my $WMIServices = Win32::OLE->GetObject(
"winmgmts:{impersonationLevel=impersonate,(security)}//$Machine"
) || die "$!" ;

...

I call the script with
perl script.pl 10.100.65.68
(ip of the remote),
but it dies on the last statement -without any error messages. Anyone know what could be wrong here?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top