uberAgent just came out with a new version so it was about time for me to make it EverGreen. I reached out to Helge Klein to get him to create a text file with the latest version and that’s basically what I need.
Software vendors please reach out and I’ll create it, share it and blog about for free. It’s all about sharing with the community.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
Function Get-uberAgentVersion { <# .NOTES Author: Trond Eirik Haavarstein Twitter: @xenappblog #> $url = "https://uberagent.com/downloads/uberAgent/current/uberAgent-current.txt" try { $temp = New-TemporaryFile Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $temp -ErrorAction SilentlyContinue $file = get-content $temp $f1 = $file.trimstart("uberAgent-") $Version = $f1.TrimEnd(".zip") Write-Output $Version } catch { Throw "Failed to connect to URL: $url with error $_." } } # PowerShell Wrapper for MDT, Standalone and Chocolatey Installation - (C)2015 xenappblog.com # Example 1: Start-Process "XenDesktopServerSetup.exe" -ArgumentList $unattendedArgs -Wait -Passthru # Example 2 Powershell: Start-Process powershell.exe -ExecutionPolicy bypass -file $Destination # Example 3 EXE (Always use ' '): # $UnattendedArgs='/qn' # (Start-Process "$PackageName.$InstallerType" $UnattendedArgs -Wait -Passthru).ExitCode # Example 4 MSI (Always use " "): # $UnattendedArgs = "/i $PackageName.$InstallerType ALLUSERS=1 /qn /liewa $LogApp" # (Start-Process msiexec.exe -ArgumentList $UnattendedArgs -Wait -Passthru).ExitCode Clear-Host Write-Verbose "Setting Arguments" -Verbose $StartDTM = (Get-Date) $Vendor = "Misc" $Product = "uberAgent x64" $PackageName = "uberAgent-64" $InstallerType = "msi" $Source = "$PackageName" + "." + "zip" $Version = "$(Get-uberAgentVersion)" $LogPS = "C:\Windows\Temp\$Vendor $Product $Version PS Wrapper.log" $LogApp = "C:\Windows\Temp\$PackageName.log" $Destination = "${env:ChocoRepository}" + "\$Vendor\$Product\$Version\$packageName.$installerType" $UnattendedArgs = "/i $PackageName.$InstallerType ALLUSERS=1 SERVERS=SPL-01:19500 /qn /liewa $LogApp" $URL = "https://uberagent.com/downloads/uberAgent/current/uberAgent-$Version.zip" $ProgressPreference = 'SilentlyContinue' Start-Transcript $LogPS if( -Not (Test-Path -Path $Version ) ) { New-Item -ItemType directory -Path $Version } CD $Version Write-Verbose "Downloading $Vendor $Product $Version" -Verbose If (!(Test-Path -Path $Source)) { Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $Source Expand-Archive -Path $Source -DestinationPath . } Else { Write-Verbose "File exists. Skipping Download." -Verbose } CD "uberAgent components\uberAgent_endpoint\bin" Write-Verbose "Starting Installation of $Vendor $Product $Version" -Verbose (Start-Process msiexec.exe -ArgumentList $UnattendedArgs -Wait -Passthru).ExitCode Write-Verbose "Stop logging" -Verbose $EndDTM = (Get-Date) Write-Verbose "Elapsed Time: $(($EndDTM-$StartDTM).TotalSeconds) Seconds" -Verbose Write-Verbose "Elapsed Time: $(($EndDTM-$StartDTM).TotalMinutes) Minutes" -Verbose Stop-Transcript |