REST API Data collect Issue through PowerShell

fabio_Lucci
New Contributor

Hi There,

I face a problem to collect Computers "Running Services" or "Application names" through REST API call with a PowerShell Script.

Basically, i can fetch computers datas when there are not duplicated but for instance as there are generally several "Running Services" or "Application names" it does not retrieve it and i get these datas instead "System.Objet[]"

Can anyone help me please ?

Many thanks

3 REPLIES 3

psliequ
Contributor III

Try piping the output of the call to

Out-String.Trim()

That will convert what you got into strings that you can view as text.

tlarkin
Honored Contributor

yup most OOP languages will store API calls as objects, which you can typically call some sort of built in to print the text.

allanp81
Valued Contributor

As tlarkin says, powershell will output it as an object, in this case it'll be an array of objects so you'll have to loop through it etc. to get what you want.