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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to run a bat script as a user.

Status
Not open for further replies.

Albion

IS-IT--Management
Aug 8, 2000
517
0
0
US
I am creating a database for our new accounting system (Yeah, I know it would have been nice to have it incorporated in the software, but as we all know, promises are for campaigns.) Anyway.

The database is pretty simple. It just creates a new shop order number based on the department, stores the person who took the job out, the department, the shop order number and a few other things in the database. It then calls a batch script to create the directory structure for the job and lastly copies a couple of ISO9000 specific files into that directory.

The batch script is necessary because CACLS is the only way I can create group and user permissions without taking a 2 year Associates Degree in VBA.

At the present I am using "CreateProcessA" which does a fine job of running the bat script to create the directories. My problem is that users must log in as a user with Admin privileges to be able to create and set the proper permissions. I need to users to be able to open the database as themselves and then run the batch file as the specific user.

I've taken a look at and tried both CreateProcessAsUser and CreateProcessWithLoginW. Both of these error out when run. I've come across this little snippet from MS and have decided that having to change every machine in an attempt to fix this process is not acceptable. I've also tried to use CreateProcessA to start RunAs which had the same problem as CreateProcessWithLoginW.

Does anyone have any suggestions? I'm not at all against using a commercial product that contains some libraries for creating Active Directory permissions.
 
What is the OS you are dealing with? I'm assuming Access is the database, what version of Access? Could you post the Batch script?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top