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