Get-AppInformation

  • 15 June 2017
  • harringg
Description: 

This can be used to build the values for the VARIABLE DECLARATION in PSAppDeployToolkit (v3.6.9 as of this writing), or any other function/script that needs an installers values.

Language: 
Powershell
#[Modified, 6/15/2017 9:35 AM, Grant Harrington]
 
$BasePath = "D:\7ZIP\Toolkit\Files\"
$FileName = "7z1604-x64"
$FileExtension = "exe"
 
#Build Path to Application
$FullPath = "{0}{1}.{2}" -f $BasePath,$FileName,$FileExtension
#Get-Item: gather's values for Application Variables
$app = get-item $FullPath | select *
 
#region Build Application Variables
#GUI: FileDescription
$app.VersionInfo.FileDescription
 
#GUI: FileVersion
$FVMajor = $app.VersionInfo.FileVersionRaw.Major
$FVMinor = $app.VersionInfo.FileVersionRaw.Minor
$FVBuild = $app.VersionInfo.FileVersionRaw.Build
$FVRevision = $app.VersionInfo.FileVersionRaw.Revision
 
    # Builds the FileVersion
    $FileVersion = "{0}.{1}.{2}.{3}" -f $FVMajor,$FVMinor,$FVBuild,$FVRevision
 
#GUI: ProductName
$app.VersionInfo.ProductName
 
#GUI: ProductVersion
$app.VersionInfo.ProductVersion
 
#Name in Explorer
$app.BaseName
 
#Extension in Explorer
$app.Extension
 
#DirectoryName + BaseName + Extension
$app.FullName
 
#BaseName + Extension
$App.Name
 
#DirectoryName
$app.DirectoryName
 
#Vendor/Company Name
$app.VersionInfo.CompanyName
 
#Comments (if any)
$app.VersionInfo.Comments
 
#GUI: Language
$app.VersionInfo.Language
#endregion Build Application Variables
 
#region PSADT VARIABLE DECLARATION VALUES
$AppVendorOut = "[string]`$appVendor = '{0}'" -f $appVendor
$AppNameOut = "[string]`$appName = '{0}'" -f $app.VersionInfo.ProductName
$AppVersionOut = "[string]`$appVersion = '{0}'" -f $appVersion
$AppArchOut = "[string]`$appArch = '{0}'" -f $appArch
$AppLanguageOut = "[string]`$appLanguage = '{0}'" -f $appLanguage
$AppRevisionOut = "[string]`$AppRevision = '{0}'" -f $FVRevision
 
$AppVendorOut
$AppNameOut
$AppVersionOut
$AppArchOut
$AppLanguageOut
$AppRevisionOut
#endregion PSADT VARIABLE DECLARATION VALUES
 
<# EXAMPLE OUTPUT
[string]$appVendor = 'Igor Pavlov'
[string]$appName = '7-Zip'
[string]$appVersion = '16.04'
[string]$appArch = ''
[string]$appLanguage = 'English (United States)'
[string]$AppRevision = '0'
#>
Note: that all applications posted here are posted for use, both commercial and non-commercial, free of charge, and as such are provided without warranty of any kind whatsoever. FMSCUG or any program's author are not responsible for any damages or shortcomings that result from usage of any of these applications.