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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COPY file to all computers 2

Status
Not open for further replies.

FISKO

Technical User
Aug 30, 2005
113
0
0
GB
Hi All,
is it possible to send a file to all the C drives on my network from the server?
I can send a file to any user but not the computer, any ideas

Only the GOOD die young,
Me? I'm here forever!
 
Do you have access to the UNC path \\servername\C$?
This can be done via robocopy or prob the FSO w/ vbs

[yinyang] Tranpkp [pc2]
 
the file will originate from the server and I assume all the networked PCs will be shared for admin acccess.
So yes is i presume the answer.
next Howto?


Only the GOOD die young,
Me? I'm here forever!
 
+ bind to AD, get a list of all computer objects in your domain, loop through this list of netbios names? then FSO.CopyFile \\machinename\c$\...

+ use the output of a NET VIEW :)

+ have your logonscript do it?
 
THANKS will try in the morning.

Only the GOOD die young,
Me? I'm here forever!
 
My FAQ faq329-4871 has a script to create a list of workstation names which could then be used to map to the workstations C$ share.

Another option is to use a startup script to have this controlled and tied to the computer OR use the login script and have it triggered by user login but still going to the workstation.

You can grab the computername and copy files in a script like this:
Code:
Dim objFSO, WSHNetwork
Const OverWriteExisting = True
Set objFSO = Createobject("Scripting.FileSystemObject")
Set WSHNetwork = Createobject("Wscript.Network")
strComputer = WSHNetwork.Computername
wsLocation = "\\"& strComputer & "\c$\Temp\"
objFSO.CopyFile "\\server\share\file.txt", wsLocation, OverWriteExisting

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Thanks once again Mark
A star always seems so little for so much help.

Only the GOOD die young,
Me? I'm here forever!
 
Mark, does the user have to be a local admin on their workstation when running from a login script? I would like to copy a custom hosts file to

"\\machinename\c$\%systemroot%\system32\drivers\etc".

Thanks.
 
Yes I have the same problem, I can get a logon script to place a file into a users My Documents folder, But I would like to place a file in every computers C drive, if the user does not have permission to access the C drive how can I get it to use an admin permission to do it? Or is this not possible.
Thanks

Only the GOOD die young,
Me? I'm here forever!
 
My suggestion to you guys would be to not use a login script for this (though it should run with elevated priviledges).

First I would adivse against the use of a hosts file and simply add A records into your DNS server.

If you MUST use a hosts file, then it is my experience that you should not copy over the existing file since it may contain custom entries you do not know about. Instead use vbscript to EDIT the existing file. You may however have reasons to WANT to eliminate such custom entries and standardize.

The way I would approach this is I would write a script that I would execute from an Admin workstation that would connect to remote computers and edit (or replace) the file.

My FAQ referenced above demonstrates how you can read a text file which can then be used to provide machine names to a scritp for the simple FileSystemObject operations.


I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Thanks once agian Mark

Only the GOOD die young,
Me? I'm here forever!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top