[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

VBS Login script > copy file

Posted on 2006-03-20
3
Medium Priority
?
425 Views
Last Modified: 2012-06-27
Hi,

We use a normal vb loginscript. It's working fine.
But i want to add some functions, like copying files etc.

This is what i want to establish.
I want to copy a file (test.scr) from the server to ALL workstations.
From: \\server\testing\
To: %Systemroot%\System32

How can i fix this?
Not necessary with login script.

tnx
0
Comment
Question by:maximaal
3 Comments
 
LVL 71

Accepted Solution

by:
Chris Dent earned 1000 total points
ID: 16234866

Hi,

If you're sticking with pure VbScript then this is how:

Set objFileSystem = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("WScript.Shell")

Set objFile = objFileSystem.GetFile("\\server\testing\test2.scr")
objFile.Copy objShell.ExpandEnvironmentStrings("%SystemRoot%") & "\System32\", True
Set objFile = Nothing

Set objShell = Nothing
Set objFileSystem = Nothing

You might find it's just easier to do it in a batch file, or call the command directly though:

Set objShell = CreateObject("WScript.Shell")
objShell.Run "copy \\server\testing\test.scr %SystemRoot%\System32", 1, True
Set objShell = Nothing

The main advantage of the VbScript method is that you can add additional code in to capture errors.

HTH

Chris
0
 
LVL 18

Expert Comment

by:Sam Panwar
ID: 16234892
I would suggest you another way for it if you can create file test.scr through the vb script on user login then use the following article for it you can urself easily create it :

For create file
http://www.computerperformance.co.uk/vbscript/vbscript_file_create.htm

enter the text or file data into file through the following script

http://www.computerperformance.co.uk/vbscript/vbscript_file_opentextfile.htm

you can put this script in the user login event in GPO of  Active directory when user login in computer then its create the file

all script
http://www.computerperformance.co.uk/vbscript/index.htm
0
 
LVL 1

Author Comment

by:maximaal
ID: 16239392
Chris-Dent > tnx, I'll try it tomorrow and let you know.

Abs_jaipur > tnx, But i think it's not the answer i'm waiting for. tnx anyway
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
In this article I will be showing you how to subnet the easiest way possible for IPv4 (Internet Protocol version 4). This article does not cover IPv6. Keep in mind that subnetting requires lots of practice and time.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

865 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question