Skip to main content
Question

REST API Data collect Issue through PowerShell

  • April 15, 2020
  • 3 replies
  • 33 views

Forum|alt.badge.img+1

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

Forum|alt.badge.img+13
  • Contributor
  • April 15, 2020

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.


Forum|alt.badge.img+31
  • Honored Contributor
  • April 20, 2020

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


Forum|alt.badge.img+11
  • Valued Contributor
  • April 23, 2020

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.