Re:Sudo for Windows
by debugnik on Thursday February 08, 2024 @08:00PM
(#39310049)
Also 'start -Verb runas' in Powershell.
[ Parent
| on HN ]
Is there anything shorter than `powershell.exe -executionpolicy unrestricted -file`?
powershell.exe -executionpolicy unrestricted -file ./setup_windows.ps1 -InstallPSWindowsUpdate -UpdateWindows -UpdateChocoPackages
setup_windows.ps1:
https://github.com/westurner/dotfiles/blob/develop/scripts/s...The executionpolicy merely allows you to write unsigned scripts. Not that it runs them elevated.
Re:Sudo for Windows
by jodrellblank on Friday February 09, 2024 @10:03PM
(#39323164)
powershell.exe -executionpolicy unrestricted -file ./setup_windows.ps1 -InstallPSWindowsUpdate -UpdateWindows -UpdateChocoPackages
powershell -ex bypass -f ./setup_windows.ps1 -I -UpdateW -UpdateC
(or whatever are short enough to uniquely identify parameter names for your script)Thx
Re:Sudo for Windows
by janosdebugs on Friday February 09, 2024 @01:31AM
(#39312043)
I really hope that sudo is going to allow one to capture the output of the thing running in sudo and handle errors better. I recently wrote an installer script in PowerShell and had to go through severe contortions to support privilege elevations for only a minimal part of the script. I needed to use start with runas to relaunch the same script with different options to continue the installation process and there's not much in the way of proper error handling either.