VMware PowerCLI 命令本地与GuestVM间复制文件

注意:要满足的条件

1. powercli 本机,要可以访问esx主机的443,902端口

2. vmtools如果不是最新会有以下提示,.

警告: The version of VMware Tools on VM 'win2019_sec' is out of date and may cause Copy-VMGuestFile to work improperly.

复制文件到vm中
get-vm win2019_sec | Copy-VMGuestFile -LocalToGuest -Source "c:\a.txt" -Destination "c:\" -GuestUser "Administrator" -GuestPassword "myPassw0Rd"
从VM中复制到本地
get-vm win2019_sec | Copy-VMGuestFile -GuestToLocal -Source "c:\a.txt" -Destination "c:\temp\" -GuestUser "Administrator" -GuestPassword "myPassw0Rd"" -Force

-Force 如果目录不存在自动创建

在线安装PowerCLI

https://developer.broadcom.com/powercli

# To install PowerCLI just open a PowerShell console and run the command below:

PS C:\> Install-Module -Name VMware.PowerCLI
离线安装PowerCLI

https://developer.broadcom.com/tools/vmware-powercli/latest

# powershell开启允许运行脚本
set-ExecutionPolicy RemoteSigned

# 下载PowerCLI包后,解压到如下目录中
C:\Program Files\WindowsPowerShell\Modules

# 运行命令
Get-ChildItem -Path 'C:\Program Files\WindowsPowerShell\Modules' -Recurse | Unblock-File

# 验证VMware PowerCLI模块是否已成功安装。
Get-Module VMware* -ListAvailable

# 设置powercli的证书机制为ignore。
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore

# 带密码连接vCenter
Connect-VIServer -Server 192.168.100.100 -Protocol https -User administrator@vsphere.local -Password myPassw0Rd

  • 8
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值