Basic question using Invoke-RestMethod


i trying rest call retrieve logs esri environment.

code snippet..

            $url              $result = invoke-restmethod -uri $url  -usedefaultcredentials |select-object endtime,logmessages              "result"              $result              "result.endtime"              $result.endtime              "result.logmessages"              $result.logmessages              "end debug"

result ..

http://xxx/admin/logs/query?....&f=pjson

result

endtime         logmessages                                                                        

 -------         -----------                                                                        

1436011287194   {@{type=fine; message=active directory details/statistics: time user 'inte...

result.endtime

1436011287194

result.logmessages

                                                                                                                                                                         

                                                                                                                                                                         

end debug

----------------------

so

result in object 2 fields (as expected)

the first field straightforward (as expected)

the second field sort of array sort of hash  table (forgive ignorance"). contents expected

a display of $result.endtime produces expected result

a display of result.logmessages produces 2 blank line ( expecting 2 array elements)

what required code display result.logmessages

   

saturday, july 04, 2015 12:19 pm

$result.logmessages | convertfrom-json

or

$result | convertfrom-json


\_(ツ)_/




Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Can no longer user MS Update - Files required to use Microsoft Update are no longer registered

How do a find data in one file, search for it in another file and if not found, write a custom message to another file