‎09-06-2016 06:16 PM
Select Top 1000000 tblAssets.AssetName,
tblNtlogSource.Sourcename,
tblNtlog.Eventcode,
tblNtlog.TimeGenerated,
tblNtlogMessage.Message,
tblAssets.AssetID,
tblAssetCustom.Warrantydate,
Case
When tblNtlogMessage.Message Like '\Device\Harddisk0' Then (Select
tblFloppy.Model Where tblFloppy.Name = '\\.\PHYSICALDRIVE0')
When tblNtlogMessage.Message Like '\Device\Harddisk1' Then (Select
tblFloppy.Model Where tblFloppy.Name = '\\.\PHYSICALDRIVE1') Else 'Other'
End As DriveModel,
Case
When tblNtlogMessage.Message Like '\Device\Harddisk0' Then (Select
tblFloppy.InterfaceType Where tblFloppy.Name = '\\.\PHYSICALDRIVE0')
When tblNtlogMessage.Message Like '\Device\Harddisk1' Then (Select
tblFloppy.InterfaceType Where tblFloppy.Name = '\\.\PHYSICALDRIVE1')
Else 'Other' End As DriveInterface
From tblAssets
Inner Join tblNtlog On tblAssets.AssetID = tblNtlog.AssetID
Inner Join tblNtlogMessage On tblNtlogMessage.MessageID = tblNtlog.MessageID
Inner Join tblNtlogSource On tblNtlogSource.SourcenameID =
tblNtlog.SourcenameID
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblFloppy On tblAssets.AssetID = tblFloppy.AssetID
Where (tblNtlogSource.Sourcename = 'Disk' And tblNtlog.Eventcode = '7') Or
(tblNtlogSource.Sourcename = 'Disk' And tblNtlog.Eventcode = '55') Or
(tblNtlogSource.Sourcename = 'Disk' And tblNtlog.Eventcode = '11')
Order By tblNtlog.TimeGenerated Desc
‎09-09-2016 09:10 PM
‎09-13-2016 06:09 PM
DaRiddler324 wrote:
Is there a way to remove all of the duplicates under Asset Name and just go with the Last TimeGenerated? I'm not smart enough to figure it out
‎09-09-2016 09:33 AM
‎09-09-2016 07:48 AM
Select Top 1000000 t.AssetName,
t.Sourcename,
t.Eventcode,
Max(t.TimeGenerated) lasttimegenerated,
t.Message,
t.AssetID,
t.DriveInterface,
t.DriveModel
From (Select tblAssets.AssetName,
tblNtlogSource.Sourcename,
tblNtlog.Eventcode,
tblNtlog.TimeGenerated,
tblNtlogMessage.Message,
tblAssets.AssetID,
IsNull((Select tblFloppy.InterfaceType From tblFloppy
Where tblAssets.AssetID = tblFloppy.AssetID And
tblFloppy.Name Like '%PHYSICALDRIVE' + SubString(tblNtlogMessage.Message,
CharIndex('Harddisk', tblNtlogMessage.Message) + 8, 1) + '%'),
'Other') DriveInterface,
IsNull((Select tblFloppy.Model From tblFloppy
Where tblAssets.AssetID = tblFloppy.AssetID And
tblFloppy.Name Like '%PHYSICALDRIVE' + SubString(tblNtlogMessage.Message,
CharIndex('Harddisk', tblNtlogMessage.Message) + 8, 1) + '%'),
'Other') DriveModel
From tblAssets
Inner Join tblNtlog On tblAssets.AssetID = tblNtlog.AssetID
Inner Join tblNtlogMessage On tblNtlogMessage.MessageID = tblNtlog.MessageID
Inner Join tblNtlogSource On tblNtlogSource.SourcenameID =
tblNtlog.SourcenameID
Where tblNtlogSource.Sourcename = 'Disk' And (tblNtlog.Eventcode = '7' Or
tblNtlog.Eventcode = '55' Or tblNtlog.Eventcode = '11')) t
Group By t.AssetName,
t.Sourcename,
t.Eventcode,
t.Message,
t.AssetID,
t.DriveInterface,
t.DriveModel
Order By lasttimegenerated Desc
‎09-07-2016 05:42 AM
Select Distinct Top 10000000 tblAssets.AssetID,
tblAssets.AssetUnique,
tblNtlogSource.Sourcename,
tblNtlog.Eventcode,
tblNtlogMessage.Message,
tsysIPLocations.IPLocation,
Max(tblNtlog.TimeGenerated) lastTimeGenerated
From tblNtlog
Inner Join tblAssets On tblAssets.AssetID = tblNtlog.AssetID
Inner Join tblNtlogSource On tblNtlogSource.SourcenameID =
tblNtlog.SourcenameID
Inner Join tblNtlogMessage On tblNtlogMessage.MessageID = tblNtlog.MessageID
Left Join tsysIPLocations On tsysIPLocations.LocationID = tblAssets.LocationID
Where tblNtlogSource.Sourcename = 'disk' And tblNtlog.Eventcode = '7'
Group By tblAssets.AssetID,
tblAssets.AssetUnique,
tblNtlogSource.Sourcename,
tblNtlog.Eventcode,
tblNtlogMessage.Message,
tsysIPLocations.IPLocation
Order By lastTimeGenerated Desc
‎09-08-2016 10:01 PM
Mister Nobody wrote:
I use this simple report:Select Distinct Top 10000000 tblAssets.AssetID,
tblAssets.AssetUnique,
tblNtlogSource.Sourcename,
tblNtlog.Eventcode,
tblNtlogMessage.Message,
tsysIPLocations.IPLocation,
Max(tblNtlog.TimeGenerated) lastTimeGenerated
From tblNtlog
Inner Join tblAssets On tblAssets.AssetID = tblNtlog.AssetID
Inner Join tblNtlogSource On tblNtlogSource.SourcenameID =
tblNtlog.SourcenameID
Inner Join tblNtlogMessage On tblNtlogMessage.MessageID = tblNtlog.MessageID
Left Join tsysIPLocations On tsysIPLocations.LocationID = tblAssets.LocationID
Where tblNtlogSource.Sourcename = 'disk' And tblNtlog.Eventcode = '7'
Group By tblAssets.AssetID,
tblAssets.AssetUnique,
tblNtlogSource.Sourcename,
tblNtlog.Eventcode,
tblNtlogMessage.Message,
tsysIPLocations.IPLocation
Order By lastTimeGenerated Desc
In your report there is problem not all disks is enumerated. For example, we have disk Harddisk7.
‎09-07-2016 12:38 AM
‎09-13-2016 06:18 PM
fjca wrote:
ATAPI is for Optical Drives, CDROM, DVDs, etc.
They are not on the tblFloppy table, but on tbl.CDROMDrive.
‎09-06-2016 07:02 PM
Select Top 1000000 tblAssets.AssetName,
tblNtlogSource.Sourcename,
tblNtlog.Eventcode,
tblNtlog.TimeGenerated,
tblNtlogMessage.Message,
tblAssets.AssetID,
tblAssetCustom.Warrantydate,
Case
When tblNtlogMessage.Message Like '%Harddisk0%' Then (Select
tblFloppy.InterfaceType Where tblFloppy.Name Like '%PHYSICALDRIVE0%')
When tblNtlogMessage.Message Like '%Harddisk1%' Then (Select
tblFloppy.InterfaceType Where tblFloppy.Name Like '%PHYSICALDRIVE1%')
Else 'Other' End As DriveInterface,
Case
When tblNtlogMessage.Message Like '%\Harddisk0%' Then (Select
tblFloppy.Model Where tblFloppy.Name Like '%PHYSICALDRIVE0%')
When tblNtlogMessage.Message Like '%\Harddisk1%' Then (Select
tblFloppy.Model Where tblFloppy.Name Like '%PHYSICALDRIVE1%') Else 'Other'
End As DriveModel
From tblAssets
Inner Join tblNtlog On tblAssets.AssetID = tblNtlog.AssetID
Inner Join tblNtlogMessage On tblNtlogMessage.MessageID = tblNtlog.MessageID
Inner Join tblNtlogSource On tblNtlogSource.SourcenameID =
tblNtlog.SourcenameID
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblFloppy On tblAssets.AssetID = tblFloppy.AssetID
Where (tblNtlogSource.Sourcename = 'Disk' And tblNtlog.Eventcode = '7') Or
(tblNtlogSource.Sourcename = 'Disk' And tblNtlog.Eventcode = '55') Or
(tblNtlogSource.Sourcename = 'Disk' And tblNtlog.Eventcode = '11') Or
(tblNtlogSource.Sourcename = 'atapi' And tblNtlog.Eventcode = '7') Or
(tblNtlogSource.Sourcename = 'atapi' And tblNtlog.Eventcode = '55') Or
(tblNtlogSource.Sourcename = 'atapi' And tblNtlog.Eventcode = '11')
Order By tblNtlog.TimeGenerated Desc
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now