Posted: Thu Apr 12, 2007 12:29 am Post subject: Logon script to update DB files
Hey All,
I'm trying to help my DB Admin write a logon script that will run when any user logs on. What this script needs to do is check a notepad file for a version number on the clients machine and if that file is not current then it will copy the current DB file over along with the current notepad file.
c:\datastaff\1.1.4.txt is not the current DB it needs to be 1.1.5.txt
So it needs to copy z:\datastaff\datastaff.mdb & z:\datastaff\1.1.5.txt (z: is a network drive that is mapped automatically for all users) over to c:\datastaff.
How can this be done from the GPO logon\logoff properties?
The current logon script we have been trying is not working!!
This is the current script that we are trying. It is a .bat file. When we run it it says that access is denied. The network drive everyone has Read/Write/Modify rights to it and the folder on the c: all users have the same permissions as well. Here is the script that we have been trying.
rem Copy a new front end if the newest version file is not present
cd..
cd..
cd..
if not exist "c:\DataStaff1\VersionNumber1.1.4.txt" copy/y "z:\Naomi\Datastaff\DataStaff.mdb"
if not exist "c:\DataStaff1\VersionNumber1.1.4.txt" copy/y "z:\Naomi\Datastaff\VersionNumber1.1.4.txt"
if exist "c:\DataStaff1\VersionNumber1.1.3.txt" delete "C:\DataStaff1\VersionNumber1.1.3.txt"
Why this - if you are running the batch file from your server, at say a netlogin share, the batch file will fail because you are trying to traverse up the directory structure of the server drive - which probably most users don't have permission for. Thus the batch file will fail as there is no error handling
The reason for the cd.. is to make the cmd prompt go to the root directory, then we need the cmd prompt to go to the c: drive if it is not already there. Here is the new code that my DB Admin just showed me.
rem Copy a new front end if the newest version file is not present
cd..
cd..
cd..
C:
cd DataStaff1
if not exist "c:\DataStaff1\VersionNumber1.1.8.txt" copy/y "z:\Naomi\DataStaff.mdb"
if not exist "c:\DataStaff1\VersionNumber1.1.8.txt" copy/y "z:\Naomi\VersionNumber1.1.8.txt"
if exist "c:\DataStaff1\VersionNumber1.1.7.txt" del "C:\DataStaff1\VersionNumber1.1.7.txt"
As I said before - the cd .. will work from the directory where the login script is. If you want to go to the root dir of c: then use c: then a cd \ - that could be why it is failing
But then in your batch file you are using fully qualified paths: f not exist "c:\DataStaff1\VersionNumber1.1.8.txt" copy/y "z:\Naomi\DataStaff.mdb" so you do not need to do it.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum