![]() | Register | FAQ | Members | Social Groups | User Map | Calendar | Search | Today's Posts | Mark Forums Read |
How do you do....it?
How do you do it forum sponsored by |
| | | LinkBack | Thread Tools | Search Thread | Language |
| Sponsored Links |
| | #1 |
![]() Join Date: Sep 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0 | 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 |
![]() | 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
edit: you will need to put some variables in there as well, i will see what i can find. Last edited by FN-GM; 21-08-2008 at 11:31 AM.. |
| |
| | #3 |
![]() Join Date: Sep 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0 | and use that as a start up script... is there a basic guide how to do this? as im pretty new to this. |
| |
| | #4 |
![]() | 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
|
| |
| | #5 |
![]() Join Date: Dec 2005 Location: Birmingham
Posts: 2,107
Thanks: 27
Thanked 162 Times in 130 Posts
Rep Power: 38 | Alternatively you could use xcopy: Code: @echo off xcopy "\\servername\sharename\txt.ini c:\windows\system32\" /y |
| |
| | #6 |
![]() Join Date: Sep 2007
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0 | 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 |
![]() Join Date: Feb 2007 Location: Northamptonshire
Posts: 1,378
Thanks: 51
Thanked 105 Times in 102 Posts
Rep Power: 25 | 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 |
![]() | 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 |
![]() Join Date: Dec 2005 Location: Birmingham
Posts: 2,107
Thanks: 27
Thanked 162 Times in 130 Posts
Rep Power: 38 | Sorry my bad, it should be: Code: @echo off xcopy "\\servername\sharename\txt.ini" "c:\windows\system32\" /y |
| |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Change NT Backups from Append to Overwrite? | Kyle | Windows | 1 | 04-06-2008 11:03 AM |
| En-mass uninstall. | boomam | Windows | 31 | 04-03-2008 10:51 AM |
| Mass Logon | FN-GM | Network and Classroom Management | 28 | 18-08-2007 07:45 PM |
| Backup to Hard Drive. Automatic overwrite of old backup. | eean | Windows | 9 | 01-08-2006 10:25 AM |
| Script to copy a shortcut to all users and overwrite an exis | tosca925 | Scripts | 12 | 21-11-2005 10:49 PM |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search Thread |
|
|








