Friday, 23 March 2012

Checking the total amount of RAM via SCCM reports or Powershell

Have you tried to check the amount of RAM of a computer that has more than 4GB of RAM and a 32-bit OS?

If yes then you know the SCCM built-in report will only show the maximum amount the OS can show.

The same will happen if you query the win32_computersystem wmi class using powershell.

If you want to check the total amount using SCCM reports you will need to modify your SMS_DEF.MOF and import a new report.

First make a backup of your SMS_DEF.MOF in <sccminstalldir>\inboxes\clifiles.src\hinv

Now edit SMS_DEF.MOF using notepad and place the below in the end of the file:

//**************************************************************************
//* Class: Physical Memory
//* Derived from: (nothing)
//*
//*
//**************************************************************************
[SMS_Report (TRUE),
SMS_Group_Name ("Physical Memory"),
SMS_Class_ID   ("Microsoft|Physical_Memory|1.0")]
class Win32_PhysicalMemory : SMS_Class_Template
{
[SMS_Report (TRUE)] string BankLabel;
[SMS_Report (TRUE), SMS_Units("Megabytes")]  uint64 Capacity;
[SMS_Report (TRUE)] string Caption;
[SMS_Report (TRUE)] string DeviceLocator[];
[SMS_Report (TRUE)] uint16 FormFactor;
[SMS_Report (TRUE)] string Manufacturer;
[SMS_Report (TRUE)] uint16 MemoryType;
[SMS_Report (TRUE)] uint32 PositionInRow;
[SMS_Report (TRUE)] uint32 Speed;
[SMS_Report (TRUE),Key] string    Tag;
[SMS_Report (TRUE),Key] string    CreationClassName;
};
//**************************************************************************
//* Class: Physical Memory Array
//* Derived from: (nothing)
//*
//*
//**************************************************************************
[SMS_Report (TRUE),
SMS_Group_Name ("Physical Memory Array"),
SMS_Class_ID   ("Microsoft|Physical_Memory_Array|1.0")]
class Win32_PhysicalMemoryArray : SMS_Class_Template
{
[SMS_Report (FALSE)] string Caption;
[SMS_Report (FALSE)] string CreationClassName;
[SMS_Report (FALSE)] string Description;
[SMS_Report (FALSE)] uint16 Location;
[SMS_Report (FALSE)] string Manufacturer;
[SMS_Report (TRUE), SMS_Units("Megabytes")] uint32 MaxCapacity;
[SMS_Report (TRUE)] uint16 MemoryDevices;
[SMS_Report (FALSE)] uint16 MemoryErrorCorrection;
[SMS_Report (FALSE)] string Model;
[SMS_Report (FALSE)] string Name;
[SMS_Report (FALSE)] string OtherIdentifyingInfo;
[SMS_Report (FALSE)] string PartNumber;
[SMS_Report (FALSE)] boolean PoweredOn;
[SMS_Report (FALSE)] boolean Removable;
[SMS_Report (FALSE)] boolean Replaceable;
[SMS_Report (FALSE)] string SerialNumber;
[SMS_Report (FALSE)] string SKU;
[SMS_Report (FALSE)] string Status;
[SMS_Report (TRUE), Key] string Tag;
[SMS_Report (FALSE)] uint16 Use;
[SMS_Report (FALSE)] string Version;
};

Now import the new report to SCCM. You can download it from here. (Thanks to Christoph Schmidt)

After the client evaluate the policy and perform a hardware inventory the report will start to be populated with the new information.

If you want to know the RAM only for a few computers you can use Powershell.

Get-WmiObject win32_memorydevice | select startingaddress, endingaddress

This will give you the starting and ending address of used slots.

So for example if you have 2 x 4GB sticks the output will be something like this:
starting address    endingaddress
____________   ___________
                      0     4194303
           4194304     8388607

No comments:

Post a Comment