Skip to content

Instantly share code, notes, and snippets.

@tstolswo
Created November 30, 2018 00:28
Show Gist options
  • Save tstolswo/c74f435e923e2e7bdb475c5ecdff552f to your computer and use it in GitHub Desktop.
Save tstolswo/c74f435e923e2e7bdb475c5ecdff552f to your computer and use it in GitHub Desktop.
SQL Query for the ConfigMgr Database which provides a summary of servers built in the last 31 days.
SELECT Distinct
GSSYS.Domain0 as 'Domain Name',
SYS.Name0 as 'Machine Name',
OS.Caption0 as 'OS',
OS.Description0 as 'Description',
GSSYS.SystemRole0 as 'Role',
OS.InstallDate0 as 'OS Install Date',
OS.TotalVisibleMemorySize0 as 'Allocated Memory',
CS.NumberOfProcessors0 as 'Allocated CPU'
FROM
v_R_System as SYS inner join v_GS_COMPUTER_SYSTEM as CS on CS.ResourceID = SYS.ResourceID
inner join v_GS_OPERATING_SYSTEM as OS on OS.ResourceID = SYS.ResourceID
inner join v_GS_SYSTEM as GSSYS on GSSYS.ResourceID = SYS.ResourceID
WHERE
DATEDIFF(day,OS.InstallDate0,getdate()) < 31
and
GSSYS.SystemRole0 = 'Server'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment