Question

Locked

Create a Scheduled Task Script

By IT_Girl_47 ·
I would like to create a script that creates a scheduled task and copies a file to a PC with users having restricted access. The scheduled task will run a VB Script that displays a message to mobile users that their network password will expire and they need to change it. What do I need to make sure I have for the username and password in the Schedule task line that will run the task on each user's PC? I know that if you don't have a correct username it will not run the task. Also, I do not want to enter a network admin or my account in the script. Thanks

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

???

by IT_Girl_47 In reply to Create a Scheduled Task S ...

Is there anyone that can give me guidance on this question? Thank you.

Collapse -

Are you scheduling it from a central location?

by jruby In reply to Create a Scheduled Task S ...

This reply assumes a domain environment, workgroups could use something similar if their set up right.

Have you looked at using SCHTASKS to schedule the tasks from a central location? From your workstation (logged in with appropriate Domain Admin access), you can schedule tasks to run on other workstations. You will have to put in your credentials in order to schedule the tasks, but those would only be visible on your workstation, not the end-user stations.

A simple example:


SCHTASKS /create /S remoteworkstationname /sc once /tn alert /tr alertscript.vbs /RU domain\profile /RP password

There's a couple of parameters missing from the command line, but they will depend on your environment so I excluded them for clarity.

Hopefully this helps you out.

Jim

Collapse -

Is this what you were looking for?

by LarryD4 In reply to Create a Scheduled Task S ...

I'm a bit confused.. Do you want to schedule a VB Script on a PC remotely? Or perhaps do you want to schedule a VB script remotely for all the PC's in your network.

This script will schedule a task on the PC but if its a network wide VB script, why not put it in the GP or as a log in script. So everytime the user logs in it checks and runs the script?

Anyway here is the VB code that schedules a task locally.

strComputer = "."
Set objService = GetObject("winmgmts:" & strComputer)
Set objNewJob = Service.Get("Win32_ScheduledJob")
errJobCreated = objNewJob.Create("Monitor.exe", "********123000.000000-420",
True , 1 OR 4 OR 16, , , JobID)
If Err.Number = 0 Then
Wscript.Echo "New Job I " & JobID
Else
Wscript.Echo "An error occurred: " & errJobCreated
End If

Collapse -

Yes...

by IT_Girl_47 In reply to Is this what you were loo ...

I am going to use GP to deploy the script. I was not getting the task to run at all with the following script because I did not include the credentials. I would like 2 tasks to run so that the users are notified a few times of their password expiration. (That is what my intentions for this script are)

schtasks /create /SC Weekly /D FRI /TN Test2 /TR c:\pwd.vbs /ST 12:00:00 /SD 06/03/2008
schtasts /create /SC weekly /D WED /TN Hello /TR C:\pwd.vbs /ST 12:00:00 /SD 06/24/2008

xcopy P:\IT\test.vbs c:\test.vbs /I /H /K /Y

I will try your VB code as well. Thank you

Back to Software Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums