cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Anonymous
Not applicable
Hello,

I was wondering if it's possible to get the physical disk size of Windows computers. I need to feel a form automatically and I need this information, I can get for the volumes, or logical drives, but I need the harddisk size for this.

Thanks, wish a nice 2013 all!
Paulo
9 REPLIES 9
Anonymous
Not applicable
Thanks! Seems to work fine and solved my problem. Thank you very much for the great support.
Hemoco
Lansweeper Alumni
We cannot reproduce the error you're referring to, though we do get an error on tblCustom_PeacyComputerTypes, which we assume is a custom database table. (Note that we do not support adding tables or fields, as this can break Lansweeper functionality.)

For tblFloppy, the following expression should work:

Ceiling(tblFloppy.Size / 1024 / 1024 / 1024)


Anonymous
Not applicable
I have a lot of customization using the Custom fields, this is the working list (the output does not matter to me as I will fill a Word document with this information.

SELECT     TOP (1000000) dbo.tblcomputers.ComputerUnique, dbo.tblComputersystem.Computername, dbo.tblADusers.Description AS CostCenter, 
dbo.tblADusers.Department, dbo.tblADusers.Displayname, dbo.tblComputerSystemProduct.IdentifyingNumber AS SerialNumber, CONVERT(VarChar(10),
dbo.tblOperatingsystem.InstallDate, 105) AS InstalledDate, dbo.tblCompCustom.BarCode AS InventoryNumber, CONVERT(VarChar(10),
dbo.tblCompCustom.PurchaseDate, 105) AS PurchaseDate, dbo.tblCustom_PeacyComputerTypes.PeacyModel, CONVERT(VarChar(10),
dbo.tblCompCustom.Warrantydate, 105) AS WarrantyDate, dbo.tblCompCustom.OrderNumber, CONVERT(VarChar(10), DATEADD(year, 4,
dbo.tblCompCustom.PurchaseDate), 105) AS ReplacementDate, dbo.tblcomputers.Computer, dbo.web40CorrectMemory.Memory,
dbo.tblComputersystem.Manufacturer, dbo.tblFloppy.Size / 1024 / 1024 / 1024 AS DiskSize
FROM dbo.tblADusers INNER JOIN
dbo.tblCompCustom ON dbo.tblADusers.Username = dbo.tblCompCustom.Custom1 INNER JOIN
dbo.tblComputerSystemProduct ON dbo.tblCompCustom.Computername = dbo.tblComputerSystemProduct.Computername INNER JOIN
dbo.tblOperatingsystem ON dbo.tblCompCustom.Computername = dbo.tblOperatingsystem.Computername RIGHT OUTER JOIN
dbo.tblComputersystem ON dbo.tblCompCustom.Computername = dbo.tblComputersystem.Computername INNER JOIN
dbo.tblcomputers ON dbo.tblcomputers.Computername = dbo.tblCompCustom.Computername INNER JOIN
dbo.tblBIOS ON dbo.tblBIOS.Computername = dbo.tblOperatingsystem.Computername INNER JOIN
dbo.web40CorrectMemory ON dbo.tblcomputers.Computername = dbo.web40CorrectMemory.Computername INNER JOIN
dbo.tblFloppy ON dbo.tblcomputers.Computername = dbo.tblFloppy.Computername LEFT OUTER JOIN
dbo.tblCustom_PeacyComputerTypes ON dbo.tblComputersystem.Model = dbo.tblCustom_PeacyComputerTypes.Model
WHERE (dbo.tblComputersystem.Domainrole = '1') AND (dbo.tblFloppy.Name = N'\\.\PHYSICALDRIVE0')
Hemoco
Lansweeper Alumni
Could you post the complete SQL query you currently have.
Anonymous
Not applicable
Oh by the way I need it rounded to no decimals.
Anonymous
Not applicable
For that it does not crash but I get the error "invalid or missing expression". Strange... the field is numeric (18,0) so it would not need to be converted, right?
Anonymous
Not applicable
Thank you very much, how do I round it to GB? I've tried this but it crashes the SQL GUI:
CAST(ROUND((dbo.tblFloppy.Size / 1024 /1024 /1024), 0) AS FLOAT)
Hemoco
Lansweeper Alumni
BullGates wrote:
Thank you very much, how do I round it to GB? I've tried this but it crashes the SQL GUI:
CAST(ROUND((dbo.tblFloppy.Size / 1024 /1024 /1024), 0) AS FLOAT)


try (untested)
Cast(Cast(tblFloppy.Size As bigint) / 1024 / 1024 As numeric) As [Total size]

Hemoco
Lansweeper Alumni
Take a look at table tblfloppy

PS: happy new year