This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Deleting the existting IIS Virtual Directory
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 14, 2010
09:09 PM
Deleting the existting IIS Virtual Directory
Hi.
Is there any ways that the MSI can delete the IIS Virtual Diectory (or web application) under the Default Web Site, before installing a feature.
Thanks
Thurein
Is there any ways that the MSI can delete the IIS Virtual Diectory (or web application) under the Default Web Site, before installing a feature.
Thanks
Thurein
(9) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 15, 2010
05:17 AM
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
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
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 15, 2010
08:32 PM
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
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
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 16, 2010
06:50 AM
What part of the ROOT are you deleting?
Post your full code example.
Post your full code example.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 18, 2010
09:13 PM
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: %s" , "MyVitualDir");
else
SprintfMsiLog ( "DeleteVirtualDir could not delete virtual directory: %s" , "MyVitualDir");
endif;
end;
Thanks
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: %s" , "MyVitualDir");
else
SprintfMsiLog ( "DeleteVirtualDir could not delete virtual directory: %s" , "MyVitualDir");
endif;
end;
Thanks
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 19, 2010
06:23 AM
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.
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.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 20, 2010
09:31 PM
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
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
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 21, 2010
03:04 AM
Are you running it in the execute part of the installation and not from a button click?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 22, 2010
01:13 AM
I just double clicked on the setup.exe.
Thanks
Thanks
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 22, 2010
04:26 AM
Yes, you need to run the installation using the setup.exe, but where/how are you running the custom action to delete the virtual directory?
![](/skins/images/8C9D13A71C7F7695F3262372C0172D68/responsive_peak/images/icon_anonymous_message.png)