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

Logon Batch Script - Anyway to use admin permissions when copying?

Status
Not open for further replies.

nitrokid

Technical User
Sep 14, 2005
89
GB
Hi

We run a sbs 2K3 domain. We use the standard SBS Logon Script to copy the latest version of our Access database to the 'all users' folder (we need it to stay this way, as both domain and non domain profiles will use it from time to time). However, if this is done from a user without local admin or power user rights, the database file ends up as 'read-only'. so the only way we have to acheive this is to set all users as local admins, which is not ideal at all

Is there any command i can use in the batch file to ensure that the file is copied with admin permissions, yet have the user profile stay as standard user
 
Modify the NTFS permissions for "Everyone" or "User" on the All User Folder. The problem is not the file. The problem is that User and Everyone do not have both Read and Write (Change) priviliges in the All User Folder.

ECHO Y| cacls.exe "%ALLUSERSPROFILE%" /T /G BUILTIN\Administrators:F
ECHO Y| cacls.exe "%ALLUSERSPROFILE%" /T /E /G System:F
ECHO Y| cacls.exe "%ALLUSERSPROFILE%" /T /E /G BUILTIN\Users:C
ECHO Y| cacls.exe "%ALLUSERSPROFILE%" /T /E /G Everyone:C
ECHO Y| cacls.exe "%ALLUSERSPROFILE%" /T /E /G "BUILTIN\Power Users":C

You can make this less generous if you know the specific folder you are going to use to place the database. For example, if the database is place in %ALLUSERSPROFILE%\Documents\Database then you would change the batch file to reflect this narrower scope:

ECHO Y| cacls.exe "%ALLUSERSPROFILE%\Documents\Database" /T /G BUILTIN\Administrators:F
ECHO Y| cacls.exe "%ALLUSERSPROFILE%\Documents\Database" /T /E /G System:F
ECHO Y| cacls.exe "%ALLUSERSPROFILE%\Documents\Database" /T /E /G BUILTIN\Users:C
ECHO Y| cacls.exe "%ALLUSERSPROFILE%\Documents\Database" /T /E /G Everyone:C
ECHO Y| cacls.exe "%ALLUSERSPROFILE%\Documents\Database" /T /E /G "BUILTIN\Power Users":C

 
brilliant. Will try. Sounds logical anyway

Cheers!
 
Silly question but why aren't you sending down a shortcut to the database and assigning rights at the server? Using this method everyone would have the latest version all the time.

What is the purpose of the database? Can you convert it to SQL for more robustness?

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
The database is edited throughout the day almost everyday, both frontend and backend, so people using it whilst modifications are taking place isn't such a good idea.

Conversion to SQL is apparently in the plans
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top