Automating with PowerShell: Monitoring Office Releases

New Website and upcoming blogs

So I haven’t blogged for the last month, and I’m not gonna tell you that was because I was moving my website to Azure Static Web Apps, because it was not. I just couldn’t find the time or inspiration to write anything down that would be useful to anyone. It happens sometimes and a bit of writers(or bloggers, or PowerShellers) block happens to anyone. Blogging and sharing knowledge is one of the most satisfying things I do so naturally I got a little bit annoyed at myself.

To get back in the game, I’ve decided to move the CyberDrain.com website from my old web host to Azure Static Web Apps. In a “practice what you preach” type of thing I figured that this move makes most sense for me; it gives me a CDN, the capability to stick an API behind some of my stuff, and allow me to edit pages in markdown and not that annoying Wordpress editor that always got me down. ;)

I’ve also decided to start a new blogging series next to my PowerShell blogs, I want to write down some more of my experiences instead of just dropping technical bombs all the time. I’ve often had people tweet or talk about my CTF story times I’ve encountered challenging issues in my business and I believe I have enough fun stories to keep everyone entertained with those as well.

To get started with blogging again I’ve decided to release 3 new blogs in the coming days, of which this is the first. I hope you’ll all enjoy them, and the new platform too.

Automating with PowerShell: Monitoring Office releases

I’ve blogged about monitoring updates for office before but that is a pretty static approach to things; you have to enter the latest version of Office yourself and with the now bi-weekly updates in the preview channel that could get annoying, especially if you want to keep your minimum version the same as the latest released version.

And that’s where this blog enters; Microsoft has a nice API available that tells us exactly which latest version is available for Office, it also tells us exactly which versions are no longer supported and really require an update. This monitoring script tells you which version is currently installed, if it is the latest version, and if not, if the version you are running is still in support by Microsoft.

$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 "Currently using the latest version of Office in the $($UsedChannel.Channel) Channel: $($ReportedVersion)"
    exit 0
}
else {
    Write-Host "Not using the latest version in the $($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 "This version does not yet have an end-of-support date. You are running a current version, but not the latest. Your version is $($ReportedVersion) and the latest version is $($UsedChannel.latestVersion)"
        exit 0
    }
    if ($OurVersion.endOfSupportDate) {
        Write-Host "this version will not be supported at $($OurVersion.endOfSupportDate). Your version is $($ReportedVersion) and the latest version is $($UsedChannel.latestVersion)"
        exit 1
    }
    else {
        Write-Host "Could not find version in the supported versions list. This version is most likely no longer support. Your version is $($ReportedVersion) and the latest version is $($UsedChannel.latestVersion). For all supported versions, see below"
        $CloudVersionInfo.OfficeVersions
        exit 1
    }
}

As always, Happy PowerShelling

Recent Articles

The return of CyberDrain CTF

CyberDrain CTF returns! (and so do I!)

It’s been since september that I actually picked up a digital pen equivalent and wrote anything down. This was due to me being busy with life but also my side projects like CIPP. I’m trying to get back into the game of scripting and blogging about these scripts. There’s still so much to automate and so little time, right? ;)

Monitoring with PowerShell: Monitoring Acronis Backups

Intro

This is a monitoring script requested via Reddit, One of the reddit r/msp users wondered how they can monitor Acronis a little bit easier. I jumped on this because it happened pretty much at the same time that I was asked to speak at the Acronis CyberSummit so it kinda made sense to script this so I have something to demonstrate at my session there.

Monitoring with PowerShell: Monitoring VSS Snapshots

Intro

Wow! It’s been a while since I’ve blogged. I’ve just been so swamped with CIPP that I’ve just let the blogging go entirely. It’s a shame because I think out of all my hobbies it’s one I enjoy the most. It’s always nice helping others achieve their scripting target. I even got a couple of LinkedIn questions asking if I was done with blogging but I’m not. Writing always gives me some more piece of mind so I’ll try to catch up again. I know I’ve said that before but this time I’ll follow through. I’m sitting down right now and scheduling the release of 5 blogs in one go. No more whining and no more waiting.