This chapter explores how you may use PowerShell scripts to perform the installation and configuration of SharePoint 2010. Microsoft provides a set of tools that aids in the installation. Use these procedures to script out and run unattended installations.
Prepare the Microsoft SharePoint Installation Module
Solution: Download and install the SPModule from Microsoft.
Before you can install SharePoint from within PowerShell, you need to download and install the SPModule code from Microsoft. The downloadable file can be found at http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c57556ff-8df0-44fd-aba6-3df01b9f80ce (or search for SPModule Powershell).
Unzip the file and place it into a local folder. Add this folder to the PSModulePath environment variable. The code is unsigned, so you must allow unsigned scripts to run. See Chapter 2, "PowerShell Basics," for steps on adding an environment variable and allowing the execution of unsigned scripts.
Launch Windows PowerShell by right-clicking the icon and selecting Run As Administrator. Import the modules extracted from the zipped SPModule by using the commands in Listing 3.1.
Listing 3.1. Importing the SPModule Components
Import-Module SPModule.misc Import-Module SPModule.setup
The cmdlets to install and configure SharePoint are now installed and ready for use.