With PowerShell defaulting to version 2 or 3 on Windows 7, 8, and 8.1, it’s becoming necessary to upgrade PowerShell to version 5.1 to take advantage of its latest features. However, the number of Microsoft updates a device needs to bring it up-to-date can make the process complex.
Fortunately, Christian Oaksford from Mytech Partners created an automation policy to handle this process. This is also a recent submittal from the 2019 North American Hackathon.
The policy is available at the following link: https://success.solarwindsmsp.com/kb/solarwinds_n-central/PowerShell-Upgrade-2-0-to-5-1
The policy makes the upgrade process very simple. With it you can deploy a custom service which will show a pass status if PowerShell is already up-to-date on the device. If it’s possible to upgrade PowerShell via the attached script, it will show a warning state—and if you must do the upgrade manually for any reason, it will show a failed state.
You can do the custom service with self-healing, which you can configure by opening the service and going to the self-healing tab.
The upgrade script, when run either manually or via a self-healing, will check for pre-requisites and download and upgrade .net if it’s required. It will then install the proper Microsoft update to do the PowerShell upgrade.
The upgrade script may require multiple executions due to the requirement for reboot with certain Microsoft updates. The custom service will show a progression through the various service items, what is needed and what the next step is.
If you’ve created an automation policy and would like to share it with the community, please feel free to email me at [email protected]
As always, don’t forget to look in the Automation Cookbook at www.solarwindsmsp.com/cookbook if you’re interested in other automation policies, script checks, and custom services.
Marc-Andre Tanguay is Head Automation Nerd. You can follow him on Twitter at @automation_nerd