29 lines
1.4 KiB
PowerShell
29 lines
1.4 KiB
PowerShell
#zebra
|
|
#Gets current Microsoft Office Version
|
|
|
|
$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.latestversion -eq $ReportedVersion) {
|
|
Write-Host "Up to date. $($ReportedVersion) - Channel: $($UsedChannel.Channel) "
|
|
exit 0
|
|
}
|
|
else {
|
|
Write-Host "Not up to date, $($UsedChannel.Channel) Channel. Check if version is still supported"
|
|
$OurVersion = $CloudVersionInfo.OfficeVersions | Where-Object -Property legacyVersion -EQ $ReportedVersion
|
|
if ($OurVersion.endOfSupportDate -eq "0001-01-01T00:00:00Z") {
|
|
Write-Host "Not up to date: $($ReportedVersion) - Latest: $($UsedChannel.latestVersion)"
|
|
exit 0
|
|
}
|
|
if ($OurVersion.endOfSupportDate) {
|
|
Write-Host "Out of date: $($ReportedVersion) - End of Support: $($OurVersion.endOfSupportDate) - Latest: $($UsedChannel.latestVersion)"
|
|
exit 1
|
|
}
|
|
else {
|
|
Write-Host "Unsupported: $($ReportedVersion) - Latest: $($UsedChannel.latestVersion)."
|
|
#$CloudVersionInfo.OfficeVersions
|
|
exit 1
|
|
}
|
|
} |