Get-Content not work in the pipeline

Hello everyone, I’m new to the forum
I’m studying Powershell
I have a problem that will surely be stupid, but I don’t understand:

PS C:\> Get-Content c:\tmp\DC.txt
srvfindc01
srvfindc02
srvfindc03
srvfindc04


PS C:\> Get-WmiObject win32_operatingsystem -ComputerName (Get-Content c:\tmp\DC.txt) -AsJob

Get-WmiObject : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Provide an argument that is not null or empty, and then try the
command again.
At line:1 char:51
+ ... ratingsystem -ComputerName (Get-Content c:\tmp\DC.txt) -AsJob
+                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Get-WmiObject], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.GetWmiObjectCommand

PS C:\>

Why?

@Bubariko Welcome to PowerShell.org forums.

Its probably due to empty lines in the text file. Make sure there are no empty lines and spaces on line endings when you have server names in a text file.

PS: You can format the code using the example in below link.

What a shame! it was just that! :confounded: