开发者

Iterate Data Returned from Web Service in PowerShell

I've written a PowerShell script to call a Web Service using the new PS 2.0 commands. I would like to know how to iterate the $events result. The code works in returning data, I'm just not sure what the result data type is or how to iterate thru it.

Here's the code:

#connect to web service
$ap = New-WebServiceProxy -Uri http://cantreallygiveyouthis/api/services/data?wsdl

#specify event params
$params = New-Object Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy3ices_AlarmPointWebService_wsdl.EventSearchParameters
$params.datasource  =  "runtime"
$para开发者_运维百科ms.startDate  =  "01/09/2011 3:00:00 PM"
$params.endDate  =  "01/09/2011 3:15:00 PM"

#call web service
$events = $ap.FindEvents("username", "pass", "", "", "", ":)", $params)


The obvious choice would be $events | Get-Member or $events[0] | Get-Member to find out what's available to you. $events[0].Gettype() can be useful as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜