Friz
(Lurker)
2005-02-24 01:01 PM
Run .bat file as local service?

The organisation I'm currently working for (doing an XP rollout) has Kixtart running several .bat files when a user logs in. Of the many functions these file perform, several of them need to write files to the C:\Windows\System32 directory. Currently the .bat files are being run as the local user which means the local user must have write access to the above mentioned directory. Since I'm not all that keen on continuing to let them have that kind of access, is there a way that we can modify the running of the .bat to use a local system account to run the .bat. Or is using the admin account and password (which I'd rather not have in the script) the only way to go?

Richard H.Administrator
(KiX Supporter)
2005-02-24 01:06 PM
Re: Run .bat file as local service?

What files are you having to write to the System32 directory?

Do you need to do this every time a user logs on, or could you use the task scheduler?


Friz
(Lurker)
2005-02-24 01:18 PM
Re: Run .bat file as local service?

That was my first question....
This place has multiple in-house developed apps. Some brainbox decided that it would be easiest if the update files were run every time a user logged on. The .bat file does a bunch of .dll updates and similar functions. Now it comes down to:
A. Changing the code for 50+ applications
B. Having the sorry assed techie contractor coming up with a workaround.

Three guesses as to which option they picked...


Glenn BarnasAdministrator
(KiX Supporter)
2005-02-24 07:46 PM
Re: Run .bat file as local service?

Continuing on Richard's theme, why not create a scheduled task that runs "At Logon", but uses a domain-admin type account (at least with permissions to write to the System folder) and take the process out lf the logon script.

Look for my TCLib UDF library - with it, you can easily create a script that runs on your workstation and pushes the startup task to a list of remote systems with just 4-5 lines to define the task.

Glenn


MightyR1
(MM club member)
2005-02-24 08:34 PM
Re: Run .bat file as local service?

Well "techie contractor",

take a look at something I made: S.W.A.P. - Start With Admin Powers

Not the most secure method, but my guess is it'll work for you!!!

To install on multiple workstations, one can modify the swapinstaller.kix to a UDF. A new installer script could use an .ini with all computer names as input to install the service...



Sealeopard
(KiX Master)
2005-02-25 04:25 AM
Re: Run .bat file as local service?

Either use the Taks scheduler or use a scheduled admin script that updates the relevant files on the remote computers.

MightyR1
(MM club member)
2005-02-25 08:51 AM
Re: Run .bat file as local service?

Correct,

scheduletask.udf is an other option and more secure.
Like I said, my option isn't the most secure one, but hey, it IS an option...


Kdyer
(KiX Supporter)
2005-02-25 03:07 PM
Re: Run .bat file as local service?

One other option which I have used is to use the SRVANY.EXE/INSTSRV.EXE from the Resouce Kit. One downfall to this is if you use your password and is expires every xx days, you have to change the password to the service as well. Of course, if you do the same thing with a Scheduled Task, this would also be the same..

Thanks,

Kent


Mart
(KiX Supporter)
2005-02-25 04:29 PM
Re: Run .bat file as local service?

Or use dedicated user credentials for this and set the password for this account to not expire. Same goes for the credentials used with the task scheduler.

Friz
(Lurker)
2005-02-28 09:22 AM
Re: Run .bat file as local service?

OK. A few different options. Luckily, I've move that part to "Phase two" of the roll-out so I'll have time to test each of these options...

Thanks.