Hi,
I'm trying to create a PowerShell script to update the enable secret on my nodes. I can't use an NCM Profile as the enable secret will be different for each node.
Below is the script I'm trying to run (with a little help from ChatGPT).
After some further digging I know I need to update the EntityType from Orion.Nodes to NCM.Nodes, but the key issue remains.
I'm probably missing something glaringly obvious - but I just don't see it. Any pointers, please?
# Load the SolarWinds SDK module
Import-Module SwisPowerShell
# Connect to SolarWinds server
$hostname = '<hostname>'
$username = '<username>'
$password = '<password>'
$swis = Connect-Swis -Hostname $hostname -Username $username -Password $password
# Define the IP address of the switch
$ipAddress = '10.41.0.8' # Replace with the actual IP address
# Retrieve node information using IP address
$query = "SELECT NodeID, Caption FROM Orion.Nodes WHERE IPAddress = '$ipAddress'"
$node = Get-SwisData -SwisConnection $swis -Query $query
# Check if node is found
if ($node) {
# Update node properties
Set-SwisObject -SwisConnection $swis -EntityType "Orion.Nodes" -Uri "/Orion/Nodes/NodeID=$($node.NodeID)" -Properties @{
Username = '<username>'
Password = '<password>'
EnablePassword = '<enablepassword'
}
# Confirm update
Write-Output "Settings updated for switch $($node.Caption)"
} else {
Write-Output "No switch found with IP address $ipAddress"
}