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
- :
- setting default doc in IIS through installscript
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
‎Nov 08, 2007
09:29 AM
setting default doc in IIS through installscript
Guys,
Any ideas on how to set a virtual directory's default document through installscript?
Thanks
Any ideas on how to set a virtual directory's default document through installscript?
Thanks
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 09, 2007
01:04 PM
Try this vbscript:
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:{authenticationLevel=pktPrivacy}\\" _
& strComputer & "\root\microsoftiisv2")
Set colItems = objWMIService.ExecQuery _
("Select * from IIsWebServiceSetting")
For Each objItem in colItems
strDocs = objItem.DefaultDoc
objItem.DefaultDoc = strDocs & ",index.htm"
objItem.DefaultDocFooter = "FILE:c:\config\footer.htm"
objItem.EnableDefaultDoc = True
objItem.EnableDocFooter = True
objItem.Put_
Next
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 24, 2014
05:54 AM
Ancient thread I know but it's nice to have an answer for anyone searching for this question still...
For IIS 7 and 8 you need the metabase compatibility (Windows feature) installed to use these II6 metabase properties.
function UpdateDefaultDocSettings(virtualDirName)
OBJECT objIIS_Root, objVirtualDir;
begin
try
// Get the root IIS folder.
set objIIS_Root = CoGetObject("IIS://localhost/W3SVC/1/Root", "");
set objVirtualDir = objIIS_Root.GetObject("IISWebVirtualDir", virtualDirName);
if (IsObject(objIIS_Root) && IsObject(objVirtualDir)) then
// Update the virtual directory.
objVirtualDir.Put("DefaultDoc", "Login.aspx,Default.aspx");
objVirtualDir.SetInfo();
endif;
catch
// Show an error.
endcatch;
end;
For IIS 7 and 8 you need the metabase compatibility (Windows feature) installed to use these II6 metabase properties.
function UpdateDefaultDocSettings(virtualDirName)
OBJECT objIIS_Root, objVirtualDir;
begin
try
// Get the root IIS folder.
set objIIS_Root = CoGetObject("IIS://localhost/W3SVC/1/Root", "");
set objVirtualDir = objIIS_Root.GetObject("IISWebVirtualDir", virtualDirName);
if (IsObject(objIIS_Root) && IsObject(objVirtualDir)) then
// Update the virtual directory.
objVirtualDir.Put("DefaultDoc", "Login.aspx,Default.aspx");
objVirtualDir.SetInfo();
endif;
catch
// Show an error.
endcatch;
end;