I just thought i would post my code for this situation i ran into. We have around 800+ Citrix VMs in solarwinds set statically(no, i dont know why. before my time). The subnet for the CItrix servers were changed over the weekend. So Monday morning all 800+ VMs are red, not available in solarwinds. Someone had been tasked with clicking the "Dynamic IP" check box on them all. What a nightmare. So, I wrote this script for them. We also found that for some reason the DNS property of a lot of the servers was not set, which is required if you check that Dynamic IP box.A helpful site for finding properties that you can pull or modify are here:SolarWinds Information Service v3.0 Schema Documentation
Here is what i did:
#Allow access to Solarwinds PowerShell cmdlets
#Put your Solarwinds server name here.
$SWserver = "<solarwinds server here>"
#Make a connection to the solarwinds server
$swis = Connect-Swis -host $SWserver -Trusted
#grab all the VMs from a text file - this can be done a few ways to get the list of servers. for my purposes this was the fastest
$nodes = get-content "C:\temp\CtxIPFix.txt"
#Loop through the list of servers
foreach($node in $nodes)
#Check to see if the Dynamic IP checkbox is unchecked
$broke = Get-SwisData $swis "SELECT DynamicIP FROM Orion.Nodes WHERE DisplayName LIKE '$node'"
#If it is unchecked - do the things
if ($broke -like "False")
#tell me what its doing
$fqdn = "$node.domain.com"
Write-Host "Fixing $fqdn"
#Create a properties Variable with the changes i want to make. Set the DNS to the FQDN of the server and check the box for Dynamic IP
#Grab the NodeID - virtually all commands in solarwinds use the node id for everything
$nodeid = Get-SwisData $swis "SELECT NodeID FROM Orion.Nodes WHERE DisplayName LIKE '$node'"
#create a variable with the connection string for the node
$uri = "swis://netmon.fairwaymc.com/Orion/Orion.Nodes/NodeID=$($nodeId)"
#apply the changes to the node
Set-SwisObject $swis -Uri $uri -Properties $customProps
#reset my $broke variable
$broke = ""
# If the checkbox IS checked, skip that node and tell me you did so.
Write-Host "Skipping $node"
$broke = ""