Ok the script ran without error, but when the vm was completed the portgroup had not been changed, the connected on startup was unchecked, and also the cpu/memory also had not been changed.
The script ended just after the second machine started cloning.