PoshCode Logo PowerShell Code Repository

Create SP2010 Farm V03 by Jos Verlinde 4 years ago
View followups from samie, Samie Merzaie, Jungchan, Jungchan and Faisal | diff | embed code: <script type="text/javascript" src="http://PoshCode.org/embed/1485"></script>download | new post

Create a Sharepoint 2010 farm

  1. ############################################################################
  2. ## Create-SPFarm
  3. ## V 0.3
  4. ## Jos.Verlinde
  5. ############################################################################
  6. Param ( [String] $Farm          = "SP2010",
  7.         [String] $SQLServer     = $env:COMPUTERNAME,
  8.         [String] $Passphrase    = "pass@word1",
  9.         [int]    $CAPort            = 26101     ,
  10.     [switch] $Force         = $false )
  11.    
  12.  
  13. # Disable the Loopback Check on stand alone demo servers.  
  14. # This setting usually kicks out a 401 error when you try to navigate to sites that resolve to a loopback address e.g.  127.0.0.1
  15.  
  16. New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name "DisableLoopbackCheck"  -value "1" -PropertyType dword
  17.  
  18.  
  19.  
  20.  
  21. #region Process Input Parameters
  22.  
  23. $SecPhrase=ConvertTo-SecureString  $Passphrase –AsPlaintext –Force
  24. $Passphrase = $null
  25.  
  26. ## get Farm Account
  27. $cred_farm = $host.ui.PromptForCredential("FARM Setup", "SP Farm Account (SP_farm)", "contoso\sp_farm", "NetBiosUserName" )
  28.  
  29.  
  30. #Endregion
  31.  
  32.  
  33.  
  34. # Create a new farm  
  35. New-SPConfigurationDatabase –DatabaseName “$FARM-Config” –DatabaseServer $SQLServer –AdministrationContentDatabaseName “$FARM-Admin-Content” –Passphrase $SecPhrase –FarmCredentials $Cred_Farm
  36.  
  37. # Create Central Admin
  38. New-SPCentralAdministration -Port $CAPort -WindowsAuthProvider "NTLM"
  39.  
  40. #Install Help Files
  41. Install-SPApplicationContent
  42.  
  43.  
  44. #Secure resources
  45. Initialize-SPResourceSecurity
  46.  
  47. #Install (all) features
  48.  
  49. If ( $Force ) {
  50.     $Features = Install-SPFeature –AllExistingFeatures -force
  51. } else {
  52.     $Features = Install-SPFeature –AllExistingFeatures
  53. }    
  54. ## Report features installed
  55. $Features
  56.  
  57.  
  58. # Provision all Services works only on stand alone servers (ie one-click-install )
  59. # Install-SPService  -Provision
  60.  
  61. ## Todo : Check for Errors in the evenlog
  62. ##
  63. ## Start Central Admin
  64. Start-Process "http://$($env:COMPUTERNAME):$CAPort"
  65.  
  66. ## Run Farm configuration Wizard
  67. Start-Process "http://$($env:COMPUTERNAME):$CAPort/_admin/adminconfigintro.aspx?scenarioid=adminconfig&welcomestringid=farmconfigurationwizard_welcome"
  68.  
  69.  
  70. ##@@ Todo - Run Farm Wizard or better yet create required service applications (minimal - normal - all template)

Submit a correction or amendment below (
click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:


Remember me