PDA

View Full Version : Change IIS Username and Password



rdemarco
06-24-2005, 02:19 AM
I've tried numerous ways to do this but so far unsuccessful...

I have created an IIS web site in a Basic MSI Project (happy to change if there is a better way) and set up a Username and Password under Directory Security.

As part of the install I have created a custom dialog where the administrator running the install can type in their own custom username and password and then created two properties to store these values. I then obviously need these new settings applied to the web site after the install.

I'm really not sure how to do this, one thing I did do was working with the MSI tables. I tried changing the ISIISCommon MSI table but couldn't get that to work through vb script, I think this is because the database object is read-only during the install. I know you can open the msi for read-write but that involves pointing to a .msi file and I don't know how this is possible during an install.

Can anyone please tell me the easiest way to do this?

Additional functionality will be to allow the admin user to change the name of the virtual directory, web site name, and Anonymous/Windows Authenticated checkbox.

Thanks, Rick

aventi
06-24-2005, 04:25 PM
Hi Rick,

My experiences with IS and setting up IIS detailed settings is use Custom Actions.

We have setup mime types and authorization levels with the CA's after the site has been established with IS's CA's.

An example:
Function SetFOOWebSecurity
dim FOOWebPath
dim oFOOWebNode

On Error Resume Next

FOOWebPath = "IIS://LocalHost/w3svc/1/Root/fooweb"
set oFOOWebNode = GetObject(FOOWebPath)
If Err.Number Then
Exit Function
End If

oFOOWebNode.AuthFlags = 1
oFOOWebNode.HttpErrors = ""
oFOOWebNode.SetInfo
End Function

In IIS they supply some great VBScripts as examples. Almost too detailed for when it comes to specifc install tasks, but it tells you what objects to open. adsutil.vbs is the main script.

rdemarco
06-28-2005, 02:33 AM
Thanks Aventi,

I have created an .asp page and managed to set some IIS properties sucessfully.. Whereabouts in the sequence do i put my custom action to make sure the web site has already been created before running my script?

Thanks, Rick

aventi
06-28-2005, 05:10 AM
(This is true for IS X) In the Execute Sequence look for caRlbackVRoots and caCreateVRoots. Place your CA's to modify the site further after these IS CA's.

rdemarco
06-28-2005, 11:08 PM
One thing I do need to do is rename the website based on user input. I have created a website under 'Internet Information Services' in the IDE and have given it a default name, during the installation there is a option for the user to change this name.

I have looked at ADSI and can't see how to rename the site, I know how to create it and set properties. The reason why I am using the IDE to create my website is because I want it to be uninstalled if the software is uninstalled and this does not happen if I use script to create it in the first place.

Any ideas on how to change the website name in script?

Thanks, Rick

aventi
06-28-2005, 11:56 PM
As you pointed out, you create via the script, you will need to remove via the script. Not what you want to do.

I would look into setting your website name prior to install. Set a property to that value. Then use that property for the name in the IIS settings.

Avoid the scripts for this basic setting and for the benefit to removal at uninstall.

rdemarco
06-29-2005, 12:53 AM
Thanks for your quick response aventi..

You suggestion is exactly what i want to do.. Sorry if this is a stupid question as i'm pretty new to IS, but once I have created my property and assinged my value to it how do i then use that property for the website name in the IIS settings? Where do I put the property name?

Thanks, Rick

aventi
06-29-2005, 06:23 AM
Once you set it via a Text entry (say USERSITENAME is your property), under the IIS Configuration for your site change the Display Name to [USERSITENAME] or whatever you want your property name to be.

A note, you may want to make this a capitalized property name so it is made a global property. This way as a command-line option (USERSITENAME=mysite) someone could do set this value during a silent install for instance.