链接:https://pan.baidu.com/s/1zs_98ahjnEkHREsxrsK6Og
提取码:d8wg
###查看未注册的信息
Get-ExecutionPolicy -List
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Unrestricted
##注册本地机器
Set-ExecutionPolicy RemoteSigned
##连接vcenter
Connect-VIServer -Server 10.100.201.15 -username "administrator@vsphere.local"-Password "Huayun@123"
##导出末班ovf vm须关机
Export-VM -VM "DCM" -Destination "D:ova" -Format Ova
###事例
Welcome to VMware PowerCLI!
PowerCLI C:> Set-ExecutionPolicy remotesigned
执行策略更改
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [S] 暂停(S) [?] 帮助 (默认值为“N”): Y
PowerCLI C:>
PowerCLI C:>
PowerCLI C:> Get-ExecutionPolicy -List
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine RemoteSigned
PowerCLI C:> Connect-VIServer -Server 10.100.201.15 -username "administrator@vsphere.local"-Password "Huayun@123"
警告: There were one or more problems with the server certificate for the server 10.100.201.15:443:
* The X509 chain is invalid due to an invalid certificate signature.
Certificate: [Subject]
C=US, CN=10.100.201.15
[Issuer]
OU=VMware Engineering, O=photon-machine, S=California, C=US, DC=local, DC=vsphere, CN=CA
[Serial Number]
00D962E1E524C646F3
[Not Before]
2019/8/19 16:30:48
[Not After]
2029/8/13 16:29:42
[Thumbprint]
5886CD1DE7BB1185F872CC92332FA33A04850575
The server certificate is not valid.
Name Port User
---- ---- ----
10.100.201.15 443 VSPHERE.LOCALAdministrator
PowerCLI C:> get-vm
Name PowerState Num CPUs MemoryGB
---- ---------- -------- --------
ibms PoweredOn 4 8.000
zhaopei-win10 PoweredOn 4 12.000
DCM PoweredOff 4 8.000
exsi PoweredOn 4 12.000
yangxiaoliang2-请... PoweredOn 4 16.000
10.100.201.162-sh... PoweredOn 2 2.000
yangxiaoliang5-请... PoweredOn 4 16.000
yangxiaoliang4-请... PoweredOn 4 16.000
han_10.100.201.19... PoweredOn 4 48.000
zhaopei-图形化虚拟机 PoweredOn 8 16.000
10.100.201.161-sh... PoweredOn 2 2.000
hammerdb_windows PoweredOff 8 16.000
yangxiaoliang1-请... PoweredOn 4 16.000
zhaopei-k8s03 PoweredOff 2 4.000
windows PoweredOff 8 16.000
10.100.201.x-temp PoweredOff 2 2.000
windows10 PoweredOff 4 8.000
windows7-shixingwen PoweredOn 8 8.000
yangxiaoliang-模... PoweredOff 4 8.000
zhaopei-k8s02 PoweredOff 2 4.000
win7.sxf.test PoweredOff 8 16.000
yangxiaoliang6-请... PoweredOn 4 16.000
zhaopei-k8s01 PoweredOff 2 4.000
VMware vCenter Se... PoweredOn 2 10.000
yangxiaoliang请勿... PoweredOn 4 16.000
yangxiaoliang3-请... PoweredOn 4 16.000
zhaopei-ansible PoweredOn 2 4.000
zhaopei-node03 PoweredOn 4 8.000
zhaopei-compute03 PoweredOn 2 4.000
zhaopei-compute01 PoweredOn 2 4.000
ddtools PoweredOff 2 2.000
zhaopei-node02 PoweredOn 4 8.000
zhaopei-node01 PoweredOn 4 8.000
Haigang-Prometheus PoweredOn 2 4.000
han-10.100.214.195 PoweredOn 4 8.000
fio-tools PoweredOn 2 2.000
han-10.100.214.192 PoweredOff 2 4.000
han-10.100.214.191 PoweredOff 2 4.000
zhaopei-computer02 PoweredOn 2 4.000
PowerCLI C:> start-vm ddtools
Name PowerState Num CPUs MemoryGB
---- ---------- -------- --------
ddtools PoweredOn 2 2.000
PowerCLI C:> stop-vm ddtools
确认
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [S] 暂停(S) [?] 帮助 (默认值为“Y”): Y
Name PowerState Num CPUs MemoryGB
---- ---------- -------- --------
ddtools PoweredOff 2 2.000