Update Reinstall Scripts/App - Zoom Workplace - Reinstall.ps1
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
<#
|
||||
Author: Gabe Kerntke
|
||||
Date: 03/14/25
|
||||
|
||||
.Synopsis
|
||||
Script checks if Zoom is installed and then reinstalls it while also deleting each users appdata folder
|
||||
|
||||
.Modified
|
||||
- GabeK (3/14/25): Script created
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[Parameter(Mandatory = $false)]
|
||||
$App_Name = "Zoom Workplace",
|
||||
[Parameter(Mandatory = $false)]
|
||||
$File_Name_Prefix = "zoom-x64",
|
||||
[Parameter(Mandatory = $false)]
|
||||
$File_Name_Extension = "msi",
|
||||
[Parameter(Mandatory = $false)]
|
||||
$Install_Parameters = "/quiet /qn /norestart",
|
||||
[Parameter(Mandatory = $false)]
|
||||
$EPCache_Folder = "3rd Party Patches\$App_Name",
|
||||
[Parameter(Mandatory = $false)]
|
||||
$OnlineVersion = (Invoke-RestMethod "https://zoom.us/rest/download?os=win").result.downloadVO.zoomX64.version,
|
||||
[Parameter(Mandatory = $false)]
|
||||
$DownloadURL = "https://zoom.us/client/latest/ZoomInstallerFull.msi?archType=x64",
|
||||
[Parameter(Mandatory = $false)]
|
||||
$File_Name = "$File_Name_Prefix-$Online_Version.$File_Name_Extension"
|
||||
)
|
||||
|
||||
# Functions #
|
||||
|
||||
Function Uninstall-App {
|
||||
$UninstallString = $Applist | Select-Object -ExpandProperty UninstallString
|
||||
$UninstallString + " /qn" | cmd
|
||||
Start-Sleep 5
|
||||
If (Get-Software | Where-Object { $_.DisplayName -like "*$AppName*" }) {
|
||||
Write-Host "Failed to uninstall $AppName, exiting script."
|
||||
Exit
|
||||
}
|
||||
}
|
||||
|
||||
#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
|
||||
Test-Probe_Online
|
||||
Install-App
|
||||
}
|
||||
Else { Write-Host "$App_Name MSI version is not installed." }
|
||||
|
||||
If ($Applist.DisplayName -notlike "*$App_Name*") {
|
||||
#Check to see if program is installed per user
|
||||
$Users = Get-ChildItem C:\Users
|
||||
foreach ($User in $Users) {
|
||||
$ZoomEXE = Test-Path "C:\Users\$($User.Name)\AppData\Roaming\Zoom\bin\Zoom.exe" -ErrorAction SilentlyContinue
|
||||
$Path = "C:\Users\$($User.Name)\AppData\Roaming\Zoom"
|
||||
If ($ZoomEXE -eq $True) {
|
||||
Remove-Item $Path -Force -Recurse
|
||||
Write-Output "$User $App_Name Appdata folder has been deleted."
|
||||
}
|
||||
Else { Write-Host "$App_Name not installed for $User." }
|
||||
}
|
||||
}
|
||||
#Region Script End
|
||||
Reference in New Issue
Block a user