PowerShell and PSConfig



Just like the PSConfig command, we can also use PowerShell to configure the SharePoint farm from scratch. Though we can install SharePoint and create a new farm using PowerShell as well, I have not covered it under this this post.

Below is a set of PSConfig commands and their equivalent cmdlet in PowerShell


PSConfig Command

PowerShell Cmdlet

configdb -create


configdb -connect


helpcollections -installall




services -install



Install-SPFeature (provide the -AllExistingFeatures parameter)

adminvs -provision


applicationcontent -install


Configuring your SharePoint farm using PowerShell

During the SharePoint Installation, make sure you choose “Server Farm” and then “Complete” install. This will allow you to create a SharePoint farm rather than a standalone server.

After the install completes, the setup program will ask you if you want to run the SharePoint Technologies Configuration Wizard (default is checked). Uncheck the box to NOT run the wizard.

Under the Start Menu, browse to Microsoft SharePoint 2010 Products, Right-click on SharePoint 2010 Management Shell and choose 'Run as administrator'




Note: Since we have not created a farm yet, the shell will load with an error that the local farm is not accessible. This is expected.

The Cmdlets

There are seven cmdlets that you will need to provision your farm so that you can access it correctly. The cmdlets are listed below along with their descriptions provided by the Get-Help cmdlet.

1. New-SPConfigurationDatabase
The New-SPConfigurationDatabase cmdlet creates a new configuration database on the specified database server. This is the
central database for a new SharePoint farm.

* Create a new configuration database and central admin content database.

Note: One of the main reason why we use this method as against the configuration wizard UI is because we can specify the names for the central admin and content databases.

       New-SPConfigurationDatabase –DatabaseName “SharePoint2010_Config” –DatabaseServer “<Your DB Server>”
–AdministrationContentDatabaseName “SharePoint2010_AdminContentDB” –Passphrase (ConvertTo-SecureString
“Password123” –AsPlaintext –Force) –FarmCredentials (Get-Credential)


Note: As you can see, we are having PowerShell prompt us for the farm credentials rather than hard coding it. You can also do this with the passphrase by accessing the “Password” property of the of the credential object: (Get-Credential).Password

After the operation completes, you can confirm that the server has been added to a farm, by reloading the PowerShell window. Close the shell and repeat the “Run as administrator” step followed earlier. It should load with out any warning message(s).

2. Install-SPHelpCollection
The Install-SPHelpCollection cmdlet installs the Help site collection files for SharePoint 2010 Products in the current farm. Use
the LiteralPath parameter to install specific custom Help collection files. If the LiteralPath parameter is not specified, all available
Help in the Help site collection is installed and existing Help collection files are overwritten.

* Install the help files:
Install-SPHelpCollection –All

3. Initialize-SPResourceSecurity
The Initialize-SPResourceSecurity cmdlet enforces resource security on the local server. This cmdlet enforces security for
all resources, including files, folders, and registry keys.

* Secure the files and registry entries (SecureResources in Psconfig):

4. Install-SPService
The Install-SPService cmdlet installs and optionally provisions services on a farm. This cmdlet installs all services, service
instances, and service proxies specified in the registry on the local server computer. Use this cmdlet in a script that you build to
install and deploy a SharePoint farm or to install a custom developed service.

* Install and provision the services on to the farm

Note : The above command is for Server farm installations Only. For standalone servers, run Install-SPService -Provision

5. Install-SPFeature
The Install-SPFeature cmdlet installs a specific SPFeature object by providing in the Identity parameter the relative path from
the folder “%Program Files%\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\" to the feature.
The SharePoint Feature’s files must already be put in the proper directory, either manually or by using a solution installer. If the
AllExistingFeatures parameter is provided, the file system is scanned and any new features are installed. This is generally
only used during deployment and upgrade.

* Install the features on the server
Install-SPFeature –AllExistingFeatures

6. New-SPCentralAdministration
The New-SPCentralAdministration cmdlet creates a new Central Administration Web application and starts the central
administration service on the local machine. Central Administration is available only on computers where this service runs.

* Provisions the central admin web application which will also link it with the admin content database created earlier
New-SPCentralAdministration -Port 2010 -WindowsAuthProvider "NTLM"

7. Install-SPApplicationContent
The Install-SPApplicationContent cmdlet copies shared application data to existing Web application folders. This cmdlet does
not take any parameters.

* Install all of the application content

That's it!! ….Launch the Central Administration site from 'Start > All Programs > SharePoint 2010 Products > SharePoint Central Administration'. 

All in one place.

The Script


# Create a new SharePoint Configuration and Administration database, use “Password123” as the passphrase.

New-SPConfigurationDatabase –DatabaseName “SharePoint2010_Config” –DatabaseServer “<Your DB Server>”

–AdministrationContentDatabaseName “SharePoint2010_AdminContentDB” –Passphrase (ConvertTo-SecureString “Password123”

–AsPlaintext –Force) –FarmCredentials (Get-Credential)

# Installs the Help site collection files for SharePoint 2010 Products in the current farm

Install-SPHelpCollection -All

# Enforces resource security on the local server


# Installs services on a farm


# The file system is scanned and any new features are installed

Install-SPFeature –AllExistingFeatures

# Creates a new Central Administration Web application and starts the central administration service on the local machine

New-SPCentralAdministration -Port 2010 -WindowsAuthProvider "NTLM"

# Copies shared application data to existing Web application folders



Happy SharePointingSmile ……