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

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

Closed
5 tasks done
ITJamie opened this issue Nov 21, 2023 · 5 comments
Closed
5 tasks done

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

ITJamie opened this issue Nov 21, 2023 · 5 comments
Assignees

Comments

@ITJamie
Copy link

ITJamie commented Nov 21, 2023

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

@asheroto
Copy link
Owner

Hello,

any attempt to use winget via winrm will be unable to actually update source lists & unable to accept any source agreement.

Can you please provide a few examples/commands or screenshots?

Without the logs I'm not sure at what point the script fails. The script your provided is essentially what this script does at some point, it's similar but not quite the exact same.

Can you please try to get the script output? You can call the script and get the script output by doing this...

&([ScriptBlock]::Create((irm asheroto.com/winget))) -Force -DebugMode *> C:\winget-install.log

which will save the log to c:\winget-install.log in text format.

Or if you have the script locally you can just append *> c:\winget-install.log (space before the *) and it will output to that location as well.

@ITJamie
Copy link
Author

ITJamie commented Nov 24, 2023

Sorry just to clarify. The install script works and installs, however winget is currently not possible to run via winrm when it's installed in the standard layout. So while the install works its just not usable from winrm

The link above shows an alternate method of install that puts all of the winget requirements into a single directory which then allows winget to run and install packages from winrm.

So my request is to have a flag in the winget install script to install winget in the alternative fashion of having all the requirements in one folder and update the windows path.

@asheroto
Copy link
Owner

asheroto commented Nov 27, 2023

Ah I see. I'm trying to figure out what the difference is in the script. Maybe I can just add a line or two.

It looks like it operates the same as the script in the link you mentioned, but it does not do this...

cmd /c setx /M PATH "%PATH%;$ENV:PROGRAMFILES\WinGet"

Can you check on your winrm instance and see if winget is installed to that folder and this command corrects the issue after running this script?

I'm thinking maybe it's the setx because that changes the path.

@asheroto
Copy link
Owner

Hello,

We you able to fix the issue with that command?

If that fixes it, I can add it to the script pretty quick.

@asheroto
Copy link
Owner

I tried to reproduce the issue but was unable to. After running the installation command and then winget-install the installation succeeded. If you cannot use winget it may be due to an environmental setup. Try exiting winrm and then re-entering.

Closing the issue now but if you have more information I can re-open it.

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

No branches or pull requests

2 participants