PDQ.com mobilePDQ.com desktop
Support

Download Files Inside a Deployment

Jason  AmickJason Amick
·

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.

Destination Caveat

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.

curl.exe https://ftp.nluug.nl/pub/graphics/blender/release/Blender2.83/blender-2.83.1-windows64.msi -o blender-2.83.1-windows64.msi
msiexec.exe /i "blender-2.83.1-windows64.msi" ALLUSERS=1 /qn /norestart /log output.log

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.

Using PowerShell

In PowerShell, we can use Invoke-WebRequest or Invoke-RestMethod. The difference is the latter can natively understand a REST API return. So that is what we will use for this example.

$Uri = https://ftp.nluug.nl/pub/graphics/blender/release/Blender2.83/blender-2.83.1-windows64.msi
Invoke-RestMethod -Uri $Uri -OutFile blender.msi
msiexec.exe /i "blender-2.83.1-windows64.msi" ALLUSERS=1 /qn /norestart /log output.log

Easy, Right?

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.

Ready to get started with PDQ Deploy & Inventory?

Take our 14-day Free Trial.
This round is on us!

Don't miss the next post!

August 2020 Patch Tuesday Vulnerabilities

August 2020 Patch Tuesday Updates and Vulnerabilities

PDQ.com
© 2020 PDQ.com Corporation

Products

  • Deploy
  • Inventory
  • Enterprise SL
  • Pricing
  • Downloads
  • Licensing
  • Buy