Friday, August 23, 2013

Updated Server Inventory Report

Updated the query:


SELECT DISTINCT
             v_R_System.Netbios_Name0 AS Name,v_RA_System_SMSAssignedSites.SMS_Assigned_Sites0 AS SCCM_Site,
             v_GS_WORKSTATION_STATUS.LastHWScan AS SCCM_Scan,
            MAX(REVERSE(LEFT(REVERSE(v_RA_System_SystemOUName.System_OU_Name0), CHARINDEX('/', REVERSE(v_RA_System_SystemOUName.System_OU_Name0)) - 1))) AS OU,
             v_R_System.description0 AS Description, v_GS_COMPUTER_SYSTEM.Manufacturer0 AS Make,
             v_GS_COMPUTER_SYSTEM.Model0 AS Model ,v_GS_PC_BIOS.SerialNumber0 AS Serial,
             v_GS_PROCESSOR.Name0 AS Processor,ISNULL(v_GS_PROCESSOR.NumberOfCores0,1) AS Cores,
             MAX(Right(v_GS_PROCESSOR.DeviceID0,1))+1 AS NumProcs,v_R_System.Operating_System_Name_and0 AS OS,
             v_GS_OPERATING_SYSTEM.CSDVersion0 AS SP,v_GS_X86_PC_MEMORY.TotalPhysicalMemory0 AS TotMemMB,
             v_GS_LOGICAL_DISK.DeviceID0 AS Drive ,v_GS_LOGICAL_DISK.Size0 AS TotalGB, v_GS_LOGICAL_DISK.FreeSpace0 AS FreeGB
FROM   v_R_System LEFT JOIN
              v_RA_System_SystemOUName ON v_R_System.ResourceID = v_RA_System_SystemOUName.ResourceID LEFT JOIN
              v_RA_System_SMSAssignedSites ON v_R_System.ResourceID = v_RA_System_SMSAssignedSites.ResourceID LEFT JOIN
              v_GS_WORKSTATION_STATUS ON v_R_System.ResourceID = v_GS_WORKSTATION_STATUS.ResourceID LEFT JOIN
              v_GS_LOGICAL_DISK ON v_R_System.ResourceID = v_GS_LOGICAL_DISK.ResourceID LEFT JOIN
              v_GS_COMPUTER_SYSTEM ON v_R_System.ResourceID = v_GS_COMPUTER_SYSTEM.ResourceID LEFT JOIN
              v_GS_OPERATING_SYSTEM ON v_R_System.ResourceID = v_GS_OPERATING_SYSTEM.ResourceID LEFT JOIN
              v_GS_PC_BIOS ON v_R_System.ResourceID = v_GS_PC_BIOS.ResourceID LEFT JOIN
              v_GS_X86_PC_MEMORY ON v_R_System.ResourceID = v_GS_X86_PC_MEMORY.ResourceID LEFT JOIN
              v_GS_PROCESSOR ON v_R_System.ResourceID = v_GS_PROCESSOR.ResourceID
Where (NOT (v_GS_LOGICAL_DISK.DriveType0 = '2')) AND (NOT (v_GS_LOGICAL_DISK.DriveType0 = '5'))
GROUP BY v_R_System.description0, v_R_System.Netbios_Name0, v_RA_System_SMSAssignedSites.SMS_Assigned_Sites0,
              v_GS_WORKSTATION_STATUS.LastHWScan,  v_GS_COMPUTER_SYSTEM.Manufacturer0, v_GS_COMPUTER_SYSTEM.Model0,
              v_GS_PC_BIOS.SerialNumber0, v_GS_PROCESSOR.Name0, v_GS_PROCESSOR.NumberOfCores0, v_GS_OPERATING_SYSTEM.CSDVersion0,
              v_GS_X86_PC_MEMORY.TotalPhysicalMemory0, v_GS_LOGICAL_DISK.DeviceID0, v_GS_LOGICAL_DISK.Size0,
              v_GS_LOGICAL_DISK.FreeSpace0, v_R_System.Operating_System_Name_and0
HAVING      (v_R_System.Operating_System_Name_and0 LIKE N'%server%')
ORDER BY Name

No comments:

Post a Comment