Answer the question
In order to leave comments, you need to log in
Alternative to sudo/su for Windows?
On Windows, I did not find an option that allows you to run cmd/powershell as an administrator, knowing the administrator password. In the GUI interface, you can right-click on the shortcut and select "Run as administrator".
And how to do the same by connecting via telnet / ssh? What are the alternatives for su/sudo on Windows and Windows Server?
Answer the question
In order to leave comments, you need to log in
Windows has a runas mechanism to run a process as a different user. Nothing needs to be added.
Registry setting:
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
With PowerShell local, everything is quite simple, for example:
Start-Process "C:\Program Files\PowerShell\7\pwsh.exe" -Verb runAs -WorkingDirectory c:\ -wait
With a remote computer, everything is somewhat more complicated
1. On a remote computer, run
Set -Item -Path WSMan:\localhost\Client\TrustedHosts -Value ''
Instead, you can put and * but it is fraught with you understand what ...
2. On the local run Invoke-Command -ComputerName $hostname -ScriptBlock { Your script is here } - Credential $hostname\ladmin | Format List
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question