Greetings peoples.

I am using Win32::OLE and ADSI to create a perl script which will allow me
to add new web servers to an NT4 Server running IIS4.

Yes I know there are WSH and VBScripts that do this, but perl is better.
Eg: I reduced 30 lines of VBScript to 15 in perl :-p

Anyway I have a question about the "Create" method use by Win32::OLE. For
example, the following VBScript will create a new webserver in IIS:

(Note this code is cut down pretty hugely)
# Get a handle on our IIS object:
GetObject("IIS://"&comp&"/w3svc/" & Index)

# Now tell OLE to create the new webserver
w3svc.Create("IIsWebServer", Index)

That works fine using VBScript, the object is created in the IIS metabase
with no problems, but, the equivilent code in perl seems to have some issues
when I do:

my $adsiobj0 = Win32::OLE->GetObject("IIS://$hostname/W3SVC");
my $number = &GetNextWebNumber();
$adsiobj0->Invoke("Create","IIsWebServer",$number);
$adsiobj0->Invoke("SetInfo");

For this above perl code to work I need to grab the new object:
my $adsiobj1 = Win32::OLE->GetObject("IIS://$hostname/W3SVC/$number");

And then set the key type.
$adsiobj1->{KeyType} = "IIsWebServer";
$adsiobj1->Invoke("SetInfo");

The setting of the key type does not appear to be neccessary in the VBScript
version.

I would like to know where this deficiency lies. Is it in the Win32:OLE perl
module? Or is their something else I am missing here?

cheers
Andrew

-- 
Andrew Best                              -              Systems Engineer 
Pacific Internet (Australia) Pty Ltd     -     http://www.pacific.net.au
"Your process hath shuffled off this mortal coil."
- The bard does error messages.
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

Reply via email to