Uninstalling a Program – Powershell – SCCM

Here’s a quick script to uninstall a program using Powershell. I’ve found this useful when attempting an uninstall with SCCM.

$lync=get-wmiobject -class win32_product | Where-Object {$_.name -like 'microsoft lync*'}

If you’d like to change the program, just change the search string name {$_.name -like ‘*whatever*’} …Also, it’s worth noting that this installs everything with a name like that program, so in this case, if Lync 2010 and 2013 were installed, it would get rid of both. To get rid of one or the other, first find exact the name of the program you can just use the first command above to do this and then view the results of the variable.


Then, reset the variable with the exact match.

$lync=get-wmiobject -class win32_product | Where-Object {$_.name -eq 'microsoft lync 2010'}

For information on using Powershell Scripts with SCCM 2012, check out my post here:


2 thoughts on “Uninstalling a Program – Powershell – SCCM

  1. Hello

    I tried to uninstall lync but it throws returnvalue 1603 instead of 0, when I went to
    Start –> Control Panel –> Program and Features
    the Microsoft Lync Server 2013, Core Components still exists.
    I have used the PowerShell console with Administrator priviliges

    1. Abdul,

      I believe this is likely due to the name change Microsoft pushed through renaming Lync to Skype for Business. Try running a get-wmiobject and finding skype as an installed program… keep me posted.


Leave a Reply

%d bloggers like this: