asheroto / winget-install

Install winget tool using PowerShell! Prerequisites automatically installed. Works on Windows 10/11 and Server 2019/2022.
https://bit.ly/winget-install
GNU General Public License v3.0
272 stars 33 forks source link

some kind of problem when installing WinGet #9

Closed MisterZeus closed 1 year ago

MisterZeus commented 1 year ago

I hit this error during the last steps, where the script tries to install winget:

PS C:\WINDOWS\system32> winget-install
##################################################

Downloading Xaml nupkg file...

##################################################

Downloading https://www.nuget.org/api/v2/package/Microsoft.UI.Xaml/2.8.4 Saving as: C:\Users\MyUser\AppData\Local\Temp\Microsoft.UI.Xaml.2.8.4.nupkg.zip

Expanding: C:\Users\MyUser\AppData\Local\Temp\Microsoft.UI.Xaml.2.8.4.nupkg.zip Into: C:\Users\MyUser\AppData\Local\Temp\Microsoft.UI.Xaml.2.8.4

##################################################

Downloading & installing x64 VCLibs...

##################################################

##################################################

Installing x64 XAML...

##################################################

Installing Appx Packages In: C:\Users\MyUser\AppData\Local\Temp\Microsoft.UI.Xaml.2.8.4\tools\AppX\x64\Release

Installing Appx Package: Microsoft.UI.Xaml.2.8.appx

Retrieving download URL for winget from GitHub...

##################################################

Downloading winget...

##################################################

Downloading: https://github.com/microsoft/winget-cli/releases/download/v1.4.11071/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle Saving as: C:\Users\MyUser\AppData\Local\Temp\winget.msixbundle

Downloading: https://github.com/microsoft/winget-cli/releases/download/v1.4.11071/5d9d44b170c146e1a3085c2c75fcc2c1_License1.xml Saving as: C:\Users\MyUser\AppData\Local\Temp\license1.xml

##################################################

Installing winget...

##################################################

Installing package: C:\Users\MyUser\AppData\Local\Temp\winget.msixbundle

Something went wrong. Please try again or open an issue at https://github.com/asheroto/winget-install/issues Line number: 251 Error: The parameter is incorrect.

asheroto commented 1 year ago

What OS do you have? And what version of PowerShell?

The problem appears to be with the Add-AppxProvisionedPackage command.

See if you can run this command:

$wingetPath = "C:\Users\MyUser\AppData\Local\Temp\winget.msixbundle"
$wingetLicensePath = "C:\Users\MyUser\AppData\Local\Temp\license1.xml"
Add-AppxProvisionedPackage -Online -PackagePath $wingetPath -LicensePath $wingetLicensePath

Let me know what the error says. 😊

MisterZeus commented 1 year ago

I'm on Windows 10 Pro, version 22H2, x64.

Running the old-school Powershell.exe via an Admin Windows Powershell ISE session, instead of any new PS version that uses pwsh.exe

Here is the full error, I added a -Verbose flag in case it gave us more useful info, but that only added 1 VERBOSE line to the output:

PS C:\WINDOWS\system32>

$PSVersionTable
Get-Host
$wingetPath = "C:\Users\MyUser\AppData\Local\Temp\winget.msixbundle"
$wingetLicensePath = "C:\Users\MyUser\AppData\Local\Temp\license1.xml"
Add-AppxProvisionedPackage -Online -PackagePath $wingetPath -LicensePath $wingetLicensePath -Verbose

Name                           Value
----                           -----
PSVersion                      5.1.19041.3031
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.3031
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Name             : Windows PowerShell ISE Host
Version          : 5.1.19041.3031
InstanceId       : 49d6e082-c7f5-45f2-8184-0c490093e180
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-GB
CurrentUICulture : en-GB
PrivateData      : Microsoft.PowerShell.Host.ISE.ISEOptions
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

VERBOSE: Target Image Version 10.0.19045.3086
Add-AppxProvisionedPackage : The parameter is incorrect.
At line:5 char:1
+ Add-AppxProvisionedPackage -Online -PackagePath $wingetPath -LicenseP ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Add-AppxProvisionedPackage], COMException
    + FullyQualifiedErrorId : Microsoft.Dism.Commands.AddAppxProvisionedPackageCommand
asheroto commented 1 year ago

I'm not sure what the problem is... I have a VM with Windows 10 22H2 using PowerShell version 5.1.19041.3031 and it works fine...

Through PowerShell:

https://github.com/asheroto/winget-installer/assets/49938263/6c9c538c-b8c5-4e48-8f38-7462e602c900

Through PowerShell ISE: https://github.com/asheroto/winget-installer/assets/49938263/aa933830-101c-4b63-a8bc-17f10a4dd12e

Looks like something is wrong with the Add-AppxProvisionedPackage command. According to a Google search, this came up and it has some troubleshooting steps.