Trying to edit a WMI script to return other information

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

Post Reply
Spectre256
Posts: 6
Joined: Thu Feb 17, 2005 10:02 am

Trying to edit a WMI script to return other information

Post by Spectre256 »

I am trying to use WMI to get information from my Windows 2003 server. I decided to edit the perl script that uses WMI to get DNS info. For refrence you can check out that script at http://www.spectre256.com/w32_dns_query_stats.txt
I looked at the page http://msdn.microsoft.com/library/defau ... lasses.asp and picked the class I want to monitor. Since one of the things I want to monitor is the SMTP server, I chose Win32_PerfFormattedData_SMTPSVC_SMTPServer. So I edited the script and chagned $Win32_Class to "Win32_PerfFormattedData_PerfDisk_PhysicalDisk", $class to "WinMgmts://$computer/root", and edited $properties to
BytesReceivedPerSec for testing. However I always get the error:

Check the comptuter and class name.
No information was found on the specified class!

Does anyone know how I can get this script to work? Thanks.
Spectre256
Posts: 6
Joined: Thu Feb 17, 2005 10:02 am

Post by Spectre256 »

For all you interested I figured out what the problem was. The line

Code: Select all

		my $computers = $wmi->ExecQuery("SELECT $properties FROM $Win32_Class Where CollectionId='4'");
must be changed to

Code: Select all

		my $computers = $wmi->ExecQuery("SELECT $properties FROM $Win32_Class");
Seems to work perfectly now
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest