diff --git a/Evergreen/Apps/Get-Microsoft365Apps.ps1 b/Evergreen/Apps/Get-Microsoft365Apps.ps1 index 099fb679..c02a0661 100644 --- a/Evergreen/Apps/Get-Microsoft365Apps.ps1 +++ b/Evergreen/Apps/Get-Microsoft365Apps.ps1 @@ -1,4 +1,4 @@ -Function Get-Microsoft365Apps { +function Get-Microsoft365Apps { <# .SYNOPSIS Returns the latest Microsoft 365 Apps version number for each channel and download. @@ -8,34 +8,48 @@ Function Get-Microsoft365Apps { Twitter: @stealthpuppy #> [OutputType([System.Management.Automation.PSObject])] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification="Product name is a plural")] - [CmdletBinding(SupportsShouldProcess = $False)] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Product name is a plural")] + [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]) ) + # Get the channels for the Microsoft 365 Apps + $params = @{ + Uri = $res.Get.Update.Channels + ContentType = $res.Get.Update.ContentType + } + $Channels = Invoke-EvergreenRestMethod @params + + # Get the latest version details for the Microsoft 365 Apps $params = @{ Uri = $res.Get.Update.Uri ContentType = $res.Get.Update.ContentType } $Updates = Invoke-EvergreenRestMethod @params - ForEach ($Update in $Updates) { + # Walk through the channels to match versions and return details + foreach ($Channel in $Channels) { + $Item = $Updates | Where-Object { $_.channelId -eq $Channel.name } + if ($Item) { - # Find the release date for this version - $Date = ($Update.officeVersions | Where-Object { $_.legacyVersion -eq $Update.latestVersion }).availabilityDate + # Find the release date for this version + $OfficeVersion = $Item.officeVersions | Where-Object { $_.legacyVersion -eq $Item.latestVersion } - # Build and array of the latest release and download URLs - $PSObject = [PSCustomObject] @{ - Version = $Update.latestVersion - Channel = $Update.channelId - Name = $res.Get.Update.ChannelNames.$($Update.channelId) - Date = [System.DateTime]$Date - URI = $res.Get.Download.Uri + # Build and array of the latest release and download URLs + $PSObject = [PSCustomObject] @{ + Version = $Item.latestVersion + ReleaseVersion = $OfficeVersion.releaseVersion + Channel = $Channel.name + Name = $Channel.displayName + AvailableDate = ConvertTo-DateTime -DateTime $OfficeVersion.availabilityDate -Pattern $res.Get.Update.DateTime + EOSDate = ConvertTo-DateTime -DateTime $OfficeVersion.endOfSupportDate -Pattern $res.Get.Update.DateTime + URI = $res.Get.Download.Uri + } + Write-Output -InputObject $PSObject } - Write-Output -InputObject $PSObject } } diff --git a/Evergreen/Manifests/Microsoft365Apps.json b/Evergreen/Manifests/Microsoft365Apps.json index d2c89d24..f1150062 100644 --- a/Evergreen/Manifests/Microsoft365Apps.json +++ b/Evergreen/Manifests/Microsoft365Apps.json @@ -4,43 +4,9 @@ "Get": { "Update": { "Uri": "https://clients.config.office.net/releases/v1.0/OfficeReleases", - "ChannelNames": { - "BetaChannel": "Beta", - "CurrentPreview": "Current Channel (Preview)", - "Current": "Current Channel", - "MonthlyEnterprise": "Monthly Enterprise", - "SemiAnnualPreview": "Semi-Annual Channel Preview", - "SemiAnnual": "Semi-Annual Channel", - "PerpetualVL2021": "Office LTSC 2021 Perpetual Enterprise", - "PerpetualVL2019": "Office 2019 Perpetual Enterprise" - }, + "Channels": "https://config.office.com/api/filelist/channels", "ContentType": "application/json; charset=utf-8", - "DateTime": "MM/dd/yyyy HH:mm" - }, - "Update2": { - "Uri": "https://mrodevicemgr.officeapps.live.com/mrodevicemgrsvc/api/v2/C2RReleaseData?audienceFFN=", - "Channels": { - "BetaChannel": "5440fd1f-7ecb-4221-8110-145efaa6372f", - "CurrentPreview": "64256afe-f5d9-4f86-8936-8840a6a4f5be", - "Current": "492350f6-3a01-4f97-b9c0-c7c6ddf67d60", - "MonthlyEnterprise": "55336b82-a18d-4dd6-b5f6-9e5095c314a6", - "SemiAnnualPreview": "b8f9b850-328d-4355-9145-c59439a0c4cf", - "SemiAnnual": "7ffbc6bf-bc32-4f92-8982-f9dd17fd3114", - "PerpetualVL2021": "5030841d-c919-4594-8d2d-84ae4f96e58e", - "PerpetualVL2019": "f2e724c1-748f-4b47-8fb8-8e0d210e9208" - }, - "ChannelNames": { - "BetaChannel": "Beta", - "CurrentPreview": "Current Channel (Preview)", - "Current": "Current Channel", - "MonthlyEnterprise": "Monthly Enterprise", - "SemiAnnualPreview": "Semi-Annual Channel Preview", - "SemiAnnual": "Semi-Annual Channel", - "PerpetualVL2021": "Office LTSC 2021 Perpetual Enterprise", - "PerpetualVL2019": "Office 2019 Perpetual Enterprise" - }, - "ContentType": "application/json; charset=utf-8", - "DateTime": "MM/dd/yyyy HH:mm" + "DateTime": "dd/MM/yyyy HH:mm:ss a" }, "Download": { "Uri": "https://officecdn.microsoft.com/pr/wsus/setup.exe"