none
Collection query for machines with less than 3gb disk space does not work RRS feed

  • Question

  • Hi,

    I have created a collection query to find the machines with less than 3gbs of disk space but when it updates, almost all my servers are in this collection.  Could someone tell me what's wrong with it?

    select SMS_R_SYSTEM.ResourceID,SMS_R_SYSTEM.ResourceType,SMS_R_SYSTEM.Name,SMS_R_SYSTEM.SMSUniqueIdentifier,SMS_R_SYSTEM.ResourceDomainORWorkgroup,SMS_R_SYSTEM.Client from SMS_R_System inner join SMS_G_System_LOGICAL_DISK on SMS_G_System_LOGICAL_DISK.ResourceID = SMS_R_System.ResourceId where SMS_G_System_LOGICAL_DISK.DeviceID = "C:" and SMS_G_System_LOGICAL_DISK.FreeSpace <= 3072

    Monday, February 11, 2019 8:19 PM

All replies

  • Remember that Freespace is no longer in MB it is in GB. 


    Garth Jones

    Blog: https://www.enhansoft.com/blog Old Blog: https://sccmug.ca/

    Twitter: @GarthMJ Book: System Center Configuration Manager Reporting Unleashed

    Monday, February 11, 2019 8:32 PM
    Moderator
  • I believe the disk space values are actually in "bytes."

    From my laptop, here is an example of a 256 GB disk with 160 GB free space.

    instance of Win32_LogicalDisk
    {
        Access = 0;
        Caption = "C:";
        Compressed = FALSE;
        CreationClassName = "Win32_LogicalDisk";
        Description = "Local Fixed Disk";
        DeviceID = "C:";
        DriveType = 3;
        FileSystem = "NTFS";
        FreeSpace = "160113053696";
        MaximumComponentLength = 255;
        MediaType = 12;
        Name = "C:";
        Size = "255465615360";
        SupportsDiskQuotas = FALSE;
        SupportsFileBasedCompression = TRUE;
        SystemCreationClassName = "Win32_ComputerSystem";
        SystemName = "S9";
        VolumeName = "";
        VolumeSerialNumber = "FFFF9DDD";
    };

    Tuesday, February 12, 2019 12:14 AM
  • except that cmcb doesn't use win32_LogicalDisk it uses SMS_LogicalDisk. ;-)

    Garth Jones

    Blog: https://www.enhansoft.com/blog Old Blog: https://sccmug.ca/

    Twitter: @GarthMJ Book: System Center Configuration Manager Reporting Unleashed

    Tuesday, February 12, 2019 1:02 AM
    Moderator
  • Which Current Branch are you running? on the Management Point check the MP_Hinv.log.

    i am going to assume that your hardware inventory has been enabled and the correct classes for Disk Space have been enabled.

     

    Tuesday, February 12, 2019 2:30 AM
  • SMS_LogicalDisk is just a wrapper to Win32_LogicalDisk. The wrapper simply excludes network-mapped drives.

    On my desktop, here is a 500 GB disk with 259 GB free space:

    instance of SMS_LogicalDisk
    {
        Access = 0;
        Availability = NULL;
        BlockSize = NULL;
        Caption = "C:";
        Compressed = FALSE;
        ConfigManagerErrorCode = NULL;
        ConfigManagerUserConfig = NULL;
        CreationClassName = "SMS_LogicalDisk";
        Description = "Local Fixed Disk";
        DeviceID = "C:";
        DriveType = 3;
        ErrorCleared = NULL;
        ErrorDescription = NULL;
        ErrorMethodology = NULL;
        FileSystem = "NTFS";
        FreeSpace = "259058421760";
        InstallDate = NULL;
        LastErrorCode = NULL;
        MaximumComponentLength = 255;
        MediaType = 12;
        Name = "C:";
        NumberOfBlocks = NULL;
        PNPDeviceID = NULL;
        PowerManagementCapabilities = NULL;
        PowerManagementSupported = NULL;
        ProviderName = NULL;
        Purpose = NULL;
        Size = "499513290752";
        Status = NULL;
        StatusInfo = NULL;
        SupportsFileBasedCompression = TRUE;
        SystemName = "DELLN11";
        VolumeName = "";
        VolumeSerialNumber = "11111B33";
    };

    Tuesday, February 12, 2019 2:59 AM
  • true but if you look at the mof edit, it has been changed to mb from kb. so i should have said above from kb to mb. 


        [ SMS_Report (TRUE), SMS_Units ("Megabytes") ]
        UInt64     FreeSpace;


    Garth Jones

    Blog: https://www.enhansoft.com/blog Old Blog: https://sccmug.ca/

    Twitter: @GarthMJ Book: System Center Configuration Manager Reporting Unleashed

    Tuesday, February 12, 2019 3:15 AM
    Moderator
  • Garth, you are right. I did not look at the units qualifier.

    Tuesday, February 12, 2019 3:26 AM
  • Hello,
     
    Well, actually, if we check/edit this query via UI rather than WQL, it clearly states that the unit of Free Space is MB.
     

     
    This query itself does not seem to have any problems. I modify it slightly to show the Free Space in the results.
     
    select SMS_R_System.ResourceId, SMS_R_System.ResourceType, SMS_R_System.Name, SMS_R_System.SMSUniqueIdentifier, SMS_R_System.ResourceDomainORWorkgroup, SMS_R_System.Client, SMS_G_System_LOGICAL_DISK.DeviceID, SMS_G_System_LOGICAL_DISK.FreeSpace from  SMS_R_System inner join SMS_G_System_LOGICAL_DISK on SMS_G_System_LOGICAL_DISK.ResourceID = SMS_R_System.ResourceId where SMS_G_System_LOGICAL_DISK.DeviceID = "C:" and SMS_G_System_LOGICAL_DISK.FreeSpace <= 3072
     
    Then we could check if the Free Space in the results match the criteria we set (<=3072) and match the actual situation on the client.
     
    Hope my answer could help you and look forward to your feedback.
     
    Best Regards,
    Ray

    Please remembers to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Tuesday, February 12, 2019 7:21 AM
  • Using 1802.  Yes all the needed inventory classes are selected.   I went back and looked at the "Free Space" attribute for the logical disk class and today it showed it was in GB.  I swear yesterday it said MB.  Thanks for the help.
    Tuesday, February 12, 2019 3:23 PM
  • Yep that's what I read yesterday.  Came in today and checked it, it was changed to GB.  ill set it and update membership and see what happens. I'm not privileged to post photos yet or I would.

    Tuesday, February 12, 2019 3:29 PM
  • I forget when exactly this changed but it did change, I will say in the last two years. I will guess that it changed in 1706 from KB to MB. 

    Garth Jones

    Blog: https://www.enhansoft.com/blog Old Blog: https://sccmug.ca/

    Twitter: @GarthMJ Book: System Center Configuration Manager Reporting Unleashed

    Tuesday, February 12, 2019 3:40 PM
    Moderator
  • it was changed in 1703 Garth, i had the same issue if you remember. 
    Wednesday, February 13, 2019 12:36 AM
  • Hello,

    Well, it is MB in SCCM 1810 and it should be GB in SCCM 1802.

    I found this for your reference.

    What's new in version 1710 > Inventory default unit revision (link)

    As devices now include hard drives with sizes in the gigabyte (GB), terabyte (TB) and larger scales, this release changes the default unit (SMS_Units) used in many views from megabytes (MB) to GB. For example, the v_gs_LogicalDisk.FreeSpace value now reports GB units.
     

    What's new in version 1806 > Hardware inventory default unit revision (link)

    In Configuration Manager version 1710, the default unit used in many reporting views changed from megabytes (MB) to gigabytes (GB). Due to improvements to hardware inventory for large integer values, and based on customer feedback, this default unit is now MB again.
     
    Hope my answer could help you and look forward to your feedback.
     
    Best Regards,
    Ray


    Please remembers to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Wednesday, February 13, 2019 2:44 AM
  • Hello,
     
    I noticed that you have not updated for several days. Has your issue been solved? Or is there any update?
     
    Feel free to feedback.
     
    Best Regards,
    Ray

    Please remembers to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Tuesday, February 19, 2019 1:23 PM