Skip to main content

Worklet: Install Dropbox for Windows


Nic-Automox

Installs Dropbox client on Windows

Evaluation code:

#REQUIRES -Version 2.0
<#
.SYNOPSIS
    This Test script checks to see if Dropbox is installed
.DESCRIPTION
    This script queries the installed files for 32 and 64bit software
    and returns a 0 if product is installed or 1 if not
.Notes
    File Name       :Dropbox_Install_Test.ps1
    Author          :Automox
    Prerequisite    :PowerShell V2 over win7 and upper
#>
#Handle Exit Codes:
trap {  $host.ui.WriteErrorLine($_.Exception); exit 90 }

function Dropbox_Install_Test {
	#Get 32 bit software
	$32BIT=Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* |  Select-Object DisplayName | select-string 'Dropbox' | out-string
	#check 64 bit
	$64BIT=Get-ItemProperty HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* |  Select-Object DisplayName | select-string 'Dropbox' | out-string

    if ($32BIT.Trim() -match "{Displayname=Dropbox}" -Or $64BIT.Trim() -match "{Displayname=Dropbox}") {
		exit 0
	}
    else {
        Write-Error "Dropbox not detected. Run Remediation Script"
        exit 1
	}
}

Dropbox_Install_Test

Remediation code:

#REQUIRES -Version 2.0
<#
.SYNOPSIS
    This script allows an admin to install Dropbox
.DESCRIPTION
    This script downloads the quiet msi installer into /Temp and runs it.
    Once the script has executed it will remove the install files.
    This is an example script that has been tested to work on Win10 and Win7.
    This script may not work on all systems. Modify to fit your needs
.NOTES
    File Name       :Dropbox_Install.ps1
    Author          :Automox
    Prerequisite    :PowerShell V2 over win7 and upper
#>
#Handle Exit Codes:
trap {  $host.ui.WriteErrorLine($_.Exception); exit 90 }

function Dropbox_Install {
    #############Change the settings in this block#######################
    $Save_Dir="c:\\Windows\Temp"
    $URL="https://www.dropbox.com/download?full=1&plat=win"
    #####################################################################
    Try {
        (new-object    System.Net.WebClient).DownloadFile("$URL", "$Save_Dir\Dropbox_Install.exe")
        start-process c:\\Windows\Temp\Dropbox_Install.exe /S -wait
        Remove-Item "$Save_Dir\Dropbox_Install.exe"
        exit 0
    }
    Catch {
        exit 1
    }
}

Dropbox_Install

0 replies

Be the first to reply!

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings