VBS log on script

G

Guest

I am looking for a simple log on VBS script to copy files from a network share to a local computer. Something like \\server\share to C:\program files\foofolder, can anyone help??
 
T

Torgeir Bakken (MVP)

Michael said:
I am looking for a simple log on VBS script to copy files from a network share to a local computer. Something like \\server\share to C:\program files\foofolder, can anyone help??

Hi

Take a look at the FileSystemObject in WSH\VBScript and it's CopyFile/CopyFolder methods...

Download WSH 5.6 documentation from here:
http://msdn.microsoft.com/downloads/list/webdev.asp

and as my sig states:
Administration scripting examples and a ONLINE version of the 1328 page
Scripting Guide: http://www.microsoft.com/technet/scriptcenter

Starting e.g. here

Scripting Concepts and Technologies for System Administration
http://www.microsoft.com/technet/scriptcenter/scrguide/sas_pt1_overview.asp

The online version can be bought as a book (with a companion CD),
http://www.amazon.com/exec/obidos/ASIN/0735618674/002-7141687-9862444


Here are some Windows Script Host (WSH) Web introductions:

WSH
http://cis.stvincent.edu/wsh/index.html

Introduction to Windows Scripting
http://www.winguides.com/article.php?id=2

NT Gains Scripting Muscle
An introduction to Windows Script Host by Bob Wells.
http://www.winnetmag.com/Articles/Index.cfm?ArticleID=3026

Scripting 101
A 4 part series on how to create and structure WSH scripts by Bob Wells
http://www.winnetmag.com/Articles/Index.cfm?ArticleID=5410
http://www.winnetmag.com/Articles/Index.cfm?ArticleID=5505
http://www.winnetmag.com/Articles/Index.cfm?ArticleID=5683
http://www.winnetmag.com/Articles/Index.cfm?ArticleID=7112

VBScript Primer
http://www.microsoft.com/technet/prodtechnol/windows2000serv/maintain/optimize/script/netvbscr.asp



If you are looking for AD related scripts, you'll can also check this sites
(the
link above to the Script Center also have a lot of AD related scripts):

http://www.rallenhome.com/scripting.html
http://www.rlmueller.net/


Here is a newsgroup thread you should look at as well with links to other
resources:

From: Wayne ([email protected])
Subject: beginner looking for resources
Newsgroups: microsoft.public.scripting.vbscript
Date: 2002-01-31 08:11:00 PST
http://groups.google.com/groups?hl=en&th=7015b808b5fb0cb4


This one is not mentioned in the link above

http://www.jsware.net/

A lot of example scripts there, as well as a nice cheap VBScript editor (it
doesn't beat PrimalScript, but then again the price difference is quite large).



When talking about editors, an alternative as well is the script editor that
comes with Office 2k/XP:

http://groups.google.com/groups?as_...8859-1&as_ugroup=microsoft.public.scripting.*

- and -
http://groups.google.com/groups?as_...ugroup=microsoft.public.scripting.*&lr=&hl=en
 
G

Guest

Thanks Torgeir

My problem is I am the director of IT for a mid-sized company and between all the many hats I wear daily I just don't have time to read up. I have VBS scripting books sitting on my desk for the last 6 months but I don't have time to get to them. I would love to learn how to program but it is not in the cards this month. All I really need is a quickly little script to copy Cisco VPN profiles from a server location to senior managment laptops. From the few scripts I have written I don't think this task is more than 2 or 3 lines of text but reading up on 10 different links is not for me now. Anyone able to give me some help??

Thanks again.
 
T

Torgeir Bakken (MVP)

Michael said:
Thanks Torgeir

My problem is I am the director of IT for a mid-sized company and between all the many hats I wear daily I just don't have time to read up. I have VBS scripting books sitting on my desk for the last 6 months but I don't have time to get to them. I would love to learn how to program but it is not in the cards this month. All I really need is a quickly little script to copy Cisco VPN profiles from a server location to senior managment laptops. From the few scripts I have written I don't think this task is more than 2 or 3 lines of text but reading up on 10 different links is not for me now. Anyone able to give me some help??

Hi

Here is an example:

http://groups.google.com/groups?hl=...threadm=#[email protected]
 
G

Guest

Thank you again Torgeir. So I put together this from the link you provied....

Const OverwriteExisting = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "\\server\MSI_Packages\VPN\a_file.pcf" ,"C:\Program Files\cisco_test" , OverwriteExisting

...but when I run the script from a double click I get "line 3 char 1 Permission denied." I know that the ACL's on both locations are correct (I added Everyone Full as a test) and nothing is read only and no one else has the file open. I don't get it (I wish I were a programmer so I could do simple things like ths..).

Anyone able to help??
 
T

Torgeir Bakken (MVP)

Michael said:
Thank you again Torgeir. So I put together this from the link you provied....

Const OverwriteExisting = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "\\server\MSI_Packages\VPN\a_file.pcf" ,"C:\Program Files\cisco_test" , OverwriteExisting

..but when I run the script from a double click I get "line 3 char 1 Permission denied."

Hi

If cisco_test is a folder, you try to overwrite the folder in itself with a file, that is why you get the permission denied.

Try this instead, added a trailing backslash to tell the CopyFile to put the file inside the folder:

"C:\Program Files\cisco_test\"
 
G

Guest

And THAT shows you why networking types ahould not program.. : ) Thanks Torgeir, that was what I was missing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top