We’re currently experiencing a high volume of support requests, which may result in longer response times — thank you for your patience and understanding.
Community FAQ
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Alfredo
Engaged Sweeper II

I have two scripts, both of which do the same thing. The only difference is that one has more fields (RAM, Slots RAM Counts, etc.) and the other script doesn't.
The strange thing is that in the script that has the RAM, Slots RAM Counts, etc fields, I see fewer assets compared to the script that doesn't have the RAM, Slots RAM Counts, etc fields.
Can you help me with this, please?

The idea is I need to equalize the assets counts shown in the scripts.

I mean, the correct result is making the both codes shows me all the assets, in this case 601 total assets.
I can't get why both scripts give me different assets counts if only im adding more columns, in this case: RAM Total Capacity, RAM Slots, etc.

Script with RAM slots, resulting less assets count = 539 (bad asset count, it need to be 601)

Select Top 1000000 tblassets.Username,
  tblassets.AssetID,
  tblassets.AssetName,
  tblADusers.Company,
  tblassets.Lastseen,
  tsysOS.OSname,
  tblassets.Version,
  tblassets.Processor,
  tblProcessor.MaxClockSpeed,
  tblProcessor.NumberOfCores,
  Cast(tblProcessor.L2CacheSize / 1024 As numeric) As CacheL2MB,
  tblDiskdrives.Caption As Drive,
  Cast(tblDiskdrives.Freespace / 1024 / 1024 / 1024 As numeric) As FreeGB,
  Cast(tblDiskdrives.Size / 1024 / 1024 / 1024 As numeric) As TotalSizeGB,
  tblassets.Memory As RAM_MB,
  tblassets.IPAddress,
  tblassets.Mac,
  tblAssetCustom.Manufacturer,
  tblAssetCustom.Model,
  tblBaseBoard.Product,
  tblAssetCustom.Serialnumber,
  Ceiling(tblPhysicalMemoryArray.MaxCapacity / 1024) As MaxCapacity,
  CorrectMemory.Memory,
  Cast(CorrectMemory.Used As numeric) As [Slots  used],
  tblPhysicalMemoryArray.MemoryDevices As [Slots available],
  tblPhysicalMemoryArray.MemoryDevices - CorrectMemory.Used As [Slots free]
From tblassets
  Inner Join tblDiskdrives On tblassets.AssetID = tblDiskdrives.AssetID
  Inner Join tsysOS On tsysOS.OScode = tblassets.OScode
  Inner Join tblAssetCustom On tblassets.AssetID = tblAssetCustom.AssetID
  Inner Join tblProcessor On tblassets.AssetID = tblProcessor.AssetID
  Inner Join tblADusers On tblADusers.Username = tblassets.Username
  Inner Join tblBaseBoard On tblassets.AssetID = tblBaseBoard.AssetID
  Inner Join tblPhysicalMemoryArray On
      tblassets.AssetID = tblPhysicalMemoryArray.AssetID
  Inner Join (Select tblAssets.AssetID,
      Sum(Ceiling(tblPhysicalMemory.Capacity / 1024 / 1024)) As Memory,
      Count(tblPhysicalMemory.Win32_PhysicalMemoryid) As Used
    From tblAssets
      Left Outer Join (TsysMemorytypes
      Right Outer Join tblPhysicalMemory On TsysMemorytypes.Memorytype =
          tblPhysicalMemory.MemoryType) On tblAssets.AssetID =
          tblPhysicalMemory.AssetID
    Group By tblAssets.AssetID,
      tblPhysicalMemory.MemoryType
    Having tblPhysicalMemory.MemoryType <> 11) CorrectMemory On
      CorrectMemory.AssetID = tblassets.AssetID And
      Ceiling(tblPhysicalMemoryArray.MaxCapacity / 1024) > CorrectMemory.Memory
      And Ceiling(tblPhysicalMemoryArray.MaxCapacity / 1024) >
      CorrectMemory.Memory
Where tblPhysicalMemoryArray.[Use] = 3
Order By [Slots free] Desc,
  tblassets.AssetName

ram slots.png

Script without RAM slots, resulting more assets count = 601 (good result, but without RAM slot columns)

Select Top 1000000 tblassets.Username,
  tblassets.AssetID,
  tblassets.AssetName,
  tblADusers.Company,
  tblassets.Lastseen,
  tsysOS.OSname,
  tblassets.Version,
  tblassets.Processor,
  tblProcessor.MaxClockSpeed,
  tblProcessor.NumberOfCores,
  Cast(tblProcessor.L2CacheSize / 1024 As numeric) As CacheL2MB,
  tblDiskdrives.Caption As Drive,
  Cast(tblDiskdrives.Freespace / 1024 / 1024 / 1024 As numeric) As FreeGB,
  Cast(tblDiskdrives.Size / 1024 / 1024 / 1024 As numeric) As TotalSizeGB,
  tblassets.Memory As RAM_MB,
  tblassets.IPAddress,
  tblassets.Mac,
  tblAssetCustom.Manufacturer,
  tblAssetCustom.Model,
  tblBaseBoard.Product,
  tblAssetCustom.Serialnumber
From tblassets
  Inner Join tblDiskdrives On tblassets.AssetID = tblDiskdrives.AssetID
  Inner Join tsysOS On tsysOS.OScode = tblassets.OScode
  Inner Join tblAssetCustom On tblassets.AssetID = tblAssetCustom.AssetID
  Inner Join tblProcessor On tblassets.AssetID = tblProcessor.AssetID
  Inner Join tblADusers On tblADusers.Username = tblassets.Username
  Inner Join tblBaseBoard On tblassets.AssetID = tblBaseBoard.AssetID

no ram slots.png

hope someone can help me

cheers.

1 ACCEPTED SOLUTION
Mister_Nobody
Honored Sweeper III

You can change Inner to Left in this part:

  Inner Join tblPhysicalMemoryArray On
      tblassets.AssetID = tblPhysicalMemoryArray.AssetID
  Inner Join (Select tblAssets.AssetID,

  

View solution in original post

2 REPLIES 2
Alfredo
Engaged Sweeper II

many many thanks!

it works now! it show me a lot more assets (970!), but no matter, it correspond to multiple sessions on servers and other host. cleaning the excel export it correspond to close to the real inventory (500 assets aprox)

Mister_Nobody
Honored Sweeper III

You can change Inner to Left in this part:

  Inner Join tblPhysicalMemoryArray On
      tblassets.AssetID = tblPhysicalMemoryArray.AssetID
  Inner Join (Select tblAssets.AssetID,

  

Reports & Analytics

Ask about reports you're interested in and share reports you've created. Subscribe to receive daily updates of reports shared in the Community.

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now