Shutdown a PC on LAN from another PC using a batch file in Windows 7
45,808
Solution 1
Yes, you can use the /m
switch for shutdown
like this
shutdown /s /m \\computer1 /t 0
Solution 2
Call the shutdown command from a batch running as a user with the correct permissions or use psshutdown.
Solution 3
Easiest way:
set computertoshutdown=COMPUTERNAME
set timetoshutdown =TIMEtoSHUTDOWN
set message=MESSAGE
shutdown -s -m \\%computertoshutdown% -t %timetoshutdown% -c "%message%"
Author by
Amith
Updated on July 09, 2022Comments
-
Amith almost 2 years
I'm just interested in knowing: can we shutdown a PC from another PC using a batch file if both are on the same LAN?
-
Amith almost 12 yearsshutdown -s -t 2 is the code that shut down my pc. i want to shutdown another pc from my PC.
-
Alex K. almost 12 years
/m \\<ComputerName>
: Specifies the target computer -
Amith almost 12 yearsshutdown -s /m \\ amith-016 -t 2 i use this code but it is not working
-
Alex K. almost 12 yearsWell you cant just randomly shut down a computer on the network.. that would cause problems. You need to run the command under a user with the correct permissions - e.g. an admin on the target pc or pass the credentials to psshutdown