From 73318e967937367ecad9c4aa5373cc21786c2de0 Mon Sep 17 00:00:00 2001 From: nhtkid <93020586+nhtkid@users.noreply.github.com> Date: Mon, 26 Aug 2024 11:35:00 +1000 Subject: [PATCH] Delete RemoveOEMApps_Claude.ps1 --- RemoveOEMApps_Claude.ps1 | 83 ---------------------------------------- 1 file changed, 83 deletions(-) delete mode 100644 RemoveOEMApps_Claude.ps1 diff --git a/RemoveOEMApps_Claude.ps1 b/RemoveOEMApps_Claude.ps1 deleted file mode 100644 index 5f2829c..0000000 --- a/RemoveOEMApps_Claude.ps1 +++ /dev/null @@ -1,83 +0,0 @@ -# Script to remove specific Dell applications (Command, SupportAssist, Optimizer) -# Log file path -$logFile = "C:\Windows\Logs\DellAppRemoval.log" - -# Function to log messages -function Write-Log { - param($message) - $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss" - "$timestamp - $message" | Out-File -FilePath $logFile -Append -} - -# Function to check if app name matches the criteria -function Match-AppName { - param($name, $keywords) - return ($keywords[0] -in $name) -and ($keywords[1] -in $name) -} - -# Function to uninstall Win32 application -function Uninstall-Win32App { - param($keywords) - $apps = Get-Package | Where-Object { Match-AppName $_.Name $keywords } - foreach ($app in $apps) { - Write-Log "Attempting to uninstall Win32 app: $($app.Name)" - try { - $app | Uninstall-Package -Force -ErrorAction Stop - Write-Log "Successfully uninstalled Win32 app: $($app.Name)" - } - catch { - Write-Log "Failed to uninstall Win32 app: $($app.Name). Error: $($_.Exception.Message)" - } - } -} - -# Function to uninstall AppX package -function Uninstall-AppxPackage { - param($keywords) - $packages = Get-AppxPackage | Where-Object { Match-AppName $_.Name $keywords } - foreach ($package in $packages) { - Write-Log "Attempting to uninstall AppX package: $($package.Name)" - try { - $package | Remove-AppxPackage -ErrorAction Stop - Write-Log "Successfully uninstalled AppX package: $($package.Name)" - } - catch { - Write-Log "Failed to uninstall AppX package: $($package.Name). Error: $($_.Exception.Message)" - } - } -} - -# Main script execution -Write-Log "Starting Dell application removal script" - -# List of target apps with their keywords -$targetApps = @( - @("Dell", "Command"), - @("Dell", "SupportAssist"), - @("Dell", "Optimizer") -) - -# Loop through each target app -foreach ($app in $targetApps) { - Write-Log "Checking for applications containing keywords: $($app[0]) and $($app[1])" - - # Check and uninstall Win32 apps - $win32Apps = Get-Package | Where-Object { Match-AppName $_.Name $app } - if ($win32Apps) { - Write-Log "Found matching Win32 app(s). Attempting to uninstall." - Uninstall-Win32App $app - } else { - Write-Log "No matching Win32 app found." - } - - # Check and uninstall UWP apps - $uwpApps = Get-AppxPackage | Where-Object { Match-AppName $_.Name $app } - if ($uwpApps) { - Write-Log "Found matching UWP app(s). Attempting to uninstall." - Uninstall-AppxPackage $app - } else { - Write-Log "No matching UWP app found." - } -} - -Write-Log "Dell application removal script completed"