共用方式為


UninstallApplication 函式 (appmgmt.h)

UninstallApplication 函式會卸載使用 Windows Installer .msi 檔案來處理安裝和安裝的組策略應用程式。 UninstallApplication 函式應該只在使用者組策略應用程式先前嘗試卸載的用戶內容中呼叫,方法是呼叫 MsiConfigureProduct 函式。 InstallApplication 函式可以安裝組策略應用程式。

注意 無法呼叫 UninstallApplication 作為卸載組策略型應用程式的通訊協定的一部分,可能會導致 原則的結果集 (RSoP) 指出不正確的資訊。
 

語法

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

參數

[in] ProductCode

要卸載之產品的 Windows Installer 產品代碼。 應用程式的 產品代碼 應該以 Windows Installer GUID 的形式提供,以具有大括號的字串形式提供。

[in] dwStatus

卸載嘗試的狀態。 dwStatus 參數是 MsiConfigureProduct 所傳回卸載嘗試的 Windows 成功代碼。 系統可以使用此功能來確保 原則的結果集 (RSoP) 指出卸載失敗或成功。

傳回值

如果函式成功,傳回值會 ERROR_SUCCESS。 否則,函式會傳回其中一個系統錯誤碼。 如需錯誤碼的完整清單,請參閱 系統錯誤碼 或頭檔 WinError.h。

備註

呼叫 Windows Installer 函式 MsiConfigureProduct 卸載應用程式,以移除使用 .msi 檔案的組策略應用程式。 然後呼叫 UninstallApplication,通知系統應用程式不再由 群組原則 在用戶端上管理。 即使卸載失敗,也應該呼叫 UninstallApplication,因為這可讓系統保持原則的結果集 (RSoP) 正確。

呼叫安裝應用程式特定的卸載函式或命令,以移除使用軟體安裝設定 (.zap 檔案) 安裝的應用程式。 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.

規格需求

需求
最低支援的用戶端 Windows Vista
最低支援的伺服器 Windows Server 2008
目標平台 Windows
標頭 appmgmt.h
程式庫 Advapi32.lib
Dll Advapi32.dll

另請參閱

群組原則 函式

群組原則概觀

InstallApplication

MsiConfigureProduct