VMware Cloud Community
zik
Enthusiast
Enthusiast
Jump to solution

New-VM in 11.2 requires a portgroup

PowerCLI 11.2 appears to require a portgroup for New-VM:

PS C:\> New-VM -Name testvm -ResourcePool testpool -Datastore testds

New-VM : 4/2/2019 8:19:17 AM New-VM Value cannot be null.

Parameter name: source

At line:1 char:1

+ New-VM -Name testvm -ResourcePool testpool -Datastore testds ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [New-VM], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.V

   iCore.Cmdlets.Commands.NewVM

PS C:\> New-VM -Name testvm -ResourcePool testpool -Datastore testds -Portgroup testpg

Name                 PowerState Num CPUs MemoryGB      

----                 ---------- -------- --------      

testvm              PoweredOff 1        0.250         

This was not true in 10.0; haven't tested 11.1.  In any case, I believe this is the wrong behavior.

Tags (1)
Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

I was able to replicate your issue.

This seems to happen when there is no VM portgroup on any VSS present.

In PowerCLI 10.0.0 the behaviour was different.

The VM was created but it didn't have a vNIC.
Which corresponds with what the Portgroup parameter help states:
"Specifies standard or distributed port groups to which you want to connect the virtual machine. For each specified port group, a new network adapter is created."

I suspect this changed behaviour might be a result of a bug fix (sic) that is mentioned in the 11.2.0.Change Log.

bug.jpg

I suggest to open a SR.
And yes, PowerCLI is supported, even without a Developer Support Contract.

Refer GSS to PowerCLI Support Breakdown


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
6 Replies
LucD
Leadership
Leadership
Jump to solution

Which PS version and which platform are you using?

Did you try the same without using OBN?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
zik
Enthusiast
Enthusiast
Jump to solution

I also tried passing objects.  It appears that it isn't getting the data center of the InventoryLocation folder.

Opened SR 19145352404.

PS C:\> $global:DefaultVIServer | select Name,Version,Build

Name                         Version Build  

----                         ------- -----  

vss-vcenter.campusad.msu.edu 6.7.0   11727113

PS C:\> get-module -name vmware*

ModuleType Version    Name                                ExportedCommands       

---------- -------    ----                                ----------------       

Script     6.7.0.1... VMware.DeployAutomation             {Add-DeployRule, Add-...

Script     6.7.0.1... VMware.ImageBuilder                 {Add-EsxSoftwareDepot...

Script     6.7.0.1... VMware.Vim                                                 

Script     11.2.0.... VMware.VimAutomation.Cis.Core       {Connect-CisServer, D...

Script     11.0.0.... VMware.VimAutomation.Cloud          {Add-CIDatastore, Con...

Script     11.2.0.... VMware.VimAutomation.Common                                

Script     11.2.0.... VMware.VimAutomation.Core           {Add-PassthroughDevic...

Script     6.5.4.7... VMware.VimAutomation.HA             Get-DrmInfo            

Script     7.6.0.1... VMware.VimAutomation.HorizonView    {Connect-HVServer, Di...

Script     10.0.0.... VMware.VimAutomation.License        Get-LicenseDataManager 

Script     10.0.0.... VMware.VimAutomation.PCloud         {Connect-PIServer, Di...

Script     11.2.0.... VMware.VimAutomation.Sdk            {Get-ErrorReport, Get...

Script     11.2.0.... VMware.VimAutomation.Storage        {Add-KeyManagementSer...

Script     11.2.0.... VMware.VimAutomation.Vds            {Add-VDSwitchPhysical...

Script     10.0.0.... VMware.VimAutomation.vROps          {Connect-OMServer, Di...

Script     6.5.1.7... VMware.VumAutomation                {Add-EntityBaseline, ...

PS C:\> $PSVersionTable

Name                           Value                                             

----                           -----                                             

PSVersion                      5.1.17763.316                                     

PSEdition                      Desktop                                           

PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                           

BuildVersion                   10.0.17763.316                                    

CLRVersion                     4.0.30319.42000                                   

WSManStackVersion              3.0                                               

PSRemotingProtocolVersion      2.3                                               

SerializationVersion           1.1.0.1        

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

InventoryLocation?
That parameter doesn't exist on the New-VM cmdlet afaik.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

I was able to replicate your issue.

This seems to happen when there is no VM portgroup on any VSS present.

In PowerCLI 10.0.0 the behaviour was different.

The VM was created but it didn't have a vNIC.
Which corresponds with what the Portgroup parameter help states:
"Specifies standard or distributed port groups to which you want to connect the virtual machine. For each specified port group, a new network adapter is created."

I suspect this changed behaviour might be a result of a bug fix (sic) that is mentioned in the 11.2.0.Change Log.

bug.jpg

I suggest to open a SR.
And yes, PowerCLI is supported, even without a Developer Support Contract.

Refer GSS to PowerCLI Support Breakdown


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Just learned that they are aware of this issue, and that they are working on a fix.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
noaboa
Contributor
Contributor
Jump to solution

I'm also experiencing this problem. Any update on this?

My script works fine on an older vCenter Server 6.0.0 and also a new one 6.7 but having trouble on a 6.5 vCenter that I get that NULL Error.

I can't create a VM at all.

I passed the parametes Name, PortGroup, ResourcePool and Datastore. Also with NetworkName instead of PortGroup and/or VMHost instead of ResourcePool I got the NULL Error.

Reply
0 Kudos