UninstallApplication function (appmgmt.h)

The UninstallApplication function uninstalls a group policy application that handles setup and installation using Windows Installer .msi files. The UninstallApplication function should only be called in the context of the user for whom the user group policy application has previously attempted an uninstall by calling the MsiConfigureProduct function. The InstallApplication function can install group policy applications.

Note  Failure to call UninstallApplication as part of the protocol for uninstalling a group policy-based application can cause the Resultant Set of Policy (RSoP) to indicate inaccurate information.
 

Syntax

DWORD UninstallApplication(
  [in] LPWSTR ProductCode,
  [in] DWORD  dwStatus
);

Parameters

[in] ProductCode

The Windows Installer product code of the product being uninstalled. The product code of the application should be provided in the form of a Windows Installer GUID as a string with braces.

[in] dwStatus

The status of the uninstall attempt. The dwStatus parameter is the Windows success code of the uninstall attempt returned by MsiConfigureProduct. The system can use this to ensure that the Resultant Set of Policy (RSoP) indicates whether the uninstall failed or succeeded.

Return value

If the function succeeds, the return value is ERROR_SUCCESS. Otherwise, the function returns one of the system error codes. For a complete list of error codes, see System Error Codes or the header file WinError.h.

Remarks

Remove a group policy application that uses .msi files by calling the Windows Installer function MsiConfigureProduct to uninstall the application. Then call UninstallApplication to inform the system that the application is no longer managed on the client by Group Policy. UninstallApplication should be called even if the uninstall fails because this enables the system to keep the Resultant Set of Policy (RSoP) accurate.

Remove applications installed using software installation settings (.zap files) by calling the uninstall function or command specific for the installation application. For information about using installation applications other than the Windows Installer see article 231747, "How to Publish non-MSI Programs with .zap Files," in the Microsoft Knowledge Base.

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header appmgmt.h
Library Advapi32.lib
DLL Advapi32.dll

See also

Group Policy Functions

Group Policy Overview

InstallApplication

MsiConfigureProduct