Link to home
Start Free TrialLog in
Avatar of naexpert
naexpert

asked on

Script available to add MIME type and Documents?

Hi Experts,

Is there a way to add MIME Types and Documents to IIS6.0 without using Internet Information Services Manager (IISM)? Im thinking there may be a script available or command line systax that I'm not aware of?

IIS 6.0 Windows 2003 SP1

Virtual Directory | Properties | Documents | Enable / Add default page

Virtual Directory | Properties | HTTP Headers | MIME Types | New

Thanks you for your advice,

Cheers, naexpert
ASKER CERTIFIED SOLUTION
Avatar of meverest
meverest
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of naexpert
naexpert

ASKER

Hi meverest,

I'll try this and give you feedback asap.

Thanks for your input.

Cheers, naexpert.
Hi meverest,

I tried your script and it works for MIME types, brilliant, part of my original question was also about how to add documents?

Virtual Directory | Properties | Documents | Enable / Add default page

If you can provide me with this info, then you've cracked it!

Cheers, naexpert.
I eventually found the syntax to add documents...

Adsutil.vbs set w3svc/defaultdoc "default.htm,default.html,default.asp,default.aspx,index.htm,index.html,index.
asp,index.aspx,temp.htm"

Thanks for your help.
Hi,

you do it the same way for documents.

use the 'enum' command demonstrated above to see what the existing context objects are, then use 'set' to change them.

e.g:

C:\Inetpub\AdminScripts>cscript adsutil.vbs enum W3SVC/1/Root/
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

KeyType                         : (STRING) "IIsWebVirtualDir"
AppRoot                         : (STRING) "/LM/W3SVC/1/Root"
.. etc ..

HttpExpires                     : (STRING) "D, 0"
DefaultDoc                      : (STRING) "Default.aspx,Default.htm,Default.asp,index.htm,iisstart.htm"
Path                            : (STRING) "C:\Inetpub\wwwroot\"

.. etc ..

MimeMap                         : (MimeMapList) ".special,some/special" ".special2,some/special2"
DirBrowseFlags                  : (INTEGER) 3221225534
EnableDirBrowsing               : (BOOLEAN) True
DirBrowseShowDate               : (BOOLEAN) True
DirBrowseShowTime               : (BOOLEAN) True
DirBrowseShowSize               : (BOOLEAN) True
DirBrowseShowExtension          : (BOOLEAN) True
DirBrowseShowLongDate           : (BOOLEAN) True
EnableDefaultDoc                : (BOOLEAN) True
AuthFlags                       : (INTEGER) 7

.. etc ..

EnableDirBrowsing               : (BOOLEAN) True
DirBrowseShowDate               : (BOOLEAN) True
DirBrowseShowTime               : (BOOLEAN) True
[/W3SVC/1/Root/aspnet_client]
[/W3SVC/1/Root/cgi-bin]
[/W3SVC/1/Root/WWW]

see in the list these two lines:


DefaultDoc                      : (STRING) "Default.aspx,Default.htm,Default.asp,index.htm,iisstart.htm"

and:

EnableDefaultDoc                : (BOOLEAN) True

This tells us that the DefaultDoc key is a comma delimited list of document names, and the enable default doc is a boolean.

so to set the DefaultDoc, we do:

adsutil.vbs enum W3SVC/1/Root/DefaultDoc "mydoc.html,Default.aspx,Default.htm,Default.asp,index.htm"

and to enable:

adsutil.vbs enum W3SVC/1/Root/EnableDefaultDoc True

cheers!
hey, you beat me to it! ;-)

I actually expected that you would work it out sooner or later - apparently 'sooner' ;-)

Cheers!
Thank you for your brilliant help, excellent!

Cheers, naexpert.