#Nuget Provider is required to continue prompts that needs to be confirmed.

21 messages ยท Page 1 of 1 (latest)

rich grail
#

Hi i am trying to run the following command to run windows update automatically.

But there is no one at the computer so this is executed remotely through a remote execution system.

The issue is that nuget prompts for confirmation i have tried to use -Force parameter with Install-PackageProvider -Name -NuGet -MinimumVersion 2.8.5.201 -Force but still i get the prompt.
Also i tried adding -Confirm:$false but i still get the prompt asking to select Yes No Suspend or Help

Powershell.exe -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Set-ExecutionPolicy -Scope Process -ExecutionPolicy Unrestricted -Force; Set-PSRepository -Name PSGallery -InstallationPolicy Trusted; Install-PackageProvider -Name Nuget -MinimumVersion 2.8.5.201 -Force; Install-Module PowerShellGet -AllowClobber -Force;Install-Module PSWindowsUpdate -Force; Install-WindowsUpdate -MicrosoftUpdate -AcceptAll -AutoReboot"

NuGet provider is required to continue
PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet
provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or
'C:\Users\ncuser\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by
running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install
and import the NuGet provider now?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):

cyan lily
#
[Net.ServicePointManager]::SecurityProtocol = @([Net.SecurityProtocolType]::Tls, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls12)

add this prior - should do ...

#
$Params = @{
    Name           = 'NuGet'
    MinimumVersion = '2.8.5.201'
    Force          = $true
    ErrorAction    = 'Stop'
}

$PackageProvider = Get-PackageProvider -Name $Params.Name -ErrorAction SilentlyContinue
if ([Version]$PackageProvider.Version -lt $Params.MinimumVersion) {
    $null = Install-PackageProvider @Params
}
#

the error thrown is totally garbage ^^ ... you just want tls backwards compatible and should do

#

some functions attached
id also encourage to implement a scheduled task to just update & restart ... until 0 updates are around -> then unregister itself

rich grail
#

@cyan lily Thanks i got some help and managed to get it running it was the execution order that was wrong Install-PackageProvider needs to run before i set InstallationPolicy then i did not get the prompt and also i added -ForceBootstrap parameter

cyan lily
#

try on a new machine ^^ im doing this over and over in buildpipelines - its literally tls first

#

then nuget - then whatever you want ๐Ÿ™‚

#

like windows exorcism ...

rich grail
#

Yes i will do that. Thanks alot for all the help ๐Ÿ™‚

cyan lily
#

np all premade and just some days old - all should be up to date and working

rich grail
#

great

cyan lily
#

iso -> vhdx / minified imagery / auto-vm ... basically a better automated labs (with extended pre/imagery phase)

rich grail
#

Yeah i configure Windows 10 IoT Enterprise LTSC and then i make imagefile in CloneZilla.

cyan lily
#

meeeeh ^^ no pls ๐Ÿ˜›

rich grail
#

it works well ๐Ÿ™‚

cyan lily
#

y but its meant to be zero touch literally ^^

#

iso -> vhdx -> add unattend -> vm oobe / provisioning without touch -> generalize -> deploy

#

thats what i tend to do atm