How to uninstall a program through group policy script

IT Department 1 Reputation point
2022-03-10T02:03:10.517+00:00

Need to uninstall a program called anydesk from every computer on the network. Was thinking to run a group policy uninstall script at startup but I do not know how to. Any help or direction to a knowledge source would be appreciated.

Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Limitless Technology 39,916 Reputation points
    2022-03-16T09:01:02.017+00:00

    Hello @IT Department

    There is no need to use script to Uninstall package or software.

    You can Uninstall using GPO editor -> Edit- > Software Settings -> All Tasks, and then click Remove -> Click Immediately uninstall the software from users and computers, and then click OK.

    https://learn.microsoft.com/en-us/troubleshoot/windows-server/group-policy/use-group-policy-to-install-software#remove-a-package

    Alternatively you can use below PowerShell script and run it from Server to Uninstall it Remotely.

    $computerNames = @("ComputerName1", "rName2", "rName3")  
    $appName = "AnyDesk"  
    $yourAccount = Get-Credential  
    ForEach ($computerName in $computerNames) {  
        Invoke-Command -ComputerName $computerName -Credential $yourAccount -ScriptBlock {  
            Get-WmiObject Win32_product | Where {$_.name -eq $appName} | ForEach {  
                $_.Uninstall()  
            }  
        }  
    }  
    

    Hope this answers your question :)

    ------
    --If the reply is helpful, please Upvote and Accept as answer--

    1 person found this answer helpful.
    0 comments No comments

  2. Thameur-BOURBITA 36,261 Reputation points Moderator
    2022-03-10T22:17:32.53+00:00

    Hi,

    If it's possible to use a script to uninstall this application , you can deploy this script via group policy and launch it at startup.

    You have to validate the script for software installation. Once the script is validated you can copy it in sysvol folder and deploy it through GPO:

    cc779329(v=ws.10)

    Please don't forget to mark helpful reply as answer

    0 comments No comments

  3. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    1 deleted comment

    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.