Category filter
Script to download and install Enterprise app (EXE) from its download link
Enterprise apps are apps that are tailored to meet the needs of an organization. Hexnode users can deploy scripts to download and install such apps on Windows 10 devices.
Batch Script
1 2 |
bitsadmin.exe /transfer "Name_of_the_process" download_url path_of_exe_file Start path_of_exe_file |
E.g., To install a program ‘application.exe’ in the Desktop of the user Deborah,
bitsadmin.exe /transfer "transfer123" http://download.url/application.exe C:\Users\Deborah\application.exe
Start C:\Users\Deborah\application.exe
PowerShell Script
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
$file=’desired_name’ $url=’downloadable_link’ Invoke-WebRequest –Uri $url -OutFile $file $arguments = "" if($arguments) { $installProcess = (Start-Process $file -ArgumentList $arguments -PassThru -Wait) } else { $installProcess = (Start-Process $file -PassThru -Wait) } if (installProcess.ExitCode-ne 0){ Write-Host ‘Installation failed’ exit installProcess.ExitCode } else{ Write-Host ‘Installation successful’ } |
Enter suitable values for the $file and $url variables in the above script. Moreover, if the .exe file mandates any arguments for its installation, you can provide them corresponding to the $arguments variable within the double inverted commas. The argument(s) to be passed are specific to the .exe file of the application to be installed.
For example, the following script will install a program ‘application.exe’ that requires a valid site token for its installation:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
$file=’application.exe’ $url=’http://download.url/application.exe’ Invoke-WebRequest –Uri $url -OutFile $file $arguments = "/SITE_TOKEN=xxxx" if($arguments) { $installProcess = (Start-Process $file -ArgumentList $arguments -PassThru -Wait) } else { $installProcess = (Start-Process $file -PassThru -Wait) } if (installProcess.ExitCode-ne 0){ Write-Host ‘Installation failed’ exit installProcess.ExitCode } else{ Write-Host ‘Installation successful’ } |