This sample scripts uses Active Directory Services Interface (ADSI) provider for IIS to change properties in the IIS metabase. The properties and computers on which you want to change them are listed in a tab-delimited text file that you create. There is a matching Windows Management Instrumentation (WMI) version of this sample.
Important These samples are provided for educational purposes only. They are not intended to be used in a production environment, have not been tested in a production environment, and Microsoft does not provide technical support for them.
Sample Overview
Requirements
Location of the Source Code
Build and Install the Sample
Run the Sample
Sample Output
Helpdesk
ADSI can be used to access most resource on your computer, including IIS resources. IIS comes installed with an ADSI provider that allows you to configure your metabase from script files and compiled code.
When running this sample, the folowing conditions must be met:
This sample requires the installation of the following software to function properly:
IIS samples are included in the IIS Software Developer Kit (SDK). You can download the IIS SDK from Platform SDK Update. You can view the SDK at MSDN Online. In the table of contents at MSDN Online, click Web Development, Server Technologies, Internet Information Services (IIS), SDK Documentation, Internet Information Services, Samples.
The following source code files are required for this sample:
File | Description |
---|---|
ChangeProperties_ADSI.js | A JScript file containing the sample code. |
Nothing is required to build this sample.
To install this sample, the following steps must be performed:
C:\Samples
and copy the files to that folder.
In order to run this sample, follow the instructions listed below:
cmd
in the text box, and click OK.C:\Samples
, type the following in the command window:
cd C:\Samples
Cscript /nologo ChangeProperties_WMI.js
<machine name> <metabase path> <property name> <value>The following is an example of a tab-delimited text file that this sample can use:
Server1 w3svc ConnectionTimeout 999 Server2 w3svc/1 ServerComment My Default Server Server2 w3svc/1/root Path c:\webroot Server1 msftpsvc ConnectionTimeout 999
C:\Samples\MyChanges.txt
, you would use the following command in the command window:
Cscript /nologo ChangeProperties_ADSI.js C:\Samples\MyChanges.txt
The following example of output is displayed for each successful change after you perform step 5 from Run the Sample.
Success: Server2 w3svc/ConnectionTimeout, 900 -> 999
Errors like the following are also displayed:
*** Error: setting property, line 1 *** -2146828218 - Permission denied ConnectionTimeout can not be set at w3svc.to top
If here you do not find answers to your questions, visit the Microsoft Help and Support Web site.
Problem | Possible Solution |
---|---|
Permission denied errors | Only administrators can run ADSI scripts.
To keep security risks low, log on to your computer using an account that is not in the
Administrators group, and then use the Run As
command to run your script or executable as an
administrator. From the command prompt, type runas /user: administrative_accountname
"script_name" . |
© 1997-2002 Microsoft Corporation. All rights reserved.