Public/Get-PdqInstalledVersion.ps1
<#
.SYNOPSIS Asks the PDQ CLI what the currently installed version is. .DESCRIPTION Uses the SystemInfo command to retrieve the version. If the PDQ CLI cannot be found, this function will return an error. .INPUTS None. .OUTPUTS System.String .EXAMPLE Get-PdqInstalledVersion -Deploy Outputs the version number for the currently installed instance of PDQ Deploy. #> function Get-PdqInstalledVersion { param ( [Parameter(Mandatory = $true)] [ValidateSet('Deploy', 'Inventory')] # The PDQ application you would like to execute this function against. [String]$Product ) $ExeName = "PDQ$Product.exe" Try { $Version = [Version](& $ExeName SystemInfo -Item Version) } Catch [System.Management.Automation.CommandNotFoundException] { throw "Unable to find $ExeName. Please make sure PDQ $Product is installed." } Write-Verbose "Installed PDQ $Product version: $Version" $Version } |