Skip to content

Instantly share code, notes, and snippets.

@DarkAllien
Created July 19, 2018 12:17
Show Gist options
  • Select an option

  • Save DarkAllien/938686350243c90251ad001554a7b325 to your computer and use it in GitHub Desktop.

Select an option

Save DarkAllien/938686350243c90251ad001554a7b325 to your computer and use it in GitHub Desktop.
SELECT [amp].[Name] AS [Antimalware_Policy],
[collection].[CollectionName] AS [Deployed_To],
[amps].[PropertyName],
[col].[query]('.').value('.', 'nvarchar(max)') AS [Property]
FROM [vSMS_AntimalwareConfig] [amps]
RIGHT JOIN [vSMS_AntimalwareSettings] [amp] ON [amp].[ID] = [amps].[SettingsID]
LEFT JOIN [vSMS_AmPolicySummary] [collection] ON [amp].[ID] = [collection].[ClientSettingsID]
CROSS APPLY [XmlValue].[nodes]('/StringArrayXML/Value') AS [Tbl]([col])
WHERE [amps].[XmlValue].value('(/StringArrayXML//Value/node())[1]', 'nvarchar(max)') IS NOT NULL
AND [amps].[xmlvalue] IS NOT NULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment