11-01-2024 06:00 PM
OK, thanks for trying.
What version of NIPM do you think is installed before you try to upgrade anything? Do you know what are the versions of the NIPM and dependent packages that were installed before you opened NIPM?
11-01-2024 10:00 PM - edited 11-01-2024 10:05 PM
I missed something on your original post. You were correct that you need to issue an "nipkg.exe update", which is what launching NIPM does, and is required for nipkg.exe to see the latest packages available in registered feeds.
Your post listed the following command:
cmd /c $nipkg_exe update ni-package-manager ni-package-manager-upgrader ni-package-manager-released-feed system-windows-x64 ni-package-manager-deployment-support
The command does not take package names as parameters, but instead wants feed names, so the simplest command that you can execute is the following which will update all registered feeds:
cmd /c $nipkg_exe update
If you want to only update the NIPM feed then the following command is required:
cmd /c $nipkg_exe update ni-package-manager-released
Once the above is done, you should be able to issue the upgrade command successfully:
nipkg.exe upgrade --force-locked --yes --accept-eulas --verbose system-windows-x64 ni-msiproperties eula-ms-dotnet-4.8 ni-msdotnet4x ni-package-manager-deployment-support ni-package-manager
I suspect that the package order does not matter as long as you list all the required packages for the upgrade transaction.
11-04-2024 11:15 AM
@Scott_Richardson wrote:
I missed something on your original post. You were correct that you need to issue an "nipkg.exe update", which is what launching NIPM does, and is required for nipkg.exe to see the latest packages available in registered feeds.
Your post listed the following command:
cmd /c $nipkg_exe update ni-package-manager ni-package-manager-upgrader ni-package-manager-released-feed system-windows-x64 ni-package-manager-deployment-support
The command does not take package names as parameters, but instead wants feed names, so the simplest command that you can execute is the following which will update all registered feeds:
cmd /c $nipkg_exe update
If you want to only update the NIPM feed then the following command is required:
cmd /c $nipkg_exe update ni-package-manager-released
Once the above is done, you should be able to issue the upgrade command successfully:
nipkg.exe upgrade --force-locked --yes --accept-eulas --verbose system-windows-x64 ni-msiproperties eula-ms-dotnet-4.8 ni-msdotnet4x ni-package-manager-deployment-support ni-package-manager
I suspect that the package order does not matter as long as you list all the required packages for the upgrade transaction.
That was it! Programmer error. Thanks for all the help.
11-28-2024 03:37 AM - edited 11-28-2024 03:59 AM
For several years, I've been using a PowerShell script to install a baseline. Below, I'm sharing a snippet (my old solution) that is responsible for installing NIPM and automatically updating it to the latest version. The process involves downloading NIPM from the public site using WebClient
and then installing it with the installer via Start-Process
.
Recently, I noticed that the NIPM download page now seems to require login credentials to access the installer, so I'm not sure if this has broken my workflow. I'll need to check this.
For updates, I used Updater\Install.exe
, but it was necessary to launch NIPM at least once before using the updater. To handle this, I would launch NIPM with a dummy command, and then proceed with the updater.
Lately, I started writing a new script that uses WinGet to install NIPM. This allows for automation using the following command:
winget install --accept-source-agreements --accept-package-agreements --silent --exact --id "NI.ni-packagemanager"
Referring back to the topic: NIPM can be installed or updated to a specific version using WinGet. In my opinion, this is quite a straightforward solution (provided that WinGet itself works). Available versions can be checked using:
winget show NI.ni-packagemanager --versions
Found NI Package Manager [NI.ni-packagemanager]
Version
-------
24.8.0
24.5.0
24.3.0
24.0.0
23.8.0
Installation can be performed with the command winget install "NI.ni-packagemanager" --version 23.8.0
.
Maybe it will be useful to someone.
My old solution below
function Download-NIPM {
[CmdletBinding()]
param (
# Specifies the NI Package Manager version. The default is "21.0.0".
[string]$Version = "21.0.0"
)
$DownloadsDir = (New-Object -ComObject Shell.Application).NameSpace('shell:Downloads').Self.Path
$Source = "https://download.ni.com/support/nipkg/products/ni-package-manager/installers/NIPackageManager$Version.exe"
$Destination = "$DownloadsDir\NIPackageManager$Version.exe"
Write-Verbose "Source: $Source"
Write-Verbose "Destination: $Destination"
try {
Write-Host "Downloading NIPM $Version..." -ForegroundColor Cyan
$WebClient = New-Object System.Net.WebClient
$WebClient.DownloadFile($Source, $Destination)
Write-Host "Success." -ForegroundColor Green
return $Destination
}
catch {
Write-Host "Error: $_" -ForegroundColor Red
Write-Error "Do you want to continue?" -ErrorAction Inquire
return ""
}
<#
.SYNOPSIS
Downloads the NI Package Manager installer.
.DESCRIPTION
Downloads specified NI Package Manager installer version from "https://download.ni.com/support/nipkg/products/ni-package-manager/installers" to the Downloads folder.
.INPUTS
None. You cannot pipe objects to Download-NIPM.
.OUTPUTS
System.String. Download-NIPM returns a string with the NI Package Manager installer path.
#>
}
function Install-NIPM {
[CmdletBinding()]
param (
# Specifies the NI Package Manager installer path.
[Parameter(Mandatory = $True, ValueFromPipeline = $True)]
[string] $Installer
)
Begin {
Write-Verbose "Installer: $Installer"
}
Process {
if (Test-Path $Installer) {
try {
Write-Host "Installing NIPM..." -ForegroundColor Cyan
$Process = Start-Process $Installer -ArgumentList "--quiet --accept-eulas --prevent-reboot" -Wait -NoNewWindow -PassThru
if($Process.ExitCode -eq 0){
Write-Host "Success." -ForegroundColor Green
}
else{
Write-Host "Error: The installer exited with error code $($Process.ExitCode)." -ForegroundColor Red
Write-Error "Do you want to continue?" -ErrorAction Inquire
}
}
catch {
Write-Host "Error: $_" -ForegroundColor Red
Write-Error "Do you want to continue?" -ErrorAction Inquire
}
}
else {
Write-Host 'Error: The installer is missing. You must run the "Download-NIPM" function first.' -ForegroundColor Red
Write-Error "Do you want to continue?" -ErrorAction Inquire
}
}
End {}
<#
.SYNOPSIS
Installs the NI Package Manager.
.DESCRIPTION
Quietly installs NI Package Manager using specified installer. Pipe the Download-NIPM output to the Install-NIPM input.
.INPUTS
System.String. You can pipe the NI Package Manager installer path.
.OUTPUTS
None. Install-NIPM does not generate any output.
#>
}
function Update-NIPM {
[CmdletBinding()]
param (
)
$ManagerPath = "C:\Program Files\National Instruments\NI Package Manager\NIPackageManager.exe"
$UpdaterPath = "C:\Program Files\National Instruments\NI Package Manager\Updater\Install.exe"
Write-Verbose "Manager: $ManagerPath"
Write-Verbose "Updater: $UpdaterPath"
if (Test-Path $UpdaterPath) {
Write-Host "Updating NIPM..." -ForegroundColor Cyan
# To use NIPM Updater tool, the NIPM needs to be run at least once.
# Run NIPM with dummy command
try {
$Process = Start-Process $ManagerPath -ArgumentList "launch nothing --passive" -Wait -NoNewWindow -PassThru
if($Process.ExitCode -ne 0){
Write-Host "Error: The NIPM exited with error code $($Process.ExitCode)." -ForegroundColor Red
Write-Error "Do you want to continue?" -ErrorAction Inquire
}
}
catch {
Write-Host "Error: $_" -ForegroundColor Red
Write-Error "Do you want to continue?" -ErrorAction Inquire
}
# Run Updater
try {
$Process = Start-Process $UpdaterPath -ArgumentList "--quiet" -Wait -NoNewWindow -PassThru
if($Process.ExitCode -eq 0){
Write-Host "Success." -ForegroundColor Green
}
else {
Write-Host "Error: The updater exited with error code $($Process.ExitCode)." -ForegroundColor Red
Write-Error "Do you want to continue?" -ErrorAction Inquire
}
}
catch {
Write-Host "Error: $_" -ForegroundColor Red
Write-Error "Do you want to continue?" -ErrorAction Inquire
}
}
else {
Write-Host 'Error: The NIPM Updater is missing. You must run the "Install-NIPM" function first.' -ForegroundColor Red
Write-Error "Do you want to continue?" -ErrorAction Inquire
}
<#
.SYNOPSIS
Installs the latest NI Package Manager.
.DESCRIPTION
Installs the latest NI Package Manager using NI Package Manager Updater tool. To use this function, the NI Package Manager must be already installed.
.INPUTS
None. You cannot pipe objects to Update-NIPM.
.OUTPUTS
None. Update-NIPM does not generate any output.
#>
}