1.首先安装powercli程序
可以直接官网下载
2.获取命令行内帮助的方法
1 |
get-help command_name |
3.连接vCenter并添加主机
1 2 |
Connect-VIServer 8.8.8.8 Add-VMHost 8.8.8.108 -Location location -User user -Password password -force |
4.附add-vmhost的help
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
PowerCLI C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI> get-help add-vmhost 名称 Add-VMHost 摘要 This cmdlet adds a host to be managed by a vCenter Server system. 语法 Add-VMHost [-Name] <String> [-Port <Int32>] [-Location] <VIContainer> [-Cre dential <PSCredential>] [-User <String>] [-Password <String>] [-Force] [-Ru nAsync] [-Server <VIServer[]>] [-WhatIf] [-Confirm] [<CommonParameters>] 说明 This cmdlet adds a host to be managed by a vCenter Server system. The host is added to the datacenter or folder specified by the Location parameter. O ne of the User/Password and Credential parameters must be provided in order to authenticate with the host. If both are specified, the Credential param eter is used and the User and Password parameters are ignored. |