PS /home/morgany/Documents/vmware/powershell>> New-VDSwitch -Name VM_Operation_DvSwitch -Location $(Get-Datacenter)
New-VDSwitch : Operation is not valid due to the current state of the object.
At line:1 char:1
+ New-VDSwitch -Name VM_Operation_DvSwitch -Location $(Get-Datacenter)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-VDSwitch], InvalidOperationException
+ FullyQualifiedErrorId : System.InvalidOperationException,VMware.VimAutomation.Vds.Commands.Cmdlets.NewVDSwitch
However, the VDSwitch does get created
PS /home/morgany/Documents/vmware/powershell>> Get-VDSwitch
Name NumPorts Mtu Version Vendor
---- -------- --- ------- ------
VM_Operation_DvSwitch 0 1500 6.0.0 VMware, Inc.
Not sure, but I have seen this before with other cmdlets as well.
Something messes up the PowerShell/PowerCLI environment, and causes this erratic behaviour in some cmdlets.
I'll leave it to our friends at VMware to find out, if at all possible.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Are there any entries in the vpxd log?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Not much....
--> "config.vpxd.instanceName"
2018-07-12T12:41:28.811Z info vpxd[7F30020C1700] [Originator@6876 sub=vpxLro opID=673e37cd] [VpxLRO] -- BEGIN task-internal-1362304 -- VpxSettings -- vim.option.OptionManager.queryView -- 525462a0-701e-41f9-8f2a-011e154a1e0e(5253757a-a634-97ea-d953-f1f5290a4022)
2018-07-12T12:41:28.812Z info vpxd[7F30020C1700] [Originator@6876 sub=vpxLro opID=673e37cd] [VpxLRO] -- FINISH task-internal-1362304
2018-07-12T12:41:33.070Z info vpxd[7F3002244700] [Originator@6876 sub=vpxLro opID=2032fa16] [VpxLRO] -- BEGIN task-internal-1362337 -- ServiceInstance -- vim.ServiceInstance.GetContent -- 523f6f98-6155-bae4-5287-6cc0ebac817a(523b1304-06a3-6072-d49b-4f3383301174)
2018-07-12T12:41:33.070Z info vpxd[7F3002244700] [Originator@6876 sub=vpxLro opID=2032fa16] [VpxLRO] -- FINISH task-internal-1362337
2018-07-12T12:41:34.473Z info vpxd[7F3001FBF700] [Originator@6876 sub=licenseServiceProxy] Authenticating to LS for stubAdapter: [N5Vmomi19SoapStubAdapterImplE:0x7f302d3b7590]
2018-07-12T12:41:34.475Z info vpxd[7F3001FBF700] [Originator@6876 sub=[SSO][SsoCertificateManagerImpl]] [CreateServiceContent] Try to connect to SSO VMOMI endpoint.
2018-07-12T12:41:34.550Z info vpxd[7F3001FBF700] [Originator@6876 sub=[SSO][SsoCertificateManagerImpl]] Retrieved trusted STS certificate: CN=ssoserverSign, TP = 80:13:42:2E:06:08:D6:DC:36:82:5B:89:A0:E0:3C:8D:A1:FB:20:94
2018-07-12T12:41:34.733Z info vpxd[7F3001FBF700] [Originator@6876 sub=licenseServiceProxy] Authenticated to LS for stubAdapter: [N5Vmomi19SoapStubAdapterImplE:0x7f302d3b7590]
2018-07-12T12:41:35.763Z info vpxd[7F30020C1700] [Originator@6876 sub=vpxLro opID=147cd3a7] [VpxLRO] -- BEGIN task-6255 -- group-n6 -- vim.Folder.createDistributedVirtualSwitch -- 529b31d4-bc47-2f95-f930-735cd1ecce2e(52edb175-475d-3620-0837-936d887017f5)
2018-07-12T12:41:35.840Z info vpxd[7F30020C1700] [Originator@6876 sub=vspan opID=147cd3a7] [Vspan::ReconfigureVspanSession] updating vspanSession in VDS [VM_Operation_DvSwitch] configInfo based on what is set in the configSpec.
2018-07-12T12:41:35.903Z info vpxd[7F30020C1700] [Originator@6876 sub=vpxLro opID=147cd3a7] [VpxLRO] -- FINISH task-6255
2018-07-12T12:41:44.535Z info vpxd[7F301453C700] [Originator@6876 sub=vpxLro opID=opId-58b5483a-9abe-4b86-9d75-d60580b2b448-79-ac] [VpxLRO] -- BEGIN task-internal-1362422 -- ServiceInstance -- vim.ServiceInstance.GetServerClock -- 52512db9-84f6-1c37-6380-132f0dcbae52(5279dd03-1885-fa78-d2ea-df1d342d9b3d)
2018-07-12T12:41:44.536Z info vpxd[7F301453C700] [Originator@6876 sub=vpxLro opID=opId-58b5483a-9abe-4b86-9d75-d60580b2b448-79-ac] [VpxLRO] -- FINISH task-internal-1362422
2018-07-12T12:41:47.675Z info vpxd[7F30030E1700] [Originator@6876 sub=vpxLro opID=opId-299cb3de-253e-4f02-a6bc-7a4e640af2a4-51-75] [VpxLRO] -- BEGIN task-internal-1362442 -- ServiceInstance -- vim.ServiceInstance.GetServerClock -- 524b125e-b37d-b65c-ff87-542fc2c12361(525cc87d-c5b1-b93f-ccf0-76a3faea8e20)
2018-07-12T12:41:47.675Z info vpxd[7F30030E1700] [Originator@6876 sub=vpxLro opID=opId-299cb3de-253e-4f02-a6bc-7a4e640af2a4-51-75] [VpxLRO] -- FINISH task-internal-1362442
Does this happen every time you try to create a new VDS?
Did you stop/start your PowerShell/PowerCLI session in between?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Good point. I was seeing EVERYTIME in the last few days. Then i exited powershell and reconnected to VCenter, and the error message mysteriously went away. What could cause that?
Not sure, but I have seen this before with other cmdlets as well.
Something messes up the PowerShell/PowerCLI environment, and causes this erratic behaviour in some cmdlets.
I'll leave it to our friends at VMware to find out, if at all possible.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference