Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Copy files to machines from Active directory

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,43321
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Copy files to machines from Active directory
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Copy files to machines from Active directory - 2/18/2007 4:37:26 PM   
  avipenina

 

Posts: 102
Score: 0
Joined: 4/24/2006
Status: offline
Hi,

how can i write a script that copy 2 files to remote machines but the machines need to be take from active directory specific container
and if any computer isn't responding that continue to the other one don't stop the script. how i do it?

Many Thx.
 
 
Post #: 1
 
 RE: Copy files to machines from Active directory - 2/18/2007 6:25:56 PM   
  DiGiTAL.SkReAM


Posts: 1194
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
Please post any code that you already have so that we can help get you pointed in the right direction.


< Message edited by DiGiTAL.SkReAM -- 2/18/2007 6:27:43 PM >


_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to avipenina)
 
 
Post #: 2
 
 RE: Copy files to machines from Active directory - 2/18/2007 6:33:09 PM   
  avipenina

 

Posts: 102
Score: 0
Joined: 4/24/2006
Status: offline
here is the code

Set objOU = GetObject("LDAP://OU=Client, DC=test, DC=com")
objOU.Filter = Array("Computer")
For Each objItem in objOU
   strComputer = objItem.CN
Const OverwriteExisting = TRUE
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "\\Servername\folder\filename" , "D:\Copy\", OverwriteExisting
objFSO.CopyFile "\\Servername\folder\filename" , "D:\Copy\", OverwriteExisting
Next

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 3
 
 RE: Copy files to machines from Active directory - 2/19/2007 8:09:37 AM   
  Parabellum


Posts: 222
Score: 0
Joined: 11/12/2006
From: UK
Status: offline
well your existing code would only copy the files locally...
if you want to copy them to a remote machine you could use a hidden admin share...

eg..   objFSO.CopyFile "\\Servername\folder\filename" , strComputer & "\D$:\Copy\", OverwriteExisting
but that depends if your machiens have admin shares enabled...


another option is to speicify a startup script via group policy that is applied to the OU in question
then you would only need this code..

Const OverwriteExisting = TRUE
Set objFSO = CreateObject("Scripting.FileSystemObject")
If Not objFSO.FileExists("D:\Copy\filename")
objFSO.CopyFile "\\Servername\folder\filename" , "D:\Copy\", OverwriteExisting
End If

there a re a few options... depending on when and how you want the files to be coppied.. and what theya re for

(in reply to avipenina)
 
 
Post #: 4
 
 RE: Copy files to machines from Active directory - 2/19/2007 9:28:20 AM   
  dm_4ever


Posts: 2726
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
small correction: 
objFSO.CopyFile "\\Servername\folder\filename" ,"\\" &  strComputer & "\D$\Copy\", OverwriteExisting

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Parabellum)
 
 
Post #: 5
 
 RE: Copy files to machines from Active directory - 2/19/2007 9:31:37 AM   
  Parabellum


Posts: 222
Score: 0
Joined: 11/12/2006
From: UK
Status: offline
thanks..my bad.. well spotted btw :)

(in reply to dm_4ever)
 
 
Post #: 6
 
 RE: Copy files to machines from Active directory - 2/19/2007 10:20:23 AM   
  dm_4ever


Posts: 2726
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
no worries.

_____________________________

dm_4ever

My philosophy: K.I.S.S - Keep It Simple Stupid
Read Me: http://www.visualbasicscript.com/m_24727/tm.htm
Frequently Asked Stuff: http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Parabellum)
 
 
Post #: 7
 
 RE: Copy files to machines from Active directory - 2/19/2007 6:27:28 PM   
  avipenina

 

Posts: 102
Score: 0
Joined: 4/24/2006
Status: offline
Thx for ur answer i try this code and it's working fine

      

no my question is how in this code i can add and line that will do ping to every computer that he try to add the file
if there are replay then do the copy if not continue to the other machines and so on?

Thx

(in reply to dm_4ever)
 
 
Post #: 8
 
 RE: Copy files to machines from Active directory - 2/19/2007 6:41:17 PM   
  Parabellum


Posts: 222
Score: 0
Joined: 11/12/2006
From: UK
Status: offline
take a look at dm_4ever's connectivity monitor --> http://www.visualbasicscript.com/m_42535/tm.htm
specicifcly the reachable function.
That should provide you with what you need...

(in reply to avipenina)
 
 
Post #: 9
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Copy files to machines from Active directory Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts