Hello Expert ,
i am trying to put the nodes in maintenance mode with the help of power shell , i want to take inputs (node name , from time , to time ) from user.
i have wrote below script for the same. i am always getting last server information , however for first and second i am not getting DB values (Uri)
function mutealert
{
Import-Module SwisPowerShell
#$creds = Get-Credential
$swis = Connect-Swis -Hostname 10.10.10.10 -Username username\username -Password Pass@1234
$hostname=$textBox.Text.Split("`n")
foreach($server in $hostname )
{
Write-Host "----------------- DB query-----------"
[String]$strQuery = "SELECT uri FROM Orion.Nodes WHERE SysName LIKE '" + "$server" + "%'"
Write-Host $strQuery
Write-Host "----------------- DB values-----------"
$uris = Get-SwisData $swis $strQuery
Write-Host $uris
}
}
output---
----------------- DB query-----------
SELECT uri FROM Orion.Nodes WHERE SysName LIKE 'Server-01%'
----------------- DB values-----------
----------------- DB query-----------
SELECT uri FROM Orion.Nodes WHERE SysName LIKE 'Server-02%'
----------------- DB values-----------
----------------- DB query-----------
SELECT uri FROM Orion.Nodes WHERE SysName LIKE 'Server-03%'
----------------- DB values-----------
swis://solarwinds.solarwind.com/Orion/Orion.Nodes/NodeID=170
can someone help me to sort out this issue.