Description
The attached Powershell script will unmanage/remanage/suppress/resume alerts for either a single node or for all members of a Solarwinds group, regardless of the kind of objects the group contains (Nodes, Applications, Transaction, etc.). If the group includes sub-groups, the script will recursively handle them. Credentials can be provided on the command line or in a credentials file created with Export-Clixml. The credentials file is useful if you plan to use this script with the Windows Task Scheduler and you don't want to include a username and password on the command line.
Changes
This script has been substantially revised from its previous version. Changes include:
- Script supports suppress/reset (aka mute/unmute) of alerts in addition to unmanage/remanage.
- Script can be run against a single node or against a group
Run from Windows Task Scheduler
To run this script from the Windows task scheduler without including the username and password on the command line follow the steps below:
- Log in to the Task Scheduler server as the user under whose name the task will run.
- Start the Powershell IDE and execute the command below to create the encrypted credentials file:
Get-Credential | Export-Clixml -Path [full path to file] - Start the Task Scheduler and create a task to run the script. Open the properties.
- In the "Actions" tab, make sure that the script is configured to use the -credstore argument with the full path to the credentials file from step 2.
- In the "General" tab, configure the task to run as the user you logged in as in step 1.
- Save the task.
Syntax
set_solarwinds_unmanged.ps1 -server servername [(-group groupname) | (-hostname nodename)] [(-username username -password password])|(-credstore credential_store)] [-unmanage | -suppress] [-minutes minutes]
Command line parameters
-server (Required): The name or IP address of the Solarwinds server.
-username (Optional): The name of a Solarwinds user that can unmanage and remanage
objects. If -username is specified, -password must also be specified. If -username
and -password are omitted, -credstore MUST be used.
-password (Optional): The password of a Solarwinds user that can unmanage and remanage
objects. If -password is specified, -username must also be specified. If -username
and -password are omitted, -credstore MUST be used.
-credstore (Optional): The path to a file containing the encrypted credentials of a
Solarwinds user that can unmanage and remanage objects. The encrypted file must be
created by the user on the server that will run the script, using the Powershell
command:
Get-Credential | Export-Clixml -Path [full path to file]
If -username is specified, -password must also be specified. If -credstore
is omitted, -username and -password MUST be used.
-group (Optional): The name of the Solarwinds group whose members are to be unmanaged,
remanaged, suppressed or resumed.
-hostname (Optional): The name of the Solarwinds node to be unmanaged,
remanaged, suppressed or resumed.
-unmanage (Optional): If the -unmanage flag is present, the script will attempt to
unmanage the node or all group members. If the -minutes flag is present, the script will
unmanage the group/node for the specified number of minutes. Included for backward compatibility.
-remanage (Optional): If the -remanage flag is present, the script will attempt to
remanage the node or all group members. Included for backward compatibility.
-suppress (Optional): If the -suppress flag is present, the script will attempt to
suppress alerts for the node or for all group members.
If the -minutes flag is present, the script will suppress alerts
for the specified number of minutes. Included for backward compatibility.
-resume (Optional): If the -resume flag is present, the script will attempt to
resume alerts for the node or all group members. Included for backward compatibility.
-minutes (Optional, default=60): An integer representing the number of minutes that the group should
be unmanaged. The unmanged period starts when the script runs. -minutes is ignored if -resume or
-remanage is specified.
-action (Optional): Replaces -unmanage, -remanage, -suppress, -resume. Must be one of the following:
unmanage, remanage, suppress, resume. The named -action replaces the flag of the same name.
Examples
Example 1
Supply username and password on the command line, unmanage the group "Prd_Servers" for 1/2 hour
set_solarwinds_unmanaged.ps1 -server solarwinds.domain.com -group Prd_Servers -action unmanage -minutes 30 -username Me -password S3cr3t
Example 2
Supply username and password in a credential file, unmanage the group "Prd_Servers" for 1 hour (the default)
set_solarwinds_unmanaged.ps1 -server solarwinds.domain.com -group Prd_Servers -action unmanage -credstore C:\Users\Me\credstore.xml
Example 3
Remanage the group "Prd_Servers"
set_solarwinds_unmanaged.ps1 -server solarwinds.domain.com -group Prd_Servers -username Me -password S3cr3t -action unmanage
Example 4
Remanage the group "Prd_Servers"
set_solarwinds_unmanaged.ps1 -server solarwinds.domain.com -group Prd_Servers -username Me -password S3cr3t -action remanage