I must have completely overlooked this, but why is there a function declaration in line 2 ?
Are you calling that function anywhere ?
The memory and CPU setting on line 14 will need a Get-VM first. Somethine like this
Get-vm -Name $_."Server Name" | Set-VM -MemoryGB $_.MemoryGB -NumCpu $_.NumCpu