4 ms·
Also 'start -Verb runas' in Powershell.
by debugnik 3y ago
Also 'start -Verb runas' in Powershell.
- westurner 3y agoIs 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/setup_windows.ps1 https://github.com/westurner/dotfiles/blob/develop/scripts/s...
- jve 3y agoThe executionpolicy merely allows you to write unsigned scripts. Not that it runs them elevated.
- jodrellblank 3y agopowershell.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)
- westurner 3y agoThx
- janosdebugs 3y agoI 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.