mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-02 02:53:31 -05:00
Test (#318)
* clean up * Update runspace.ps1 for new tweaks (#291) * clean up (#290) * Update Tweaks Co-authored-by: Chris Titus <dfm.titus@gmail.com> * Github actions to update script based on branch (#294) * clean up (#290) * Update Tweaks * test pipeline * test pipeline * chore: autopublish 2022-10-19T09:34:35Z * test pipeline * test pipeline * chore: autopublish 2022-10-19T11:39:50Z * test pipeline * test pipeline * test pipeline * test pipeline * test pipeline * test pipeline * test * please work * Update Branch in script * test new variable * Update Branch in script * test all branches * updated $BranchToUse to use the correct casing Co-authored-by: Chris Titus <dfm.titus@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: DeveloperDurp <DeveloperDurp@users.noreply.github.com> * bring test up to date (#295) * clean up (#290) * Update README.md * Update README.md * Update README.md * Update release.yaml * Replace Broken Issue Links in KnownIssues.md (#297) - The issues listed in KnownIssues.md were broken due to the issues tab in the previous repo being removed. - Replaced with issues in this repo that apply to the issues, if there were any - I think this issue could be applied to the main branch without worry, but I'll leave that up to you. * Update Branch in script * Implement check for local ooshutup10.cfg file (#298) - Checks for an ooshutup10.cfg file in the current directory and uses it if found - This allows users to use custom config files if they wish * bring winget install script (#302) * clean up (#290) * Update README.md * Update README.md * Update README.md * Update winget.ps1 * Update Branch in script * Brave Fix * Fix Flickering New Windows versions HATE timeout tweaks * Fixing Error Messages * syntax fix * Switch to PSGallery winget-installer * Adding Branch Variables from #309 * typo * teams uninstall fix * Fix Uninstall MS Apps Issues * Update Branch in script Co-authored-by: DeveloperDurp <developerdurp@durp.info> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: DeveloperDurp <DeveloperDurp@users.noreply.github.com> Co-authored-by: Carter <60557606+Carterpersall@users.noreply.github.com> Co-authored-by: ChrisTitusTech <ChrisTitusTech@users.noreply.github.com>
This commit is contained in:
75
winutil.ps1
75
winutil.ps1
@ -1305,48 +1305,51 @@ $WPFtweaksbutton.Add_Click({
|
||||
"HPSystemInformation"
|
||||
)
|
||||
|
||||
## Teams Removal
|
||||
# Remove Teams Machine-Wide Installer
|
||||
Write-Host "Removing Teams Machine-wide Installer" -ForegroundColor Yellow
|
||||
$MachineWide = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -eq "Teams Machine-Wide Installer" }
|
||||
$MachineWide.Uninstall()
|
||||
# Remove Teams for Current Users
|
||||
$localAppData = "$($env:LOCALAPPDATA)\Microsoft\Teams"
|
||||
$programData = "$($env:ProgramData)\$($env:USERNAME)\Microsoft\Teams"
|
||||
If (Test-Path "$($localAppData)\Current\Teams.exe") {
|
||||
unInstallTeams($localAppData)
|
||||
## Teams Removal - Source: https://github.com/asheroto/UninstallTeams
|
||||
function getUninstallString($match) {
|
||||
return (Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object { $_.DisplayName -like "*$match*" }).UninstallString
|
||||
}
|
||||
elseif (Test-Path "$($programData)\Current\Teams.exe") {
|
||||
unInstallTeams($programData)
|
||||
|
||||
$TeamsPath = [System.IO.Path]::Combine($env:LOCALAPPDATA, 'Microsoft', 'Teams')
|
||||
$TeamsUpdateExePath = [System.IO.Path]::Combine($TeamsPath, 'Update.exe')
|
||||
|
||||
Write-Output "Stopping Teams process..."
|
||||
Stop-Process -Name "*teams*" -Force -ErrorAction SilentlyContinue
|
||||
|
||||
Write-Output "Uninstalling Teams from AppData\Microsoft\Teams"
|
||||
if ([System.IO.File]::Exists($TeamsUpdateExePath)) {
|
||||
# Uninstall app
|
||||
$proc = Start-Process $TeamsUpdateExePath "-uninstall -s" -PassThru
|
||||
$proc.WaitForExit()
|
||||
}
|
||||
else {
|
||||
Write-Warning "Teams installation not found"
|
||||
|
||||
Write-Output "Removing Teams AppxPackage..."
|
||||
Get-AppxPackage "*Teams*" | Remove-AppxPackage -ErrorAction SilentlyContinue
|
||||
Get-AppxPackage "*Teams*" -AllUsers | Remove-AppxPackage -AllUsers -ErrorAction SilentlyContinue
|
||||
|
||||
Write-Output "Deleting Teams directory"
|
||||
if ([System.IO.Directory]::Exists($TeamsPath)) {
|
||||
Remove-Item $TeamsPath -Force -Recurse -ErrorAction SilentlyContinue
|
||||
}
|
||||
# Get all Users
|
||||
$Users = Get-ChildItem -Path "$($ENV:SystemDrive)\Users"
|
||||
# Process all the Users
|
||||
$Users | ForEach-Object {
|
||||
Write-Host "Process user: $($_.Name)" -ForegroundColor Yellow
|
||||
#Locate installation folder
|
||||
$localAppData = "$($ENV:SystemDrive)\Users\$($_.Name)\AppData\Local\Microsoft\Teams"
|
||||
$programData = "$($env:ProgramData)\$($_.Name)\Microsoft\Teams"
|
||||
If (Test-Path "$($localAppData)\Current\Teams.exe") {
|
||||
unInstallTeams($localAppData)
|
||||
}
|
||||
elseif (Test-Path "$($programData)\Current\Teams.exe") {
|
||||
unInstallTeams($programData)
|
||||
}
|
||||
else {
|
||||
Write-Warning "Teams installation not found for user $($_.Name)"
|
||||
}
|
||||
|
||||
Write-Output "Deleting Teams uninstall registry key"
|
||||
# Uninstall from Uninstall registry key UninstallString
|
||||
$us = getUninstallString("Teams");
|
||||
if ($us.Length -gt 0) {
|
||||
$us = ($us.Replace("/I", "/uninstall ") + " /quiet").Replace(" ", " ")
|
||||
$FilePath = ($us.Substring(0, $us.IndexOf(".exe") + 4).Trim())
|
||||
$ProcessArgs = ($us.Substring($us.IndexOf(".exe") + 5).Trim().replace(" ", " "))
|
||||
$proc = Start-Process -FilePath $FilePath -Args $ProcessArgs -PassThru
|
||||
$proc.WaitForExit()
|
||||
}
|
||||
cmd /c winget uninstall -h "Microsoft Teams"
|
||||
|
||||
|
||||
Write-Output "Restart computer to complete teams uninstall"
|
||||
|
||||
Write-Host "Removing Bloatware"
|
||||
|
||||
foreach ($Bloat in $Bloatware) {
|
||||
Get-AppxPackage "*$Bloat*" | Remove-AppxPackage
|
||||
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like "*$Bloat*" | Remove-AppxProvisionedPackage -Online
|
||||
Get-AppxPackage "*$Bloat*" | Remove-AppxPackage -ErrorAction SilentlyContinue
|
||||
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like "*$Bloat*" | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
|
||||
Write-Host "Trying to remove $Bloat."
|
||||
}
|
||||
|
||||
@ -1359,7 +1362,7 @@ $WPFtweaksbutton.Add_Click({
|
||||
Write-Host -Object "Attempting to uninstall: [$($_.Name)]..."
|
||||
|
||||
Try {
|
||||
$Null = $_ | Uninstall-Package -AllVersions -Force -ErrorAction Stop
|
||||
$Null = $_ | Uninstall-Package -AllVersions -Force -ErrorAction SilentlyContinue
|
||||
Write-Host -Object "Successfully uninstalled: [$($_.Name)]"
|
||||
}
|
||||
Catch {
|
||||
|
Reference in New Issue
Block a user