$UserForestMAName = "AD FIM Agent Read Domain" $ResourceForestMAName = "AD FIM Agent Write Domain" $SQLMAName = "SQL_CSV" $ResourceForestMA2ndDomain = "AD FIM Agent Write2ndDomain" $UserForestMA = @(Get-WmiObject -Class "MIIS_ManagementAgent" -Namespace "root\MicrosoftIdentityIntegrationServer" -Computername "." -Filter "Name='$UserForestMAName'") if ($UserForestMA.Count -eq 0) { Throw "User Forest Management Agent named '$UserForestMAName' not found" } $ResourceForestMA = @(Get-WmiObject -Class "MIIS_ManagementAgent" -Namespace "root\MicrosoftIdentityIntegrationServer" -Computername "." -Filter "Name='$ResourceForestMAName'") if ($ResourceForestMA.Count -eq 0) { Throw "Resource Forest Management Agent named '$ResourceForestMAName' not found" } $SQLMA = @(Get-WmiObject -Class "MIIS_ManagementAgent" -Namespace "root\MicrosoftIdentityIntegrationServer" -Computername "." -Filter "Name='$SQLMAName'") if ($SQLMAName.Count -eq 0) { Throw "Resource Forest Management Agent named '$SQLMAName' not found" } $ResourceForestMA2ndDomain = @(Get-WmiObject -Class "MIIS_ManagementAgent" -Namespace "root\MicrosoftIdentityIntegrationServer" -Computername "." -Filter "Name='$ResourceForestMA2ndDomain'") if ($ResourceForestMA2ndDomain.Count -eq 0) { Throw "Resource Forest Management Agent named '$ResourceForestMA2ndDomain' not found" } function Run-FIMProfile () { param ( [parameter(Mandatory=$true)]$ManagementAgent, [parameter(Mandatory=$true)][string]$Profile ) Write-Host ("`nStarting FIM Run Profile '" + $Profile + "' on Management Agent '" + $ManagementAgent.Name + "'") Write-Host ("Result: $($ManagementAgent[0].Execute($Profile).ReturnValue)`n") } # sequence as course told us Run-FIMProfile -ManagementAgent $UserForestMA -Profile "Delta Import" Run-FIMProfile -ManagementAgent $ResourceForestMA -Profile "Delta Import" Run-FIMProfile -ManagementAgent $UserForestMA -Profile "Delta Sync" Run-FIMProfile -ManagementAgent $ResourceForestMA -Profile "Delta Sync" Run-FIMProfile -ManagementAgent $ResourceForestMA -Profile "Export" Run-FIMProfile -ManagementAgent $ResourceForestMA -Profile "Delta Import" Run-FIMProfile -ManagementAgent $SQLMA -Profile "Export" Run-FIMProfile -ManagementAgent $SQLMA -Profile "Full Import" Run-FIMProfile -ManagementAgent $SQLMA -Profile "Delta Sync" Run-FIMProfile -ManagementAgent $ResourceForestMA2ndDomain -Profile "Delta Sync" Run-FIMProfile -ManagementAgent $ResourceForestMA2ndDomain -Profile "Export" Run-FIMProfile -ManagementAgent $ResourceForestMA2ndDomain -Profile "Delta Import" # here would FIM write his log file $File="C:\Program Files\Microsoft Forefront Identity Manager\2010\Synchronization Service\MaData\AD FIM Agent Read Domain\FIM Agent Read Domain_Delta_Import.txt" # but instead i want them over here $newFile = "C:\FIM_logs\FIM Agent Read Domain_Delta_Import-"+(get-date -uformat %Y%m%d-%H%M)+".xml" $groesse = (Get-Item $File).length if ($groesse -gt "358") { Copy-Item -verbose $File $newFile } #358 Byte is the size of the file if it has no real Entries