http://www.perlmonks.org?node_id=142448


in reply to Accessing IIS information

What tilly said sums it up pretty good. Win32::OLE is really just a wrapper to get at OLE stuff. Beyond useing it, all the learning is about how OLE works. And like tilly said, the little differences between the Perl - VB syntax.

Look at this for more info on the IIS provider. What they're actually using is ADSI (Active Directory Services Interface). So you're going to want to read up on that too. I'd personally suggest learning a bit more about OLE and ADSI before you try to do too much. Understanding how all this works will go a long way to making it easier to write this stuff in perl.

Rich

Replies are listed 'Best First'.
Re: Re: Translating VBS to Perl
by saprice (Novice) on Feb 02, 2002 at 23:59 UTC
    I've managed to solve my problem with the help provided here and working through a similar example from Dave Roth's Win32 Perl Programming. The script must be run on a server that has IIS installed on it I've posted the rough working script below if anyone would like to offer some constructive comments
    use Win32::OLE ('in'); my @servers; my $WebService; my(@servers)=@ARGV if ($ARGV[0]); die "usage is findweb SERVERNAME [,SERVERNAME...]" unless ($servers[0] +); foreach my $Server (@servers){ print "Starting with Server $Server\n"; # Get an IIS COM object for the target machine unless($WebService = Win32::OLE->GetObject( "IIS://$Server/w3svc" +)) { print "Unable to find IIS service on $Server, Skipping\n"; next; } foreach my $webserver (in ($WebService)){ my $WebServer = $WebService->GetObject( "IIsWebServer",$webser +ver->{Name} ) || next; #no webserver available if(($WebServer->Class() ne "IIsWebServer") ) { next; #not a webserver object, hmm, skip } print "Starting Webserver $WebServer->{name}\n" foreach my $vdiroot (in ($WebServer)){ my $VRoot = $WebServer->GetObject( "IIsWebVirtualDir", $vd +iroot->{name} ) || next; #not a virtual directory object, hmm, skip if(($VRoot->Class() ne "IIsWebVirtualDir") ) { next; } foreach my $VSubdir (in ($VRoot)){ if($VSubdir->Class() eq "IIsWebVirtualDir") { print "\tVirtual Web Dir Name=/$VSubdir->{name} Pa +th=$VSubdir->{path}\n"; } elsif($VSubdir->Class() eq "IIsWebDirectory") { print "\tWeb Directory Name=/$VSubdir->{name}\n"; } else { next; #not a webdir or a vwebdir, hmm, skip } } } } print "done with server $Server\n"; }