quick way of copy a file to multiple locations ?

Soldato
Joined
18 Oct 2002
Posts
10,078
Location
At home
Hi,

I need to copy an ini file to everyone's personal drive here. Was wondering what is the best way to do this.

In this case it is their 'H' drive, and from an admin point of view, in the root of the 'h' drive there are loads of folders which is basically their login names, and that is the user's h-drive.

Was thinking group policy so when users log on they automatically get the file ?

login script ?

any other easy way ?

Thanks
 
Login script looks like the easiest way to do it myself.

Or a VB script to iterate through every sub directory of a folder and copy the file across.
e.g.
\\server\userdata\*loops all folders here with usernames*

I dont imagine that either of those would be too difficult or time consuming to create, if you want some help with specifics then just ask :)
 
login script is the way forward!

Code:
@echo off

IF EXIST "\\servername\share\%username%\filename.ini" GOTO END
ELSE copy "\\servername\share\filename.ini" "\\servername\share\%username%\"

:END

Will check for existance of file, if it's there then it does nothing, if it's not then will copy the file to their user directory.

Note: filename.ini is the name of your file.
Note: %username% will only work if the directory name is identical to their username.
 
Indeed, and if a new profile is created then you can be sure that the file will be copied to their profile too, unlike if you did a one off run through all directories and copied the file across.

The_KiD has the answers :D
 
Of course, that will only be applied when the user logs in. Personally I'd be writing some vbscript, so I could make it happen whenever I wanted. After that, tag the script onto a GPO to maintain consistency :)
 
Pyrosoft said:
Indeed, and if a new profile is created then you can be sure that the file will be copied to their profile too, unlike if you did a one off run through all directories and copied the file across.

The_KiD has the answers :D

lol there's a first :p

This is our current login script :p has some stuff in for checking for a virus we were hacing issues with a while ago, should remove it, but you just never know when the bloody thing might rear it's ugly head again.

Code:
@echo off

REM =====================Check for and install BGInfo================
IF %computername% == LCH-CTX GOTO BGEND ELSE
IF %computername% == LCH-CTX2 GOTO BGEND ELSE
IF %computername% == LCH-CTX3 GOTO BGEND ELSE

IF EXIST "c:\bginfo\Bginfo.exe" GOTO BGCOPY2 ELSE GOTO BGCOPY

:BGCOPY
	MD c:\bginfo
	COPY "\\serverfile\itdept\utilities\bginfo\bginfo.exe" "C:\bginfo"
	COPY "\\serverfile\itdept\utilities\bginfo\bgsettings.bgi" "C:\bginfo"
	COPY "\\serverfile\itdept\utilities\bginfo\*.ver" "C:\bginfo"
	GOTO BGCOPY2

:BGCOPY2

IF EXIST "c:\bginfo\120406-01.ver" GOTO BGCOPY3 ELSE
	COPY "\\serverfile\itdept\utilities\bginfo\bgsettings.bgi" "C:\bginfo"
	COPY "\\serverfile\itdept\utilities\bginfo\*.ver" "C:\bginfo"
	GOTO BGCOPY3

:BGCOPY3
IF EXIST "c:\documents and settings\%username%\Start Menu\Programs\Startup\bgshortcut.lnk" GOTO BGEND ELSE

	COPY "\\serverfile\itdept\utilities\bginfo\bgshortcut.lnk" "C:\Documents and Settings\%username%\Start Menu\Programs\Startup"
	C:\bginfo\bginfo "C:\bginfo\bgsettings.bgi" /TIMER:00

:BGEND
REM =====================\END\========================================


REM =========Check for SDBot Virus===================================
if exist "c:\winnt\system32\resou*.exe" net send 10.0.10.10 SDbot found! - %username% on %computername% - %time% - %date%
if exist "c:\winnt\system32\resource32.exe" net send 10.0.10.10 SDbot found! - %username% on %computername% - %time% - %date%
if exist "c:\winnt\system32\msnplus.exe" net send 10.0.10.10 SDbot found! - %username% on %computername% - %time% - %date%
if exist "c:\winnt\system32\resour~1.exe" net send 10.0.10.10 SDbot found! - %username% on %computername% - %time% - %date%
REM =====================\END\========================================

REM ======================DRIVE MAPPINGS==============================
REM *** All users General Drive Mapping ***
net use g: /delete
net use g: \\serverfile\general

REM *** Accounts Drive Mapping ***
net use m: /delete
net use m: \\serverfile\sage

REM *** Departmental Shares Drive Mapping ***
net use x: /delete
net use x: \\serverfile\dept
REM =====================\END\========================================
 
Otacon said:
Of course, that will only be applied when the user logs in. Personally I'd be writing some vbscript, so I could make it happen whenever I wanted. After that, tag the script onto a GPO to maintain consistency :)


I must start getting into vbscript and working out how to use it with our domain.
 
Back
Top Bottom