Loading
  • Hi,

     

    I don't know of a way to do it through installshield.

     

    I used a custom action.

     

    function DeleteVirtualDir(hMSI, szDeleteVR)

     

    OBJECT objIIS_Root, objIIS_Sub;

     

    begin

     

    set objIIS_Root = CoGetObject("IIS://localhost/W3SVC/1/Root", "");

     

    set objIIS_Sub = CoGetObject("IIS://localhost/W3SVC/1/Root/" + szDeleteVR, "");

     

    if (IsObject(objIIS_Sub)) then

     

    objIIS_Root.Delete("IISWebVirtualDir", szDeleteVR);

     

    SprintfMsiLog ( "DeleteVirtualDir deleted virtual directory: %s" , szDeleteVR);

     

    else

     

    SprintfMsiLog ( "DeleteVirtualDir could not delete virtual directory: %s" , szDeleteVR);

     

    endif;

     

    end;

     

     

    hope this helps.

     

    Vijay
    Expand Post
  • I was trying to get the IIS object by using the following code almost the same logic as urs

     

    set objIIS_Root = CoGetObject("IIS://localhost/W3SVC/1/Root", "");

     

    if (IsObject(objIIS_Root)) then

     

    \\do delete

     

    but the objIIS_Root object got empty all the time so it won't pass the if statement and the delete logic will not be executed. I have tested the above code in both IIS 6 and 7. Pls advice what I am doing wrong.

     

    Thanks Thurein
    Expand Post
  • following is my code. When I check the MSI log, it said "could not delete virtual directory" which means it is only going through the else statement. In my IIS, I have a "Default Web Site" and under that I created a Application called "MyVitualDir".

     

    function MyFunction(hMSI)

     

    OBJECT objIIS_Root, objIIS_Sub;

     

    begin

     

    set objIIS_Root = CoGetObject("IIS://localhost/W3SVC/1/Root", "");

     

    set objIIS_Sub = CoGetObject("IIS://localhost/W3SVC/1/Root/MyVitualDir" , "");

     

    if (IsObject(objIIS_Sub)) then

     

    objIIS_Root.Delete("IISWebVirtualDir", "MyVitualDir");

     

    SprintfMsiLog ( "DeleteVirtualDir deleted virtual directory: &37;s" , "MyVitualDir");

     

    else

     

    SprintfMsiLog ( "DeleteVirtualDir could not delete virtual directory: %s" , "MyVitualDir");

     

    endif;

     

    end;

     

    Thanks
    Expand Post
  • Hi,

     

    Is the action you have created, deferred in system context?

     

    On operating systems with UAC.

     

    It needs to be deferred in system context to remove the iis. So you might aswell try this before the IIS website are created again in the execute part of the msi installation.
    Expand Post
  • Hi,

     

    I have set the "In-Script Execution" to "Deffered Execution in System Context" and "Install Exec Sequence" to "After InstallInitialize" but it is still going through the else statement. Any idea ?

     

    Thanks
    Expand Post

Loading
Deleting the existting IIS Virtual Directory