I've assigned the output of the ExecuteSQL verb in Powershell (using the Invoke-SwisVerb cmdlet) to a variable, but I can't figure out how to parse the results. It says it is in XML format but the only properties that the XML object has is diffgram, schema, and xmlns. None of which have the results of the SQL query in them. If I view the .InnerText of the object I see all of my results crammed together into one massive string. No property names, no separator that I can split on. Nothing... I've searched all over google and Thwack and the few examples of ExecuteSQL I've found have been people using it to perform Inserts or to perform a single count, meaning they weren't expecting to get back an object with a bunch of results.
The SQL query I'm running is this (which I wouldn't have to do if NCM just easily showed us this data by default):
SELECT
n.NodeCaption
,n.CoreNodeID
,ISNULL(n.NCM_Username, 'EMPTY') AS OldProperty
,CASE
WHEN np.ConnectionProfile = 0 THEN ngs.SettingValue
ELSE ncp.Username
END AS NewPropertyEncrypted
,np.ConnectionProfile
FROM NCM_Nodes n
JOIN NCM_NodeProperties np ON n.CoreNodeID = np.CoreNodeID
LEFT OUTER JOIN NCM_ConnectionProfiles ncp ON np.ConnectionProfile = ncp.ID
LEFT OUTER JOIN NCM_GlobalSettings ngs ON ngs.SettingName = 'GlobalUsername'
**NOTE: The query above won't work if you don't have a Node custom property called NCM_Username. Just remove the following line from the query so that it will run in your SQL DB:
,ISNULL(n.NCM_Username, 'EMPTY') AS OldProperty
I'm not good with XML, I'll admit, but I have parsed it several times in PowerShell before and always been able to access the properties and their values pretty easily. This time I'm stumped. What am I doing wrong tdanner?