Simple registry create two values not working

written by Braian

Hi All,

Im trying to record Ramsize and Time on registry but when i run using fixlet debugger only one value is written to the registry. any idea on how to resolved it?

im attaching my screenshot for reference.

Thanks,

Braian

written by NoahSalzman

Hey Briaian,

Couple things: for questions like this please paste in your code so it’s easy for folks to copy to their own systems to troubleshoot. And, is this still an issue for you? Being too lazy to retype your code and test it my first thought is to tell you to try running the action in a test fixlet in the console and see if you get different results than the Fixlet Debugger.

written by Braian

HI
NoahSalzman,

her
e is the code:
if {(size of ram/1024/1024) > 1024}

regset “[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix]” “LastRAMtime”="{now}"

if {(size of ram/1024/1024) > 1024}

regset “[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix]” “LastRAMSize”="{((if (it > 128) then (((it/32)32) + (if (it mod 32 > 16) then 32 else 0) ) else it ) of (size of ram / (10241024)) as floating point /1024) as integer}"

else

regset “[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix]” “LastRAMSize”="{(if (it > 128) then (((it/32)32) + (if (it mod 32 > 16) then 32 else 0) ) else it ) of (size of ram / (10241024)) as integer}"

Thanks,

Braian

written by jgstew

I’m curious, why are you recording this? Is this before an upgrade?

it looks like you are missing an “endif”

I would not recommend writing “time” like that and i would write the raw size of ram value and only adjust it when you report back on the value.

written by jgstew

I’d recommend a key like RamSize_20140301 with a value that is the raw ram size as reported by the inspector. You can then look for all keys with name that starts with “RamSize_” to find historical ram size.

Part of the reason why storing just “time” is a bad idea is because of the possibility of future name collisions. It would be better to store valueRamSize and timeRamSize or RamSize_value RamSize_Time, which are far less likely to have issues, especially if you expand what you are doing in the future.

I still wonder what you are after since you can usually retrieve the original configuration from the manufacturer and you can retrieve the current Ram size from the inspector. Is this to track Ram upgrades over time? or to track potential RAM theft? or something else?

written by Braian

hi
jgstew,

i only used time for the testing,
if i add value to the name (ex. RamSize_20140301) then i need to edit it before redeploying again, we used this to detect if someone is removing/adding RAM from their workstation and time for the checking.

thanks,

Braian

written by jgstew

You do not need to edit it before redeploying, you can use relevance substitution to automatically replace 20140301 with whatever the current YYYYMMDD is.

http://bigfix.me/relevance/details/2996999

regset “[HKEY_LOCAL_MACHINE\SOFTWARE\BigFix]” “RamSize_{ ((year of it as string & month of it as two digits & day_of_month of it as two digits) of date (local time zone) of it) of now }”="{ size of ram }"

Then reporting:

Raw Values: (name of it, it as string) of values whose(name of it starts with “RamSize_”) of key “HKEY_LOCAL_MACHINE\SOFTWARE\BigFix”

Changed RAM: exists values whose(name of it starts with “RamSize_” and it as string as integer != size of ram) of key “HKEY_LOCAL_MACHINE\SOFTWARE\BigFix”

You could then set this to fire off every 30 days, or something. You could even have the task that fires off every N days only write to the registry if the current ram size does not match the already recorded ram size in the registry so that you would not have multiple entries unless changes are detected.