-
Notifications
You must be signed in to change notification settings - Fork 1
/
New-UserProfileService.ps1
58 lines (47 loc) · 1.74 KB
/
New-UserProfileService.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<#
.SYNOPSIS
Creates New UPA avoiding Default Schema Issue
.DESCRIPTION
Still important despite removal of UPS in SP 2016+
25/06/2015
.NOTES
File Name : New-UserProfileService.ps1
Author : Spencer Harbar ([email protected])
Requires : PowerShell Version 2.0
.LINK
.PARAMETER File
The configuration file
#>
#region PARAMS
param (
[String]$Server,
[String]$SaAppPoolName,
[String]$UpaName,
[String]$UpaProfileDBName,
[String]$UpaSocialDBName,
[String]$UpaSyncDBName,
[String]$MySiteHost
)
#endregion PARAMS
#region MAIN
try {
If ((Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -EA 0) -eq $null) { Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" }
<# Creates UPA Service Application & Proxy, and User Profile Service Instance
If omitted, -ProfileSyncDBServer, -SocialDBServer & -ProfileDBServer are the SharePoint Default DB Server
If omitted, -SyncInstanceMachine is the local machine
#>
Write-Host "$(Get-Date -Format T) : Creating $UpaName Application & Proxy..."
$Upa = New-SPProfileServiceApplication -Name $UpaName -ApplicationPool $SaAppPoolName `
-ProfileDBName $UpaProfileDBName -SocialDBName $UpaSocialDBName `
-ProfileSyncDBName $UpaSyncDBName -MySiteHostLocation $MySiteHost
$UpaProxy = New-SPProfileServiceApplicationProxy -Name "$UpaName Proxy" -ServiceApplication $Upa -DefaultProxyGroup
Write-Host "$(Get-Date -Format T) : Created $UpaName Application & Proxy!" -ForegroundColor Green
}
catch {
Write-Host "OOOPS! We failed during creating UPA on $server." -ForegroundColor Red
$_
Exit
}
#endregion MAIN
#EOF