Skip to content

Instantly share code, notes, and snippets.

@stphnwlkr
Created May 6, 2017 18:43
Show Gist options
  • Save stphnwlkr/c74668aee589e379ac0e70712d3e5b42 to your computer and use it in GitHub Desktop.
Save stphnwlkr/c74668aee589e379ac0e70712d3e5b42 to your computer and use it in GitHub Desktop.
remote any function getAllServerInfoJSON() returnformat="JSON"    {
s = queryExecute("SELECT ResourceID, Name0 AS ServerName, operatingSystem0 AS OperatingSystem, CASE WHEN Is_Virtual_Machine0 = 1 THEN 'Virtual' ELSE 'Physical' END as isvm, Resource_Domain_OR_Workgr0 AS Domain,
(SELECT        ROUND((TotalPhysicalMemory0 / 1024.0) / 1024.0, 0) AS t
FROM            SCCM_Ext.vex_GS_X86_PC_MEMORY
WHERE        (ResourceID = v_R_System.ResourceID)) AS memory,
(SELECT        COUNT(*) AS pq
FROM            SCCM_Ext.vex_GS_PROCESSOR
WHERE        (ResourceID = v_R_System.ResourceID)) AS CPU
FROM            v_R_System
WHERE        (Is_Virtual_Machine0 IS NOT NULL)",{},{datasource='hyperv'});
return query2array(s);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment