Administrators benefit from PowerShell when they need to create a number of site collections. This can often happen when administrating large SharePoint farms or providing hosting services.
Site collection creation operations consist of three steps:
These operations can be performed via central administration or easily automated via PowerShell. The following example combines all three steps as a single cmdlet:
To execute this function, type the following into the PowerShell shell:
The script calls all necessary cmdlets and enables you to create a new site collection with a single call. In the previous example, a site collection with the associated pool will be created, and it will be available at port 8080 with the default template (Blank site).
The function can be further customized with additional site collection parameters as needed. Default parameters include
• SiteName—
Name for your site collection and web application.
• Port—
Port that will be used for your site collection URL; default port is 80.
• HostHeader—
Optional host header, for example, portal.companyABC.com. If the host header is not provided, site collection will be available as http://SP_Server_Name:Port.
• URL—
Custom URL for your site collection.
• ApplicationPool—
Name of application pool that will be used.
• ApplicationPoolAccount—
Account that will be used as application pool account (must be managed account).
• SiteCollectionOwner—
Account that will be primary site collection administrator. If value is not provided, ApplicationPoolAccount
will be used instead.
• TemplateName—
Template that will be applied to newly created site collection. If value is not provided, "Blank Site"
will be used.