Skip to content

Configuring Flash Player Settings and Updates with VBScript

2013 November 16
by Kirk Kosinski

Adobe Flash Player on Microsoft Windows is is configured by a file, mms.cfg, rather than registry entries.  For a computing environment using Active Directory, a file is more troublesome to handle than registry entries, which can easily be controlled with a custom GPO.  However, a script can be to used to edit configuration files.

While researching this article I found a few blogs that recommended using a script to copy a mms.cfg with the desired settings from a network share.  While that will work, I prefer using a self-contained script.  For this article I am using VBScript, but other languages such as PowerShell will also work.  See my recent article Common Windows Scripting Languages for more details on the possibilities.

One common reason an administrator would want to configure Flash Player is the “updater” service introduced in Flash Player 11.2 that allows the automatic installation of updates (see Introducing Adobe Flash Player Background Updater for Windows).  The updater can be configured manually using the Flash Player Settings Manager in the Windows Control Panel as shown below.  While manual configuration would be fine for a personal machine, it wouldn’t scale to hundreds or thousands of machines in an enterprise environment, so a script should be used to automatically perform the configuration.

Flash Player Settings Manager

Windows system administrators may find it useful to enable the updater since it eliminates a reason for end-users to have administrator rights or the need for an administrator to regularly create and deploy new Flash Player update packages through Microsoft SCCM, Novell ZENworks, or similar tools.  Conversely, administrators might want full control over updates and disallow Flash Player from updating itself.  In addition to updates, other settings including privacy and security settings are configured in the mms.cfg, and there are other configuration files that can be configured, such as ProtectedModeWhitelistConfig.txt.  I suggest taking a look at the Flash Player Administration Guide to see the possibilities.

With the above in mind the basic requirements of the script can be quickly determined.  First, the script obviously needs to configure mms.cfg.  Second, according to the admin guide,  “Flash Player looks for the mms.cfg file” in “%WINDIR%\System32\Macromed\Flash” for 32-bit Windows and “%WINDIR%\SysWow64\Macromed\Flash” for 64-bit.  Thus the script needs to check if the OS is 32- or 64-bit before writing the configuration.  Third, if the script will run more than once (like a startup script), for efficiency’s sake the script should check if writing the configuration is actually necessary.  The following sample script meets these requirements by assuming configuration is not necessary if mms.cfg already exists.

' Script to create mms.cfg.
On Error Resume Next
Const READ = 1, WRITE = 2, APPEND = 8
' edit mms.cfg contents here
mmsContents = "SilentAutoUpdateEnable=1" & VbCrLf &_
              "AutoUpdateDisable=0" & VbCrLf
Set objShell = CreateObject("WScript.Shell")
Set objEnv = objShell.Environment("Process")
Set objFSO = CreateObject("Scripting.FileSystemObject")
sysWow = objEnv("WINDIR") & "\SysWOW64"
sys32 = objEnv("WINDIR") & "\System32"
' Check OS bitness and configure the appropriate mms.cfg location.
If objFSO.FolderExists(sysWow) Then
   flashDir = sysWow & "\Macromed\Flash\"
   mmsFile = flashDir & "mms.cfg"
Else
   flashDir = sys32 & "\Macromed\Flash\"
   mmsFile = flashDir & "mms.cfg"
End If
' If Flash Player is installed and not configured, create and configure mms.cfg.
If ( objFSO.FolderExists(flashDir) And Not objFSO.FileExists(mmsFile) ) Then
   Set objMmsFile = objFSO.OpenTextFile(mmsFile, WRITE, TRUE)
   objMmsFile.Write mmsContents
   objMmsFile.Close
End If

The above script is only useful if the mms.cfg won’t need to be updated.  For example, it would be appropriate during an deployment of Windows.  In some cases, though, mms.cfg may already exist and need updating, and a script that runs on an ongoing basis like a startup script ought to be able to do this.  The sample script below can implement both new and updated configurations.  This is done with a simple version check.  By adding a version number in mms.cfg (using a comment), the script can be quickly check to determine if the file needs updating.  Whenever mms.cfg needs updating, simply increment the version number in the script and the next time it runs it will overwrite the old configuration.

' Script to create or reconfigure mms.cfg.
On Error Resume Next
Const scriptVer = 0.01
Const READ = 1, WRITE = 2, APPEND = 8
' edit mms.cfg contents here
mmsContents = "#configured by startup script ver. " & scriptVer & VbCrLf &_
              "SilentAutoUpdateEnable=1" & VbCrLf &_
              "AutoUpdateDisable=0" & VbCrLf
Set objShell = CreateObject("WScript.Shell")
Set objEnv = objShell.Environment("Process")
Set objFSO = CreateObject("Scripting.FileSystemObject")
sysWow = objEnv("WINDIR") & "\SysWOW64"
sys32 = objEnv("WINDIR") & "\System32"
' Check OS bitness and configure the appropriate mms.cfg location.
If ( objFSO.FolderExists(sysWow) ) Then
   flashDir = sysWow & "\Macromed\Flash\"
   mmsFile = flashDir & "mms.cfg"
Else
   flashDir = sys32 & "\Macromed\Flash\"
   mmsFile = flashDir & "mms.cfg"
End If
' if flash is installed and not configured, create and configure mms.cfg
If ( objFSO.FolderExists(flashDir) And Not objFSO.FileExists(mmsFile) ) Then
   Set objMmsFile = objFSO.OpenTextFile(mmsFile, WRITE, TRUE)
   objMmsFile.Write mmsContents
   objMmsFile.Close
ElseIf ( objFSO.FolderExists(flashDir) And objFSO.FileExists(mmsFile) ) Then
   Set objMmsFile = objFSO.OpenTextFile(mmsFile, READ, TRUE)
   strMmsLine = objMmsFile.ReadLine
   objMmsFile.Close
   If ( InStr(strMmsLine, scriptVer) =  0 ) Then
      Set objMmsFile = objFSO.OpenTextFile(mmsFile, WRITE, TRUE)
      objMmsFile.Write mmsContents
      objMmsFile.Close
   End If
End If

The actual configuration to write to mms.cfg will vary.  The samples above enable automatic updates (AutoUpdateDisable=0) and disable user interaction (SilentAutoUpdateEnable=1). They should only be used as examples.  Many other settings can be configured in mms.cfg, and more functionality could be added such as additional error handling.  If you are interested in learning more about VBScript I recommend reading Microsoft VBScript Step by Step from Microsoft Press or VBScript in a Nutshell from O’Reilly.

Leave a Reply

Note: You may use basic HTML in your comments. Your email address will not be published.

Subscribe to this comment feed via RSS

*