Uninstall programs remotely

Welcome Forums General PowerShell Q&A Uninstall programs remotely

This topic contains 3 replies, has 2 voices, and was last updated by

6 months, 2 weeks ago.

  • Author
  • #105785

    Points: 0
    Rank: Member


    I took a script from SpiceWorks , but the program can uninstall one app .

    I want uninstall SAP Crystal reports but when i list with Win32 Products , i have many app like crystalreports.cpp .

    My question is : how to adapt the script to uninstall all app like crystalreports .

    Ps Script doesnt work with this :

    $machineName = Read-host "Enter a Machine Name:"
    #$userName = Read-Host "Enter your admin account:"

    $app = Get-WmiObject -Class Win32_Product -computerName $machineName -impersonation Impersonate | Where-Object {($_.Vendor -Like "SAP*") -and ($_.Name -Like "crystalreports*")}

    Loop is missing but i dont know how to do .

    Thanks and excuse me for my bad english ( i'm french)

  • #105794

    Points: 22
    Rank: Member

    Your script looks ok except for the last line. Try the following

    $app | foreach-object {$_.uninstall()}

    Note, I am not in front of a computer to test.

    • #105797

      Points: 0
      Rank: Member


      I will say you if it's okay .

  • #105800

    Points: 0
    Rank: Member

    Thanks a lot , it's working .

The topic ‘Uninstall programs remotely’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort