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

Fix WinUtil's self-elevation when running winutil.ps1 without administrator #2823

Closed

Conversation

Cryostrixx
Copy link
Contributor

@Cryostrixx Cryostrixx commented Sep 25, 2024

Contributor Note

I decided to close this PR because, after waiting a significant period without any feedback or review, it became clear that my contributions weren't valued. Seeing other PRs prioritized over mine reinforced this feeling, and I’ve chosen to step away from contributing. I hope the review process improves to be more inclusive of all contributors, regardless of their contributor status.
PR status: Permanently closed and won't be reopened. Reason: The head repository has been deleted and won't be restored.

Type of Change

  • New feature
  • Bug fix
  • Documentation update
  • Refactoring
  • Hotfix
  • Security patch
  • UI/UX improvement

Description

Problem

WinUtil Stable currently doesn't launch correctly when run as a non-elevated user.
The following error occurs when running irm https://christitus.com/win | iex without elevation:
WinUtil Stable Launch Issue

Changes

Summary

  • Updated scripts\start.ps1 to use Invoke-RestMethod <url> -OutFile <file_path> instead of Invoke-RestMethod <url>.
  • Updated scripts\start.ps1 to fix the Start-Process command; it will now handle the launch arguments correctly for:
    • Windows Terminal
    • Windows PowerShell
    • PowerShell Core

Testing

I conducted thorough testing using both local execution and remote execution.
For remote execution, I used npm's http-server package to serve the script's directory with the following command:
http-server -p 4300 -c-1 C:\Users\#####\NoSync\Projects\Cryostrixx\forks\winutil.

Results

Local Execution

Command: .\winutil.ps1
Result: WinUtil launches successfully with no errors.
WinUtil Local Command Test - Without Arguments

Command: .\winutil.ps1 -Config "C:\Users\#####\Documents\Configs\winutil.json"
Result: WinUtil launches successfully and imports my config with no errors.
WinUtil Local Command Test - With Arguments

Remote Execution

Command: iex "& { $(irm http://127.0.0.1:4300/winutil.ps1) }":
Result: WinUtil launches successfully with no errors.
WinUtil Remote Command Test - Without Arguments

Command: iex "& { $(irm http://127.0.0.1:4300/winutil.ps1) } -Config 'C:\Users\#####\Documents\Configs\winutil.json'"
Result: WinUtil launches successfully and imports my config with no errors.
WinUtil Remote Command Test - With Arguments

Impact

  • Corrected the launch arguments handling to facilitate smoother launching of WinUtil using the appropriate process:
    • Windows PowerShell/PowerShell Core running in Windows Terminal.
    • Windows PowerShell/PowerShell Core running as a standalone app.
  • Corrected the launch arguments handling to allow passing the arguments -Run, -Config, and -Debug correctly.

Issues related to PR

Additional Information

None.

Checklist

  • My code adheres to the project's coding and style guidelines.
  • I have performed a self-review of my own code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no errors/warnings/merge conflicts.

@Cryostrixx Cryostrixx closed this Sep 29, 2024
@Cryostrixx Cryostrixx deleted the fix-start-ps1-admin-elevation branch September 29, 2024 02:30
@Cryostrixx Cryostrixx restored the fix-start-ps1-admin-elevation branch September 29, 2024 19:07
@Cryostrixx Cryostrixx deleted the fix-start-ps1-admin-elevation branch September 29, 2024 19:08
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

Successfully merging this pull request may close these issues.

admin Elevation
1 participant