How to set an ObjectID to a reference object
Hi, I'm trying to modify the resourceID of an object. I have tried to do this : >$fimSession = New-FIMSession -Credential (Get-Credential) -Server localhost >New-FIMResource -Type "Resource" -Session $fimSession -Attributes @{"DisplayName"="Service2"} >$res = Get-FIMResource -Filter "/Resource[DisplayName='Service2']" -Session $fimSession DisplayName CreatedTime ExpirationTime ObjectType ObjectID ----------- ----------- -------------- ---------- -------- Service2 7/7/2011 8:15:05 AM 1/1/0001 12... Resource 69423ae1-fc47-43a2-8c18-da13d8787fed >$res.SetValue("ObjectID", "69423ae1-fc47-43a2-8c18-da13d8787fed") >Set-FIMResource -Instance $res -Session $fimSession Set-FIMResource : Object reference not set to an instance of an object. At line:1 char:16 + Set-FIMResource <<<< -Instance $res -Session $fimSession + CategoryInfo : NotSpecified: (:) [Set-FIMResource], NullReferenceException + FullyQualifiedErrorId : System.NullReferenceException,Quest.FIMPowerShellSnapin.SetIlmResource I tried to see if there is something in the events viewer, but nothing. Could we change the ResourceID of an Object ? Indeed in the GUI of my pilot FIM Portal, when I go to Adminitration -> Schema Management and click on my object named Service, and then click on advanced view, I can modify the resourceId. However in my production FIM Portal, I can't do that. Could you help me ? Thanks in advance. Jean-Michel
July 7th, 2011 5:35am

Your production might have stricter MPR's in place which do not grant your account the right permissons. However why would you want to modify the ObjectID of an object? To me this is some system managed attribute for which the system ensures it's uniqueness. What (why) are you trying to accomplish?http://setspn.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
July 7th, 2011 6:04am

I want to modify th ObjectId of an object to resolve my issue when I import the schema into my production environment. AerService Service don't exist in my production environment, I have to create it before I run SyncPolicy and Commit Changes. Indeed I would like to create manually the "AerService Service" resource with the same ID that It had in the pilot environment in order to run again CommitChanges ( Schema) and then run SyncPolicy and Commit Changes. However, that has tickled my curiosity, and I don't understand why I can't do that (Of course, by ensuring that the uniqueness is respected) ? Thanks again.
July 7th, 2011 8:28am

The configuration migration scripts do not require that you have the same object id's in the portal. That's not the case for MPR's as wel and they migrate fine. If you open up syncpolicy.ps1 script you'll see that "join rules" are listed. By default most things join based upon "display name". Suppose you have the following situation: You have a custom workflow which sends an email to "servicedesk". Servicedesk is a userobject with an email filled in. So this workflow has a reference to this userobject. Once you start migrating the configuration from test to production you'll obviously want to migrate this workflow. At first it will simply fail because one of it's "dependencies", namely the "servicedesk" user cannot be found. All you have to do is manually pre-create this user (with the same displayname) in your production environment. If you then run the syncpolicy script you will see that this displayname is listed with the object ID of the test AND production environment. This way the exportPolicy command nows how to translate this info. I hope this clears stuff up a bit. This doesn't answer your orginal question "why can't I change the object ID". But please don't do this! It's a workaround for a problem you are handling in the wrong way.http://setspn.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
July 7th, 2011 10:06am

Thanks a lot thomas, but I would like to run a migration without having to go through the GUI of FIM Portal, If it is possible, I would to do all thanks to the powershell even if I know it is not the recommanded way to do. Moreover If I must go through the GUI of FIM Portal, for each resource or specialized object that I have created in my pilot environment, in order to create them agin into my production environment, could you explain to me why we perform a migration, because then I am a little bit lost. Thanks again. P.S : Thanks and Congratulation, your explanations were very clear (even if they don't answer to my original question asked here).
July 7th, 2011 11:06am

If I'm correct only instances of objects such as groups/users/custom objects have to be kept "manually" in sync. However manually does not mean you have to use the FIM Portal. Most of us don't like clicking too. So using powershell (besides the migration scripts) to precreate some objects is a perfect valid and imo advised situation. Scripting ensures everything is done without human errors interfering. But I would again argue against interfering with the object ID. In your case you are trying to change the object ID of such a referenced object. In order for you to change it you must create the object first... Like I suggest doing in the first place. So simply leave out this additional step (change objectID) and make sure the joining goes fine. You'll find yourself in a much eassier migration process. Once you fully understand how it works, it's quit easy to perform migration. Leaving aside some side issues I seem to run in now then. A few example of bulk powershell modifications: http://social.technet.microsoft.com/wiki/contents/articles/how-to-use-powershell-to-create-a-user-in-the-fim-portal.aspx http://social.technet.microsoft.com/wiki/contents/articles/how-to-use-powershell-to-update-resources-from-a-csv-file.aspx http://social.technet.microsoft.com/wiki/contents/articles/how-to-use-powershell-to-bulk-update-the-value-of-an-attribute-for-a-certain-type.aspx http://social.technet.microsoft.com/wiki/contents/articles/how-to-use-powershell-to-create-criteria-based-security-groups-from-a-csv-file.aspx http://social.technet.microsoft.com/wiki/contents/articles/how-to-use-powershell-to-create-manager-based-distribution-lists-from-a-csv-file.aspx There's probably some more on the Technet Wiki I hope this helps you somehow :) Feel free to ask morehttp://setspn.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
July 7th, 2011 5:41pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics