144 lines
7.2 KiB
HTML
144 lines
7.2 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
|
|
<TITLE>ADSI Object Methods</TITLE>
|
|
<SCRIPT LANGUAGE="JavaScript">
|
|
<!--
|
|
TempString = navigator.appVersion
|
|
if (navigator.appName == "Microsoft Internet Explorer"){
|
|
// Check to see if browser is Microsoft
|
|
if (TempString.indexOf ("4.") >= 0){
|
|
// Check to see if it is IE 4
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
|
|
}
|
|
else {
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
|
|
}
|
|
}
|
|
else if (navigator.appName == "Netscape") {
|
|
// Check to see if browser is Netscape
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
|
|
}
|
|
else
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
|
|
//-->
|
|
</script>
|
|
<SCRIPT LANGUAGE="VBScript">
|
|
<!--
|
|
Sub Window_OnLoad()
|
|
Dim frmContents
|
|
On Error Resume Next
|
|
If Not Parent Is Nothing Then
|
|
Set frmContents = Parent.Contents
|
|
If Not frmContents Is Nothing Then
|
|
frmContents.Window.TOCSynch_Click
|
|
End If
|
|
End If
|
|
End Sub
|
|
//--></SCRIPT><META NAME="DESCRIPTION" CONTENT="Internet Information Services reference information">
|
|
<META HTTP-EQUIV="PICS-Label" CONTENT='(PICS-1.1 "<http://www.rsac.org/ratingsv01.html>" l comment "RSACi North America Server" by "inet@microsoft.com <mailto:inet@microsoft.com>" r (n 0 s 0 v 0 l 0))'>
|
|
<META NAME="MS.LOCALE" CONTENT="EN-US">
|
|
<META NAME="MS-IT-LOC" Content="Internet Information Services">
|
|
</HEAD>
|
|
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
|
|
|
|
<H2><A NAME="_k2_adsi_object_methods"></A><SUP></SUP>ADSI Object Methods</H2>
|
|
|
|
<P>You can use the ADSI methods of the IIS Admin Objects to change metabase property values that control your IIS configuration. To configure a specific element of IIS, open the IIS Admin Object that corresponds to the metabase key associated with that element, modify the property values cached in the object, and direct the object to store the modified values in the metabase.</P>
|
|
|
|
<P>The following ADSI methods are exposed by the IIS Admin Objects, and can be used to set or query metabase properties.</P>
|
|
|
|
<TABLE border=0 cellpadding=5 cols=2 frame=box rules=all>
|
|
|
|
<TR VALIGN="top">
|
|
<TD class=blue width=24%><B>Method</B></TD>
|
|
<TD class=blue width=76%><B>Description</B></TD>
|
|
</TR>
|
|
|
|
<TR VALIGN="top">
|
|
<TD width=24%><A HREF="/iishelp/iis/htm/asp/adsi5ius.htm"><B>Get</B></A></TD>
|
|
<TD width=76%>Retrieves a value for a named property from the object.</TD>
|
|
</TR>
|
|
|
|
<TR VALIGN="top">
|
|
<TD width=24%><A HREF="/iishelp/iis/htm/asp/adsi52wj.htm"><B>GetDataPaths</B></A></TD>
|
|
<TD width=76%>Retrieves the paths to all locations of a metabase property subordinate to a specified starting path.</TD>
|
|
</TR>
|
|
|
|
<TR VALIGN="top">
|
|
<TD width=24%><A HREF="/iishelp/iis/htm/asp/adsi5ewo.htm"><B>GetEx</B></A></TD>
|
|
<TD width=76%>Retrieves a value or values for a named single-valued or multivalued property of the object.</TD>
|
|
</TR>
|
|
|
|
<TR VALIGN="top">
|
|
<TD width=24%><A HREF="/iishelp/iis/htm/asp/adsi7vcf.htm"><B>GetInfo</B></A></TD>
|
|
<TD width=76%>Reloads the object with property values that exist in the metabase.</TD>
|
|
</TR>
|
|
|
|
<TR VALIGN="top">
|
|
<TD width=24%><A HREF="/iishelp/iis/htm/asp/adsi5wmi.htm"><B>GetPropertyAttribObj</B></A></TD>
|
|
<TD width=76%>Retrieves an object that contains the property's attributes. This object can then be used to retrieve individual attributes of ADSI properties.</TD>
|
|
</TR>
|
|
|
|
<TR VALIGN="top">
|
|
<TD width=24%><A HREF="/iishelp/iis/htm/asp/adsi6c38.htm"><B>Put</B></A></TD>
|
|
<TD width=76%>Sets the value for a named property of an object.</TD>
|
|
</TR>
|
|
|
|
<TR VALIGN="top">
|
|
<TD width=24%><A HREF="/iishelp/iis/htm/asp/adsi1np4.htm"><B>PutEx</B></A></TD>
|
|
<TD width=76%>Sets the value or values for a named single-valued or multivalued property of the object.</TD>
|
|
</TR>
|
|
|
|
<TR VALIGN="top">
|
|
<TD width=24%><A HREF="/iishelp/iis/htm/asp/adsi0elr.htm"><B>SetInfo</B></A></TD>
|
|
<TD width=76%>Writes the object property values to the metabase.</TD>
|
|
</TR>
|
|
</TABLE><BR>
|
|
|
|
<P>The <B>GetInfo</B> method reloads the property values from the metabase into the object. When one of the IIS Admin Objects is created or opened with the <B>GetObject</B> function, its properties are initialized from the metabase. You can refresh these values from the metabase by using the <B>GetInfo</B> method, and overwriting any changes you have made to the property values cached in the object. You then use the <B>Get</B> or <B>GetEx</B> methods to retrieve the object properties and assign these values to variables, and the <B>Put</B> and <B>PutEx</B> methods to modify property values in the object. </P>
|
|
|
|
<P>The IIS Admin Objects also support the <I>object.property </I>syntax when used with languages such as VBScript or JScript. You can use the <B>SetInfo</B> method to write property values from the object to the metabase. When you call <B>SetInfo</B>, only the properties that you changed in the object are written back to the metabase. If you do not call <B>SetInfo</B>, your changes will not be written to the metabase.</P>
|
|
|
|
<P><span class=le><B>Note </B></span>When you bind to the metabase to modify properties in one of the IIS Admin Objects, the metabase is not locked while you are changing property values in the object. Other programs can make changes to values in the metabase after you have retrieved values but before you save them back into the metabase. Your program should minimize the time between retrieving and saving values.</P>
|
|
|
|
<P>ADSI properties apply only to the object, and non-ADSI properties apply to the metabase. You must use the <I>object.property</I> syntax when retrieving ADSI properties, whereas you can use either the <I>object.property</I> syntax or the ADSI methods such as <B>Get</B> and <B>Put</B> when manipulating metabase properties.</P>
|
|
|
|
<H6>Example</H6>
|
|
|
|
<P>The following sample VBScript code shows how you can use the ADSI methods of the IIS Admin Objects to change values in the metabase, and illustrates the use of metabase property inheritance for efficiency. <I>MyComputer</I> is a placeholder for the name of the computer on which IIS is running.</P>
|
|
|
|
<PRE><CODE><%
|
|
Dim WebServerObj
|
|
Dim VDirObj
|
|
|
|
|
|
'Open the object for the first virtual Web server root.
|
|
Set WebServerObj = GetObject("IIS://<I>MyComputer</I>/W3SVC/1/Root")
|
|
|
|
'Deny write access for all directories and files
|
|
'for the server (except those already specifically set)
|
|
'by using the Put method.
|
|
WebServerObj.Put "AccessWrite", False
|
|
|
|
'Save the changed value to the metabase.
|
|
WebServerObj.SetInfo
|
|
|
|
'Get a directory subordinate to the Web server root.
|
|
Set VDirObj = GetObject("IIS://<I>MyComputer</I>/W3SVC/1/Root/Vdir1/Dir1a")
|
|
|
|
'Overwrite the inherited value for write access
|
|
'by using the dot method equivalent to Put.
|
|
VDirObj.AccessWrite = True
|
|
|
|
'Save the changed value to the metabase.
|
|
VDirObj.SetInfo
|
|
%>
|
|
</CODE></PRE>
|
|
<hr class="iis" size="1">
|
|
<p align="center"><em><a href="../../../common/colegal.htm">© 1997-2001 Microsoft Corporation. All rights reserved.</a></em></p>
|
|
</BODY>
|
|
</HTML>
|