A
A
Alexander2020-12-22 08:23:01
Computer networks
Alexander, 2020-12-22 08:23:01

How to set a password in a bat file for the runas /user:Admin command?

Good afternoon!
There is a bat file that would like to restart the computer on the local network.
If you write it like this:
shutdown -r -f -t 0 -m \\MY-PC
Answer:
Access is denied. (5)
And if you try just like this:
runas /user:Admin "shutdown -r -f -t 0 -m \\MY-PC"
Then displays "Enter the password for Admin".
I know the password, but for some reason I can't enter it into the console window.
How can I write the password in the bat file?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
martrr, 2020-12-22
@martrr

Try admilink.ru/admilink.htm for a great solution to run as administrator.

A
Alexander, 2020-12-22
@StupidQuestion

psexec \\192.168.1.1 cmd /c shutdown /r /t 0

K
Korben5E, 2020-12-24
@Korben5E

where I'm too lazy to make a domain, I added a user to each computer - myself and transferred it to a service user.
the downside is that if you change your password at home, you have to change the password on all other computers manually.
PS: the domain is still better ... the way is even on samba

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question