FIM 2010: PowerShell get an object without specifying the type

You know that I use the Lithnet PS for almost all my PS activities (I think I said that before? 🙂 well you will hear it again – chuckle). I am currently working on a new FIM reporting tool which I will share when finished. I come across a situation where I will read a request and then break down the number of attribute updates within that single request into individual single records. Now if it is a guid value, I know that its update to a reference field like Manager for Person or adding a Group as member to a group.

The request does not tell me the object type of each item within the request. I want to get the Display name of the guid object. I want to show that “John Brown” was added as manager to Tom Smith, not “25177e5b-2122-43a5-aee3-e9aa456747bc” was added as manager. But in FIM PS you need to specify the object type. Well not in Litnet PS, it figures it out by itself. So all i had to do was

# Get a resource by its object ID
#Set the variable to GUID
$MyGuid = [GUID]("7fb2b853-24f0-4498-9534-4e10589723c4")
#get the resource
$obj = Get-Resource -ID $MyGuid 
$ObjDn= $Obj.DisplayName 

Makes it a whole lot easier.