Quantcast
Channel: PowerShell General
Viewing all articles
Browse latest Browse all 10624

How to use Powershell script to unmanage the multiple nodes

$
0
0

I am trying to use PowerShell script to unmanage the testweb5 and the testweb6 nodes in Solarwinds using for loop. I got something below but I am not sure of the syntax.

Please help ...

For ($i=5; $i-le6; $i++)

{String Syntax}

Also I am not sure if you heard of Solarwinds but this is what I did when I had to unmanage one node using PowerShell script. Please see below something similar but for multiple nodes shown above for testweb and testweb6

$ErrorActionPreference="SilentlyContinue"
Stop-Transcript | out-null
$ErrorActionPreference = "Continue"
Start-Transcript -path C:\UnmanageOutput.txt

#Add SwisSnapin to the current PowerShell runspace
Add-PSSnapin SwisSnapin

#Connect to Orion Server
$swis = Connect-Swis -Trusted -Hostname 'solarwinds.connectionsacademy.org'

#Get Node Info
$nodeid = Get-SwisData $swis "SELECT NodeID FROM Orion.Nodes WHERE SysName = 'testweb5.ca-schools.org'"
$nodeid = 871

#Unmanage Node
$now = [DateTime]::UtcNow
$later = $now.AddHours(1)
Invoke-SwisVerb $swis Orion.Nodes Unmanage @("N:$nodeid",$now,$later,"false")

Stop-Transcript

 

 

 

 


Viewing all articles
Browse latest Browse all 10624

Trending Articles