Windows Server 2000/2003 Thread, Copying files to multiple computers - Running the script once in Technical; I have written a batch script to copy a config file to multiple computers.
Code:
REM Copies the FuseCore Config ...
-
11th August 2011, 12:18 PM #1 Copying files to multiple computers - Running the script once
I have written a batch script to copy a config file to multiple computers.
Code:
REM Copies the FuseCore Config File to the installation folder to ensure that the client software can locate the database on the Server.
XCOPY "\\server\SYSVOL\domain\scripts\Zeitgeist Client\FuseCore.config" "C:\Program Files\OxBox\Zeitgeist AQA GCE German - 31d6f5c4-196f-4a1c-9a18-47d80a262a4d\" /Y
At the moment I have deployed it as a start up script with the GPO to which the software relates. The only problem I can see with this, is the script will run every time the computer starts, which is not ideal. Is there a way to ensure that the script only runs once or is it a case of a manual job?
I am on server 2003 with XP clients.
Thanks
nN
-
-
IDG Tech News
-
11th August 2011, 12:34 PM #2 Use IF EXIST command to check if a file/folder you are trying to copy over is already on the computer.
You could always do it through Group Policy Preferences (Computer Configuration > Preferences > Windows Settings > Files) and then use Item Level Filtering to only apply if file/folder does not exist.
Last edited by MYK-IT; 11th August 2011 at 12:37 PM.
-
-
11th August 2011, 09:30 PM #3 
Originally Posted by
MYK-IT
Use IF EXIST command to check if a file/folder you are trying to copy over is already on the computer.
You could always do it through Group Policy Preferences (Computer Configuration > Preferences > Windows Settings > Files) and then use Item Level Filtering to only apply if file/folder does not exist.
The file does exist. The difference in the files is that the newer one, which I am trying to copy over includes the path to the database, which is on the server
If you do a manual install this would be done as part of the normal installation wizard, but that would mean an individual install, which I am trying to avoid.
I have even looked at editing the MSI with ORA but cant see where to add a new column or even what to call it. I have also asked tech support and they could not help
Thanks
nN
-
-
11th August 2011, 09:53 PM #4 You could use Robocopy with the /mir switch. It will only then copy file when you update the source.
You can use this code
Code:
robocopy.exe "\\server\SYSVOL\domain\scripts\Zeitgeist Client" "C:\Program Files\OxBox\Zeitgeist AQA GCE German - 31d6f5c4-196f-4a1c-9a18-47d80a262a4d" /mir
You can extract robocopy from the Windows Server 2003 Resource Kit Tools. You dont have to install it on all clients, you can just host robocopy .exe on a share
-
Thanks to FN-GM from:
networkingNut (12th August 2011)
-
11th August 2011, 10:06 PM #5 Put a call to run the script in the RunOnce section of the registry.
This explains exactly how it's done.
http://www.ehow.com/how_5175782_crea...ce-script.html
Last edited by jinnantonnixx; 11th August 2011 at 10:32 PM.
-
Thanks to jinnantonnixx from:
networkingNut (12th August 2011)
-
12th August 2011, 09:13 AM #6 
Originally Posted by
jinnantonnixx
I will give that a go I think. If I am thinking correctly, it is just a case of placing the reg key on a shared directory, creating a batch script to call the key and when adding it to GPO putting /s in the 'switches' box?
Or does the /s have to go directly after the filename?
Code:
\\server\SYSVOL\domain\scripts\Zeitgeist Client\newKey.reg /s
-
-
12th August 2011, 09:23 AM #7 
Originally Posted by
networkingNut
I will give that a go I think. If I am thinking correctly, it is just a case of placing the reg key on a shared directory, creating a batch script to call the key and when adding it to GPO putting /s in the 'switches' box?
Or does the /s have to go directly after the filename?
Code:
\\server\SYSVOL\domain\scripts\Zeitgeist Client\newKey.reg /s
I'm not sure you're thinking runonce is what it is... It'll run once in terms on "not every startup", however if you've got the GPO applying everytime it'd still run everyone, just once per apply? If that makes sense. (Maybe I misunderstood how you worded that but we'll see) 
Steve
-
-
12th August 2011, 09:31 AM #8
-
-
12th August 2011, 09:54 AM #9 Are you using Windows 2008 server? If so, you can use a GPO to deploy the file. In fact, this is probably the easiest way.
Create a GPO, under the Computer Configuration side, expand Preferences>Windows Settings>File
Right click in the panel, and specify files to copy.
Here, you can specify what happens if the file already exists. Choose 'Create'.
This is quite a nice way of copying config files. There are other options, such as 'Delete' and 'replace' for when you need to change the config file at a later date.
-
-
16th August 2011, 08:55 PM #10 We use Impero for sending out quick files like this. It worked a treat when I had to make changes to Kodu on the fly.
Gareth
-
Thanks to garethedmondson from:
russdev (17th August 2011)
-
17th August 2011, 09:55 PM #11
- Rep Power
- 8
Personally speaking, i'd make a snapshot Msi containing the file(s) you want to deploy. I sent out our Crtl Alt Del background .bmp file using this method, and also a .Scr file. Works great, and its fuly automated for new computers to the network.
-
-
22nd August 2011, 02:30 PM #12 
Originally Posted by
Steve21
I'm not sure you're thinking runonce is what it is... It'll run once in terms on "not every startup", however if you've got the GPO applying everytime it'd still run everyone, just once per apply? If that makes sense. (Maybe I misunderstood how you worded that but we'll see)
Steve
Are you suggesting it is best to remove the Script from the startup GPO and add it to the RunOnce folder in the registry?
What I cant get my head around it how to copy the updated RunOnce Directory to multipe machines, without using the Startup script option in the GPO, ie to avoid making the RunOnce folder being copied multiple times.
Hope that makes sense
nN
-
-
28th September 2011, 09:32 AM #13
- Rep Power
- 0
When I do something like this, I put a flag on the client computer.....
How?
When you copy your config file, copy another small text file named after the version # (ie ver-1-1.txt).
You will be able to use IF EXIST ver-1-1.txt in your batch file.
If you push a never version (if not exist), first delete the old flag (DEL ver-*.txt) to avoid having multiple versions on the client.
Easy and simple.
Here is a good one for everybody.
To push new files (or install software), I am using a small batch file to create a scheduled task on the WorkStations.
Nobody has to be logged on the computers, they just have to be turned ON (advantage of using wakeup on LAN)
You need a text file containing the name of the workstations (one name per line) where the software has to be installed (export the names from your AD).
To push the scheduled task on the workstations, use the 'system' user (System is an administrator on all computers attached to the AD).
The way that it works, you create a scheduled task to run in one hour. When the scheduled task is installed, you tell the WS to run it now.
Here is an example:
rem @echo off
set program=D:\apps\xxx.exe
set runtime=09:54
rem +++++++++++++++++++++++++++++++
rem + Do not modify anything under this line +
rem +++++++++++++++++++++++++++++++
set program1=%program%
rem cd %0\..
for /f %%i in (ws.txt) do (
echo %program% was deployed at%TIME% on workstation %%i >> %program%.log
copy %program% \\%%i\D$
)
rem ************************************************
rem * now that the installation software is copied on the WS *
rem * we create a schedule task for each WS and run it right away *
rem * The switch /ST (start time) has to be set to a time greater *
rem * than the actual time. Otherwise the task will never run. *
rem ***********************************************
for /f %%i in (ws.txt) do (
SCHTASKS /Create /S %%i /z /F /RU SYSTEM /SC ONCE /ST %runtime% /TN %%i /TR "D:\%program1%
SCHTASKS /run /S %%i /TN %%i
)
Bert
-
SHARE:
Similar Threads
-
By DaveP in forum Downloads
Replies: 6
Last Post: 12th September 2011, 10:24 AM
-
By mats in forum Netbooks, PDA and Phones
Replies: 0
Last Post: 27th January 2011, 05:44 PM
-
By WithoutMotive in forum How do you do....it?
Replies: 13
Last Post: 12th February 2010, 02:34 PM
-
By tosca925 in forum How do you do....it?
Replies: 5
Last Post: 28th April 2007, 07:31 AM
-
By dezt in forum How do you do....it?
Replies: 7
Last Post: 5th July 2006, 11:43 AM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules