Here is a very basic script that will configure a barebones SharePoint 2010 farm. This isn’t designed for a production ready environment, but is great for a test lab and if you need to get something up and running very quickly.
I am in the process of building something more enterprise ready and bulletproof..so watch this space :-)
Fill in the appropriate servers, passwords to suit your environment. The script has been tested in both AD and non-AD connected environments. For Non-AD environments, you will need to logon as the FarmAdminAccount otherwise you will experience access denied errors.
TIP: Ensure that the powershell execution policy is set to unrestricted using the Powershell command – Set-ExecutionPolicy Unrestricted
Here is the script:
$username="SERVER\FarmAdminAccount" $PWD="password" $DBServer="SQLServer" $password=convertto-securestring $PWD -asplaintext -force $passphrase = convertto-securestring $PWD -asplaintext -force $FarmAdminCredentials = New-Object System.Management.Automation.PSCredential $username, $password
Write-Host "Creating the configuration database" New-SPConfigurationDatabase -DatabaseServer $DBServer -DatabaseName SharePoint_Config -Passphrase $passphrase -FarmCredentials $FarmAdminCredentials -AdministrationContentDatabaseName "Admin_Content_DB"
Write-Host "Installing the help collection" Install-SPHelpCollection -All
Write-Host "Setting the security" Initialize-SPResourceSecurity
Write-Host "Installing the Services" Install-SPService
Write-Host "Installing the features" Install-SPFeature -AllExistingFeatures
Write-Host "Creating Central Administration" New-SPCentralAdministration -Port 10000
Write-Host "Installing the application Content" Install-SPApplicationContent Write-Host "Farm created"