‎08-19-2015 06:00 PM
‎08-25-2015 10:54 AM
Select Top 1000000 tblAssetCustom.AssetID,
tblAssets.AssetUnique,
tblAssetCustom.Manufacturer As Vendor,
tblAssetCustom.Model,
tblAssets.IPAddress,
tsysOS.OSname,
tblAssets.Memory,
Case When tblAssetCustom.Model Like '%virtual%' Then 'virtual' Else 'physical'
End As VirtualCheck,
VMWare.Hostname As [VMware Host],
HyperV.Hostname As [HyperV Host],
Convert(Decimal(7,2),tblAssets.Uptime / 60 / 60 / 24) As UptimeDays,
DateDiff(m, tblAssets.Firstseen, tblAssets.Lastseen) As MonPeriod,
tuptime.LastUp,
tuptime.UpDays
From tblAssetCustom
Inner Join tblAssets On tblAssetCustom.AssetID = tblAssets.AssetID
Inner Join tsysOS On tblAssets.OScode = tsysOS.OScode
Left Join (Select tblUptime.AssetId,
Max(tblUptime.EventTime) As LastUp,
DateDiff(dd, Max(tblUptime.EventTime), GetDate()) As UpDays
From tblUptime
Where tblUptime.EventType In (1, 4)
Group By tblUptime.AssetId) tuptime On tblAssets.AssetID = tuptime.AssetId
Inner Join tblOperatingsystem
On tblAssets.AssetID = tblOperatingsystem.AssetID
Left Join tsysIPLocations On tblAssets.IPNumeric >= tsysIPLocations.StartIP
And tblAssets.IPNumeric <= tsysIPLocations.EndIP
Left Join (Select Top 1000000 tblAssetMacAddress.AssetID,
tblAssets1.AssetName As Hostname
From tblAssetMacAddress
Left Join tblVmwareGuestNetwork On tblVmwareGuestNetwork.MacAddress =
tblAssetMacAddress.Mac
Left Join tblVmwareGuest On tblVmwareGuest.GuestID =
tblVmwareGuestNetwork.GuestID
Left Join tblAssets tblAssets1 On tblAssets1.AssetID =
tblVmwareGuest.AssetID
Where tblAssets1.AssetName Is Not Null) VMWare On VMWare.AssetID =
tblAssets.AssetID
Left Join (Select Top 1000000 tblAssetMacAddress.AssetID,
tblAssets1.AssetName As Hostname
From tblAssetMacAddress
Left Join TblHyperVGuestNetwork On TblHyperVGuestNetwork.MacAddress =
tblAssetMacAddress.Mac
Left Join tblHyperVGuest On tblHyperVGuest.hypervguestID =
TblHyperVGuestNetwork.HyperVGuestID
Left Join tblAssets tblAssets1 On tblAssets1.AssetID =
tblHyperVGuest.AssetID
Where tblAssets1.AssetName Is Not Null) HyperV On HyperV.AssetID =
tblAssets.AssetID
Left Join tblComputersystem On tblAssets.AssetID = tblComputersystem.AssetID
Where tblAssetCustom.State = 1 And tblComputersystem.Domainrole > 1
‎09-17-2015 04:02 PM
‎09-16-2015 09:05 PM
‎09-16-2015 09:01 PM
‎08-25-2015 10:54 AM
Select Top 1000000 tblAssetCustom.AssetID,
tblAssets.AssetUnique,
tblAssetCustom.Manufacturer As Vendor,
tblAssetCustom.Model,
tblAssets.IPAddress,
tsysOS.OSname,
tblAssets.Memory,
Case When tblAssetCustom.Model Like '%virtual%' Then 'virtual' Else 'physical'
End As VirtualCheck,
VMWare.Hostname As [VMware Host],
HyperV.Hostname As [HyperV Host],
Convert(Decimal(7,2),tblAssets.Uptime / 60 / 60 / 24) As UptimeDays,
DateDiff(m, tblAssets.Firstseen, tblAssets.Lastseen) As MonPeriod,
tuptime.LastUp,
tuptime.UpDays
From tblAssetCustom
Inner Join tblAssets On tblAssetCustom.AssetID = tblAssets.AssetID
Inner Join tsysOS On tblAssets.OScode = tsysOS.OScode
Left Join (Select tblUptime.AssetId,
Max(tblUptime.EventTime) As LastUp,
DateDiff(dd, Max(tblUptime.EventTime), GetDate()) As UpDays
From tblUptime
Where tblUptime.EventType In (1, 4)
Group By tblUptime.AssetId) tuptime On tblAssets.AssetID = tuptime.AssetId
Inner Join tblOperatingsystem
On tblAssets.AssetID = tblOperatingsystem.AssetID
Left Join tsysIPLocations On tblAssets.IPNumeric >= tsysIPLocations.StartIP
And tblAssets.IPNumeric <= tsysIPLocations.EndIP
Left Join (Select Top 1000000 tblAssetMacAddress.AssetID,
tblAssets1.AssetName As Hostname
From tblAssetMacAddress
Left Join tblVmwareGuestNetwork On tblVmwareGuestNetwork.MacAddress =
tblAssetMacAddress.Mac
Left Join tblVmwareGuest On tblVmwareGuest.GuestID =
tblVmwareGuestNetwork.GuestID
Left Join tblAssets tblAssets1 On tblAssets1.AssetID =
tblVmwareGuest.AssetID
Where tblAssets1.AssetName Is Not Null) VMWare On VMWare.AssetID =
tblAssets.AssetID
Left Join (Select Top 1000000 tblAssetMacAddress.AssetID,
tblAssets1.AssetName As Hostname
From tblAssetMacAddress
Left Join TblHyperVGuestNetwork On TblHyperVGuestNetwork.MacAddress =
tblAssetMacAddress.Mac
Left Join tblHyperVGuest On tblHyperVGuest.hypervguestID =
TblHyperVGuestNetwork.HyperVGuestID
Left Join tblAssets tblAssets1 On tblAssets1.AssetID =
tblHyperVGuest.AssetID
Where tblAssets1.AssetName Is Not Null) HyperV On HyperV.AssetID =
tblAssets.AssetID
Left Join tblComputersystem On tblAssets.AssetID = tblComputersystem.AssetID
Where tblAssetCustom.State = 1 And tblComputersystem.Domainrole > 1
‎08-21-2015 08:29 PM
‎08-21-2015 04:25 PM
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now