Write to a custom field (RAM Slots Used)

Written By Mikel from Gorelo

You can write to a custom asset field via scripts. This is useful for things such as BitLocker keys, rotating local admin passwords and third-party UIDโ€™s.
โ€‹
In this example, we'll report on RAM slots.

Step 1: Create the custom asset field

  1. Navigate to Settings -> Assets -> Custom Fields

  2. Add custom field with the following details

    • Name: RAM Slots Used

    • Variable: ramSlotsUsed

Step 2: Create the script

  1. Navigate to Scripts

  2. Create a script with the following details:

    • Name: ๐Ÿ—๏ธStore-ramSlotsUsed

    • Content:

Example
$totalSlots = (Get-CimInstance -ClassName Win32_PhysicalMemoryArray).MemoryDevices $usedSlots = (Get-CimInstance -ClassName Win32_PhysicalMemory).Count $emptySlots = $totalSlots - $usedSlots $totalRAM = [math]::Round((Get-CimInstance -ClassName Win32_ComputerSystem).TotalPhysicalMemory/1GB, 2) $ramInfo = "RAM: $totalRAM GB installed | Slots: $usedSlots/$totalSlots used ($emptySlots empty)" # Set Gorelo RMM custom field GoreloAction -SetCustomField -Name 'asset.ramSlotsUsed' -Value $ramInfo Write-Host "Set Gorelo field 'asset.ramSlotsUsed' to: $ramInfo"

Step 3: Deploy the script via a policy

  1. Navigate to Policies

  2. Edit an existing policy that covers the assets you want to report on RAM slots used

  3. Add the '๐Ÿ—๏ธStore-ramSlotsUsed' script and set to repeat daily at your preferred time

  4. Save and Distribute the policy