Skip to content

mkht/DSCR_Firefox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DSCR_Firefox

DSC Resource for installing and managing Firefox


Installation

You can install from PowerShell Gallery.

Install-Module -Name DSCR_Firefox

Dependencies


Resources

cFirefox
cFirefoxBookmarks cFirefoxPrefs
cFirefoxPolicy cFirefoxBookmarksPolicy

cFirefox

Install Firefox

Properties

  • [string] VersionNumber (Require):

    • The version of the Firefox you wish install. e.g) 79.0
  • [string] Language (Optional):

    • Language of the Firefox.
    • The default is en-US
  • [string] MachineBits (Optional):

    • Specify the machine's operating system architecture. (Auto | x86 | x64 | ARM64)
    • If you don't specify it, the best one for the system will be selected automatically.
  • [string] InstallerPath (Optional):

    • The path of the Firefox installer file.
    • If this value is not specified, The Installer will be downloaded from Mozilla. (https://ftp.mozilla.org/pub/firefox/releases/)
    • Please use if you want to use the self-customized installer or if the target machine is not connected to the Internet.
  • [string] InstallDirectoryName (Optional):

    • The name of the directory where the Firefox will be installed.
    • If this value is specified then InstallDirectoryPath will be ignored.
  • [string] InstallDirectoryPath (Optional):

    • The full path of the directory to install the Firefox.
    • If the both InstallDirectoryPath and InstallDirectoryName not specified, the Firefox will be installed in the system's program files directory.
  • [bool] QuickLaunchShortcut (Optional):

    • Create a shortcut for the Firefox in the QuickLaunch directory.
    • The default is $false
  • [bool] DesktopShortcut (Optional):

    • Create a shortcut for the Firefox on the all user's desktop.
    • The default is $true
  • [bool] TaskbarShortcut (Optional):

    • Create a shortcut for the Firefox on the taskbar.
    • The default is $false
  • [bool] MaintenanceService (Optional):

    • Specify whether the MozillaMaintenance service will be installed or not
    • The default is $true
  • [bool] StartMenuShortcuts (Optional):

    • Create shortcuts for the application in the Start Menu.
    • The default is $true
  • [string] StartMenuDirectoryName (Optional):

    • The directory name to use for the StartMenu folder
    • The default is Mozilla Firefox
  • [bool] OptionalExtensions (Optional):

    • Set this option to $false to opt-out installation of any optional extensions.
    • The default is $true
    • This option can be used in Firefox 60 or later.
  • [bool] RegisterDefaultAgent (Optional):

    • Set to $false to disable creating a recurring scheduled task to run the default browser agent.
    • The default is $true
    • This option can be used in Firefox 76 or later.
  • [bool] RemoveDistributionDir (Optional):

    • Set to $false to disable removing the distribution directory from an existing installation that’s being paved over.
    • By default this is $true and the directory is removed.
  • [PSCredential] Credential (Optional):

    • The credential for access to the installer on a remote source if needed.
    • ⚠️ If you want to run the installation as a specific user, you need to use PsDscRunAsCredential standard property.

Examples

  • Example 1: Install Firefox 78.0.2 x64 japanese
Configuration Example1
{
    Import-DscResource -ModuleName DSCR_Firefox
    cFirefox Firefox78
    {
        VersionNumber = "78.0.2"
        Language = "ja"
        Machinebits = "x64"
    }
}
  • Example 2: Install Firefox 78.0.2 ESR without MozillaMaintenance service
Configuration Example2
{
    Import-DscResource -ModuleName DSCR_Firefox
    cFirefox Firefox78ESR
    {
        VersionNumber = "78.2.0esr"
        MaintenanceService = $false
    }
}

cFirefoxBookmarks

Manage bookmarks.

Properties

  • [string] Title (Require):

    • The title of the bookmark.
  • [string] Link (Require):

    • The URL of the bookmark.
  • [string] Type (Optional):

    • Specify the type of the item.
    • Link / Separator / Folder
    • The default is Link
  • [string] BookmarksLocation (Optional):

    • The location of the bookmark
    • BookmarksMenu / BookmarksToolbar / BookmarksFolder-(FolderId)
    • The default is BookmarksMenu
  • [int] Position (Optional):

    • The position of the bookmark. The smaller is placed above. (1-99)
    • The default is 1
  • [string] IconUrl (Optional):

    • The URL of the bookmark's icon.
  • [string] IconData (Optional):

    • The data of the bookmark's icon.
    • You can use data URI scheme.
  • [int] FolderId (Optional):

    • The ID of the folder.
    • This value only respect when the item type is Folder.
    • The default is 1
  • [string] FirefoxDirectory (Optional):

    • Specify the directory of the Firefox installed.
    • The default is "C:\Program Files\Mozilla Firefox"

Examples

Example 1: Bookmark to Google

Configuration Example1
{
    Import-DscResource -ModuleName DSCR_Firefox
    cFireFoxBookmarks FireFox_Bookmark_Google
    {
        Title = 'Google'
        Link = 'https://www.google.com/'
    }
}

cFirefoxPrefs

Manage preferences.

Properties

  • [string] PrefName (Require):

    • The name of the preference.
  • [string] PrefValue (Require):

    • The value of the preference.
  • [bool] IsStringValue (Optional):

    • When $true is specified, the type of preference will always be a string.
    • The default is $false ( The value type will be determined automatically. )
  • [string] PrefType (Optional):

    • The type of the preference.
    • pref / defaultPref / lockPref / cleanPref / LocalizablePreferences (Case sensitive!)
    • The default is pref
Type detail
pref The user can temporarily change the setting, but the changed value will be lost when exiting Firefox
defaultPref The user can change the setting, and the changed value will be saved even after Firefox exits.
lockPref The user can not change the setting.
cleanPref Delete setting value
  • [string] FirefoxDirectory (Optional):
    • Specify the directory of the Firefox installed.
    • The default is "C:\Program Files\Mozilla Firefox"

Examples

Example 1: Disable Firefox update

Configuration Example1
{
    Import-DscResource -ModuleName DSCR_Firefox
    cFireFoxPrefs FireFox_Update_Disable
    {
        PrefName = 'app.update.enabled'
        PrefValue = $false
        PrefType = 'lockPref'
    }
}

cFirefoxPolicy

The DSC Resource for configuring Firefox Enterprise Policies
This resource can be used only in Firefox 60 or later

Properties

  • [string] Ensure (Optional):

    • Whether to set or delete policies
    • The default is Present [Present | Absent]
  • [string] PolicyName (Require):

    • The NAME of the policy
    • Please refer to the document for possible values
  • [string] PolicyValue (Require):

    • The value of the policies
    • The value of this parameter must be a JSON formatted string
  • [string] FirefoxDirectory (Optional):

    • Specify the directory of the Firefox installed.
    • The default is "C:\Program Files\Mozilla Firefox"

Examples

Example 1: To configure the policy that removes access to about:addons

Configuration Example1
{
    Import-DscResource -ModuleName DSCR_Firefox
    cFireFoxPolicy FireFox_BlockAboutAddons
    {
        PolicyName = 'BlockAboutAddons'
        PolicyValue = $true
    }
}

Example 2: To configure the policy that sets the default homepage

Configuration Example2
{
    Import-DscResource -ModuleName DSCR_Firefox
    cFireFoxPolicy FireFox_Homepage
    {
        PolicyName = 'Homepage'
        PolicyValue = @'
        {
            "URL": "http://example.com/",
            "Locked": true,
            "Additional": ["http://example.org/", "http://example.edu/"]
        }
'@
    }
}

cFirefoxBookmarksPolicy

The DSC Resource for configuring Bookmarks
The difference with cFirefoxBookmarks is set as policy, so you can enforce settings to the end-users
This resource can be used only in Firefox 60 or later

Properties

  • [string] Ensure (Optional):

    • Whether to create or delete bookmarks
    • The default is Present [Present | Absent]
  • [string] Title (Require):

    • The name of the bookmark
  • [string] URL (Require):

    • The URL of the bookmark.
  • [string] Favicon (Optional):

    • The URL of the bookmark's icon.
  • [string] Placement (Optional):

    • Whether to place bookmarks in menu or toolbar.
    • The default is toolbar [toolbar | menu]
  • [string] Folder (Optional):

    • If a Folder is specified, it is automatically created and bookmarks with the same folder name are grouped together.
  • [string] FirefoxDirectory (Optional):

    • Specify the directory of the Firefox installed.
    • The default is "C:\Program Files\Mozilla Firefox"

Examples

Example 1: Create a bookmark

Configuration Example1
{
    Import-DscResource -ModuleName DSCR_Firefox
    cFireFoxBookmarksPolicy FireFox_BookmarksPolicy
    {
        Title   = 'Example1'
        URL     = 'https://www.example.com/'
        Favicon = 'https://www.example.com/favicon.ico'
    }
}

ChangeLog

2.0.3

  • [cFirefoxPolicy] Fixed an issue where JSON strings containing newlines were not parsed correctly.

2.0.2

  • [cFirefox] Firefox 90.0 or later support.

2.0.1

  • [cFirefox] ARM64 support (experimental).
  • [cFirefox] No longer necessary to explicitly specify the OS architecture. It will be determined automatically.
  • [cFirefox] Add RegisterDefaultAgent and RemoveDistributionDir params.
  • Updates examples.

1.2.0

  • [cFirefoxPrefs] Add IsStringValue property. When $true is specified, the type of preference will always be a string.
  • [cFirefoxPrefs] Fix an issue that incorrect type is set when specifying floating point number in PrefValue.

1.1.3

  • [cFirefox] Fixed an issue that some garbage files remain in the C:\Windows\Temp folder after configuration.
  • minor fixes

1.1.2

  • [cFirefoxPrefs] Improved to work properly even if the case of PrefType value is incorrect.
  • [cFirefoxPrefs] Fixed issue that the cFirefoxPrefs is not working correctly when the PrefType is defaultPref or cleanPref or lockPref.

1.1.0

1.0.1

  • Remove unnecessary files in the published package

1.0.0

  • [cFirefox] Add the Credential property

0.9.0

  • Add new resource cFirefoxPolicy
  • Add new resource cFirefoxBookmarksPolicy

0.8.0

  • [cFirefox] Now you can specify the ESR version of Firefox. e.g) VersionNumber = "60.0esr"
  • [cFirefox] Add the OptionalExtensions param to opt-out installation of any optional extensions. (This option can be used in Firefox 60 or later)
  • [cFirefox] Add StartMenuShortcuts and StartMenuDirectoryName params.
  • [cFirefox] Add the InstallerPath param for offline installation.
  • [cFirefox] Change the download source URL of the installer to https://ftp.mozilla.org/

0.7.1

  • Fix issue #7 cFirefoxPrefs was not loaded some systems.

0.7.0

  • Add module dependency (DSCR_Application)
  • Remove module dependency (xPSDesiredStateConfiguration)
  • Fix issue that the Download process runs even if FireFox has already been installed #4