Logon script to update DB files

Networking/Security Forums -> Databases

Author: Thrawn717 PostPosted: 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!! Twisted Evil

Any help would be great!!
Thanks
James

Author: stimpy99 PostPosted: Thu Apr 12, 2007 9:31 pm    Post subject:
    ----
What is in you current script - might just be a typo - post and everyone can take a gander

Author: Thrawn717 PostPosted: Thu Apr 12, 2007 9:37 pm    Post subject:
    ----
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"

Author: stimpy99 PostPosted: Thu Apr 12, 2007 9:58 pm    Post subject:
    ----
Thrawn717 wrote:

cd..

cd..

cd..


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

What is the exact error message you are getting?

Author: Thrawn717 PostPosted: Thu Apr 12, 2007 10:07 pm    Post subject:
    ----
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"

Author: stimpy99 PostPosted: Thu Apr 12, 2007 10:14 pm    Post subject:
    ----
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.



Networking/Security Forums -> Databases


output generated using printer-friendly topic mod, All times are GMT + 2 Hours

Page 1 of 1

Powered by phpBB 2.0.x © 2001 phpBB Group