Disable Teams "Personal"

Looking for a way to hide/disable the personal Teams app.
Found this article to do it with intune - could we implement in Immy?

I did this a while back. Create a new Software called “Microsoft Teams - Windows 11” (or whatever you want - doesn’t actually matter)

Use Custom Detection and use this script

$Package = Get-AppxPackage -Name MicrosoftTeams -AllUsers
if ($Package -and $Package.Status -eq "Ok") {
    $Package.Version
}

And this Uninstall script

$Package = Get-AppxPackage -Name "MicrosoftTeams" -AllUsers
$Package | Remove-AppxPackage -Confirm:$False -AllUsers

You might want to add the Remove-AppxProvisionedPackage line (from the example in the link you shared) to the uninstall script too…

But since then i created a template task for removing store apps and am using that. Too much code to post here though.

The problem with both these approaches is that when you combine it with a Windows 10 → 11 upgrade, the maintenance looks like this:

  • Is the Windows 11 Teams installed? No? Then we don’t need to do anything with it
  • Upgrade to Windows 11
  • Don’t uninstall the Windows 11 Teams app because we didn’t detect it was installed when we did our detection, even though it is installed now

I suppose this would work provided you run it regularly. However, the issue with the chat app is that it is configured to auto install during every feature update (possibly every cumulative update, not sure). The registry key to configure it is ConfigureChatAutoInstall and it can only be disabled during OOBE or earlier.

Michael Niehaus has a powershell module called LocalMDM (as well as a nice little blog explaining it). My method was to take that and rework it so that it work in an ImmyBot context, then turn it into a task. I’ve got it working so now I can enforce CSPs using OMA-URI like I can in Intune, except I can do it on workgroup or active directory joined computers as well.