Category filter
Script to download files on Windows devices
You can use custom scripts to perform almost all sorts of configurations on the devices. For example, when you want to pre-provision Windows devices with necessary files, you may use PowerShell commands to specify the file URL to download them directly to a specified location on the devices. These commands can be executed as scripts from the Hexnode portal to initiate file download on several devices.
Script to download files
The PowerShell script to download files from a given URL to a specific location on a Windows device is given below.
1 2 3 |
$client = new-object System.Net.WebClient $client.DownloadFile("https://www.hexnode.com/mobile-device-management/resources/hexnode-unified-endpoint-management.pdf","C:\Users\Acer\Pictures\Saved Pictures\samplefile.pdf") |
The $client.DownloadFile command takes two arguments: the file URL and the device location to download the file. The downloaded file takes after the file name you have provided in the second argument (Here, samplefile.pdf).
Given above is a sample script that downloads a PDF file from the URL “https://www.hexnode.com/mobile-device-management/resources/hexnode-unified-endpoint-management.pdf” to the device location “C:\Users\Acer\Pictures\Saved Pictures\” . You may replace these arguments with the parameters that help download the necessary files to the devices.