?
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
Medium Priority
?
219 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 400 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

Question has a verified solution.

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

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…
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

765 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