Hi,
I'm new at scripting for Solarwinds. I followed the script example Remove Domain and Capitalize Node Captions and modified for my needs. The script (below) works for a single node but doesn't for a bulk change. It is writing what it will be renaming and nothing happen.
I don't know what could be wrong.
Any help would be appreciated.
******************************************
$credential = Get-Credential
$swis = Connect-Swis -Hostname localhost -Cred $credential
$query = "
Select
caption, URI
From Orion.Nodes
Where Caption Like 'T5040PD-xxx.xx.%'
"
$result = Get-SwisData -SwisConnection $swis -Query $query
foreach ($node in $result) {
$newname = $node.Caption -replace "xxx.xx.",""
Write-Output " Renaming nodes $($node.Caption) to $newname " }
Set-SwisObject -SwisConnection $swis -Uri $node.URI -Properties @{ Caption = $newname }