Pregunta89
Contributor
Contributor

Problems updating VMtools for multiple VMs

Jump to solution

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!

0 Kudos
1 Solution

Accepted Solutions
RvdNieuwendijk
Leadership
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

View solution in original post

0 Kudos
2 Replies
RvdNieuwendijk
Leadership
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

View solution in original post

0 Kudos
Pregunta89
Contributor
Contributor

Thanks! Silly me on syntax.

0 Kudos