$cs.MSI_IsMSIGuidInstalled
Description
Section titled “Description”Checks whether a product with the given ProductCode GUID is currently installed, by querying Windows Installer’s product state directly — no MSI file needed, just the GUID. Windows-only.
Syntax
Section titled “Syntax”$cs.MSI_IsMSIGuidInstalled(string msiguid)
Parameters
Section titled “Parameters”msiguid (String)
Section titled “msiguid (String)”ProductCode GUID to check the installation status of.
Return value
Section titled “Return value”Boolean, $true if a product with this GUID is installed. Returns $false on any error rather than throwing.
Example
Section titled “Example”if ($cs.MSI_IsMSIGuidInstalled('{AC76BA86-1033-FF00-7760-BC15014EA700}')) { $cs.Job_WriteLog("Product is already installed, skipping install")}Use the same guard with a hardcoded GUID inside PreInstall, which is useful when the kit downloads its MSI separately at install time rather than shipping it in the package:
function PreInstall { $cs.Log_SectionHeader('PreInstall', 'o') $knownProductCode = '{AC76BA86-1033-FF00-7760-BC15014EA700}' if ($cs.MSI_IsMSIGuidInstalled($knownProductCode)) { Exit-PSScript -exitcode 3330 -exitmessage "$global:AppName ($knownProductCode) is already installed, nothing to do" }}