ZDNet UK


Skip to Main Content

ZDNet.co.uk - Winner of Best Business Website 2007
  1. Home
  2. News
  3. Blogs
  4. Reviews
  5. Prices
  6. Resources
  7. Community
  8. My ZDNet

 

ZDNet UK RSS Feeds


IT Jobs

General Forum


Next

Previous

1



Distributing a scheduled task

Thursday 21 February 2008, 12:31 PM

Hi
I have written a script which when run a client workstation will download a registry file to set cleanmgr settings and copy a cleanmgr and defrag task into the scheduled task.

BUT..although I set up the tasks originally to run as a network administrator, the tasks that end up on the workstation are set to tun as the local user but presumably with the admin password as they will not run! (unless I change the run as user manually which kinda negates the object of the script :)

Any ideas anyone?
Geoff



Tuesday 26 February 2008, 12:38 PM

Hi there. Could you give a bit more information about the situation? For example, what are you running locally? (service, .bat file, etc.?) And how are you deploying the script: Are you using group policy or remote admin software, for instance?



Tuesday 26 February 2008, 2:15 PM

  • Quote

Karen Friar wrote:

Hi there. Could you give a bit more information about the situation? For example, what are you running locally? (service, .bat file, etc.?) And how are you deploying the script: Are you using group policy or remote admin software, for instance?


Hi Karen
At the moment, I am distributing a vbs script to a user via e-mail and running the script on the local PC.
The script copies the two tasks from a file server (copied there from the windows \task folder) and places them in the local windows\tasks folder. It also runs a register file to load the results of a cleanmgr /sageset:1 into the local registry (this bit works fine)
My problem is that the 'run as' user for the tasks set on the local machine is set to the local user rather than the admin account with which they were set up.

Geoff



Friday 29 February 2008, 5:09 AM

It would be helpful to know if the system is running in a Domain or as a stand=alone or workgroup workstation.
Usually cscript and wscript will not run under runas using admin credentials, especially since SP2. If you are able to elevate the logon-User to Admin remotely, you can script the logon account to demote to User again after the main action in the script runs, then force a reboot. While the account is still in Admin mode, put the task into HKLM\Software\Microsoft\Windows\CurrentVersion\Run or Runonce. Have it install itself on a boot up as Admin then set Task Manager task to run on the schedule you want but as a task under HKLM, that will run it under the service account. Finally in a second stage script, demote the User back to User.




Next

Previous

1