We've had a SQL job for a long time now that does this job. I'd like to do this instead via SWQL, and not sure how to write it. Here is the SQL job. It basically forces Caption to equal the FQDN stripped down to the Hostname:
Update NodesData
SET Caption = LEFT(DNS, CHARINDEX('.', DNS) - 1)
WHERE CHARINDEX('.', DNS) > 0
AND Caption <> LEFT(DNS, CHARINDEX('.', DNS) - 1)
I know how to modify the Caption via SWQL, just not sure about the WHERE clause, which doesn't seem to work in SWQL Studio as is. Maybe that SQL syntax cannot be used exactly as is, and needs some tweaking.
Any help will be greatly appreciated.