MSFN Forum: NT4 - Shuting down and restarting the server - MSFN Forum

Jump to content


  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

NT4 - Shuting down and restarting the server NT4 - Shuting down and restart the server Rate Topic: -----

#1 User is offline   am12348 

  • Newbie
  • Group: Members
  • Posts: 17
  • Joined: 29-December 12
  • OS:none specified
  • Country: Country Flag

Posted 29 December 2012 - 04:42 PM

Hello everybody,

I would like to if there is a statement I can write in the command window that shuts down the server and restarts it.

I was told that I can use the following command. However, when I tried Inothing happened

Under c:\winnt\system32

rundll32.exe shutdown /1 /y /r


My purpose is to add the cmd to a batch file which is scheduled on a certain time

Thank you in advance,
Amos


#2 User is offline   angmor 

  • Group: Members
  • Posts: 7
  • Joined: 03-January 13
  • OS:none specified
  • Country: Country Flag

Posted 04 January 2013 - 12:39 AM

Different versions of Windows use different parameters for shutdown.exe
I don't have the NT4 RK shutdown.exe easily accessible but I think the parameters may be the same as NT4

from the W2K resource kit, shutdown.exe:
shutdown /l /r /y /c

/l
Specifies a local shutdown. (note that the parameter is the lower case letter L)
/r
Restart the computer specifed after shutdown.
/y
Answers questions with "yes".
/c
Forces running applications to close. Caution
If you use the /c parameter, Windows 2000 ignores the application's option to save data that might have changed. You will see no File Save dialog box, because Windows 2000 will force the application to close. This will result in a loss of all data not previously saved.

Other parameters:
\\computername
Specifies the remote computer to shut down. If no name is given but the tool is started with any of the other options, the local computer name will be used.
/a
Quits a system shutdown. This can only be done during the timeout period. If this switch is used, all others are ignored.
/t:xx "msg"
Sets the timer for system shutdown in xx seconds. The default is 20 seconds.
"msg"
Specifies an additional message with a maximum of 127 characters, surrounded by quotation marks.
/? (or shutdown without parameters)
display help.

#3 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,433
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 04 January 2013 - 06:19 AM

View Postam12348, on 29 December 2012 - 04:42 PM, said:

I would like to if there is a statement I can write in the command window that shuts down the server and restarts it.


Here:

Quote

Reboot Windows NT
(without the need to use the Resource Kit)


http://www.robvander...mb_rebootnt.php

jaclaz

#4 User is offline   am12348 

  • Newbie
  • Group: Members
  • Posts: 17
  • Joined: 29-December 12
  • OS:none specified
  • Country: Country Flag

Posted 06 January 2013 - 02:37 PM

Hello everybody,

For a certain reason I want to shut down and restart the NT4 at a certain hour on specific dates.

I wrote in the command screen:

at 07:15 /every:Su,M,T,W,TH,F restartNT4

restartNT4 is a private batch file. I have not found an appropriate command in NT4, that does
shut down and restart.

When I types the statement at, I've seen this command in the list.

However, when the specified time comes in the appropriate days in week, nothing happens.

Does anyone have an idea, what is wrong.

When I type the command-the name of the batch file regularly - The server shuts down and
restarts.


Thank you,
Amos

#5 User is offline   am12348 

  • Newbie
  • Group: Members
  • Posts: 17
  • Joined: 29-December 12
  • OS:none specified
  • Country: Country Flag

Posted 06 January 2013 - 02:43 PM

Thank you for your replies they helped me

This post has been edited by am12348: 06 January 2013 - 02:45 PM


#6 User is offline   allen2 

  • Not really Newbie
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,736
  • Joined: 13-January 06

Posted 06 January 2013 - 03:01 PM

You might need to put the full path name of the batch.
You could also use the psshutdown command from the pstools with the right user.

This post has been edited by allen2: 06 January 2013 - 03:01 PM


#7 User is offline   am12348 

  • Newbie
  • Group: Members
  • Posts: 17
  • Joined: 29-December 12
  • OS:none specified
  • Country: Country Flag

Posted 07 January 2013 - 03:17 PM

]Hello,

First of all thank you.

Secondly, I've specified the scheduled command in a full path. However the situation
is the same - the "at " command does not take effect. I've even put the full command in
quotes.

However, if I specify the "interactive" parameter, the "at" then stops at the scheduled
time and waits, the user to put something.

I want to use the "interactive" parameter to solve my problem. Therefore I would like to
know, if there a way to put an additional parameter besides the "interactive", that tells the
system, that if there is not any response from the user for a certain time, the command
associated to the "at" is done.

Thank you,
Amos

#8 User is offline   am12348 

  • Newbie
  • Group: Members
  • Posts: 17
  • Joined: 29-December 12
  • OS:none specified
  • Country: Country Flag

Posted 08 January 2013 - 11:02 PM

Hello,

As I've written before, I've met a problem in "at" cpmmand in our NT4. The command
does not take effect when the scheduled time comes.I've specified the full path, I've
put the command in quotes. It didn't help.

However, if I specify the "interactive" parameter, the "at" then stops at the scheduled
time and waits the user to put something.

ThereforeI want to try to use the "interactive" parameter to solve my problem, but a
user has not to be near the server at that time.

Is there an additional parameter besides the "interactive" parameter "number of seconds
to wait" "so that the server executess the command in "at" automatically if no one gives
any response?


Thank you for your answers,
Amos

#9 User is offline   am12348 

  • Newbie
  • Group: Members
  • Posts: 17
  • Joined: 29-December 12
  • OS:none specified
  • Country: Country Flag

Posted 13 January 2013 - 04:42 PM

Hello,

As I've specified the previous topocs I've a problem in "at" comans - The associated command
does not take effect when the schedule time cones, even though the schediler service has
been starsed.

I've heard , that in order that "at" will take effect , an additional service besides the scheduler
task has to be started by an administrator.

Does anyone know the name of that setvice?

Thank you,
Amos

#10 User is offline   am12348 

  • Newbie
  • Group: Members
  • Posts: 17
  • Joined: 29-December 12
  • OS:none specified
  • Country: Country Flag

Posted 26 January 2013 - 02:29 PM

Hello,

Thank to anyone that will help me to overcome this problem:

I've write a batch file that shuts down and restarts the NT server.

I've put it in the C: drive in the NT.

When I activate the batch in the cmd screen, it shuts down and restarts
the server as espected.

I want to activate the batch at a specific time. Therefore I try to use the
function "at":

I write in the cmd screen:
at 07:00 /every:Su,M,T,W,TH,F c:\temp\restart.bat

When the time comes, the server sounds a "beep", but it seems that the batch is not activated

When I write in the cmd screen
at 07:00 /interactive /every:Su,M,T,W,TH,F c:\temp\restart.bat
When the time comes, the server displays a message about istallation error. The batch
is not activated.

What is wrong with what I've written?

Is there an alternative way, any function, to schedule the batch file?

Thank you
Amos

#11 User is offline   submix8c 

  • Inconceivable!
  • Group: Patrons
  • Posts: 3,244
  • Joined: 14-September 05
  • OS:none specified
  • Country: Country Flag

Posted 26 January 2013 - 03:30 PM

Hmmm -
http://www.computing...-nt-/14540.html
Get it here (maybe)
http://www.hpcfactor...s/msie/ie55sp2/
Or find links here (better)
http://www.mdgx.com/ietoy.htm#IE55

Not sure if using "Task Scheduler" will work out better than "AT" or not.

edit - It appears that using a BAT directly may not work? Look at this as well
http://computerplumb...scheduled-task/

HTH

This post has been edited by submix8c: 26 January 2013 - 03:33 PM


#12 User is offline   bphlpt 

  • MSFN Expert
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 1,076
  • Joined: 12-May 07

Posted 26 January 2013 - 08:53 PM

I noticed that it says that the "schedule" service must be running for the "AT" command to work correctly. Is your "schedule" service running?

Cheers and Regards

#13 User is offline   am12348 

  • Newbie
  • Group: Members
  • Posts: 17
  • Joined: 29-December 12
  • OS:none specified
  • Country: Country Flag

Posted 30 January 2013 - 11:03 PM

Hello,

As far as I've checked, the "schedule" service is running.In the NT4 server, I've gone to the control panel and
under "services" I've seen that "schedule" is active

#14 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,433
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 31 January 2013 - 08:07 AM

Post the contents of the actual .bat (which BTW should really be a .cmd)

Here there are some good tips on what to add to the batch to troubleshoot/debug:
http://www.robvanderwoude.com/ntat.php

jaclaz

#15 User is offline   am12348 

  • Newbie
  • Group: Members
  • Posts: 17
  • Joined: 29-December 12
  • OS:none specified
  • Country: Country Flag

Posted 31 January 2013 - 01:30 PM

Hello,

Here there is the content of the batch I use:


@ECHO OFF & cd/d %temp% & echo [version] > {out}.inf
(set inf=InstallHinfSection DefaultInstall)
echo signature=$chicago$ >> {out}.inf
echo [defaultinstall] >> {out}.inf
rundll32 setupapi,%inf% 1 %temp%\{out}.inf
del {out}.inf

If I activate the batch without "at" , it is working as expected.

However if I put in in "at", when time comes, a beep is sound
and the batch does not work

I write the "at" as follows:

at 07:00 /interactive /every:Su,M,T,W,TH,F c:\winnt\system32\cmd.exe /q /c c:\temp\restart.bat

#16 User is offline   am12348 

  • Newbie
  • Group: Members
  • Posts: 17
  • Joined: 29-December 12
  • OS:none specified
  • Country: Country Flag

Posted 31 January 2013 - 01:36 PM

Hello,

As far as I know, there is not "Schedulrd Task" under Control Panel"

Following to the replies in the forum, I've done the following:
- I've written a batch file, which shuts down the NT4 server and restarts it
- I've verified that the schedule service is active
- I've define a new "at" activity in such way:
at 07:00 /every:Su,M,T,W,TH,F c:\winnt\system32\cmd.exe /q /c c:\temp\restart.bat

When I write "at": in the command prompt, I see a new id with the one I've defined

Now, when the time comes,I hear a beep but the at does not take efffect
I've written the same, but with the parameter interactive

at 07:00 /interactive /every:Su,M,T,W,TH,F c:\winnt\system32\cmd.exe /q /c c:\temp\restart.bat

When the time comes, the server displays a message about istallation error. The batch
is not activated.

When I write another activity for example "notepad"
at 07:00 /interactive /every:Su,M,T,W,TH,F notepad
The notepad window is displayed, when the time comes

If I write simply "c:\temp\restart.bat", the batch works as expected - It shuts down the server and restarts it

Does anyone have an idea what can I do, is there an alternative way, any function, to schedule the batch?


Is there an alternative way, any function, to schedule the batch file?


Thank you in advance,
Amos

#17 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,433
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 31 January 2013 - 02:04 PM

READ the given link.

Quote

Add a PAUSE command to the end of any batch file to be sceduled, and REM out the initial @ECHO OFF line, so you'll be able to see the "flow" of the batch file -- what commands does it execute, does it jump to any labels, etc.
Just schedule CMD.EXE to be started, using AT.EXE's /INTERACTIVE switch to make the CMD prompt visible
Now execute the command in the resulting CMD prompt and see if the access rights are sufficient for the task you intend to schedule
Check the current directory; is it the same directory you used for testing the command?
It is best to use fully specified paths instead of relying on PATH variables that may change every now and then or even be different for different user IDs
Check if you can access remote systems, if that's necessary for the task to be scheduled; many scheduled COPY commands to remote systems fail because the SYSTEM account cannot access remote network drives
Check if the necessary drive mappings are available in this CMD prompt
Check the environment variables; are they identical to your own environment variables?
Remember, this CMD prompt is the exact environment that your scheduled command will be using


It is possible that there are access rights issue (IMHO the most likely, but cannot really say).
It could be an issue when writing the temporary "out" file or when actually executing it through rundll32 setupapi.
Do exactly the steps listed above, and report what happens/which step fails.

At first sight there is nothing "wrong" in the batch, I would personally write it slightly differently:
@ECHO OFF
PUSHD %temp%

set inf=InstallHinfSection DefaultInstall
::SET
::PAUSE

(
echo [version]
echo signature=$chicago$
echo [defaultinstall]
)>{out}.inf
:: TYPE {out}.inf
::PAUSE
rundll32 setupapi,%inf% 1 %temp%\{out}.inf
::PAUSE
del {out}.inf
POPD

but it shouldn't make a difference (to test remove the :: in front of the lines to pause and show what is happening).


jaclaz

P.S: : I am not too sure that grouping with brackets is supported in NT 4, if it doesn't work revert to plainer:

echo [version]>{out}.inf
echo signature=$chicago$>>{out}.inf
echo [defaultinstall]>>{out}.inf

This post has been edited by jaclaz: 31 January 2013 - 02:08 PM


#18 User is offline   Tripredacus 

  • K-Mart-ian Legend
  • Group: Super Moderator
  • Posts: 8,670
  • Joined: 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Posted 31 January 2013 - 02:11 PM

Post #7 is from a thread merge.

#19 User is offline   allen2 

  • Not really Newbie
  • PipPipPipPipPipPipPip
  • Group: Members
  • Posts: 1,736
  • Joined: 13-January 06

Posted 31 January 2013 - 03:30 PM

Scheduled tasks service will be installed on nt4 after upgrading Internet explorer to version 6 sp1 and this might solve problems with at tasks not working properly.

#20 User is offline   submix8c 

  • Inconceivable!
  • Group: Patrons
  • Posts: 3,244
  • Joined: 14-September 05
  • OS:none specified
  • Country: Country Flag

Posted 31 January 2013 - 05:29 PM

Post #7 is a Thread Merge (see post #9)
Post #10 says IE6SP1 (should work fine)
Post #2 says Minimum/Recommended IE5.5SP2 (see link)

Install one or the other. Task Scheduler will appear in Control Panel.
Also see LAST link in Post #2 for "How To" in Task Scheduler. A slight "trick". Fairly simple. ;)

Quote

When I write another activity for example "notepad"
It's because it's a PROGRAM and not a BAT/CMD. You have to start CMD.EXE and cause IT to execute the BAT/CMD file (again, see last link Post #2 indicating the Problem and Workaround). Also note Post #5 and Post #8 suggesting CALLING the Functions via CMD.EXE (same deal-io).

In fact this scenario has me confused.

Quote

I've write a batch file that shuts down and restarts the NT server.
OK...

Quote

Here there is the content of the batch I use:
(reference also Post #8). Is the (lacking contents of the) INF file supposed to Shut Down/Beep/Restart the OS? Guessing so(?), but unsure about BEEP unless that's from the PC starting up during POST?
Another reference to RUNDLL32 also from Rob -
http://www.robvander....com/rundll.php
AAAAAND the INF/BAT in question is ALSO referenced by Rob (scroll down) -
http://www.robvander...om/shutdown.php

Your PROBLEM is putting the INF into a BAT/CMD and causing it to SCHEDULE.
Combine the Partial Solutions listed.
1 - Install IE5.5SP2/IE6SP1 (see references)
2 - Create the BAT file (see refrences)
3 - Scheduler the CMD in Task Scheduler to Run the BAT (see references)
Done!
Note: I'm really unsure if you will need some kind of Delay somewhere to allow for Scheduled CMD Exit. You should PROBABLY use "START /WAIT xxxx.BAT"(?). Maybe an "EXIT" need put in the end of the BAT(?).
http://ss64.com/nt/cmd.html

Quote

cmd.exe /q /c
...the TARGET being START(?)...
http://www.robvander...com/ntstart.php

This post has been edited by submix8c: 01 February 2013 - 07:34 AM


Share this topic:


  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy