Sharepoint Foundations 2013 Configuration Script
### Script Verified 26 August 2016 ###
## This script can be used with the FIM / MIM Preperation Script , The Preparation script is not required and to use this script with out the preparation script just Type "No" when prompted with with the question "Was the MIMPrep tool used to create Service Accounts Yes or No" ##
The Following Script can be used to configure SharePoint Foundation 2013 for use with the FIM / MIM Portal.
NOTE: The FIM / MIM Portal CAN NOT be installed with Claims Based Authentication which is configured by default when you first deploy SharePoint Foundations 2013 / SP1To run this script you may need to run from PowerShell as an Administrator as well as the Server mus
- On the Server you wish to configure SharePoint 2013 Foundations open up PowerShell as an Administrator
- Verify that the Server can load the Active Directory and SharePoint PowerShell Modules
- Verify that you have the Following information which you will be prompted for during the Configuration
- SharePoint Pool Service Account
- Primary Site Administrator Account
- Secondary Site Administrator Account
- Name of Base Site you wish to configure, this will also be used during the install of the FIM Portal
- The Port that this Site will be hosted on
- Its also important to note that you will be initially ask if the MIM Prep Tool was used at this time Type No and for verification type Y.
NOTE:
For all Prompts type "Yes" or "No" and for all Verification Type "1" for Yes or "2" for No.
When copying and pasting the following script be sure to verify that all " quotes copy correctly as well as the following "STS#0" is not converted with other characters.
### Script Updated 15 March 2015 ###
##This first line only needs to be run if you’re not running the SharePoint 2013 Management Console.
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue
## to Verify if Microsoft.Sharepoint.Powershell has been added
# Get-PSSnapin
function Prompt-ForInput
{
Param($message)
$success = "n"
while($success -ne "" -and $success.ToLower() -ne "1")
{
$val = Read-Host $message
$success = Read-Host "You entered: $val. Is this correct? Enter the #1 for Yes or the # 2 for No"
}
return $val
}
##All sections highlighted in Pink are currently not in use
##This next block of code sets your variables the script will need to build your SharePoint Site
## Below you will need to know the following information
## NetBIOS Domain name
## The account that will be used run the actual website
## An account that will be used as a Farm Administrator
$Domain = $(Get-ADDomain).Name
$Prep = Prompt-ForInput "Was the MIMPrep tool used to create Service Accounts Yes or No"
$MIMPrep = $Prep.ToLower()
if($MIMPrep -eq "yes")
{
#### Import Feeder File
##########################################################################
#[Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
Add-Type -assemblyName "System.Windows.Forms" #use this instead of loadwithpartialname
$dialog = New-Object -TypeName System.Windows.Forms.OpenFileDialog
$dialog.AddExtension = $true
$dialog.Filter = 'CSV file (*.csv)|*.csv|All Files|*.*'
$dialog.Multiselect = $false
$dialog.FilterIndex = 0
$dialog.InitialDirectory = "$HOME\Documents"
$dialog.RestoreDirectory = $true
$dialog.ShowReadOnly = $true
$dialog.ReadOnlyChecked = $false
$dialog.Title = 'Select Pre Req CSV file'
$result = $dialog.ShowDialog()
if ($result -ne 'OK')
{
#return
Exit 1 #exit is more appropriate in this case and then you can also give a non-zero return code
}
$accts = Import-Csv $dialog.FileName
$svcFIMPool = ($accts | where-object{$_.variable -eq "MIMSPPool"}).SamAccountName
if(!$svcFIMPool)
{
$svcFIMPool = Prompt-ForInput "Enter the SharePoint Application Pool Service Account"
}
$FarmAdminUser = ($accts | where-object{$_.variable -eq "MIMAdmin"}).SamAccountName
if(!$FarmAdminUser)
{
$FarmAdminUser = Prompt-ForInput "Enter the Primary Site Collection Administrator Account"
}
$Site = "https://" + $($accts | where-object{$_.variable -eq "Site" -and $_.Type -eq "MIM"}).DisplayName
if(!$Site)
{
$Site = "https://" + $(Prompt-ForInput "Enter the site Url, Note: what ever is entered here will be used when Installing the FIM Portal")
}
$SecFarmAdmin = ($accts | where-object{$_.variable -eq "MIMSecAdmin"}).SamAccountName
if(!$SecFarmAdmin)
{
$SecFarmAdmin = Prompt-ForInput "Enter the Secondary Site Administrator Account"
}
$Port = ($accts | where-object{$_.variable -eq "Site"}).Value
if(!$Port)
{
$Port = Prompt-ForInput "Enter the Port Number to be set for the FIM Portal"
}
}
elseif($MIMPrep -eq "no")
{
# $svcFIMPool = "svcFIMSPPOOL"
$svcFIMPool = Prompt-ForInput "Enter the SharePoint Application Pool Service Account"
# $FarmAdminUser = "svcFIMAdmin"
$FarmAdminUser = Prompt-ForInput "Enter the Primary Site Collection Administrator Account"
# $Site = "FIMPortal"
$Site = "https://" + $(Prompt-ForInput "Enter the site Url, Note: what ever is entered here will be used when Installing the FIM Portal")
# $SecFarmAdmin = "Administrator"
$SecFarmAdmin = Prompt-ForInput "Enter the Secondary Site Administrator Account"
# $Port = 80
$Port = Prompt-ForInput "Enter the Port Number to be set for the FIM Portal"
}
##The next block of code sets the credentials being used to create the site
New-SPManagedAccount -Credential (Get-Credential -Message "FIMSPFPoolAccount" -UserName "$Domain\$svcFIMPool")
##A pop up will appear for you to type in the Password of the account that was set as the variable of $svcFIMPool
##You may need to correct the user name in the following format DOMAIN\ACCOUNT NAME
##Enter the Password in the window
##The next block of code will create the application pool
New-SPServiceApplicationPool -Name FIMSPFPool -Account $svcFIMPool
##This next block of code This creates a Web application that uses classic mode windows authentication
New-SPWebApplication -Name "FIM" -Url $site -Port $port -SecureSocketsLayer:$false -ApplicationPool "FIMSPFPool" -ApplicationPoolAccount (Get-SPManagedAccount $($svcFIMPool)) -AuthenticationMethod "Kerberos" -DatabaseName "FIM_SPF_Content"
##This block of code creates the creates the SP Site
New-SPSite -Name "FIM" -Url $Site -CompatibilityLevel 14 -Template "STS#0" -OwnerAlias $FarmAdminUser
##This next block of code sets Secondary Site Administrator
Set-SPSite -Identity $Site -SecondaryOwnerAlias "$Domain\$SecFarmAdmin"
##This block of code disables server side view state which is required for FIM
$contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$contentService.ViewStateOnServer = $false
$contentService.Update()
##This last block of code disables self-service upgrade to 2013 Experience mode
#2013 Experience mode is not supported by FIM
##Old Block of Code $SPSite = SPSite("https://FIMPortal")
$SPSite = Get-SPSite $Site
$SPSite.AllowSelfServiceUpgrade = $false
## https://blogs.msdn.com/connector_space ##
Troubleshooting notes:
In case your having issues running this script verify the following
1. Active Directory Module is installed
2. Verify that you have copied the text correctly and verify that all quotes are correct you may need to replace the quotes.
3.The following line often does not copy over correctly
New-SPSite -Name "FIM" -Url $Site -CompatibilityLevel 14 -Template "STS#0" -OwnerAlias $FarmAdminUser
Comments
Anonymous
October 03, 2014
Recently Updated to clarify accounts needed during prompts.Anonymous
April 12, 2016
FIMDevil - Dude! This is awesome! It saved quite a bit of time and, with the previous instructions, allowed me to "nail it!" in 4 1/2 hours. Prior to that I had been working on the installation over 3 days, struggling particularly with the prerequisite installation on Windows Server 2012 R2. One of my colleagues was able to follow this, particularly prerequisite documents 6, 7, and 8 to get this installed.There was a small issue where my computer decided to change the " to a ?, possibly because it did not like that different style of quote when I pasted it into Notepad and into ISE. Powershell likes " but not ” or “, apparently. It reminds me of a cat that will eat stinky seafood cat food but won't touch the shrimp in it, using her claw to drag it off the plate and throw it on the floor in disdain and discust. Contemptful kitties! ...I digress...This was one of the lines affected as an example:New-SPSite -Name "FIM" -Url $Site -CompatibilityLevel 14 -Template “STS#0″ -OwnerAlias $FarmAdminUserOnce I put the quotes in place everything worked magically.Thank you and Kristopher for publishing the install and configuration documents to the world. Thanks for the script. One day PowerShell and BASH on Windows will automate us infrastructure geeks out of a job.Anonymous
May 17, 2016
The comment has been removedAnonymous
August 26, 2016
@Robert is correct, the script was written with that idea that most people didn't like typing in DOMAIN\ACCOUNT as far as not entering http:// this is interesting because I never would have thought that anyone would, not saying your wrong to do so more as an amateur developer I need to learn to write code / scripts to accommodate all scenarios thanks for pointing this outAnonymous
June 09, 2017
Hi Anthony, I am planning to use SharePoint Foundation 2016 on Window 2016 OS (with SQL2016). Can this configuration script be used for SharePoint Foundation 2016 prep prior to setting up MIM2016SP1?- Anonymous
June 09, 2017
As soon as I can I will test this out, I been working on some new stuff but I am definitely curious. If you try it before I post an update let me know
- Anonymous