Function ReadFile( filePath ) Dim theFile 'OpenTextFile args: , 1 = ForReading 'If you read an empty file, VBScript throws an error for some reason if (FileSystemObj.FileExists(filePath)) then Set theFile = FileSystemObj.GetFile(filePath) if (theFile.size > 0) then Set theFile = FileSystemObj.OpenTextFile(filePath, 1) ReadFile = theFile.ReadAll else ReadFile = "" end if else ReadFile = "" end if End Function Sub WriteFile( filePath, contents ) Dim theFile 'OpenTextFile args: , 2 = ForWriting, True = create if not exist Set theFile = FileSystemObj.OpenTextFile(filePath, 2, True) theFile.Write contents End Sub Sub ReplaceInFile( filePath, lookForStr, replaceWithStr ) Dim buffer buffer = ReadFile(filePath) if (buffer <> "") then buffer = Replace(buffer, lookForStr, replaceWithStr) WriteFile filePath, buffer end if End Sub Dim FileSystemObj, ConfigFile, ConfigFileName, XMLDir, WshShell on error resume next Set FileSystemObj = CreateObject("Scripting.FileSystemObject") if (Err = 0) then 'Get the parameters via CustomActionData customData = Session.Property("CustomActionData") msiProperties = split(customData,";@;") XMLDir = msiProperties(0) ' \programdata\shibboleth\sp\xml\opensaml\ ConfigFile = msiProperties(1) 'catalog ReplaceInFile ConfigFile, "@-PKGXMLDIR-@/", XMLDir 'Last End If End If