|
From: | Antonio Apostoliu |
Subject: | Power shell with some problems. |
Date: | Mon, 20 Feb 2023 16:04:31 +0200 |
Hello You are so kind to look at next listing. Where I wrong? Best regards. PS F:\step> $PSVersionTable Name Value ---- ----- PSVersion 7.3.2 PSEdition Core GitCommitId 7.3.2 OS Microsoft Windows 10.0.19045 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0 PS F:\step>dir Directory: F:\step Mode LastWriteTime Length Name ---- ------------- ------ ---- d---- 2/10/2023 12:00 PM qemu -a--- 2/20/2023 3:05 PM 369754112 d.qcow2 -a--- 2/20/2023 2:48 PM 1263 reset_vm.ps1 -a--- 2/20/2023 3:23 PM 552 start.bat PS F:\step> type .\start.bat @echo off set portqmp=4444 set em64w=qemu-system-x86_64w.exe set "arg_c1=-accel whpx -k us -m 952 -M q35 -smp 1 -no-reboot -no-shutdown -nographic" set "arg_c2=-parallel none -serial none -rtc base=localtime,clock=host" set "arg_c=%arg_c1% %arg_c2%" set "arg_m=%arg_c% -nic user" set "arg_u=-qmp tcp:localhost:%portqmp%,server,wait=off" set "arg=%arg_m% %arg_u%" for %%i in ("%~dp0.") do SET "mypath=%%~fi" set "subdirector_qemu=qemu" set "locatie_qemu=%mypath%\%subdirector_qemu%" set "qm=%locatie_qemu%\%em64w%" start "" %qm% -hda d.qcow2 %arg% PS F:\step> type .\reset_vm.ps1 $LoginParameters1 = @{ Uri = 'http://localhost:4444' SessionVariable = 'Session' Method = 'POST' ContentType = "application/json" Body = @{ "execute"= "qmp_capabilities" } } $LoginParameters2 = @{ Method = 'POST' ContentType = "application/json" Body = @{ "execute"= "send-key" "arguments"= @{ "keys"= @( @{ "type" = "qcode" "data" = "ctrl" } @{ "type" = "qcode" "data" = "alt" }, @{ "type" = "qcode" "data" = "delete" } ) } } } $LoginResponse = Invoke-WebRequest @LoginParameters1 $ProfileResponse = Invoke-WebRequest 'http://localhost:4444' -WebSession $Session @LoginParameters2 PS F:\step> .\start.bat PS F:\step> Start-Sleep -Seconds 60 PS F:\step> .\reset_vm.ps1 Invoke-WebRequest: F:\step\reset_vm.ps1:40 Line | 40 | $LoginResponse = Invoke-WebRequest @LoginParameters1 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Received an invalid status line: '{"QMP": {"version": {"qemu": {"micro": 0, "minor": 2, "major": 7}, | "package": "v7.2.0-11948-ge6523b71fc-dirty"}, "capabilities": ["oob"]}}'. Invoke-WebRequest: F:\step\reset_vm.ps1:41 Line | 41 | … eResponse = Invoke-WebRequest 'http://localhost:4444' -WebSession $Se … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Received an invalid status line: '{"QMP": {"version": {"qemu": {"micro": 0, "minor": 2, "major": 7}, | "package": "v7.2.0-11948-ge6523b71fc-dirty"}, "capabilities": ["oob"]}}'. PS F:\step> |
[Prev in Thread] | Current Thread | [Next in Thread] |