Skip to content
This repository was archived by the owner on Nov 7, 2024. It is now read-only.
This repository was archived by the owner on Nov 7, 2024. It is now read-only.

UEM-Samples/Sensors/Windows/system_totalphysicalmemory.ps1 - Sensor fails because Integer Response type doesn't allow decimal points #306

@jdtomchick1194

Description

@jdtomchick1194

Describe the bug

When deploying this Sensor with a Response Data Type: Integer , an error occurs as Ints don't support decimal points.

image

Reproduction steps

1.Deploy Sensor with suggested values
2. Some\all devices fail
3.
...

Expected behavior

I was able to work around this with the following code addition to round the value, there may be a better long term fix

$totalphysicalmemory = (Get-WmiObject -Class win32_computersystem).TotalPhysicalMemory

$ram = [math]::Round(([decimal]($totalphysicalmemory)/1GB),2)

$ram = [math]::Round($ram)

return $ram

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions