LoginSignup
0
0

[AWS]Windows Server2022のEC2にFleetManagerで接続した際にPowershellへの入力ができない際の対応

Posted at

問題

Windows_Server-2022-English-Full-Baseを使用して起動したインスタンスでPowershellを起動しても入力が出来ない。(ペーストやEnterは可能。)
2023/11/2現在、最新のWindows_Server-2022-English-Full-Base-2023.10.11でも発生。

原因

当該AMIで使用されているPSReadline2.0.0が原因。
PSReadLine v2.2.0-beta4 Releaseで解消されているとのこと。
参考:PSReadline 2.1.0 doesn't work in the windows virtual desktop web interface · Issue #2725 · PowerShell/PSReadLine · GitHub

対策

PSReadLineのバージョンアップを行う

コマンド
入力はできないがペーストはできるので、以下をコピーしてペーストする。
もしくはセッションマネージャーから入力を行う。

Install-Module -Name PSReadLine -Repository PSGallery -MinimumVersion 2.3.3 -Force
PS C:\Users\Administrator> Get-Module                                                                                   
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Con...
Script     2.0.0      PSReadline                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PS...


PS C:\Users\Administrator> Install-Module -Name PSReadLine -Repository PSGallery -MinimumVersion 2.3.3 -Force

NuGet provider is required to continue
PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet
 provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or
'C:\Users\Administrator\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by
 running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install
and import the NuGet provider now?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y
PS C:\Users\Administrator>


PS C:\Users\Administrator> exit

Powershellを一度終了して再度起動することで入力が可能となる。

PS C:\Users\Administrator> Get-Module

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     2.3.4      PSReadline                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PS...    
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0