The command helps in various configuration scenarios for example if you were to configure user profile service application using install account but actual service provisioning should happen under farm account. In such case, the code block that provisions service application and synchronization service should be run under farm account.
Here is code snippet. This approach is better than launching a separate process also it runs commands in background without interacting with current user session.
$init = {Add-PSSnapIn Microsoft.SharePoint.Powershell} $sb = { #powershell code to provision user profile service application } # fetch farm account $farmaccount = (Get-SPFarm).DefaultServiceAccount $cred = Get-Credential $farmaccount.Name $job = Start-Job -ScriptsBlock $sb -Credential $cred -InitializationScript $init $job | wait-job | receive-job
I will expand this topic and give you more code samples when I discuss User Profile Service Application provisioning.
Hope this helps !
Majid
2 comments:
Nice, thanks. waiting to get your code samples...
Ah, I have used this command before but not in User Profiles case.
Good work !
Post a Comment