powershell - VMware VIM IPv6

标签 powershell vmware

这是基于另一篇文章。 clone vm change network identity

我在构建虚拟机时需要设置 IPv6 地址。我找到了属性,但它不允许我设置值。

$FirstNic.Adapter.IpV6Spec = New-Object VMware.Vim.CustomizationIPSettingsIpV6AddressSpec 
$FirstNic.Adapter.IpV6Spec.Ip = New-Object VMware.Vim.CustomizationFixedIpV6 
$FirstNic.Adapter.IpV6Spec.Ip.IpAddress = "::1"

The property 'IpAddress' cannot be found on this object. Verify that the property exists and can be set. At line:33 char:4 + $FirstNic.Adapter.IpV6Spec.Ip.IpAddress = "::1" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

这是成员:类型名称:VMware.Vim.CustomizationFixedIpV6

Name    MemberType  Definition
----        ----------  ----------
Equals      Method      bool Equals(System.Object obj)
GetHashCode     Method      int GetHashCode()
GetType     Method      type GetType()
ToString    Method      string ToString()
DynamicProperty Property    VMware.Vim.DynamicProperty[] DynamicProperty {get;set;}
DynamicType     Property    string DynamicType {get;set;}
IpAddress   Property    string IpAddress {get;set;}
SubnetMask  Property    int SubnetMask {get;set;}

最佳答案

快速测试表明,直接在 VMware.Vim.CustomizationFixedIpV6 上设置该属性似乎有效。之后将其分配给 VMware.Vim.CustomizationIPSettingsIpV6AddressSpec 对象似乎也有效。

> $ip = New-Object vmware.vim.customizationfixedipv6
> $ip.IpAddress = "::1"
> $ipv6spec = new-object vmware.vim.customizationipsettingsipv6addressspec
> $ipv6spec.ip = $ip
> $ipv6spec.ip.ipaddress
::1
> $ipv6spec.ip.ipaddress = "::2"
Property 'ipaddress' cannot be found on this object; make sure it exists and is settable
At line:1 char:1
+ $ipv6spec.ip.ipaddress = "::2"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

但是,VMware.Vim.CustomizationIPSettingsIpV6AddressSpecIp 属性似乎没有 VMware.Vim.CustomizationFixedIpV6 作为其类型。它有 VMware.Vim.CustomizationIpV6Generator

所以我想知道这是否是类型规范/继承/等等。问题。

关于powershell - VMware VIM IPv6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27986035/

相关文章:

file - 使用 PowerShell 复制没有文件的文件夹、没有文件夹的文件或所有内容

ubuntu - vmware ubuntu : error usb 4-1: stat urb: status -32 when connecting external drive

mysql - 使用putty在vmware服务器中上传sql文件

docker - 容器构建错误 - 无法关闭容器 - 容器在关闭期间遇到错误

vmware - 如何打开 Google-Chrome-OS bundle 2012 的 VMDK 文件?

powershell - 远程Powershell弹出消息

powershell - 在 Powershell 中调用 Exchange 命令 - 数据部分中不允许出现 block

powershell - Invoke-Command:找不到可以接受参数的位置参数

sql-server - 使用 PowerShell 在客户计算机上部署 SSRS 报告

VMWare 播放器与 VMWare 工作站