wenn ich das folgende Powershell Skript im Guest (Windows Powershell ISE) laufen lasse, funktioniert alles wie erwartet.
Es öffnet ein Fenster (siehe Bild), fokusiert es und drückt TAB --> ENTER um die Applikation zu installieren.
Code: Alles auswählen
add-type -AssemblyName microsoft.VisualBasic
add-type -AssemblyName System.Windows.Forms
try {
WriteIntoLogFile("Starting installation")
$windowTitle = "Installer"
Start-Process -FilePath "C:\temp\installMe.exe"
start-sleep -Milliseconds 30000
[Microsoft.VisualBasic.Interaction]::AppActivate($windowTitle)
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
}
catch {
WriteErrorIntoLogFile("Could not install installMe.exe" + $_.Exception.Message)
}
Mein Problem ist aktuell, dass wenn ich versuche das Powershell Skript über den Host (vmrun.exe) zu triggern, das fokusieren des Fensters (Installer) nicht funktioniert.
"C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe" -gu user -gp 123 runProgramInGuest C:\VMs\VM1\VM1.vmx -interactive C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -file C:\KickstarterCache\MSCV5\powershell.ps1
Hat jemand dafür eine Erklärung und evtl. einen Lösungsvorschlag wie ich das zum laufen bringe?
Gruß + Danke