How to find relative path to C: \ Inetpub \ AdminScripts \ ADSUTIL.VBS?

IIS 6 and older ships with a script utility called ADSUTIL.VBS :

Adsutil.vbs is an IIS administration utility that uses Microsoft Visual Basic Scripting Edition (VBScript) Active Directory Interfaces (ADSI) to manage IIS. This script should be run using CScript, which is with the Windows script Host.

In other words, this tool allows you to programmatically change IIS metase parameters from the command line.

I would like to call this tool from the InstallShield project to make some configuration changes in IIS. I am curious if it is possible to legally redistribute the script (there is no legal wording inside the source for it) or just run the command through:

CSCRIPT %SYSTEMDRIVE%\Inetpub\AdminScripts\adsutil.vbs 

and hope the script exists on disk in this place.

So my question is - will it always exist on this path above, even if some other websites (inetpub roots) on the machine are located on a non-system drive? It seems that all MSDN and other Microsoft KB articles related to the ADSUTIL tool do this using the% SYSTEMDRIVE% path above.

I see at least one more attempt to deal with this by distributing both cscript.exe and adsutil.vbs with their InstallShield projects.

Perhaps there is a registry key or other method to get the location of the Inetpub \ AdminScripts path?

Maybe I just write a C # application that changes the value or my own VBScript and distribute with my own little application instead?

+4
source share
2 answers

I worked in response to JShumaker to solve this problem. The best route seems to be the following InstallScript function, which I call to run the script package:

 prototype SetIISValues(); function SetIISValues() string szProgram, szCmd; begin szProgram = TARGETDIR + "SetIISValues.bat"; szCmd = ""; LaunchAppAndWait (szProgram, szCmd, LAAW_OPTION_WAIT); end; 

The script package calls this:

 @echo off cscript.exe SetIISValues.vbs 

And VBScript looks like this:

 Option Explicit Dim IIsObject Set IIsObject = GetObject("IIS://localhost/w3svc/1") IIsObject.Put "Name", "Value" IIsObject.Setinfo 

Executing this method eliminates the need to use ADSUTIL.VBS as part of the installation - the path (relative) to it does not matter if you do not need to use it.

+1
source

I recently ran into a similar problem and decided to just rework a small bit of vbscript for use in a user action in the msi installer. It may take a little time to understand the essence of how adsutil.vbs does something, but it is well written. For example, I needed to switch the application pool to Classic instead of the integrated mode and explicitly configure it to run in 32-bit mode, when in 64-bit windows in distilled form this led to the following:

  Option Explicit

 Dim iisobject
 Set IIsObject = GetObject ("IIS: // LocalHost / W3SVC / AppPools / TestPool")
 IIsObject.Put "ManagedPipelineMode", 1
 IIsObject.Setinfo
 IIsObject.Put "Enable32BitAppOnWin64", CBool ​​("True")
 IIsObject.Setinfo 
+3
source

All Articles