Repairing PowerShellGet Publishing

by Mar 27, 2019

If you are using Publish-Module to publish your modules to a PowerShell repository, and you keep getting exceptions about unsupported commands, it might be worthwhile to reinstall the executables that manage the module upload. When these executables get too old, they may no longer be in sync with the latest PowerShellGet module.

Run this to download and update nuget.exe with Administrator privileges (for all users):

$Path = "$env:ProgramData\Microsoft\Windows\PowerShell\PowerShellGet"
$exists = Test-Path -Path $Path
if (!$exists)
{
    $null = New-Item -Path $Path -ItemType Directory 
}
Invoke-WebRequest -Uri https://aka.ms/psget-nugetexe -OutFile "$Path\NuGet.exe"

Run this to download and install nuget.exe for your current user only:

$Path = "$env:LOCALAPPDATA\Microsoft\Windows\PowerShell\PowerShellGet"
$exists = Test-Path -Path $Path
if (!$exists)
{
    $null = New-Item -Path $Path -ItemType Directory 
}
Invoke-WebRequest -Uri https://aka.ms/psget-nugetexe -OutFile "$Path\NuGet.exe" 

psconf.eu – PowerShell Conference EU 2019 – June 4-7, Hannover Germany – visit www.psconf.eu There aren’t too many trainings around for experienced PowerShell scripters where you really still learn something new. But there’s one place you don’t want to miss: PowerShell Conference EU – with 40 renown international speakers including PowerShell team members and MVPs, plus 350 professional and creative PowerShell scripters. Registration is open at www.psconf.eu, and the full 3-track 4-days agenda becomes available soon. Once a year it’s just a smart move to come together, update know-how, learn about security and mitigations, and bring home fresh ideas and authoritative guidance. We’d sure love to see and hear from you!

Twitter This Tip! ReTweet this Tip!