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"
$params.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-Memberor$events[0] | Get-Memberto find out what’s available to you.$events[0].Gettype()can be useful as well.