Fix WinUtil's self-elevation when running winutil.ps1 without administrator #2823
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
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:Changes
Summary
scripts\start.ps1
to useInvoke-RestMethod <url> -OutFile <file_path>
instead ofInvoke-RestMethod <url>
.scripts\start.ps1
to fix theStart-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.
Command:
.\winutil.ps1 -Config "C:\Users\#####\Documents\Configs\winutil.json"
Result: WinUtil launches successfully and imports my config with no errors.
Remote Execution
Command:
iex "& { $(irm http://127.0.0.1:4300/winutil.ps1) }"
:Result: WinUtil launches successfully with no errors.
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.
Impact
Windows PowerShell/PowerShell Core running in Windows Terminal
.Windows PowerShell/PowerShell Core running as a standalone app
.-Run
,-Config
, and-Debug
correctly.Issues related to PR
Additional Information
None.
Checklist