Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script wont work?? 1

Status
Not open for further replies.

Highland

MIS
Jul 4, 2001
451
GB
I've "wrote" the following script to run scheduled every nite to keep an updated copy of the ERD on a central server, why will the batch file run from a command line and not complete within the scheduler...???? The rdisk runs no problem it appears to be something to do with the file copy...????? Any ideas.........!!!!

rdisk /s-
net use z: \\itssfp05\hydra04erd$ /persistent:no
copy c:\wtsrv\repair\*.* z:net use z: /delete
exit


itssfp05 is the "central server" and hydra04erd$ is a share on this server.....

It's set-up as a batch file, although started life as a command file.....
 
Is this on NT 4 or 2000.

If its on NT4 then you will need to change the service account for task scheduler to a domain account and set the service to start automatic.

If it on 2000 then you can specify an account to use when executing the batch file.

In either case the account that the Task Scheduler uses must have access accross the domain.

remember that the this is an interactive service and the machine must be left logged in.

Dan

 
Yeah, I think you're right...!!! Its permissions...!!!

BUT, scheduler is set-up to use the local system account...???? How can I change this as it wont allow me to uncheck this option...???? Is there a way of assigning permissions to the system account...????

 
I asume you are logging in with an account that has permission to change such settings. Try stoping the service.

Dan
 
Yeah logged in with Admin rights, but the check buttons are greyed out.....???? Tried stopping the service too...!!!

 
Tried both Local and Domain Admin accounts.......

Is there another process or service that has dependancy on the scheduler....????

 
Can you make any changes to the service at all like changing the startup options to manual etc..., if you can set to manual and do a reboot, and then try changing the account details again.

Dan
 
Yeah, tried that....!!!!

I think the scheduler "uses" the rpc service, I think the inability to change the scheduler settings is because of this dependency...??? I'm going to set-up a PC to "play" with before trying too many things on a "live" server....!!!!!

Thanks.............

 
According to the MS Regentry Help...."U must define access controls on the Schedule Key itself if u want to run in a account other than the local admin account".....naturally MS do not tell u how to do this.....does anyone know how I do this...??????

 
I Assume you mean setting permissions on certain registry key. You can do this by using Regedt32, browse to the key you wish to set ACL's on then click on the permissions menu, you can then assign the permissions you need. Although this does sound odd to me, I have never had to do this before, unless someone has beaten you to it and set permissions only for the account it is already using???

Dan
 
Thanks........OK I tried the permissions thing as you suggested and added a domain admin account to the set for the Task Scheduler and it still doesn't help.....beginning to think I'm over-complicating the whole thing.....!!!!!

It is definitely permissions, if I run a simple batch file within the scheduler it fails and asks for a password for the share it is copying files to, the same batch file runs fine from a command prompt etc.....this would suggest that the account the scheduler is using to run the batch file doesn't have domain permissions...????....any suggestions...???? It just seems so ridiculous for a 2 line batch file...?????!!!!!!!
 
I think you have other problems with permissions in that you can seem to change the account that the Schedule service uses, if you cant do this then there aint going to be a lot you can do to fix it. Are you running the script from a pc or server. has the PC or server crashed recently, check the "Crash on Audit failure" in the registry, if it is set to 2 then you need to set it back to 1. this may explain the lack of admin functionality. Yer in fact that where i would start first check out the crach on audit fail in the Registry
HKLM\system\currentcontrolset\control\lsa

set it to 1.

Let me know

dan
 
You shouldn't have to be changing permissions to the registry unless you are trying to write to the registry. When you go to the schedule service and check startup, if the box is greyed out, you have installed IE5.0 or higher and the schedule service itself must run as the local system account. If this is the case, you can go to windows explorer and select scheduled tasks. Once this is open right click the job you are working on and select properties or if it is not available schedule the job and select properties. In the run as box select an account with admin access to the local server and at least write access to the server you are righting to and you should be good to go.

there is a kb article available on MS's website addressing the changes to the schedule service with IE5.0 and higher. Good luck
 
Brilliant...!!!! I managed to wreck the PC on which I was testing.....never play with the registry etc etc...!!! Anyway after re-installing the base O/S with no service pack (or explorer upgrades) the scheduler was magically working, with full control over account settings etc...I would probably have thought it was something to do with the service packs (it was previously running as an sp6) then I read msconmw's message re explorer....checked one of our live servers and managed to schedule and run the script...I think it was down to setting the domain password for the account it is scheduling the job to run under....

A huge thank you to everyone for your help/suggestions and it just goes to show how valuable a resource this is....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top