NI Package Manager
The NI Package Manager (https://www.ni.com/en/support/downloads/ni-package-manager.html) is NI's proprietary version of a Debian package manager software framework. Almost every NI Software is installed using NI Packages (*.nipkg). A very handy feature is the possibility to define package dependencies incl. version numbers.
Consuming NI Packages
The mostly known way of consuming *.nipkg files is the NI Package Manager GUI (%Programs%\National Instruments\NI Package Manager\NIPackageManager.exe on Windows machines). NI Package Manager GUI is registered as the default application for handling *.nipkg files during installation.
The GUI is an application providing easier access to the usage of the Package Manager. Generally speaking it is a Windows application wrapping the functionality of the underlying command line tool (%Programs%\National Instruments\NI Package Manager\nipkg.exe on Windows machines) and providing a kind of shop experience for the user.
INFO: since NI Package Manager is used to install software to the computer, it requires administrative privileges to run.
Use Cases for uisng NI Packages
- Installation of NI Software (like LabVIEW, TestStand, ....) and required components
- TestStand Deployments
- Installation of general software packages incl. required dependencies
Contents of NI Packages
A NI Package can consist of different contents depending on what kind of software needs to be distributed
- Distribution and execution of MSI installers
- Distribution of files and folder structures
- Distribution of multiple nipkg files (Package of Packages)
Internal structure of an NI Package
An *.nipkg file is an archive file which holds a defined file / folder structure. Detailed information can be found at https://www.ni.com/docs/en-US/bundle/package-manager/page/package-components.html
How to create *.nipkg files
There are different possibilities to create nipkg files; the choice which one to actiually use is dependant on your workflow.
Using LabVIEW Build script
Details to be added
Using TestStand Deployment Tool
Details to be added
NI Package Builder
nipkg.exe
Refer to https://github.com/mbilyk/NIPM-Tutorial/blob/master/README.md for details
How to use NI Package Manager to create a list of installed NI Packages
There are times when you have to check which NI Packages are installed on a certain PC. Such an inventory can be done using SystemLink. But most of us don't have this available I guess. So why not use NIPMs built-in featured which can be accessed via command line.
On a standard installation, you can find the executable at
C:\Program Files\National Instruments\NI Package Manager\nipkg.exe
There are several command line options you can use, in this use case we'll use
nipkg.exe list-installed
which gives us a complete list of nipkg installed on your computer. To add a little traceability, we can also determine the source feed, the package was actually installed from
nipkg.exe list-source-feeds <package name>
For starters, you can use the following PowerShell Script to create a csv file which contains a list of all installed packages and the source feeds they have been installed from.
$nipkgPath = "C:\Program Files\National Instruments\NI Package Manager\nipkg.exe"
# Path to nipkg.exe
# Check if nipkg.exe exists
if (-not (Test-Path -Path $nipkgPath)) {
Write-Error "NI Package Manager wasn't found at '$nipkgPath'."
exit
}
# Target-Pfad for CSV file
$outputPath = "C:\Temp\NI_Installed_Packages.csv"
Write-Host "Retrieving installed packages..." -ForegroundColor Cyan
# call nipkg
$installedOutput = & $nipkgPath list-installed
$results = [System.Collections.Generic.List[PSCustomObject]]::new()
foreach ($line in $installedOutput) {
# whit space handling
$cleanLine = ($line -replace '\s+', ' ').Trim()
# skip empty lines
if ([string]::IsNullOrWhiteSpace($cleanLine)) {
continue
}
# split line
# 0: PackageName, 1: Version, 2: Architecture, 3: Description
$parts = $cleanLine.Split(' ', 4)
if ($parts.Count -ge 3) {
$packageName = $parts[0]
$version = $parts[1]
$architecture = $parts[2]
$description = if ($parts.Count -eq 4) { $parts[3] } else { "" }
Write-Host "Determining Source Feed: $packageName" -ForegroundColor Gray
# call 'list-source-feeds' for current package
$feedOutput = & $nipkgPath list-source-feeds $packageName 2>$null
# get rid of empty lines
$sourceFeeds = ($feedOutput | Where-Object { -not [string]::IsNullOrWhiteSpace($_) }) -join "; "
# create data structure
$results.Add([PSCustomObject]@{
PackageName = $packageName
Version = $version
Architecture = $architecture
Description = $description
SourceFeed = $sourceFeeds
})
}
}
# Export to CSV-Datei (; as seperator)
$results | Export-Csv -Path $outputPath -Delimiter ';' -NoTypeInformation -Encoding UTF8
Write-Host "`nExport succeded! File saved at: $outputPath" -ForegroundColor Green