ahhhh not so good start, tested in SQL works now...
DECLARE @v1_TrusteeScope nvarchar(max)
SET @v1_TrusteeScope = N'%TrusteeScope%'
SELECT DISTINCT i.Guid,
i.Name [Computer Name],
i.Domain [Domain],
i.[User] [User ID],
vu.[Display Name],
case when ua.[Full Name] is NULL then ISNULL(i.[User],'') else ISNULL(ua.[Full Name],'') end [Full Name as displayed in windows start menu],
CAST (ISNULL (logical.[Total Disk Space]/ (1024),0) AS DECIMAL (15,0)) [Total Disk Space (GB)],
ISNULL (storage.[Number of Hard Drives],0) [Number of Hard Drives],
CAST (ISNULL (logical.FreeSpace /1024 ,0) AS Decimal (15,2)) [Free Disk Space (GB)],
CAST (ISNULL (primarydrive.[Free Space on Primary Drive] / (1024),0) AS DECIMAL (15,0)) [Free space on primary logical volume (GB)]
FROM dbo.vComputer i
JOIN dbo.Inv_Inventory_Results ir
ON ir._ResourceGuid = i.Guid
JOIN dbo.ScopeMembership sm
ON sm.[ResourceGuid] = i.Guid
AND sm.[ScopeCollectionGuid] IN (SELECT * FROM dbo.fnGetTrusteeScopeCollections (@v1_TrusteeScope))
LEFT JOIN (SELECT COUNT (1) [Number of Hard Drives], s._ResourceGuid FROM dbo.vHWStorage s
WHERE s.[Media Type] = 29 GROUP BY s._ResourceGuid) storage
ON storage._ResourceGuid = i.Guid
LEFT JOIN
(
--select summary info for logical disks based on hard drives
-- ET#1832291 Sagar Bhat 02-Dec-2010 Removed single quotes from defination of 'FreeSapce'
SELECT SUM ([Free Space (Bytes)] / (1024.0 * 1024.0)) FreeSpace, MAX ([Free Space (Bytes)] / (1024.0 * 1024.0)) [Max Free Space], SUM ([Size (Bytes)]/ (1024 * 1024)) [Total Disk Space] ,
_ResourceGuid [Guid] FROM vHWLogicalDisk WHERE [Logical Disk Type] = 3 GROUP BY _ResourceGuid
) logical ON i.Guid = logical.Guid
LEFT JOIN dbo.vOSOperatingSystem os
ON os._ResourceGuid = i.Guid
LEFT JOIN (SELECT DISTINCT ld.[Free Space (Bytes)] / (1024 * 1024) [Free Space on Primary Drive], ld._ResourceGuid FROM vHWLogicalDisk ld
LEFT JOIN dbo.vOSOperatingSystemWindows osw
ON ld.[Device ID] = SUBSTRING (osw.[Windows Directory], 1, 2)
AND ld._ResourceGuid = osw._ResourceGuid
LEFT JOIN dbo.vOSOperatingSystem os
ON os._ResourceGuid = ld._ResourceGuid
WHERE CASE WHEN osw._ResourceGuid IS NULL AND ld.[Device ID] = os.[Boot Device] THEN 1
WHEN ld.[Device ID] = SUBSTRING (osw.[Windows Directory], 1, 2) THEN 1
ELSE 0 END = 1) primarydrive
ON primarydrive._ResourceGuid = i.Guid
LEFT JOIN vUser vu on vu.Name = i.[User] and i.[User] != ''
left join Inv_UG_User_Account ua on ua._ResourceGuid = i.[Guid] and i.Domain+'\'+i.[User] = ua.[User Name]
WHERE LOWER (i.Name) LIKE LOWER ('%Computer Name%')
AND (('%Less than 'N' Free disk space on primary drive%' = '%') OR (primarydrive.[Free Space on Primary Drive] / (1.0) IS NULL) OR ('%Less than 'N' Free disk space on primary drive%' <> '%' AND primarydrive.[Free Space on Primary Drive] < CAST (REPLACE ('%Less than 'N' Free disk space on primary drive%','%','')AS FLOAT)))
AND (('%Total free disk space in MB or %%' = '%') OR ('%Total free disk space in MB or %%' <> '%' AND CAST (ISNULL (logical.FreeSpace,0) AS Decimal (15,3)) >= CAST (REPLACE ('%Total free disk space in MB or %%','%','') AS FLOAT)))
AND ('%More than 'N' Free Space in MB%' = '%' OR CAST (REPLACE ('%More than 'N' Free Space in MB%','%','') AS FLOAT) < CAST (ISNULL (logical.FreeSpace,0) AS Decimal (15,3))) -- ET#1832291 Sagar Bhat 02-Dec-2010 Changed table column from [Max Free Space] to FreeSapce