<# .SYNOPSIS Installs the latest alpha build of Windows Terminal #> param( #Path to store the terminal app. Defaults to %LocalAppData%/WinTerminalDev $Path = (join-path $env:LocalAppData "WinTerminalDev") ) write-host -fore Green "====Windows Terminal Latest Dev Build Installer====" #Sanity Checks $ErrorActionPreference = 'stop' $DevMode = Get-ItemPropertyValue -Path 'HKLM:\software\Microsoft\Windows\CurrentVersion\AppModelUnlock' -Name allowdevelopmentwithoutdevlicense if (-not $DevMode) {throw "You have not enabled developer mode in Windows yet: https://docs.microsoft.com/en-us/windows/uwp/get-started/enable-your-device-for-development"} [int]$ReleaseID = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseID if ([environment]::OSVersion.version -lt '10.0.18362.0') {throw "You need Windows 10 1903 or greater to test Windows Terminal."} #Get Latest Successful Master Build function Get-AzDevOpsArtifact($organization,$project,$path) { $body = [ordered]@{ resultFilter='Succeeded' BuildQueryOrder='finishTimeDescending' reasonFilter='batchedCI' branchName='refs/heads/master' artifactName='appx-Release' '$top'="1" 'api-version'=4.1 } $baseURI = "https://dev.azure.com/$organization/$project/_apis/build" $latestBuildID = (irm "$baseURI/builds" -body $Body -verbose).value.id write-host -fore Green "Fetching artifact for build $latestBuildId" $zipUrl = (irm "$baseuri/builds/$latestBuildID/artifacts" -verbose).value.resource.downloadUrl $progresspreference='silentlycontinue' $zipDir = New-Item $path -type Directory -ErrorAction 'SilentlyContinue' write-host -fore Green "Downloading appexrelease for build $latestBuildId" iwr -outfile "$path\appxrelease.zip" -UseBasicParsing $zipUrl -verbose } Get-AzDevOpsArtifact ms terminal "$path" -verbose Expand-Archive $path/appxrelease.zip -force $appxreleasepath = join-path $path 'appxrelease/appx-Release' 'CascadiaPackage_*_x64.msix','OpenConsolePackage_*_x64.appx' | foreach { Get-ChildItem $appxreleasepath/$PSItem } | foreach { write-host -fore green "Installing $PSItem Package" $PSItem | Expand-Archive -Force Add-AppxPackage "$appxreleasepath/$($psitem.basename)/AppxManifest.xml" -Register -Verbose -ForceApplicationShutdown } write-host -fore green "Done!"