From what I can see, it looks like you are not receiving all the information. I am going to ask you to do this "script" again but just copy/ paste the lines in the script pane of that ISE program we talked about.
Then, you have the possibility to run line by line and see what happens. (Select a line, press F8, then select the next line, press F8 and so on...) Normally I would expect that you see two outputs. The one you pasted above is the output for the variable $server (so we know that that one works
). But then you should also have an output for $VM and I cannot see that one.
Maybe really stupid but is your VMname actually ama-dc1 or is it named differently in Hyper-V manager?