The problem is that the code I'm doing is trying to enumerate through
the metabase, and it doesn't know what every object's attribute are,
since that'd be a LOT of redundant coding (and what about when it goes
to IIS 7 and the metabase changes?) - meaning that it needs to find out
the attributes.  Usually, I can do this with MandatoryProperties and
OptionalProperties, but stuff like AdminACL doesn't work that way.  And
when I read AdminACL, it shows up as the famed Win32::OLE::Hash.

The basic question is, how can I turn Win32::OLE::Hash into something I
can understand?

--------------------------
Mike Sweetser | Systems Administrator

Adhost Internet
140 Fourth Avenue North, Suite 360, Seattle, Washington 98109 USA
P 206.404.9023    T 888.234.6781 (ADHOST-1)    F 206.404.9050
E [EMAIL PROTECTED]    W adhost.com

Our brand new Adhost West data center is open - contact us for a tour at
1-888-234-6781 (ADHOST-1)
-----Original Message-----
From: Steven Manross [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 17, 2007 10:16 AM
To: Mike Sweetser - Adhost; perl-win32-admin@listserv.ActiveState.com
Subject: RE: Enumerating Win32::OLE::Hash?

I would use a tool like MetaEdit tool from the IIS 6 Resource Kit
instead of enumming attrubutes.

But, I can see where enumming the properties would get you more familiar
with the programming side of it.

Here's the link for the IIS 6 Resource Kit:

http://www.microsoft.com/downloads/details.aspx?FamilyID=56fc92ee-a71a-4
c73-b628-ade629c89499&DisplayLang=en  

Steven

Here's some code I haven't looked at in years...

use Win32::OLE;
use Win32::OLE::Enum;

@servers= ("SOMESERVER");

@web_services = ("w3svc","msftpsvc","");

%server_states = ( '1' => 'Starting',
                   '2' => 'Started',
                   '3' => 'Stopping',
                   '4' => 'Stopped',
                   '5' => 'Pausing',
                   '6' => 'Paused',
                   '7' => 'Continuing'
                 );

foreach $server (@servers) { 
  print "$server\n"; 
  foreach $service (@web_services) {
    $Root_Path = "IIS://$server/$service"; 
    $IIS = Win32::OLE->GetObject( $Root_Path ); 
    if ($IIS) { 
      $enumIIS = Win32::OLE::Enum->new($IIS); 
      foreach $objSites ($enumIIS->All) { 
        print "\n";
        if (!($objSites->{Name} =~ /(Filters|Info|SSLKeys)/)) { 
          print "  $IIS->{Name}\n";
          $ServerBindings = $objSites->{ServerBindings};
          $ServerState = $objSites->{ServerState};
          foreach $item (@{$ServerBindings}) {
            $item =~ /(.*):(.*):(.*)/;
            $IP = $1||"(All Unassigned)";
            $TCP = $2||"80";
          $hostheader = $3;
            print "    $IP ($TCP)";
            if ($hostheader ne "") {
              print "    HostHeader = $hostheader";
            }
            print "\n";
            print "    parent-object: $IIS->{Name}\n";
            print "    server-state: $server_states{$ServerState}\n";
            print "    name: $objSites->{Name}\n";
            print "    server-comment: $objSites->{ServerComment}\n";
            if ($service ne "msftpsvc") {
              print "    auth: ";
              if ($objSites->{AuthAnonymous}) {
                print "Anonymous ";
              } elsif ($objSites->{AuthBasic}) {
                print "Basic ";
              } elsif ($objSites->{AuthNTLM}) {
                print "NTLM ";
              }
              print "\n";
              print "    Path: $objSites->{Path}\n";
 
              if ($objSites->{EnableDefaultDoc}) {
                print "    Default Doc Enabled\n";
                if ($objSites->{DefaultDoc}) {
                  print "    default-doc: $objSites->{DefaultDoc}\n";
                } else {
                  print "    No Default Doc\n";
                }
              } else {
                print "    Default Doc Disabled\n";
              }
              if ($objSites->{EnableDirBrowsing}) {
                print "    Directory Browsing Enabled\n";
              } else {
                print "    Sub-dirs:\n";
                $enumobjSites = Win32::OLE::Enum->new($objSites); 
                foreach $objdirs ($enumobjSites->All) { 
                  print "      $objdirs->{Name}  - Directory Browsing";
                  if ($objdirs->{EnableDirBrowsing}) {
                    print " Enabled\n";
                  } else {
                    print " Disabled\n";
                  }
                  print "        Path: $objdirs->{Path}\n";
                }
              }
            }
          }
        }
      }
    }
  }
}

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Mike Sweetser - Adhost
> Sent: Monday, October 08, 2007 3:55 PM
> To: perl-win32-admin@listserv.ActiveState.com
> Subject: Enumerating Win32::OLE::Hash?
> 
> What is the best way to enumerate the properties for 
> something returning back as Win32::OLE=Hash?  I'm trying to 
> crawl the IIS metabase, and I need to figure out what the 
> available properties are on a particular item.
> 
> Mike Sweetser
> 
> --------------------------
> Mike Sweetser | Systems Administrator
> 
> Adhost Internet
> 140 Fourth Avenue North, Suite 360, Seattle, Washington 98109 USA
> P 206.404.9023    T 888.234.6781 (ADHOST-1)    F 206.404.9050
> E [EMAIL PROTECTED]    W adhost.com
> 
> Our brand new Adhost West data center is open - contact us 
> for a tour at
> 1-888-234-6781 (ADHOST-1)
> 
> _______________________________________________
> Perl-Win32-Admin mailing list
> Perl-Win32-Admin@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 
> 
_______________________________________________
Perl-Win32-Admin mailing list
Perl-Win32-Admin@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to