Hello Thwackies,
So I am reaching out to ask what would be the best way to script an update to a Nodes custom properties based on a predetermined value set in the 'City' field. So we have a list of known Cities and the associated Address and site POC email. What I would like to see is when the City field is populated, 'Already done by other means', then the script would fill in the custom properties. We have a list of about 15 cities and a corresponding Address and email, so my initial thought was to have this bit of the script repeated for each city. And I also wonder if doing this directly in SQL would be best. This script should be set to run at least twice in a 24 hour period. What I have so far is this:
# prepare a custom property value
$customProps = @{
Address="123 Street London, England"
SiteEmail="someguy@someplace.net"
}
# set the custom property
$uris = Get-SwisData $swis "SELECT CP.Uri, CP.City
FROM Orion.Nodes AS N
LEFT JOIN Orion.NodesCustomProperties AS CP ON N.NodeID = CP.NodeID
WHERE Vendor NOT LIKE 'Sierra%' AND City = 'London'"
$uris | Set-SwisObject $swis -Properties $customProps
I've searched the forums and found bit and pieces to bring me this far, but I would love to hear any suggestions to make this better. Thanks in advance.
V/R, J Dixon