Actualización por script de firefox
Cansado de descargar soft para los paquetes de firefox para el sccm me interese en buscar un método de detección por script e instalacion y el codigo ya no recuerdo de donde lo saque (gracias a la web si la recuerdo la nombro), pero si que lo adapte a mis necesidades haciendo un hibrido
básicamente miramos en la web la version, la comparamos con la instalada, descargamos la version que queremos he instalamos (en mi caso la version en catalán por petición del cliente)
function Get-OnlineVerFirefox
{
[cmdletbinding()]
param (
[Parameter(Mandatory=$false,
Position=0)]
[switch]
$Quiet
)
begin
{
# Initial Variables
$SoftwareName = "Mozilla Firefox"
$uri = 'https://product-details.mozilla.org/1.0/firefox_versions.json'
$hashtable = [ordered]@{
'Software_Name' = $softwareName
'Software_URL' = $uri
'Online_Version' = 'UNKNOWN'
'Online_Date' = 'UNKNOWN'
'Download_URL_x64' = 'UNKNOWN'
'Download_URL_x86' = 'UNKNOWN'
}
$swObject = New-Object -TypeName PSObject -Property $hashtable
}
Process
{
# Get the Version & Release Date
try
{
Write-Verbose -Message "Attempting to pull info from the below URL: `n $URI"
$uri = 'https://product-details.mozilla.org/1.0/firefox_versions.json'
$FirefoxVersion = Invoke-WebRequest $uri -UseBasicParsing | ConvertFrom-Json | select -ExpandProperty LATEST_FIREFOX_vERSION
#$FirefoxDate = (Invoke-WebRequest 'https://product-details.mozilla.org/1.0/firefox_history_stability_releases.json' -UseBasicParsing | ConvertFrom-Json) | select -ExpandProperty $FirefoxVersion
$FirefoxDownloadX64 = "https://download-origin.cdn.mozilla.net/pub/firefox/releases/" + $FirefoxVersion + "/win64/ca/Firefox%20Setup%20" + $FirefoxVersion + ".exe"
#https://download-origin.cdn.mozilla.net/pub/firefox/releases/" + $FirefoxVersion + "/win64/en-US/Firefox%20Setup%20" + $FirefoxVersion + ".exe
$swObject.Online_Version = $FirefoxVersion
$swobject.Online_Date = $FirefoxDate
}
catch
{
Write-Verbose -Message "Error accessing the below URL: `n $URI"
$message = $("Line {0} : {1}" -f $_.InvocationInfo.ScriptLineNumber, $_.exception.message)
$swObject | Add-Member -MemberType NoteProperty -Name 'ERROR' -Value $message
}
finally
{
# Get the Download URLs
if ($swObject.Online_Version -ne 'UNKNOWN')
{
$swobject.Download_URL_X64 = $FirefoxDownloadX64
}
}
}
End
{
# Output to Host
if ($Quiet)
{
Write-Verbose -Message '$Quiet was specified. Returning just the version'
Return $swObject.Online_Version
}
else
{
Return $swobject
}
}
} # END Function Get-OnlineVerFirefox
#Cuerpo
$V_web = Get-OnlineVerFirefox
$V_actual=Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | where-object {$_.DisplayName -like "*Mozilla*Firefox*"} |Select-Object DisplayVersion
if ($V_web.Online_Version -match $V_actual.DisplayVersion){
"Misma Vesion" + " " + "Version Online " + $V_web.Online_Version + " Version Local " + $V_actual.DisplayVersion}
else
{
"Diferente Version " + " " + "Version Online " + $V_web.Online_Version + " Version Local " + $V_actual.DisplayVersion
wget $V_web.Download_URL_x64 -OutFile "C:\Windows\Temp\firefox.exe"
Start-Process "C:\Windows\Temp\firefox.exe" -ArgumentList "/S"
}