ADSI through Win32::OLE

Discussion in 'Perl Misc' started by damien.chaumette@gmail.com, Nov 3, 2006.

  1. Guest

    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
     
    , Nov 3, 2006
    #1
    1. Advertising

  2. wrote:
    > 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
     
    Mark Clements, Nov 4, 2006
    #2
    1. Advertising

  3. Guest

    Mark Clements wrote:

    > wrote:
    > > 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?


    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
     
    , Nov 6, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?ZG90bmV0dGVzdGVy?=

    Retrieving mailbox information through ADSI

    =?Utf-8?B?ZG90bmV0dGVzdGVy?=, Aug 31, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    451
    =?Utf-8?B?ZG90bmV0dGVzdGVy?=
    Aug 31, 2005
  2. Patrick.O.Ige

    Ole ole

    Patrick.O.Ige, Jul 16, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    526
    Patrick.O.Ige
    Jul 16, 2006
  3. Drew Pihera
    Replies:
    0
    Views:
    668
    Drew Pihera
    Feb 4, 2004
  4. Berger, Daniel
    Replies:
    1
    Views:
    205
  5. Lance Hoffmeyer
    Replies:
    0
    Views:
    275
    Lance Hoffmeyer
    Nov 17, 2003
Loading...

Share This Page