Freigeben über


Setting Binary Metabase Properties Using ADSI

Setting binary metabase properties is more complicated than setting String, DWORD, or list properties.

The following example shows you how to use the JScript programming language to add a certificate hash value to the SSLCertHash metabase property. This example uses ADSI. For an example that uses System.DirectoryServices, see Setting a Binary Property Using System.DirectoryServices.

Note

This does not work when using IIS 5.0 on Windows 2000. This only works when using IIS 5.1 on Windows XP or IIS 6.0 on Windows 2003.

// The example certificate hash is:  
// d0 23 f9 88 bb 2a 96 d6 28 e9 75 a5 2f 96 ae a8 3f dc 82 9f 

var hash = String.fromCharCode( 0x23d0, 0x88f9, 0x2abb, 0xd696, 0xe928, 0xa575, 0x962f, 0xa8ae, 0xdc3f, 0x9f82); 
var objSite = GetObject("IIS://localhost/w3svc/1"); 

objSite.SslStoreName = "MY"; 
objSite.SecureBindings = ":443:"; 
objSite.SSLCertHash = hash; 
objSite.SetInfo();