• 0

[REQ]Command to silently uninstall Lync Client


Question

I am looking for a command that when executed will silently (no prompts) uninstall the Lync client on an end user's PC. 

 

Also as an added issue we have 3 versions floating out there.

  • Lync 2010 (x86)
  • Lync 2013 (x86) 
  • Lync 2013 (x64)

At first my plan was to use WMIC, however, some machines state that it is not installed when infact it is. so i need an alternative.

 

/node: PCNAME product where name="Microsoft Lync MUI (English) 2013" call uninstall /nointeractive
/node: PCNAME product where name="Microsoft Lync 2010" call uninstall /nointeractive
Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

Where I work at we are removing Lync 2007 and 2010 to install 2013.  This may help you.

wscript.echo Now() & " - Checking for old versions of Microsoft Communicator or Microsoft Lync to remove"

Dim messagingSoftware,messagingSoftwareItem

messagingSoftware = array("Microsoft Communicator 2007","Microsoft Communicator 2007 R2","Microsoft Lync 2010")
	For Each messagingSoftwareItem In messagingSoftware
		Select Case checkForInstalledApplication(messagingSoftwareItem)
			Case True
				WScript.echo Now() & " - " & messagingSoftwareItem & " is installed.  Beginning uninstall."
				uninstallSoftware(messagingSoftwareItem)
				WScript.echo Now() & " - " & messagingSoftwareItem & " has been uninstalled.  Continuing installation."
			Case False
				WScript.echo Now() & " - Previous install of " & messagingSoftwareItem & " not found... Continuing install..."
			Case Else 
				WScript.echo Now() & " - There was an error trying to determine the status of your " & messagingSoftwareItem & " installation.  Ending script"
				WScript.quit 4999
		End Select
	Next
	
Function checkForInstalledApplication(applicationName)
     Dim objItem, strComputer : strComputer = "." 
     Dim objWMIService : Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
     Dim colItems : Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE Name = '" & applicationName & "'",,48) 
     If IsNull(colItems) Then
          checkForInstalledApplication = False
     Else
          For Each objItem in colItems
               If objItem.name = applicationName Then 
                    checkForInstalledApplication = True
               End If
          Next
     End If
End Function

Function uninstallSoftware(applicationName)
	Dim objSoftware, strComputer : strComputer = "."
	Dim objWMIService : Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
	Dim colSoftware : Set colSoftware = objWMIService.ExecQuery("Select * from Win32_Product Where Name = '" & applicationName & "'",,48)
	For Each objSoftware in colSoftware
		objSoftware.Uninstall()
	Next
End Function
Link to comment
Share on other sites

  • 0

 

Where I work at we are removing Lync 2007 and 2010 to install 2013.  This may help you.

wscript.echo Now() & " - Checking for old versions of Microsoft Communicator or Microsoft Lync to remove"

Dim messagingSoftware,messagingSoftwareItem

messagingSoftware = array("Microsoft Communicator 2007","Microsoft Communicator 2007 R2","Microsoft Lync 2010")
	For Each messagingSoftwareItem In messagingSoftware
		Select Case checkForInstalledApplication(messagingSoftwareItem)
			Case True
				WScript.echo Now() & " - " & messagingSoftwareItem & " is installed.  Beginning uninstall."
				uninstallSoftware(messagingSoftwareItem)
				WScript.echo Now() & " - " & messagingSoftwareItem & " has been uninstalled.  Continuing installation."
			Case False
				WScript.echo Now() & " - Previous install of " & messagingSoftwareItem & " not found... Continuing install..."
			Case Else 
				WScript.echo Now() & " - There was an error trying to determine the status of your " & messagingSoftwareItem & " installation.  Ending script"
				WScript.quit 4999
		End Select
	Next
	
Function checkForInstalledApplication(applicationName)
     Dim objItem, strComputer : strComputer = "." 
     Dim objWMIService : Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
     Dim colItems : Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE Name = '" & applicationName & "'",,48) 
     If IsNull(colItems) Then
          checkForInstalledApplication = False
     Else
          For Each objItem in colItems
               If objItem.name = applicationName Then 
                    checkForInstalledApplication = True
               End If
          Next
     End If
End Function

Function uninstallSoftware(applicationName)
	Dim objSoftware, strComputer : strComputer = "."
	Dim objWMIService : Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
	Dim colSoftware : Set colSoftware = objWMIService.ExecQuery("Select * from Win32_Product Where Name = '" & applicationName & "'",,48)
	For Each objSoftware in colSoftware
		objSoftware.Uninstall()
	Next
End Function

 

should that just be copied into a .cmd file or a .ps1 file?

Link to comment
Share on other sites

  • 0

OK Figured out how to get it to run (VBS) however, it was unable to find any versions of Microsoft Lync installed on the test computer. I added Lync 2013 using the name provided by WMIC as well as just Microsoft Lync 2013 and it still says it cannot find any copies of lync installed.

Link to comment
Share on other sites

  • 0

The VBS will help with removing Lync 2007 and 2010.  With Lync 2013 you will have to make MSP with the installer to remove it.  Lync 2013 is part of the installer for Office 2013 unlike 2007 and 2010 which were standalone products.

Link to comment
Share on other sites

  • 0

I found the uninstall GUID to uninstall Lync 2013, but it breaks the Office 2013 installer if you're using Office 2013 Pro Plus.  If you're using Pro Plus, you are better off removing Office and creating a MSP to not to include Lync and then removing and reinstalling Office.

Link to comment
Share on other sites

  • 0

I found the uninstall GUID to uninstall Lync 2013, but it breaks the Office 2013 installer if you're using Office 2013 Pro Plus.  If you're using Pro Plus, you are better off removing Office and creating a MSP to not to include Lync and then removing and reinstalling Office.

 

ok thanks. sadly that is the case with most of the installed copies of it that they are part of office rather than being addons. there are only 97 users with it installed right now so i will probably just do manual removals for those users and then install Jabber at the same time.

Link to comment
Share on other sites

This topic is now closed to further replies.