gpt4 book ai didi

powershell - VMware VIM IPv6

转载 作者:行者123 更新时间:2023-12-03 01:52:58 24 4
gpt4 key购买 nike

这是基于另一篇文章。 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com