パラメーター | 説明 |
コマンド情報 | コマンドソース | [コマンドの内容を入力] を選択してコマンドを作成します。 |
コマンドタイプ | コマンドの種類を選択します。 Windowsインスタンスの場合は、[PowerShell] を選択します。 |
コマンドの内容 | 次のコードセグメントをコードエディターに貼り付けます。 $curDir = $PSScriptRoot
Set-Location $curDir
# Check the OS version
$OSversion = [Environment]::OSVersion.Version
if ($OSversion.Major -lt 6 -and $OSversion.Minor -lt 1) {
throw "This scrip is not supported on Windows 2008 or lower"
}
$Arch =([Array](Get-WmiObject -Query "select AddressWidth from Win32_Processor"))[0].AddressWidth
if ($Arch -ne "64") {
throw "Only 64-bit system architecture is supported"
}
function Check-Env() {
$srv_status = (Get-WmiObject -Class win32_service -Filter "name= 'sshd'").Status
if ( $srv_status -match "OK") {
Write-Host "system already installed opensshd"
exit
}
}
function Download-File($file_url = "{{sshd_download_url}}", $file_path = "C:\Programdata\OpenSSH-Win64.zip") {
if (Test-Path $file_path) { return; }
[System.Net.ServicePointManager]::SecurityProtocol=[System.Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $file_url -OutFile $file_path -UseBasicParsing
if (! $?) { throw "$file_url download to $file_path error" }
}
function Unzip-File($src_file = "C:\Programdata\OpenSSH-Win64.zip", $dst_file = "C:\Programdata") {
Expand-Archive -Path $src_file -DestinationPath $dst_file
if (! $?) { throw "Unzip $src_file to $dst_file error, please check" }
}
function Install-Ssh() {
powershell.exe -ExecutionPolicy Bypass -File C:\Programdata\OpenSSH-Win64\install-sshd.ps1
if (! $?) {
throw "Install openssh error, please check"
}
Start-Service sshd
Set-Service -Name "sshd" -StartupType Automatic; Start-Service sshd
if (! $?) {
throw "set sshd enable auto start or start sshd error , please check"
}
}
Check-Env
Download-File
Unzip-File
Install-Ssh
Use Parameters: Use Parametersをオンにします。 次に、上記のコードセグメントで {{sshd_download_url}} パラメーターを設定する必要があります。 {{sshd_download_url}} パラメーターを、OpenSSH公式Webサイトで目的のOpenSSHバージョンをダウンロードしてインストールできるURLに置き換えます。 たとえば、{{sshd_download_url}} パラメーターを https://github.com/PowerShell/Win32-OpenSSH/releases/download/v9.5.0.0p1-Beta/OpenSSH-Win64.zip に置き換えます。 
|
実行プラン | [即時実行] を選択します。 |
コマンド名 | コマンドの名前を入力します。 |
コマンドの説明 | コマンドの説明を入力します。 管理やメンテナンスを容易にするために, コマンドの目的など, コマンドの特定に役立つ说明を指定することをお勧めします。 |
ユーザー名 | ECSインスタンスでコマンドを実行するために使用するユーザー名を指定します。 セキュリティを確保するために、最小権限の原則に基づいて、通常のユーザーとしてCloud Assistantコマンドを実行することを推奨します。 詳細については、「Cloud Assistantコマンドを通常ユーザーとして実行する」をご参照ください。
説明 デフォルトでは、Cloud Assistantコマンドは、Linuxインスタンスではrootユーザーによって、WindowsインスタンスではSystemユーザーによって実行されます。 |
実行パス | コマンドの実行パスを指定します。 コマンドが実行されるインスタンスのオペレーティングシステムに基づいて、さまざまなデフォルトの実行パスが提供されます。 Windowsインスタンスの場合、デフォルトの実行パスは、Cloud Assistant Agentのプロセスが存在するディレクトリC:\ProgramData\aliyun\assist\$(version) です。 |
タイムアウト | インスタンスで実行するコマンドのタイムアウト期間を指定します。 コマンドを実行するタスクがタイムアウトした場合、Cloud Assistantはタスクを強制的に停止します。 単位は秒です。 デフォルト値:60。 このパラメーターを300に設定することを推奨します。 ネットワーク条件に基づいて値を変更できます。 |
インスタンスの選択 | コマンドを実行するECSインスタンスを選択します。 |
管理対象インスタンスの選択 | コマンドを実行するマネージドインスタンスを選択します。 |