Script for FTP_.msi pull and install

I need help to build a script that will pull a .msi from a FTP server and then silently install. Any pointers would be appreciated.

I see you are asking for Windows. Are you using CMD, powershell, or something else? And for what Windows and/or scripting program version(s)?

If you are going for powershell, I would install and use this module-
https://gallery.technet.microsoft.com/scriptcenter/PowerShell-FTP-Client-db6fe0cb

Connect to the remote server, download the msi, disconnect from the remote server, launch the MSI, delete the MSI. Add error handling and stuff as needed(ie a decent error message if it cannot connect, if the file is not their, etc)

Look up how to do basic(and some more advanced) powershell stuff here-
https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-5.1

Primarily for windows. We have an RMM tool that can push scripts. I wanted a script we could push out that would go to a web hosted FTP server that would pull down a .msi file and run it silently.

What language do you want to use?

Powershell?
CMD(ie .bat or .cmd)?
Python?
Something else?

.bat probable, I appreciate your help. Not sure why but I haven’t been getting notifications for your replies, sorry with the delayed response

Windows has a built in FTP application that you can access from cmd so it should not be too hard.

MD a directory in temp
CD to that directory
echo your ftp commands to a text file
ftp to the remote computer with the text file as an argument for what ftp commands to run(ie login credentials and pulling a msi then quiting)
msiexec /i /quiet filename.msi
cd to somewhere else
rd /s the directory in temp

You will have to fill in what exact commands you need, see the resources below on the commands-
https://ss64.com/nt/md.html
https://ss64.com/nt/cd.html
https://ss64.com/nt/echo.html
https://ss64.com/nt/ftp.html
https://ss64.com/nt/msiexec.html
https://ss64.com/nt/rd.html

Thank you for your help. I appreciate it :slight_smile:

1 Like