< Back

Get-MSITable

Sat Jan 18, 2020 4:45 pm

NAME Get-MSITable



SYNOPSIS

Selects records from a table or custom query from a product or patch package.





SYNTAX

Get-MSITable [[-Table] <String>] [-Product] <ProductInstallation[]> [-IgnoreMachineState] -Query <String>

[<CommonParameters>]



Get-MSITable [[-Table] <String>] [-Path] <String[]> [-Product] <ProductInstallation[]> [-IgnoreMachineState]

-LiteralPath <String[]> [-Patch <String[]>] [-Transform <String[]>] [<CommonParameters>]



Get-MSITable [-Path] <String[]> [-Product] <ProductInstallation[]> [-IgnoreMachineState] -LiteralPath <String[]>

[-Patch <String[]>] -Query <String> [-Transform <String[]>] [<CommonParameters>]



Get-MSITable [[-Table] <String>] -LiteralPath <String[]> [-Patch <String[]>] -Query <String> [-Transform

<String[]>] [<CommonParameters>]



Get-MSITable [[-Table] <String>] [-Path] <String[]> [-Patch <String[]>] -Query <String> [-Transform <String[]>]

[<CommonParameters>]





DESCRIPTION

You can query all records from a table or records matching a custom query from a product or patch package. The

Windows Installer SDK has more information about custom queries, since the SQL-like syntax is rather constrained.



When no table or query is provided all tables from the package are displayed. Specifying a patch or transform will

cause tables added by the patch or transform to be displayed, along with the operation performed on that table by

the patch or transform in the MSIOperation property.



Records are returned with properties matching column names. If records are selected from a single table, the table

name is also part of the type name queryable from the PSTypeNames object property. If the column name is prefixed

with the table name - required to disambiguate names, or optional otherwise - a property is returned as typed in

the original query string. Note that Windows PowerShell allows periods in property names but may require in some

scenarios that a property name with periods is contained in quotes, like 'File.Attributes'.



For attribute columns in standard Windows Installer tables, you may also query for specific attribute values by

specifying a special property name on the end of the attribute column name, like 'File.Attributes'.HasVital, to

query for any columns that have the attribute value set. You can define an $MsiAttributeColumnFormat variable to

control the display format of attribute columns, though the underlying value will not be changed. Run 'help

about_MSI' for more information.



Note that patch packages do not typically have more than a couple of tables. The patch has to be applied to a

product package to view any changes it has made. When applying a patch or transforms, records will contain an

operation performed on the record by the patch or transform in the MSIOperation property.





PARAMETERS

-IgnoreMachineState [<SwitchParameter>]

Whether to apply any patches current installed to the product.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-LiteralPath <String[]>

The path to a product package to open. The value of -LiteralPath is used exactly as typed. No characters are

interpreted as wildcards.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Patch <String[]>

The path to a patch package to apply to the product package. Multiple patches are applied in authored sequence

order.



Wildcards are permitted. You can specify * in any part of the path to select all matching files.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? true



-Path <String[]>

The path to a product package to open. Wildcards are permitted. You can specify * in any part of the path to

select all matching files.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName, ByValue)

Accept wildcard characters? true



-Product <ProductInstallation[]>

An installed product to query.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-Query <String>

A custom query for which records are selected. Ambiguous column names must be prefixed with the table name to

which they belong.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Table <String>

The table from which all records are selected. If no table name is provided all tables in the database are

displayed.



Required? false

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Transform <String[]>

The path to a transform to apply to the product package.



Wildcards are permitted. You can specify * in any part of the path to select all matching files.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? true



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

Microsoft.Deployment.WindowsInstaller.ProductInstallation







OUTPUTS

Microsoft.Tools.WindowsInstaller.Record





Microsoft.Tools.WindowsInstaller.TableInfo







NOTES









-------------------------- EXAMPLE 1 --------------------------



get-msitable .\\example.msi -table Property



Gets all records from the Property table.

-------------------------- EXAMPLE 2 --------------------------



$productCode = get-msitable .\\example.msi -table Property | where-object { $_.Property -eq "ProductCode" } |

select-object -expand Value



Selects just the ProductCode property from the example.msi package and assigns the value to a variable.

-------------------------- EXAMPLE 3 --------------------------



get-childitem -filter *.msi | get-msitable -query "SELECT ComponentId, FileName, FileSize FROM Component, File

WHERE Component_ = Component"



Selects the component GUID, file name, and file size for all files in all packages in the current directory.

-------------------------- EXAMPLE 4 --------------------------



get-msitable .\\example.msi -query "SELECT ComponentId, FileName, File.Attributes FROM Component, File WHERE

Component_ = Component" | where-object { $_.'File.Attributes'.HasVital }



Selects all vital files and displays the component GUID, file name, and all file attribtes from the example.msi

package.



Note that in the query filter the 'File.Attributes' column is contained in quotes; otherwise, Windows PowerShell

will attempt to filter based on an Attributes property of a File property of the current pipeline object. The

'File.Attributes' column is contained in quotes in the original query because the Component table also contains a

column named Attributes. Windows Installer requires that you disambiguate column names.

-------------------------- EXAMPLE 5 --------------------------



get-msitable .\\example.msi -patch .\\example.msp | get-msitable | where-object { $_.MSIOperation -ne 'None' }



Gets all records in the example.msi package added or modified by the example.msp patch package.

-------------------------- EXAMPLE 6 --------------------------



get-msiproductinfo '{877EF582-78AF-4D84-888B-167FDC3BCC11}' | get-msitable -table Property



Selects records from the installed product along with any patches currently installed.



RELATED LINKS

Get-MSIProductInfo

Get-MSIProperty