Pretty cool. Here is the example it produces for Win32_registry (unedited):
use strict; use Win32::OLE('in'); use constant wbemFlagReturnImmediately => 0x10; use constant wbemFlagForwardOnly => 0x20; my @computers = ("INSPIRON"); 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_Regis +try", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly); foreach my $objItem (in $colItems) { print "Caption: $objItem->{Caption}\n"; print "CurrentSize: $objItem->{CurrentSize}\n"; print "Description: $objItem->{Description}\n"; print "InstallDate: $objItem->{InstallDate}\n"; print "MaximumSize: $objItem->{MaximumSize}\n"; print "Name: $objItem->{Name}\n"; print "ProposedSize: $objItem->{ProposedSize}\n"; print "Status: $objItem->{Status}\n"; print "\n"; } }sub WMIDateStringToDate(strDate) { return "blah"; }
But the Readme file is genuinely bizarre. Someone should tell the "Scripting Guys" that they aren't that funny. They sound like a bad parody of teenage hackers.
Scriptomatic 2.0: Readme

Throughout most of history people were much easier to please than they are now. For example, it's unlikely that anyone ever went up to Luke the evangelist and said, "One Gospel? Come on, Luke. I mean, Matthew, Mark, John - anybody can write one Gospel." Upon being introduced to someone at a cocktail party Neil Armstrong probably never had to hear, "Oh, first man on the moon? I see ...." Did anyone ever say to the Pharaoh Cheops, "Well, it's a good pyramid, Cheops, but I don't know about a great pyramid ...." Of course they didn't.

Well, not if they knew what was good for them, anyway.

Today it's a bit different: not only are people notoriously hard to please, but even if you do have a success there's no guarantee that anyone will be satisfied. After all, nothing is worse than being labeled a one-trick pony, a one-hit wonder, or a flash-in-the-pan. We remember William Shakespeare, but only because he wrote hundreds of plays and sonnets. Who remembers the rock duo Mouth and McNeal? Nobody. And that's because Mouth and McNeal had one hit song, and then were never heard from again. Stephen King will be remembered forever because of his prolific productivity, but does anyone out there have the slightest idea who wrote the Epic of Gilgamesh?

Well, OK, it probably was Stephen King. Then what about - right, he probably wrote that, too. But you know what we mean.

Now, to be honest, we Microsoft Scripting Guys were never too concerned about being one-hit wonders; after all, you can't be a one-hit wonder unless you first have a hit. We were sure nobody would ever hear of us, and somehow that seemed better than being remembered and then just as quickly forgotten. Remember baseball's Joltin' Joe Charboneau? Exactly.

But then we made a terrible mistake: we released the original Scriptomatic - the amazing utility that actually wrote WMI scripts for you - and it turned out to be a hit. That was not intentional, by the way. The Scriptomatic was originally thrown together when one of the Scripting Guys was looking for a socko-boffo ending for a WMI presentation he had to make for an internal Microsoft audience. Literally minutes before the presentation was to begin, he created something called the Scriptomatic, an HTA (HTML Application) that could write rudimentary WMI scripts. He showed off his new creation at the end of the talk, and the response was both overwhelming and unanimous; as noted in the official annals of the Scripting Guys, everyone in the room stood up as one and said, "Can we go now?" Not the most auspicious debut a piece of software has ever had, though it probably still tops the reception accorded Microsoft Bob.

...

It goes on like that.

--
John.


In reply to Re: Win32::OLE made easy! by jmcnamara
in thread Win32::OLE made easy! by husker

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.