I'm using the built in SCSM cmdlets and the SMlets powershell module. I'm able to query Service Requests, but I can't seem to figure out how to get the Affected User of a given Service Request. I'm getting service requests in the following manner:
Import-Module SMlets -ErrorAction Stop
$SCSMclassSR = Get-SCSMClass -Name System.WorkItem.ServiceRequest
$SCSMobject = Get-SCSMObject -Class $SCSMclassSR
If you select any given ticket and run a Get-Member
on it you can view the list of properties. None of which are mapping back to the Affected User. Thinking perhaps the ticket data is saved with the user object, I ran the following code:
$scsmuser = Get-SCSMObject -Class (get-scsmclass -name microsoft.ad.user) -filter "UserName -like <username>"
None of the properties there appear to map to any tickets (run a gm on it too). Granted, this could be ignorance on my part and the method to produce the tickets just isn't aptly named or described.
I've tried looking at the SMlets source code to glean some insight, but I'm not a C# developer so some of it goes over my head. I've also tried to get some understanding and help from the msdn page for EnterpriseManagementObject Class, but to no avail.
Hopefully there's a really simple solution to this and I'm just over thinking it. But, how do you get the Affected User for a SCSM ticket using powershell? Preferably a service request ticket.