Feb 242016
Have you ever looked at director and saw a user had a very long login, and wondered how the hell you could find out who that was? I wrote a script to help you out a bit!
Here is the script
Read it! There are places you will have to edit to allow it to run in your environment. Search for ##### to find the spots to pay attention to.
In the end it will output a .htm file to your my documents\logon_logs and open after it finishes.
Note: I have no idea if this works for XA, but I know it works for XD 7.6
when i run your script i get the follow error
Get-Date : Cannot bind parameter ‘Date’ to the target. Exception setting “Date”: “Object reference not set to an instance of an object.”
At C:\scripts\create_loginreport.ps1:160 char:110
+ … | ?{((get-date ($_.startdate.”#text”)) -ge $start) -and (([int]$_.logonduration. …
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Get-Date], ParameterBindingException
+ FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.PowerShell.Commands.GetDateCommand
What version of XenDesktop are you using?
currently using 7.8
This script was written for 7.6 FP2. They may have changed some things in the ODATA.
from some of the debuging i have done it looks like true is being passed at the get-date statement on line
$sessions = (invoke-restmethod -uri ($base+”Sessions”) -Credential $creds).content.properties | ?{((get-date ($_.startdate.”#text”)) -ge $start) -and (([int]$_.logonduration.”#text”) -ge $max)}
i am not able to run this script can you help me for that I am using 7.8.