Sign in to follow this  
Followers 0
am12348

NT4 - Shuting down and restarting the server

45 posts in this topic

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

0

Share this post


Link to post
Share on other sites

READ the given link.

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

Edited by jaclaz
0

Share this post


Link to post
Share on other sites

Post #7 is from a thread merge.

0

Share this post


Link to post
Share on other sites

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.

0

Share this post


Link to post
Share on other sites

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. ;)

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.

I've write a batch file that shuts down and restarts the NT server.
OK...
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.robvanderwoude.com/rundll.php

AAAAAND the INF/BAT in question is ALSO referenced by Rob (scroll down) -

http://www.robvanderwoude.com/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

cmd.exe /q /c
...the TARGET being START(?)...

http://www.robvanderwoude.com/ntstart.php

Edited by submix8c
0

Share this post


Link to post
Share on other sites

Hmmm, I would rather troubleshoot and solve the issue at hand with AT rather than have IE6 SP1 in order to have Task Scheduler.

There is not one reason in the world why plain AT should not work, AFAIK.

There is more than one way to skin a cat, most of them without any need to have Internet Explorer on NT 4.

In my (perverted) mind installing IE on NT4 and upgrading it to IE6 sounds like a complete failure at solving the problem and thus shooting a fly with a cannon.

If the issue is not resolved "simply", I would rather try a third party tool such as (example) nircmd:

http://www.nirsoft.net/utils/nircmd.html

jaclaz

0

Share this post


Link to post
Share on other sites

Maybe scheduling SHUTDOWN instead? :unsure:

http://www.robvanderwoude.com/shutdown.php

NT4+RK | SHUTDOWN /L /R /T:0 /Y | Effect=Reboot | Remarks=Immediate shutdown & reboot
Reference here -

http://ss64.com/nt/shutdown.html

"Random" site (I like that term now!) giving the MS Link and some info -

http://smallvoid.com/tweak/winnt/files/winnt4sp4st.htm

Another "random site" (google cache)

File is not on MS anymore (even with Wayback). But Google

"sp4rk_i386.exe"

Inside the EXE is a CAB and inside it is "NETMGMT_NETADMIN_shutdown.exe".

You could ALSO maybe try the PSSHUTDOWN (robvanderwoude link above lists it).

Wouldn't either one of these be more "direct"? :unsure:

0

Share this post


Link to post
Share on other sites

You could ALSO maybe try the PSSHUTDOWN (robvanderwoude link above lists it).

Wouldn't either one of these be more "direct"? :unsure:

That what i already proposed in his previous thread....

Edited by allen2
0

Share this post


Link to post
Share on other sites

Ahhh! The "Thread Merge"...

0

Share this post


Link to post
Share on other sites

Hello,

First of all thank you for your useful posts, referinfg to my problem in at command.

I've changed my batch file, that shuts dowwn and restarts NT4 server according to

Jaclaz's post. I've added "pauses" to some places in the batch and configured the

"at" command to run the batch interactively. run the batch interactively step by step.

The pauses have helped me to find out what is wrong wuth the batch. I've fixed the

problems and now, when the time configured in "at| command comes, the batch is

actuvared and is working properly.

Ther is still a one little problem. I use to lock the server when I don't use it and

ublock it by ty[ing a password. When the server is locked, the batch file doesn't

work properly, when the configured time comes. In my logs, I can see that the

batch has been activated, but it haven't worked properly.

Can be any problem in activation of scheduled batches, when the server is locked?

What can I do to overcome this problrm?

Thank you for your useful help,

Amos

0

Share this post


Link to post
Share on other sites

If the computer is locked, you'll need to force the shutdown. Psshutdown i linked before has an option to force it and even logoff a user.

0

Share this post


Link to post
Share on other sites

Hello,

Thanks to Allen2 for his help

I've the two following questions:

- Does psshutdown fdo the work on NT4?

- Can I use this software freely in any NT4 server?

Thank you

Edited by am12348
0

Share this post


Link to post
Share on other sites

1 - For a whopping 1.6 megabytes, you could download it and try. One might assume it will work on NT4 as the OTHER utilities were also suggested (in the OTHER thread).

2 - Uhhhh, yes FREE (or freely???)! A Server is nothing more than a beefed-up workstation.

You're beating the exact same "problem" to death in no less than SIX separate topics!

See THIS (post#11 link AND Allen2's comment) -

www.msfn.org/board/topic/161834-shutting-down-and-restart-nt4/

Which points to THIS -

http://www.robvanderwoude.com/shutdown.php

Which SPECIFICALLY STATES NT4!!!!

PLEASE be so kind as to NOT create NEW topics AND be so kind as to READ all Posts and the associated LINKS therein! EVERY single question you have asked has been repeatedly answered - correctly!

Thank you for your support!

0

Share this post


Link to post
Share on other sites

Hello,

Before I refer to what submix8c has said, I would like to thank you for everybody's useful posts.

Now to the point . Maybe six separate topics for the same subject are too much.

However , upon my experience in some forums(Not this one) , in many times nobody

refers to a topic that is not either recent or in the first forum page. The topics I've posted

relate to the same subject "Scheduling shutting down and restarting NT4 server", but each time,

I've written different things. I've tried to read and implement what everybody has posted and

when I've met problems , I've posted a new topic in order to get an answer as soon as possible.

Due to company's security policy, I've sometimes asked the same question twice in order to

be sure with what I'm doing.

I hope that now, I'm quite clear and I'm sorry for the misunderstanding.

Thank you,

Amos

0

Share this post


Link to post
Share on other sites
...

I've posted a new topic in order to get an answer as soon as possible.

This is not effective, but rather just makes frequent users of the forum annoyed at the needless clutter, as you have seen. Also, posting the same or similar questions in multiple places is not necessary since frequent users often use forum links such as this one - http://www.msfn.org/board/index.php?app=core&module=search&do=active - which will pull up all the recent posts, over a time period the user can specify, from anywhere on the board. So if you make a post anywhere at all someone will see it. Try very hard to put it in an appropriate place, since otherwise it might be ignored. After all, if you don't care enough about your issues, and the board, to keep the place tidy and organized for the benefit of others, then why should we care about helping you? Another reasons for a non-response is if at first glance we can't think of anything helpful to post, we might wait to see if anyone else comes up with something. Most of us here don't post just to "hear ourselves talk". So it is perfectly OK if there has not been a response in a reasonable amount of time, say a day or two, to post again, in the same thread, with additional information about what else you have tried while you have been waiting, along with the results of your efforts. Remember we are glad to help you, not do it for you.

Cheers and Regarrds

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.