Git Product home page Git Product logo

winget-install's People

Contributors

asheroto avatar misterzeus avatar og-mrk avatar thomasschadenhofer avatar uffemcev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

winget-install's Issues

issue

WARNING! An error occurred during installation!

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

WARNING: Something went wrong. If messages above don't help and the problem persists,
WARNING: Please open an issue at https://github.com/asheroto/winget-install/issues
WARNING: Line number : 434
WARNING: Error: Deployment failed with HRESULT: 0x80073CF6, Package could not be registered.

error 0xC0020036: windows.licensing failed to start ClipSvc. Try again and contact the package publisher if the problem
persists.

NOTE: For additional information, look for [ActivityId] 6531d6de-ce87-000a-5ee3-3e6587ced901 in the Event Log or use
the command line Get-AppPackageLog -ActivityID 6531d6de-ce87-000a-5ee3-3e6587ced901

Error when installing

Hello. I have winget, but I decided to run this script to test it and I get this error. The error appears if the system language is Russian. If the system language is English, then there is no problem. Sorry for bad English.

Script verson 3.0.0
Windows 22H2
UAC disable
Powershell 5.1
Run as admin

Log Windows PowerShell (C) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.

Установите последнюю версию PowerShell для новых функций и улучшения! https://aka.ms/PSWindows

PS C:\Users\uffemcev> &([ScriptBlock]::Create((irm https://raw.githubusercontent.com/asheroto/winget-install/master/winget-install.ps1))) -Force
winget-install 3.0.0

###################################################
# Downloading & installing 64-разрядная VCLibs... #
###################################################

URL:

Installing 64-разрядная VCLibs...
ПРЕДУПРЕЖДЕНИЕ: Error when trying to download or install VCLibs. Trying alternate method...

Installing 64-разрядная VCLibs...
ПРЕДУПРЕЖДЕНИЕ: Same version already installed.
ПРЕДУПРЕЖДЕНИЕ: That's okay, continuing...

####################################################
# Downloading & installing 64-разрядная UI.Xaml... #
####################################################

URL:

Installing 64-разрядная UI.Xaml...
ПРЕДУПРЕЖДЕНИЕ: Error when trying to download or install UI.Xaml. Trying alternate method...

Downloading UI.Xaml...
Extracting...

Installing 64-разрядная UI.Xaml...
Get-ChildItem : Не удается найти путь "C:\Users\uffemcev\AppData\Local\Temp\Microsoft.UI.Xaml.2.7.3\tools\AppX\64-разрядная\Release\Microsoft.UI.Xaml.2.7.appx", так как он не существует.
строка:706 знак:17
+ ... Get-ChildItem -Path $XamlAppxPath -Filter *.appx | ForEa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Users\uffemc...I.Xaml.2.7.appx:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

UI.Xaml installed successfully.

######################################
# Downloading & installing winget... #
######################################

Retrieving download URL for winget from GitHub...
Downloading winget...
Downloading license...

Installing winget...

winget installed successfully.

#################################################################################################
# Checking and adding WindowsApps directory to PATH variable for current user if not present... #
#################################################################################################

PATH variable already present for Machine, skipping.
PATH variable already present for User, skipping.

##########################
# Installation complete! #
##########################

Checking if winget is installed and working...
winget is installed and working now, you can go ahead and use it.
PS C:\Users\uffemcev>

No applicable app licenses found

When installing on a new Windows 2022 server the installation completes successfully, but winget will not run.

The issue seems to be caused by a missing license file:
image

The issue has earlier been reported in winget repo:
microsoft/winget-cli#700

The issue seems to be caused by the change where the script now uses Add-AppxPackage instead of Add-AppxProvisionedPackage:

Add-AppxPackage -Path $wingetPath -ErrorAction SilentlyContinue

Add-AppxPackage doesn't support adding a license file.
The PowerShell script only downloads the license file from Winget but never uses it.

I have locally changed the above mentioned line to:
Add-AppxProvisionedPackage -Online -PackagePath $wingetPath -LicensePath $wingetLicensePath -ErrorAction SilentlyContinue

and it works on the server I tested on

License

What is the license for this project?

Errors when installing

Script verson 1.0.1
Windows 22H2
UAC disable
Powershell 5.1
Run as admin

Log PS C:\Users\uffemcev> iwr raw.githubusercontent.com/asheroto/winget-installer/master/winget-install.ps1 | iex

Invoke-RestMethod : BlobNotFoundThe specified blob does not exist.
RequestId:68001a83-a01e-0069-2c38-a384bb000000
Time:2023-06-20T05:31:37.0098866Z
At line:47 char:10
+ $json = Invoke-RestMethod -Method Get -Uri $url
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Cannot index into a null array.
At line:49 char:2
+ $latestVersion = $json.versions[-1]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray

##################################################
# Downloading Xaml nupkg file...
##################################################

##################################################
# Downloading & installing x64 VCLibs...
##################################################

##################################################
# Installing x64 XAML...
##################################################

Add-AppxPackage : Cannot find path 'C:\Users\uffemcev\AppData\Local\Temp\Microsoft.UI.Xaml.\tools\AppX\x64\Release\Microsoft.UI.Xaml..appx' because it does not exist.
At line:69 char:2
+ Add-AppxPackage $pkg -ErrorAction SilentlyContinue
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (C:\Users\uffemc...t.UI.Xaml..appx:String) [Add-AppxPackage], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand

##################################################
# Downloading winget...
##################################################

##################################################
# Installing winget...
##################################################

##################################################
# Checking and adding WindowsApps directory to PATH variable for current user if not present...
##################################################

##################################################
# Cleaning up...
##################################################

Remove-Item : An object at the specified path C:\Users\uffemcev\AppData\Local\Temp\Microsoft.UI.Xaml. does not exist.
At line:148 char:1
+ Remove-Item -Path $nupkgFolder -Recurse
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Remove-Item], PSArgumentException
+ FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.RemoveItemCommand

##################################################
# Installation complete!
##################################################

##################################################
# Please restart your computer to complete the installation.
##################################################

PS C:\Users\uffemcev>

WINGET NOT INSTALLING

PS E:\Documents\scripts> winget-install.ps1

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

Downloading & installing x64 VCLibs...

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

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

Downloading & installing x64 VCLibs...

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

URL: https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx

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

Downloading & installing x64 UI.Xaml...

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

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

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

WARNING! An error occurred during installation!

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

WARNING: Something went wrong. If messages above don't help and the problem persists,
WARNING: Please open an issue at https://github.com/asheroto/winget-install/issues
WARNING: Line number : 375
WARNING: Error: Unable to connect to the remote server

Install as SYSTEM user

It seems there might be a limitation of using this script as the SYSTEM account. I don't know if this is a limitation of winget itself or the installer. If it's winget, you might consider to put a check in the install to check if it's being ran as SYSTEM. If not, could it be added?

Winget not installing

I've tried to run the script on several PCs. Not had any issues historically until yesterday. Now I just can't get winget to install. I get the same output as the readme. Failed getting latest UI.Xaml... Using hardcoded version 2.8.4 etc

However, despite many reboots, I just cannot get winget to install anymore.

I've tried 3 different builds on Windows 10 (Windows 10 Education - 22H2)

  1. Custom ISO updated to April 2023 (NTLite)
  2. Custom ISO updated to July 2023 (NTLite)
  3. Untouched ISO downloaded directly from VLSC - Updated July 2023

Also tried forcing the install using Chris Titus' script and I just get the message "Winget install failed".

Any ideas?

some kind of problem when installing WinGet

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.

[Bug]: Get-OSInfo incorrectly identifies Windows 11 23H2 Multi-Session as a Server OS < 2022

Checklist

  • I have performed the steps in the Troubleshooting section and confirm that the issue only occurs with this script.

  • I have restarted my computer to confirm this is not a transitory problem.

  • I have verified that I am using the latest version of winget-install.

  • I have verified that this issue is NOT security related (please create security advisory if so).

  • I have run the script with the -DebugMode argument and included the output below

What You Are Seeing?

Running the script on Windows 11 23H2 Enterprise multi-session (for Azure Virtual Desktop) Azure Marketplace image. The script returns this error:

winget requires Windows Server 2022 or newer on server platforms. Your version of Windows Server is not supported.

Running with -Force or -Debug returns same error.

I think the problem is the EditionID is ServerRdsh.

System Details

Azure Marketplace image:
Windows 11 (23H2) Enterprise multi-session + Microsoft 365 Apps - Gen2 (multi-session)
February Windows update installed
See Additional Context for details

Additional Context

PS C:> $osDetails = Get-CimInstance -ClassName Win32_OperatingSystem
PS C:> $osDetails
SystemDirectory Organization BuildNumber RegisteredUser SerialNumber Version


C:\Windows\system32 22631 00432-70000-00001-AA416 10.0.22631

PS C:> Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
SystemRoot : C:\Windows
BaseBuildRevisionNumber : 1
BuildBranch : ni_release
BuildGUID : ffffffff-ffff-ffff-ffff-ffffffffffff
BuildLab : 22621.ni_release.220506-1250
BuildLabEx : 22621.1.amd64fre.ni_release.220506-1250
CompositionEditionID : Enterprise
CurrentBuild : 22631
CurrentBuildNumber : 22631
CurrentMajorVersionNumber : 10
CurrentMinorVersionNumber : 0
CurrentType : Multiprocessor Free
CurrentVersion : 6.3
DisplayVersion : 23H2
EditionID : ServerRdsh
EditionSubManufacturer :
EditionSubstring :
EditionSubVersion :
InstallationType : Client
InstallDate : 1709571506
ProductName : Windows 10 Enterprise multi-session
ReleaseId : 2009
SoftwareType : System
UBR : 3155
PathName : C:\Windows
PendingInstall : 0
ProductId : 00432-70000-00001-AA416
DigitalProductId : {164, 0, 0, 0...}
DigitalProductId4 : {248, 4, 0, 0...}
InstallTime : 133540451065555457
PSPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT
PSChildName : CurrentVersion
PSDrive : HKLM
PSProvider : Microsoft.PowerShell.Core\Registry

Full Output With -DebugMode

No response

[Request]: -NoExit argument

Describe the feature or improvement you're requesting

Hello! We know that when restarting in conhost from the terminal with -ForceClose param, the script window automatically closes after completion.

Now I'm see that this behavior exists even in normal mode without a restarting with -ForceClose param. So for example this won't work:

test.ps1

&([ScriptBlock]::Create((irm https://raw.githubusercontent.com/uffemcev/winget-install/master/winget-install.ps1))) -Force; dir; pause

Perhaps it makes sense to add a -NoExit param that would disable automatic exit after completion.

Of course, this still probably won't work after restarting from Terminal in Conhost with -ForceClose param, but the script warns about this, so it's okay.

Additional context

No response

does not work on server 2019 ( but it should )

Thank you for this. Great and very helpful. Any idea why it does not work for server 2019 as-is? ( It should .. )
BTW the following GIST from @likamrat (Lior Kamrat) does work for server 2019 also.

https://gist.github.com/likamrat/cae833a6e5b3461709f14c093c21c293

But I don't like his use of the "https://store.rg-adguard.net/api/GetFiles" to get some of the downloads ... I thought I post it here in case it helps you figure out why yours does not work on server 2019?

[Bug]: current setup will not work inside winrm.

Checklist

  • I have performed the steps in the Troubleshooting section and confirm that the issue only occurs with this script.

  • I have restarted my computer to confirm this is not a transitory problem.

  • I have verified that I am using the latest version of winget-install.

  • I have verified that this issue is NOT security related (please create security advisory if so).

  • I have run the script with the -DebugMode argument and included the output below

What You Are Seeing?

While winget will install with this script with winrm. it is not useable.
any attempt to use winget via winrm will be unable to actually update source lists & unable to accept any source agreement.

someone documented an alternative method of setup here: microsoft/winget-cli#256 (comment)

it would be nice if this method could be included in the winget-install script as an alternative install method flag for people wanting to use winget via winrm.

System Details

windows 2k22 server latest

issue detected when setting up an os with packer which uses winrm to manage the VM its building out

Additional Context

No response

Full Output With -DebugMode

due to the packer setup its quite difficult for me to get these logs as the build fails and the VM is deleted

[Bug]: one-liner and conhost issue

What You Are Seeing?

Hello again! :)

So if i use iex "& { $(iwr asheroto.com/winget) } -Force -ForceClose" command in Windows Terminal it's restarting in conhost and then it's immediately crash with error: there are no terminator "@>" in multiline comments. I can only assume that the problem is formatting, but I'm not sure.

In otherside there is no problem with &([ScriptBlock]::Create((irm asheroto.com/winget))) -Force -ForceClose command.

Video and photo examples. Is it the same for you?

System Details

Script verson 3.2.2
Windows 11 22H2
UAC disable
Powershell 5.1
Run as administrator

Suggestion to always get the newest version of winget from github

function getNewestLink($match){
$uri = "https://api.github.com/repos/microsoft/winget-cli/releases"
Write-Verbose "[$((Get-Date).TimeofDay)] Getting information from $uri"
$get = Invoke-RestMethod -uri $uri -Method Get -ErrorAction stop
Write-Verbose "[$((Get-Date).TimeofDay)] getting latest release"
$data = $get[0].assets | Where-Object name -Match $match
return $data.browser_download_url
}

$wingetUrl=getNewestLink("msixbundle")
$wingetLicenseUrl=getNewestLink("License1.xml")

[Feature request]: Automation of closing conflicting processes during installation

What You Are Seeing?

Hello again. This time I had a problem during installation: "The modified resources are in use. Try closing Windows Terminal/PowerShell/Command Prompt and try again." This problem affects many other applications that interfere with installation: store, notepad, webexperience, and so on. These processes often hang in the background and have to be closed through the task manager. Restarting the PC does not always help.

Example

ПРЕДУПРЕЖДЕНИЕ: Resources modified are in-use. Try closing Windows Terminal / PowerShell / Command Prompt and try again.
ПРЕДУПРЕЖДЕНИЕ: If the problem persists, restart your computer.
Add-AppxPackage : Сбой развертывания с HRESULT: 0x80073D02, Не удалось установить пакет, так как изменяемые им ресурсы в настоящее время используются.

Ошибка 0x80073D02: не удалось выполнить установку, так как требуется закрыть следующие приложения: Microsoft.WindowsNotepad_11.2307.27.0_x64__8wekyb3d8bbwe MicrosoftWindows.Client.WebExperience_423.23500.0.0_x64__cw5n1h2txyewy.

ПРИМЕЧАНИЕ. Чтобы получить дополнительные сведения, найдите [ActivityId] 9eea3719-0014-000a-9100-eb9e1400da01 в журнале событий или введите в командной строке Get-AppxLog -ActivityID 9eea3719-0014-000a-9100-eb9e1400da01.

строка:680 знак:9
+ Add-AppxPackage $url -ErrorAction Stop
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (http://tlu.dl.d...q2KJ%2fSg%3d%3d:String) [Add-AppxPackage], Exception
+ FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand

I would like to suggest using the "-ForceApplicationShutdown" parameter with all Add-AppxPackage cmdlets to automatically shut down conflicting processes. More about this: https://learn.microsoft.com/en-us/powershell/module/appx/add-appxpackage?view=windowsserver2022-ps#-forceapplicationshutdown

What do you think about this?

System Details

Script verson 3.1.1
Windows 11 22H2
UAC disable
Powershell 5.1
Run as administrator

[Bug]: Fails during Registering step

Checklist

  • I have performed the steps in the Troubleshooting section and confirm that the issue only occurs with this script.

  • I have restarted my computer to confirm this is not a transitory problem.

  • I have verified that I am using the latest version of winget-install.

  • I have verified that this issue is NOT security related (please create security advisory if so).

  • I have run the script with the -DebugMode argument and included the output below

What You Are Seeing?

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

Registering

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

Add-AppxPackage : Deployment failed with HRESULT: 0x80073CF3, Package failed updates, dependency or conflict validation.
Windows cannot install package Microsoft.DesktopAppInstaller_1.22.10582.0_x64__8wekyb3d8bbwe because this package depends on a framework that could not be found. Provide the framework
"Microsoft.UI.Xaml.2.8" published by "CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US", with neutral or x64 processor architecture and minimum version
8.2310.30001.0, along with this package to install. The frameworks with name "Microsoft.UI.Xaml.2.8" currently installed are: {}
NOTE: For additional information, look for [ActivityId] f6859c66-6b2d-0006-36da-85f62d6bda01 in the Event Log or use the command line Get-AppPackageLog -ActivityID
f6859c66-6b2d-0006-36da-85f62d6bda01
At C:\Program Files\WindowsPowerShell\Scripts\winget-install.ps1:829 char:13
+             Add-AppxPackage -RegisterByFamilyName -MainPackage Micros ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (Microsoft.Deskt...r_8wekyb3d8bbwe:String) [Add-AppxPackage], IOException
    + FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageComman

System Details

Windows 10 Pro x64 22H2

Additional Context

Just started 2/27/24.

Full Output With -DebugMode

`Name Value


PSVersion 5.1.19041.3803
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.3803
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Name : ConsoleHost
Version : 5.1.19041.3803
InstanceId : 6b9ff3ac-41c9-49c1-be6b-d61ef09a6d4a
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace

winget-install 4.0.2
To check for updates, run winget-install -CheckForUpdate
VERBOSE: Perform operation 'Enumerate CimInstances' with following parameters, ''namespaceName' = root\cimv2,'className' = Win32_OperatingSystem'.
VERBOSE: Operation 'Enumerate CimInstances' complete.

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

Prerequisites

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

Downloading VCLibs...
VERBOSE: GET https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx with 0-byte payload
VERBOSE: received 6764349-byte response of content type application/octet-stream
Downloading UI.Xaml...
VERBOSE: GET https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.7.3/Microsoft.UI.Xaml.2.7.x64.appx with 0-byte payload
VERBOSE: received 5070706-byte response of content type application/octet-stream

##########

winget

##########

VERBOSE: GET https://api.github.com/repos/microsoft/winget-cli/releases with 0-byte payload
VERBOSE: received 449422-byte response of content type application/json; charset=utf-8
Downloading winget license...
VERBOSE: GET https://github.com/microsoft/winget-cli/releases/download/v1.7.10582/5e4a105df01840b0bbf00985e4f57c1e_License1.xml with 0-byte payload
VERBOSE: received 2688-byte response of content type application/octet-stream
Downloading winget...
VERBOSE: GET https://aka.ms/getwinget with 0-byte payload
VERBOSE: received 258178004-byte response of content type application/octet-stream
Installing winget and its dependencies...
VERBOSE: Target Image Version 10.0.19045.3803

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

Complete

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

winget installed successfully.
Checking if winget is installed and working...

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

Registering

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

Add-AppxPackage : Deployment failed with HRESULT: 0x80073CF3, Package failed updates, dependency or conflict validation.
Windows cannot install package Microsoft.DesktopAppInstaller_1.22.10582.0_x64__8wekyb3d8bbwe because this package depends on a framework that could not be found. Provide the framework
"Microsoft.UI.Xaml.2.8" published by "CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US", with neutral or x64 processor architecture and minimum version
8.2310.30001.0, along with this package to install. The frameworks with name "Microsoft.UI.Xaml.2.8" currently installed are: {}
NOTE: For additional information, look for [ActivityId] f6859c66-6b2d-0006-07de-85f62d6bda01 in the Event Log or use the command line Get-AppPackageLog -ActivityID
f6859c66-6b2d-0006-07de-85f62d6bda01
At C:\Program Files\WindowsPowerShell\Scripts\winget-install.ps1:829 char:13

  •         Add-AppxPackage -RegisterByFamilyName -MainPackage Micros ...
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : WriteError: (Microsoft.Deskt...r_8wekyb3d8bbwe:String) [Add-AppxPackage], IOException
    • FullyQualifiedErrorId : DeploymentError,Microsoft.Windows.Appx.PackageManager.Commands.AddAppxPackageCommand

VERBOSE: Operation completed for: Microsoft.DesktopAppInstaller_8wekyb3d8bbwe
winget command registered successfully.`

[Feature request]: Initializing winget without rebooting

What You Are Seeing?

Hello, it's me again! :)
After running the script on a freshly installed system I get this result:

Log Checking if winget is installed and working...

ПРЕДУПРЕЖДЕНИЕ: winget is installed but is not detected as a command. Try using winget now. If it doesn't work, wait about 1 minute and try again (it is sometimes delayed). Also try restarting your computer.

ПРЕДУПРЕЖДЕНИЕ: If you restart your computer and the command still isn't recognized, please read the Troubleshooting section
of the README: https://github.com/asheroto/winget-install#troubleshooting

ПРЕДУПРЕЖДЕНИЕ: Make sure you have the latest version of the script by running this command: winget-install -CheckForUpdate

PS C:\Users\uffemcev> winget
winget : Имя "winget" не распознано как имя командлета, функции, файла сценария или выполняемой программы. Проверьте правильность написания имени, а также наличие и правильность пути, после чего повторите попытку.
строка:1 знак:1
+ winget
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (winget:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Even after installation via a script winget is still not initialized in the system. The problem can be solved by restarting the PC, but there is another way to solve this. Microsoft suggests using this command: Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe

After this the winget is ready for work instantly. So what do you think about this?

System Details

Script verson 3.0.1
Windows 22H2
UAC disable
Powershell 5.1
Run as administrator

Check if WinGet is installed

Would be nice to add some code to get if WinGet is installed - and if so is it the latest version.

If WinGet is installed, and it's the latest version, just write it and exit.
If not installed or not latest version install/update.

[Bug]: default terminal application and powershell x86 issue

What You Are Seeing?

Another day - another bug :)

If i set default terminal application as windows terminal and run windows powershell (x86) so Get-CurrentProcessModuleName function will stop working because MainModule and Modules fields are empty. Is it the same for you?

I think function must check several properties at once, but not only MainModule.

bug example
Windows PowerShell
(C) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.

Установите последнюю версию PowerShell для новых функций и улучшения! https://aka.ms/PSWindows

PS C:\Users\uffemcev> function Get-CurrentProcessModuleName {
>>     <#
>>         .SYNOPSIS
>>             Gets the module name of the current PowerShell process.
>>
>>         .DESCRIPTION
>>             This function retrieves the window title of the current PowerShell host, finds the corresponding process, and returns the name of the main module of that process without the file extension.
>>
>>         .EXAMPLE
>>             $processName = Get-CurrentProcessModuleName
>>             This example shows how to use the function to get the module name of the current process and store it in a variable.
>>
>>         .NOTES
>>             This function assumes that the window title is unique to the current PowerShell session. If multiple windows have the same title, the function may not behave as expected.
>>     #>
>>
>>     $windowTitle = $host.ui.RawUI.WindowTitle
>>     $currentProcess = Get-Process | Where-Object { $_.MainWindowTitle -eq $windowTitle }
>>     $moduleNameWithExtension = $currentProcess.MainModule.ModuleName
>>     $moduleNameWithoutExtension = [System.IO.Path]::GetFileNameWithoutExtension($moduleNameWithExtension)
>>     return $moduleNameWithoutExtension
>> }
PS C:\Users\uffemcev> Get-CurrentProcessModuleName

PS C:\Users\uffemcev> $windowTitle = $host.ui.RawUI.WindowTitle
PS C:\Users\uffemcev> $currentProcess = Get-Process | Where-Object { $_.MainWindowTitle -eq $windowTitle }
PS C:\Users\uffemcev> $currentProcess

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
    809      43    92712      82484       0,08  11388   1 WindowsTerminal


PS C:\Users\uffemcev> $currentProcess | format-list *


Name                       : WindowsTerminal
Id                         : 11388
PriorityClass              : Normal
FileVersion                :
HandleCount                : 809
WorkingSet                 : 84463616
PagedMemorySize            : 94937088
PrivateMemorySize          : 94937088
VirtualMemorySize          : -1
TotalProcessorTime         : 00:00:00.0937500
SI                         : 1
Handles                    : 809
VM                         : 4294967295
WS                         : 84463616
PM                         : 94937088
NPM                        : 44152
Path                       :
Company                    :
CPU                        : 0,09375
ProductVersion             :
Description                :
Product                    :
__NounName                 : Process
BasePriority               : 8
ExitCode                   :
HasExited                  : False
ExitTime                   :
Handle                     : 3440
SafeHandle                 : Microsoft.Win32.SafeHandles.SafeProcessHandle
MachineName                : .
MainWindowHandle           : 1574456
MainWindowTitle            : Администратор: Windows PowerShell (x86)
MainModule                 :
MaxWorkingSet              : 1413120
MinWorkingSet              : 204800
Modules                    :

System Details

Script verson 3.2.2
Windows 11 22H2
UAC disable
Powershell 5.1
Run as administrator

Does this work on Server 2019/2022?

I tried this on Server 2019 and all the steps completed successfully, but winget is not recognized as a command. I believe Winget should be located at "C:\Program Files\WindowsApps" but that folder does not exist. Winget isn't officially supported for Server OSes, but there are workarounds and just want to confirm your script will accommodate the workarounds for servers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.