DSCResources/MSFT_xFirefox/MSFT_xFirefox.schema.psm1
Configuration MSFT_xFirefox { param ( [string]$VersionNumber = "30.0", [string]$Language = "en-US", [string]$OS = "win", [string]$machineBits = "x86", [string]$LocalPath = "$env:SystemDrive\Windows\DtlDownloads\Firefox" ) $localSetupPath = $LocalPath + "\Firefox Setup " + $versionNumber +".exe" $iniFilePath = "$env:SystemDrive" + "\firefoxIniFile.ini" Import-DscResource -ModuleName xPSDesiredStateConfiguration File CreateLocalPath { Type = 'Directory' DestinationPath = $LocalPath Ensure = "Present" } File CreateIniFile { Type = 'File' DestinationPath = $iniFilePath Ensure = "Present" Contents = "[Install]`nMaintenanceService=false" } Script ChangeFileContentToUtfWithOutBOM { SetScript = { $iniFilePath = "$env:SystemDrive\firefoxIniFile.ini" $contents = Get-Content $iniFilePath $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding($False) [System.IO.File]::WriteAllLines($iniFilePath, $contents, $Utf8NoBomEncoding) } TestScript = { !(Test-Path $iniFilePath) } GetScript = { @{} } DependsOn = "[File]CreateIniFile" } xRemoteFile DownloadSetup { Uri = "http://download.mozilla.org/?product=firefox-" + $VersionNumber +"&os="+$OS+"&lang=" + $Language DestinationPath = $localSetupPath DependsOn = "[File]CreateIniFile" } Package InstallFirefox { Ensure = "Present" Path = $localSetupPath Name = "Mozilla Firefox "+$VersionNumber+" ("+$machineBits+" "+$Language+")" ProductId = '' Arguments = "/INI=" + $iniFilePath DependsOn = "[xRemoteFile]DownloadSetup" } } |