Jump to content

Automatic Shutdown, Once More


Uten
 Share

Recommended Posts

Has anyone of you created a shutdown script that is garanteed to shut down a computer?

I want to do a sceduled shutdown (The power is automaticaly shut off at night). Remote access is not possible.

The scripts and utilities I have tried will not handel a open notepad document with some text in, whome has not been saved.

The notorious "do you want to do this" dialog from notepad will block all attempts to do a automatic shutdown.

Today I have (done others before) tried:

  • psshutdown from sysinternals.
  • Autoits shutdown(9) function.
And scripts found in this forum:All of these programs, scripts will fail. I also have tried some of the winmgmnts objects but they are not garanteed to work on a default windows 2000 installation.

Obviously it is possible to use lett Autoit monitor for notepad windows with "Untitled -" in the title. Force a close and then do a shutdown(9). But this will not garantee that there is no other programs blocking a shutdown in the same manner.

If you dont know of any utility managing a brute force shutdown, but knowing of programs that would do block a shutdown I would like to heare about it.

I'm off to code the notepad part :)

Regards

Uten

Link to comment
Share on other sites

From the command line type

shutdown -s -f

Open Command Prompt.

Type:

shutdown [-l | -s |-r | -a] [-f] [-m \\ComputerName] [-t xx] [-c "message"] [-d [p]:xx:yy]

Value Description

-l Logs off the current user; this is also the default. -m ComputerName takes precedence.

-s Shuts down the local computer.

-r Reboots after shutdown.

-a Quits shutdown. Ignores other parameters, except -l and ComputerName. You can use -a only during the time-out period.

-f Forces running applications to close.

-m [\\ComputerName] Specifies the computer that you want to shut down.

-t xx Sets the timer for system shutdown in xx seconds. The default is 20 seconds.

-c "message" Specifies a message to be displayed in the Message area of the System Shutdown window. You can use a maximum of 127 characters. You must enclose the message in quotation marks.

-d [p]:xx:yy Lists the reason code for the shutdown. The following table lists the different values. Value Description

u Indicates a user code.

p Indicates a planned shutdown code.

xx Specifies the major reason code (0-255).

yy Specifies the minor reason code (0-65536).

Edit - added full list Edited by BigDod


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

hmm, to many trees in this forest :">

I was aware of the -f switch to psshutdown, and thought I was using it.

Must have typed somthing else :) While testing it. Because now it works like a charme.

Sorry for your trouble BigDod and JdeB, and thanks a lot for taking the time to correct me.

Regards

Uten

Link to comment
Share on other sites

did you try the Force option ?

ShutDown(13)

I had problems with W2KP boxes until I used force. They all go down now...no issues for months & everything from WinME to XP Pro. Haven't had access to a 98se box for a while...hope it stays that way...

Actually, since I loop through all running pid's (from an array of course) and shut down all items other than ones I need during my process, I know at the end the only thing running is my stuff & some required OS process.

Rich

Good intentions will always be pleaded for every assumption of authority. It is hardly too strong to say that the Constitution was made to guard the people against the dangers of good intentions. There are men in all ages who mean to govern well, but they mean to govern. They promise to be good masters, but they mean to be masters.-Daniel Webster

Link to comment
Share on other sites

I had problems with W2KP boxes until I used force. They all go down now...no issues for months & everything from WinME to XP Pro. Haven't had access to a 98se box for a while...hope it stays that way...

Actually, since I loop through all running pid's (from an array of course) and shut down all items other than ones I need during my process, I know at the end the only thing running is my stuff & some required OS process.

Rich

I am having an issue with SBS 2003 and XP pro & win2k running as work stations - I made a script (logon) that creates a scheduled task to shutdown - force the computer. What I have found is that if you have a screen saver program running that is password protected (windows screen saver) the shutdown does not work. Has anyone else ran into this or is it just my LAN?

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
Share on other sites

I too had issues with screen savers doing strange things...which is why I set SS to none & power to always on when I first start my process. At the end, before shutting down, the last thing I do is turn everything back to where it was before (saved the vari's before changing them first time). Then, it's shutdown, and when they come back up, everything is the way it was....There are a bunch more things eventually I want to nulify effects of, but that will wait for a few months until other isssues are resolved

Rich

Good intentions will always be pleaded for every assumption of authority. It is hardly too strong to say that the Constitution was made to guard the people against the dangers of good intentions. There are men in all ages who mean to govern well, but they mean to govern. They promise to be good masters, but they mean to be masters.-Daniel Webster

Link to comment
Share on other sites

Remote shutdown is possible. All you have to do is make autoit download a internet file and read it. If it says shutdown then use the shutdown(). On the other computer make a php file that change the file's info.

$open=fopen("file.con");
fwrite($open,"shutdown");
fclose($open);

this is the delete code:

unlink("file.con");

Autoit:

InetGet("http://webserver/","file.con");

And then use a fileread()

:mellow::o:):)

Link to comment
Share on other sites

Remote shutdown is possible. All you have to do is make autoit download a internet file and read it. If it says shutdown then use the shutdown(). On the other computer make a php file that change the file's info.

$open=fopen("file.con");
fwrite($open,"shutdown");
fclose($open);

this is the delete code:

unlink("file.con");

Autoit:

InetGet("http://webserver/","file.con");

And then use a fileread()

:mellow::o:):)

i am not sure if I follow what you are saying - one more time please - I have a server and work stations. What needs to be put on what - and the file.con is that something I have to download? And on the ISS do I have to set up PHP? Please I really want to make sure people shutdown their computers at night

All by me:

"Sometimes you have to go back to where you started, to get to where you want to go." 

"Everybody catches up with everyone, eventually" 

"As you teach others, you are really teaching yourself."

From my dad

"Do not worry about yesterday, as the only thing that you can control is tomorrow."

 

WindowsError.gif

WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF

AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send

StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2

AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit  Docs

SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF

Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language

Programming Tips

Excel Changes

ControlHover.UDF

GDI_Plus

Draw_On_Screen

GDI Basics

GDI_More_Basics

GDI Rotate

GDI Graph

GDI  CheckExistingItems

GDI Trajectory

Replace $ghGDIPDll with $__g_hGDIPDll

DLL 101?

Array via Object

GDI Swimlane

GDI Plus French 101 Site

GDI Examples UEZ

GDI Basic Clock

GDI Detection

Ternary operator

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...