Monday 25 May 2015

Hyper-V Server: Un-instaling software using command prompt


This tutorial covers Hyper-V Server, not to be confused with Windows Server core installation with the Hyper-V role installed. That being said, this short tutorial should work for both scenarios.

First, I'd like to check what software is actually installed on the server


 wmic product get name,version,vendor
 C:\>wmic product get name,version,vendor
Name                                                         Vendor
    Version
Microsoft System Center 2012 R2 DPM Protection Agent         Microsoft Corporati
on  4.2.1292.0
Microsoft Visual C++ 2010  x64 Redistributable - 10.0.30319  Microsoft Corporati
on  10.0.30319


C:\>


In this case I have an outdated version of the System Center Data Protection Manager 2012 R2 Protection Agent on my server.

Trying to install the latest version of the protection agent end in failure as long as the old version is installed, but that is a story for another blog entry.

Uninstalling the application in the command prompt

I took note of the name of the application I need to uninstall during.

Microsoft System Center 2012 R2 DPM Protection Agent
wmic product where name="Microsoft System Center 2012 R2 DPM Protection Agent" call uninstall

 The result

 C:\>wmic product where name="Microsoft System Center 2012 R2 DPM Protection Agen
t" call uninstall
Executing (\\HYPER-V\ROOT\CIMV2:Win32_Product.IdentifyingNumber="{6FA0CE18-E1A
B-4CA2-B552-03D16516E174}",Name="Microsoft System Center 2012 R2 DPM Protection
Agent",Version="4.2.1292.0")->Uninstall()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
        ReturnValue = 0;
};


C:\>

 Supplemental: Wildcards

A batch script that uninstalls everything DPM would look like this
C:\Windows\System32\wbem\wmic product where "Name like '%%DPM%%'" call uninstall

No comments:

Post a Comment