Update-Firefox: Renamed to Update-MozillaSoftware; Can Update Firefox and Thunderbird now!
This commit is contained in:
@@ -1,47 +0,0 @@
|
|||||||
####################################################################################################
|
|
||||||
# Digital Data Configuration File (Template Date: 30.07.2016) #
|
|
||||||
# UTF-8 Coding required! #
|
|
||||||
# incl. FailSafe functions that are active when information is missing. #
|
|
||||||
####################################################################################################
|
|
||||||
|
|
||||||
#==================================================================================================#
|
|
||||||
########################################## General Setup ###########################################
|
|
||||||
#==================================================================================================#
|
|
||||||
|
|
||||||
####################################################################################################
|
|
||||||
# Path in which the log files will be stored. #
|
|
||||||
# Example: E:\LogFiles\<ScriptName> #
|
|
||||||
# FailSafe Setting is: <ScriptPath>\Logs #
|
|
||||||
####################################################################################################
|
|
||||||
LogPath =
|
|
||||||
|
|
||||||
####################################################################################################
|
|
||||||
# Numerical value how long (in days) log files will be kept. ValidateRange is 0 - 1000 #
|
|
||||||
# Setting the Value to 0 disables this Function. #
|
|
||||||
# FailSafe Setting is: 60 #
|
|
||||||
####################################################################################################
|
|
||||||
LogFileKeepTime = 30
|
|
||||||
|
|
||||||
#==================================================================================================#
|
|
||||||
########################################## Profile Setup ###########################################
|
|
||||||
#==================================================================================================#
|
|
||||||
|
|
||||||
####################################################################################################
|
|
||||||
# VersionURL #
|
|
||||||
# Set the URL with the info about current version distibution. #
|
|
||||||
# Result file should be JSON #
|
|
||||||
####################################################################################################
|
|
||||||
VersionURL = https://product-details.mozilla.org/1.0/firefox_versions.json
|
|
||||||
|
|
||||||
####################################################################################################
|
|
||||||
# DownloadURL #
|
|
||||||
# Set the URL where to download the new software version. #
|
|
||||||
# Use "%NewFirefoxVersion%" as placeholder for the new version number, got from the VersionURL. #
|
|
||||||
####################################################################################################
|
|
||||||
DownloadURL = https://download-installer.cdn.mozilla.net/pub/firefox/releases/%NewFirefoxVersion%/win64/de/Firefox%20Setup%20%NewFirefoxVersion%.msi
|
|
||||||
|
|
||||||
####################################################################################################
|
|
||||||
# InstallPath #
|
|
||||||
# Set the local installation path. #
|
|
||||||
####################################################################################################
|
|
||||||
InstallPath = D:\ProgramFiles\Mozilla Firefox
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# Update-Firefox
|
# Update-MozillaSoftware
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
# This Script installs the newest Firefox version
|
# This Script installs the newest Firefox and/or Thunderbird versions
|
||||||
#
|
#
|
||||||
# Returns: -
|
# Returns: -
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
@@ -10,8 +10,8 @@
|
|||||||
# Tel.: 0641/202360 • E-Mail: info-flow@digitaldata.works
|
# Tel.: 0641/202360 • E-Mail: info-flow@digitaldata.works
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
# Creation Date / Author: 04.11.2024 / MK
|
# Creation Date / Author: 04.11.2024 / MK
|
||||||
# Version Date / Editor: 23.11.2024 / MK
|
# Version Date / Editor: 24.11.2024 / MK
|
||||||
# Version Number: 1.1.0.0
|
# Version Number: 1.2.0.0
|
||||||
|
|
||||||
#Requires –Version 4.0
|
#Requires –Version 4.0
|
||||||
|
|
||||||
@@ -49,11 +49,8 @@ Set-Variable -Scope Global -Name ModuleDefaultSourcePath -Value "P:\Sk
|
|||||||
Set-Variable -Scope Global -Name ModuleHKLMRegistryPath -Value "HKLM:\SOFTWARE\Digital Data\Modules"
|
Set-Variable -Scope Global -Name ModuleHKLMRegistryPath -Value "HKLM:\SOFTWARE\Digital Data\Modules"
|
||||||
Set-Variable -Scope Global -Name ModuleHKCURegistryPath -Value "HKCU:\SOFTWARE\Digital Data\Modules"
|
Set-Variable -Scope Global -Name ModuleHKCURegistryPath -Value "HKCU:\SOFTWARE\Digital Data\Modules"
|
||||||
|
|
||||||
Set-Variable -Scope Global -Name VersionURL -Value "https://product-details.mozilla.org/1.0/firefox_versions.json"
|
Set-Variable -Scope Global -Name Firefox -Value $NULL
|
||||||
Set-Variable -Scope Global -Name DownloadURL -Value "https://download-installer.cdn.mozilla.net/pub/firefox/releases/%NewFirefoxVersion%/win64/de/Firefox%20Setup%20%NewFirefoxVersion%.msi"
|
Set-Variable -Scope Global -Name Thunderbird -Value $NULL
|
||||||
Set-Variable -Scope Global -Name InstallPath -Value "D:\ProgramFiles\Mozilla Firefox"
|
|
||||||
Set-Variable -Scope Global -Name CurrentFirefoxVersion -Value 0
|
|
||||||
Set-Variable -Scope Global -Name NewFirefoxVersion -Value 0
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------------------------------#
|
#-----------------------------------------------------------------------------------------------------#
|
||||||
############################################ set functions ############################################
|
############################################ set functions ############################################
|
||||||
@@ -628,18 +625,37 @@ Function Import-CustomModule {
|
|||||||
} #end process
|
} #end process
|
||||||
|
|
||||||
} #end function
|
} #end function
|
||||||
Function Get-CurrentFirefoxVersion {
|
Function Get-CurrentVersion {
|
||||||
Try {
|
Param ($MozillaSoftware)
|
||||||
$CurrentFirefoxVersion = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Mozilla\Mozilla Firefox" -Name "(default)" -ErrorAction Stop)."(default)"
|
|
||||||
Write-Logfile -LogLine "Currently installed Firefox Version: $CurrentFirefoxVersion"
|
|
||||||
Return $CurrentFirefoxVersion
|
|
||||||
} Catch {
|
|
||||||
Write-Logfile -LogLine "Firefox seems not to be installed!"
|
|
||||||
Return 0
|
|
||||||
} #end try/catch
|
|
||||||
|
|
||||||
|
# Check if MozillaSoftware parameter is provided
|
||||||
|
If (-not $MozillaSoftware) {
|
||||||
|
Write-Logfile -LogLine "No Mozilla software specified!"
|
||||||
|
Return [Version]::0
|
||||||
|
}
|
||||||
|
|
||||||
|
Try {
|
||||||
|
$CurrentMozillaSoftwareVersionRegPath = "HKLM:\SOFTWARE\Mozilla\Mozilla $MozillaSoftware"
|
||||||
|
Write-Logfile -LogLine "Checking registry path: $CurrentMozillaSoftwareVersionRegPath"
|
||||||
|
|
||||||
|
# Check if the registry path exists
|
||||||
|
If (Test-Path -Path $CurrentMozillaSoftwareVersionRegPath) {
|
||||||
|
$CurrentMozillaSoftwareVersion = (Get-ItemProperty -Path $CurrentMozillaSoftwareVersionRegPath -Name "(default)" -ErrorAction Stop)."(default)"
|
||||||
|
Write-Logfile -LogLine "Currently installed $MozillaSoftware Version: $CurrentMozillaSoftwareVersion"
|
||||||
|
Return [Version]$CurrentMozillaSoftwareVersion
|
||||||
|
} Else {
|
||||||
|
Write-Logfile -LogLine "Registry path for $MozillaSoftware not found!"
|
||||||
|
Return [Version]::0
|
||||||
|
}
|
||||||
|
} Catch {
|
||||||
|
Write-Logfile -LogLine "Error retrieving version for $MozillaSoftware`: $_"
|
||||||
|
Return [Version]::0
|
||||||
|
}
|
||||||
} #end function
|
} #end function
|
||||||
Function Get-NewFirefoxVersion {
|
|
||||||
|
Function Get-NewVersion {
|
||||||
|
Param ($MozillaSoftware, $VersionURL)
|
||||||
|
|
||||||
Try {
|
Try {
|
||||||
|
|
||||||
$WebRequestResult = Invoke-WebRequest -Uri $VersionURL -ErrorAction Stop
|
$WebRequestResult = Invoke-WebRequest -Uri $VersionURL -ErrorAction Stop
|
||||||
@@ -648,13 +664,14 @@ Function Get-NewFirefoxVersion {
|
|||||||
|
|
||||||
$RestMethodResult = Invoke-RestMethod -Uri $VersionURL -ErrorAction Stop
|
$RestMethodResult = Invoke-RestMethod -Uri $VersionURL -ErrorAction Stop
|
||||||
Write-Logfile -LogLine "Software Version on server retrived!"
|
Write-Logfile -LogLine "Software Version on server retrived!"
|
||||||
|
$VersionAttribut = "LATEST_$MozillaSoftware`_VERSION"
|
||||||
|
|
||||||
IF ($RestMethodResult.LATEST_FIREFOX_VERSION -gt "0" ) {
|
IF ($($RestMethodResult.$VersionAttribut) -gt "0" ) {
|
||||||
[version]$NewFirefoxVersion = $($RestMethodResult.LATEST_FIREFOX_VERSION)
|
[version]$NewVersion = $($RestMethodResult.$VersionAttribut)
|
||||||
Write-Logfile -LogLine "Latest Firefox Version: $NewFirefoxVersion"
|
Write-Logfile -LogLine "Latest Version: $NewVersion"
|
||||||
Return $NewFirefoxVersion.ToString()
|
Return $NewVersion.ToString()
|
||||||
} else {
|
} else {
|
||||||
Write-Logfile -LogLine "Could not find the Firefox version number on the release notes page."
|
Write-Logfile -LogLine "Could not find the $MozillaSoftware version number from JSON interface."
|
||||||
Return 0
|
Return 0
|
||||||
} #end if/else
|
} #end if/else
|
||||||
|
|
||||||
@@ -672,26 +689,28 @@ Function Get-NewFirefoxVersion {
|
|||||||
} #end try/catch
|
} #end try/catch
|
||||||
|
|
||||||
} #end function
|
} #end function
|
||||||
Function Update-NewFirefoxVersion {
|
Function Install-NewVersion {
|
||||||
Param ($NewFirefoxVersion, $DownloadURL)
|
Param ($MozillaSoftware, $NewVersion, $DownloadURL, $InstallPath)
|
||||||
|
|
||||||
Try {
|
Try {
|
||||||
# Define the URL for the latest Firefox installer
|
# Define the URL for the latest installer
|
||||||
$NewFirefoxVersionURL = $DownloadURL -replace("%NewFirefoxVersion%",$NewFirefoxVersion)
|
$NewVersionURL = $DownloadURL -replace("%NewVersion%",$NewVersion)
|
||||||
$NewFirefoxVersionSetup = "$env:TEMP\Firefox$NewFirefoxVersion.msi"
|
$NewVersionSetup = "$env:TEMP\$MozillaSoftware$NewVersion.msi"
|
||||||
|
|
||||||
# Use Invoke-WebRequest to download the installer
|
# Use Invoke-WebRequest to download the installer
|
||||||
Write-Logfile -LogLine "Downloading Firefox Version $NewFirefoxVersion..."
|
Write-Logfile -LogLine "Downloading $MozillaSoftware Version $NewVersion from: "
|
||||||
Invoke-WebRequest -Uri $NewFirefoxVersionURL -OutFile $NewFirefoxVersionSetup -ErrorAction Stop
|
Write-Logfile -LogLine $NewVersionURL
|
||||||
|
Invoke-WebRequest -Uri $NewVersionURL -OutFile $NewVersionSetup -ErrorAction Stop
|
||||||
|
|
||||||
IF (Test-Path -Path $NewFirefoxVersionSetup -PathType Leaf -ErrorAction SilentlyContinue) {
|
IF (Test-Path -Path $NewVersionSetup -PathType Leaf -ErrorAction SilentlyContinue) {
|
||||||
|
|
||||||
$FirefoxProcess = Get-Process -Name "firefox" -ErrorAction SilentlyContinue
|
$MozillaSoftwareProcess = Get-Process -Name $MozillaSoftware -ErrorAction SilentlyContinue
|
||||||
If ($FirefoxProcess) {Stop-Process -Name "firefox" -Force -ErrorAction Stop}
|
If ($MozillaSoftwareProcess) {Stop-Process -Name $MozillaSoftware -Force -ErrorAction Stop}
|
||||||
|
|
||||||
Write-Logfile -LogLine "Installing Firefox Version $NewFirefoxVersion, please wait..."
|
Write-Logfile -LogLine "Installing $MozillaSoftware Version $NewVersion, please wait..."
|
||||||
$ArgumentList = "/i $NewFirefoxVersionSetup INSTALL_DIRECTORY_PATH=""$InstallPath"" /quiet"
|
$ArgumentList = "/i $NewVersionSetup INSTALL_DIRECTORY_PATH=""$InstallPath"" /quiet"
|
||||||
Start-Process -Verb runAs -FilePath "msiexec.exe" -ArgumentList $ArgumentList -Wait -ErrorAction Stop
|
Start-Process -Verb runAs -FilePath "msiexec.exe" -ArgumentList $ArgumentList -Wait -ErrorAction Stop
|
||||||
|
Write-Logfile -LogLine "Install or Update is completed!"
|
||||||
|
|
||||||
} Else {
|
} Else {
|
||||||
Write-Logfile -LogLine "Cannot find setup file!"
|
Write-Logfile -LogLine "Cannot find setup file!"
|
||||||
@@ -703,7 +722,7 @@ Function Update-NewFirefoxVersion {
|
|||||||
|
|
||||||
} Finally {
|
} Finally {
|
||||||
Write-Logfile -LogLine "Cleaning Up!"
|
Write-Logfile -LogLine "Cleaning Up!"
|
||||||
Remove-Item "$env:TEMP\Firefox$NewFirefoxVersion.msi" -Force -ErrorAction SilentlyContinue
|
Remove-Item "$env:TEMP\$MozillaSoftware$NewVersion.msi" -Force -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
} #end try/catch/finally
|
} #end try/catch/finally
|
||||||
|
|
||||||
@@ -740,9 +759,39 @@ FOREACH ($Module in $Modules) {
|
|||||||
[ARRAY]$LogPaths = $ConfigFileContent."LogPath_$($ConfigFileContent.LogPath[0])"
|
[ARRAY]$LogPaths = $ConfigFileContent."LogPath_$($ConfigFileContent.LogPath[0])"
|
||||||
[STRING]$LogFileKeepTime = $ConfigFileContent."LogFileKeepTime_$($ConfigFileContent.LogFileKeepTime[0])"
|
[STRING]$LogFileKeepTime = $ConfigFileContent."LogFileKeepTime_$($ConfigFileContent.LogFileKeepTime[0])"
|
||||||
|
|
||||||
[STRING]$VersionURL = $ConfigFileContent."VersionURL_$($ConfigFileContent.VersionURL[0])"
|
Try {
|
||||||
[STRING]$DownloadURL = $ConfigFileContent."DownloadURL_$($ConfigFileContent.DownloadURL[0])"
|
[OBJECT]$Firefox = New-Object PSObject -ErrorAction Stop
|
||||||
[STRING]$InstallPath = $ConfigFileContent."InstallPath_$($ConfigFileContent.InstallPath[0])"
|
Add-Member -InputObject $Firefox -MemberType NoteProperty -Name ProductName -Value "Firefox" -ErrorAction Stop
|
||||||
|
Add-Member -InputObject $Firefox -MemberType NoteProperty -Name Action -Value $ConfigFileContent."FirefoxAction_$($ConfigFileContent.FirefoxAction[0])" -ErrorAction Stop
|
||||||
|
Add-Member -InputObject $Firefox -MemberType NoteProperty -Name VersionURL -Value $ConfigFileContent."FirefoxVersionURL_$($ConfigFileContent.FirefoxVersionURL[0])" -ErrorAction Stop
|
||||||
|
Add-Member -InputObject $Firefox -MemberType NoteProperty -Name DownloadURL -Value $ConfigFileContent."FirefoxDownloadURL_$($ConfigFileContent.FirefoxDownloadURL[0])" -ErrorAction Stop
|
||||||
|
Add-Member -InputObject $Firefox -MemberType NoteProperty -Name InstallPath -Value $ConfigFileContent."FirefoxInstallPath_$($ConfigFileContent.FirefoxInstallPath[0])" -ErrorAction Stop
|
||||||
|
Add-Member -InputObject $Firefox -MemberType NoteProperty -Name CurrentVersion -Value 0 -ErrorAction Stop
|
||||||
|
Add-Member -InputObject $Firefox -MemberType NoteProperty -Name NewVersion -Value 0 -ErrorAction Stop
|
||||||
|
|
||||||
|
} Catch {
|
||||||
|
Write-Logfile -LogLine " "
|
||||||
|
Write-Logfile -LogLine "Error creating Object for: Firefox"
|
||||||
|
|
||||||
|
Write-Logfile -LogLine "Property Value is missing or invalid!"
|
||||||
|
} #end try/catch
|
||||||
|
|
||||||
|
Try {
|
||||||
|
[OBJECT]$Thunderbird = New-Object PSObject -ErrorAction Stop
|
||||||
|
Add-Member -InputObject $Thunderbird -MemberType NoteProperty -Name ProductName -Value "Thunderbird" -ErrorAction Stop
|
||||||
|
Add-Member -InputObject $Thunderbird -MemberType NoteProperty -Name Action -Value $ConfigFileContent."ThunderbirdAction_$($ConfigFileContent.ThunderbirdAction[0])" -ErrorAction Stop
|
||||||
|
Add-Member -InputObject $Thunderbird -MemberType NoteProperty -Name VersionURL -Value $ConfigFileContent."ThunderbirdVersionURL_$($ConfigFileContent.ThunderbirdVersionURL[0])" -ErrorAction Stop
|
||||||
|
Add-Member -InputObject $Thunderbird -MemberType NoteProperty -Name DownloadURL -Value $ConfigFileContent."ThunderbirdDownloadURL_$($ConfigFileContent.ThunderbirdDownloadURL[0])" -ErrorAction Stop
|
||||||
|
Add-Member -InputObject $Thunderbird -MemberType NoteProperty -Name InstallPath -Value $ConfigFileContent."ThunderbirdInstallPath_$($ConfigFileContent.ThunderbirdInstallPath[0])" -ErrorAction Stop
|
||||||
|
Add-Member -InputObject $Thunderbird -MemberType NoteProperty -Name CurrentVersion -Value 0 -ErrorAction Stop
|
||||||
|
Add-Member -InputObject $Thunderbird -MemberType NoteProperty -Name NewVersion -Value 0 -ErrorAction Stop
|
||||||
|
|
||||||
|
} Catch {
|
||||||
|
Write-Logfile -LogLine " "
|
||||||
|
Write-Logfile -LogLine "Error creating Object for: Thunderbird"
|
||||||
|
Write-Logfile -LogLine "Property Value is missing or invalid!"
|
||||||
|
|
||||||
|
} #end try/catch
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------------------------------#
|
#-----------------------------------------------------------------------------------------------------#
|
||||||
############################################# main part ###############################################
|
############################################# main part ###############################################
|
||||||
@@ -761,24 +810,88 @@ Write-Logfile -LogLine "from Account $env:USERDOMAIN\$env:USERNAME."
|
|||||||
Write-Logfile -LogLine "********************************************************************************"
|
Write-Logfile -LogLine "********************************************************************************"
|
||||||
|
|
||||||
Write-Logfile -LogLine " "
|
Write-Logfile -LogLine " "
|
||||||
|
Write-Logfile -LogLine "Starting with $($Firefox.ProductName) ..."
|
||||||
|
IF (($Firefox.Action) -and ($Firefox.VersionURL) -and ($Firefox.DownloadURL) -and ($Firefox.InstallPath)) {
|
||||||
|
Write-Logfile -LogLine "All required Variables are set for this Step."
|
||||||
|
Write-Logfile -LogLine "Action: $($Firefox.Action)"
|
||||||
|
Write-Logfile -LogLine "VersionURL: $($Firefox.VersionURL)"
|
||||||
|
Write-Logfile -LogLine "DownloadURL: $($Firefox.DownloadURL)"
|
||||||
|
Write-Logfile -LogLine "InstallPath: $($Firefox.InstallPath)"
|
||||||
|
Write-Logfile -LogLine " "
|
||||||
|
|
||||||
IF (($VersionURL) -and ($DownloadURL) -and ($InstallPath)) {
|
$Firefox.CurrentVersion = Get-CurrentVersion -MozillaSoftware $Firefox.ProductName
|
||||||
Write-Logfile -LogLine "All required Variables are set for this Script."
|
$Firefox.NewVersion = Get-NewVersion -MozillaSoftware $Firefox.ProductName -VersionURL $Firefox.VersionURL[0]
|
||||||
|
|
||||||
$CurrentFirefoxVersion = Get-CurrentFirefoxVersion
|
|
||||||
$NewFirefoxVersion = Get-NewFirefoxVersion
|
|
||||||
|
|
||||||
If ($NewFirefoxVersion -gt $CurrentFirefoxVersion) {
|
If ([Version]$Firefox.NewVersion -gt [Version]$Firefox.CurrentVersion) {
|
||||||
Write-Logfile -LogLine "Install or Update is neccessary!"
|
|
||||||
Update-NewFirefoxVersion -NewFirefoxVersion $NewFirefoxVersion -DownloadURL $DownloadURL
|
IF ($Firefox.Action -match "InstallAndUpdate") {
|
||||||
Write-Logfile -LogLine "Install or Update is completed!"
|
Write-Logfile -LogLine "Install or Update is neccessary!"
|
||||||
Get-CurrentFirefoxVersion | Out-Null
|
Install-NewVersion -MozillaSoftware $Firefox.ProductName -NewVersion $Firefox.NewVersion -DownloadURL $Firefox.DownloadURL[0] -InstallPath $Firefox.InstallPath[0]
|
||||||
|
Get-CurrentVersion -MozillaSoftware $Firefox.ProductName | Out-Null
|
||||||
|
|
||||||
|
} ElseIf (($Firefox.Action -match "UpdateOnly") -and ([Version]$Firefox.CurrentVersion -gt 0)) {
|
||||||
|
Write-Logfile -LogLine "Update is neccessary!"
|
||||||
|
Install-NewVersion -MozillaSoftware $Firefox.ProductName -NewVersion $Firefox.NewVersion -DownloadURL $Firefox.DownloadURL[0] -InstallPath $Firefox.InstallPath[0]
|
||||||
|
Get-CurrentVersion -MozillaSoftware $Firefox.ProductName | Out-Null
|
||||||
|
|
||||||
|
} ElseIf (($Firefox.Action -match "UpdateOnly") -and (([Version]$Firefox.CurrentVersion -eq $NULL) -or ([Version]$Firefox.CurrentVersion -eq 0))) {
|
||||||
|
Write-Logfile -LogLine "Skipping Update because of non exisitng installation and config!"
|
||||||
|
|
||||||
|
} Else {
|
||||||
|
Write-Logfile -LogLine "Unknown config!"
|
||||||
|
|
||||||
|
} #end if/elseif/else
|
||||||
|
|
||||||
} Else {
|
} Else {
|
||||||
Write-Logfile -LogLine "No Install or Update is neccessary!"
|
Write-Logfile -LogLine "No Install or Update is neccessary!"
|
||||||
} #end if/else
|
} #end if/else
|
||||||
|
|
||||||
} Else {
|
} Else {
|
||||||
Write-Logfile -LogLine "Not all required Variables are set for this Script."
|
Write-Logfile -LogLine "Not all required Variables are set for this Step."
|
||||||
|
|
||||||
|
} #end if/else
|
||||||
|
|
||||||
|
Write-Logfile -LogLine "--------------------------------------------------------------------------------"
|
||||||
|
|
||||||
|
Write-Logfile -LogLine " "
|
||||||
|
Write-Logfile -LogLine "Continue with $($Thunderbird.ProductName) ..."
|
||||||
|
IF (($Thunderbird.Action) -and ($Thunderbird.VersionURL) -and ($Thunderbird.DownloadURL) -and ($Thunderbird.InstallPath)) {
|
||||||
|
Write-Logfile -LogLine "All required Variables are set for this Step."
|
||||||
|
Write-Logfile -LogLine "Action: $($Thunderbird.Action)"
|
||||||
|
Write-Logfile -LogLine "VersionURL: $($Thunderbird.VersionURL)"
|
||||||
|
Write-Logfile -LogLine "DownloadURL: $($Thunderbird.DownloadURL)"
|
||||||
|
Write-Logfile -LogLine "InstallPath: $($Thunderbird.InstallPath)"
|
||||||
|
Write-Logfile -LogLine " "
|
||||||
|
|
||||||
|
$Thunderbird.CurrentVersion = Get-CurrentVersion -MozillaSoftware $Thunderbird.ProductName
|
||||||
|
$Thunderbird.NewVersion = Get-NewVersion -MozillaSoftware $Thunderbird.ProductName -VersionURL $Thunderbird.VersionURL[0]
|
||||||
|
|
||||||
|
If ([Version]$Thunderbird.NewVersion -gt [Version]$Thunderbird.CurrentVersion) {
|
||||||
|
|
||||||
|
IF ($Thunderbird.Action -match "InstallAndUpdate") {
|
||||||
|
Write-Logfile -LogLine "Install or Update is neccessary!"
|
||||||
|
Install-NewVersion -MozillaSoftware $Thunderbird.ProductName -NewVersion $Thunderbird.NewVersion -DownloadURL $Thunderbird.DownloadURL[0] -InstallPath $Thunderbird.InstallPath[0]
|
||||||
|
Get-CurrentVersion -MozillaSoftware $Thunderbird.ProductName | Out-Null
|
||||||
|
|
||||||
|
} ElseIf (($Thunderbird.Action -match "UpdateOnly") -and ([Version]$Thunderbird.CurrentVersion -gt 0)) {
|
||||||
|
Write-Logfile -LogLine "Update is neccessary!"
|
||||||
|
Install-NewVersion -MozillaSoftware $Thunderbird.ProductName -NewVersion $Thunderbird.NewVersion -DownloadURL $Thunderbird.DownloadURL[0] -InstallPath $Thunderbird.InstallPath[0]
|
||||||
|
Get-CurrentVersion -MozillaSoftware $Thunderbird.ProductName | Out-Null
|
||||||
|
|
||||||
|
} ElseIf (($Thunderbird.Action -match "UpdateOnly") -and (([Version]$Thunderbird.CurrentVersion -eq $NULL) -or ([Version]$Thunderbird.CurrentVersion -eq 0))) {
|
||||||
|
Write-Logfile -LogLine "Skipping Update because of non exisitng installation!"
|
||||||
|
|
||||||
|
} Else {
|
||||||
|
Write-Logfile -LogLine "Unknown config!"
|
||||||
|
|
||||||
|
} #end if/elseif/else
|
||||||
|
|
||||||
|
} Else {
|
||||||
|
Write-Logfile -LogLine "No Install or Update is neccessary!"
|
||||||
|
} #end if/else
|
||||||
|
|
||||||
|
} Else {
|
||||||
|
Write-Logfile -LogLine "Not all required Variables are set for this Step."
|
||||||
|
|
||||||
} #end if/else
|
} #end if/else
|
||||||
|
|
||||||
@@ -801,7 +914,7 @@ Write-Logfile -LogLine "********************************************************
|
|||||||
|
|
||||||
#Enable only for debugging
|
#Enable only for debugging
|
||||||
#exit
|
#exit
|
||||||
start-process -w
|
|
||||||
Remove-Variable -Name ScriptName -Force -ErrorAction SilentlyContinue
|
Remove-Variable -Name ScriptName -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Variable -Name ScriptPath -Force -ErrorAction SilentlyContinue
|
Remove-Variable -Name ScriptPath -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Variable -Name ConfigFile -Force -ErrorAction SilentlyContinue
|
Remove-Variable -Name ConfigFile -Force -ErrorAction SilentlyContinue
|
||||||
@@ -820,10 +933,7 @@ Remove-Variable -Name ModuleDefaultSourcePath -Force -ErrorAction SilentlyC
|
|||||||
Remove-Variable -Name ModuleHKLMRegistryPath -Force -ErrorAction SilentlyContinue
|
Remove-Variable -Name ModuleHKLMRegistryPath -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Variable -Name ModuleHKCURegistryPath -Force -ErrorAction SilentlyContinue
|
Remove-Variable -Name ModuleHKCURegistryPath -Force -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
Remove-Variable -Name VersionURL -Force -ErrorAction SilentlyContinue
|
Remove-Variable -Name Firefox -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Variable -Name DownloadURL -Force -ErrorAction SilentlyContinue
|
Remove-Variable -Name Thunderbird -Force -ErrorAction SilentlyContinue
|
||||||
Remove-Variable -Name InstallPath -Force -ErrorAction SilentlyContinue
|
|
||||||
Remove-Variable -Name CurrentFirefoxVersion -Force -ErrorAction SilentlyContinue
|
|
||||||
Remove-Variable -Name NewFirefoxVersion -Force -ErrorAction SilentlyContinue
|
|
||||||
|
|
||||||
$error.clear()
|
$error.clear()
|
||||||
@@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Version 1.2.0.0 - 24.11.2024
|
||||||
|
NEW: - Added support for updating Thunderbird
|
||||||
|
- Added switch for install and update action (=FirefoxAction;=ThunderbirdAction)
|
||||||
|
FIX: -
|
||||||
|
CHG: - Script renamed. Old name: "Update-Firefox", new name: "Update-MozillaSoftware"
|
||||||
|
REM: -
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
####################################################################################################
|
||||||
|
# Digital Data Configuration File (Template Date: 30.07.2016) #
|
||||||
|
# UTF-8 Coding required! #
|
||||||
|
# incl. FailSafe functions that are active when information is missing. #
|
||||||
|
####################################################################################################
|
||||||
|
|
||||||
|
#==================================================================================================#
|
||||||
|
########################################## General Setup ###########################################
|
||||||
|
#==================================================================================================#
|
||||||
|
|
||||||
|
####################################################################################################
|
||||||
|
# Path in which the log files will be stored. #
|
||||||
|
# Example: E:\LogFiles\<ScriptName> #
|
||||||
|
# FailSafe Setting is: <ScriptPath>\Logs #
|
||||||
|
####################################################################################################
|
||||||
|
LogPath =
|
||||||
|
|
||||||
|
####################################################################################################
|
||||||
|
# Numerical value how long (in days) log files will be kept. ValidateRange is 0 - 1000 #
|
||||||
|
# Setting the Value to 0 disables this Function. #
|
||||||
|
# FailSafe Setting is: 60 #
|
||||||
|
####################################################################################################
|
||||||
|
LogFileKeepTime = 30
|
||||||
|
|
||||||
|
#==================================================================================================#
|
||||||
|
########################################## Firefox Setup ###########################################
|
||||||
|
#==================================================================================================#
|
||||||
|
|
||||||
|
####################################################################################################
|
||||||
|
# FirefoxAction #
|
||||||
|
# Set the action to be performed! #
|
||||||
|
# Example: InstallAndUpdate #
|
||||||
|
# Example: UpdateOnly #
|
||||||
|
####################################################################################################
|
||||||
|
FirefoxAction = InstallAndUpdate
|
||||||
|
|
||||||
|
####################################################################################################
|
||||||
|
# FirefoxVersionURL #
|
||||||
|
# Set the URL with the info about current version distibution. #
|
||||||
|
# Result file should be JSON #
|
||||||
|
####################################################################################################
|
||||||
|
FirefoxVersionURL = https://product-details.mozilla.org/1.0/firefox_versions.json
|
||||||
|
|
||||||
|
####################################################################################################
|
||||||
|
# FirefoxDownloadURL #
|
||||||
|
# Set the URL where to download the new software version. #
|
||||||
|
# The URL can be case sensitive! #
|
||||||
|
# Use "%NewVersion%" as placeholder for the new version number, got from the VersionURL. #
|
||||||
|
####################################################################################################
|
||||||
|
FirefoxDownloadURL = https://download-installer.cdn.mozilla.net/pub/firefox/releases/%NewVersion%/win64/de/Firefox%20Setup%20%NewVersion%.msi
|
||||||
|
|
||||||
|
####################################################################################################
|
||||||
|
# FirefoxInstallPath #
|
||||||
|
# Set the local installation path. #
|
||||||
|
####################################################################################################
|
||||||
|
FirefoxInstallPath = D:\ProgramFiles\Mozilla Firefox
|
||||||
|
|
||||||
|
#==================================================================================================#
|
||||||
|
######################################## Thunderbird Setup #########################################
|
||||||
|
#==================================================================================================#
|
||||||
|
|
||||||
|
####################################################################################################
|
||||||
|
# ThunderbirdAction #
|
||||||
|
# Set the action to be performed! #
|
||||||
|
# Example: InstallAndUpdate #
|
||||||
|
# Example: UpdateOnly #
|
||||||
|
####################################################################################################
|
||||||
|
ThunderbirdAction = InstallAndUpdate
|
||||||
|
|
||||||
|
####################################################################################################
|
||||||
|
# ThunderbirdVersionURL #
|
||||||
|
# Set the URL with the info about current version distibution. #
|
||||||
|
# Result file should be JSON #
|
||||||
|
####################################################################################################
|
||||||
|
ThunderbirdVersionURL = https://product-details.mozilla.org/1.0/thunderbird_versions.json
|
||||||
|
|
||||||
|
####################################################################################################
|
||||||
|
# ThunderbirdDownloadURL #
|
||||||
|
# Set the URL where to download the new software version. #
|
||||||
|
# The URL can be case sensitive! #
|
||||||
|
# Use "%NewVersion%" as placeholder for the new version number, got from the VersionURL. #
|
||||||
|
####################################################################################################
|
||||||
|
ThunderbirdDownloadURL = https://download-installer.cdn.mozilla.net/pub/thunderbird/releases/%NewVersion%/win64/de/Thunderbird%20Setup%20%NewVersion%.msi
|
||||||
|
|
||||||
|
####################################################################################################
|
||||||
|
# ThunderbirdInstallPath #
|
||||||
|
# Set the local installation path. #
|
||||||
|
####################################################################################################
|
||||||
|
ThunderbirdInstallPath = D:\ProgramFiles\Mozilla Thunderbird
|
||||||
|
|
||||||
|
####################################################################################################
|
||||||
|
|
||||||
|
# Sources:
|
||||||
|
# https://stackoverflow.com/questions/36480534/is-there-an-api-to-retrieve-latest-versions-of-firefox-release-numbers-for-all-r
|
||||||
|
# https://github.com/ScoopInstaller/Extras/blob/master/bucket/thunderbird.json
|
||||||
Reference in New Issue
Block a user