Public/Get-PdqDatabaseColumns.ps1
<#
.SYNOPSIS Retrieves all column names from the specified table. .INPUTS None. .OUTPUTS System.Object[] .EXAMPLE Get-PdqDatabaseColumns -Product 'Deploy' -Table 'Deployments' #> function Get-PdqDatabaseColumns { [CmdletBinding()] param ( [ValidateSet('Deploy', 'Inventory')] # The PDQ application you would like to execute this function against. [String]$Product, [Parameter(Mandatory = $true)] # The table whose columns you would like to retrieve. # Use Get-PdqDatabaseTables to see the available tables. [String]$Table, # The path to the currently active database will be retrieved by default. # You can use this parameter if you wish to run this function against a different database. [String]$DatabasePath ) $Query = "pragma table_info($Table)" (Invoke-PdqSqlQuery -Product $Product -DatabasePath $DatabasePath -Query $Query).name | Sort-Object } |