in reply to Re: Translating VBS to Perl
in thread Accessing IIS information

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"; }