Something's gone wrong!An error ocurred performing that action. Please try refreshing the page.

CM: Scripts and updating the client Windows edition

By Katy Nicholson, posted on 2 August, 2020

winver showing Education edition

We took delivery of 5 Surface Go tablets a while ago, as we are trialling a Surface Go paired up with a Microsoft Wireless Display adapter on the projector, to replace the traditional PC + interactive whiteboard. They came with Win 10 Pro pre-installed and I didn't fancy re-imaging them (given at the time I didn't have any Surface Docks, so no way to plug into the network). This post covers creating and running Powershell scripts through MEMCM as well as the script required to bump up the Windows edition.

You need to find out the default product key for the edition you want to move to - called the "generic volume licence key". These are publicly available, as they require Active Directory or KMS to be configured for them to activate. They can be found here:

To update the edition we need the following powershell, with the GVLK for the edition you want plugged in (in this case it's Education)

$sls = Get-WmiObject -Query 'SELECT * FROM SoftwareLicensingService' @($sls).foreach({ $_.InstallProductKey("NW6C2-QMPVW-D7KKK-3GKT6-VCFB2") $_.RefreshLicenseStatus() })

If you've only a couple of PCs to run this on you might want to do it manually - however I don't like doing this manually, especially when it involves logging on to machines. So we'll do it with the Scripts section of MEMCM.

Create your script - notice you can import an existing Powershell script if needed.

Open your MEMCM console, then go to Software Library\Scripts and hit Create Script. Put in a title and paste the above script in, then hit Next and finish the wizard. You'll notice you've now got one script which is waiting for approval. By default, you will need somebody with the script approver role to approve your scripts in MEMCM, and you can't approve your own scripts - fine for a large environment but if you're the only person capable of doing this you'll want to be able to approve your own scripts. Luckily there's a setting that enables this - go to Administration\Site Configuration\Sites. On the bar at the top, click on Hierarchy Settings, and then look for the "Script authors require additional script approver" and untick this.

Now if you go back to Software Library\Scripts, you should be able to select your script and approve it. If you are in a larger environment and want to keep the default behaviour, find somebody and ask them to approve your script now.

If you now go into Assets and Compliance, you can select some devices (or an entire device collection), right click and select Run Script. Go through the wizard, selecting your script and eventually you'll be at a screen "Creating client jobs". Once this has finished (assuming the client devices are powered up and accessible to MEMCM) you'll get the results of the script:

Detailed results of the script job per device

If you close the wizard it will still create the jobs/run the script in the background, and you can check up on it through Monitoring\Scripts. Double clicking on a script will also show you the detailed results, including any output returned from the script on each device. You can also see bar charts if the script is outputting something useful for viewing in that format (e.g. a script to get the version number).

Monitoring\Scripts will show you current and previous jobs with the results

Support My Work

I hope you find my content useful. Please consider tipping to support the running costs of hosting, licensing etc on my Ko-fi page.

Support me on Ko-fi