That looks better, but I guess there is a typo on line 4.
That should be
Get-OSCustomizationSpec $_.Customization | Set-OSCustomizationSpec -MemoryMB $_.MemoryMB -NumCpu $_.NumCpu -Confirm:$false
And I don't think line 7 will work.
That should be something like this, and after the New-VM.
Get-VM -Name $_."Server Name" | Get-NetworkAdapter | Where {$_.NetworkName -eq 140 } |Set-NetworkAdapter -NetworkName $VLAN -Confirm:$false
Let me know if your script runs after these changes, and if it does what you want it to do ?