i want to write a ps script that will auto download exe file from suppliers site
(e.g. www.suppliers.com/file.exe)
then after the download the scripts will check if existing file on local computer has already same file version with new download - if it is, scripts will not continue to run the exe and end the command
else - the file.exe will continue install and update the current installed application on local computer - then output reports to c:\file.log
Hey James, if i understand this right, the initial exe is like a compressed zip file, which automatically expands to a folder when you run it, before the dialogue prompts for installation begin? Also not sure how you would resume an installation of a program when the process is already running?
Code wise, for killing the process, your function would consist of something like this :
For the auto download you refer to, I guess you will have options of performing the download via a scheduled task, or a new registered event using a timer. A scheduled task has the advantage that you dont need to have an active powershell session open to perform the task.
I’m not sure if thats what you mean though. Can you be a bit more specific?
there is a program we use in the engineering group that has weekly /monthly updates - the issue is that once installed by the administrator the only way updates can be loaded is by the administrator -the issue we have that in order to get the administrator to make the updates it has to go to our helpdesk etc and becomes a bureaucratic nightmare for an update. So what happens is we continue to run without the updates because it is easier. Most of the updates are bug fixes and software improvements.
My question is it possible to write a ps scripts and have a secondary level of administrator who is a regular user of the software and can load the updates for designated programs
the program is running on a windows 2008 box which has our production program running on it and at least we need the script to run once a month to check if any new release updates frmo vendor site (by checking the fileversion info and do comparison to current installed on server) if fileversion is the same then scripts will terminate the program end of story
but if new file version is available we want the scripts to be able to download the single exe program from suppliers site - then check if any process running and terminate if process running - then install the new software and create an installation.log in C: after ending the scripts
Sounds like a company i worked for a year or two ago and their frequent updates to saplogon.ini. But i’ll say no more about that one!
Some form of scheduling is definately the way to go with this. Does your company use SCCM by any chance? My personal preference would be to use this as you can then just update an existing package with the downloaded file. This could be combined with a Task Sequence from which you can run your powershell code.
To be honest, for what you want to do though, i’d be more inclined to wrap the file in a Windows Installer package, which can handle everything you need for this, including version control. Then either use a distribution tool like sccm, or create a scheduled task which runs in an administrative context on the engineers systems to access the latest msi file on a network share. This also has the advantage that you only need a one time download.