|
|
|||||||
Background: I administer a few dozen win2k pcs that are part of a huge, vast network. I am not a domain admin and I don't have access to a server. All I have is the password for the local admin accounts on all of the win2k boxes. I wrote a little script to connect to our PCs and copy a file (copying a text file to the desktop is just a test - cause it's easy to check if it worked). Here's the script: code:It's not pretty, but it works. The PC names are stored in the PCNames.txt fileif open (1,"s:\computing\scripts\PCNames.txt") = 0 What I can't get to work is this. I'd like a log file to be created that says which PC this worked on and which one it didn't and the date and time I ran the script. The only way I could think of to test if it worked was to test if the file is in the location where it was supposed to be copied to. When I try to write a log, the first line for the first PC writes, but nothing after. Can someone help me? [BTW, in case it isn't obvious, I took out the failed code for writing the log file from the script above]. And, of course, if there's a better way to do this I sure would appreciate someone telling me how. Many thanks. |
||||||||
|
|
|||||||
If you took out the code, how are we to see what's wrong with it? |
||||||||
|
|
|||||||
Take a look at this FAQ, Topic: File Input/Output Primer post some code, and we'll have a go at it. |
||||||||
|
|
|||||||
Les... code:Keep your stick on the icesetlogic(hide) |
||||||||
|
|
|||||||
I took out the code cause it was just plain bad... Now for the odd part. I ran the script again this morning and it works. I didn't change a thing. Here it is: code:So is there a better way to do all of this?if open (1,"s:\computing\scripts\PCNames.txt") = 0 [ 24. September 2002, 15:23: Message edited by: Shane ] |
||||||||
|
|
|||||||
Do not use the abbreviated 8.3 DOS names for long file/folder names. There is no guarantee that 'Documents And Settings' will always translate to 'DOCUME~1' on all Windows machines. also, put your PC names into an .INI file. It is much easier to read a .INI file with READPROFILESTRING, and you can read a whole bunch of computernames with one line and convert the list into an array. Also, there is no reason to have a separate GOSUB routine for the copying since you always call it from the same spot. I would therefore include it into the READLINE segment. |
||||||||
|
|
|||||||
Thanks for the suggestions, Jens. Better learn how to work with arrays and ini files... |