Jump to content
Welcome to our new Citrix community!
  • 0

Is there a way i can execute the Odata query in powershell to acheive something that i am unable to do via powershell itself as there are no required paramaters


Shruthi Keerthi S

Question

Is there a way i can execute the Odata query in powershell to acheive something that i am unable to do via powershell itself as there are no required paramaters

 

i wanted to execute this odate query saved in citrix director using powershell

could someone please help me with this

 

details:

querying citrix director to get the list of client connection failures

where in powershell i am unable to do it as the get-brokerconnectionlog does not have any parameter named filtertype that accepts Client connection failures as input

 

Thanks

Shruthi

Capture.JPG

Link to comment

1 answer to this question

Recommended Posts

  • 1

You can query OData API with PowerShell and Invoke-RestMehtod:

(Don't know if this query will work instantly. Maybe you start with a more easy one :-))

$StartDate = '2022-07-05T11:26:04'
$EndDate =  '2022-07-05T13:26:04'

$ODataQuery = 'http://{0}/Citrix/Monitor/OData/v4/Data/Connections?`$filter=LogonStartDate ge datetime''{1}'' and LogOnStartDate le datetime''{2}'' and Session/Failure/Category eq 1&`$select=Session/User/UserName,BrokeringDuration,Session/Machine/Name,Session/Failure/Category&`$expand=Session/User,Session/Machine,Session/Failure' `
    -f $env:COMPUTERNAME, $StartDate, $EndDate

$ODataOutput = Invoke-RestMethod -Uri $ODataQuery `
    -UseDefaultCredentials |
        Select-Object -ExpandProperty Value

$ODataOutput

 

  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...