From fb3b49845b1e697ee979a9092684c9049daf668a Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Tue, 10 Oct 2023 12:06:22 +1100 Subject: [PATCH] Update MicrosoftWvd apps --- Evergreen/Apps/Get-MicrosoftWvdBootloader.ps1 | 13 +++++-------- Evergreen/Apps/Get-MicrosoftWvdInfraAgent.ps1 | 7 +++---- .../Get-MicrosoftWvdMultimediaRedirection.ps1 | 4 ++-- Evergreen/Apps/Get-MicrosoftWvdRemoteDesktop.ps1 | 12 ++++++------ Evergreen/Apps/Get-MicrosoftWvdRtcService.ps1 | 16 ++++++++-------- Evergreen/Manifests/MicrosoftWvdRtcService.json | 2 +- 6 files changed, 25 insertions(+), 29 deletions(-) diff --git a/Evergreen/Apps/Get-MicrosoftWvdBootloader.ps1 b/Evergreen/Apps/Get-MicrosoftWvdBootloader.ps1 index 6069fe22..dcf3a948 100644 --- a/Evergreen/Apps/Get-MicrosoftWvdBootloader.ps1 +++ b/Evergreen/Apps/Get-MicrosoftWvdBootloader.ps1 @@ -1,4 +1,4 @@ -Function Get-MicrosoftWvdBootLoader { +function Get-MicrosoftWvdBootLoader { <# .SYNOPSIS Get the current version and download URL for the Microsoft Remote Desktop Boot Loader. @@ -9,9 +9,9 @@ Function Get-MicrosoftWvdBootLoader { Twitter: @stealthpuppy #> [OutputType([System.Management.Automation.PSObject])] - [CmdletBinding(SupportsShouldProcess = $False)] + [CmdletBinding(SupportsShouldProcess = $false)] param ( - [Parameter(Mandatory = $False, Position = 0)] + [Parameter(Mandatory = $false, Position = 0)] [ValidateNotNull()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) @@ -24,14 +24,14 @@ Function Get-MicrosoftWvdBootLoader { ReturnObject = "Headers" } $Headers = Invoke-WebRequestWrapper @params + if ($null -ne $Headers) { - If ($Null -ne $Headers) { # Match filename $Filename = [RegEx]::Match($Headers['Content-Disposition'], $res.Get.Download.MatchFilename).Captures.Groups[1].Value # Match version $Version = [RegEx]::Match($Headers['Content-Disposition'], $res.Get.Download.MatchVersion).Captures.Value - If ($Version.Length -eq 0) { $Version = "Unknown" } + if ($Version.Length -eq 0) { $Version = "Unknown" } # Construct the output; Return the custom object to the pipeline $PSObject = [PSCustomObject] @{ @@ -44,7 +44,4 @@ Function Get-MicrosoftWvdBootLoader { } Write-Output -InputObject $PSObject } - Else { - Throw "$($MyInvocation.MyCommand): Failed to return a header from $($res.Get.Download.Uri)." - } } diff --git a/Evergreen/Apps/Get-MicrosoftWvdInfraAgent.ps1 b/Evergreen/Apps/Get-MicrosoftWvdInfraAgent.ps1 index fe5d5264..c485fefc 100644 --- a/Evergreen/Apps/Get-MicrosoftWvdInfraAgent.ps1 +++ b/Evergreen/Apps/Get-MicrosoftWvdInfraAgent.ps1 @@ -9,9 +9,9 @@ function Get-MicrosoftWvdInfraAgent { Twitter: @stealthpuppy #> [OutputType([System.Management.Automation.PSObject])] - [CmdletBinding(SupportsShouldProcess = $False)] + [CmdletBinding(SupportsShouldProcess = $false)] param ( - [Parameter(Mandatory = $False, Position = 0)] + [Parameter(Mandatory = $false, Position = 0)] [ValidateNotNull()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) @@ -23,7 +23,6 @@ function Get-MicrosoftWvdInfraAgent { ReturnObject = "Headers" } $Content = Invoke-WebRequestWrapper @params - if ($null -ne $Content) { # Match filename @@ -32,8 +31,8 @@ function Get-MicrosoftWvdInfraAgent { # Construct the output; Return the custom object to the pipeline $PSObject = [PSCustomObject] @{ Version = [RegEx]::Match($Content.'Content-Disposition', $res.Get.Download.MatchVersion).Captures.Value - Architecture = Get-Architecture -String $Filename Date = $Content.'Last-Modified'[0] + Architecture = Get-Architecture -String $Filename Filename = $Filename URI = $res.Get.Download.Uri } diff --git a/Evergreen/Apps/Get-MicrosoftWvdMultimediaRedirection.ps1 b/Evergreen/Apps/Get-MicrosoftWvdMultimediaRedirection.ps1 index f433e614..5effa83f 100644 --- a/Evergreen/Apps/Get-MicrosoftWvdMultimediaRedirection.ps1 +++ b/Evergreen/Apps/Get-MicrosoftWvdMultimediaRedirection.ps1 @@ -23,8 +23,8 @@ function Get-MicrosoftWvdMultimediaRedirection { ReturnObject = "Headers" } $Content = Invoke-WebRequestWrapper @params - if ($null -ne $Content) { + try { # Match filename $Filename = [RegEx]::Match($Content.'Content-Disposition', $res.Get.Download.MatchFilename).Captures.Groups[1].Value @@ -48,8 +48,8 @@ function Get-MicrosoftWvdMultimediaRedirection { # Construct the output; Return the custom object to the pipeline $PSObject = [PSCustomObject] @{ Version = $Version - Architecture = Get-Architecture -String $Filename Date = $Content.'Last-Modified'[0] + Architecture = Get-Architecture -String $Filename Filename = $Filename URI = $res.Get.Download.Uri } diff --git a/Evergreen/Apps/Get-MicrosoftWvdRemoteDesktop.ps1 b/Evergreen/Apps/Get-MicrosoftWvdRemoteDesktop.ps1 index 290789e2..fe60e1c5 100644 --- a/Evergreen/Apps/Get-MicrosoftWvdRemoteDesktop.ps1 +++ b/Evergreen/Apps/Get-MicrosoftWvdRemoteDesktop.ps1 @@ -9,9 +9,9 @@ Function Get-MicrosoftWvdRemoteDesktop { Twitter: @stealthpuppy #> [OutputType([System.Management.Automation.PSObject])] - [CmdletBinding(SupportsShouldProcess = $False)] + [CmdletBinding(SupportsShouldProcess = $false)] param ( - [Parameter(Mandatory = $False, Position = 0)] + [Parameter(Mandatory = $false, Position = 0)] [ValidateNotNull()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) @@ -23,11 +23,11 @@ Function Get-MicrosoftWvdRemoteDesktop { foreach ($architecture in $res.Get.Update.Uri.$channel.Keys) { Write-Verbose -Message "$($MyInvocation.MyCommand): Querying for architecture: $architecture." $Redirect = Resolve-SystemNetWebRequest -Uri $res.Get.Update.Uri.$channel[$architecture] - if ($null -ne $Redirect) { - $Update = Invoke-RestMethodWrapper -Uri $Redirect.ResponseUri.AbsoluteUri + $Update = Invoke-RestMethodWrapper -Uri $Redirect.ResponseUri.AbsoluteUri if ($null -ne $Update) { + Write-Verbose -Message "$($MyInvocation.MyCommand): Found version: $($Update.version)" $Date = ConvertTo-DateTime -DateTime $($Redirect.Headers['Last-Modified'] | Select-Object -First 1) -Pattern $res.Get.Download.DatePattern $FileName = $($Redirect.Headers['Content-Disposition'] -split $res.Get.Download.SplitText)[-1] -replace "\.json$", ".msi" @@ -35,11 +35,11 @@ Function Get-MicrosoftWvdRemoteDesktop { # Output the version object $PSObject = [PSCustomObject] @{ Version = $Update.version - Architecture = $architecture - Channel = $channel Date = $Date + Channel = $channel MD5 = $Update.md5 Sha2 = $Update.sha2 + Architecture = $architecture Filename = $FileName URI = $Update.url } diff --git a/Evergreen/Apps/Get-MicrosoftWvdRtcService.ps1 b/Evergreen/Apps/Get-MicrosoftWvdRtcService.ps1 index 7ff3a2ee..24b97be7 100644 --- a/Evergreen/Apps/Get-MicrosoftWvdRtcService.ps1 +++ b/Evergreen/Apps/Get-MicrosoftWvdRtcService.ps1 @@ -1,4 +1,4 @@ -Function Get-MicrosoftWvdRtcService { +function Get-MicrosoftWvdRtcService { <# .SYNOPSIS Get the current version and download URL for the Microsoft Remote Desktop WebRTC Redirector service. @@ -9,10 +9,10 @@ Function Get-MicrosoftWvdRtcService { Twitter: @stealthpuppy #> [OutputType([System.Management.Automation.PSObject])] - [CmdletBinding(SupportsShouldProcess = $False)] + [CmdletBinding(SupportsShouldProcess = $false)] param ( - [Parameter(Mandatory = $False, Position = 0)] - [ValidateNotNull()] + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNullOrEmpty()] [System.Management.Automation.PSObject] $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) ) @@ -24,17 +24,17 @@ Function Get-MicrosoftWvdRtcService { ReturnObject = "Headers" } $Headers = Invoke-WebRequestWrapper @params + if ($null -ne $Headers) { - If ($Null -ne $Headers) { # Match filename - $Filename = [RegEx]::Match($Headers['Content-Disposition'], $res.Get.Download.MatchFilename).Captures.Groups[1].Value + $Filename = [Regex]::Match($Headers['Content-Disposition'], $res.Get.Download.MatchFilename).Captures.Groups[1].Value # Construct the output; Return the custom object to the pipeline $PSObject = [PSCustomObject] @{ - Version = [RegEx]::Match($Headers['Content-Disposition'], $res.Get.Download.MatchVersion).Captures.Value - Architecture = Get-Architecture -String $Filename + Version = [Regex]::Match($Headers['Content-Disposition'], $res.Get.Download.MatchVersion).Captures.Value Date = $Headers['Last-Modified'] | Select-Object -First 1 Size = $Headers['Content-Length'] | Select-Object -First 1 + Architecture = Get-Architecture -String $Filename Filename = $Filename URI = $res.Get.Download.Uri } diff --git a/Evergreen/Manifests/MicrosoftWvdRtcService.json b/Evergreen/Manifests/MicrosoftWvdRtcService.json index 05a76612..f740695a 100644 --- a/Evergreen/Manifests/MicrosoftWvdRtcService.json +++ b/Evergreen/Manifests/MicrosoftWvdRtcService.json @@ -1,6 +1,6 @@ { "Name": "Microsoft Remote Desktop WebRTC Redirector Service", - "Source": "https://docs.microsoft.com/en-us/azure/virtual-desktop/teams-on-wvd", + "Source": "https://docs.microsoft.com/en-us/azure/virtual-desktop/teams-on-avd", "Get": { "Download": { "Uri": "https://aka.ms/msrdcwebrtcsvc/msi",