Showing results for 
Search instead for 
Did you mean: 

Install Software with Google Drive as the File Repo

Novitiate I

I needed to work out how to host files in a location that i had control of, but could be access by any device connected to the internet, preferably without introducing any new vendors/apps. We are a google shop, so I created a folder in our IT shared drive for the files I needed to deploy, and then just needed to figure out how to download them with PowerShell. 

Here is what i figured out: 

1. Create a shareable link in google drive to the file/folder you need to download with viewer access to anyone with the link. It should look something like this:<FileID>/view?usp=sharing
The <FileID> is what we need from this link. Save this to $id or something similar.

2. Use this code block to set the download location of the file to $InstallerTempLocation this should include the filename and file extension i.e.: 

$installerTempLocation = "C:\Users\$SignedInUserUsername\AppData\Local\Temp\App2Installv1.3.45.msi"

Use this code block to download the file to that location: 

Write-Output 'Testing if installer is downloaded'

if (-not(Test-Path -Path $InstallerTempLocation -PathType Leaf))
        Write-Output 'Downloading installer now.'
            $WebClient = New-Object System.Net.WebClient
            $Url = "$id&confirm=t"
            $WebClient.DownloadFile($Url, $InstallerTempLocation)
            Write-Error "Unable to download installer to $InstallerTempLocation."
            exit 1
        Write-Output 'Finished downloading installer.'
        throw $_.Exception.Message

This checks if the file is already downloaded, and if not, downloads it to your chosen directory. 

3. run your command to install the files, you will need to work out the correct flags to use to run your exe or msi or whatever silently. 

The result is the base you can use to install any application without a chocolatey package.

Bonus nachos: By default windows commands run as the system user, but if you take a look at the template script for installing the JumpCloud Password manager, there is a section that has the installer run as the local user. You can copy this into your script to install apps as the user where required as well. 

You Might Like

New to the site? Take a look at these additional resources:

Community created scripts:

Our new Radical Admin blog:

Keep up with Product News:

Read our community guidelines

Ready to join us? You can register here.