Computing.Net > Forums > Windows XP > .bat to shutdown un-logged on PC's

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

.bat to shutdown un-logged on PC's

Reply to Message Icon

Name: Strick80
Date: December 27, 2007 at 07:13:26 Pacific
OS: XP Pro SP2
CPU/Ram: 3GHz / 1 GB
Product: HP Compaq / DC7100
Comment:

I am trying to make this batch file because all the company's PC's are turned on in the morning. We have a lot of hot desks so I want to make a batch file which will shut them down if no one is logged on.

This is it so far:

for /f %%a in (d:\shutdown\shutdown.txt) do (
psloggedon \\%%a > D:\Shutdown\shutdown.tmp
if %errorlevel% EQU 0 (
TYPE d:\shutdown\shutdown.tmp | find /i "xxx"
)
IF %errorlevel% NEQ 0 (
shutdown -s -m \\%%a
)
)
)

Now this works fine up until "IF %errorlevel% NEQ 0" because it does not shut the sytem down.

Any idea's please, this has been bugging me for ages



Sponsored Link
Ads by Google

Response Number 1
Name: Strick80
Date: December 27, 2007 at 07:18:56 Pacific
Reply:

Sorry, im new to the forum and i just realised that this should be in the programming section. :).

P.S Not back seat moderating but if mods want to delete :D


0

Response Number 2
Name: Frankie566
Date: December 27, 2007 at 08:29:29 Pacific
Reply:

I work at a public Library and we have a Public Lab where users didn't seem to want to get off at closing time. We solved the problem using a shutdown utility program called Poweroff.
Poweroff is a program that lets you shutdown, log off, reboot, etc. even remotely.
Check it out here:
http://users.pandora.be/jbosman/pow...

Also read this on how to set it for multiple PCs.
http://www.webjunction.org/do/Displ...

You can even create a batch file that you can set up as a Scheduled Task to run at a set time.

Who knows, knows and who doesn't know, dosen't know jack!
El que sabe, sabe y el que no sabe, no sabe nada!


0

Response Number 3
Name: Strick80
Date: December 27, 2007 at 08:38:14 Pacific
Reply:

Hey there, thanks for that. Its a good program but doesnt do all i want it to do :(. I need to set it so that it does it when the pc is not logged on. I know if has the function where it can see if a process is running. But i dnt want to do a mass install :(.

Thanks tho


0

Response Number 4
Name: justcuz (by whitevalley)
Date: December 27, 2007 at 09:24:38 Pacific
Reply:

"... if NO ONE is logged on..."

In this scenario of yours, what happens if "userN" just walks away from his/her workstation without bothering to log off? All workstations stay powered up?

Then your 2nd post:"...when THE pc is not logged on..." suggests that you need to poll each individual workstation repeatedly and shut each down as the users log off... Confusing issues.

Presumably, you would execute that batch file on a fixed schedule (end of work shift, regardless of circumstances)?

A simple/cheap electrical timer might be just as useful/effective, depending on any other of your other what-IFscenarios...


0

Response Number 5
Name: jefro
Date: December 27, 2007 at 12:09:32 Pacific
Reply:

I might use an autolog off and then use power settings to shutdown after set time.

I read it wrong and answer it wrong too. So get off my case you peanut.


0

Related Posts

See More



Response Number 6
Name: Strick80
Date: December 28, 2007 at 00:47:59 Pacific
Reply:

With regards to "justcuz (by whitevalley)" post, I would run the batch file every night at end of the day from my pc using a Scheduled Task.

This is part of a .bat which I have made. I got another .bat which calls this which tells me how long the pc and user have been on and i read the report every day to see if it is just some one walking away from their PC all the time.

I would only run the bat file once. This is just a case of shutting down the hotdesks, not an automated shutdown for users. Thanks for the reply.

And in response to jefro, that would be so much easier I agree but my boss wont allow, saying they might have unsaved data. Thanks for the response


0

Response Number 7
Name: Strick80
Date: December 28, 2007 at 08:04:05 Pacific
Reply:

Solved it:

for /f %%a in (d:\shutdown\shutdown.txt) do (
psloggedon \\%%a > D:\Shutdown\shutdown.tmp
if errorlevel 0 ((
TYPE d:\shutdown\shutdown.tmp | find /i "server"
)
IF errorlevel 1 (
shutdown -m \\%%a -f -s
))

)

regards

Strick80


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows XP Forum Home


Sponsored links

Ads by Google


Results for: .bat to shutdown un-logged on PC's

free tool to show spec's on PC's? www.computing.net/answers/windows-xp/free-tool-to-show-specs-on-pcs/161126.html

Way to to control/limit log-on time www.computing.net/answers/windows-xp/way-to-to-controllimit-logon-time/170103.html

How do I log on to the network? www.computing.net/answers/windows-xp/how-do-i-log-on-to-the-network/70764.html