Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Variables
- $AppName = 'Bluebook'
- $AppVersion = '0.9.257'
- $AppFileName = $AppName + '_' + $AppVersion + '.exe'
- $RemoteAppPath = "\\BCS.local\SYSVOL\BCS.Local\Apps\$AppName\$AppFileName"
- $SetupAppPath = 'C:\TempPath\' + $AppName
- $InstallPath = "$env:LOCALAPPDATA\Programs\bluebook\Bluebook.exe"
- $ProgressPreference = 'SilentlyContinue'
- #Create Setup Path
- if (!(Test-Path $SetupAppPath )) { New-Item -Path $SetupAppPath -ItemType Directory -Force }
- #Start Logging
- Start-Transcript -Path "$SetupAppPath\Deploy_$AppName.log" -Force
- #Check If Installed
- if ((Test-Path "$InstallPath")) {
- Write-Host "$AppName is already installed. Aborting..."
- Stop-Transcript
- Exit
- } else {
- #Check Setup File
- if ((Test-Path "$SetupAppPath\$AppFileName")) {
- Write-Host "$AppName installer already exists. Proceeding with install..."
- } else {
- Write-Host "$AppName installer is missing. Downloading..."
- Copy-Item "$RemoteAppPath" -Destination "$SetupAppPath\$AppFileName" -Force -Confirm:$false
- if (!(Test-Path "$SetupAppPath\$AppFileName")) {
- Write-Host "$AppName installer failed to download! Review logs to troubleshoot."
- Stop-Transcript
- Exit
- } else {
- Write-Host "$AppName installer successfully download!"
- }
- }
- #Install App
- Write-Host "Installing $AppName" -ForegroundColor Yellow
- Start-Process -FilePath "$SetupAppPath\$AppFileName" -ArgumentList "/S" -Wait
- if ((Test-Path "$InstallPath")) {
- Write-Host "$AppName was successfully installed!"
- Stop-Transcript
- Exit
- } else {
- Write-Host "$AppName failed to install! Review logs to troubleshoot."
- Stop-Transcript
- Exit
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement