For Windows 10 we could use the store apps, and Microsoft Intune to uninstall the built-in Windows Store apps. For Windows 11, this seems not possible because of the changes in the Store.To retrieve the name from the Teams client, run below in PowerShell: Get-AppxPackage -Name teams * With the remediation script, we remove the Teams app. This can be done by running: Get-AppxPackage -Name MicrosoftTeams | Remove-AppxPackage -ErrorAction stop With this information, we can create two simple scripts to get the job done. This is our detection script: #Script detects the new Microsoft Teams consumer app on Windows 11.
if ($null -eq (Get-AppxPackage -Name MicrosoftTeams)) {
Write-Host "Microsoft Teams client not found"
exit 0
} Else {
Write-Host "Microsoft Teams client found"
Exit 1
} And this is our remediation script:#Script removes the new Microsoft Teams consumer app on Windows 11.
#App is removed because this app can only be used with personal Microsoft accounts
try{
Get-AppxPackage -Name MicrosoftTeams | Remove-AppxPackage -ErrorAction stop
Write-Host "Microsoft Teams app successfully removed"
}
catch{
Write-Error "Errorremoving Microsoft Teams app"
} Let’s implement the proactive remediation.
Sign in to the Microsoft Endpoint Manager admin center
Browse to Reports – Endpoint Analytics – Proactive remediations
Click +Create script package
Enter a Name and Description (optional)
Click Next
Upload the Detection and Remediation script
Set Run this script using logged-on credentials to Yes
Set Run script in 64-bit PowerShell to Yes
Click Next We can assign the remediation for example to All devices and use a filter to only run the scripts on Windows 11 devices.When we click on Daily (under schedule) we can edit the schedule based on which the script is run.The remediation script is scheduled and will remove the Teams app on a daily base.