-
Notifications
You must be signed in to change notification settings - Fork 138
Register-PSRepository in non-interactive mode? #101
Comments
In automation scripts, please use the below command to bootstrap the NuGet provider. Install-PackageProvider -Name NuGet -MinimumVersion '2.8.5.201' -Force |
@bmanikm That command doesn't seem to download nuget.exe. In my environment, I have been running that command, but I don't get the error about non-interactive mode until I get to the publish-module step, which fails because it's trying to prompt about downloading nuget.exe. |
@godefroi Correct, Install-PackageProvider only installs NuGet provider, and it doesn't download nuget.exe. NuGet.exe is required only during Publish-Module or Publish-Script operations. Please take a look at |
This is extremely unsatisfying. @bmanikm's suggestion results in downloading NuGet in every iteration/build/deployment! We end up needing something like this in our deployment scripts? if(!(Get-PackageProvider NuGet)) {
Install-PackageProvider Nuget -ForceBootstrap -Force
} It's a bit frustrating that I need to write so many lines for that, and then I have the same problem when installing modules. |
In automation scripts, please use the below simple command to bootstrap the NuGet provider. This bootstrap the NuGet provider only if it is not available on the local machine. Get-PackageProvider NuGet -ForceBootstrap |
In non-interactive mode this step requires additional privileges, at least account under which is running this commandlet has to have SeAssignPrimaryTokenPrivileges and SeServiceLogonRight rights. I've just extended this script by adding SeAssignPrimaryTokenPrivilege options. Currently Register-PSRepository works fine for me from our Chef recipes. |
This should be reopened @bmanikm - I have similar use case with Docker (installing pswh on docker image behind proxies) and it would be very welcomed |
@bmanikm I am now also experiencing this issue, and it seems your suggestions have nothing to do with the actual problem. The problem is with using the Register-PsRepository cmdlet. NOT with installing the PackageProvider. This should definitely be re-opened and addressed appropriately. See below my output: |
I was having a similar issue when trying to run a PowerShell script in my release pipeline that needed access to a module in our private Azure DevOps Artifacts feed, so I was attempting to do:
However, when the script runs on the MS hosted agent, it ends up in an infinite wait loop outputting:
I came across this feedback post though and was able to get it working with the following code (ensuring
The trick was to first do |
Team,
I'm using Register-PSRepository for automation on internal build system. On PS 5.1. the cmdlet prompts and I get the following message(from the build logs):
The cmdlet doesn't have -Force/-Confirm parameters and it doesn't respect the $ConfirmPreference variable. Is there a workaround for this?
Thanks,
Nedko
The text was updated successfully, but these errors were encountered: