Reading Time: 3 minutes

Hi everyone! #WAC extensions list is growing day by day and more functionality is being added to our favorite management tool. But, there is a small key feature missing at the moment. The possibility to perform automatic updates for the extensions you are using.

For this reason, I took a little bit of time to compile the following PowerShell script which it takes care of the extension update process for us. So let’s break down a bit the script.

The following script was tested on a #WAC Gateway Server.

Step 1: Import the WAC module to the current session

Firstly, we need to add the #WAC module to the current session in order to leverage the extension update function that comes with it. The script must be executed from the target machine where the #WAC is hosted.

Step 2: Specify the WAC gateway

During this step, we need to specify the #WAC url address which the updater will run again to.

Step 3: Getting a list of all the outdated extensions

The following on-liner will query against the #WAC extensions and list only the ones that are outdated.

Step 4: Update #WAC outdated extensions and produce a log file

Having a list with all the extensions that are missing the missing updates from the previous step, we are now able to initiate the update process from the default extension feed “https://aka.ms/sme-extension-feed”. The feed is not included below because its the default one.

Step 5: Cleanup log files older than 5 days

During the update process, logs are produced under the folder C:\Users\Public\. So in this step, we do casual housekeeping.

Step 6: Write contents of the log file to Windows event log

Finally, the contents of the log files will be written in Windows Event Log under Application events.

Wrap up

So this it! Wrap it up to a PowerShell script, save it on the server in which the #WAC is hosted and create a Scheduled Task to execute the script on a daily basis! Make sure the user that will be used during the execution of the script, has the role of Gateway administrator.

Thanks for reading!