Page 1 of 1 1
Topic Options
#139940 - 2005-05-18 10:58 PM Help in renaming files on 10 different servers
brett_young Offline
Fresh Scripter

Registered: 2002-04-19
Posts: 6
There is a certain exe file on the same directory for each server that needs to be renames to the version number. Then I will copy the new file (on my local c: drive) to all of those servers.
I want to create the kix file using a list. I could use the help on how to do it.
Here is my work in progress code:
Code:
 
DIM $MYARRAY[10]
$MYARRAY = "PRC03","PRC04","PRC06","PRC07","PRC08","PRC09","PRC10","PRC11","PRC12","PROP02"
? $MYARRAY
USE G: "\\$MYARRAY\C$\" /USER:ADMINISTRATOR /PASSWORD:PASSWORD_OBSCURED
CD MBT
$RESULT = GetFileVersion(%SystemDrive% + "\quoteserver.exe", "ProductVersion")

? $RESULT



So as you can see the script would keep looping where $myarray uses each server name to logon to the machine. Currently, I am just trying to figure out how the script substitutes the server name for $myarray. Once I figure that out, I think I'll be able to write the rest.

Somewhat related, I wanted to print out what was currently in $myarray, but that gives me an error.
Any help would greatly be appreciated.

Top
#139941 - 2005-05-18 11:27 PM Re: Help in renaming files on 10 different servers
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
How 'bout something like this:
Code:
Dim $asPCs, $sPC
$asPCs="PRC03","PRC04","PRC06","PRC07","PRC08","PRC09","PRC10","PRC11","PRC12","PROP02"
For Each $sPC in $asPCs
"Checking "+$sPC+@CRLF
Use G: /delete /persistent
USE G: "\\"+$sPC+"\C$$" /USER:ADMINISTRATOR /PASSWORD:PASSWORD_OBSCURED
If @ERROR
"Could not map G: to this PC"+@CRLF
"Error is ["+@ERROR+"] "+@SERROR+@CRLF
Else
; Do your version checking here...
EndIf
Next


Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1198 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.05 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org