First, you should list the installed apps to identify the app names and their package names. Use the following command to list all installed apps:
Get-AppxPackage -AllUsers | Select-Object Name, PackageFullName
After identifying the app and its package full name, you can use the Remove-AppxPackage
command to uninstall it.Replace "PackageFullName"
with the actual package name of the app you want to uninstall.
Get-AppxPackage -AllUsers | Where-Object { $_.Name -eq 'YourAppName' } | Remove-AppxPackage
Replace 'YourAppName'
with the name of the app you want to uninstall. Repeat this step for each app you want to remove.
To uninstall these apps for all user profiles on the computer, you can use a ForEach
loop to iterate through all user profiles and uninstall the app for each profile.
$AppPackageName = "YourAppPackageFullName"
$AllUserProfiles = Get-WmiObject -Class Win32_UserProfile | Where-Object { $_.Special -eq $false }
foreach ($UserProfile in $AllUserProfiles) {
$UserProfilePath = $UserProfile.LocalPath
$UserProfileSID = $UserProfile.SID
# Uninstall the app for the current user profile
Invoke-Command -ScriptBlock {
Get-AppxPackage -AllUsers -User $Using:UserProfileSID | Where-Object { $_.PackageFullName -eq $Using:AppPackageName } | Remove-AppxPackage
}
Write-Host "Uninstalled app for user profile: $UserProfilePath"
}
Replace "YourAppPackageFullName"
with the package name of the app you want to uninstall.
Save the script to a .ps1 file and run it with administrative privileges.