How can I elevate Powershell while keeping the current working directory AND maintain all parameters passed to the script?
Note: On 15 Nov 2021 a bug was fixed in the code below in order to make it work properly with advanced scripts – see this answer for details. The closest you can get to a robust, cross-platform self-elevating script solution that supports: both positional (unnamed) and named arguments while preserving type fidelity within the … Read more