Keyboard Scan Code

Welcome Forums General PowerShell Q&A Keyboard Scan Code

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years ago.

  • Author
  • #5942

    Points: 0
    Rank: Member

    by scriptwriter3 at 2012-10-29 00:24:18

    Is there a way in Powershell to take in ASCII and convert it to keyboard scan code?

    I have written a PSH script that enumerates the BIOS on HP laptops, and depending on some of the settings will then make changes to the BIOS. To make changes (write) requires the input of the BIOS password. HP decided that instead of passing ASCII characters for the password they would use keyboard scan code. I found keyboard scan code tables and have the script working if the password is 'abc123'

    $bios = Get-WMIObject -Namespace root/hp/instrumentedBIOS -Class HP_BIOSSettingInterface

    But, if the password uses a SHIFT key then I can't get this to work. For example if the password is 'abc123$'

    $bios = Get-WMIObject -Namespace root/hp/instrumentedBIOS -Class HP_BIOSSettingInterface

    So I am hoping there might be way in Powershell to help reveal or explain what I am missing.

    by poshoholic at 2012-10-29 08:01:51

    Just a hunch, but have you tried using a combination of both the down and up scan codes? For example, it seems from this table that:

    "$" would be Shift-Down, 4-Down, 4-Up, Shift-Up, or 2A0585AA
    "a" would be A-Down, A-Up, or 1E9E
    "A" would be Shift-Down, A-Down, A-Up, Shift-Up, or 2A1E9EAA

    Again, this is just a hunch, but I think it would be worth trying to see if you can control the keyboard scan codes by being more explicit about keydown and keyup "events".

The topic ‘Keyboard Scan Code’ is closed to new replies.