If you want to run a command as admin on PowerShell on Windows, you can write something like this:
Start-Process foo -Verb RunAs -ArgumentList '...'
But it is not possible on Linux. Powershell will return you the following error: Start-Process: The parameter '-Verb' is not supported for the cmdlet 'Start-Process' on this edition of PowerShell.
Indeed, According to the Powershell online documentation, "the [-Verb] parameter does not apply for non-Windows systems", so it is not possible to run Powershell as admin like this on Linux.
My question is simple: how to elevate Powershell privileges on Linux? How can I simulate BASH's sudo ...
with Powershell on Linux? I know that you can make a workaround with bash and some thing like sudo pwsh -Command '...'
, but I am looking for a "100% PowerShell" way to do this.
Thanks in advance for your responses.
PS: By "PowerShell", I mean "PowerShell 7", the latest one.