2013
Renaming Site Collections
$site = Get-SPSite http://portal.contoso.com/sites/demo
$uri = New-Object System.Uri("http://demo.contoso.com")
$site.Rename($uri)
Thx Todd - How to Rename SharePoint 2013 Site Collections Without Prayer or Sobbing
Host Named Site Collections
So the future for Microsoft is to use Host Named Site Collections and since we have no GUI, my challenge has been to script this via PowerShell. But many examples on the web have come up short and since I have been real busy this project has been put on the back burner. Finally!
For my students, I am using 20331 Lab 8 but you can use any SharePoint farm, but you will need to modify the IP address and domain names as needed
http://thecloudengineer.blogspot.com/2014/09/creating-host-name-site-collection-via.html
2010 Archive
How do you create multiple site collections via PowerShell?
The following script allows you to create a site collection with a dedicated content db and url.
First you set an array with the site collection names, then add managed path, content db and site collections for each url in the array.
$a = ("Engineering", "Sales")
ForEach($url in $a)
{
New-SPManagedPath -relativeurl /$url -webapplication http://intranet.contoso.com -explicit
New-SPContentDatabase -Name WSS_Content_Intranet_$url -WebApplication http://intranet.contoso.com
New-SPSite -Url http://intranet.contoso.com/$url -ContentDatabase WSS_Content_Intranet_$url -OwnerAlias CONTOSO\SP_Admin -Template "STS#0"
}
Special Site Collections
Hosted Named Site Collections (great article)
http://blogs.msdn.com/b/kaevans/archive/2012/03/27/what-every-sharepoint-admin-needs-to-know-about-host-named-site-collections.aspx
http://blogs.msdn.com/b/markarend/archive/2012/05/30/host-named-site-collections-hnsc-for-sharepoint-2010-architects.aspx (scripts confirmed)
How to Create Host Named Site Collections (I found some good code samples and reposted below in case of site deletion) Note you need to add the DNS entries for both.
http://mshorrosh.blogspot.com/2014/02/quick-guide-to-implementing-host-name.html
1: #"Add SharePoint Cmdlets"
2: add-pssnapin microsoft.sharepoint.powershell
3:
4: # Web App Variables
5: $WebAppDefault = "SharePoint - HSNC Example"
6: $Port = "80"
7: $AppPool = "HSNCAppPool"
8: $Account = "domain\svc-apppoolaccount"
9:
10: # Root Site Variables'
11: $RootHHDefault = "myrootsite.com"
12: $RootURLDefault = "http://myrootsite.com"
13: $Owner = "domain\svc-farmaccount"
14: $RootDB = "RootDB"
15: $Lang = "1033"
16: $Template = "blankinternetcontainer#0"
17:
18: # HSNC Site Variables
19: $HNSCSITE1 = "http://hnsc1.com"
20: $HNSCSITE2 = "http://hnsc2.com"
21:
22: # Create Web App
23: New-SPWebApplication -Name $WebAppDefault -hostHeader $RootHHDefault -Port $port -ApplicationPool $AppPool -ApplicationPoolAccount (Get-SPManagedAccount $Account) -AuthenticationProvider (New-SPAuthenticationProvider –UseWindowsIntegratedAuthentication) -DatabaseName $RootDB -AllowAnonymousAccess
24: echo "Web App created"
25:
26: # Create Root Site Collection
27: New-SPSite $RootURLDefault -Name 'Root Site' -Description 'External Root Site Collection' -OwnerAlias $Owner -language $Lang -Template $Template
28: echo "Root Site Collection created"
29:
30: # Create HNSC 1
31: New-SPSite $HNSCSITE1 -HostHeaderWebApplication (get-spwebapplication $RootURLDefault) -Name 'Site 1' -Description 'HNSC Site1' -OwnerAlias $Owner -language $Lang -Template $template
32: echo "HNSC 1 Site Collection created"
33:
34: # Create HNSC 2
35: New-SPSite $HNSCSITE2 -HostHeaderWebApplication (get-spwebapplication $RootURLDefault) -Name 'Site 2' -Description 'HNSC Site2' -OwnerAlias $Owner -language $Lang -Template $template
36: echo "HNSC 2 Site Collection created"
http://www.sharepointdiary.com/2014/06/create-host-named-site-collections-in-sharepoint-2013.html
1: Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
2: #Set variables for New web application creation
3: $WebAppName = "HNSC Host Web Application"
4: #Variables for new Application Pool
5: $AppPoolName = "HNSC App Pool"
6: #Get the existing Managed Account
7: $AppPoolAccount = Get-SPManagedAccount "Crescent\SvcAppPool"
8: #To utilize existing AppPool, Use: Get-SPServiceApplicationPool <AppPoolName>
9: $ContentDatabase = "SP13_HNSC_Content"
10: $AuthProvider = New-SPAuthenticationProvider –UseWindowsIntegratedAuthentication
11: #Create the web application
12: $WebApp = New-SPWebApplication -ApplicationPool $AppPoolName -ApplicationPoolAccount $AppPoolAccount
1: $ServerName = "http://G1WFE01"
2: New-SPSite -URL $ServerName -Name "HNSC Root" -OwnerAlias "Global\SvcOwner"
1: $HostURL = "http://WFE01"
2: $OwnerID = "Crescent\Support"
3: $OwnerMail= "Support@Crescent.com"
4: $SiteURL = "http://sales.crescent.com"
5: $TemplateVal ="sts#0" #Team Site
6: #Create the HNSC
7: New-SPSite -url $SiteURL -HostHeaderWebApplication $HostURL -owneralias $OwnerID -owneremail $OwnerMail -Template $TemplateVal
1: New-SPManagedPath "Teams" –Hostheader
1: $HostURL = "http://WFE01"
2: $OwnerID = "Crescent\Salaudeen"
3: $OwnerMail= "Support@Crescent.com"
4: $SiteURL = "http://Sales.crescent.com/teams/cloud"
5: $SiteName = "Clould Sales Team"
6: $TemplateVal ="sts#0"
7: #Get the Host named site collection by its name
8: $webApp = Get-SPWebApplication $HostURL
9: #Create new Host-named site under the managed path
10: New-SPSite $SiteURL -OwnerAlias $OwnerID -HostHeaderWebApplication $webApp -Name $SiteName -Template $TemplateVal
No comments:
Post a Comment