Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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"; }

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

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2021-10-25 08:11 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (89 votes). Check out past polls.