So,
I have been working on several powershell scripts... Here is what i have.
#Author: John Johnson
#Last Modified: 3/8/22
#Summary: Set Node Custom Properties in SolarWinds
# Be sure to install the SwisPowershell module on Powershell 5 or lower prior to use
# Install-Module SwisPowershell
#Designate Hostname
$server = 'host'
$creds = Get-Credential
$swis = Connect-Swis -HostName $server -Credential $creds
#$nodes = Get-SwisData $swis 'SELECT NodeID, Caption, DNS, IPAddress, Uri FROM Orion.Nodes'
## Export data from SWQL and arrange it in Excel first
## CSV Import Approach
$updates = Import-Csv C:\Users\list.csv
foreach ($update in $updates)
{
Write-Host "Updating"$($update.IPAddress)"@$($update.Uri)
$properties = ''
$properties = $update.psobject.properties | where-object {($_.Name -ne "Uri") -and ($_.Name -ne "NodeID") -and ($_.Name -ne "IPAddress")}
$record = @{}
foreach ($property in $properties)
{
if (($($property.Value) -ne $null) -and ($($property.Value) -ne ''))
{
$record += @{$($property.Name)=$($property.Value)}
}
}
Set-SwisObject $swis -Uri $($update.Uri) -properties $record
}
i have a custom property 'NodesCustomProperties.ServiceNow_Owner_1'
how would i be able to use a serverlist.csv, to modify all servers in the list...and modify the custom property above?