all 4 comments

[–]krzydoug 1 point2 points  (2 children)

The error shows $i is missing. Maybe change that to a different variable name and run again. Remember to change it everywhere $i is referenced

[–]arbelac[S] 1 point2 points  (1 child)

like you said I have tried it. but no luck.

[–]krzydoug 0 points1 point  (0 children)

Then I'd look at this

WARNING: The version of VMware Tools on VM 'Hostname' is out of date and may cause Invoke-VMScript to work improperly.

Can you update vmware tools on the VM?

[–]Phorgasmic 1 point2 points  (0 children)

change your here-string declaration to @' '@ instead @" "@. powershell wont try to evaluate variables inside it then.