Send Keystrokes/Text to a VM through VMBus (Virtual-Key/Console Keyboard)
Aus Wiki-WebPerfect
Version vom 29. November 2017, 19:37 Uhr von Admin (Diskussion | Beiträge)
$Node = <"Hyper-V Node"> $VM = <"VM"> $ComputerSystem = Get-WmiObject -ComputerName $Node -Query "select * from Msvm_ComputerSystem where ElementName = '$VM'" -Namespace "root\virtualization\v2" $Keyboard = Get-WmiObject -ComputerName $Node -Query "ASSOCIATORS OF {$($ComputerSystem.path.path)} WHERE resultClass = Msvm_Keyboard" -Namespace "root\virtualization\v2" $Keyboard.InvokeMethod("TypeText","Hello world!") # Type 'Hello World!' $Keyboard.InvokeMethod("TypeKey","13") # Press enter $Keyboard.TypeCtrlAltDel() # Send Ctrl + Alt + Del
Virtual-Key Codes: