Hi everyone,
I already added the device as ICMP via Network Sonar Wizard. Unfortunately, the hostname is the same with the IP Address. How can I change multiple device hostnames?
To do it via powershell use this OrionSDK/Samples/PowerShell/Update.Captions.ps1 at master · solarwinds/OrionSDK · GitHub
Also see this for doing it using SQL (+) Bulk Node Name/Caption Change - Forum - Network Performance Monitor (NPM) - THWACK (solarwinds.com)
You could use a custom property or you can load a CSV.
# Build Connection to SWIS - SolarWinds Platform$SwisHost = # Connection to host $swisConnection = Connect-Swis -Hostname $SwisHost -Certificate # The actual SWIS query $Query = "SELECT N.Caption, N.CustomProperties._Nickname AS NickName, N.IP_Address, N.Uri FROM Orion.Nodes N WHERE N.Caption != N.CustomProperties._Nickname;" # <> N.CustomProperties._NicknameNS $nodes = Get-SwisData -SwisConnection $swisConnection -Query $query$nodes |Foreach-Object {Write-Output "Renaming node $($_.IP_Address), $($_.Caption) to $($_.NickName)"if($($_.NickName) -like 'NotAvailable') {Set-SwisObject -SwisConnection $swisConnection -Uri $_.URI -Properties @{ Caption=$($_.IP_Address) }}# uncomment the lines below if you're seeing the output you expect above# else {# Set-SwisObject -SwisConnection $swisConnection -Uri $_.URI -Properties @{ Caption=$($_.NickName) }}}
OR
# Build Connection to SWIS - SolarWinds Platform$SwisHost = # $SwisCreds = Get-Credential -Message "Enter the username/password for '$SwisHost'"#$SwisConnection = Connect-Swis -Hostname $SwisHost -Credential $SwisCreds$SwisConnection = Connect-Swis -Hostname $SwisHost -Username -Password Write-Host "Reading data from E:\WIP\inventory.csv"$csv = Import-Csv "E:\WIP\inventory.csv" -Delimiter ';'$csv | ForEach-Object {$Caption = $_.Nickname$IP_Address = $_.IPAddress$query = "SELECT Nodes.Caption, Nodes.URI FROM Orion.Nodes Where IPAddress Like '$IP_Address'"$nodes = Get-SwisData -SwisConnection $swisConnection -Query $queryforeach ($node in $nodes) {$newName = $Caption# skip over this node if it already has the right nameif ($node.Caption -ceq $newName) {continue}Write-Output "Renaming node $IP_Address, $($node.Caption) to $newName"# uncomment the line below if you're seeing the output you expect above# Set-SwisObject -SwisConnection $swisConnection -Uri $node.URI -Properties @{ "Caption" = $newName }}}
Thank you so much
i make this on Database using this query
UPDATE nodesdata SET Caption = 'NODE NAME' WHERE IP_Address = '172.60.4.226';
Thank you Giovana. But i am looking for bulk update.
With ICMP only, we are limited in discovering what the name of the device is, unlike SNMP/WMI/Agent, where we can ask each node for there hostname/system name. ICMP by default will attempt to use reverse DNS to populate a name, if it does not have a DNS entry, then the IP Address will be used.So the options are (no particular order):1) Leverage a spreadsheet with the names and use the API as outlined by @ldelt
2) Create a reverse DNS entry for each node.3) Manually update each node in SolarWinds with a name.