Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to script the copying of network shares

Status
Not open for further replies.

Councilk

MIS
May 14, 2003
72
US
Hello all,

I know there are several ways to skin a cat however, I need to skin the cat a certain way.

I'm trying to write a script to copy the share\folder along with the permissions.

I used the "Xcopy /o" which appears to do the job, so I'm guessing the approach would be to script it where I use the CmdLine to do this via the script.

Or does anyone else have a solution on how best to write this up

Thanks again for all youe help in the past and assistance with this is really appreciated

:)
 
I strongly recommend using Robocopy.

See thread931-1481973

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Thanks PScott,

I was told that Robo has some special use in this environment here and to avoid any confusion (?)

a seperate VB script is needed, can you expand on this because I have used it in the past unless this is something new with a later version of this product
 
Hello all

I found that I could use some other third party tool however, I would like to get this to work using VB and here's what I have so far..

Well, I might want to call this Pseudo syntax (lol)
But this is the logical approach I was trying to come up with...
========== Script ===================================

Option Explicit
'On error resume next

dim strcomputer
dim wmiNS
dim wmiQuery
dim objWMIService
dim colItems
dim objItem
dim objFso
dim objShare
dim sfolder
dim dfolder

strComputer = "."
wmiNS = "\root\cimv2"
Set objWMIService.ExecQuery(wmiQuery)

For Each objItem in colItems
sfolder = objItem.Item
Wscript.Echo "Name: " & objItem.name)

Call CopyShareSub
Next

Sub CopyShareSub
' Testing to see if sfolder stores the value from colItems
Wscript.echo(sfolder & "Here it is!")
objFSO.CopyFolder "\\" & server & "\" & "sfolder"
End Sub

Any assistance with this script is greatly appreciated

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top