Upload files to "Reinstall Scripts"
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<#
|
||||
Author: Gabe Kerntke
|
||||
Date: 02/23/2024
|
||||
|
||||
.Synopsis
|
||||
Script checks if Firefox is installed and then reinstalls it while also deleting each users appdata folder
|
||||
|
||||
.Modified
|
||||
- GabeK (2/23/24): Script created
|
||||
- GabeK (4/1/25): Update with new MoveIT function
|
||||
- GabeK (5/21/25): Updated to use functions script
|
||||
#>
|
||||
|
||||
# Variables #
|
||||
|
||||
$App_Name = "Firefox"
|
||||
$File_Name_Prefix = "Firefox-x64"
|
||||
$File_Name_Extension = "exe"
|
||||
$Install_Parameters = "/S"
|
||||
$EPCache_Folder = "3rd Party Patches\$App_Name"
|
||||
$Version_URL = (Invoke-WebRequest -UseBasicParsing "https://product-details.mozilla.org/1.0/firefox_versions.json").Content | ConvertFrom-Json
|
||||
$Online_Version = $Version_URL.LATEST_FIREFOX_VERSION
|
||||
$FirefoxURL = (Invoke-WebRequest -UseBasicParsing "https://download-installer.cdn.mozilla.net/pub/firefox/releases/$Online_Version/win64/en-US/").Links.href -like "*exe*"
|
||||
$DownloadURL = "https://download-installer.cdn.mozilla.net$FirefoxURL"
|
||||
$File_Name = "$File_Name_Prefix-$Online_Version.$File_Name_Extension"
|
||||
$User_Folder = "C:\Users\$($User)\AppData\Local\Mozilla"
|
||||
$User_Folder2 = "C:\Users\$($User)\AppData\Roaming\Mozilla"
|
||||
$Program_Folder = "C:\Program Files\Mozilla Firefox"
|
||||
$Program_Folder2 = "C:\Program Files (x86)\Mozilla Firefox"
|
||||
|
||||
# Functions #
|
||||
|
||||
Function Uninstall-App {
|
||||
$UninstallString = (Get-Software | Where-Object {$_ -like "*$App_Name*" }).UninstallString
|
||||
foreach ($String in $UninstallString) { $String + " $Install_Parameters" | cmd }
|
||||
Start-Sleep 5
|
||||
If (Get-Software | Where-Object { $_.DisplayName -like "*$App_Name*" }) {
|
||||
Write-Host "Failed to uninstall $App_Name, suggest rerunning script"
|
||||
Exit
|
||||
}
|
||||
Else {
|
||||
Write-Host "$App_Name uninstalled successfully"
|
||||
}
|
||||
}
|
||||
|
||||
#Region Script Start
|
||||
If ((Test-Path "C:\Temp\Script Cache") -eq $False) { New-Item -ItemType directory -Path "C:\Temp\Script Cache" }
|
||||
Invoke-WebRequest -UseBasicParsing "https://scripts.gabesville.com/Gabesville/Powershell-Scripts/raw/branch/main/Functions%20Scripts/Functions.ps1" -outfile "C:\Temp\Script Cache\Functions.ps1"
|
||||
. "C:\Temp\Script Cache\Functions.ps1"
|
||||
|
||||
#Check to see if program is installed
|
||||
$Applist = Get-Software | Sort-Object -Descending
|
||||
|
||||
If ($Applist.DisplayName -like "*$App_Name*") {
|
||||
Close-App
|
||||
Uninstall-App
|
||||
Remove-User_Folder
|
||||
Remove-Program_Folder
|
||||
Test-Probe_Online
|
||||
Install-App
|
||||
}
|
||||
|
||||
Else { Write-Host "$App_Name is not installed, exiting script." }
|
||||
#Region Script End
|
||||
Reference in New Issue
Block a user