From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9D7EFC05027 for ; Mon, 20 Feb 2023 14:11:20 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pU6sD-0002p7-UA; Mon, 20 Feb 2023 09:10:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pU6mZ-0000tE-IQ for qemu-devel@nongnu.org; Mon, 20 Feb 2023 09:04:45 -0500 Received: from mail.cestrin.ro ([213.177.15.195]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pU6mW-0000k7-2R for qemu-devel@nongnu.org; Mon, 20 Feb 2023 09:04:43 -0500 Received: from localhost (unknown [127.0.0.1]) by mail.cestrin.ro (Postfix) with ESMTP id E55A9300291 for ; Mon, 20 Feb 2023 14:14:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at cestrin.ro Received: from mail.cestrin.ro ([127.0.0.1]) by localhost (mail.cestrin.ro [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HkVbBunk4MtS for ; Mon, 20 Feb 2023 16:14:12 +0200 (EET) Received: from C04E02P124API (unknown [192.168.104.15]) by mail.cestrin.ro (Postfix) with ESMTPSA id 6800D3000D6 for ; Mon, 20 Feb 2023 14:14:12 +0000 (UTC) From: "Antonio Apostoliu" To: Subject: Power shell with some problems. Date: Mon, 20 Feb 2023 16:04:31 +0200 Message-ID: <000001d94534$41461c30$c3d25490$@cestrin.ro> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0001_01D94545.04D04BC0" X-Mailer: Microsoft Outlook 16.0 Thread-Index: AdlFM+tmIWCRBL33S8iEx0ezYvxYdw== Content-Language: en-us X-Antivirus: Avast (VPS 230220-0, 20/2/2023), Outbound message X-Antivirus-Status: Clean Received-SPF: none client-ip=213.177.15.195; envelope-from=antonio.apostoliu@cestrin.ro; helo=mail.cestrin.ro X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_REMOTE_IMAGE=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 20 Feb 2023 09:10:28 -0500 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This is a multipart message in MIME format. ------=_NextPart_000_0001_01D94545.04D04BC0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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> -- This email has been checked for viruses by Avast antivirus software. www.avast.com ------=_NextPart_000_0001_01D94545.04D04BC0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hello

  You are so kind to look at next lis= ting.

Where I wrong?

 

Best regards.

 

= PS F:\step> $PSVersionTable

Name = ;            &n= bsp;            = ; Value

----    &nbs= p;            &= nbsp;         -----

<= p class=3DMsoNormal>PSVersion       &nbs= p;            &= nbsp; 7.3.2

PSEdition   &= nbsp;           &nbs= p;      Core

Gi= tCommitId           =          7.3.2

OS         &nbs= p;            &= nbsp;      Microsoft Windows 10.0.19045=

Platform       =             &nb= sp;   Win32NT

PSCompatibleVers= ions           {1.0, 2.0,= 3.0, 4.0…}

PSRemotingProtocolVers= ion      2.3

Se= rializationVersion         &nb= sp; 1.1.0.1

WSManStackVersion  = ;            3.0

PS F:\step>dir

    Directory: F:\step

Mode          &nb= sp;      LastWriteTime    &nbs= p;    Length Name

----&nb= sp;            =     -------------       &= nbsp; ------ ----

d----   = ;        2/10/2023 12:00 PM  &= nbsp;           &nbs= p; qemu

-a---    &nb= sp;      2/20/2023  3:05 PM   =    369754112 d.qcow2

-a---&nbs= p;          2/20/2023  2:= 48 PM           1263 rese= t_vm.ps1

-a---    &n= bsp;      2/20/2023  3:23 PM   = ;         552 start.bat<= /p>

PS F:\step> type .\start.bat

@echo off

set portqmp=3D= 4444

set em64w=3Dqemu-system-x86_64w.exe=

set "arg_c1=3D-accel whpx -k us -m= 952 -M q35 -smp 1 -no-reboot -no-shutdown -nographic"

<= p class=3DMsoNormal>set "arg_c2=3D-parallel none -serial none -rtc bas= e=3Dlocaltime,clock=3Dhost"

set &qu= ot;arg_c=3D%arg_c1% %arg_c2%"

set &= quot;arg_m=3D%arg_c% -nic user"

set= "arg_u=3D-qmp tcp:localhost:%portqmp%,server,wait=3Doff"

set "arg=3D%arg_m% %arg_u%"

for %%i in ("%~dp0.") do SET "mypa= th=3D%%~fi"

set "subdirector_q= emu=3Dqemu"

set "locatie_qemu= =3D%mypath%\%subdirector_qemu%"

set= "qm=3D%locatie_qemu%\%em64w%"

start "" %qm%  -hda d.qcow2 %arg%

PS F:\step> type .\reset_vm.ps1

$LoginParameters1 =3D @{

 &nbs= p;  Uri          &nb= sp;  =3D 'http://localhost:4444'

&n= bsp;   SessionVariable =3D 'Session'

    Method       &= nbsp;  =3D 'POST'

   = ; ContentType     =3D "application/json"=

    Body   &nb= sp;        =3D @{

          "e= xecute"=3D "qmp_capabilities"

        }

}

$LoginParameters2 =3D @{

    Method   =        =3D 'POST'

    ContentType     =3D "ap= plication/json"

    = Body            =3D = @{

      &= nbsp;  "execute"=3D "send-key"

         "argu= ments"=3D @{

   &nbs= p;            &= nbsp;     "keys"=3D @(

          &n= bsp;            = ;          @{

         &n= bsp;            = ;             &= quot;type" =3D "qcode"

&n= bsp;            = ;            &n= bsp;          "data"= =3D "ctrl"

   =             &nb= sp;            =       }

 &= nbsp;           &nbs= p;            &= nbsp;     @{

 &= nbsp;           &nbs= p;            &= nbsp;        "type" =3D "= qcode"

    &nbs= p;             =             &nb= sp;    "data" =3D "alt"<= /p>

        &nb= sp;            =             },<= /o:p>

       &nb= sp;            =            @{<= /p>

        &nb= sp;            =             &nb= sp; "type" =3D "qcode"

            =             &nb= sp;          "data" = =3D "delete"

   = ;            &n= bsp;            = ;    }

   =             &nb= sp;            = )

      &= nbsp;           &nbs= p; }

      = ;  }

}

$LoginResponse =3D Invoke-WebRequest @LoginParameters1

$ProfileResponse =3D Invoke-WebRequest 'http://localh= ost:4444' -WebSession $Session @LoginParameters2

PS F:\step> .\start.bat

PS F= :\step> Start-Sleep -Seconds 60

PS F:= \step> .\reset_vm.ps1

Invoke-WebReque= st: F:\step\reset_vm.ps1:40

Line |<= /o:p>

  40 |  $LoginResponse =3D Invoke-W= ebRequest @LoginParameters1

  =    |          &= nbsp;        ~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~

     | Rece= ived an invalid status line: '{"QMP": {"version": {&quo= t;qemu": {"micro": 0, "minor": 2, "major"= ;: 7},

     | "= package": "v7.2.0-11948-ge6523b71fc-dirty"}, "capabilit= ies": ["oob"]}}'.

Invoke-= WebRequest: F:\step\reset_vm.ps1:41

Line= |

  41 |  … eResponse = =3D Invoke-WebRequest 'http://localhost:4444' -WebSession $Se …<= /o:p>

     |   &= nbsp;            ~~~= ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     | Received an invalid status line: = '{"QMP": {"version": {"qemu": {"micro&qu= ot;: 0, "minor": 2, "major": 7},

     | "package": "v7.2.0-1= 1948-ge6523b71fc-dirty"}, "capabilities": ["oob"]}= }'.

PS F:\step>

<= div id=3D"DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2">
3D""Virus-free.www.avast.com
------=_NextPart_000_0001_01D94545.04D04BC0--