Cannot add a user with a datetime using PowerShell
Hello,
I'm a beginner in FIM and in PowerShell. I have a FIM portal, where I have of course some users created via Graphic interface. I would like to do the same but with a powershell script. I have already seen the Markus Vilcinskas tutorial on how
to create user in FIM portal and it's running.
Indeed when I write this :
PS C:\Users\CA000016\Desktop> .\creationUtilisateur.ps1 "DisplayName:Britta Simon|FirstName:Britta|LastName:Simon|AerMatricule:0"
It runs
But when I want to write Date and time field, I have this error :
PS C:\Users\CA000016\Desktop> .\creationUtilisateur.ps1 "DisplayName:Britta Simon|FirstName:Britta|LastName:Simon|AerMatricule:0|AerBirthdate:2010-12-20T08"
SourceObjectIdentifier : 9a1c797c-fd3f-4807-90a6-df38cb57539c
TargetObjectIdentifier :
ObjectType : Person
State : Create
Changes : {DisplayName, FirstName, LastName, AerBirthdate}
AnchorPairs :
Import-FIMConfig : Failure when making web service call.
SourceObjectID = 9a1c797c-fd3f-4807-90a6-df38cb57539c
Error = System.InvalidOperationException: Operation is not valid due to the current state of the object.
at Microsoft.ResourceManagement.WebServices.Client.Attribute.FormatFragmentValue(AttributeDefinition attributeDefini
tion, LocaleAwareClientHelper localePreferences, Object value)
at Microsoft.ResourceManagement.WebServices.Client.SelectableAttribute.ToFragment(LocaleAwareClientHelper localePref
erences, Object value)
at Microsoft.ResourceManagement.WebServices.Client.ResourceTemplate.CreateResource(Guid identifier, String synchroni
zationSequenceIdentifier)
at Microsoft.ResourceManagement.WebServices.ResourceManager.CreateResource()
at Microsoft.ResourceManagement.Automation.ImportConfig.Create(String objectType, List`1 changeList)
at Microsoft.ResourceManagement.Automation.ImportConfig.EndProcessing()
At C:\Users\CA000016\Desktop\creationUtilisateur.ps1:70 char:29
+ $newUser | Import-FIMConfig <<<< -uri $URI
+ CategoryInfo : InvalidOperation: (:) [Import-FIMConfig], InvalidOperationException
+ FullyQualifiedErrorId : ImportConfig,Microsoft.ResourceManagement.Automation.ImportConfig
I have already tried with different type of date such as [Datetime]"1/1/1950 12:00:00 AM" beacause when I write directly in graphic interface of FIM portal this date for this user it runs.
I have seen these links :
http://social.technet.microsoft.com/Forums/en-US/ilm2/thread/60159f17-b308-495a-a0c1-95d7e14be33a/
http://www.identitychaos.com/2010/01/fim-2010-contributing-datetime-values.html
http://social.technet.microsoft.com/Forums/en-US/ilm2/thread/c9d0caa4-64d0-49b5-bdb1-aab3112c66e1
http://blogs.msdn.com/b/imex/archive/2008/12/14/sample-scenario-get-ilm-schema.aspx
http://www.identitychaos.com/2010/03/fim-2010-registering-fimautomation.html
Could you help me to solve my problem. thanks in advance.
Faithfully
April 27th, 2011 8:01am
Hi,
I have the same issue.
In my case, I use Technet FIM migration scripts. I have a production platform and a test platform. The goal is to export production users and import them into test FIM Portal. For users without EmployeeStartDate and EmployeeEndDate, FIM import works
fine, but, for other users,I have an issue.
When I export Users in a XML File, Date Attributes look like "DD/MM/YYYY HH:MM:SS"
I already seen on forums that FIM portal want another type of Date : "YYYY-MM-DDTHH:MM:SS.000"
I tried to write directly in XML file this type of date but I still have an issue during import.
I tested several type of date in xml with no success.
Thanks
Victor
Free Windows Admin Tool Kit Click here and download it now
April 28th, 2011 5:51am
Hi,
I have the same issue too. I've seen this link :
http://msdn.microsoft.com/en-us/library/ee652239.aspx
For me my problem is with the birthdate attribute. When I create users in FIM portal,I have an error about the datetime.
But I don't know if I have to create an xml file with the same things
than on the link (but here I don't know both how to create this file, where have I to put it (in which directoty))
or perhaps there is a method to write this attribute correctly.
I tried this but it doesn't run :
$da=Get-Date -UFormat '%Y-%m-%dT%H:%M:%S'
SetAttribute -object $newUser -attributeName $attName -attributeValue $da
Have you a solution ?
thanks
May 2nd, 2011 12:00pm
Hi,
I have the same issue too. I've seen this link :
http://msdn.microsoft.com/en-us/library/ee652239.aspx
For me my problem is with the birthdate attribute. When I create users in FIM portal,I have an error about the datetime.
But I don't know if I have to create an xml file with the same things
than on the link (but here I don't know both how to create this file, where have I to put it (in which directoty))
or perhaps there is a method to write this attribute correctly.
I tried this but it doesn't run :
$da=Get-Date -UFormat '%Y-%m-%dT%H:%M:%S'
SetAttribute -object $newUser -attributeName $attName -attributeValue $da
Have you a solution ?
thanks
Free Windows Admin Tool Kit Click here and download it now
May 2nd, 2011 12:00pm
Hi Jean,
There is a bug with importing DateTimes using RTM bits. This issue was fixed in CTP.
Billy
May 2nd, 2011 2:08pm
Hello,
from
what
I saw,
CTP
is an
update of
FIM, (isn't it ? I make perhaps a mistake),
but
when is
it out?
Is
it possible to
have it
now in
beta version?
Thank you
for your
answers. Jean-Michel
Free Windows Admin Tool Kit Click here and download it now
May 3rd, 2011 4:02am
Hi,
I summarize and answer to the problem.
The
FIM PowerShell
Add-in
can not write a
date
format dateTime
"FIM"
(http://msdn.microsoft.com/en-us/library/ee652239.aspx
)
using webServices
portal.
This problem
will be corrected
when
the release
of
FP1 wil be out.
Thus
the only
remaining possible solution
is
as follows and is
given
on the
Microsoft forum (link
below).
http://social.technet.microsoft.com/Forums/en-US/ilm2/thread/c9d0caa4-64d0-49b5-bdb1-aab3112c66e1
Methods
Get-and Set-FIMResource
FIMResource
are present in
the
add-in
Quest
(http://fimpscmdlets.codeplex.com/
)
that must be installed
via
the following procedure:
http://social.technet.microsoft.
com/Forums/en-US/ilm2/thread/23232d61-67f9-43c9-885c-e0a37e9f9d8a
Be careful, use
the
"Run
As Administrator"to
open
PowerShell.
And
from there everything
goes
as expected.
Sincerely,
Jean-Michel
Thanks Again.
May 3rd, 2011 11:51am