Jump to content

Recommended Posts

Posted

I have written a batch script to copy a config file to multiple computers.

 

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

Posted (edited)

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.

Edited by MYK-IT
Posted
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

Posted

You could use Robocopy with the /mir switch. It will only then copy file when you update the source.

 

You can use this 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 1
Posted
Put a call to run the script in the RunOnce section of the registry.

 

This explains exactly how it's done.

 

How to Create a Runonce Script | eHow.com

 

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?

 

\\server\SYSVOL\domain\scripts\Zeitgeist Client\newKey.reg /s

Posted
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?

 


\\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) :D

 

Steve

Posted

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.

Posted
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.
Posted
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) :D

 

Steve

 

:confused: 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

  • 1 month later...
Posted

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...