vmware-samples / euc-samples

Workspace ONE UEM (previously AirWatch) Samples and Guidance
https://code.vmware.com/web/workspace-one
BSD 3-Clause "New" or "Revised" License
271 stars 148 forks source link

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

Open jdtomchick1194 opened 5 months ago

jdtomchick1194 commented 5 months ago

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

  1. Some\all devices fail
  2. ...

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