Submit a ticketCall us

Training ClassThe Orion® Platform Instructor-led Classes

Provided by SolarWinds® Academy, these trainings will introduce users to the Orion Platform and its features, management, and navigation. These courses are suitable for users looking to discover new tips, tricks, and ways to adapt their Orion products to better suit their monitoring needs:
Deploying the Orion Platform
Configuring Orion views, maps, and accounts
Configuring Orion alerts and reports

Reserve your seat.

Home > Success Center > Patch Manager > Patch Manager Documentation > Install the updates with PowerShell scripts

Install the updates with PowerShell scripts

Last updated December 4, 2018

Microsoft Windows PowerShell is a command-line shell created for system administrators. PowerShell includes an interactive prompt and a scripting environment that can be used independently or in combination with other tools. PowerShell is built on top of the Microsoft .NET Framework Common Language Runtime (CLR) and the .NET Framework, and is included with .NET Framework 4.0.

Beginning in 2.1.6, you can create PowerShell scripts in Windows PowerShell Integrated Scripting Environment (ISE) or a text editor (such as Notepad) that execute as part of an Update Management task—both before and after the task completes. Using Update Management or the Update Management Wizard, you can push updates with PowerShell scripts to your managed systems that perform the following tasks:

  • Creating a VM snapshot prior to an update task
  • Reverting to a snapshot if an issue occurs
  • Stopping services in a specific order
  • Failing over machines
  • Muting alerts from Orion Platform nodes during update tasks

See the Microsoft Docs website for details about how to write and run scripts in the Windows PowerShell ISE.

Review and evaluate how Windows PowerShell scripts are incorporated in your environment. This includes importing scripts from third parties, including content posted by customers in the THWACK online community. To prevent unauthorized access to computers in your network, SolarWinds recommends using a dedicated Windows account with low-level privileges to create and review PowerShell scripts.

Push PowerShell scripts to managed systems using Update Management

Use this installation method to push PowerShell scripts with specific updates to your managed systems. 

  1. Create a new Windows PowerShell script and save the file in PS1 format.
  2. Log in to the Patch Manager Administrator Console as an administrator.
  3. In the navigation pane, select an installation method.

    To install the script with your software updates, expand Enterprise > Update Services > your_WSUS_server > Updates and select the updates in the center pane that you want to include with the script.

    SPM-Admin-Guide-Select-WSUS-Updates.png

    To install the script without your software updates, select one or more computers or computer groups in Microsoft Windows Network or Managed Computers that require the script.

    SPM-Admin-Guide-Select-Computer-Updates.png

  4. In the Actions pane, click Update Management.
  5. In the Pre-Update Management Reboot Options box, select the options you want to execute before the updates are installed on the managed computers.
    To run a PowerShell script before Patch Manager installs the updates:
    1. Select Run PowerShell Script.
      SPM-Admin-Guide-Pre-Update-Reboot-Options.png
    2. Click Load and select the targeted PowerShell script.
    3. Click Validate.
      Patch Manager checks and validates the script. If the script code is correct, Valid displays in the window. If the script code is not valid, Not Valid displays in the window.
    4. (Optional) Select the checkbox to continue the update procedure if the PowerShell script fails. 
    5. (Optional) Select any advanced options.
      SPM-Admin-Guide-Select-Advanced-Options.png
  6. In the Post-Update Management Reboot Options box, select the options you want to execute before the updates are installed on the managed computers.
    To run a PowerShell script after Patch Manager installs the updates:
    1. Select Run PowerShell Script.
      SPM-Admin-Guide-Post-Update Reboot-Options.png
    2. Click Load and select the targeted PowerShell script.
    3. Click Validate.
      Patch Manager checks and validates the script. If the script code is correct, Validate displays in the window. If the script code is not valid, Not Valid displays in the window.
    4. (Optional) Enter a message that displays on the managed computers after reboot. 
  7. Click OK.
  8. In the Task Options Wizard, locate and add the targeted computers, and click Next. 
  9. Complete the wizard to push the scripts and updates to the managed computers. 

Push PowerShell scripts to managed systems using the Update Management Wizard

Use this installation method when you want to push PowerShell scripts with a fixed list of updates based on specific criteria. For example, downloading and installing all needed and approved security and critical updates. 

  1. Create a new script using Windows PowerScript ISE and save the file in PS1 format.
  2. Log in to the Patch Manager Administrator Console as an administrator.
  3. In the navigation pane, select an installation method.
    To install the script with your software updates, expand Enterprise > Update Services > your_WSUS_server > Updates and select the updates in the center pane that you want to include with the script.
    SPM-Admin-Guide-Select-WSUS-Updates.png
    To install the script without your software updates, select one or more computers or computer groups in Microsoft Windows Network or Managed Computers that require the script.
    SPM-Admin-Guide-Select-Computer-Updates.png
  4. In the Actions pane, click Update Management Wizard.
  5. Select a fixed list of updates or a dynamic list of updates based on specific criteria, and click Next.
  6. Add a custom dynamic rule that includes updates based on selected criteria. Otherwise, accept the selected rules, and click Next. 
  7. Click Next.
  8. In the Pre-Update Management Reboot Options box, select the options you want to execute before the updates are installed on the managed computers.
    To run a PowerShell script before Patch Manager installs the updates:
    1. Select Run PowerShell Script.
      SPM-Admin-Guide-Pre-Update Reboot-Options-Wizard.png
    2. Click Load and select the targeted PowerShell script.
    3. Click Validate.
      Patch Manager checks and validates the script. If the script code is correct, Valid displays in the window. If the script code is not valid, Not Valid displays in the window.
    4. Select any additional options as required.
  9. In the Post-Update Management Reboot Options box, select the options you want to execute before the updates are installed on the managed computers.
    To run a PowerShell script after Patch Manager installs the updates:
    1. Select Run PowerShell Script.
      SPM-Admin-Guide-Pre-Update Reboot-Options-Wizard.png
    2. Click Load and select the targeted PowerShell script.
    3. Click Validate.
      Patch Manager checks and validates the script. If the script code is correct, Validate displays in the window. If the script code is not valid, Not Valid displays in the window.
    4. (Optional) Select the checkbox to perform additional actions if the updates are installed successfully.
  10. Select any additional approval or advanced options as required, and click Finish.
  11. Complete the wizard to push the scripts and updates to the managed computers.
Last modified

Tags

Classifications

Public