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

Does this work on Server 2019/2022? #4

Closed bscheewe closed 1 year ago

bscheewe commented 1 year ago

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.

daryltucker commented 1 year ago

This works for Windows Server 2022 Datacenter.

PowerShell:

Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted
Install-Script -Name winget-install
winget-install

CMD:

winget install --id=Microsoft.WindowsTerminal -e
asheroto commented 1 year ago

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.

Sorry I just saw this. It should add the correct folder to your PATH environmental variable. You may have to restart on older OS's.

daryltucker commented 1 year ago

@asheroto Have you tried Windows Server 2019 Datacenter ? Even after a reboot...

CMD:

C:\Windows\system32>winget install --id=Microsoft.WindowsTerminal -e
'winget' is not recognized as an internal or external command,
operable program or batch file.

PowerShell:

PS C:\Windows\system32> winget install --id=Microsoft.WindowsTerminal -e
winget : The term 'winget' 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 line:1 char:1
+ winget install --id=Microsoft.WindowsTerminal -e
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (winget:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

This directory is empty in 2019, where 2022 has the executable: $env:APPDATA\Local\Microsoft\WindowsApps

PS C:\Windows\system32> winget-install
###################################
# Downloading Xaml nupkg file... (19000000ish bytes)
###################################
###################################
# Extracting appx file from nupkg file...
###################################
###################################
# 64-bit OS detected
###################################
###################################
# Downloading & installing x64 VCLibs... (21000000ish bytes)
###################################
###################################
# Installing x64 XAML...
###################################
###################################
# Downloading winget... (21000000ish bytes)
###################################
###################################
# Installing winget...
###################################

Path          :
Online        : True
RestartNeeded : False

###################################
# Adding WindowsApps directory to PATH variable for current user...
###################################
###################################
# Cleaning up...
###################################
###################################
# Installation complete!
###################################
###################################
# Please restart your computer to complete the installation.
###################################

I understand you wrote this installer, and not winget itself, but curious if you have any suggestions.

asheroto commented 1 year ago

I tested it in a new instance of Server 2019 and experienced the same problems. So unfortunately it must not work on Server 2019.

FYI Microsoft Windows Terminal doesn't either. :-/