Update Edge source files in MEMCM using PowerShell

Edge is updated often and if we use AutoUpdate which I think we should use for Edge it is automatically updated after OS deployment. But in some cases, we need policies to be applied to Edge that are only supported in newer versions then we need to make sure it is updated when the user logs on.

I found this great PowerShell module “Evergreen” https://www.powershellgallery.com/packages/Evergreen written by Aaron Parker; Bronson Magnan; Trond Eric Haarvarstein. Which makes this task easy as we can use that module to check the latest version, get download paths and so on. I have used to send emails when new versions are being published so a ticket is being created in our helpdesk system. Be sure to check it out!

Sample script dialog

The script can be downloaded from Github here: PowerShell/UpdateEdgeSourceFiles at master · Ccmexec/PowerShell · GitHub

The script will do the following:

  • Install/Update the Evergreen module
  • Check if a new version of Edge (stable) is available
  • Download the latest version if needed to a staging folder
  • Copy the EdgeEnterprise.MSI to the source folder configured in the script
  • Update the Source files on Distribution Points

In this setup I used the wizard in MEMCM to create the Edge application, the detection method created by the wizard uses the “Greater than or equal to” Operator so it will still work just fine even after we updated the Source files.

Detection Method example

The script can be run as a schedule task on a server/computer, it needs the Configuration Manager console installed or cmdlets. 

Before using the script, the following lines needs to be adjusted to your environment.

Script parameters

$CMEdgeAppName = The name of the Edge application that should be updated.
$CMAPPDeploymentType = The Deployment type Edge that should be updated.
$TempPath = Path to staging folder where the new .MSI will be downloaded to.
$TargetPath= the path to the source files for Edge
$VersionsToKeep = how many versions of Edge should be saved in the Staging folder.

The script will create the staging folder, in this example “D:\staging”. It can also be configured to keep x number of versions if for some reasons a rollback is needed, after that it will start deleting the oldest one.

Staging folder content

It also creates a log file that can be used to troubleshoot if something went wrong when running the script.

Log file sample

I hope this can be useful!

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.