Since we had announced the retirement of the TechNet gallery last year, I’ve been slowly moving my scripts to the PowerShell gallery. I haven’t posted any new scripts in a couple of months and wrote a new one today. Uploading a script to the PowerShell Gallery typically requires using the Publish-Script
cmdlet in conjunction with an API key.
And received this delightfully cryptic error:
Publish-PSArtifactUtility : Failed to generate the compressed file for script ‘C:\Program Files\dotnet\dotnet.exe failed to pack: error
‘.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.4.1\PSModule.psm1:11336 char:17
+ … Publish-PSArtifactUtility @PublishPSArtifactUtility_Param …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : FailedToCreateCompressedScript,Publish-PSArtifactUtility
I figured since I hadn’t done it in a while, maybe something was wrong with PowerShellGet, so I ran Update-Module PowerShellGet
. Same result.
The ultimate fix was equally as cryptic as the error message. From a new elevated PowerShell prompt, run the following command:
Invoke-WebRequest -Uri https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile "$env:LOCALAPPDATA\Microsoft\Windows\PowerShell\PowerShellGet\NuGet.exe"
From there, you should be able to run Publish-Script successfully.
Cheers!
Howdy,
Thank you for sharing your knowledge during the past several years. I cant find my copy of idfix for public folders. Would you mind posting it to powershell gallery?
Thanks again!
Drew
I just posted a new version of it here with a lot more features. Let me know if this one works for you: https://www.powershellgallery.com/packages/Get-PublicFolderIDFixReport/.