Docteur L – François Lessard

SharePoint Architect, IT Manager and IT Specialist

  • Author:
  • Published: Nov 8th, 2011
  • Category: Configuration, DNS, Domain name, Installation, PowerShell, Scripts
  • Comments: None
  •             

The Special Edition – Create a new Web Application with PowerShell – How to

Tags: , , , , , , , ,

Here’s another Special Edition post. How to create a new Web Application in SharePoint 2010 using PowerShell? Just use the following script.

# Load SharePoint 2010 CmdLets Module 
Add-PsSnapin Microsoft.SharePoint.PowerShell
# Set Variables
$SiteName = "Contoso Site"
$dns = "intranet.contoso.com"
$url = ("http://" + $dns)
$AppPool = "SharePoint - intranet.contoso.com80"
$Port = 80
$AppPoolServiceAccount = "contoso\srvshpapppool"
$ApplicationPoolAccount = Get-SPManagedAccount $AppPoolServiceAccount
$ContentDatabaseName = "SHP_2010_Intranet_Content"
$DatabaseServer = "MySQLServerName"
$SiteCollName = "Home"
$Template = "STS#0"
$Language = 1033 #Other language required the installation of the Language pack
$Owner = "contoso\myuser" 
# WebApplication Creation
New-SPWebApplication -Name $SiteName -HostHeader $SiteHostHeader -url $url -ApplicationPool $AppPool -ApplicationPoolAccount $ApplicationPoolAccount -DatabaseName $ContentDatabaseName -DatabaseServer $DatabaseServer -Port $Port 
# Site Collection Provisioning 
New-SPSite -Name $SiteName -url $url -OwnerAlias $Owner -Template $SiteCollectionTemplate -Language $Language

Requirements

Share on TwitterShare on LinkedInSubmit to StumbleUponDigg ThisSubmit to reddit

The Special Edition – Configure SharePoint 2010 with PowerShell – How to

Tags: , , , ,

Starting today, I’m publishing my first article that will inaugurate a new serie of posts on how to install SharePoint 2010 by using PowerShell. This article will be available under a new section in my blog: The Special Edition.

Before going further with the PowerShell syntax to configureSharePoint 2010. I suggest to review two previous articles I wrote.

The following PowerShell Script allows to create the SharePoint 2010 Configuration Database and the Central Administration Content Database. Unlike the SharePoint Configuration Wizard, It is possible with this script to specify the name of these databases and thus avoid the horrifying GUID in the database name.

#-------------------------------------------------------------
#Loading SharePoint Powershell Snapin
#-------------------------------------------------------------
Start-Sleep 5
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null) 
{ 
	Write-Host "Loading SharePoint Powershell Snapin"
	Add-PSSnapin "Microsoft.SharePoint.Powershell" 
}
 
#Set variables
$Credential = Get-Credential #Authentication Popup to Enter Farm Service Account Credential
$DatabaseServer = "smtlshpsql99" #SQL Server Name
$ConfigDatabaseName = "SHP_2010_DEV_Config_temp" #SharePoint Configuration Database Name
$AdminContentDatabaseName = "SHP_2010_DEV_Admin_Content_temp" #SharePoint Administration Content Database Name
$Passphrase = "test1234!" #Passphrase must be with a special character
$PassphraseConv = (ConvertTo-SecureString $Passphrase -AsPlainText -force) 
$CentralAdminPort = 65000
 
New-SPConfigurationDatabase -DatabaseServer $DatabaseServer -DatabaseName $ConfigDatabaseName -AdministrationContentDatabaseName $AdminContentDatabaseName -Passphrase $PassphraseConv -farmCredentials $credential
New-SPCentralAdministration -Port $CentralAdminPort -WindowsAuthProvider "NTLM"
 
#Provisioning Central Admin
Install-SPApplicationContent
Initialize-SPResourceSecurity
Install-SPFeature -AllExistingFeature
Install-SPService

The second line triggers the Windows Authentication Popup which allows to enter the Farm Service Account. The fourth line configure the Central Administration Web Application with the port 65000 and the NTLM Authentication Provider. I recommend to keep it that way. Using a specific port on Central Admin URL is much more easy to remember. As for the NTLM Authentication Provider, it is preferable to use NTLM instead of Kerberos for Central Administration.


Share on TwitterShare on LinkedInSubmit to StumbleUponDigg ThisSubmit to reddit

© 2011 Docteur L – François Lessard. All Rights Reserved.

This blog is powered by Wordpress and Magatheme by Bryan Helmig.

Switch to our mobile site