Topic
  • 1 reply
  • Latest Post - ‏2012-11-20T15:51:44Z by SystemAdmin
SystemAdmin
SystemAdmin
2038 Posts

Pinned topic check a registry key

‏2012-11-20T07:12:51Z |
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?
Updated on 2012-11-20T15:51:44Z at 2012-11-20T15:51:44Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    2038 Posts

    Re: check a registry key

    ‏2012-11-20T15:51:44Z  
    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