Thank you for the sample code, it is very helpful.  Though I do have a
question about Win32::OLE functionality.  The script receives what looks
like a perl hash from the Win32::Ole->GetObject function, but when I try to
process it like a hash, it returns nothing.  Yet when you access a hash key
by name, it is populated.  How can this be?

Essentially I want to be able to enter the Root_Path and enumerate all
values below that path.


thanks
Chuck

<snip>
use Win32::Ole;
use Win32::Ole::Enum;

my $Root_Path = "IIS://localhost/w3svc";
my $IIS = Win32::OLE->GetObject( $Root_Path );
if ($IIS) {
        print "name = $IIS->{Name}\n";
        my $enumIIS = Win32::OLE::Enum->new($IIS);
        foreach my $objSites ($enumIIS->All) {
                print "objcet $objSites\n";
                while (my ($object, $value) = each %$objSites) {
                        print "$object, $value\n";
                }
        }
}
</snip>


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of
Iacoboni, Vince
Sent: April 25, 2002 8:29 AM
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: Access the IIS metabase


There's some examples in Dave Roth's book Win32 Perl Scripting.  Highly
Recommended.  Here's a sample:

#  IISProperty.pl
#  Example 9.12:
#  ----------------------------------------
#  From "Win32 Perl Scripting: Administrators Handbook" by Dave Roth
#  Published by New Riders Publishing.
#  ISBN # 1-57870-215-1
#
#  This script sets a property in a web server.
#
print "From the book 'Win32 Perl Scripting: The Administrator's Handbook' by
Dave Roth\n\n";


use Getopt::Long;
use Win32;
use Win32::OLE qw( in );

Configure( \%Config );
push( @ARGV, Win32::DomainName() ) if( ! scalar @ARGV );
foreach my $Machine ( @ARGV )
{
  my $ADsPath = "IIS://$Machine";
  if( my $IIS = Win32::OLE->GetObject( $ADsPath ) )
  {
    ProcessObject( $IIS );
  }
}

sub ProcessObject
{
  my( $Object ) = @_;
  local $PropertyName;
  my $fDirty = 0;

  print "\n$Object->{ADsPath}\n";
  foreach my $Property ( sort( keys( %{$Config{prop}} ) ) )
  {
    my $Value = $Config{prop}->{$Property};
    next unless( defined $Object->{$Property} );

    if( $Config{set} )
    {
      print "  Setting '$Property' => '$Value'\n";
      $Object->{$Property} = $Value;
      $fDirty = 1;
    }
    else
    {
      print "  $Property: $Object->{$Property}\n";
    }
  }
  $Object->SetInfo() if( $fDirty );
}

sub Configure
{
    my( $Config ) = @_;
    my $Result;
    Getopt::Long::Configure( "prefix_pattern=(-|\/)" );
    $Result = GetOptions( $Config,
              qw(
                prop|p=s%
                set|s
              ) );
  return();
}

> -----Original Message-----
> From: Chuck Lee [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, April 24, 2002 5:53 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Access the IIS metabase
>
>
> Do you have any specific sample code for accessing the
> metabase through
> Win32::OLE?  I'm not very familiar with VB concepts so any
> help would be
> appreciated.
>
> thanks
> Chuck


This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.


_______________________________________________
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