ADSI through Win32::OLE

  • Thread starter damien.chaumette
  • Start date
D

damien.chaumette

Hi, I need to be able to deploy an IIS configuration using a perl
script.
Therefore I've been looking into Win32::OLE, which allowed me to Dump
my config and make changes to the existing keys.
Now my problem is that I can't create a new Object or a new Property,
I've been looking around and found that piece of VB code:

Set IIsWebVDirRootObj = GetObject("IIS://localhost/W3SVC/1/Root")
Set IIsWebVDirObj = IIsWebVDirRootObj.Create("IIsWebVirtualDir",
"NewVDir")

Which successully created a new Object in my tree whereas the same code
in Perl left the tree unchanged (without warning nor error):

my $root = Win32::OLE->GetObject("IIS://localhost/W3SVC/1/Root");
my $o = $root->Create("IIsWebVirtualDir", "ReallyNewVDir");

Any ideas or suggestions?

Thanks,
Damien
 
M

Mark Clements

Hi, I need to be able to deploy an IIS configuration using a perl
script.
Therefore I've been looking into Win32::OLE, which allowed me to Dump
my config and make changes to the existing keys.
Now my problem is that I can't create a new Object or a new Property,
I've been looking around and found that piece of VB code:

Set IIsWebVDirRootObj = GetObject("IIS://localhost/W3SVC/1/Root")
Set IIsWebVDirObj = IIsWebVDirRootObj.Create("IIsWebVirtualDir",
"NewVDir")

Which successully created a new Object in my tree whereas the same code
in Perl left the tree unchanged (without warning nor error):

my $root = Win32::OLE->GetObject("IIS://localhost/W3SVC/1/Root");
my $o = $root->Create("IIsWebVirtualDir", "ReallyNewVDir");

Is the result of executing "Create" twice with the same key name (here
it's "IIsWebVirtualDir") defined?

Will the VB code *change* the name (not just create it) if you execute
it a second time but with a different string ie not "NewVDir"?

What happens if you run a "Delete" first?

Is $o defined after the call to create?

Mark
 
D

damien.chaumette

Mark said:
Is the result of executing "Create" twice with the same key name (here
it's "IIsWebVirtualDir") defined?

Will the VB code *change* the name (not just create it) if you execute
it a second time but with a different string ie not "NewVDir"?

What happens if you run a "Delete" first?

Is $o defined after the call to create?

The VB functions will create and not rename, therefore exiting when
executing a second time the function with the same parameters.

$o is never defined wether the Object to create exists or not and
executing several Create() don't change anything.
I tried to turn warnings on but I still don't get any output
($Win32::OLE::Warn = 3).

Damien
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top