About Me

Having 12 years experience in Microsoft technologies.Since more than 7 years working in SharePoint technologies. Expert in providing consultation for SharePoint projects. Hands on with development and administration.

Tuesday 9 April 2013

Provision SP 2010 - User Profile Application Service using PowerShell script

Following powershell script will provision UPA service.

Points to be noted:

1. Update $UserProfileServiceAccount with the account with respect to your environment.

2. Save the follwing script on some meaningful name like psProvisionUserProfileService.ps1

3. Call the file using bacth file & it contains follwoing and save as ProvisionUserProfileService.bat

cd /d %~dp0
powershell -noexit -file    ".\psProvisionUserProfileService.ps1" "%CD%"
pause


Add-PSSnapin Microsoft.SharePoint.Powershell -EA 0
$UserProfileServiceName ="UserProfileServiceAppPool"
$UserProfileServiceAccount = "xxxxxx"

$saAppPoolName = New-SPServiceApplicationPool -Name $UserProfileServiceName -Account $UserProfileServiceAccount

# UPA specifics
$upaInstanceName = "User Profile Service"
$upsInstanceName = "User Profile Synchronization Service"
$upaName = "User Profile Service"
$upaProfileDBName = "SP_User_Profile_DB"
$upaSocialDBName = "SP_User_Social_DB"
$upaSyncDBName = "SP_User_Sync_DB"
 

Write-Host "Creating $upaName Application & Proxy..."

$upa = New-SPProfileServiceApplication -Name $upaName -ApplicationPool $saAppPoolName -ProfileDBName $upaProfileDBName -SocialDBName $upaSocialDBName -ProfileSyncDBName $upaSyncDBName

New-SPProfileServiceApplicationProxy -Name "$upaName Proxy" -ServiceApplication $upa -DefaultProxyGroup

Write-Host "Starting the $upaInstanceName Instance..."

Get-SPServiceInstance | where-object {$_.TypeName -eq $upaInstanceName} | Start-SPServiceInstance

Write-Host " UPA Done!"

Remove-PSSnapin Microsoft.SharePoint.Powershell -EA 0
 

No comments:

Post a Comment