Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instructions for installing winget in windows sandbox no longer work #5329

Open
Skgland opened this issue Mar 4, 2025 · 1 comment
Open
Labels

Comments

@Skgland
Copy link

Skgland commented Mar 4, 2025

Type of issue

Code doesn't work

Feedback

The instructions to install winget in Windows Sandbox appear to no longer work.

Reproduction

  1. Save the instructions as install-winget.ps1 and copy the file into windows sandbox
$progressPreference = 'silentlyContinue'
Write-Host "Installing WinGet PowerShell module from PSGallery..."
Install-PackageProvider -Name NuGet -Force | Out-Null
Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null
Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..."
Repair-WinGetPackageManager
Write-Host "Done."
  1. Open a PowerShell Window

  2. Run powershell -command "& {Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force}" to allow running the script

  3. Run .\install-winget.ps1

Image

PS C:\Users\WDAGUtilityAccount\Desktop> powershell -command "& {Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force}"
PS C:\Users\WDAGUtilityAccount\Desktop> .\install-winget.ps1
Installing WinGet PowerShell module from PSGallery...
Microsoft.PowerShell.Management\Test-Connection : Access is denied. (Exception from HRESULT: 0x80070005
(E_ACCESSDENIED))
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:6146 char:22
+ ... connected = Microsoft.PowerShell.Management\Test-Connection -Computer ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Test-Connection], UnauthorizedAccessException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.TestConnectionCommand

Microsoft.PowerShell.Management\Test-Connection : Access is denied. (Exception from HRESULT: 0x80070005
(E_ACCESSDENIED))
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:6146 char:22
+ ... connected = Microsoft.PowerShell.Management\Test-Connection -Computer ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Test-Connection], UnauthorizedAccessException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.TestConnectionCommand

Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet...
Repair-WinGetPackageManager : The term 'Repair-WinGetPackageManager' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At C:\Users\WDAGUtilityAccount\Desktop\install-winget.ps1:6 char:1
+ Repair-WinGetPackageManager
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Repair-WinGetPackageManager:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Done.
PS C:\Users\WDAGUtilityAccount\Desktop>

Page URL

https://learn.microsoft.com/de-de/windows/package-manager/winget/#install-winget-on-windows-sandbox

Content source URL

https://github.com/MicrosoftDocs/windows-dev-docs/blob/docs/hub/package-manager/winget/index.md

Author

@mattwojo

Document Id

b49c32ea-2efa-b090-7123-87c31d10279b

@Skgland Skgland changed the title Feedback Instructions for installing winget in windows sandbox no longer work Mar 4, 2025
@Skgland
Copy link
Author

Skgland commented Mar 4, 2025

If I remove -Repository PSGallery from the script, it works again.

 $progressPreference = 'silentlyContinue'
 Write-Host "Installing WinGet PowerShell module from PSGallery..."
 Install-PackageProvider -Name NuGet -Force | Out-Null
-Install-Module -Name Microsoft.WinGet.Client -Force -Repository PSGallery | Out-Null
+Install-Module -Name Microsoft.WinGet.Client -Force | Out-Null
 Write-Host "Using Repair-WinGetPackageManager cmdlet to bootstrap WinGet..."
 Repair-WinGetPackageManager
 Write-Host "Done."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant