Month: August 2020

Hostname History

This query will display computers who host names changes. SelectCS.Name0,HCS.Name0,HCS.TimeStampfromdbo.v_GS_COMPUTER_SYSTEM CSjoin dbo.v_HS_COMPUTER_SYSTEM HCS on Cs.ResourceID = HCS.ResourceIDWhereCS.Name0 <> HCS.Name0

Find computers with no active users.

This query will find all computers in SCCM that have had not user logon within the last 30 days. declare @Now as datetimeset @Now = getdate() ;with MINLCU as(SelectSCU.ResourceID as ‘ResourceID’,min(SCU.LastConsoleUse0) as ‘LastConsoleUse0’Fromdbo.v_GS_SYSTEM_CONSOLE_USER SCUGroup bySCU.ResourceID) selectRV.Netbios_Name0,SCU.SystemConsoleUser0,SCU.LastConsoleUse0,SCU.NumberOfConsoleLogons0fromdbo.v_R_System_Valid RVJoin dbo.v_GS_SYSTEM_CONSOLE_USER SCU on RV.ResourceID = SCU.ResourceIDjoin MINLCU on RV.ResourceID = MINLCU.ResourceIDWheredatediff(dd,MINLCU.LastConsoleUse0, @Now) >30order byRV.Netbios_Name0,SCU.LastConsoleUse0 DESC