File tree Expand file tree Collapse file tree 1 file changed +74
-74
lines changed Expand file tree Collapse file tree 1 file changed +74
-74
lines changed Original file line number Diff line number Diff line change 10
10
. DESCRIPTION
11
11
This function sends a series of character keystrokse to a particular VM
12
12
. PARAMETER VMName
13
- The name of a VM to send keystrokes to
14
- . PARAMETER StringInput
15
- The string of characters to send to VM
16
- . PARAMETER DebugOn
17
- Enable debugging which will output input charcaters and their mappings
13
+ The name of a VM to send keystrokes to
14
+ . PARAMETER StringInput
15
+ The string of characters to send to VM
16
+ . PARAMETER DebugOn
17
+ Enable debugging which will output input charcaters and their mappings
18
18
. EXAMPLE
19
19
Set-VMKeystrokes -VMName $VM -StringInput "root"
20
20
. EXAMPLE
32
32
# Map subset of USB HID keyboard scancodes
33
33
# https://gist.github.com/MightyPork/6da26e382a7ad91b5496ee55fdc73db2
34
34
$hidCharacterMap = @ {
35
- " a" = " 0x04" ;
36
- " b" = " 0x05" ;
37
- " c" = " 0x06" ;
38
- " d" = " 0x07" ;
39
- " e" = " 0x08" ;
40
- " f" = " 0x09" ;
41
- " g" = " 0x0a" ;
42
- " h" = " 0x0b" ;
43
- " i" = " 0x0c" ;
44
- " j" = " 0x0d" ;
45
- " k" = " 0x0e" ;
46
- " l" = " 0x0f" ;
47
- " m" = " 0x10" ;
48
- " n" = " 0x11" ;
49
- " o" = " 0x12" ;
50
- " p" = " 0x13" ;
51
- " q" = " 0x14" ;
52
- " r" = " 0x15" ;
53
- " s" = " 0x16" ;
54
- " t" = " 0x17" ;
55
- " u" = " 0x18" ;
56
- " v" = " 0x19" ;
57
- " w" = " 0x1a" ;
58
- " x" = " 0x1b" ;
59
- " y" = " 0x1c" ;
60
- " z" = " 0x1d" ;
61
- " 1" = " 0x1e" ;
62
- " 2" = " 0x1f" ;
63
- " 3" = " 0x20" ;
64
- " 4" = " 0x21" ;
65
- " 5" = " 0x22" ;
66
- " 6" = " 0x23" ;
67
- " 7" = " 0x24" ;
68
- " 8" = " 0x25" ;
69
- " 9" = " 0x26" ;
70
- " 0" = " 0x27" ;
71
- " !" = " 0x1e" ;
72
- " @" = " 0x1f" ;
73
- " #" = " 0x20" ;
74
- " $" = " 0x21" ;
75
- " %" = " 0x22" ;
76
- " ^" = " 0x23" ;
77
- " &" = " 0x24" ;
78
- " *" = " 0x25" ;
79
- " (" = " 0x26" ;
80
- " )" = " 0x27" ;
81
- " _" = " 0x2d" ;
82
- " +" = " 0x2e" ;
83
- " {" = " 0x2f" ;
84
- " }" = " 0x30" ;
85
- " |" = " 0x31" ;
86
- " :" = " 0x33" ;
87
- " `" " = " 0x34" ;
88
- " ~" = " 0x35" ;
89
- " <" = " 0x36" ;
90
- " >" = " 0x37" ;
91
- " ?" = " 0x38" ;
92
- " -" = " 0x2d" ;
93
- " =" = " 0x2e" ;
94
- " [" = " 0x2f" ;
95
- " ]" = " 0x30" ;
96
- " \" = " 0x31" ;
97
- " `;" = " 0x33" ;
98
- " `' " = " 0x34" ;
99
- " ," = " 0x36" ;
100
- " ." = " 0x37" ;
101
- " /" = " 0x38" ;
102
- " " = " 0x2c" ;
35
+ " a" = " 0x04" ;
36
+ " b" = " 0x05" ;
37
+ " c" = " 0x06" ;
38
+ " d" = " 0x07" ;
39
+ " e" = " 0x08" ;
40
+ " f" = " 0x09" ;
41
+ " g" = " 0x0a" ;
42
+ " h" = " 0x0b" ;
43
+ " i" = " 0x0c" ;
44
+ " j" = " 0x0d" ;
45
+ " k" = " 0x0e" ;
46
+ " l" = " 0x0f" ;
47
+ " m" = " 0x10" ;
48
+ " n" = " 0x11" ;
49
+ " o" = " 0x12" ;
50
+ " p" = " 0x13" ;
51
+ " q" = " 0x14" ;
52
+ " r" = " 0x15" ;
53
+ " s" = " 0x16" ;
54
+ " t" = " 0x17" ;
55
+ " u" = " 0x18" ;
56
+ " v" = " 0x19" ;
57
+ " w" = " 0x1a" ;
58
+ " x" = " 0x1b" ;
59
+ " y" = " 0x1c" ;
60
+ " z" = " 0x1d" ;
61
+ " 1" = " 0x1e" ;
62
+ " 2" = " 0x1f" ;
63
+ " 3" = " 0x20" ;
64
+ " 4" = " 0x21" ;
65
+ " 5" = " 0x22" ;
66
+ " 6" = " 0x23" ;
67
+ " 7" = " 0x24" ;
68
+ " 8" = " 0x25" ;
69
+ " 9" = " 0x26" ;
70
+ " 0" = " 0x27" ;
71
+ " !" = " 0x1e" ;
72
+ " @" = " 0x1f" ;
73
+ " #" = " 0x20" ;
74
+ " $" = " 0x21" ;
75
+ " %" = " 0x22" ;
76
+ " ^" = " 0x23" ;
77
+ " &" = " 0x24" ;
78
+ " *" = " 0x25" ;
79
+ " (" = " 0x26" ;
80
+ " )" = " 0x27" ;
81
+ " _" = " 0x2d" ;
82
+ " +" = " 0x2e" ;
83
+ " {" = " 0x2f" ;
84
+ " }" = " 0x30" ;
85
+ " |" = " 0x31" ;
86
+ " :" = " 0x33" ;
87
+ " `" " = " 0x34" ;
88
+ " ~" = " 0x35" ;
89
+ " <" = " 0x36" ;
90
+ " >" = " 0x37" ;
91
+ " ?" = " 0x38" ;
92
+ " -" = " 0x2d" ;
93
+ " =" = " 0x2e" ;
94
+ " [" = " 0x2f" ;
95
+ " ]" = " 0x30" ;
96
+ " \" = " 0x31" ;
97
+ " `;" = " 0x33" ;
98
+ " `' " = " 0x34" ;
99
+ " ," = " 0x36" ;
100
+ " ." = " 0x37" ;
101
+ " /" = " 0x38" ;
102
+ " " = " 0x2c" ;
103
103
}
104
104
105
105
$vm = Get-View - ViewType VirtualMachine - Filter @ {" Name" = " ^$ ( $VMName ) $" }
106
106
107
- # Verify we have a VM or fail
107
+ # Verify we have a VM or fail
108
108
if (! $vm ) {
109
109
Write-host " Unable to find VM $VMName "
110
110
return
You can’t perform that action at this time.
0 commit comments