cosmicperl has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,
  I'm wondering if the following is possible, and if so how I would go about it.
I want to make a script that can automatically setup subdomains with IIS6 and maybe also IIS5.
Can this be done? And if so where would I start?

Thanks

Replies are listed 'Best First'.
Re: Interacting with IIS6
by marto (Cardinal) on Mar 09, 2007 at 13:17 UTC
    Hi cosmicperl,

    Under IIS6 I am pretty sure you can set it up so that the metabase xml file can be configured dynamically, so you could exit the XML via Perl. Failing that you could look at the examples from Microsoft for working II6 using VB and create a Perl script to do the same. For Perl examples of working with WMI have a look at The Script Center Script Repository: Sample Perl Scripts.

    Update: Perhaps Win32::IIS::Admin is of interest to you. I have never used it.

    Hope this helps.

    Martin
      Thanks Martin, I'll take a look
Re: Interacting with IIS6
by Discipulus (Canon) on Oct 19, 2007 at 12:00 UTC
    may is too late but...
    sub New_IIS_Site ################################################### +######### { my $ip = shift; my $header= shift; my $num; chomp $header; my $w3svc=Win32::OLE->GetObject("IIS://$ip/W3SVC")||die Win32::OLE->L +astError(); my $w3num; my $index; for($index=1;defined ($w3num=$w3svc->GetObject("","$index"));$index++ +) {next} my $bind=$ip.':80:'.$header; my $new=$w3svc->Create("IIsWebServer", "$index")||die Win32::OLE->Las +tError(); $new->{ServerBindings}=$bind; $new->{ServerComment}="$header"; #$new->Put('FrontPageWeb', "1")||die Win32::OLE->LastError();;##noo I + hate this point!! $new->SetInfo(); $new->Start(); my $newdir=$new->Create("IIsWebVirtualDir", "ROOT")||die Win32::OLE-> +LastError(); $newdir->{Path}="c:\\webroot\\_test";##################### $newdir->{AccessRead}="true";# $newdir->SetInfo(); return $index; }
    and my 257370 and my 257372

    PS I need your help!