The following error: “parameter name source cannot be null” is just an exception in the VMWare.VimAutomation.Core module.
With this error its hard to find the actual issue. The version i’ve running:
PS > get-command new-vm CommandType Name Version Source ----------- ---- ------- ------ Cmdlet New-VM 11.3.0.... VMware.VimAutomation.Core
The actual issue is that there is no “-NetworkName” or -PortGroup parameter is given. So adding this wil fix the issue.
Just curious so i updated the module to the newest available.
Updated VMware.VimAutomation.Core to version: 11.5
Now the error is more clear.
PS > get-command new-vm CommandType Name Version Source ----------- ---- ------- ------ Cmdlet New-VM 11.5.0.... VMware.VimAutomation.Core
My test command:
$VMhost = get-vmhost -name "TST01" $DS = Get-datastore -name "DS1" New-VM -VMHost $vmhost -name "TST01" -Datastore $DS -DiskGB 40 -NumCpu 2 -MemoryGB 8 -DiskStorageFormat Thick
Error: New-VM: PowerCLI could not automatically determine a network to which to attach the VM. Specify a network explicitly using the -NetworkName parameter.
In the newest PowerCli version the error is more clear.
Add a -NetworkName or -PortGroup to fix the error.
Happy Automating
The post New-VM Value cannot be null. Parameter name: source appeared first on Rob V IT.