Logo
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
PREGNANCY
 
 
Windows Server

SharePoint 2010 and PowerShell: Real-World Solutions : Scripted Installation of SharePoint 2010 Using Windows PowerShell

4/26/2013 3:52:25 PM

When the binaries are installed on the server and we have a Microsoft SQL Server instance available, the first thing we need to do is create a configuration database. The configuration database is the heart of a SharePoint farm and contains more or less all global settings. Without the configuration database, a SharePoint farm would not function.

To create this new database we use the New-SPConfigurationDatabase cmdlet. This cmdlet requires that we specify the database name and the name of the database server instance, as well as the name of the content database associated with the Central Administration web application, the credentials of the farm account to use, and the passphrase used when adding extra servers to the farm.

So, to begin, we specify the name of the database. Storing information in variables allows us to reuse the variables.

PS > $dbName = "NimaIntranet_ConfigDB"

Setting the database name is an option available when performing a setup using Windows PowerShell (or STSADM). This is one of the main reasons for using a scripted installation: You are able to control the database name and align it with corporate naming standards.

We also specify the name of the SQL Server instance that we will use and the name for the Central Administration content database.

PS > $dbServer = "SQLServer01"
PS > $centralAdmindbName = "NimaIntranet_Admin_ContentDB"

The New-SPConfigurationDatabase cmdlet also requires the Passphrase parameter. A passphrase is a new addition in SharePoint 2010. It is a “farm password” used for generating the farm encryption key (master key), which is used for securing managed accounts and credentials stored in the Secure Store Service. In addition, the passphrase is used when adding new servers to the farm.

The Passphrase parameter requires an object of the type System.Security.SecureString as input. By using the ConvertTo-SecureString cmdlet, we can create a secure string in Window PowerShell, as in this example:

PS > $securePassPhrase =
>> (ConvertTo-SecureString -String "pass@word1" -AsPlaintext -Force)

The SecureString cmdlets in Windows PowerShell use the Windows Data Protection API when working with secure strings. This API is the standard way a Windows program protects sensitive data. The encryption key is based on logon credentials.

We also add the credentials used for the farm administrator account using the FarmCredentials parameter. The parameter requires a System.Management.Automation.PSCredential object as input. Windows PowerShell includes the Get-Credential cmdlet, which prompts the user for password (or a username and password) and returns a PSCredential object to the session. However, since we are going for an automated installation, we will create a PSCredential object using the New-Object cmdlet. Before we can create a PSCredential object, we need to create a secure string containing the user password, since the PSCredential object constructor accepts only secure strings as input for the password argument.

PS > $userName = "powershell\administrator"
PS > $password = "P@ssword1"
PS > $securePassword =
>> ConvertTo-SecureString -string $password -AsPlainText -Force
PS > $psCredentials =
>> New-Object -TypeName System.Management.Automation.PSCredential `
>> -ArgumentList $userName, $securePassword

Now that we have collected all the necessary input information and stored it conveniently in variables, we can go ahead and run the New-SPConfigurationDatabase cmdlet:

PS > New-SPConfigurationDatabase -DatabaseName $databaseName `
>> -DatabaseServer $databaseServer `
>> -AdministrationContentDatabaseName $centralAdminDatabase `
>> -Passphrase $securePassPhrase -FarmCredentials $psCredentials

The next step in the process of installing a SharePoint 2010 farm is to install the Help files. If a custom Help file or only a specific file should be used, you can use the LiteralPath parameter. In most cases, you will use the All parameter to install all available Help collections, like this:

PS > Install-SPHelpCollection -All

We also want to enforce security for all resources, including files, folders, and registry keys. This is done by using the Initialize-SPResourceSecurity cmdlet:

PS > Initialize-SPResourceSecurity

Now we need to install the necessary services and features in our farm. The services are installed using the Install-SPService cmdlet. The cmdlet installs all services, service instances, and service proxies specified in the registry on the server. Install-SPService also supports the Provision parameter used for stand-alone servers only.

The features are installed using the Install-SPFeature cmdlet. The cmdlet supports the AllExistingFeatures switch parameter, which installs all the existing features on the server.

The following example demonstrates how to use these two cmdlets.

PS > Install-SPService
PS > Install-SPFeature -AllExistingFeatures

We can manage the SharePoint 2010 environment through the Central Administration site, but before we can access it, we must provision a new site using the New-SPCentralAdministration cmdlet. The cmdlet creates a new web application with the Central Administration site collection at the root, using the port and authentication provider specified with the parameters Port and WindowsAuthProvider, as shown in the following example.

PS > New-SPCentralAdministration -Port 8000 -WindowsAuthProvider "NTLM"

The last step in the installation is to copy the shared application data to the web application folders. We can achieve this using the Install-SPApplicationContent cmdlet.

PS > Install-SPApplicationContent

Tip

Since none of the cmdlets used in this scenario produce any output, you can use the Verbose switch parameter on the cmdlets to get a detailed output of what each actually does. An example is Install-SPApplicationContent -Verbose.

Other -----------------
- Microsoft Systems Management Server 2003 : Using the Distribute Software To Collection Wizard
- Microsoft Systems Management Server 2003 : Configuring the Software Distribution Component
- Client Access to Exchange Server 2007 : Getting the Most Out of the Microsoft Outlook Client - Security Enhancements in Outlook 2007
- Client Access to Exchange Server 2007 : Getting the Most Out of the Microsoft Outlook Client - What's New in Outlook 2007
- Windows Server 2008 R2 : High Availability, Live Migration, and Snapshots
- SharePoint 2010 : Configuring Search Settings and the User Interface - Search Alerts Administration, Search Suggestions
- SharePoint 2010 : Configuring Search Settings and the User Interface - Search Keywords
- BizTalk Server 2006 : Starting a New BizTalk Project - Creating a Build-and-Integration Environment (part 2) - Using Test-Driven Development, Creating a BizTalk Installation Package
- BizTalk Server 2006 : Starting a New BizTalk Project - Creating a Build-and-Integration Environment (part 1) - Five-Step Build Process
- Maintaining Dynamics GP : Maintaining updated code by rolling out Service Packs with Client Updates
- Maintaining Dynamics GP : Providing correct tax information by Updating 1099 information
- SQL Server 2008 R2 : Creating and Managing Stored Procedures - Startup Procedures
- SQL Server 2008 R2 : Creating and Managing Stored Procedures - Using System Stored Procedures
- Windows Server 2003 : Windows Firewall (part 3) - Service Pack Firewall Modifications - Modifying firewall behavior using the Windows Firewall INF file and unattend.txt
- Windows Server 2003 : Windows Firewall (part 2) - Service Pack Firewall Modifications - Modifications
- Windows Server 2003 : Windows Firewall (part 1) - Internet Connection Firewall
- Windows Server 2003 on HP ProLiant Servers : Server Placement (part 3) - Flexible Single Master Operations (FSMO) Placement
- Windows Server 2003 on HP ProLiant Servers : Server Placement (part 2) - DC Placement, GC Placement
- Windows Server 2003 on HP ProLiant Servers : Server Placement (part 1) - DNS Placement, Site Affinity
- Managing SharePoint 2010 with Windows PowerShell : Managing SharePoint 2010 Sites (part 2)
 
 
Most view of day
- System Center Configuration Manager 2007 : Network Design - Fast Networks and Slow Networks
- What's new and improved in SharePoint 2013 : Creating a new site
- Windows Phone 8 : Phone-Specific Design (part 1) - The ApplicationBar in Blend
- Windows Server 2012 : Configuring IPv6/IPv4 interoperability (part 4) - IPv6 address assignment - Manual address assignment
- Microsoft Dynamics CRM 4.0 : Silverlight - Deploying Silverlight Using IFrames, Notes Entity
- Microsoft OneNote 2010 : Doing Research with Side Notes (part 1) - Creating Side Notes
- Evaluating Applications for Windows 7 Compatibility : Deploying XP Mode
- Managing Windows Licensing and Activation : Licensing Windows
- Windows Server 2008 : Configuring Server Core after Installation (part 4) - Setting the Time, Date, and Time Zone , Joining a Domain
- Windows Server 2012 : File Services and Storage - Configuring iSCSI storage (part 5) - Using iSCSI Initiator - Discovering targets
Top 10
- Windows Server 2012 : Administering Active Directory using Windows PowerShell (part 3) - Performing an advanced Active Directory administration task
- Windows Server 2012 : Administering Active Directory using Windows PowerShell (part 2) - Finding Active Directory administration cmdlets
- Windows Server 2012 : Administering Active Directory using Windows PowerShell (part 1) - Managing user accounts with Windows PowerShell
- Windows Server 2012 : Enabling advanced features using ADAC (part 3) - Creating fine-grained password policies
- Windows Server 2012 : Enabling advanced features using ADAC (part 2) - Configuring fine-grained password policies
- Windows Server 2012 : Enabling advanced features using ADAC (part 1) - Enabling and using the Active Directory Recycle Bin
- Microsoft Excel 2010 : Protecting and Securing a Workbook - Marking a Workbook as Read-Only
- Microsoft Excel 2010 : Protecting and Securing a Workbook - Working with Office Safe Modes
- Microsoft Excel 2010 : Protecting and Securing a Workbook - Setting External Content Security Options
- Microsoft Excel 2010 : Protecting and Securing a Workbook - Setting Privacy Options - Set Parental Controls for Online Research
 
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro