This was a pain figuring out so many posts were wrong. Thanks to Jasper (http://blog.repsaj.nl/?p=258) for the corrections needed to get this working. I am very close to having my FIM 2010 implementation call the SharePoint 2010 FIM run profiles and then compile all the audiences on a more than once a day schedule.
Update 2011-11-17: Small change, I couldn't get the compile all call to work, so I resorted to compiling each individually.
Update 2011-11-17: Small change, I couldn't get the compile all call to work, so I resorted to compiling each individually.
- Add-PSSnapin Microsoft.SharePoint.PowerShell
- $AUDIENCEJOB_START = '1'
- $AUDIENCEJOB_INCREMENTAL = '0'
- $site = Get-SPSite 'https://www.mywegmansconnect.com'
- $context = Get-SPServiceContext $site
- $proxy = $context.GetDefaultProxy([Microsoft.Office.Server.Audience.AudienceJob].Assembly.GetType('Microsoft.Office.Server.Administration.UserProfileApplicationProxy'))
- $applicationId = $proxy.GetType().GetProperty('UserProfileApplication', [System.Reflection.BindingFlags]'NonPublic, Instance').GetValue($proxy, $null).Id.Guid
- $auManager = New-Object Microsoft.Office.Server.Audience.AudienceManager $context
- $auManager.Audiences | Sort-Object AudienceName | Select-Object @{Name='Audience';Expression={$_.AudienceName}},@{Name='ReturnValue';Expression={[Microsoft.Office.Server.Audience.AudienceJob]::RunAudienceJob(@($applicationId, $AUDIENCEJOB_START, $AUDIENCEJOB_INCREMENTAL, $_.AudienceName))}} | ft -auto
I use http://fimeventbroker.com in the non-SharePoint sync world to perform FIM 2010 run profiles on demand, based on detected changes in the source systems (HR, AD, etc.). This tool can run the FIM sync service for SharePoint using the same paradigm, and fire your powershell script after every legitimate update to SharePoint. I am just working on setting exactly this scenario in a lab. Interested?
ReplyDelete