So you want to use a freshly downloaded file inside your deployment, but you want this deployment to remain a Set It and Forget It package. You can do this with any file for which you can get a download link. This is also useful if you need to ensure your installer is installing the most up to date templates or modules when they are separate downloads. We will cover how to do this, and how to make sure you can use that file during your deployment.
When downloading a file from inside a deployment, you will need to keep in mind that the section for the working directory will be inside of a runner service that will get obliterated when that step completes. If you do not use the file and finish with it in the same step, that file will get destroyed as well. So using the working directory for your destination may not always be the best practice. You can utilize temp folders instead or any other location if you need to use that file in later steps, you can clean it up at the end.
With CMD Prompt
Let us start with a method in CMD prompt. For this method, we will use curl.exe. We will not go into all the switches because the list is enormous, but you can view these by running curl.exe –help. The syntax for this example will be curl.exe “sourceWebAddress” -o “Destination” the switch we are using is -o meaning output or Write to file.
This command will reach out to the given url, grab that file, and save it to the location we entered as the destination. In this case, we are going to use the working directory because we are going to kick off the silent install in the same step.
So now that we have learned to download a file and use it in either a CMD step or a PowerShell Step, the world is a better place. Keep in mind that the file will not be found to add in an Install step because it does not exist while creating the package. It also cannot be referenced in later steps unless you use a CMD or PowerShell step to call it from wherever you decided to stash the little fella.
After a decade of grinding away what seems like a lifetime in IT\sysadmin work, the only thing Jason loves more than work is sleeping, eating, drinking, riding his Harley, spending time with his kids, pretty much most things. This is why Jason automates so many tasks, if it can be automated it should be automated. If it can't, then why do it?