diff --git a/9781484221693.jpg b/9781484221693.jpg new file mode 100644 index 0000000..824592b Binary files /dev/null and b/9781484221693.jpg differ diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..5768c1d --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,27 @@ +Freeware License, some rights reserved + +Copyright (c) 2016 Stacy Simpkins + +Permission is hereby granted, free of charge, to anyone obtaining a copy +of this software and associated documentation files (the "Software"), +to work with the Software within the limits of freeware distribution and fair use. +This includes the rights to use, copy, and modify the Software for personal use. +Users are also allowed and encouraged to submit corrections and modifications +to the Software for the benefit of other users. + +It is not allowed to reuse, modify, or redistribute the Software for +commercial use in any way, or for a user’s educational materials such as books +or blog articles without prior permission from the copyright holder. + +The above copyright notice and this permission notice need to be included +in all copies or substantial portions of the software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS OR APRESS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + diff --git a/README.md b/README.md new file mode 100644 index 0000000..4780036 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +#Apress Source Code + +This repository accompanies [*Building a SharePoint 2016 Home Lab*](http://www.apress.com/9781484221693) by Stacy Simpkins (Apress, 2016). + +![Cover image](9781484221693.jpg) + +Download the files as a zip using the green button, or clone the repository to your machine using Git. + +##Releases + +Release v1.0 corresponds to the code in the published book, without corrections or updates. + +##Contributions + +See the file Contributing.md for more information on how you can contribute to this repository. diff --git a/contributing.md b/contributing.md new file mode 100644 index 0000000..f6005ad --- /dev/null +++ b/contributing.md @@ -0,0 +1,14 @@ +# Contributing to Apress Source Code + +Copyright for Apress source code belongs to the author(s). However, under fair use you are encouraged to fork and contribute minor corrections and updates for the benefit of the author(s) and other readers. + +## How to Contribute + +1. Make sure you have a GitHub account. +2. Fork the repository for the relevant book. +3. Create a new branch on which to make your change, e.g. +`git checkout -b my_code_contribution` +4. Commit your change. Include a commit message describing the correction. Please note that if your commit message is not clear, the correction will not be accepted. +5. Submit a pull request. + +Thank you for your contribution! \ No newline at end of file diff --git a/scripts/2016-CentralAdmin.ps1 b/scripts/2016-CentralAdmin.ps1 new file mode 100644 index 0000000..fa20e5a --- /dev/null +++ b/scripts/2016-CentralAdmin.ps1 @@ -0,0 +1,39 @@ +Set-ExecutionPolicy Unrestricted + +Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue +Remove-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue +Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue + +Write-Host "When prompted for credentials, give SharePoint the farm account, not the install account that you are signed in with, then provide the passphrase, note: you will not be prompted for passPhrase if it is baked into the script" -ForegroundColor green + +New-SPConfigurationDatabase -DatabaseName PRD_SharePoint_ConfigDB -DatabaseServer SPAlias -Passphrase (ConvertTo-SecureString "1Qaz2Wsx3Edc4Rfv" -AsPlainText -Force) -FarmCredentials (Get-Credential) -AdministrationContentDatabaseName PRD_SharePoint_CentralAdmin_Content -SkipRegisterAsDistributedCacheHost -localserverrole Application + +#Enter the port for Central Admin and the Authentication Provider if different than NTLM# + +$CAPort = 11111 +$CAAuth = “NTLM” + + +#Must use this order http://technet.microsoft.com/en-us/library/ff806336(v=office.14).aspx## + + +Install-SPHelpCollection -All +Initialize-SPResourceSecurity +Install-SPService +Install-SPFeature -AllExistingFeatures + +New-SPCentralAdministration -Port $CAPort -WindowsAuthProvider $CAAuth + +Install-SPApplicationContent + +New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name “DisableLoopbackCheck” -value “1” -PropertyType dword + +$ServiceConnectionPoint = get-SPTopologyServiceApplication | select URI + +Set-SPFarmConfig -ServiceConnectionPointBindingInformation $ServiceConnectionPoint -Confirm: $False + +Write-Host "Make sure to register the managed accounts for Service Apps and for Web Content before continuing with the 2013Install script" -ForegroundColor Blue -BackgroundColor white +Write-Host "#######################################################################################################################################" -ForegroundColor Blue -BackgroundColor White +Write-Host "Have a great SharePoint Day. . ." -ForegroundColor Green +Write-Host "#######################################################################################################################################" -ForegroundColor Green + diff --git a/scripts/2016Install.ps1 b/scripts/2016Install.ps1 new file mode 100644 index 0000000..8b409c2 --- /dev/null +++ b/scripts/2016Install.ps1 @@ -0,0 +1,191 @@ +<# Check line 8, line 12, line 16, and line 55 and check all databasename, log path, and account variables correspond with your naming convention +Based on scripts at http://www.harbar.net/articles/sp2013mt.aspx and http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=378 +Thanks Todd and Spencer! +This should be run on the first server in your farm #> + +#Creates the Default Service Application Pool# + +New-SPServiceApplicationPool -Name “Default SharePoint Service App Pool” -Account “Tailspintoys\svc_svcacct” + +## Replace values between < > with correct values and remove < ># + +$DatabaseServerName = “SPAlias“ + +$AppPoolName = “Default SharePoint Service App Pool” + +$AppPoolUserName = “Tailspintoys\svc_svcacct“ + +$SAAppPool = Get-SPServiceApplicationPool -Identity $AppPoolName -EA 0 + +if($SAAppPool -eq $null) + +{ + +$AppPoolAccount = Get-SPManagedAccount -Identity $AppPoolUserName -EA 0 + +if($AppPoolAccount -eq $null) + +{ + +$AppPoolCred = Get-Credential $AppPoolUserName + +$AppPoolAccount = New-SPManagedAccount -Credential $AppPoolCred -EA 0 + +} + +$AppPoolAccount = Get-SPManagedAccount -Identity $AppPoolUserName -EA 0 + +if($AppPoolAccount -eq $null) + +{ + +Write-Host “Cannot create or find the managed account $appPoolUserName, please ensure the account exists.” + +Exit -1 + +} + +New-SPServiceApplicationPool -Name $SAAppPoolName -Account $AppPoolAccount -EA 0 > $null + +} + +##Configure Farm Service Applications + +## Create Usage and Health Data Collection Service and State Service Applications, replace variables with desired values for database names, etc. ## + +## Begin Variables for usage and health data collection and state service, make sure the E: location exists first ## +$usageSAName = “Usage and Health Data Collection Service” +$usageServiceDBName = “PRD_Usage_HealthDataDB” +$usageLogLocationOnDisk = “E:\logs\ULS\” +$stateSAName = “State Service” +$stateServiceDatabaseName = “PRD_StateServiceDataDB” +## End Variables ## + +Set-SPUsageService -LoggingEnabled 1 -UsageLogLocation $usageLogLocationOnDisk -UsageLogMaxSpaceGB 2 + +$serviceInstance = Get-SPUsageService + +New-SPUsageApplication -Name $usageSAName -DatabaseServer $DatabaseServerName -DatabaseName $usageServiceDBName -UsageService $serviceInstance > $null + +$stateServiceDatabase = New-SPStateServiceDatabase -Name $stateServiceDatabaseName + +$stateSA = New-SPStateServiceApplication -Name $stateSAName -Database $stateServiceDatabase + +New-SPStateServiceApplicationProxy -ServiceApplication $stateSA -Name “$stateSAName Proxy” -DefaultProxyGroup + +## Create Managed Metadata Service (If Upgrading Use Existing Database Name of database that was attached) ## + +$metadataSAName = “Managed Metadata Service” +$metadataDBName = “PRD_ManagedMetadataDB” + +$mmsApp = New-SPMetadataServiceApplication -Name $metadataSAName –ApplicationPool $AppPoolName -DatabaseServer $DatabaseServerName -DatabaseName $metadataDBName > $null + +New-SPMetadataServiceApplicationProxy -Name “$metadataSAName Proxy” -DefaultProxyGroup -ServiceApplication $metadataSAName > $null + +Get-SPServiceInstance | where-object {$_.TypeName -eq “Managed Metadata Web Service”} | Start-SPServiceInstance > $null + + + + + + +## Word ## + +$wordAutomationServiceName = “Word Automation Service Application” +$wordAutomationDatabaseName = “PRD_WordAutomationDataDB“ + +Get-SPServiceApplicationPool –Identity $AppPoolName | New-SPWordConversionServiceApplication -Name $wordAutomationServiceName -DatabaseName $wordAutomationDatabaseName + +## BDC (If Upgrading Use Existing Database Name) ## + +$BDCServiceName = “Business Data Connection Service Application” +$BDCDatabaseName = “PRD_BusinessDataConnectionDataDB“ + +New-SPBusinessDataCatalogServiceApplication –ApplicationPool “Default SharePoint Service App Pool” –DatabaseName $BDCDatabaseName –DatabaseServer $DatabaseServerName –Name $BDCServiceName + +### New-SPBusinessDataCatalogServiceApplicationProxy -Name “Business Data Connection Service Application Proxy” -ServiceApplication “Business Data Connection Service Application”## + +## Secure Store (If Upgrading Use Existing Database Name) ## + +#See page 162 - - previously did not have variable instantiation of the service app, and was trying to call the app by name on the proxy line versus the variable### + +$SecureStoreServiceAppName = “Secure Store Service Application” +$SecureStoreDBName = “PRD_SecureStoreServiceDB” + +$SecureStoreServiceApp = New-SPSecureStoreServiceApplication –ApplicationPool $AppPoolName –AuditingEnabled:$false –DatabaseServer $DatabaseServerName –DatabaseName $SecureStoreDBName –Name $SecureStoreServiceAppName + +New-SPSecureStoreServiceApplicationProxy –Name “Secure Store Service Application Proxy” –ServiceApplication $SecureStoreServiceApp -DefaultProxyGroup + +## Performance Point (If Upgrading Use Existing Database Name) ## + +$PerformancePointAppProxyName = “Performance Point Service Application Proxy” +$PerformancePointAppName = “Performance Point Service Application” +$PerformancePointDatabase = “PRD_PerformancePointDataDB” + + +New-SPPerformancePointServiceApplication -Name $PerformancePointAppName -ApplicationPool $AppPoolName -DatabaseName $PerformancePointDatabase + +New-SPPerformancePointServiceApplicationProxy -Name $PerformancePointAppProxyName -ServiceApplication $PerformancePointAppName -Default + + +## Create Subscription Settings and App Management Services ## See minute 40 point int video dated 8/4/2014#### + +$SubSettingssName = “Subscription Settings Service” + +$SubSettingsDatabaseName = “PRD_SubscriptionSettingsDB” + +$AppManagementName = “App Management Service” + +$AppManagementDatabaseName = “PRD_AppManagementDB” + +$AppPoolName = “Default SharePoint Service App Pool” + +$DatabaseServerName = “SPAlias“ + +Write-Host “Creating Subscription Settings Service and Proxy…” + +$SubSvc = New-SPSubscriptionSettingsServiceApplication –ApplicationPool $AppPoolName –Name $SubSettingssName –DatabaseName $SubSettingsDatabaseName + +$SubSvcProxy = New-SPSubscriptionSettingsServiceApplicationProxy –ServiceApplication $SubSvc + +Get-SPServiceInstance | where-object {$_.TypeName -eq $SubSettingssName} | Start-SPServiceInstance > $null + +Write-Host “Creating App Management Service and Proxy…” + +$AppManagement = New-SPAppManagementServiceApplication -Name $AppManagementName -DatabaseServer $DatabaseServerName -DatabaseName $AppManagementDatabaseName –ApplicationPool $AppPoolName + +$AppManagementProxy = New-SPAppManagementServiceApplicationProxy -ServiceApplication $AppManagement -Name “$AppManagementName Proxy” + +Get-SPServiceInstance | where-object {$_.TypeName -eq $AppManagementName} | Start-SPServiceInstance > $null + +Set-SPAppDomain apps.Tailspintoys.com + +Set-SPAppSiteSubscriptionName -Name “apps” -Confirm:$false + +## Create Machine Translation Service ## + +$AppPool = “Default SharePoint Service App Pool” + +$MTSInst = “Machine Translation Service” + +$MTSName = “Translation Service” + +$MTSDB = “PRD_MachineTranslationDB” + +$AppPoolName = Get-SPServiceApplicationPool $AppPool + +Get-SPServiceInstance | ? {$_.GetType().Name -eq $MTSInst} | Start-SPServiceInstance + +$MTS = New-SPTranslationServiceApplication -Name $MTSName -ApplicationPool $AppPoolName -DatabaseName $MTSDB + +$MTSProxy = New-SPTranslationServiceApplicationProxy –Name “$MTSName Proxy” –ServiceApplication $MTS –DefaultProxyGroup + + +Write-Host "Time to configure User Profile Service, Visio, Excel,Performance Point. . ." -ForegroundColor White +Write-Host "##########################################################################################" -ForegroundColor White +Write-Host "Configure Publishing Infrastructure. . ." -ForegroundColor White +Write-Host "##########################################################################################" -ForegroundColor White +Write-Host "And, Time to run the enable .Net Session State and install Workflow Manager 1.0. . ." -ForegroundColor White +Write-Host "##########################################################################################" -ForegroundColor White +Write-Host "Have a great SharePoint Day. . ." -ForegroundColor White +Write-Host "##########################################################################################" -ForegroundColor White \ No newline at end of file diff --git a/scripts/DisableLoopBackCheck.ps1 b/scripts/DisableLoopBackCheck.ps1 new file mode 100644 index 0000000..4dc704d --- /dev/null +++ b/scripts/DisableLoopBackCheck.ps1 @@ -0,0 +1 @@ +New-ItemProperty HKLM:\System\CurrentControlSet\Control\Lsa -Name “DisableLoopbackCheck” -value “1” -PropertyType dword \ No newline at end of file diff --git a/scripts/JoinFarm-Distributed-Cache.ps1 b/scripts/JoinFarm-Distributed-Cache.ps1 new file mode 100644 index 0000000..99df3e4 --- /dev/null +++ b/scripts/JoinFarm-Distributed-Cache.ps1 @@ -0,0 +1,7 @@ +Connect-SPConfigurationDatabase -DatabaseName PRD_SharePoint_ConfigDB -DatabaseServer SPAlias -Passphrase (ConvertTo-SecureString "1Qaz2Wsx3Edc4Rfv" -AsPlainText -Force) -localserverrole distributedCache +Install-SPHelpCollection -All +Initialize-SPResourceSecurity +Install-SPService +Install-SPFeature -AllExistingFeatures +Install-SPApplicationContent +Start-Service SPTimerV4 \ No newline at end of file diff --git a/scripts/JoinFarm-Search.ps1 b/scripts/JoinFarm-Search.ps1 new file mode 100644 index 0000000..e33a09f --- /dev/null +++ b/scripts/JoinFarm-Search.ps1 @@ -0,0 +1,7 @@ +Connect-SPConfigurationDatabase -DatabaseName PRD_SharePoint_ConfigDB -DatabaseServer SPAlias -Passphrase (ConvertTo-SecureString "1Qaz2Wsx3Edc4Rfv" -AsPlainText -Force) -localserverrole Search +Install-SPHelpCollection -All +Initialize-SPResourceSecurity +Install-SPService +Install-SPFeature -AllExistingFeatures +Install-SPApplicationContent +Start-Service SPTimerV4 \ No newline at end of file diff --git a/scripts/JoinFarm-WFE.ps1 b/scripts/JoinFarm-WFE.ps1 new file mode 100644 index 0000000..a1cb05a --- /dev/null +++ b/scripts/JoinFarm-WFE.ps1 @@ -0,0 +1,7 @@ +Connect-SPConfigurationDatabase -DatabaseName PRD_SharePoint_ConfigDB -DatabaseServer SPAlias -Passphrase (ConvertTo-SecureString "1Qaz2Wsx3Edc4Rfv" -AsPlainText -Force) -localserverrole WebFrontEnd +Install-SPHelpCollection -All +Initialize-SPResourceSecurity +Install-SPService +Install-SPFeature -AllExistingFeatures +Install-SPApplicationContent +Start-Service SPTimerV4 \ No newline at end of file diff --git a/scripts/hnsc.ps1 b/scripts/hnsc.ps1 new file mode 100644 index 0000000..8544d75 --- /dev/null +++ b/scripts/hnsc.ps1 @@ -0,0 +1,93 @@ +<# +INSTRUCTIONS for 2016: + +- Check the values for the variables in lines 21-26 and adapt to your values in your domain +- - Run lines 21-26 +- Make sure you like port number on line 21, 52, and 60. Change it if you dont like it. Use a high port +- - Run line 52 - Create the WEB Application +- Change the values for the variables in lines 56-60 and adapt to your values in your domain +- - Run line 62 - Create the Top Level Site +- Set the BackConnectionHostNames registry entries, Host file entries, and Binding on the applicable machines +- Set the values for the database names on lines 74 & 75 and make sure lines 85 & 86 and lines 90 & 91 "look ok" (e.g. have dns entries for the Cnames that are referenced in the URL & you like titles) - change to your domain if needed +- Set the site template at the end of lines 88 & 93, currently it is set for a blank site (STS#1) you might want a team site (STS#0) or maybe a publishing portal or search center - use get-spwebtemplate to find the templates for your desired site collection. +- - Run line 88 & line 93 +- After the site is created open IIS on the servers that have the site and assign the SSL Certificate - - If, and God forbid, you're not running SSL, then go through this and change all the https to http - - "I didnt say that" +#> + + + +#Build a web application and place an empty site collection in it, a site collection with no site, e.g. pick site later or create with powershell as follows: + +$applicationPool = "SharePoint - HNSC - 33333" +$ServiceAcct = "tailspintoys\svc_Content" +$svcacctmail = "svc_Content@tailspintoys.com" +$WebApp = "SharePoint HNSC Web Application" +$webAppURL = "https://hnsc.tailspintoys.com/" +$contentDB = "Prd_HNSC_ContentDB" + +#######################################################################################################################################MAKE SURE TO UPDATE PORT##### + +<# +MOST OF THIS SCRIPT IS FOR SHAREPOINT 2016 or 2013 - - 2016 and 13 vs the earlier versions - Claims or no claims + +The primary diffrence is whether your using claims or not. +If you're creating a HNSC for SharePoint 2013 you should use a claims based web application. For 2016 you must use a claims based web application. +Send the claims authentication provider by calling the new-spauthenticationprovider cmdlet into a variable as: $Provider = New-spauthenticationprovider + +THIS IS FOR A 2010 - NON claims based web application - or can use in 2013 if needed, normally you would use the $Provider = New-spauthenticationprovider along with the -AuthenticationProvider + +New-SPWebApplication -ApplicationPool $applicationPool -ApplicationPoolAccount $serviceAcct -Name $WebApp -Port 33333 -databaseName $contentDB -securesocketslayer + +#> + +###########################################################################################################################################MAKE SURE TO UPDATE PORT##### + ## + ## ## +## ## ## MAKE SURE TO UPDATE PORT IF YOU DONT LIKE IT + ## ## +## ## + +#If doing for 2013 or 2016 + +New-SPWebApplication -ApplicationPool $applicationPool -ApplicationPoolAccount $serviceAcct -Name $WebApp -Port 33333 -AuthenticationProvider (new-spauthenticationprovider) -databaseName $contentDB -secureSocketsLayer + +#Now that the web app is there, add the bindings, build the empty site collection, assign the site collection admins + +$primarySiteCollectionOwnerAcct = "tailspintoys\svc_content" +$PrimarySCOwnerEmail = "svc_content@tailspintoys.com" +$SecondarySiteCollectionOwnerAcct = "tailspintoys\spadmin" +$SecondarySCOwnerEmail = "spadmin@tailspintoys.com" +$webApp0URL = "https://hnsc.tailspintoys.com:33333" + +New-SPSite -URL $webApp0URL -OwnerAlias $primarySiteCollectionOwnerAcct -OwnerEmail $PrimarySCOwnerEmail -SecondaryOwnerAlias $SecondarySiteCollectionOwnerAcct -SecondaryEmail $SecondarySCOwnerEmail -Template STS#1 + +################################### +##### ##### +##### ADD THE BINDINGS IN IIS ##### - - - #### On All Servers, Add the BackconnectionHostNames #### +##### on the servers ##### +##### that have the sites ##### - - - #### Add host file entries on servers that have websites in IIS #### +##### ##### +################################### + +#Instantiate some DB names for the script + +$HNSC1DB = "Prd_IT_ContentDB" +$HNSC2DB = "Prd_TBSPUG_ContentDB" + + +#Build some content databases for your new HNSC's + +new-SPContentDatabase -Name $HNSC1DB -WebApplication $WebApp -WarningSiteCount 0 -MaxSiteCount 1 +new-SPContentDatabase -Name $HNSC2DB -WebApplication $WebApp -WarningSiteCount 0 -MaxSiteCount 1 + +#Now build some HNSC's + +$HNSC1Name = "Information Technology" +$HNSC1URL = "https://it.tailspintoys.com" + +New-SPSite -url $HNSC1URL -HostHeaderWebApplication $webApp0URL -Name $HNSC1Name -ownerAlias $PrimarySiteCollectionOwnerAcct -owneremail $PrimarySCOwnerEmail -SecondaryOwnerAlias $SecondarySiteCollectionOwnerAcct -SecondaryEmail $SecondarySCOwnerEmail -contentDatabase $HNSC1DB -Template STS#1 + +$HNSC2Name = "Tailspintoys Best SharePoint Users Group" +$HNSC2URL = "https://TBSPUG.tailspintoys.com" + +New-SPSite -url $HNSC2URL -HostHeaderWebApplication $webApp0URL -Name $HNSC2Name -ownerAlias $PrimarySiteCollectionOwnerAcct -owneremail $PrimarySCOwnerEmail -SecondaryOwnerAlias $SecondarySiteCollectionOwnerAcct -SecondaryEmail $SecondarySCOwnerEmail -contentDatabase $HNSC2DB -Template STS#1