JayRHa / EndpointAnalyticsRemediationScripts

MIT License
318 stars 74 forks source link

Uninstall-PrivateTeams Wrong Context #47

Closed grossgrundbesitzer closed 1 year ago

grossgrundbesitzer commented 1 year ago

In the comments for "Uninstall-Private teams" the context "Admin" is documented, which is wrong.

The problem is, that the following line is executed in a user context: Get-AppxPackage -Name MicrosoftTeams | Remove-AppxPackage -ErrorAction stop

Microsoft documentation for Get-AppxPackage:

Gets a list of the app packages that are installed in a user profile.

The script would work if executed in the user context. But you could also rewrite it, and add the flag "-allusers", to Get-AppxPackage so that you can run the script as admin. More Information: https://learn.microsoft.com/en-us/powershell/module/appx/get-appxpackage?view=windowsserver2022-ps

andrew-s-taylor commented 1 year ago

Good spot, added -allusers