+ Post New Thread
Results 1 to 9 of 9
How do you do....it? Thread, Overwrite file on mass. in Technical; How would i go about overwriting a file on all the machines on our RM network easily. There's a txt.ini ...
  1. #1
    damien.deakes's Avatar
    Join Date
    Sep 2007
    Location
    Doncaster
    Posts
    60
    Thank Post
    12
    Thanked 3 Times in 3 Posts
    Rep Power
    15

    Exclamation Overwrite file on mass.

    How would i go about overwriting a file on all the machines on our RM network easily.

    There's a txt.ini file we have in c:/windows/sytem32 folder to help a program run, however we have changed some values in it.

    Ad i certainly don't want to manually go round overwriting the file on a few hundred machines.

  2. #2

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,852
    Thank Post
    877
    Thanked 1,681 Times in 1,460 Posts
    Blog Entries
    12
    Rep Power
    445
    I would use a startup script. This VBS code will check a master copy of the .txt file on the server against the local one. If the one on the server is more upto date it will update the client one.

    Code:
    Set objFSO = CreateObject ("Scripting.FileSystemObject")
    
    on error resume next
    	sourcefile1 = "c:\file.txt"
    	sourcefile2 = "\\server\NETLOGON\bin\files.txt"
    
    	Set objFile = objFSO.GetFile(sourcefile1)
    	strFile1 = objFile.DateLastModified
    	Set objFile = objFSO.GetFile(sourcefile2)
    	strFile2 = objFile.DateLastModified
    
    	If strFile1 <> strFile2 Then 
    	objFSO.CopyFile "\\server\NETLOGON\bin\file.txt", "C:\"
    	End IF
    wscript.quit
    The good thing about server 2008 with this type of thing you don't have to mess around with scripts.

    edit: you will need to put some variables in there as well, i will see what i can find.
    Last edited by FN-GM; 21st August 2008 at 11:31 AM.

  3. #3
    damien.deakes's Avatar
    Join Date
    Sep 2007
    Location
    Doncaster
    Posts
    60
    Thank Post
    12
    Thanked 3 Times in 3 Posts
    Rep Power
    15
    and use that as a start up script... is there a basic guide how to do this? as im pretty new to this.

  4. #4

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,852
    Thank Post
    877
    Thanked 1,681 Times in 1,460 Posts
    Blog Entries
    12
    Rep Power
    445
    Hi there

    If you copy and paste this code into a notepad and change the path of the original file on the server and the destination. Once you have done that save the file in your netlogon file but save it as a VBS file. for example copyfile.vbs

    After that add the script to start-up scripts in group policy.

    Code:
    Set objFSO = CreateObject ("Scripting.FileSystemObject")
    
    on error resume next
    	sourcefile1 = "c:\file.txt"
    	sourcefile2 = "\\server\NETLOGON\bin\file.txt"
    
    	Set objFile = objFSO.GetFile(sourcefile1)
    	strFile1 = objFile.DateLastModified
    	Set objFile = objFSO.GetFile(sourcefile2)
    	strFile2 = objFile.DateLastModified
    
    	If strFile1 <> strFile2 Then 
    	objFSO.CopyFile "\\server\NETLOGON\bin\file.txt", "C:\"
    	End IF
    wscript.quit
    Let me know how you get on.

  5. #5

    Michael's Avatar
    Join Date
    Dec 2005
    Location
    Birmingham
    Posts
    9,262
    Thank Post
    242
    Thanked 1,568 Times in 1,250 Posts
    Rep Power
    340
    Alternatively you could use xcopy:

    Code:
    @echo off
    xcopy "\\servername\sharename\txt.ini c:\windows\system32\" /y
    Again put this in a startup script.

  6. #6
    damien.deakes's Avatar
    Join Date
    Sep 2007
    Location
    Doncaster
    Posts
    60
    Thank Post
    12
    Thanked 3 Times in 3 Posts
    Rep Power
    15
    i get an invalid charcater line 1 char 1, after running the xcopy.

    no errors on the other but it just didnt copy the file across.

  7. #7


    Join Date
    Feb 2007
    Location
    Northamptonshire
    Posts
    4,689
    Thank Post
    352
    Thanked 794 Times in 714 Posts
    Rep Power
    346
    If you're on CC3, you could use a package to deploy the file, which may be a bit overkill it certainly allows you version control should you make changes later.

  8. #8

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,852
    Thank Post
    877
    Thanked 1,681 Times in 1,460 Posts
    Blog Entries
    12
    Rep Power
    445
    can we see a copy of your VBS script please?

    for xcopy you may have to put quotations around the path if there is a space in the location.

  9. #9

    Michael's Avatar
    Join Date
    Dec 2005
    Location
    Birmingham
    Posts
    9,262
    Thank Post
    242
    Thanked 1,568 Times in 1,250 Posts
    Rep Power
    340
    Sorry my bad, it should be:

    Code:
    @echo off
    xcopy "\\servername\sharename\txt.ini" "c:\windows\system32\" /y

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 1
    Last Post: 4th June 2008, 11:03 AM
  2. En-mass uninstall.
    By boomam in forum Windows
    Replies: 31
    Last Post: 4th March 2008, 09:51 AM
  3. Mass Logon
    By FN-GM in forum Network and Classroom Management
    Replies: 28
    Last Post: 18th August 2007, 07:45 PM
  4. Replies: 9
    Last Post: 1st August 2006, 10:25 AM
  5. Replies: 12
    Last Post: 21st November 2005, 09:49 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •