Solved

2003 server I need a script that will copy an .ini file to all of my users machines.

Posted on 2003-12-05
8
217 Views
Last Modified: 2010-04-13
I need a script that will copy an .ini file to all of my users machines.
I need this file to be copied to all the machines in the domain only once.
Im working on my scripting skill but this needs to be done by monday and i dont want to
goto each machine and do it. Thanks for the help.
0
Comment
Question by:djohnson104
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 1

Accepted Solution

by:
20LILY00 earned 100 total points
ID: 9883815
This will give you an idea. This script keeps track of computers that login and places a file on there machine only once. If the file exsists it wont rerun the next time they log in.


Public FileExists,proc,comp

FileExists=0





Call ReportFileStatus()



if FILEEXISTS =0 then

      Call fncOpenTextFileTest(err)

      Call EndProcess (Proc, comp)
END IF





Function fncOpenTextFileTest(err)

      On Error Resume Next

      Set WshNetwork = WScript.CreateObject("WScript.Network")

         Set fso = CreateObject("Scripting.FileSystemObject")

        Set f = fso.OpenTextFile("\\lilynorth\printerLog$\Printer.txt", ForAppending, True)

      Const ForReading = 1, ForWriting = 2, ForAppending = 8

         Dim f,fso


      If err<>0 then
            fncSendMessage()
      Else
      
            FSO.CopyFile "\\fido\netlogon\deleteThis.txt", "c:\"
      END IF

         
 
         f.Write WshNetwork.ComputerName & "  " & WshNetwork.UserName & " " & err & " " & date

         f.WriteBlankLines(1)

         f.Close
   
End Function





Function ReportFileStatus()

      On Error Resume Next
      
        Dim fso, msg,filespec

         filespec= "c:\deleteThis.txt"

        Set fso = CreateObject("Scripting.FileSystemObject")

        If (fso.FileExists(filespec)) Then

                FileExists=1

         Else

                  FileExists=0
      End If
   
End Function



'*** Makes sure all processes are closed **********

      Function EndProcess (Process, computername)

            Dim obj

            comp = WScript.CreateObject("WScript.Network").ComputerName

              For Each obj In GetObject("winmgmts://" & computername & _
                    "/root/cimv2").ExecQuery("SELECT * FROM Win32_Process")

                If lcase(obj.Description) = lcase(Process) Then obj.Terminate
              Next
      
              Set obj = Nothing

      End Function


0
 
LVL 2

Author Comment

by:djohnson104
ID: 9883941
Thanks alot but im not sure what to do with it. If you could just sum up what i need to do that would be great!!
0
 
LVL 1

Expert Comment

by:20LILY00
ID: 9884791
I have edited the script so all you should have to do is put in the file name and location in 2 places im sure you can figure that out.



Public FileExists,proc,comp

FileExists=0





Call ReportFileStatus()



if FILEEXISTS =0 then

      Call fncOpenTextFileTest(err)

      Call EndProcess (Proc, comp)
END IF





Function fncOpenTextFileTest(err)

      On Error Resume Next

      Set WshNetwork = WScript.CreateObject("WScript.Network")

         Set fso = CreateObject("Scripting.FileSystemObject")

        

         Dim f,fso


      If err<>0 then
            fncSendMessage()
      Else
      
            FSO.CopyFile "\\FILE LOCATION HERE\netlogon\Name of ini.ini", "c:\"
      END IF

         
         f.Close
   
End Function





Function ReportFileStatus()

      On Error Resume Next
      
        Dim fso, msg,filespec

         filespec= "c:\Name of ini.ini"

        Set fso = CreateObject("Scripting.FileSystemObject")

        If (fso.FileExists(filespec)) Then

                FileExists=1

         Else

                  FileExists=0
      End If
   
End Function



'*** Makes sure all processes are closed **********

      Function EndProcess (Process, computername)

            Dim obj

            comp = WScript.CreateObject("WScript.Network").ComputerName

              For Each obj In GetObject("winmgmts://" & computername & _
                    "/root/cimv2").ExecQuery("SELECT * FROM Win32_Process")

                If lcase(obj.Description) = lcase(Process) Then obj.Terminate
              Next
      
              Set obj = Nothing

      End Function


0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
LVL 1

Expert Comment

by:20LILY00
ID: 9884812
Oh and just referance this script file in a login script
0
 
LVL 2

Author Comment

by:djohnson104
ID: 9885023
Worked like a charm thanks for the help.

Your points are awarded

Where can i put this so it will affect the whole domain?
Do i have to add it to each user under there profile?

Thanks again
0
 
LVL 1

Expert Comment

by:20LILY00
ID: 9885054
Well yes or you could probably create a policy and apply it .
0
 
LVL 2

Author Comment

by:djohnson104
ID: 9885223
I just found out where to do that thanks alot for your help
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
XP pro; manually run services in registry? 15 28
Recovering backup .Qic files on Windows 7 6 2,306
Cannot Upgrade Microsoft Installer on Windows 2000 29 70
AD account Auto logoff 1 39
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
This article discusses how to implement server side field validation and display customized error messages to the client.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question