Page 1 of 1 1
Topic Options
#108590 - 2003-11-20 11:59 PM Kix and Scheduled Tasks
TexasBrownsFan Offline
Fresh Scripter

Registered: 2001-02-07
Posts: 36
Loc: Fort Worth , TX, USA
Does anyone know of away to modify an existing scheduled task through a kix script?

I saw the post for the Scheduled Task Manager UDF, but i don't believe that is what i am looking for. The problem that i am running into is that when creating our corporate image and having the tasks implace is that after i run Sysprep and bring the machine back on line, the User Information in the scheduled tasks gets wiped out.


I would like to be able to reset that information with some sort of script.

Any Ideas?

Top
#108591 - 2003-11-21 12:05 AM Re: Kix and Scheduled Tasks
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
that is what sysprep does... If it is local accounts, domain accounts stay.

Code:
 			$objWMIService	= GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
if $objWMIService
$colItems = $objWMIService.ExecQuery("Select * from Win32_ScheduledJob",,48)
$taskexist=0
For each $objItem in $colItems
if $objItem.Command = $command
if $objItem.DaysOfWeek=$days
if $objItem.StartTime=$mstime
$taskexist=$objItem.JobId
else
$=$objItem.delete
endif
else
$=$objItem.delete
endif
endif
next
if not $taskexist
$runrpt = 0 ; boolean for run repeatedly
$daymon = 0 ; used for specific dates
$interact=1 ; boolean for interactive with desktop
$objNewJob = $objWMIService.get("Win32_ScheduledJob")
$errJobCreated = $objNewJob.Create($command,$mstime,$runrepeatedly,$days,$daymon,$interact)
$objWMIService = 0
endif
endif

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#108592 - 2003-11-21 06:56 PM Re: Kix and Scheduled Tasks
TexasBrownsFan Offline
Fresh Scripter

Registered: 2001-02-07
Posts: 36
Loc: Fort Worth , TX, USA
What about password information associated with this task in windows XP. That is the portion of the task that i am concerned about.
Top
#108593 - 2003-12-04 05:37 PM Re: Kix and Scheduled Tasks
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
See also TaskScheduleControl() - Library of UDFs to manage Windows Task Scheduler
_________________________
There are two types of vessels, submarines and targets.

Top
#108594 - 2003-12-08 05:00 PM Re: Kix and Scheduled Tasks
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
The tsControl library will definately do this.. read remote task lists, obtain task details, and read account but not password info. It stores it in an array for easy manipulation, and with one call, updates the task.

Download the ZIP file from NTDoc's site - be sure to review the sample script before starting out with tsControl on your own! It can be complex to get started, but it offers a lot of task management control.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

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 657 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.06 seconds in which 0.032 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