Powercli Get-OvfConfiguration部署ova虚拟机

本文介绍如何通过PowerShell脚本设置OVF配置并部署vAPP。包括设置网络映射、IP协议及分配策略等步骤,并提供具体命令示例。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Set the OVF path to a variable:
 
$ovfpath "Path_to_OVA”
 
Get the OVF configuration:
 
$ovfConfig = Get-OvfConfiguration –Ovf $ovfpath
 
Display the configuration properties of the OVF:
 
$ovfConfig.ToHashTable() | ft –autosize
 
You can see the list of properties that can be assigned values for deployment.
 
Set the appropriate configuration properties for your environment:
 
$ovfConfig.NetworkMapping.Network_1.Value = “Network_1″
$ovfConfig.IpAssignment.IpProtocol.Value = “IPv4″
$ovfConfig.IpAssignment.IpAllocationPolicy.Value = "dhcpPolicy"
 
Once the configuration properties are assigned, deploy the vAPP by running this command:
 
Import-VApp -Source "Path_TO_OVF" -OvfConfiguration $ovfConfig -VMHost "IP_Address" -Name vApp_Name -DiskStorageFormat Thin -Datastore (Get-Datastore -VMHost "IP_Address" -Name 'Datastore_Name')
 
For example:
 
Import-VApp -Source "C:\NewFolder\VMware-vcops-5.8.4.0-2199700-vapp.ovf" -OvfConfiguration $ovfConfig -VMHost "10.1.1.1" -Name vROpsTestvApp -DiskStorageFormat Thin -Datastore (Get-Datastore -VMHost "10.1.1.1" -Name 'datastore1')



    

1
2
3
4
5
6
    $ovfPath "E:\iso\h5ngcVA-3.27.0.0-7055108_OVF10.ova"
    $ovfConfig Get-OvfConfiguration -Ovf $ovfPath
    $ovfConfig.NetworkMapping.Network_1.Value = "Management Network"
    $ovfConfig.IpAssignment.IpProtocol.Value = "IPv4"
    $ovfConfig.IpAssignment.IpAllocationPolicy.Value = "dhcpPolicy"
    Import-VApp $ovfPath -OvfConfiguration $ovfConfig -VMHost "192.168.1.11" -Name         htmlclient -DiskStorageFormat Thin -Datastore vsanDatastore -force

















本文转自bard_zhang51CTO博客,原文链接:http://blog.51cto.com/timefiles/1980299 ,如需转载请自行联系原作者


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值