The new scriptomatic 2.0 will generate WMI scripts in VBScript, Perl,
and Javascript. It will be released in August, but you can email
[EMAIL PROTECTED] to get a preview version.

The old one is found at
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scrip
tcenter/tools/wmimatic.asp but it does not generate Perl scripts.


Example skeleton script:

use strict;
use Win32::OLE('in');

use constant wbemFlagReturnImmediately => 0x10;
use constant wbemFlagForwardOnly => 0x20;

my @computers = ("COMPUTER");
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 * FROM
Win32_OperatingSystem", "WQL",
                  wbemFlagReturnImmediately | wbemFlagForwardOnly);

   foreach my $objItem (in $colItems) {
      print "BootDevice: $objItem->{BootDevice}\n";
      print "BuildNumber: $objItem->{BuildNumber}\n";
      print "BuildType: $objItem->{BuildType}\n";
      print "Caption: $objItem->{Caption}\n";
      print "CodeSet: $objItem->{CodeSet}\n";
      print "CountryCode: $objItem->{CountryCode}\n";
      print "CreationClassName: $objItem->{CreationClassName}\n";
      print "CSCreationClassName: $objItem->{CSCreationClassName}\n";
      print "CSDVersion: $objItem->{CSDVersion}\n";
      print "CSName: $objItem->{CSName}\n";
      print "CurrentTimeZone: $objItem->{CurrentTimeZone}\n";
      print "Debug: $objItem->{Debug}\n";
      print "Description: $objItem->{Description}\n";
      print "Distributed: $objItem->{Distributed}\n";
      print "EncryptionLevel: $objItem->{EncryptionLevel}\n";
      print "ForegroundApplicationBoost:
$objItem->{ForegroundApplicationBoost}\n";
      print "FreePhysicalMemory: $objItem->{FreePhysicalMemory}\n";
      print "FreeSpaceInPagingFiles:
$objItem->{FreeSpaceInPagingFiles}\n";
      print "FreeVirtualMemory: $objItem->{FreeVirtualMemory}\n";
      print "InstallDate: $objItem->{InstallDate}\n";
      print "LargeSystemCache: $objItem->{LargeSystemCache}\n";
      print "LastBootUpTime: $objItem->{LastBootUpTime}\n";
      print "LocalDateTime: $objItem->{LocalDateTime}\n";
      print "Locale: $objItem->{Locale}\n";
      print "Manufacturer: $objItem->{Manufacturer}\n";
      print "MaxNumberOfProcesses: $objItem->{MaxNumberOfProcesses}\n";
      print "MaxProcessMemorySize: $objItem->{MaxProcessMemorySize}\n";
      print "Name: $objItem->{Name}\n";
      print "NumberOfLicensedUsers:
$objItem->{NumberOfLicensedUsers}\n";
      print "NumberOfProcesses: $objItem->{NumberOfProcesses}\n";
      print "NumberOfUsers: $objItem->{NumberOfUsers}\n";
      print "Organization: $objItem->{Organization}\n";
      print "OSLanguage: $objItem->{OSLanguage}\n";
      print "OSProductSuite: $objItem->{OSProductSuite}\n";
      print "OSType: $objItem->{OSType}\n";
      print "OtherTypeDescription: $objItem->{OtherTypeDescription}\n";
      print "PAEEnabled: $objItem->{PAEEnabled}\n";
      print "PlusProductID: $objItem->{PlusProductID}\n";
      print "PlusVersionNumber: $objItem->{PlusVersionNumber}\n";
      print "Primary: $objItem->{Primary}\n";
      print "ProductType: $objItem->{ProductType}\n";
      print "QuantumLength: $objItem->{QuantumLength}\n";
      print "QuantumType: $objItem->{QuantumType}\n";
      print "RegisteredUser: $objItem->{RegisteredUser}\n";
      print "SerialNumber: $objItem->{SerialNumber}\n";
      print "ServicePackMajorVersion:
$objItem->{ServicePackMajorVersion}\n";
      print "ServicePackMinorVersion:
$objItem->{ServicePackMinorVersion}\n";
      print "SizeStoredInPagingFiles:
$objItem->{SizeStoredInPagingFiles}\n";
      print "Status: $objItem->{Status}\n";
      print "SuiteMask: $objItem->{SuiteMask}\n";
      print "SystemDevice: $objItem->{SystemDevice}\n";
      print "SystemDirectory: $objItem->{SystemDirectory}\n";
      print "SystemDrive: $objItem->{SystemDrive}\n";
      print "TotalSwapSpaceSize: $objItem->{TotalSwapSpaceSize}\n";
      print "TotalVirtualMemorySize:
$objItem->{TotalVirtualMemorySize}\n";
      print "TotalVisibleMemorySize:
$objItem->{TotalVisibleMemorySize}\n";
      print "Version: $objItem->{Version}\n";
      print "WindowsDirectory: $objItem->{WindowsDirectory}\n";
      print "\n";
   }
}


-----Original Message-----
From: Webb, Andy [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 31, 2003 12:19 PM
To: [EMAIL PROTECTED]
Subject: RE: wmi - sorry?

The WMI SDK is part of the Platform SDK that can be found documented on
MSDN.  Translating from the vbscript examples gets pretty easy once
you've done it a couple times.

A google search on "WMI perl" comes up with a list of good content.

-----Original Message-----
From: hugh s [mailto:[EMAIL PROTECTED] 
Posted At: Wednesday, July 30, 2003 9:35 AM
Posted To: perl-win32-admin
Conversation: wmi - sorry?
Subject: wmi - sorry?

I've got a few notes about the nature of my questions. They've
mentioned that perhaps this isn't the group for them.  But
perl and these automation hooks are so intertwined that, well,
who else to ask?  Please suggest a list or
group if you think this belongs elsewhere. 
I'm using perl as the script to motor it so here goes.

I've automated Xcel etc buy muddling threw objects with
their browser.  There's a lot of suggestions to use 
WMI in this group and so I ask, where are the objects and 
how do I browse? I went to uS and see the have various 
interfaces.  I can't figure out which interface perl uses.

Thanks - I'm just starting this WinK server stuff (which is half the
problem)


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to