Contributor

## Problems updating VMtools for multiple VMs

I know this is an old post, but I seem to be having troubles. I am extremely new to powershell, so forgive me.

My code is nearly the same, minus the obvious. I am throwing an couple terminator errors. What am I missing?

Get-Content -C:\VM\VMs.txt | '

ForEach-Object {Update-Tools -VM $_} In my VM text document, I have one servername and that's it. Error message received: The string starting: At C:\VM\test.ps1:1 char 30 + Get-Content -C:\VM\VMs.txt | <<<< ' is missing the terminator: '. At C:\VM\text.ps1:2 char:48 +ForEach-Object [Update-tools -VM$_} <<<<

+CategoryInfo          : ParserError: (

Foreach-Objec...M $_}:String) [], ParseException + Fully QualifiedErrorId : TerminatorExpectedAtEndOfString Any help would be great, thanks! 1 Solution Accepted Solutions Leadership The last character in the first line needs to be the back tick  instead of the single quote '. The minus sign before the path should not be there. Get-Content C:\VM\VMs.txt |  ForEach-Object {Update-Tools -VM$_}

Regards, Robert

Message was edited by: RvdNieuwendijk

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
2 Replies

The last character in the first line needs to be the back tick  instead of the single quote '.

The minus sign before the path should not be there.

Get-Content C:\VM\VMs.txt |

ForEach-Object {Update-Tools -VM \$_}

Regards, Robert

Message was edited by: RvdNieuwendijk

Blog: https://rvdnieuwendijk.com/ | Twitter: @rvdnieuwendijk | Author of: https://www.packtpub.com/virtualization-and-cloud/learning-powercli-second-edition
Contributor

Thanks! Silly me on syntax.