Page 1 of 1 1
Topic Options
#120180 - 2004-05-26 05:08 PM Shutdown script
wizard79 Offline
Getting the hang of it

Registered: 2003-03-26
Posts: 64
Loc: Australia.
Hi all,

Does anyone use a shutdown script somehow?

What I want is:

Send a net message across network at 6pm saying all computers will shutdown in the next few minutes. The user can click NO if they dont want to shutdown the pc otherwise it will shutdown.

Anyone heard of something like this?

Top
#120181 - 2004-05-26 05:42 PM Re: Shutdown script
Richie19Rich77 Offline
Seasoned Scripter
*****

Registered: 2002-08-16
Posts: 624
Loc: London, England
Yeah use COMNetView() UDF to get a list of all PC's on domain, then use the inbuilt Shutdown command and make sure that you allow the user to cancel if they want.

This should have been posted in the Starters Forum.

Rich

Top
#120182 - 2004-05-26 10:04 PM Re: Shutdown script
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
..also check out the GUI switch of shutdown.exe from the Win2000 Srv reskit (also included by default in w2k3 and WinXP)
_________________________
The tart is out there

Top
#120183 - 2004-05-27 08:42 AM Re: Shutdown script
Wokkeltje Offline
Fresh Scripter

Registered: 2002-08-12
Posts: 31
Loc: Torhout, Belgium
I also use such a script.
I used the logon script to schedule a task that runs at 6 o'clock.
That task asks the user if the PC may be shut down. If the user didn't react in 60seconds I use the Shutdown() function in Kix.

The scheduled job is configured to use the local user account.

Problem now is that the job works if I start him manual, but if the user has left his desk and the PC is locked, I think the shutdown isn't executed.

Is there someone who has experience whit this?
Or someone who knows how I can show a messagebox via a scheduled job that runs as an administrator. Normally you don't see any output.

Top
#120184 - 2004-05-27 08:51 AM Re: Shutdown script
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
add some logging to your script so you can see if it executes or not.
_________________________
!

download KiXnet

Top
#120185 - 2004-05-27 09:38 AM Re: Shutdown script
Wokkeltje Offline
Fresh Scripter

Registered: 2002-08-12
Posts: 31
Loc: Torhout, Belgium
I did some tests, and found that the ShutDown command returned a 0.

Return Code Value
0 = Computer shut down
System error code = Function failed

but the PC didn't shutdown.
* if I run the job manualy there is no problem.
* if I run the job automaticaly trough the scheduler when the workstation is locked the PC won't shutdown
* if I run the job automaticaly trough the scheduler when the workstation is NOT locked the PC WILL shutdown

So I think it is because the workstation is locked. Because this is the only difference.

Top
#120186 - 2004-05-27 10:12 AM Re: Shutdown script
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
do you use forced shutdown?
_________________________
!

download KiXnet

Top
#120187 - 2004-05-27 10:46 AM Re: Shutdown script
Wokkeltje Offline
Fresh Scripter

Registered: 2002-08-12
Posts: 31
Loc: Torhout, Belgium
Code:
  	If @PRODUCTTYPE = "Windows NT Workstation"
$ = Shutdown("","Laatste kans om je werk op te slaan, het afsluiten kan niet meer onderbroken worden.",60,True,0)
Else
$ = Shutdown("","Laatste kans om je werk op te slaan, het afsluiten kan niet meer onderbroken worden.",60,True,2)
EndIf



Here is the code that I use.

Top
#120188 - 2004-05-27 10:58 AM Re: Shutdown script
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so, indeed, shutdown fails as there is no change user can press anything.

try timing a messagebox.
if the timer goes out, do immediate shutdown.
_________________________
!

download KiXnet

Top
#120189 - 2004-06-01 10:13 AM Re: Shutdown script
Wokkeltje Offline
Fresh Scripter

Registered: 2002-08-12
Posts: 31
Loc: Torhout, Belgium
I changed my script so that the messagebox has a timer and when that timer stops, the shutdown is started immediately.

But the problem is still there. The PC won't shutdown if the PC is locked.

With some messages that are written in a textfile I could see that the problem is in the shutdown function.

Is there someone else who has a usefull tip to shutdon a PC?

Top
#120190 - 2004-06-01 10:21 AM Re: Shutdown script
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
what error does the shutdown give you?
how do you call it?
_________________________
!

download KiXnet

Top
#120191 - 2004-06-01 11:27 AM Re: Shutdown script
Wokkeltje Offline
Fresh Scripter

Registered: 2002-08-12
Posts: 31
Loc: Torhout, Belgium
there is no error, the shutdown command returns a zero.
strange

It just won't do the shutdown on a locked workstation. In any other situation the shutdown works.

Top
#120192 - 2004-06-01 12:49 PM Re: Shutdown script
Wokkeltje Offline
Fresh Scripter

Registered: 2002-08-12
Posts: 31
Loc: Torhout, Belgium
I got my problem solved with a freeware program.
I does everything, it has a GUI or you can use command line

PowerOff 3.0.1.3

Top
#120193 - 2004-06-01 04:02 PM Re: Shutdown script
wizard79 Offline
Getting the hang of it

Registered: 2003-03-26
Posts: 64
Loc: Australia.
thanks guys - you are legends!
Top
#120194 - 2004-06-03 12:52 AM Re: Shutdown script
rvdmast Offline
Fresh Scripter

Registered: 2003-07-01
Posts: 15
XP wont shutdown when the PC is locked, this is by design.
you could try if the /f (force) option of the shutdown utility helps.

Top
#120195 - 2004-06-03 01:30 AM Re: Shutdown script
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
think he just said it works.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 302 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.064 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org