msgraph-sdk-powershell icon indicating copy to clipboard operation
msgraph-sdk-powershell copied to clipboard

Remove-MgUserTeamworkInstalledApp No effective change

Open dmaloney02 opened this issue 10 months ago • 0 comments

Describe the bug

Remove-MgUserTeamworkInstalledApp submitted to remove applications from users in mass. The application is never un-pinned or uninstalled from the users team client.

Expected behavior

Application is unpinned (if relevant) Application is uninstalled from user's Teams client app and profile Get-MgUserTeamworkInstalledApp no longer returns the App ID

How to reproduce

Install and pin and application in the teams client. The use this script to uninstall

Connect-MgGraph -ClientId "" -TenantId "" -CertificateThumbprint ""

APPID of Application to detect and Remove

$appid = "574f2d32..." $appinstallid = "NTc0ZjJkM..." $userId = "04f6b7c8..." Connect-MgGraph -ClientId "7bce5636-79e6-4178-8a11-75ecc2f57aca" -TenantId "16532572-d567-4d67-8727-f12f7bb6aed3" -CertificateThumbprint "654DDCD8FE9014DDBBB75B355A7C9D4AB91D81E7"

APPID of Application to detect and Remove

$appid = "574f2d32-8c49-4b61-ae92-c858844571bb" $appinstallid = "NTc0ZjJkMzItOGM0OS00YjYxLWFlOTItYzg1ODg0NDU3MWJiIyMzLjIuOSMjUHVibGlzaGVk" $userId = "04f6b7c8-c46e-45e0-8b80-7848951c63b6" #Dwight #$userid = "7328d468-195f-475d-ab6a-3f0d956da095" #Eric

$userScopeTeamsAppInstallationId = (Get-MgBetaUserTeamworkInstalledApp -UserId $userId -ExpandProperty "teamsApp,teamsAppDefinition" -Filter "teamsApp/Id eq '$($appid)'").ID

$userScopeTeamsAppInstallationId

If($userScopeTeamsAppInstallationId){ Try{ Write-Host "Removing app for userid $userID" Remove-MgUserTeamworkInstalledApp -UserId $userId -UserScopeTeamsAppInstallationId $userScopeTeamsAppInstallationId Write-Host "SUCCESS: Removing app for userid $userID" } Catch{ Write-Host "ERROR: Removing app for userid $userID" $_ } } Else{ Write-Host "Application not found for $UserID" }

$userScopeTeamsAppInstallationId = (Get-MgBetaUserTeamworkInstalledApp -UserId $userId -ExpandProperty "teamsApp,teamsAppDefinition" -Filter "teamsApp/Id eq '$($appid)'").ID

$userScopeTeamsAppInstallationId

If($userScopeTeamsAppInstallationId){ Try{ Write-Host "Removing app for userid $userID" Remove-MgUserTeamworkInstalledApp -UserId $userId -UserScopeTeamsAppInstallationId $userScopeTeamsAppInstallationId Write-Host "SUCCESS: Removing app for userid $userID" } Catch{ Write-Host "ERROR: Removing app for userid $userID" $_ } } Else{ Write-Host "Application not found for $UserID" }

SDK Version

2.4

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ``` No error generated. Command reports success with no effective changes.
</details>


### Configuration

_No response_

### Other information

_No response_

dmaloney02 avatar Apr 22 '24 20:04 dmaloney02