WMI을 사용하면됩니다. 필요에 따라 제거 프로그램을 사용자 정의 할 수 있습니다. 이를 달성하려면 Win32_Product class 및 uninstall method을 사용해야합니다.
using System;
using System.Management;
using System.Windows.Forms;
namespace WMISample
{
public class CallWMIMethod
{
public static void Main()
{
try
{
ManagementObject classInstance =
new ManagementObject("root\\CIMV2",
"Win32_Product.IdentifyingNumber='{EDDE41A3-A870-4D97-A1ED-67FF62AA0552}',Name='MyServiceSetup',Version='1.0.0'",
null);
// No method in-parameters to define
// Execute the method and obtain the return values.
ManagementBaseObject outParams =
classInstance.InvokeMethod("Uninstall", null, null);
// List outParams
Console.WriteLine("Out parameters:");
Console.WriteLine("ReturnValue: " + outParams["ReturnValue"]);
}
catch(ManagementException err)
{
MessageBox.Show("An error occurred while trying to execute the WMI method: " + err.Message);
}
}
}
}
당신은 Error Codes (Windows 바탕 화면 앱)에서 반환 값을 확인할 수 있습니다 : 다음은 로컬 컴퓨터에서 프로그램을 제거의 예입니다.
프로그램 추가/제거에서 "제거"를 클릭하면 사용자 정의 된 설치 해제 대화 상자를 시작 하시겠습니까? – Sandeep
@Sandeep : 수정하십시오. – ABCD