Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 7161
  • Last Modified:

How to reboot 2003 Server from Command Prompt

Ok, I've asked this question before, but need to ask again b/c nothing seems to be working.

I have multiple 2003 servers, but there are two in particular that have Citrix Metraframe installed and from time to time they become unresponsive.  They can be pinged, and they can be reached via my computer management to check which services are running.  I can go to their advanced tab and do a shutdown by setting the action to: Restart and Force Apps Closed has been set to both NEver and Always (could lose data), but receive the WMI Error [Computer Management Properties] -> Error while trying to shutdcwn the computer: 15

I also try to RDP into them [FIRST] and receive this usual error message:
Remote Desktop Disconnected
The client could not establish a connection to the remote computer.
The most likely causes for this error are:
1)remote connections might be enabled at the remote computer - FALSE
2) The maximum number of connections was exceeded at the remote computer - FALSE [noone is able to log in]
3)A network error occurred while establishing the connection - NOPE

Someone suggested installed psshutdown from Sysinternals - www.sysinternals.com
 - I did, and it appears to work, when I enter the information into the command prompt: psshutdown.exe   \\YourComputerName   -r

C:\Documents and Settings\username>psshutdown \\citrix -r

PsShutdown v2.50 - Shutdown, logoff and power manage local and remote systems
Copyright (C) 1999-2005 Mark Russinovich
Sysinternals - www.sysinternals.com

CITRIX is scheduled to reboot in 00:00:20.

But the Server never reboots.

Someone else suggested these syntaxes:
shutdown \\yourservername /r /y /c
shutdown \\citrix /r /y /

when I attempt either of these i receive all of this:
C:\Documents and Settings\user>shutdown \\citrix /r /y /c
Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "c
omment"] [-d up:xx:yy]

        No args                 Display this message (same as -?)
        -i                      Display GUI interface, must be the first option
        -l                      Log off (cannot be used with -m option)
        -s                      Shutdown the computer
        -r                      Shutdown and restart the computer
        -a                      Abort a system shutdown
        -m \\computername       Remote computer to shutdown/restart/abort
        -t xx                   Set timeout for shutdown to xx seconds
        -c "comment"            Shutdown comment (maximum of 127 characters)
        -f                      Forces running applications to close without warning
        -d [u][p]:xx:yy         The reason code for the shutdown u is the user code
                                p is a planned shutdown code
                               xx is the major reason code (positive integer less than 256)
                                yy is the minor reason code (positive integer less than 65536)

So, I then attempt trying syntaxes like this [-i | -r] [-m \\citrix] but receive:
'[-i' is not recognized as an internal or external command, operable program or batch file. so i try w/out the brackets and still receive not recognized.

Does anyone out there know of a trick, where a network server can be rebooted remotely ** ESPECIALLY WHEN REMOTE DESKTOP CONNECTION ERROR appears?  It seems as though if the server can be pinged and reached via my computer management, there must be a way to get this thing restarted without actually having to go to the server and holding down the shutdown button.  There are times those of us in the IT dept have to drive out to the office after hours or on the weekend to just hold down the button, b/c ppl are trying to remote into these servers to get their work done.

We've been experiencing this problem for months, and nothing is resolving.  I'm posting 500 points here, but if someone can truly resolve this problem, I'll post a duplicate of this question w/500 pts, so you'll get 1000.

SO START THINKING EXPERTS!
0
mdmcq5
Asked:
mdmcq5
  • 15
  • 8
  • 5
  • +5
5 Solutions
 
LazarusCommented:
try:    shutdown -r -f -m \\SERVERNAME
0
 
LazarusCommented:
Let me know if that does not work. If it doesn't you have something else going on as well.
0
 
NJComputerNetworksCommented:
The problem is most likely that the server is hung and not longer has the ability to shut down.

I'm sure when the server is working properly, your remote shutdown methods work...  Have you tried to reboot or shut down the server when its not hung?  

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
mdmcq5Author Commented:
I was trying to add more to the question, but was denied, b/c you were posting.

If there are no problems w/the REMOTE connection and I type
C:\Documents and Settings\username>shutdown -i -l -r -f -m\\citrix
Succeeded: citrix

If REMOTE connection is down then i receive
C:\Documents and Settings\username>shutdown -i -l -r -f -m\\citrix
The device is not ready.
Failed: citrix

So, the syntaxes do work BUT ONLY IF REMOTE CONNECTIONS are running.  There must be a workaround!

If I'm able to connect to the server through my Computer Management you'd think I'd be able to restart whatever services is causing the Remote Desktop to become disconnected.
0
 
NJComputerNetworksCommented:
Did you ever try restarting the terminal services service when the server is hung?
0
 
NJComputerNetworksCommented:
You can find any other services that are no longer running on the hung server by looking at the services.... then simply sort the services by AUTOMATIC startup type...  Any services listed as AUTOMATIC startup type that is no longer STARTED, has failed.....try to restart any Automatic services that have stopped.

Although, I doubt that you will be able to restart these failed services...  you can always try...and see what happens...  

At least now, you have something to look for...
0
 
aalabertCommented:
Hello mdmcq5,

you didn't comment on the -f option of psshutdown. This means to force closing all processes. It's possible of course that the failing services still don't allow server to close, but the switch has helped me many times. So try:

psshutdown -r -f \\citrix
0
 
mdmcq5Author Commented:
NJComputerNetworks, we must have been posting at the same time before.  Yes, when all is well on the server, the remote shutdowns work fine.

I will try both of your suggestions the next time the server hangs.

NJComputerNetworks
Did you ever try restarting the terminal services service when the server is hung?

aalabert
psshutdown -r -f \\citrix

aalabert, any reason why your syntax order is different than mine?  Does it make a difference?
psshutdown \\citrix -r
I put the \\servername before the switches
0
 
aalabertCommented:
parameters first is official usage for psshutdown, but I'm not 100% sure if this matters.

Anyway using the -f switch is helpful sometimes, that was my point. If it's easy for you to check it out, then just give it a try.
0
 
mdmcq5Author Commented:
ok, i'll have to wait for the server to hang again, before I can let ya'll know if anything has worked...should be any hour now....
0
 
Jeff BeckhamEngineerCommented:
If the server is hanging to the point where you cannot connect to it via TS, then chances are good that remote shutdown commands won't work either.

You *might* be able to use psexec (another System Internals tool) to fire either the shutdown or psshutdown executables.

Lastly, if you're server is hanging like this and needs to be hard booted, you might be able to use a management card to reboot the server.  Examples are HP's ILO cards or Dell's Remote Access Card.
0
 
averybCommented:
Another solution would be Remotely Anywhere.  Use it extensively.  Similar to pcAnywhere but gives a lot more.  There have been times when holding the power button won't even shut down a server, but I can do a "Hard Reboot" with Remotely Anywhere without any problem.

Under $200 for one license. Free trial for 30 days.  Prefer is over using Remote Desktop in admin mode since RemotelyAnywhere connections are to the server console rather than initiating a new user connection.

What happens if you stop and start TS services using Computer Mgmt when it is hung?
0
 
NJComputerNetworksCommented:
You can use remote desktop to get console connection....

Type

start --> run

mstsc.exe /v:servername /console

No need to third party.... especially no need to 3rd party that costs money...  You can use tightVNC for free.
0
 
averybCommented:
What do you know.  All this time I had been messing up the command syntax.

How do you send a Ctrl Alt Del?

I've only used TIghtVNC as a remote control tool.  Didn't think it had all that remotely anywhere has to offer.

0
 
mdmcq5Author Commented:
NJComputerNetworks,
This is how I connect anyway, still doesn't work:
mstsc.exe /v:servername /console

I'll have to try checking all the Services that are supposed to be auto started and aren't appearing to be started the next time I'm unable to RDP into the server.  it happens rather frequently so give it a few hours....

And if I'm unable to RDP/MSTSC into a server, do you honestly think VNC would let me connect to reboot?
0
 
aalabertCommented:
rdp and vnc are independent of each other, so it could be easily that rdp is unresponsive but you still can vnc. But of course if you are in the middle of shutdown, I think you cant determine that vnc service be closed later than others, so the service can be shut down already when you try to connect to it...

BTW, I have had very similar symptons as you have, not with Citrix but just plain sever used for terminal services (30-40 users or so). It also became unresponsive from time to time. The users who had sessions open could work on , but new users couldn't connect anymore and even administrator (me) couldn't log on to physical console of the server. Probably something with Logon service, but also only button press did solve the situation.

After a while we found that it was caused by users copying files to terminal server hard drive from local disk (connect to local disk were enabled for user sessions). We couldn't solve this problem, but it got fixed with a service pack or patch from Microsoft.
0
 
davesneilsonCommented:
If all else fails - supermicro (and others)  have a "lights out module" that allows a server to be powered up and down remotely. Even if the server is off, it can be started. (We have just purchased some rackmounts based on this, we have the modules but have not implimented the "lights out" yet.)
0
 
mdmcq5Author Commented:
I'll have to take a look at lights out....never heard of it before.
0
 
NJComputerNetworksCommented:
lights out requires additional hardware....but it would be good in your situation.,..it will hard boot the server for you remotely.

0
 
mdmcq5Author Commented:
OK, the server froze this morning.

I attempted the following:
1) no RDP available not even using mstsc
2) connected to citrix via my computer management and checked services that are automatic, all were started.  Stopped and restarted the main ones.
** However, looks like our Security Admin has disabled the feature to stop/restart terminal services and I honestly don't know where to find that feature to see who he has put in the list to have rights to do this procedure.
3) attempted psshutdown -r -f \\citrix, absolutely nothing happened.

Next time I will try the:
1) shutdown -r -f -m \\SERVERNAME syntax by lazuras - overlooked that one to try.  But, if psshutdown didnt' get a response i doubt this one will.
2) I'll doublecheck to see whether users have rights to save to the terminal server hard drive - I'm betting that's a 100% NO.
3) Have to get permission from the boss if I install something like VNC - if I do install that app, there's gotta be a feature that will make the application unavailable to the users who log on, right? not all the applications that are downloaded on the TS are accessible to everyone..??
4) I'm also going to look into this suggestion: You *might* be able to use psexec (another System Internals tool) to fire either the shutdown or psshutdown executables.
Lastly, if you're server is hanging like this and needs to be hard booted, you might be able to use a management card to reboot the server.  Examples are HP's ILO cards or Dell's Remote Access Card.
and....
5) supermicro's "lights out module
0
 
NJComputerNetworksCommented:
2) connected to citrix via my computer management and checked services that are automatic, all were started.  Stopped and restarted the main ones.
** However, looks like our Security Admin has disabled the feature to stop/restart terminal services and I honestly don't know where to find that feature to see who he has put in the list to have rights to do this procedure.

I think this is common to all Terminal Servers...  I think the stop/restart is always greyed out.   Especially if you have Citrix installed on top of Terminal Services.

You be better off spending your time trying to figure out why the server is hanging... rather then trying to figure out why the server can't be remotely rebooted.

I think the server can not be remotely rebooted because of the hang.  I predict, the even if you walked up physically to the server, you would not be able to reboot the server.  Hangs typically will stop you from shutting down properly.  Therefore, VNC, remote control, etc will never work...  The server is hung.  Only a power off can get your back online  (HP ILO, lights out technology, etc will resolve this for you...as they can do a power off hardware level reboot)

0
 
Jeff BeckhamEngineerCommented:
I agree, that time invested in figuring out how to reboot a hung server would be better spent trying to figure out why the server is hanging in the first place.
0
 
mdmcq5Author Commented:
Not only am I trying to figure out how to reboot the server remotely I'm also attempting to figure out why the server is hanging; i have another post elsewhere, but noone has been able to assist w/figuring out what the problems are w/the two servers having identical problems.

And, i had to drive out to work at 10PM last night to reboot the damn server, so figuring a way to reboot from home, would have saved me two hours.
0
 
NJComputerNetworksCommented:
I think the server can not be remotely rebooted because of the hang.  I predict, the even if you walked up physically to the server, you would not be able to reboot the server.  Hangs typically will stop you from shutting down properly.  Therefore, VNC, remote control, etc will never work...  The server is hung.  Only a power off can get your back online  (HP ILO, lights out technology, etc will resolve this for you...as they can do a power off hardware level reboot)
0
 
davesneilsonCommented:
It may be worth downloading the free VMWARE Server, then loading this to whichever terminal server has the least load (and the most RAM). Then build a new virtual Terminal server to test with. Move some users to the new virtual Terminal server and see if the problem is resolved.

VMWare  will allow you to build a new server without (hopefully) having to buy new hardware, and has the added benefit of giving you a "machine" image for fast restore, in case of disaster.  

It sounds like it will be faster to build a new server than to locate the problem.

Another option would be to buy a remote reboot switch as a very short term fix, (never a good option to drop the power on a server as you know,  but the two hour drive sounds a killer!)     see here for details - http://www.dataprobe.com/power/index.html

0
 
mdmcq5Author Commented:
jebeckham,

Of course the server crashed just now.  I had installed psexec but hadn't yet taken a look at it.  Ran it, but apparently don't know the syntaxes.  You mentioned it could perhaps "fire either the shutdown or psshutdown executables".  Can you explain the syntaxes for this program, please?
0
 
NJComputerNetworksCommented:
Usage
See the February 2005 issue of Windows IT Pro Magazine for Mark's article that covers advanced usage of PsKill.

You can use PsShutdown to initiate a shutdown of the local or a remote computer, logoff a user, lock a system, or to abort an imminent shutdown.

usage: psshutdown [[\\computer[,computer[,..] | @file [-u user [-p psswd]]] -s|-r|-h|-d|-k|-a|-l|-o [-f] [-c] [-t nn|h:m] [-n s] [-v nn] [-e [u|p]:xx:yy] [-m "message"]

-?
Displays the supported options.
computer
Perform the command on the remote computer or computers specified. If you omit the computer name the command runs on the local system, and if you specify a wildcard (\\*), the command runs on all computers in the current domain.
@file
Run the command on each computer listed in the text file specified.
-u
Specifies optional user name for login to remote computer.
-p
Specifies optional password for user name. If you omit this you will be prompted to enter a hidden password.
-a
Aborts a shutdown (only possible while a countdown is in progress)
-c
Allow the shutdown to be aborted by the interactive user
-d
Suspend the computer
-e
Shutdown reason code.
Specify 'u' for user reason codes and 'p' for planned shutdown reason codes.
xx is the major reason code (must be less than 256)
yy is the minor reason code (must be less than 65536)
-f
Forces all running applications to exit during the shutdown instead of giving them a chance to gracefully save their data
-h
Hibernate the computer
-k
Poweroff the computer (reboot if poweroff is not supported)
-l
Lock the computer
-m
This option lets you specify a message to display to logged-on users when a shutdown countdown commences
-n
Specifies timeout in seconds connecting to remote computers
-o
Logoff the console user
-r
Reboot after shutdown
-s
Shutdown without poweroff
-t
Specifies the countdown in seconds until the shutdown (default: 20 seconds) or the time of shutdown (in 24 hour notation)
-v
Display message for the specified number of seconds before the shutdown. If you omit this parameter the shutdown notification dialog displays and specifying a value of 0 results in no dialog.
0
 
mdmcq5Author Commented:
NJComputerNetworks,

I know about the psshutdown syntaxes you told me about. And what's this? Usage
See the February 2005 issue of Windows IT Pro Magazine for Mark's article that covers advanced usage of PsKill.

But jebeckham  had mentioned psexec and can't quite grasp how the syntaxes would tie into forcing shutdown or psshutdown to shutdown the server.

Still haven't had time to look at "lights out" and we do have VMWare installed on the Citrix Servers.  We're also in the process of rebuilding a from scratch Citrix, but w/300 employees and only 5 IT ppl, we ain't got much time.
0
 
Jeff BeckhamEngineerCommented:
Basically, your syntax will look something like:

psexec \\<computername> -u <username> -p <password> shutdown.exe -r -t 0 -f

<computername> can be a name or IP address.

<username> and <password> may be required if you're not logged on to your local computer as an admin on your remote server.  You can specify a domain user in the form or -u <domainname>\<username>.

You can also try running the remote shutdown command via the remote computer's system account, by replacing "-u <username> -p <password>" with "-s".
0
 
mdmcq5Author Commented:
jebeckham,

Ok, let me see if I understand you.

I'm not logged into my local computer as "administrator" BUT I am an "administrator", I'm in the group.

So, to just play it safe, would this be a correct syntax for me to type?

psexec \\citrix administrator Pas$word shutdown.exe -r -t 0 -f   OR
psexec \\citrix administrator Pas$word psshutdown.exe -r -t 0 -f

and could you please explain this in more detail?
You can also try running the remote shutdown command via the remote computer's system account, by replacing "-u <username> -p <password>" with "-s".
0
 
mdmcq5Author Commented:
Ok, I think I may understand this now:
You can also try running the remote shutdown command via the remote computer's system account, by replacing "-u <username> -p <password>" with "-s".

Since I am an administrator, then I have rights to reboot the servers and sign into the servers as myself. Am I on the right track, jebeckham?

so, the syntax would be:
psexec \\citrix -s shutdown.exe -r -t 0 -f   OR
psexec \\citrix -s psshutdown.exe -r -t 0 -f

or am I way off on that thought?
0
 
mdmcq5Author Commented:
Can any of you who have mentioned 'Lights Out' provide me with any type of screenshots?  It's accessible via a web browser, where the iLO has been configured to have its own IP...right?
0
 
Jeff BeckhamEngineerCommented:
You've got the syntax down correctly, in both your "-u <username> -p <password>" and "-s" commands.  I'd try shutdown.exe, as it's the built-in MS command.

If you specify a username and password, they need to have the proper rights in order to execute the command at the server (to be safe, use either a local admin on the remote box or a domain admin).  You might be able to run the command under the system account if you're logged in on your local PC as a user who has the proper rights to shutdown the remote system.
0
 
mdmcq5Author Commented:
I do have the proper rights to shutdown the remote system being logged in as myself.
So, this is all I have to type?
psexec \\citrix -s shutdown.exe -r -t 0 -f

and since I am the admin, I don't really need to type this, but for some reason the above doesn't work, I'll try.

psexec \\citrix administrator Pas$word shutdown.exe -r -t 0 -f   OR
0
 
Jeff BeckhamEngineerCommented:
That's correct.  You do need to specify "-u administrator -p Pas$word" (note the -u and -p options) when you specify username and password.
0
 
mdmcq5Author Commented:
Ok, got it!  I'll give it a shot, and let you know if this one works.
0
 
mdmcq5Author Commented:
Nothing seems to have resolved this issue, and Security Admin is 100% against Lights Out or any program similiar to it.

I'm going to spread the points out here guys. Thank you all for your input.
0
 
PS-SupportCommented:
Thank you
0
 
PS-SupportCommented:
shutdown -r -f -m \\SERVERNAME

this command is working 100 % note that the server was locked

Thank you again
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 15
  • 8
  • 5
  • +5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now