Have a Question?
< All Topics
Print

Transfer Files Between ESXi Hosts with SCP

Steps to transfer files between ESXi Hosts with SCP

Enable SSH Access with PowerCLI

SSH Access is NOT enabled by default

#Enable SSH Service
$EsxiHost = "nuc2.lab.aventislab.com"
$ServiceName = "TSM-SSH"

Start-VMHostService -HostService (Get-VMHost -Name $EsxiHost | Get-VMHostService | Where { $_.Key -eq "TSM-SSH"})

Enable sshClient in Firewall Ruleset

By default, SshClient is NOT allowed in Firewall in ESXi 6.7 host

#Verify sshClient is enabled? 
$ServiceName = "sshClient" 
$EsxCli = (Get-EsxCli -VMHost $EsxiHost -V2).network.firewall

$Arg = @{
    rulesetid = $ServiceName
}

$EsxCli.ruleset.list.Invoke($Arg)

#Enable sshClient 
$Arg = @{
    allowedall = 'true'
    enabled = 'true'
    rulesetid = $ServiceName

}

$EsxCli.ruleset.set.Invoke($Arg)

Refer to How to use ESXCLI v2 Commands in PowerCLI for more detail information

Transfer Files Between ESXi Hosts with SCP

Login to source ESXi host with SSH, and transfer to file to destination host with SCP

[root@nuc8:~] scp /vmfs/volumes/LOCAL/ISO/Debian10.2.iso [email protected]://vmfs/volumes/NUC2-240/ISO
FIPS mode initialized
The authenticity of host '192.168.1.160 (192.168.1.160)' can't be established.
RSA key fingerprint is SHA256:Xh5zJNzV78L+FBjGkKw9TaBi1cmc3C3QkpaeVZ/JpXY.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.160' (RSA) to the list of known hosts.
Password:
Debian10.2.iso                                                                                                                                 100%  335MB  98.1MB/s   00:03
Table of Contents
Scroll to Top