Page 1 of 1 1
Topic Options
#103872 - 2003-08-17 07:00 PM Using a Scheduled Task to run KIX
johnt Offline
Fresh Scripter

Registered: 2002-03-01
Posts: 6
I'm trying to setup a scheduled task to call a script to log off users at a certain time. Does anyone know how to use a scheduled task to run a kix script?

I was successful using PSSHUTDOWN through task scheduler, however this tool shutdown the computer if the user was logged out.

Top
#103873 - 2003-08-17 07:15 PM Re: Using a Scheduled Task to run KIX
Richie19Rich77 Offline
Seasoned Scripter
*****

Registered: 2002-08-16
Posts: 624
Loc: London, England
Use Logoff command, 1 will force the user to quit all applications.

code:
LogOff(1)


Top
#103874 - 2003-08-17 07:16 PM Re: Using a Scheduled Task to run KIX
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
how to use?

like this:
code:
 at 01:01 /every:MO,TH,WE... "wkix32.exe "mykix.kix"" 

or similar.
_________________________
!

download KiXnet

Top
#103875 - 2003-08-18 03:35 AM Re: Using a Scheduled Task to run KIX
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
See also the documentation for the ScheduleTask() UDF, which is available in the UDF Forum.
_________________________
There are two types of vessels, submarines and targets.

Top
#103876 - 2003-08-18 04:37 PM Re: Using a Scheduled Task to run KIX
johnt Offline
Fresh Scripter

Registered: 2002-03-01
Posts: 6
I'm using this to schedule the task.

code:
   shell '%COMSPEC% /c at 04:00 /interactive /every:M,T,W,Th,F,S ""%WINDIR%\wkix32.exe"" ""winexit.kix"" 

This works great on an XP worksatation, but the 2000 workstation fails.

I'm using SMS to copy the files to the workstations, so it can run with admin rights.

Top
#103877 - 2003-08-18 04:46 PM Re: Using a Scheduled Task to run KIX
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
This will only work on a local computer without the ability to set any account credentials.
_________________________
There are two types of vessels, submarines and targets.

Top
#103878 - 2003-08-18 04:56 PM Re: Using a Scheduled Task to run KIX
johnt Offline
Fresh Scripter

Registered: 2002-03-01
Posts: 6
So the System account won't do what I need here?
BTW thanks for the quick reply's.

Top
#103879 - 2003-08-19 01:07 PM Re: Using a Scheduled Task to run KIX
johnt Offline
Fresh Scripter

Registered: 2002-03-01
Posts: 6
I found the problem I was having. Because the task is using the system account it was hanging on part of the script that was seeing if a network drive existed.
code:
 $Selection = MessageBox("This PC Needs to be logged out. Please save your work and log off. Would you like to log off now?","Time to Logoff",36, 15)
If $Selection = 6
LogOff(0)
Endif
If $Selection = -1
LogOff(0)
Endif

Does anyone know how I can prevent this from running if no one's logged in to the PC without looking at the network?

Top
#103880 - 2003-08-19 01:34 PM Re: Using a Scheduled Task to run KIX
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I would actually change your code to:
code:
$Selection = MessageBox("This PC Needs to be logged out. Please save your work and log off. Would you like to log off now?","Time to Logoff",36, 15)
If $Selection = 6 or $Selection = -1
LogOff(0)
Endif

what comes to logged on users...
hmm, at least you can see the connections with "net sessions"
_________________________
!

download KiXnet

Top
#103881 - 2003-08-19 04:37 PM Re: Using a Scheduled Task to run KIX
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You cannot use the MESSAGEBOX with scheduled tasks as the message box will show up for the account running the task, not the account that is logged in for an interactive session. You will need to use SendMessage() and send it to the local computer if you want messages displayed to a potentially logged-in user. See also the UDF Forum for UDFs that determine whether there are users logged in.
_________________________
There are two types of vessels, submarines and targets.

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 1471 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.052 seconds in which 0.025 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