Re: Copy a file to multiple servers with the same location on each
- From: ESP <ESP@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 15 Dec 2005 08:50:05 -0800
Because the ARRAY example I provided cycles through the machine names you
will have to put into the script in place of the names I used (computer1,
computer2, etc...)
The ARRAY reads each machine name, executes the portion of the script you
provided to the forum, then through the use of "NEXT" cycles to the next
machine name in the list.
p.s. It is true. "objWMIService" is not needed in this script ;-)
ESP
"kb" wrote:
> In the below code is strComputer still going to work being it's not defined
> anywhere?
>
> "Santos Soler" wrote:
>
> > objFSO.CopyFile "C:\SandBox\lpt$vpn.103" , "\\" & strComputer &
> > "\c$\SProtect\", OverwriteExisting
> >
> > "kb" <kb@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > news:8BFD0C44-D447-401C-9F4F-BFF05FE0769C@xxxxxxxxxxxxxxxx
> > > But what about the line
> > >
> > > objFSO.CopyFile "C:\SandBox\lpt$vpn.103" , "\\usnsmcw040\c$\SProtect\",
> > >
> > > Wouldn't that copy it to just that server?
> > >
> > > "ESP" wrote:
> > >
> > >> <Watch the word-wrap>
> > >>
> > >> Const OverwriteExisting = True
> > >> arrDC =
> > >> Array("computer1","computer2","computer3","computer4","computer5", _
> > >> "computer6","computer7","computer8","computer9","computer10")
> > >> For Each strComputer in arrDC
> > >> Set objWMIService = GetObject("winmgmts:" _
> > >> & "{impersonationLevel=impersonate}!\\" & strComputer &
> > >> "\root\cimv2")
> > >> Set objFSO = CreateObject("Scripting.FileSystemObject")
> > >> objFSO.CopyFile "C:\SandBox\lpt$vpn.103" , "\\usnsmcw040\c$\SProtect\",
> > >> OverwriteExisting
> > >> Next
> > >>
> > >>
> > >> ESP
> > >>
> > >>
> > >>
> > >>
> > >> "kb" wrote:
> > >>
> > >> > Ok, below is what I have so far but it only copies the file to one
> > >> > server. I
> > >> > need it to be able to copy that same file to a bunch of servers. Can
> > >> > anyone
> > >> > direct me as to how I would go about this? Thanks.
> > >> >
> > >> >
> > >> > Const OverwriteExisting = TRUE
> > >> >
> > >> > strComputer = "usnsmcw040"
> > >> > Set objWMIService = GetObject("winmgmts:" _
> > >> > & "{impersonationLevel=impersonate}!\\" & strComputer &
> > >> > "\root\cimv2")
> > >> >
> > >> >
> > >> > Set objFSO = CreateObject("Scripting.FileSystemObject")
> > >> > objFSO.CopyFile "C:\SandBox\lpt$vpn.103" , "\\usnsmcw040\c$\SProtect\",
> > >> > OverwriteExisting
> > >> >
> >
> >
.
- References:
- Prev by Date: Connecting to a users OU after a global search for the user
- Next by Date: Re: Joining Files
- Previous by thread: Re: Copy a file to multiple servers with the same location on each
- Next by thread: Re: Copy a file to multiple servers with the same location on each
- Index(es):
Relevant Pages
|