Script - Get-SoftwareInfo

There will be times that you will only have the option to use a exe and not a MSI to build an application. Normally that's not a problem but then halfway through building the application you realizes you have no idea what to use for a detection method since when you use a MSI SCCM will import that information for you. That is where this script is very handy for a SCCM admin what I do is install the software manually then run this script to get the Software ID number since that is one of the cleanest ways for SCCM to detect an application.

<#

    .SYNOPSIS
    Script to show or export installed software information

    .DESCRIPTION
    The script will display Software ID number, Name, Vendor and Version. 

    .PARAMETER Computer
    With this parameter you cam run this on a remote computer 

    .PARAMETER Export
    Allows you to export the information to a file 

    .EXAMPLE
    .\Get-SoftwareInfo.ps1 -Export SoftwareInfo.txt

    .EXAMPLE
    .\Get-SoftwareInfo.ps1 -Computer IT-Testing-7

    .EXAMPLE
    To get an export from a remote computer
    .\Get-SoftwareInfo.ps1 -Computer IT-Testing-7 | Out-File SoftwareInfo.txt

    .NOTES
    Created By: Kris Gross
    Contact: KrisGross@sccmtst.com
    Twitter: @kmgamd

    .LINK
    http://www.sccmtst.com/2017/04/script-get-softwareinfo.html

#>


param($Computer = $env:computername,
      $Export = 0
    )

Function Export-SoftwareInfo
{
    Get-WmiObject Win32_Product | Format-List IdentifyingNumber, Name, Vendor, Version | Out-File $Export
    Write-Host You can find your export at $Export
    pause
}


Function Show-SoftwareInfo
{
    Write-Host "Software Info: $Computer"
    Clear-Host
    Get-WmiObject Win32_Product | Format-Table IdentifyingNumber, Name, Vendor, Version
    pause
}

IF (($Computer -eq $env:computername) -and ($Export -ne 0))
{
   Export-SoftwareInfo
}
IF (($Computer -eq $env:computername) -and ($Export -eq 0))
{
   Show-SoftwareInfo
}
IF (($Computer -ne $env:computername) -and ($Export -eq 0))
{   
    Invoke-Command -ComputerName $Computer -ScriptBlock ${function:Show-SoftwareInfo} 
}
IF (($Computer -ne $env:computername) -and ($Export -ne 0))
{
    RemoteExport Invoke-Command -ComputerName $Computer -ScriptBlock ${function:Export-SoftwareInfo}
}

Popular posts from this blog

SCCM Task Sequence GUI - How to set up the TS to work with a GUI

SCCM Applications vs. SCCM Packages: Understanding the Key Differences

Faster PXE boot times in SCCM 1606 and later