##### Below is a script to Configure Sharepoint Foundations 2013 on Server 2012 or 2012 R2 (Installation on Server 2012 R2 requires the SP1 Package) #####

##### No edit is required to the script, execute the script on the server where Sharepoint Foundations 2013 is installed and enter information when prompted. ######

##### You can also enter this code in sections if desired #####

###### Download Sharepoint Foundations 2013 SP1 Here ######

##### Copy Script below Red Highlighted Text, or download attached script #####


 

 

 

##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

function Prompt-ForInput
{
 Param($message)
 $success = "n"
 while($success -ne "" -and $success.ToLower() -ne "y")
 {
  $val = Read-Host $message
  $success = Read-Host "You entered: $val. Is this correct? Enter y or n"
 }
 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
$svcFIMPool = Prompt-ForInput "Enter the FIM Service Pool"
$FarmAdminUser = Prompt-ForInput "Enter the Farm Account"
$SecFarmAdmin = Prompt-ForInput "Enter the Secondary Site Administrator"
$Site = "http://" + $(Prompt-ForInput "Enter the site url")

##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 username 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 80 -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
$SPSite = SPSite("http://FIMPortal")
$SPSite.AllowSelfServiceUpgrade = $false