Link to home
Create AccountLog in
Avatar of stalliondz
stalliondzFlag for United Arab Emirates

asked on

Deployment of an (.ini) file to C:\ in a 80 Domain clients

Hello,
I have a file (abc.ini) that i want to deploy in 80 Domain client (domain running on windows 2003 R2)

I was wondering if any one has a script that can do that by copying the file from a network shared folder to the client machines and the script will check if the file already exists, if it exists it should over write it with the new (.ini) file.

We currently have an application that uses the (.ini) file to determine some settings and we want to change these settings from time to time, and it's very hard to do it every time manualy, as also the users dont have permisions to change it and an administrator should do it.
SOLUTION
Avatar of m_walker
m_walker

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
If you need admin permissions to do it, put it in the computer startup script instead.
Avatar of stalliondz

ASKER

I'm not really a VB programer, can any one help putting the above in a VB Script !

this is the details that i have

copy /-Y \\dcsrv\Deployment\test.ini C:\Epro  

Source: \\dcsrv\Deployment\test.ini
Destination: C:\Epro  


thanks


It doesn't need to be VB, you can just do this as a batch file using the command you just put in the post above...

I tried it and it worked, but i have 2 questions:

- When i re-run it again i get the command prompt and it asks me if i want to overright the file or not ( i believe with the /-Y switch it should do it without asking), but still it's asking! will that be the case also if i run it as a (Computer) startup script! or it will over write it when it's on startup script!

- if i want to delete the file that has been copied , how to do that with the same method !

Thanks in advance
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
To delete the INI file

Cheers,
Rene

 
@ECHO OFF

REM ASSUMING THAT ALL OF YOUR PCs STARTS WITH \\PC

SETLOCAL enabledelayedexpansion

REM THE LOG FILE WILL HAVE THE SAME NAME AS THE BATCH FILE BUT WITH THE .LOG EXTENSION
SET LogFile=%~n0_DeleteINI.log
IF EXIST %LogFile% DEL %LogFile%

FOR /F %%A IN ('NET VIEW ^| FINDSTR -i "\\PC"') DO (
	DEL /f /q "%%A\C$\IniFileFolder\abc.ini"
	IF !errorlevel! == 0 (ECHO %%A OK >>%LogFile%) ELSE (ECHO %%A ERROR >>%LogFile%)
)
ECHO.
PAUSE
EXIT

Open in new window

ReneGe,
Can you clarify that script, i couldnt make it work,
shout i put it in a file and save it as .BAT or Vbs!!! and how to define the following:

File name to be copied
File source (Shared location)
Destination

i'm sorry but i couldnt understand it well as i'm not really a programmer

Kindly advise
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
stalliondz,

I'm as well sorry that it's taken me so long to reply.

1) Put it in a .bat file
2) File name to be copied: Replace abc.ini by the path and name of your INI file
3) Destination:

"%%A\C$\IniFileFolder"

"%%A" : Will be the computer name found in the 'NET VIEW ^| FINDSTR -i "\\PC"', where in this case, will be all the computer names starting with "\\PC". Customize it according to your environment.

IniFileFolder : Is a folder in your destination PCs. Customize it according to your needs.

@Draxonic
Your comment looks interresting. Going to bed. I'll read it later.

Cheers,
Rene