Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Translating VBS to Perl

by rchiav (Deacon)
on Jan 31, 2002 at 16:51 UTC ( [id://142448]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://142448]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2025-01-18 14:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which URL do you most often use to access this site?












    Results (56 votes). Check out past polls.