G
G
Gleb868989642021-02-23 22:35:32
PowerShell
Gleb86898964, 2021-02-23 22:35:32

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

6 answer(s)
A
azarij, 2021-02-23
@azarij

https://www.google.com/search?q=%D0%90%D0%BB%D1%8C...

D
d-stream, 2021-02-23
@d-stream

psexec

E
Eugene, 2021-02-24
@zeond

Windows has a runas mechanism to run a process as a different user. Nothing needs to be added.

V
Vasily Bannikov, 2021-02-23
@vabka

scoop install sudo
(Not a joke)

R
res2001, 2021-02-24
@res2001

Registry setting:

reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f

disables the UAC action for remotely started processes. It must be installed on a PC on which applications will be remotely launched. A reboot is required after installation.
When it's installed and you run something remotely as an administrator on the remote computer, the program runs with real administrator rights, without the UAC filter.
For example, using the same psexec (or wmic) it will be possible to launch applications remotely.
Not sure if this will work for ssh and telnet, as the service server is running on a remote computer.

E
Eugene, 2021-03-07
@zloy_zaya

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 question

Ask a Question

731 491 924 answers to any question