FIM PowerShell Management Agent - the object reference not set to an instance of an object

Hi There

I've been running into the following problem when trying to import from my Management Agent, based on Soren Granfeldt's PowerShell MA. In FIM it says "stopped-extensible-extension-error". 

The log contains the following text (and some more which I figured wasn't important for my issue):

07.09.2015 06:11:08: Invoking import script: d:\daten\xml-agent\import.ps1
07.09.2015 06:11:08: Should impersonate: False
07.09.2015 06:11:10: Page token returned: ''
07.09.2015 06:11:10: Custom data returned: ''
07.09.2015 06:11:10: Object(s) in pipeline: 2
07.09.2015 06:11:10: System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
07.09.2015 06:11:10: Leave InvokeImportEntryWorker->GetImportEntries

Der Objektverweis wurde nicht auf eine Objektinstanz festelegt is German for "the object reference not set to an instance of an object"

This is  my import-script:

param 
(
	$Username = "",
	$Password = ""
)

[xml]$content = Get-Content -Encoding UTF8 -Path "D:\daten\XML-Agent\Export.xml"
$mitarbeiter = $content.SelectNodes("/Header/MITARBEITER_LISTE/item")


foreach ( $item in $mitarbeiter ){
    $name = $item.NAME
    $vorname = $item.VORNAME
    $persnr = $item.PERSONALNR
    
    
    $obj = @{}
    $obj.Add("id", "$persnr")
    $obj.Add("sn", "$name")
    $obj.Add("givenName", "$vorname")
	$obj.Add("objectClass","user")
    $obj
}

This is my schema-script:

$obj = New-Object -Type PSCustomObject
$obj | Add-Member -Type NoteProperty -Name "Anchor-id|String" -Value "123456"
$obj | Add-Member -Type NoteProperty -Name "objectClass|String" -Value "person"
$obj | Add-Member -Type NoteProperty -Name "givenName|String" -Value "Peter"
$obj | Add-Member -Type NoteProperty -Name "sn|String" -Value "Muster"
$obj

I will appreciate any advice to solve my problem.
Thanks


September 7th, 2015 2:15am

Hello (Hallo) Rafael,

the scripts look clear and fine to me, a simple Scenario.

I assume the issue is because  some data in the XML, can you post the some sampledata of that file.

/Peter

Free Windows Admin Tool Kit Click here and download it now
September 7th, 2015 3:06am

Hallo Peter

<?xml version="1.0" encoding="UTF-8"?>

-<Header>


-<MITARBEITER_LISTE>


-<item>

<PERSONALNR>020203</PERSONALNR>

<NAME>Test2</NAME>

<VORNAME>User2</VORNAME>

<TAETIGKEIT>Stationsleitung</TAETIGKEIT>

<BESCHAEFTGRAD>80</BESCHAEFTGRAD>

<KS_Nr>113606</KS_Nr>

<KS_Bezeichnung>SO Station 2G</KS_Bezeichnung>

<ORGANTEIL> 100.00</ORGANTEIL>

<MANDID>SO10</MANDID>

<GEBDATUM>19790716</GEBDATUM>

<AUSTRITT/>

</item>


-<item>

<PERSONALNR>010203</PERSONALNR>

<NAME>Test</NAME>

<VORNAME>User</VORNAME>

<TAETIGKEIT>Stationsleitung</TAETIGKEIT>

<BESCHAEFTGRAD>80</BESCHAEFTGRAD>

<KS_Nr>113606</KS_Nr>

<KS_Bezeichnung>SO Station 2G</KS_Bezeichnung>

<ORGANTEIL> 100.00</ORGANTEIL>

<MANDID>SO10</MANDID>

<GEBDATUM>19790716</GEBDATUM>

<AUSTRITT/>

</item>

</MITARBEITER_LISTE>

</Header>

This is what the XML looks like.


September 7th, 2015 3:10am

Hello Rafael,

the XML Looks even fine to be, so i take another look on the PS scripts.

In Schema you define objectClass to "Person" but in the Import script you set "User" as the objectClass, so I think that would be your Problem.

/Peter

Free Windows Admin Tool Kit Click here and download it now
September 7th, 2015 3:16am

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

Other recent topics Other recent topics