-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDetect-OfficeUpdateChannel.ps1
More file actions
21 lines (21 loc) · 973 Bytes
/
Detect-OfficeUpdateChannel.ps1
File metadata and controls
21 lines (21 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
try
{
$ReportedVersion = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration" -Name "VersionToReport"
$Channel = Get-ItemPropertyValue -Path "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration" -Name "CDNBaseUrl" | Select-Object -Last 1
$CloudVersionInfo = Invoke-RestMethod 'https://clients.config.office.net/releases/v1.0/OfficeReleases'
$UsedChannel = $cloudVersioninfo | Where-Object { $_.OfficeVersions.cdnBaseURL -eq $channel }
if (($UsedChannel.channelId -eq "SemiAnnual") -and ($UsedChannel.latestversion -eq $ReportedVersion)) {
Write-Host "Currently using the latest version of Office in the $($UsedChannel.Channel) Channel: $($ReportedVersion)"
Exit 0
}
else {
Write-Host "Not using Semi-Annual channel. Detected channel is the $($UsedChannel.Channel) Channel."
Exit 1
}
}
catch
{
$errMsg = $_.Exception.Message
Write-Host $errMsg
Exit 1
}