'======================================================================== ' changePasswordFix.wsf ' Fixes the iisadmpwd virtual directory for the OWA "change password" ' feature so that it works for both common cases: Win2003 FE + Win2000 BE ' and Win2000 FE + W2K3 BE. ' Author: a guy at Microsoft who asked not to be named here ' Date: 8/03 ' ======================================================================= ' DISCLAIMER: This script is presented without warranty or support. Use it ' completely at your own risk. If it breaks, that's tough. This is not a ' Microsoft product, and it's not supported by Microsoft in any way. Function Make_IISADMPWD_vDirectory(Directory, DirectoryPath) ' Create the Virtual Dir Dim oVdir, oApp, oDll Set oVdir = GetObject("IIS://Localhost/W3SVC/1/Root") Set oApp = oVdir.Create("IIsWebVirtualDir", Directory) oDll = vInstallDirectory & "\asp.dll" ' add properties to new virtual directory With oApp .AppFriendlyName = Directory .AppCreate2 1 ' 1 = out-of-process(isolated) .DefaultLogonDomain = "\" .Path = DirectoryPath .AccessFlags = "513" .AccessRead = True .AccessScript = True .EnableDirBrowsing = False .EnableDefaultDoc = False .AuthFlags = 1 .AuthAnonymous = True .scriptmaps = ".*," & oDll & ",5,GET,HEAD,POST,TRACE" .SetInfo End With Set oVdir = Nothing End Function ' asp2htr converts the ASP filename to the corresponding .HTR file name; this provides ' interop with Windows 2000 boxes that are still using HTR files. Sub asp2htr Dim File_Collection Dim Source_File Dim ASP_File Dim HTR_File Set File_Collection = Target_folder.Files For Each Source_File in File_Collection If UCASE(Right(Source_File,3)) = "ASP" Then ' msgbox Source_File.Name File_Name = FSO.GetFileName(Source_File) ASP_File = Split(File_Name,".") HTR_File = ASP_File(0) & ".htr" FSO.CopyFile Source_File, vDirectoryPath & "\" & HTR_File End If Next Set FSO = Nothing Set Target_Folder =Nothing Set File_Collection = Nothing MsgBox ("asp files copied to .htr files for Windows 2000 interoperabiltiy") End Sub ' htr2asp swaps the file names to provide W2K3-to-W2k interop Sub htr2asp Dim File_Collection Dim Source_File Dim ASP_File Dim HTR_File Set File_Collection = Target_folder.Files For Each Source_File in File_Collection If UCASE(Right(Source_File,3)) = "HTR" Then ' msgbox Source_File.Name File_Name = FSO.GetFileName(Source_File) HTR_File = Split(File_Name,".") ASP_File = HTR_File(0) & ".asp" FSO.CopyFile Source_File, vDirectoryPath & "\" & ASP_File End If Next Set FSO = Nothing Set Target_Folder =Nothing Set File_Collection = Nothing MsgBox (".htr files copied to .asp files for Windows 2003 interoperabiltiy") End Sub Dim vDirectory, vInstallDirectory,vDirectoryPath vDirectory = "IISADMPWD" Set wshShell = WScript.CreateObject("WScript.Shell") vInstallDirectory = wshShell.RegRead("HKLM\System\CurrentControlSet\Services\W3SVC\Parameters\InstallPath") vDirectoryPath = vInstallDirectory & "\" & vDirectory Make_IISADMPWD_vDirectory vDirectory,vDirectoryPath Set wshShell = Nothing Dim FSO, Target_Folder, w2k3_svr Set FSO = CreateObject("Scripting.FileSystemObject") Set Target_Folder = FSO.Getfolder(vDirectoryPath) w2k3_svr = Target_Folder & "\achg.asp" If (FSO.FileExists(w2k3_svr)) Then ' WScript.Echo(w2k3_svr) call asp2htr Else ' WScript.Echo(w2k3_svr) call htr2asp End If MsgBox "Configuration completed successfully !"