Announcement

Collapse
No announcement yet.

Download and install any application

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Download and install any application

    This script will download and install any program that has silent install options. You need to supply url, app name, directory to save to, directory will be created if it doesn't exist, and silent install options. The downloaded file will be deleted on completion.

    Code:
    import urllib2, subprocess, os, sys, shutil
    
    url = 'http://www.thewebsomewhere.com/yourapp.ext'
    appname = 'savedappname.exe'
    filedirectory = "directory/to/save/to"
    
    options1 = '-yourswitch1'
    options2 = '/yourswitch2'
    
    drive = os.path.splitdrive(sys.executable)[0] + os.sep
    directory = os.path.join(drive, filedirectory)
    
    if not os.path.isdir(directory):
        os.makedirs(directory)
    
    installapplication = os.path.join(directory, appname)
    getfile = urllib2.urlopen(url)
    with open(installapplication, 'wb') as savefile:
        shutil.copyfileobj(getfile, savefile)
    
    process = subprocess.Popen([ installapplication, options1, options2 ],stdout=subprocess.PIPE)
    for line in iter(process.stdout.readline,''):
        print line.rstrip();        
            
    os.remove(installapplication)

  • #2
    Can you modify this to check if the software already exist and if not download and install?

    This would be helpful when adding workstations to a clients network. If the required software for the client is not installed by the technician, then the system will install it. For example, Comodo Security, a necessary browser such as FireFox, and so on.

    Comment


    • #3
      Good idea.

      Comment


      • #4
        Hi rmorton

        Yes sure , we will update you once the script is ready

        Comment


        • #5
          Thank you. I think this will be an asset to the community.

          Comment


          • #6
            Originally posted by rmorton View Post
            Thank you. I think this will be an asset to the community.
            We offer Script Writing service for anyone who need it and do so for free. Any script any time....for free....please use it.

            Comment


            • #7
              Hi rmorton,

              Please use the script https://forum.mspconsortium.com/foru...and-install-it to get checking before downloading and installing any application

              Thank you.

              Comment

              Working...
              X