Page 1 of 1

Shutdown computer in LAN help

Posted: 22 Oct 2012 05:19
by joakim
Hi, im trying to shudown computers in a LAN but its not working, in administrator.

first i open cmd and type : net view to get a list of the computers in the LAN

then i ping the computer i want to shutdown,

then i type: shutdown -i

i select the computer i want to shutdown by writing the name of it when press shutdown but its only shutdowns my computer :(

Re: Shutdown computer in LAN help

Posted: 22 Oct 2012 05:25
by abc0502
Shutdown command is like this:
shutdown -s -f -m \\computer_name -t 30 -c comment


The compute name is what you are missing, the GUI not working on my pc ?? but this should work if you have administrator access to the pc


Edit:
BTW, It never worked with me whether i have admin rights or not :?

Re: Shutdown computer in LAN help

Posted: 22 Oct 2012 06:20
by Boombox
.

Code: Select all

wmic /node:"COMPUTERNAME" /user:REMOTEUSERNAME /password:REMOTEPASSWORD process call create "cmd.exe" /c shutdown -s -t 0


Or automate it a little...

Code: Select all

@echo off
:main
set "netnode="
set "remuser="
set "rempass="
cls

for /f "tokens=1 delims=\" %%g in ('net view ^| findstr "\\"') do (
ping -4 -n 1 %%g | findstr "Pinging">>netview.txt)

echo.
echo   Network Computers
echo   -----------------
for /f "tokens=2,3" %%g in (netview.txt) do echo   %%g %%h& del netview.txt
echo   -----------------

echo.
echo   Which computer?
set /p netnode=
echo.
echo   Username at remote location?
set /p remuser=
echo.
echo   Password of remote user?
set /p rempass=

:error
cls
echo.
echo   Network Computer: %netnode%...
echo.
echo   1 to shutdown, or 2 to restart...?

set /p option=
if %option%==1 goto shutdown
if %option%==2 goto restart
goto error

:restart
wmic /node:"%netnode%" /user:%remuser% /password:%rempass% process call create "cmd.exe" /c shutdown -r -t 0

:shutdown
wmic /node:"%netnode%" /user:%remuser% /password:%rempass% process call create "cmd.exe" /c shutdown -s -t 0

goto main


Any Dos command can replace 'shutdown -r -t 0'.

Code: Select all

wmic /node:"%netnode%" /user:%remuser% /password:%rempass% process call create "cmd.exe" /c systeminfo>>(YOUR NETSHARE)



NOTE: WMIC WILL NOT WORK REMOTELY, IF THE REMOTEUSER HAS NO PASSWORD!