Skip to main content
GameDev.net gamedev.net
🔒 Locked

WinXp Batch File

Started by guts Jun 4, 2004 at 5:54 AM 14 replies 800+ views
Original Post
guts
guts
hi! i want to write a batch file, that shutdowns all computers which are in the network (from the domain controller) the computers should just shutdown if nobody is logged in. has anybody done something like this, or may sb else help me?! thank in advance, stefan
Coward
Coward
I doubt it can be done with a batch file..
Don't Temp Fate..
guts
guts
well there is a "shutdown" command, with that you can shutdown any computer in the network you like.
my only problem is getting all computers in the network and how to test if somebody is logged in or not. *g*
Toolmaker
Toolmaker
Write an application that sits as a service on the other computer? Just scan an IP range and query each service which user is logged in. Analyze the returned list, reconnect to all non logged in nodes and call the shutdown function. Be sure that you have network admin passwords for that.

Toolmaker
 
nes8bit
nes8bit
I''m in XP so I can''t do this... If your terminals aren''t using the XP or 2k distros then you can [probably] use this in a batch file...

To force shut down
rundll32 user32.dll,ExitWindowsEx 5 -1

To not force shut down
rundll32 user32.dll,ExitWindowsEx 5 -1


I did this a lot when I was visiting the philippines a while back. It really screwed with the admins

So figure out if you can run batch files remotely and execute that script. Otherwise write a small app to do it. I could probably write one for you in like 10 minutes ...in VB or C++. But I won''t

---------------------------------------------
insert flashy image here
Promit
Promit
If you can get a hold of Remote Desktop, it''s really, really useful.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
nes8bit
nes8bit
And more!

XP:

go into cmd.exe
shutdown -s




quote:

Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-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)


---------------------------------------------
insert flashy image here
Michalson
Michalson
Download the NT administrator resource kit from Microsoft. It comes with the shutdown.exe commandline tool that lets you (assuming your accounts has privileges) shutdown the local or a remote machine with a variety of options. This could obviously be used by a batch file to do what you want. There is also a gui version in the toolkit. Free download is here, though I'm not sure what stuff is missing from the subscriber version.

EDIT: From nes8bit's post it would appear shutdown.exe actually comes with XP [Pro only most likely]. NT Server and 2000 Pro don't have it by default (though I've never checked 2000 Server Edition)
lethalhamster
lethalhamster
Heheh I was having fun with the shutdown command a while ago. I made a program:

main()
{
system("shutdown -s");
return 0;
}

that was fun to send to people and say "Try out my new program!". Then they would get pissed at me for shutting down their computer. It was fun.

EDIT: did the source tag wrong.
_______________________________________________________________________
Could Jesus microwave a burrito so hot that he himself could not eat it?

[edited by - lethalhamster on June 4, 2004 11:48:00 AM]
............Could Jesus microwave a burrito so hot that he himself could not eat it?
Promit
Promit
quote:
Original post by lethalhamster
Heheh I was having fun with the shutdown command a while ago. I made a program:

main()
{
system("shutdown -s");
return 0;
}

that was fun to send to people and say "Try out my new program!". Then they would get pissed at me for shutting down their computer. It was fun.

EDIT: did the source tag wrong.
_______________________________________________________________________
Could Jesus microwave a burrito so hot that he himself could not eat it?

[edited by - lethalhamster on June 4, 2004 11:48:00 AM]


You didn''t indent the return statement! EVIL!!
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
lethalhamster
lethalhamster
quote:
Original post by Promit
quote:
Original post by lethalhamster
Heheh I was having fun with the shutdown command a while ago. I made a program:

main()
{
system("shutdown -s");
return 0;
}

that was fun to send to people and say "Try out my new program!". Then they would get pissed at me for shutting down their computer. It was fun.

EDIT: did the source tag wrong.
_______________________________________________________________________
Could Jesus microwave a burrito so hot that he himself could not eat it?

[edited by - lethalhamster on June 4, 2004 11:48:00 AM]


You didn''t indent the return statement! EVIL!!



sorry.

_______________________________________________________________________
Could Jesus microwave a burrito so hot that he himself could not eat it?
............Could Jesus microwave a burrito so hot that he himself could not eat it?
nes8bit
nes8bit
quote:
Original post by Michalson
Download the NT administrator resource kit from Microsoft. It comes with the shutdown.exe commandline tool that lets you (assuming your accounts has privileges) shutdown the local or a remote machine with a variety of options. This could obviously be used by a batch file to do what you want. There is also a gui version in the toolkit. Free download is here, though I''m not sure what stuff is missing from the subscriber version.

EDIT: From nes8bit''s post it would appear shutdown.exe actually comes with XP [Pro only most likely]. NT Server and 2000 Pro don''t have it by default (though I''ve never checked 2000 Server Edition)


I don''t know...I''m using the XP Pro distro right now.
*vomits in the direction of XP Home*

---------------------------------------------
insert flashy image here
DukeAtreides076
DukeAtreides076
quote:
Original post by lethalhamster
Heheh I was having fun with the shutdown command a while ago. I made a program:

main()
{
system("shutdown -s");
return 0;
}

that was fun to send to people and say "Try out my new program!". Then they would get pissed at me for shutting down their computer. It was fun.

EDIT: did the source tag wrong.
_______________________________________________________________________
Could Jesus microwave a burrito so hot that he himself could not eat it?

[edited by - lethalhamster on June 4, 2004 11:48:00 AM]


Even funnier if you modify it to run at startup.
haro
haro
quote:
Original post by DukeAtreides076
Even funnier if you modify it to run at startup.


Yeah real funny. Why not just throw format /y c: in the program instead of shutdown? That''d just be hilarious, right? Grow up, idiots.
nes8bit
nes8bit
lol...that''s what I did to piss off the admins in the philippines...

---------------------------------------------
insert flashy image here
Coward
Coward
quote:
Original post by haro
Yeah real funny. Why not just throw format /y c: in the program instead of shutdown? That''d just be hilarious, right? Grow up, idiots.

Calm down.


Don''t Temp Fate..
Don't Temp Fate..

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.