Solved

# vbs script to copy file to another computer and test speed/time

Posted on 2011-10-05
363 Views
Hi,
Does anyone know of a vb or similar script that i can use to copy a file from one computer to another and then report how long it took and the speed it took?

It would be great if the script would ask me the location of the computer that I want to copy the file to (example \\computer\shared_folder)

it would also be great if it could output the time it took and speed it took to a log file like C:\folder\speed_test.log
0
Question by:GTechForce

LVL 51

Expert Comment

Why not just use ROBOCOPY for this test, it gives you those type of stats.

For example, doing this:

robocopy . g:\ large.txt

I got this:

-------------------------------------------------------------------------------
ROBOCOPY     ::     Robust File Copy for Windows
-------------------------------------------------------------------------------

Started : Wed Oct 05 17:02:33 2011

Source : c:\ee\
Dest : g:\

Files : large.txt

Options : /COPY:DAT /R:1000000 /W:30

------------------------------------------------------------------------------

1    c:\ee\
100%        New File               9.5 m        LARGE.TXT

------------------------------------------------------------------------------

Total    Copied   Skipped  Mismatch    FAILED    Extras
Dirs :         1         0         1         0         0         0
Files :         1         1         0         0         0         0
Bytes :    9.53 m    9.53 m         0         0         0         0
Times :   0:00:01   0:00:01                       0:00:00   0:00:00

Would be easy to put that in a BAT file and use PROMPT to ask for the computer name to copy to, let me know if you need help with that.

~bp
0

Author Comment

if you wouldnt mind doing that, i would greatly appreciate it. I dont know much about coding.
0

Author Comment

actually after looking into robocopy, that won't work for windows Server 2003 since its not part of the standard features.

is there another way of doing it?
0

LVL 51

Expert Comment

Can you download it from the resource kit and place it on the server?

~bp
0

Author Comment

Ya i can do that. I bet i could setup the script so if robocopy is not installed i could download it,and then have it run the command?

what do i need to do to use the prompt feature to ask for the computer name and location?
0

LVL 51

Accepted Solution

Hope this makes sense, it will prompt for the destination computer and folder path and then do the copy.  It will display the results to the screen, and also save it to a logfile.  Update the SETs at the top of the script as needed.  Save as a BAT file.

@echo off

REM Define folders and files to be used for copy and logging
set BaseDir=c:\basefolder
set TestFile=testfile.txt
set LogFile=logfile.txt

REM Prompt for computer name
set Computer=
set /P Computer=Enter computer name:

REM If a computer name was entered, do the timing test
if defined Computer (
robocopy "%BaseDir%" "%Computer%" "%TestFile%" /TEE /LOG:"%LogFile%"
)

~bp
0

Author Closing Comment

this worked perfectly!
0

LVL 51

Expert Comment

Great, glad that helped, thanks for the feedback.

~bp
0

## Featured Post

Often times network admins need to run domain logon scripts for seperate subnets, but also for a seperate set of computers within that subnet.  In this circumstance, configuring Active Directory Sites and Services then linking a GPO to site/subnet m…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
how to add IIS SMTP to handle application/Scanner relays into office 365.