APPX Software Library

Chapter 7: Read APPX Data with 32-bit PowerShell

Work with Query Results in PowerShell

Download read-appx-odbc-32.ps1 into a working folder. This helper complements the first connection example: it returns one object per record, keeping the fields available for filtering, calculations and exports. Use it in 32-bit Windows PowerShell 5.1 with the site's approved script-execution method. Keep execution policy unchanged.

Open the 32-bit PowerShell executable, change to the folder containing the helper, and run:

$credential = Get-Credential -UserName appx -Message 'APPX ODBC login'
$rows = @(.\read-appx-odbc-32.ps1 -Dsn AppxODBC -Credential $credential -Verbose)
$rows.Count
$rows | Format-Table name, region_label, no_words, post_code_loc -AutoSize

The default query reads COUNTRY ordered by name. Expect 7 objects. The @(...) wrapper keeps zero, one and many results as arrays. Each call opens a new connection, reads the results, and disposes the reader, command and connection, including on failure. The credential stays in this PowerShell session so later recipes can reuse it without another prompt. Do not put its password into SQL or a connection string typed at the console.

Use Format-Table only for display. Keep $rows as the original objects for the following recipes. The helper preserves returned numbers and dates, converts database NULL to PowerShell $null, and retains fixed-width text padding. It does not silently trim or change business values. Give duplicate or unnamed SQL result columns distinct AS aliases.

Read the built-in help with Get-Help .\read-appx-odbc-32.ps1 -Full. The helper accepts SELECT statements intended for reading; it does not parse SQL into a security policy or replace the account's database permissions.