Solved

restart servers in list

Posted on 2014-12-19
8
155 Views
Last Modified: 2014-12-20
i have a list of servers in "servers_list.txt" file. how can i trigger restart all the servers in list from a server in network.
0
Comment
Question by:naveen mullaguri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 4

Expert Comment

by:Kent Fichtner
ID: 40509081
I am sure you can do this with a program but the best idea I have is the shutdown command in windows.  you would just take the text document and make it a batch file adding the following:

shutdown /r /t 0 /m \\<computer1>
shutdown /r /t 0 /m \\<computer2>
shutdown /r /t 0 /m \\<computer3>

that should work.
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40509100
On a administrative command prompt:

for /f %f in (servers_list.txt) do @echo shutdown /r /t 0 /m "%f"

(test mode - remove echo in above line for real)

In a batch file:

for /f %%f in (servers_list.txt) do @echo shutdown /r /t 0 /m "%%f"

(put in same folder as .txt file and call from administrative command prompt)
0
 
LVL 17

Expert Comment

by:Emmanuel Adebayo
ID: 40509107
You can use psshutdown You can download from MS technet link below

http://technet.microsoft.com/en-gb/sysinternals/bb897541.aspx

Command usage

Go to the directory where you have the executable and run the following

psshutdown.exe -r -f -c -t 60  @servers_list.txt

Not that the servers_list.txt must be in the same directory as the executable is other wise you have to use the full path with @

Hope this helps
0
WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

 

Author Comment

by:naveen mullaguri
ID: 40510529
@Gerwin


i got the restart usage error as attached. please advise.
restart-error.gif
0
 
LVL 38

Accepted Solution

by:
Gerwin Jansen, EE MVE earned 500 total points
ID: 40510544
Look at the 'usage' message that you get from the shutdown command. You are not putting the machine name (from your servers.txt file) after the /m parameter.

Besides that: for testing do as I suggested leaving the echo command in there. Are you running this from a batch file? I cannot see that from the screenshot you posted, if so then you have to use %%f instead of %f (see above as well).

Your shutdown line would have to be like this if in a batch file:
for /f %%f in (d:\cognos_server_restart\servers_list.txt) do echo shutdown /r /m "%%f" /t 120 /d p:2:17 /c "Your comment"

Open in new window


If you leave the echo in, you will see the command that would be sent, including the server name(s) that you are about to restart.

Your server.txt file should look like this:

Server1
Server2
Server3

etc.

What do your server names look like?
0
 
LVL 25

Expert Comment

by:Lionel MM
ID: 40510712
for /f %%f in (d:\cognos_server_restart\servers_list.txt) do echo shutdown /r /m "%%f" /t 120 /d p:2:17 /c "Your comment"

I would only add to force a shutdown                            
for /f %%f in (d:\cognos_server_restart\servers_list.txt) do echo shutdown /r / f /m "%%f" /t 120 /d p:2:17 /c "Your comment"

also you did run the command froma dos prompt--the above will work if in a batch file but if you run it from a dos prompt, the command line you must remove one of the %'s like this--from %% to just %
for /f %f in (d:\cognos_server_restart\servers_list.txt) do echo shutdown /r / f /m "%f" /t 120 /d p:2:17 /c "Your comment"
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 40510716
@lionelmm - I already mentioned twice about single % our double %% - you are repeating what has been said already...
0
 

Author Closing Comment

by:naveen mullaguri
ID: 40511343
thank you so much
0

Featured Post

Optimum High-Definition Video Viewing and Control

The ATEN VM0404HA 4x4 4K HDMI Matrix Switch supports 4K resolutions of UHD (3840 x 2160) and DCI (4096 x 2160) with refresh rates of 30 Hz (4:4:4) and 60 Hz (4:2:0). It is ideal for applications where the routing of 4K digital signals is required.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article summaries thoughts and ideas from two years of sustained use. It provides good reasoning to make the jump to Windows 10.
Windows 10 Creator Update has just been released and I have it working very well on my laptop. Read below for issues, fixes and ideas.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question