DetermineApplicablePatches Method (product, patches, errorHandler, userSid, context)

Microsoft Deployment Tools

Deployment Tools Foundation DetermineApplicablePatches Method (product, patches, errorHandler, userSid, context)
Deployment Tools Foundation NamespacesMicrosoft.Deployment.WindowsInstallerInstallerDetermineApplicablePatches(String, array<String>[]()[], InapplicablePatchHandler, String, UserContexts)
Determines which patches apply to a specified product and in what sequence. If the product is installed, this method accounts for patches that have already been applied to the product and accounts for obsolete and superceded patches.
Declaration Syntax
C# Visual Basic Visual C++
public static IList<string> DetermineApplicablePatches(
	string product,
	string[] patches,
	InapplicablePatchHandler errorHandler,
	string userSid,
	UserContexts context
)
Public Shared Function DetermineApplicablePatches ( _
	product As String, _
	patches As String(), _
	errorHandler As InapplicablePatchHandler, _
	userSid As String, _
	context As UserContexts _
) As IList(Of String)
public:
static IList<String^>^ DetermineApplicablePatches(
	String^ product, 
	array<String^>^ patches, 
	InapplicablePatchHandler^ errorHandler, 
	String^ userSid, 
	UserContexts context
)
Parameters
product (String)
The product that is the target for the set of patches. This may be either a ProductCode (GUID) of a product that is currently installed, or the path to a an MSI file.
patches (array< String >[]()[])
An array of strings specifying the patches to be checked. Each item may be the path to an MSP file, the path an XML file, or just an XML blob.
errorHandler (InapplicablePatchHandler)
Callback to be invoked for each inapplicable patch, reporting the reason the patch is not applicable. This value may be left null if that information is not desired.
userSid (String)
Specifies a security identifier (SID) of a user. This parameter restricts the context of enumeration for this user account. This parameter cannot be the special SID strings s-1-1-0 (everyone) or s-1-5-18 (local system). If context is set to None or Machine, then userSid must be null. For the current user context, userSid can be null and context can be set to UserManaged or UserUnmanaged.
context (UserContexts)
Restricts the enumeration to per-user-unmanaged, per-user-managed, or per-machine context, or (if referring to an MSI) to no system context at all. This parameter can be Machine, UserManaged, UserUnmanaged, or None.
Return Value
An array of selected patch strings from patches, indicating the set of applicable patches. The items are re-ordered to be in the best sequence.
Remarks

If an item in patches is a file path but does not end in .MSP or .XML, it is assumed to be an MSP file.

Passing an InstallContext of None only analyzes the MSI file; it does not consider the current state of the system. You cannot use InstallContext.None with a ProductCode GUID.

Win32 MSI APIs: MsiDetermineApplicablePatches MsiDeterminePatchSequence

Assembly: Microsoft.Deployment.WindowsInstaller (Module: Microsoft.Deployment.WindowsInstaller) Version: 3.0.0.0 (3.5.1623.0)