I am trying to squeeze this perl script into an APM template but can't figure out whats wrong. I'm hoping some APM expert out there could look at provide a solution.
On the Script Engine: line I have perl ${SCRIPT} arg1
The Script body contains:
#!perl
# Simple Perl Script to illustrate use of WMI to gather system information
# and display it in the same format at the Windows Management Console
use Win32::OLE qw(in with);
use Win32::Registry;
# Pick a host that you have the necessary rights to monitor
$host = $ENV{COMPUTERNAME};
$host=$ARGV[0] if ($ARGV[0]);
# Gather System Information
$WMI = Win32::OLE->new('WbemScripting.SWbemLocator') ||
die "Cannot access WMI on local machine: ", Win32::OLE->LastError;
$Services = $WMI->ConnectServer($host) ||
die "Cannot access WMI on remote machine: ", Win32::OLE->LastError;
# Gather Computer System Information
$sys_set = $Services->InstancesOf("Win32_ComputerSystem");
foreach $sys (in($sys_set))
{
$system_name = $sys->{'Caption'};
$system_manufacturer = $sys->{'Manufacturer'};
$system_model = $sys->{'Model'};
}
# Gather BIOS Information
$bios_set = $Services->InstancesOf("Win32_BIOS");
foreach $bios (in($bios_set))
{
$service_tag = $bios->{'SerialNumber'};
}
print "System Summary Information\n";
print "--------------------------\n";
print "OS Manufacturer\t\t\t$os_manufacturer\n";
print "System Name\t\t\t$system_name\n";
print "System Manufacturer\t\t$system_manufacturer\n";
print "System Model\t\t\t$system_model\n";
print "ServiceTag\t\t\t$service_tag\n";
print "Statistic: 0\n";
exit 1;
My Script Arguments is ${IP}
I know that the script runs from a command line by using this syntax c:\perl wmi1.pl <IP Address>
Any help would be appreciated