Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a German Translation thanks to "Snaker."

  • Loading branch information...
commit a354b2cebe339104b7ec48437db8748a80aaed4e 1 parent d0c8f81
@n8felton authored
Showing with 589 additions and 536 deletions.
  1. +46 −0 ADMX/de-DE/Mozilla.adml
  2. +35 −28 CHANGELOG.txt
  3. +508 −508 firefox_startup.vbs
View
46 ADMX/de-DE/Mozilla.adml
@@ -0,0 +1,46 @@
+<policyDefinitionResources revision="1.0" schemaVersion="1.0">
+ <displayName>FirefoxADMX</displayName>
+ <description>Firefox ADMX ist ein Weg um zentral Einstellungen via Gruppenrichtlinen und administrative Vorlagen &#252;ber das Active Directory zu verteilen. Firefox ADMX ist eine Weiterentwicklung der Firefox ADM von Mark Sammons.</description>
+ <resources>
+ <stringTable>
+ <string id="MOZILLA_FIREFOX">Mozilla Firefox</string>
+ <string id="MOZILLA_FIREFOX_LOCKED">Gesperrte Einstellungen</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_CUSTOM_HOMEPAGE">Benutzerdefinierte Startseite</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_CUSTOM_HOMEPAGE_BLANKPAGE">Leere Seite</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_CUSTOM_HOMEPAGE_CUSTOMPAGE">Benutzerdefinierte Startseite</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_CUSTOM_HOMEPAGE_DEFAULTPAGE">Standardseite</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_DISABLEDEFAULTCHECK">Deaktiviere Pr&#252;fung nach Standardbrowser</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_DISABLEIMPORT">Deaktiviere Import-Assistenten</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_DISABLEUPDATES">Deaktiviere automatische Updates</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_DISABLE_DM">Deaktiviere Download-Manager</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_DISABLE_DM_Help">Deaktiviere das Starten des Download-Managers beim Herunterladen einer Datei</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_DISABLE_PASSWORDS">Deaktiviere Password-Manager</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_CUSTOM_HOMEPAGE_Help">Erlaube das Ver&#228;ndern der Startseite. Die Seite kann entweder leer oder mit einer benutzerdefinierten URL geladen werden</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_SUPRESSUPDATEPAGE">Unterdr&#252;cke "Firefox wurde aktualisiert"-Seite nach einem Update</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_SUPRESSUPDATEPAGE_Help">Unterdr&#252;cke die "Was ist neu"-Seite nach einem Update.
+
+Wenn Sie diese Richtlinie aktivieren, wird die Anzeige der folgenden Seite verhindert</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_DISABLEADDONWIZARD">Deaktiviere den Add-On Assistenten</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_DISABLEADDONWIZARD_Help">Deaktiviere den Add-On Assistenten beim Start</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_DISABLETELEMETRY">Deaktiviere Telemetrie (Senden von Hintergrunddaten)</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_DISABLETELEMETRY_Help">Deaktiviere Hinweisfenster, ob im Hintergrund Informationen an Mozilla gesendet werden sollen. Eine Deaktivierung hat die Aktivierund der Telemetrie zur Folge</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_DISABLERIGHTS">Deaktiviere den "Kennen Sie Ihre Rechte..."-Hinweis</string>
+ <string id="MOZILLA_FIREFOX_LOCKED_DISABLERIGHTS_Help">Deaktiviere "Kennen Sie Ihre Rechte..."-Hinweis beim ersten Start</string>
+ </stringTable>
+ <presentationTable>
+ <presentation id="MOZILLA_FIREFOX_LOCKED_CUSTOM_HOMEPAGE">
+ <dropdownList refId="MOZILLA_FIREFOX_LOCKED_CUSTOM_HOMEPAGE_DISPLAY_DROPDOWN" defaultItem="0">Beim Start von Firefox anzeigen</dropdownList>
+ <textBox refId="MOZILLA_FIREFOX_LOCKED_CUSTOM_HOMEPAGE_CUSTOMPAGETEXT">
+ <label>Benutzerdefinierte Startseite</label>
+ <defaultValue>
+ </defaultValue>
+ </textBox>
+ </presentation>
+ <presentation id="MOZILLA_FIREFOX_LOCKED_DISABLEUPDATES">
+ <checkBox refId="MOZILLA_FIREFOX_LOCKED_DISABLEUPDATES_FIREFOX" defaultChecked="true">Deaktiviere Firefox-Auto-Update</checkBox>
+ <checkBox refId="MOZILLA_FIREFOX_LOCKED_DISABLEUPDATES_EXTENSIONS" defaultChecked="true">Deaktiviere autom. Updates der Erweiterungen</checkBox>
+ <checkBox refId="MOZILLA_FIREFOX_LOCKED_DISABLEUPDATES_SEARCH" defaultChecked="true">Deaktiviere autom. Updates der Suchmaschinen</checkBox>
+ </presentation>
+ </presentationTable>
+ </resources>
+</policyDefinitionResources>
View
63 CHANGELOG.txt
@@ -1,28 +1,35 @@
-0.1.0
-- Inital relase to the public
-
-0.1.1
-- Fixed a bug where the script would show errors on Windows XP machines at the login screen.
-- Added functionality to quit the script if Mozilla Firefox wasn't detected as installed.
-- Added the "/qb" and "/qn" switches to be able to show or hide the UI for the Windows XP
- login screen.
- * Mimics the MSI command line switches
- * /qb is unattended but shows the log.
- * /qn is unattended with no UI at all. (Default)
-- Added support to disable the "Default Browser" prompt. (browser.shell.checkDefaultBrowser)
-
-0.1.2
-- Added option to disable the Add-On Startup Wizard implemented in FF 7 & 8.
- * extensions.shownSelectionUI
- * extensions.autoDisableScope
-
-0.1.3
-- Added option to disable telemetry.
- * toolkit.telemetry.enabled
- * toolkit.telemetry.prompted
- * toolkit.telemetry.rejected
-
-
-0.1.3.1 (Jason Lang)
-- Fixed bug with "browser.rights.3.shown" being set as STRING rather than Boolean. Works as intended now.
- *toolkit.telemetry.prompted now properly set/working for firefox version(s) through 12.
+0.1.0
+- Inital relase to the public
+
+0.1.1
+- Fixed a bug where the script would show errors on Windows XP machines at the login screen.
+- Added functionality to quit the script if Mozilla Firefox wasn't detected as installed.
+- Added the "/qb" and "/qn" switches to be able to show or hide the UI for the Windows XP
+ login screen.
+ * Mimics the MSI command line switches
+ * /qb is unattended but shows the log.
+ * /qn is unattended with no UI at all. (Default)
+- Added support to disable the "Default Browser" prompt. (browser.shell.checkDefaultBrowser)
+
+0.1.2
+- Added option to disable the Add-On Startup Wizard implemented in FF 7 & 8.
+ * extensions.shownSelectionUI
+ * extensions.autoDisableScope
+
+0.1.3
+- Added option to disable telemetry.
+ * toolkit.telemetry.enabled
+ * toolkit.telemetry.prompted
+ * toolkit.telemetry.rejected
+
+
+0.1.3.1 (Jason Lang)
+- Fixed bug with "browser.rights.3.shown" being set as STRING rather than Boolean. Works as intended now.
+ *toolkit.telemetry.prompted now properly set/working for firefox version(s) through 12.
+
+0.1.3.2
+- Added a German translation thanks to "Snaker" and his blog at
+ http://snakerl.blogspot.de/2012/04/admx-dateien-fur-firefox-deutsche.html
+
+NOTE: This will the last update to the CHANGELOG.txt. All additonal changes will be noted in the
+ git commit messages.
View
1,016 firefox_startup.vbs
@@ -1,508 +1,508 @@
-' Firefox ADMX
-' Version 0.1.3
-'
-' Author: Nathan Felton
-'
-' Firefox ADMX is a way of allowing centrally managed locked and/or default settings
-' in Firefox via Group Policy and Administrative Templates in Active Directory.
-'
-' Firefox ADMX is a continuation of FirefoxADM by Mark Sammons.
-'
-' This work is licensed under the Creative Commons Attribution 3.0 Unported License.
-' To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/
-
-'On Error Resume Next
-
-Dim objShell : Set objShell = WScript.CreateObject("WScript.Shell")
-Dim objFSO : Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
-Dim objEnv : Set objEnv = objShell.Environment("Process")
-Dim objWMIService : Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
-Dim objArgs : Set objArgs = WScript.Arguments
-
-Const ForReading = 1, ForWriting = 2, ForAppending = 8
-
-' Script variables
-Dim strVersion : strVersion = "0.1.3"
-
-' Variables required for logging.
-Dim fileLog
-Dim strLogLocation : strLogLocation = objEnv("TEMP") & "\FirefoxADMX.log"
-
-' Global variables used by the various parts of the script.
-Dim policiesRegistry : policiesRegistry = "HKLM\Software\Policies\Mozilla\Firefox"
-Dim baseRegistry : baseRegistry = ""
-Dim firefoxVersion : firefoxVersion = ""
-Dim firefoxMajorVersion : firefoxMajorVersion = ""
-Dim firefoxInstallDir : firefoxInstallDir = ""
-Dim strMozillaCfgFile : strMozillaCfgFile = ""
-Dim strAllSettingsFile : strAllSettingsFile = ""
-Dim strOverrideFile : strOverrideFile = ""
-Dim bQB : bQB = False
-Dim bQN : bQN = True
-
-checkArgs
-forceCScript
-generateLogFile
-
-determineArchitecture
-locateInstallation
-
-setFileLocations
-forceConfigFiles
-cleanOldSettings
-
-setCustomHomepage
-setDisableDefaultCheck
-setDisableImport
-setDisableUpdates
-setDisableDownloadManager
-setDisablePasswordManager
-setDisableAddonWizard
-setSupressUpdatePage
-setDisableTelemetry
-setDisableRights
-
-Sub setCustomHomepage()
- Dim keyHomepageDisplay, keyCustomHomepage
- keyHomepageDisplay = getRegistryKey(policiesRegistry & "\HomepageDisplay")
- keyCustomHomepage = getRegistryKey(policiesRegistry & "\CustomHomepage")
- If keyHomepageDisplay <> "" Then
- writeLog "Changing homepage to " & keyHomepageDisplay
- removePreference("browser.startup.homepage")
- removePreference("browser.startup.page")
- Select Case Ucase(keyHomepageDisplay)
- Case "DEFAULT"
- appendLockPreference "browser.startup.homepage","about:home",True
- appendLockPreference "browser.startup.page","1",False
- Case "CUSTOM"
- appendLockPreference "browser.startup.homepage",keyCustomHomepage,True
- appendLockPreference "browser.startup.page","1",False
- writeLog "Custom homepage: " & keyCustomHomepage
- Case "BLANK"
- appendLockPreference "browser.startup.homepage","about:blank",True
- appendLockPreference "browser.startup.page","0",False
- End Select
- End If
-End Sub
-
-Sub setDisableDefaultCheck
- Dim keyDisableDefaultCheck
- keyDisableDefaultCheck = getRegistryKey(policiesRegistry & "\DisableDefaultCheck")
- If keyDisableDefaultCheck <> "" Then
- writeLog "Disabling Default Browser Check"
- removePreference("browser.shell.checkDefaultBrowser")
- Select Case keyDisableDefaultCheck
- Case 0
- appendLockPreference "browser.shell.checkDefaultBrowser","true",False
- Case 1
- appendLockPreference "browser.shell.checkDefaultBrowser","false",False
- End Select
- End If
-End Sub
-
-Sub setDisableImport()
- Dim keyDisableImport, fileOverride, arrOverrideContents, strEnableProfileMigrator
- keyDisableImport = getRegistryKey(policiesRegistry & "\DisableImport")
- If keyDisableImport <> "" Then
- Select Case keyDisableImport
- Case 0
- writeLog "Enabling Import Wizard"
- strEnableProfileMigrator = "EnableProfileMigrator=true"
- Case 1
- writeLog "Disabling Import Wizard"
- strEnableProfileMigrator = "EnableProfileMigrator=false"
- End Select
- If objFSO.FileExists(strOverrideFile) Then
- Set fileOverride = objFSO.GetFile(strOverrideFile)
- If fileOverride.Size > 0 Then 'If the file already exists but is not empty
- writeLog strOverrideFile & " already exists. Replaceing contents"
- Set fileOverride = objFSO.OpenTextFile(strOverrideFile, ForReading)
- arrOverrideContents = Split(fileOverride.ReadAll, vbCrLf)
- arrOverrideContents = Filter(arrOverrideContents,"[XRE]", False, vbTextCompare)
- arrOverrideContents = Filter(arrOverrideContents,"EnableProfileMigrator", False, vbTextCompare)
- Set fileOverride = objFSO.OpenTextFile(strOverrideFile, ForWriting)
- fileOverride.WriteLine "[XRE]"
- fileOverride.WriteLine strEnableProfileMigrator
- fileOverride.Write Join(arrOverrideContents,vbCrLf)
- fileOverride.Close
- Else 'If the file exists but is Empty
- writeLog strOverrideFile & " exists, but is empty. Adding contents"
- Set fileOverride = objFSO.OpenTextFile(strOverrideFile, ForWriting)
- fileOverride.WriteLine "[XRE]"
- fileOverride.WriteLine strEnableProfileMigrator
- fileOverride.Close
- End If
- Else 'If the file does not exist at all
- writeLog "Creating " & strOverrideFile
- Set fileOverride = objFSO.OpenTextFile(strOverrideFile, ForWriting, True)
- fileOverride.WriteLine "[XRE]"
- fileOverride.WriteLine strEnableProfileMigrator
- fileOverride.Close
- End If
- End If
-End Sub
-
-Sub setDisableUpdates()
- Dim keyDisableUpdate, keyDisableExtensionsUpdate, keyDisableSearchUpdate
- keyDisableUpdate = getRegistryKey(policiesRegistry & "\DisableUpdate")
- keyDisableExtensionsUpdate = getRegistryKey(policiesRegistry & "\DisableExtensionsUpdate")
- keyDisableSearchUpdate = getRegistryKey(policiesRegistry & "\DisableSearchUpdate")
- If keyDisableUpdate <> "" Then
- writeLog "Disabling Firefox Updates"
- removePreference("app.update.enabled")
- Select Case keyDisableUpdate
- Case 0
- appendLockPreference "app.update.enabled","true",False
- Case 1
- appendLockPreference "app.update.enabled","false",False
- End Select
- End If
- If keyDisableExtensionsUpdate <> "" Then
- writeLog "Disabling Firefox Extension Updates"
- removePreference("extensions.update.enabled")
- Select Case keyDisableUpdate
- Case 0
- appendLockPreference "extensions.update.enabled","true",False
- Case 1
- appendLockPreference "extensions.update.enabled","false",False
- End Select
- End If
- If keyDisableSearchUpdate <> "" Then
- writeLog "Disabling Firefox Search Updates"
- removePreference("browser.search.update")
- Select Case keyDisableUpdate
- Case 0
- appendLockPreference "browser.search.update","true",False
- Case 1
- appendLockPreference "browser.search.update","false",False
- End Select
- End If
-End Sub
-
-Sub setDisableDownloadManager()
- Dim keyDisableDownloadManager
- keyDisableDownloadManager = getRegistryKey(policiesRegistry & "\DisableDownloadManager")
- If keyDisableDownloadManager <> "" Then
- writeLog "Disabling Download Manager"
- removePreference("browser.download.manager.showWhenStarting")
- Select Case keyDisableDownloadManager
- Case 0
- appendLockPreference "browser.download.manager.showWhenStarting","true",False
- Case 1
- appendLockPreference "browser.download.manager.showWhenStarting","false",False
- End Select
- End If
-End Sub
-
-Sub setDisablePasswordManager
- Dim keyDisablePasswordManager
- keyDisablePasswordManager = getRegistryKey(policiesRegistry & "\DisablePasswordManager")
- If keyDisablePasswordManager <> "" Then
- writeLog "Disabling the Password Manager"
- removePreference("signon.rememberSignons")
- Select Case keyDisablePasswordManager
- Case 0
- appendLockPreference "signon.rememberSignons","true",False
- Case 1
- appendLockPreference "signon.rememberSignons","false",False
- End Select
- End If
-End Sub
-
-Sub setDisableAddonWizard()
- Dim keyDisableAddonWizard
- keyDisableAddonWizard = getRegistryKey(policiesRegistry & "\DisableAddonWizard")
- If keyDisableAddonWizard <> "" Then
- writeLog "Disabling the Add-On Wizard"
- removePreference("extensions.shownSelectionUI")
- removePreference("extensions.autoDisableScope")
- Select Case keyDisableAddonWizard
- Case 0
- appendLockPreference "extensions.shownSelectionUI","false",False
- appendLockPreference "extensions.autoDisableScope","15",False
- Case 1
- appendLockPreference "extensions.shownSelectionUI","true",False
- appendLockPreference "extensions.autoDisableScope","11",False
- End Select
- End If
-End Sub
-
-Sub setSupressUpdatePage()
- Dim keySuppressUpdatePage
- keySuppressUpdatePage = getRegistryKey(policiesRegistry & "\SupressUpdatePage")
- If keySuppressUpdatePage <> "" Then
- writeLog "Suppressing the Firefox Updated page"
- removePreference("startup.homepage_override_url")
- removePreference("startup.homepage_welcome_url")
- Select Case keySuppressUpdatePage
- Case 1
- appendLockPreference "startup.homepage_override_url","",True
- appendLockPreference "startup.homepage_welcome_url","",True
- End Select
- End If
-End Sub
-
-Sub setDisableTelemetry()
- Dim keyDisableTelemetry
- keyDisableTelemetry = getRegistryKey(policiesRegistry & "\DisableTelemetry")
- If keyDisableTelemetry <> "" Then
- writeLog "Disabling Telemetry"
- removePreference("toolkit.telemetry.enabled")
- removePreference("toolkit.telemetry.prompted")
- removePreference("toolkit.telemetry.rejected")
- Select Case keyDisableTelemetry
- Case 1
- appendLockPreference "toolkit.telemetry.enabled","false",False
- appendLockPreference "toolkit.telemetry.rejected","true",False
- Select Case firefoxMajorVersion
- Case 8
- appendLockPreference "toolkit.telemetry.prompted","true",False 'FF8
- Case 9
- appendLockPreference "toolkit.telemetry.prompted","2",False 'FF9
- Case 10
- appendLockPreference "toolkit.telemetry.prompted","2",False 'FF10
- Case 11
- appendLockPreference "toolkit.telemetry.prompted","2",False 'FF11
- Case 12
- appendLockPreference "toolkit.telemetry.prompted","2",False 'FF12
- End Select
- End Select
- End If
-End Sub
-
-Sub setDisableRights()
- Dim keyDisableRights
- keyDisableRights = getRegistryKey(policiesRegistry & "\DisableRights")
- If keyDisableRights <> "" Then
- writeLog "Suppressing the Know your Rights Browser Bar"
- removePreference("browser.rights.3.shown")
- Select Case keyDisableRights
- Case 1
- appendLockPreference "browser.rights.3.shown","true",False
- End Select
- End If
-End Sub
-
-Sub determineArchitecture()
- Dim colArchitecture : Set colArchitecture = objWMIService.ExecQuery("Select AddressWidth from Win32_Processor")
- Dim objArch, strArch
-
- For Each objArch In colArchitecture
- strArch = objArch.AddressWidth
- Next
-
- Select Case strArch
- Case "64"
- baseRegistry = "HKLM\Software\Wow6432Node\Mozilla\Mozilla Firefox\"
- Case "32"
- baseRegistry = "HKLM\Software\Mozilla\Mozilla Firefox\"
- End Select
-End Sub
-
-Sub locateInstallation()
- On Error Resume Next
- firefoxVersion = objShell.RegRead(baseRegistry & "CurrentVersion")
- If Err.Number <> 0 Then
- writeLog "Mozilla Firefox not installed. Exiting."
- Err.Clear
- WScript.Quit(1)
- End If
- On Error GoTo 0
- firefoxInstallDir = objShell.RegRead(baseRegistry & firefoxVersion & "\Main\Install Directory")
- firefoxVersion = split(firefoxVersion,Chr(32))(0)
- firefoxMajorVersion = split(firefoxVersion,Chr(46))(0)
-
- 'If the Firefox installation directory can not be found in the registry, use the default 32-bit OS location
- '(C:\Program Files\Mozilla Firefox) by default.
- If firefoxInstallDir = "" Then
- firefoxInstallDir = objEnv("ProgramFiles") & "\Mozilla Firefox"
- End If
- writeLog "Installation Directory: " & firefoxInstallDir
-End Sub
-
-Sub setFileLocations()
- strMozillaCfgFile = firefoxInstallDir & "\mozilla.cfg"
- strAllSettingsFile = firefoxInstallDir & "\defaults\pref\all-settings.js"
- strOverrideFile = firefoxInstallDir & "\override.ini"
-End Sub
-
-Sub forceConfigFiles()
-
- On Error Resume Next
- Dim strConfigFile, strConfigObscure, fileAllSettings, arrAllSettingsContents
- strConfigFile = "pref(" & Chr(34) & "general.config.filename" & Chr(34) & "," & Chr(34) & "mozilla.cfg" & Chr(34) & ");"
- strConfigObscure = "pref(" & Chr(34) & "general.config.obscure_value" & Chr(34) & "," & "0" & ");"
- If objFSO.FileExists(strAllSettingsFile) Then 'Check if the file exists first.
- Set fileAllSettings = objFSO.GetFile(strAllSettingsFile)
- 'If the file does exist, then make sure it's not empty.
- If fileAllSettings.Size > 0 Then 'If the file is NOT empty
- Set fileAllSettings = objFSO.OpenTextFile(strAllSettingsFile, ForReading)
- arrAllSettingsContents = Split(fileAllSettings.ReadAll, vbCrLf)
- arrAllSettingsContents = Filter(arrAllSettingsContents,"general.config.filename", False, vbTextCompare)
- arrAllSettingsContents = Filter(arrAllSettingsContents,"general.config.obscure_value", False, vbTextCompare)
- Set fileAllSettings = objFSO.OpenTextFile(strAllSettingsFile, ForWriting)
- fileAllSettings.WriteLine strConfigFile
- fileAllSettings.WriteLine strConfigObscure
- fileAllSettings.Write Join(arrAllSettingsContents,vbCrLf)
- fileAllSettings.Close
- Else 'If the file IS empty
- Set fileAllSettings = objFSO.OpenTextFile(strAllSettingsFile, ForWriting)
- fileAllSettings.WriteLine strConfigFile
- fileAllSettings.WriteLine strConfigObscure
- fileAllSettings.Close
- End If
- Else
- Set fileAllSettings = objFSO.OpenTextFile(strAllSettingsFile, ForWriting, True)
- fileAllSettings.WriteLine strConfigFile
- fileAllSettings.WriteLine strConfigObscure
- fileAllSettings.Close
- End If
- Dim fileMozillaCfg, arrMozillaCfgContents
- If objFSO.FileExists(strMozillaCfgFile) Then 'Check if the file exists first.
- Set fileMozillaCfg = objFSO.GetFile(strMozillaCfgFile)
- 'If the file does exist, then make sure it's not empty.
- If fileMozillaCfg.Size > 0 Then 'If the file is NOT empty
- Set fileMozillaCfg = objFSO.OpenTextFile(strMozillaCfgFile, ForReading)
- arrMozillaCfgContents = Split(fileMozillaCfg.ReadAll, vbCrLf)
- arrMozillaCfgContents = Filter(arrMozillaCfgContents,"//", False, vbTextCompare)
- Set fileMozillaCfg = objFSO.OpenTextFile(strMozillaCfgFile, ForWriting)
- fileMozillaCfg.WriteLine "//"
- fileMozillaCfg.Write Join(arrMozillaCfgContents,vbCrLf)
- fileMozillaCfg.Close
- Else 'If the file IS empty
- Set fileMozillaCfg = objFSO.OpenTextFile(strMozillaCfgFile, ForWriting)
- fileMozillaCfg.WriteLine "//"
- fileMozillaCfg.Close
- End If
- Else
- Set fileMozillaCfg = objFSO.OpenTextFile(strMozillaCfgFile, ForWriting, True)
- fileMozillaCfg.WriteLine "//"
- fileMozillaCfg.Close
- End If
- On Error GoTo 0
-End Sub
-
-Sub cleanOldSettings
- Dim oldRegistryLocation : oldRegistryLocation = "HKLM\Software\Policies\Mozilla\Firefox\4\"
- On Error Resume Next
- objShell.RegDelete oldRegistryLocation
- On Error GoTo 0
-End Sub
-
-Sub removePreference(strPreference)
- Dim fileMozillaCfg, arrMozillaCfgContents
- If objFSO.FileExists(strMozillaCfgFile) Then 'Check if the file exists.
- Set fileMozillaCfg = objFSO.GetFile(strMozillaCfgFile)
- If fileMozillaCfg.Size > 0 Then 'If the file is NOT empty.
- Set fileMozillaCfg = objFSO.OpenTextFile(strMozillaCfgFile, ForReading)
- arrMozillaCfgContents = Split(fileMozillaCfg.ReadAll, vbCrLf)
- arrMozillaCfgContents = Filter(arrMozillaCfgContents, strPreference, False, vbTextCompare)
- Set fileMozillaCfg = objFSO.OpenTextFile(strMozillaCfgFile, ForWriting)
- fileMozillaCfg.Write Join(arrMozillaCfgContents,vbCrLf)
- fileMozillaCfg.Close
- End If
- End If
-End Sub
-
-Sub appendLockPreference(strPreference,strValue,boolQuoted)
- Dim fileMozillaCfg, arrMozillaCfgContents
- If boolQuoted Then
- strPreference = "lockPref(" & Chr(34) & strPreference & Chr(34) & "," & Chr(34) & strValue & Chr(34) & ");"
- Else
- strPreference = "lockPref(" & Chr(34) & strPreference & Chr(34) & "," & strValue & ");"
- End If
-
- If objFSO.FileExists(strMozillaCfgFile) Then
- Set fileMozillaCfg = objFSO.OpenTextFile(strMozillaCfgFile,ForAppending,False)
- fileMozillaCfg.WriteLine strPreference
- fileMozillaCfg.Close
- Else
- Set fileMozillaCfg = objFSO.OpenTextFile(strMozillaCfgFile,ForAppending,True)
- fileMozillaCfg.WriteLine "//"
- fileMozillaCfg.WriteLine strPreference
- fileMozillaCfg.Close
- End If
-End Sub
-
-' generateLogFile
-Sub generateLogFile()
- On Error Resume Next
- Set fileLog = objFSO.OpenTextFile(strLogLocation,ForAppending,True)
- Select Case Err.Number
- Case 70 'Access Denied
- MsgBox "Log File Inaccessable. Please make sure another instance isn't running and that you are an administrator."
- WScript.Quit(1)
- End Select
- On Error GoTo 0
- writeLog ""
- writeLog "-----------------------------------------------------------------"
- writeLog vbTab & vbTab & vbTab & "Starting New Instance"
- writeLog "-----------------------------------------------------------------"
- writeLog ""
- writeLog vbTab & vbTab & vbTab & "Firefox ADMX - Version " & strVersion
-End Sub
-
-' writeLog
-' Outputs "strMessage" to the screen as well as write to a specifed log file.
-' Uses the fLog object which points to the logFile variable for a file name and location of the log.
-' @param sMessage The message that will be output to both the specified error log and to the screen
-Sub writeLog(strMessage)
- logFormat = "["&time&"]"&" "& strMessage
- Wscript.Echo logFormat
- fileLog.WriteLine(logFormat)
-End Sub
-
-' forceCScript
-' Forces the script to be run using "CScript.exe" rather than the often default "WScript.exe"
-Sub forceCScript()
- Dim strArgs : strArgs = " "
- Dim i, iWindow
- For i = 0 To objArgs.Count-1
- strArgs = strArgs & objArgs.Item(i) & " "
- Next
- If bQN Then
- iWindow = 0
- ElseIf bQB Then
- iWindow = 1
- Else
- iWindow = 1
- End If
-
- If InStr(WScript.FullName,"cscript") = 0 Then
- objShell.Run "%comspec% /k " & WScript.Path & "\cscript.exe " & Chr(34) & WScript.ScriptFullName & Chr(34) & strArgs,iWindow,False
- WScript.Quit(0)
- End If
-End Sub
-
-Sub checkArgs()
- Dim i
- If objArgs.Count > 0 Then
- For i = 0 To objArgs.Count-1
- Select Case objArgs.Item(i)
- Case "/qb"
- bQB = True
- bQN = False
- Case "/qn"
- bQB = False
- bQN = True
- End Select
- Next
- End If
-End Sub
-
-Function getRegistryKey(strKey)
- On Error Resume Next
- strKey = objShell.RegRead(strKey)
- If Err.Number <> 0 Then
- Select Case Err.Number
- Case -2147024894 'Registry key doesn't exist. Usually means the setting is not set via GPO.
- getRegistryKey = ""
- Case Else
- writeLog "Error: " & Err.Number
- End Select
- Else
- getRegistryKey = strKey
- End If
- Err.Clear
- On Error GoTo 0
-End Function
+' Firefox ADMX
+' Version 0.1.3
+'
+' Author: Nathan Felton
+'
+' Firefox ADMX is a way of allowing centrally managed locked and/or default settings
+' in Firefox via Group Policy and Administrative Templates in Active Directory.
+'
+' Firefox ADMX is a continuation of FirefoxADM by Mark Sammons.
+'
+' This work is licensed under the Creative Commons Attribution 3.0 Unported License.
+' To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/
+
+'On Error Resume Next
+
+Dim objShell : Set objShell = WScript.CreateObject("WScript.Shell")
+Dim objFSO : Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
+Dim objEnv : Set objEnv = objShell.Environment("Process")
+Dim objWMIService : Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
+Dim objArgs : Set objArgs = WScript.Arguments
+
+Const ForReading = 1, ForWriting = 2, ForAppending = 8
+
+' Script variables
+Dim strVersion : strVersion = "0.1.3.2"
+
+' Variables required for logging.
+Dim fileLog
+Dim strLogLocation : strLogLocation = objEnv("TEMP") & "\FirefoxADMX.log"
+
+' Global variables used by the various parts of the script.
+Dim policiesRegistry : policiesRegistry = "HKLM\Software\Policies\Mozilla\Firefox"
+Dim baseRegistry : baseRegistry = ""
+Dim firefoxVersion : firefoxVersion = ""
+Dim firefoxMajorVersion : firefoxMajorVersion = ""
+Dim firefoxInstallDir : firefoxInstallDir = ""
+Dim strMozillaCfgFile : strMozillaCfgFile = ""
+Dim strAllSettingsFile : strAllSettingsFile = ""
+Dim strOverrideFile : strOverrideFile = ""
+Dim bQB : bQB = False
+Dim bQN : bQN = True
+
+checkArgs
+forceCScript
+generateLogFile
+
+determineArchitecture
+locateInstallation
+
+setFileLocations
+forceConfigFiles
+cleanOldSettings
+
+setCustomHomepage
+setDisableDefaultCheck
+setDisableImport
+setDisableUpdates
+setDisableDownloadManager
+setDisablePasswordManager
+setDisableAddonWizard
+setSupressUpdatePage
+setDisableTelemetry
+setDisableRights
+
+Sub setCustomHomepage()
+ Dim keyHomepageDisplay, keyCustomHomepage
+ keyHomepageDisplay = getRegistryKey(policiesRegistry & "\HomepageDisplay")
+ keyCustomHomepage = getRegistryKey(policiesRegistry & "\CustomHomepage")
+ If keyHomepageDisplay <> "" Then
+ writeLog "Changing homepage to " & keyHomepageDisplay
+ removePreference("browser.startup.homepage")
+ removePreference("browser.startup.page")
+ Select Case Ucase(keyHomepageDisplay)
+ Case "DEFAULT"
+ appendLockPreference "browser.startup.homepage","about:home",True
+ appendLockPreference "browser.startup.page","1",False
+ Case "CUSTOM"
+ appendLockPreference "browser.startup.homepage",keyCustomHomepage,True
+ appendLockPreference "browser.startup.page","1",False
+ writeLog "Custom homepage: " & keyCustomHomepage
+ Case "BLANK"
+ appendLockPreference "browser.startup.homepage","about:blank",True
+ appendLockPreference "browser.startup.page","0",False
+ End Select
+ End If
+End Sub
+
+Sub setDisableDefaultCheck
+ Dim keyDisableDefaultCheck
+ keyDisableDefaultCheck = getRegistryKey(policiesRegistry & "\DisableDefaultCheck")
+ If keyDisableDefaultCheck <> "" Then
+ writeLog "Disabling Default Browser Check"
+ removePreference("browser.shell.checkDefaultBrowser")
+ Select Case keyDisableDefaultCheck
+ Case 0
+ appendLockPreference "browser.shell.checkDefaultBrowser","true",False
+ Case 1
+ appendLockPreference "browser.shell.checkDefaultBrowser","false",False
+ End Select
+ End If
+End Sub
+
+Sub setDisableImport()
+ Dim keyDisableImport, fileOverride, arrOverrideContents, strEnableProfileMigrator
+ keyDisableImport = getRegistryKey(policiesRegistry & "\DisableImport")
+ If keyDisableImport <> "" Then
+ Select Case keyDisableImport
+ Case 0
+ writeLog "Enabling Import Wizard"
+ strEnableProfileMigrator = "EnableProfileMigrator=true"
+ Case 1
+ writeLog "Disabling Import Wizard"
+ strEnableProfileMigrator = "EnableProfileMigrator=false"
+ End Select
+ If objFSO.FileExists(strOverrideFile) Then
+ Set fileOverride = objFSO.GetFile(strOverrideFile)
+ If fileOverride.Size > 0 Then 'If the file already exists but is not empty
+ writeLog strOverrideFile & " already exists. Replaceing contents"
+ Set fileOverride = objFSO.OpenTextFile(strOverrideFile, ForReading)
+ arrOverrideContents = Split(fileOverride.ReadAll, vbCrLf)
+ arrOverrideContents = Filter(arrOverrideContents,"[XRE]", False, vbTextCompare)
+ arrOverrideContents = Filter(arrOverrideContents,"EnableProfileMigrator", False, vbTextCompare)
+ Set fileOverride = objFSO.OpenTextFile(strOverrideFile, ForWriting)
+ fileOverride.WriteLine "[XRE]"
+ fileOverride.WriteLine strEnableProfileMigrator
+ fileOverride.Write Join(arrOverrideContents,vbCrLf)
+ fileOverride.Close
+ Else 'If the file exists but is Empty
+ writeLog strOverrideFile & " exists, but is empty. Adding contents"
+ Set fileOverride = objFSO.OpenTextFile(strOverrideFile, ForWriting)
+ fileOverride.WriteLine "[XRE]"
+ fileOverride.WriteLine strEnableProfileMigrator
+ fileOverride.Close
+ End If
+ Else 'If the file does not exist at all
+ writeLog "Creating " & strOverrideFile
+ Set fileOverride = objFSO.OpenTextFile(strOverrideFile, ForWriting, True)
+ fileOverride.WriteLine "[XRE]"
+ fileOverride.WriteLine strEnableProfileMigrator
+ fileOverride.Close
+ End If
+ End If
+End Sub
+
+Sub setDisableUpdates()
+ Dim keyDisableUpdate, keyDisableExtensionsUpdate, keyDisableSearchUpdate
+ keyDisableUpdate = getRegistryKey(policiesRegistry & "\DisableUpdate")
+ keyDisableExtensionsUpdate = getRegistryKey(policiesRegistry & "\DisableExtensionsUpdate")
+ keyDisableSearchUpdate = getRegistryKey(policiesRegistry & "\DisableSearchUpdate")
+ If keyDisableUpdate <> "" Then
+ writeLog "Disabling Firefox Updates"
+ removePreference("app.update.enabled")
+ Select Case keyDisableUpdate
+ Case 0
+ appendLockPreference "app.update.enabled","true",False
+ Case 1
+ appendLockPreference "app.update.enabled","false",False
+ End Select
+ End If
+ If keyDisableExtensionsUpdate <> "" Then
+ writeLog "Disabling Firefox Extension Updates"
+ removePreference("extensions.update.enabled")
+ Select Case keyDisableUpdate
+ Case 0
+ appendLockPreference "extensions.update.enabled","true",False
+ Case 1
+ appendLockPreference "extensions.update.enabled","false",False
+ End Select
+ End If
+ If keyDisableSearchUpdate <> "" Then
+ writeLog "Disabling Firefox Search Updates"
+ removePreference("browser.search.update")
+ Select Case keyDisableUpdate
+ Case 0
+ appendLockPreference "browser.search.update","true",False
+ Case 1
+ appendLockPreference "browser.search.update","false",False
+ End Select
+ End If
+End Sub
+
+Sub setDisableDownloadManager()
+ Dim keyDisableDownloadManager
+ keyDisableDownloadManager = getRegistryKey(policiesRegistry & "\DisableDownloadManager")
+ If keyDisableDownloadManager <> "" Then
+ writeLog "Disabling Download Manager"
+ removePreference("browser.download.manager.showWhenStarting")
+ Select Case keyDisableDownloadManager
+ Case 0
+ appendLockPreference "browser.download.manager.showWhenStarting","true",False
+ Case 1
+ appendLockPreference "browser.download.manager.showWhenStarting","false",False
+ End Select
+ End If
+End Sub
+
+Sub setDisablePasswordManager
+ Dim keyDisablePasswordManager
+ keyDisablePasswordManager = getRegistryKey(policiesRegistry & "\DisablePasswordManager")
+ If keyDisablePasswordManager <> "" Then
+ writeLog "Disabling the Password Manager"
+ removePreference("signon.rememberSignons")
+ Select Case keyDisablePasswordManager
+ Case 0
+ appendLockPreference "signon.rememberSignons","true",False
+ Case 1
+ appendLockPreference "signon.rememberSignons","false",False
+ End Select
+ End If
+End Sub
+
+Sub setDisableAddonWizard()
+ Dim keyDisableAddonWizard
+ keyDisableAddonWizard = getRegistryKey(policiesRegistry & "\DisableAddonWizard")
+ If keyDisableAddonWizard <> "" Then
+ writeLog "Disabling the Add-On Wizard"
+ removePreference("extensions.shownSelectionUI")
+ removePreference("extensions.autoDisableScope")
+ Select Case keyDisableAddonWizard
+ Case 0
+ appendLockPreference "extensions.shownSelectionUI","false",False
+ appendLockPreference "extensions.autoDisableScope","15",False
+ Case 1
+ appendLockPreference "extensions.shownSelectionUI","true",False
+ appendLockPreference "extensions.autoDisableScope","11",False
+ End Select
+ End If
+End Sub
+
+Sub setSupressUpdatePage()
+ Dim keySuppressUpdatePage
+ keySuppressUpdatePage = getRegistryKey(policiesRegistry & "\SupressUpdatePage")
+ If keySuppressUpdatePage <> "" Then
+ writeLog "Suppressing the Firefox Updated page"
+ removePreference("startup.homepage_override_url")
+ removePreference("startup.homepage_welcome_url")
+ Select Case keySuppressUpdatePage
+ Case 1
+ appendLockPreference "startup.homepage_override_url","",True
+ appendLockPreference "startup.homepage_welcome_url","",True
+ End Select
+ End If
+End Sub
+
+Sub setDisableTelemetry()
+ Dim keyDisableTelemetry
+ keyDisableTelemetry = getRegistryKey(policiesRegistry & "\DisableTelemetry")
+ If keyDisableTelemetry <> "" Then
+ writeLog "Disabling Telemetry"
+ removePreference("toolkit.telemetry.enabled")
+ removePreference("toolkit.telemetry.prompted")
+ removePreference("toolkit.telemetry.rejected")
+ Select Case keyDisableTelemetry
+ Case 1
+ appendLockPreference "toolkit.telemetry.enabled","false",False
+ appendLockPreference "toolkit.telemetry.rejected","true",False
+ Select Case firefoxMajorVersion
+ Case 8
+ appendLockPreference "toolkit.telemetry.prompted","true",False 'FF8
+ Case 9
+ appendLockPreference "toolkit.telemetry.prompted","2",False 'FF9
+ Case 10
+ appendLockPreference "toolkit.telemetry.prompted","2",False 'FF10
+ Case 11
+ appendLockPreference "toolkit.telemetry.prompted","2",False 'FF11
+ Case 12
+ appendLockPreference "toolkit.telemetry.prompted","2",False 'FF12
+ End Select
+ End Select
+ End If
+End Sub
+
+Sub setDisableRights()
+ Dim keyDisableRights
+ keyDisableRights = getRegistryKey(policiesRegistry & "\DisableRights")
+ If keyDisableRights <> "" Then
+ writeLog "Suppressing the Know your Rights Browser Bar"
+ removePreference("browser.rights.3.shown")
+ Select Case keyDisableRights
+ Case 1
+ appendLockPreference "browser.rights.3.shown","true",False
+ End Select
+ End If
+End Sub
+
+Sub determineArchitecture()
+ Dim colArchitecture : Set colArchitecture = objWMIService.ExecQuery("Select AddressWidth from Win32_Processor")
+ Dim objArch, strArch
+
+ For Each objArch In colArchitecture
+ strArch = objArch.AddressWidth
+ Next
+
+ Select Case strArch
+ Case "64"
+ baseRegistry = "HKLM\Software\Wow6432Node\Mozilla\Mozilla Firefox\"
+ Case "32"
+ baseRegistry = "HKLM\Software\Mozilla\Mozilla Firefox\"
+ End Select
+End Sub
+
+Sub locateInstallation()
+ On Error Resume Next
+ firefoxVersion = objShell.RegRead(baseRegistry & "CurrentVersion")
+ If Err.Number <> 0 Then
+ writeLog "Mozilla Firefox not installed. Exiting."
+ Err.Clear
+ WScript.Quit(1)
+ End If
+ On Error GoTo 0
+ firefoxInstallDir = objShell.RegRead(baseRegistry & firefoxVersion & "\Main\Install Directory")
+ firefoxVersion = split(firefoxVersion,Chr(32))(0)
+ firefoxMajorVersion = split(firefoxVersion,Chr(46))(0)
+
+ 'If the Firefox installation directory can not be found in the registry, use the default 32-bit OS location
+ '(C:\Program Files\Mozilla Firefox) by default.
+ If firefoxInstallDir = "" Then
+ firefoxInstallDir = objEnv("ProgramFiles") & "\Mozilla Firefox"
+ End If
+ writeLog "Installation Directory: " & firefoxInstallDir
+End Sub
+
+Sub setFileLocations()
+ strMozillaCfgFile = firefoxInstallDir & "\mozilla.cfg"
+ strAllSettingsFile = firefoxInstallDir & "\defaults\pref\all-settings.js"
+ strOverrideFile = firefoxInstallDir & "\override.ini"
+End Sub
+
+Sub forceConfigFiles()
+
+ On Error Resume Next
+ Dim strConfigFile, strConfigObscure, fileAllSettings, arrAllSettingsContents
+ strConfigFile = "pref(" & Chr(34) & "general.config.filename" & Chr(34) & "," & Chr(34) & "mozilla.cfg" & Chr(34) & ");"
+ strConfigObscure = "pref(" & Chr(34) & "general.config.obscure_value" & Chr(34) & "," & "0" & ");"
+ If objFSO.FileExists(strAllSettingsFile) Then 'Check if the file exists first.
+ Set fileAllSettings = objFSO.GetFile(strAllSettingsFile)
+ 'If the file does exist, then make sure it's not empty.
+ If fileAllSettings.Size > 0 Then 'If the file is NOT empty
+ Set fileAllSettings = objFSO.OpenTextFile(strAllSettingsFile, ForReading)
+ arrAllSettingsContents = Split(fileAllSettings.ReadAll, vbCrLf)
+ arrAllSettingsContents = Filter(arrAllSettingsContents,"general.config.filename", False, vbTextCompare)
+ arrAllSettingsContents = Filter(arrAllSettingsContents,"general.config.obscure_value", False, vbTextCompare)
+ Set fileAllSettings = objFSO.OpenTextFile(strAllSettingsFile, ForWriting)
+ fileAllSettings.WriteLine strConfigFile
+ fileAllSettings.WriteLine strConfigObscure
+ fileAllSettings.Write Join(arrAllSettingsContents,vbCrLf)
+ fileAllSettings.Close
+ Else 'If the file IS empty
+ Set fileAllSettings = objFSO.OpenTextFile(strAllSettingsFile, ForWriting)
+ fileAllSettings.WriteLine strConfigFile
+ fileAllSettings.WriteLine strConfigObscure
+ fileAllSettings.Close
+ End If
+ Else
+ Set fileAllSettings = objFSO.OpenTextFile(strAllSettingsFile, ForWriting, True)
+ fileAllSettings.WriteLine strConfigFile
+ fileAllSettings.WriteLine strConfigObscure
+ fileAllSettings.Close
+ End If
+ Dim fileMozillaCfg, arrMozillaCfgContents
+ If objFSO.FileExists(strMozillaCfgFile) Then 'Check if the file exists first.
+ Set fileMozillaCfg = objFSO.GetFile(strMozillaCfgFile)
+ 'If the file does exist, then make sure it's not empty.
+ If fileMozillaCfg.Size > 0 Then 'If the file is NOT empty
+ Set fileMozillaCfg = objFSO.OpenTextFile(strMozillaCfgFile, ForReading)
+ arrMozillaCfgContents = Split(fileMozillaCfg.ReadAll, vbCrLf)
+ arrMozillaCfgContents = Filter(arrMozillaCfgContents,"//", False, vbTextCompare)
+ Set fileMozillaCfg = objFSO.OpenTextFile(strMozillaCfgFile, ForWriting)
+ fileMozillaCfg.WriteLine "//"
+ fileMozillaCfg.Write Join(arrMozillaCfgContents,vbCrLf)
+ fileMozillaCfg.Close
+ Else 'If the file IS empty
+ Set fileMozillaCfg = objFSO.OpenTextFile(strMozillaCfgFile, ForWriting)
+ fileMozillaCfg.WriteLine "//"
+ fileMozillaCfg.Close
+ End If
+ Else
+ Set fileMozillaCfg = objFSO.OpenTextFile(strMozillaCfgFile, ForWriting, True)
+ fileMozillaCfg.WriteLine "//"
+ fileMozillaCfg.Close
+ End If
+ On Error GoTo 0
+End Sub
+
+Sub cleanOldSettings
+ Dim oldRegistryLocation : oldRegistryLocation = "HKLM\Software\Policies\Mozilla\Firefox\4\"
+ On Error Resume Next
+ objShell.RegDelete oldRegistryLocation
+ On Error GoTo 0
+End Sub
+
+Sub removePreference(strPreference)
+ Dim fileMozillaCfg, arrMozillaCfgContents
+ If objFSO.FileExists(strMozillaCfgFile) Then 'Check if the file exists.
+ Set fileMozillaCfg = objFSO.GetFile(strMozillaCfgFile)
+ If fileMozillaCfg.Size > 0 Then 'If the file is NOT empty.
+ Set fileMozillaCfg = objFSO.OpenTextFile(strMozillaCfgFile, ForReading)
+ arrMozillaCfgContents = Split(fileMozillaCfg.ReadAll, vbCrLf)
+ arrMozillaCfgContents = Filter(arrMozillaCfgContents, strPreference, False, vbTextCompare)
+ Set fileMozillaCfg = objFSO.OpenTextFile(strMozillaCfgFile, ForWriting)
+ fileMozillaCfg.Write Join(arrMozillaCfgContents,vbCrLf)
+ fileMozillaCfg.Close
+ End If
+ End If
+End Sub
+
+Sub appendLockPreference(strPreference,strValue,boolQuoted)
+ Dim fileMozillaCfg, arrMozillaCfgContents
+ If boolQuoted Then
+ strPreference = "lockPref(" & Chr(34) & strPreference & Chr(34) & "," & Chr(34) & strValue & Chr(34) & ");"
+ Else
+ strPreference = "lockPref(" & Chr(34) & strPreference & Chr(34) & "," & strValue & ");"
+ End If
+
+ If objFSO.FileExists(strMozillaCfgFile) Then
+ Set fileMozillaCfg = objFSO.OpenTextFile(strMozillaCfgFile,ForAppending,False)
+ fileMozillaCfg.WriteLine strPreference
+ fileMozillaCfg.Close
+ Else
+ Set fileMozillaCfg = objFSO.OpenTextFile(strMozillaCfgFile,ForAppending,True)
+ fileMozillaCfg.WriteLine "//"
+ fileMozillaCfg.WriteLine strPreference
+ fileMozillaCfg.Close
+ End If
+End Sub
+
+' generateLogFile
+Sub generateLogFile()
+ On Error Resume Next
+ Set fileLog = objFSO.OpenTextFile(strLogLocation,ForAppending,True)
+ Select Case Err.Number
+ Case 70 'Access Denied
+ MsgBox "Log File Inaccessable. Please make sure another instance isn't running and that you are an administrator."
+ WScript.Quit(1)
+ End Select
+ On Error GoTo 0
+ writeLog ""
+ writeLog "-----------------------------------------------------------------"
+ writeLog vbTab & vbTab & vbTab & "Starting New Instance"
+ writeLog "-----------------------------------------------------------------"
+ writeLog ""
+ writeLog vbTab & vbTab & vbTab & "Firefox ADMX - Version " & strVersion
+End Sub
+
+' writeLog
+' Outputs "strMessage" to the screen as well as write to a specifed log file.
+' Uses the fLog object which points to the logFile variable for a file name and location of the log.
+' @param sMessage The message that will be output to both the specified error log and to the screen
+Sub writeLog(strMessage)
+ logFormat = "["&time&"]"&" "& strMessage
+ Wscript.Echo logFormat
+ fileLog.WriteLine(logFormat)
+End Sub
+
+' forceCScript
+' Forces the script to be run using "CScript.exe" rather than the often default "WScript.exe"
+Sub forceCScript()
+ Dim strArgs : strArgs = " "
+ Dim i, iWindow
+ For i = 0 To objArgs.Count-1
+ strArgs = strArgs & objArgs.Item(i) & " "
+ Next
+ If bQN Then
+ iWindow = 0
+ ElseIf bQB Then
+ iWindow = 1
+ Else
+ iWindow = 1
+ End If
+
+ If InStr(WScript.FullName,"cscript") = 0 Then
+ objShell.Run "%comspec% /k " & WScript.Path & "\cscript.exe " & Chr(34) & WScript.ScriptFullName & Chr(34) & strArgs,iWindow,False
+ WScript.Quit(0)
+ End If
+End Sub
+
+Sub checkArgs()
+ Dim i
+ If objArgs.Count > 0 Then
+ For i = 0 To objArgs.Count-1
+ Select Case objArgs.Item(i)
+ Case "/qb"
+ bQB = True
+ bQN = False
+ Case "/qn"
+ bQB = False
+ bQN = True
+ End Select
+ Next
+ End If
+End Sub
+
+Function getRegistryKey(strKey)
+ On Error Resume Next
+ strKey = objShell.RegRead(strKey)
+ If Err.Number <> 0 Then
+ Select Case Err.Number
+ Case -2147024894 'Registry key doesn't exist. Usually means the setting is not set via GPO.
+ getRegistryKey = ""
+ Case Else
+ writeLog "Error: " & Err.Number
+ End Select
+ Else
+ getRegistryKey = strKey
+ End If
+ Err.Clear
+ On Error GoTo 0
+End Function
Please sign in to comment.
Something went wrong with that request. Please try again.