Link to home
Start Free TrialLog in
Avatar of mishalk
mishalk

asked on

group policy scripts

hi
i have a file called tns.ora which i want to replace and keep the new tns.ora in  in all users
 c:/oranet. how can i do this using a script through group policy.
Avatar of Chev_PCN
Chev_PCN
Flag of South Africa image

Use the "rename" command. It works for files & directories:

Ren tns.ora tns.ora.old

Then use something like xcopy to copy the new version down.

XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
                           [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]
                           [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z] [/B]
                           [/EXCLUDE:file1[+file2][+file3]...]

Use the good ol' fashioned xcopy /? to get more detail.


Avatar of Lee Osborne
If the domain users have write permission to the folder in question, you can create a GPO logon script for the users, and paste this code into a new batch file -

xcopy /y "\\servername\folder\tns.ora" "c:\oranet\tns.ora" >nul

Put this batch file reference as a logon script in -

GP MMC > User Configuration > Policies > Windows Settings > Scripts > Logon

Lee
Sorry, forgot you wanted to keep the existing file too!

rename c:\oranet\tns.ora tns.ora.old
xcopy /y "\\servername\folder\tns.ora" "c:\oranet\tns.ora" >nul

Lee
Avatar of mishalk
mishalk

ASKER

rename c:\orant\NET80\ADMIN\TNSNAMES.ORA TNSNAMES.ORA.old
xcopy /y "\\192.168.1.24\Oracle TNSname update\TNSNAMES.ORA" "c:\orant\NET80\ADMIN\TNSNAMES.ORA" >nul



this is the exact script and the location, what is happening is it is renaming the file but not copying to the folder,  i tried running it manually ,but it is doing it
Avatar of mishalk

ASKER

sorry
but it is not doing it
ASKER CERTIFIED SOLUTION
Avatar of mishalk
mishalk

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mishalk

ASKER

after removing the /y and instead of xcopy , i used copy