SharePoint 2016: Quickly create and configure new wildcard inclusion site collection using PowerShell
I am sometimes requested to create a new wildcard inclusion site collection on a web application for a user and I want to configure its primary and secondary site collection administrators, add the user to the site collection's Site Collection Administrator group, and deactivate various features I've found through experience my users don't use, all in one task. It doesn't employ anything fancy, such as prompts for information. Instead, I keep these in a text file and just edit the script as needed and then copy and paste into an elevated SMS. It's much quicker. This is the script I use:
$site="https://contoso.com/sites/site1" $SiteCollectionAdmin1="CONTOSO\SiteCollectionAdmin1" $SiteCollectionAdmin2="CONTOSO\SiteCollectionAdmin2" $UserOwner1="CONTOSO\UserOwner1" $UserOwner2="CONTOSO\UserOwner2" $DBName="SP16_Content_Contoso" $Template="STS#0" New-SPSite -URL $site -OwnerAlias $SiteCollectionAdmin1 -SecondaryOwnerAlias $SiteCollectionAdmin2 -ContentDatabase $DBName -Template $Template $owner1 = (get-SPWeb $site).EnsureUser($UserOwner1) $owner2 = (get-SPWeb $site).EnsureUser($UserOwner2) Set-SPUser -Web $site -Identity $owner1 -IsSiteCollectionAdmin:$True Set-SPUser -Web $site -Identity $owner2 -IsSiteCollectionAdmin:$True Disable-SPFeature -identity "AccSvcAddAccessApp" -URL $site -Confirm:$False Disable-SPFeature -identity "FollowingContent" -URL $site -Confirm:$False Disable-SPFeature -identity "GettingStarted" -URL $site -Confirm:$False Disable-SPFeature -identity "MDSFeature" -URL $site -Confirm:$False Disable-SPFeature -identity "MBrowserRedirect" -URL $site -Confirm:$False Disable-SPFeature -identity "SiteFeed" -URL $site -Confirm:$False Disable-SPFeature -identity "SiteNotebook" -URL $site -Confirm:$False
References
Notes
- tbd