Check a registry key

(imported topic written by SystemAdmin)

hello

how do i check a registry key value and make an action that if this value is less than a number its installing a program?

(imported comment written by SystemAdmin)

As long as you know where the key is that should be straight forward:

//convert the value to a string and then a version

q: value “PowerShellVersion” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine” of registry as string as version

A: 2.0

T: 0.066 ms

I: singular version

//Once you have a version you can compare with <,>,=,!=

q: value “PowerShellVersion” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\PowerShellEngine” of registry as string as version = “2.0”

A: True

T: 0.081 ms

I: singular boolean