0

この例 (例 5) をhttps://www.vmware.com/support/developer/PowerCLI/PowerCLI51/html/Set-NetworkAdapter.htmlからコピーし、自分で使用するために少し変更しましたが、エラーがスローされます。

Get-VM SDBNAPPQA03 | Get-NetworkAdapter | Set-NetworkAdapter -NetworkName "10.30.88.0/21(VL712)" -Confirm:$false

Set-NetworkAdapter : 7/2/2013 8:07:05 AM    Set-NetworkAdapter        Object reference not set to an instance of an object.
At line:1 char:43
+ Get-VM SDBNAPPQA03 | Get-NetworkAdapter | Set-NetworkAdapter -NetworkName "10.30 ...
+                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Set-NetworkAdapter], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDevice.SetNetworkAdapter

Get-NetworkAdapter から Adapter オブジェクトを取得しています。

Get-VM SDBNAPPQA03 | Get-NetworkAdapter  | Get-Member


   TypeName: VMware.VimAutomation.ViCore.Impl.V1.VirtualDevice.NetworkAdapterImpl

Name             MemberType Definition
----             ---------- ----------
ConvertToVersion Method     T VersionedObjectInterop.ConvertToVersion[T]()
Equals           Method     bool Equals(System.Object obj)
GetHashCode      Method     int GetHashCode()
GetType          Method     type GetType()
IsConvertableTo  Method     bool VersionedObjectInterop.IsConvertableTo(type type)
LockUpdates      Method     void ExtensionData.LockUpdates()
ToString         Method     string ToString()
UnlockUpdates    Method     void ExtensionData.UnlockUpdates()
Client           Property   VMware.VimAutomation.ViCore.Interop.V1.VIAutomation Client {get;}
ConnectionState  Property    VMware.VimAutomation.ViCore.Types.V1.VirtualDevice.ConnectInfo ConnectionState {get;}
ExtensionData    Property   System.Object ExtensionData {get;}
Id               Property   string Id {get;}
MacAddress       Property   string MacAddress {get;}
Name             Property   string Name {get;}
NetworkName      Property   string NetworkName {get;}
Parent           Property   VMware.VimAutomation.Sdk.Types.V1.VIObject Parent {get;}
ParentId         Property   string ParentId {get;}
Type             Property   VMware.VimAutomation.ViCore.Types.V1.VirtualDevice.VirtualNetworkAdapterType Type {get;}
Uid              Property   string Uid {get;}
WakeOnLanEnabled Property   bool WakeOnLanEnabled {get;}

問題なく vCenter コンソールでネットワーク名を設定できます。

次のコマンドも試してみましたが、同じ結果になりました。

(Get-VM SDBNAPPQA03).Guest.Nics.Device | Set-NetworkAdapter -NetworkName "10.30.88.0/21(VL712)" -Confirm:$False

この VM の vCenter ドロップダウン リストから、ネットワーク名が正しいことを確認しました。そして、リストから他の選択肢を試しました。

NetworkAdapter の設定方法に関するアイデアはありますか?

4

1 に答える 1

0

問題は -NetworkName 変数と完全に一致していないことが判明しました。大文字小文字を含めて正確でなければなりません。例: 「10.30.80.0/21(VL712)」を入力していましたが、実際のネットワーク名と一致するように、左括弧の前にスペースが必要です。

于 2013-07-11T19:56:10.620 に答える