' By: Bob Templeton 2004 - http://home.comcast.net/~ifrit/FFDeploy.html ' Adapted for French version by Grandzebu On Error Resume Next ' Create the objects that we'll be using Set Shell = WScript.CreateObject("WScript.Shell") Set FSO = WScript.CreateObject("Scripting.FileSystemObject") Set NET = WScript.CreateObject("WScript.Network") ' Initialize Variables ProfPath = Shell.ExpandEnvironmentStrings("%USERPROFILE%") AppData = Shell.ExpandEnvironmentStrings("%APPDATA%") UName = NET.UserName WindowsHome = Shell.ExpandEnvironmentStrings("%WINDIR%") TempDir = Shell.ExpandEnvironmentStrings("%TEMP%") FFProfPath = AppData + "\Mozilla\Firefox\Profiles\" + UName MyAppPath = Left(WScript.ScriptFullName, InStrRev(WScript.ScriptFullName, "\")) ' Copy the Global Profile FSO.CreateFolder AppData + "\Mozilla" FSO.CreateFolder AppData + "\Mozilla\Firefox" FSO.CreateFolder AppData + "\Mozilla\Firefox\Profiles" FSO.CopyFolder MyAppPath + "Defaults\Profile", FFProfPath ' Create the PROFILES.INI for Firefox ***This part is a hard-core writing of the file*** ' It doesn't matter if it already exists...it's going to get (re)created. If FSO.FileExists(AppData + "\Mozilla\Firefox\Profiles.ini") Then FSO.DeleteFile (AppData + "\Mozilla\Firefox\Profiles.ini") End If Set INIFile = FSO.CreateTextFile(AppData + "\Mozilla\Firefox\Profiles.ini", True) INIFile.WriteLine ("[General]") INIFile.WriteLine ("StartWithLastProfile=1") INIFile.WriteLine ("[Profile0]") INIFile.WriteLine ("Name=default") INIFile.WriteLine ("IsRelative=1") INIFile.WriteLine ("Default=1") INIFile.WriteLine ("Path=Profiles/" + UName) INIFile.Close ' Convert the FFProfPath for prefs.js FileContents = GetFile(FFProfPath + "\Prefs.js") dFileContents = Replace(FileContents, "***USER ACCOUNT NAME***", UName) WriteFile FFProfPath + "\Chrome\chrome.rdf", dFileContents ' Clean up Set Shell = Nothing Set FSO = Nothing Set NET = Nothing ' Done! '################## Functions ##################### ' Read a text file as a string Function GetFile(FileName) If FileName <> "" Then Dim FileStream On Error Resume Next Set FileStream = FSO.OpenTextFile(FileName) GetFile = FileStream.ReadAll End If End Function ' Write string as a text file. Function WriteFile(FileName, Contents) Dim OutStream On Error Resume Next Set OutStream = FSO.OpenTextFile(FileName, 2, True) OutStream.Write Contents End Function