psutils
psutils copied to clipboard
[sudo] Command is incorrectly parsed when calling a .NET function
When calling a .NET function, sudo will incorrectly pass the command to the administrator instance, removing some characters.
Steps to reproduce:
PS> sudo [Environment]::SetEnvironmentVariable('Path', $value, 'Machine')
ParserError:
Line |
1 | [Environment]::SetEnvironmentVariable Path, 'C:\Users\bruno\desktop\D …
| ~~~~
| Unexpected token 'Path' in expression or statement.
sudo removed the parenthesis, as well as the quotes on Path, causing the command to be syntactically incorrect.