#41129 - 2003-06-05 05:06 PM
Help with KIX
|
caseman
Lurker
Registered: 2003-06-05
Posts: 4
Loc: Newark, DE
|
I need a script to read computer names from a text file then copy a paticular file from each machine to a certain location. Does anyone anready have such a script or can you give me some ideas. thanks.
|
|
Top
|
|
|
|
#41132 - 2003-06-05 05:32 PM
Re: Help with KIX
|
caseman
Lurker
Registered: 2003-06-05
Posts: 4
Loc: Newark, DE
|
Sorry, here are some more details. I would be copying from UNC path to a local machine. the file name is the same on each machine so it would have to renamed during the copy. Drives will not need to mapped, this will be done with about 30 machines. thanks.
|
|
Top
|
|
|
|
#41134 - 2003-06-05 06:04 PM
Re: Help with KIX
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Ok, heres a quicky based on the way I like to do this sort of thing, up to you if you want to persue this:
1) Create a file called HOSTS.INI in your current directory, heres a sample:
[HOSTS.INI]
code:
[todo] server1 = 1 server2 = 1 server3 = 1 server4 = 1
[done]
Notice there are two sections TODO and DONE. The todo section contains the list of all the machines to copy the file from. As the files are copied, and if the copy was successfull, the hostname "moves" from the TODO section to the DONE section. That way, if a machine is down or not available, all you have to do is rerun the script, and the script will automatically restart and attempt to copy files from the failed machines.
To reset this script for the another copy, simply (manually) rename the DONE section to TODO, and delete the old TODO section.
Anyways, hope you get the picture. Heres a the script - you must customize it to your environment, good luck:
code:
Break On $HOSTS = ".\HOSTS.INI" $SHARE = "\BUILDS\XML\ENG\" $FILE = "MSXML.MSI" $TARGET = @CURDIR For Each $Host In Split(ReadProfileString($HOSTS,"TODO",""),CHR(10)) If $Host $SRC = "\\"+$HOST+$SHARE+$FILE $TGT = $TARGET+$HOST+"_"+$FILE ?"Copying $SRC to $TGT" COPY $SRC $TGT
?@SERROR ? If @ERROR = 0 $= WriteProfileString($HOSTS,"TODO",$Host,"") $= WriteProfileString($HOSTS,"DONE",$Host,1) EndIf EndIf Next Exit 1
|
|
Top
|
|
|
|
#41135 - 2003-06-05 06:35 PM
Re: Help with KIX
|
caseman
Lurker
Registered: 2003-06-05
Posts: 4
Loc: Newark, DE
|
Thanks Shawn, however i get this error message.
Script error : Unknown command ! For Each $Host In Split(ReadProfileString($HOSTS,"todo",""),CHR(10))
I am using version 3.55. if that is the issue where can i find the newest version?
thanks again.
|
|
Top
|
|
|
|
#41136 - 2003-06-05 06:40 PM
Re: Help with KIX
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
|
|
Top
|
|
|
|
#41137 - 2003-06-05 09:39 PM
Re: Help with KIX
|
caseman
Lurker
Registered: 2003-06-05
Posts: 4
Loc: Newark, DE
|
I was able to get it to work Shawn. Thanks for your help everyone.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 857 anonymous users online.
|
|
|