Installing WinGet and PowerShell Module Programmatically on Windows 10 #4065
Replies: 3 comments 7 replies
-
The PS module only works if WinGet is installed, and installing the PS module itself doesn't install WinGet with it. But yes, I was able to create a script to install WinGet (but it doesn't install the PS module |
Beta Was this translation helpful? Give feedback.
-
This should work, since it is what is used in the SandboxTest script over at winget-pkgs.
If you don't need the Try-Catch, it can be simplified down to 3 lines -
As @Andrew-J-Larson said, you need to install the WinGet client in order to use commands like |
Beta Was this translation helpful? Give feedback.
-
The latest method for doing this is by running |
Beta Was this translation helpful? Give feedback.
-
Has anyone been able to successfully install WinGet as well as the PowerShell module (Microsoft.WinGet.Client) on a Windows 10 machine programmatically (using command line / PS script)?
I have been trying now for a couple of weeks, but it always results in the PS module giving me this error when I try to run commands like
Get-WinGetPackage
orFind-WinGetPackage
:Using the
winget
command always works so it does not appear to be anything wrong with the WinGet installation itself (lately I have been using this installer script)I have tried two different approaches; installing PowerShell 7 first (in PS5 using this MSI), then WinGet and finally the Microsoft.WinGet.Client in PS7 ... and another where I install WinGet first then PS7 using WinGet in PS5, and finally Microsoft.WinGet.Client in PS7. None of the approaches seems to work.
Has anyone tried the same and experienced similar issues?
Beta Was this translation helpful? Give feedback.
All reactions