Skip to main content
Question

REST API Data collect Issue through PowerShell


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
  • 146 replies
  • 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
  • 2721 replies
  • 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
  • 324 replies
  • 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.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings