Skip to content

Instantly share code, notes, and snippets.

@pmatthews05
pmatthews05 / CreateAppService.ps1
Last active September 6, 2016 12:14
Creates the App Service For SharePoint 2016
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)
{
#Add SharePoint PowerShell Commands
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
$DatabaseServerName = "SQL2016"
$AppPoolName = "Default SharePoint Service App Pool"
$AppPoolUserName = "CFCODE2016\SP_Services"
$AppDomain = "cfapps.com"
$applicationPool = "SharePoint - HNSC - 11111"
$ServiceAcct = "cfcode2016\SP_Content"
$WebApp = "SharePoint HNSC Web Application"
$contentDB = "SP_HNSC_ContentDB"
New-SPWebApplication -ApplicationPool $applicationPool -ApplicationPoolAccount $serviceAcct -Name $WebApp -Port 11111 -AuthenticationProvider (new-spauthenticationprovider) -databaseName $contentDB -secureSocketsLayer
New-SPSite -Url "https://hnsc.cfcode2016.com:11111" -OwnerAlias "cfcode2016\SP_Setup" -Template STS#1
$devdb = “SP_DEVDB”
$intranetdb = “SP_IntranetDB”
$webApp = “SharePoint HNSC Web Application”
#Build Databases
new-SPContentDatabase -Name $devdb -WebApplication $WebApp -WarningSiteCount 0 -MaxSiteCount 1
new-SPContentDatabase -Name $intranetdb -WebApplication $WebApp -WarningSiteCount 0 -MaxSiteCount 1
$hnsc = Get-SPWebApplication | Where-Object {$_.DisplayName -eq $webApp}
New-SPSite -Name “CF Development” -Url https://dev.cfcode2016.com –HostHeaderWebApplication $hnsc -OwnerAlias “cfcode2016\SP_Setup” -Template “DEV#0” -contentDatabase $devdb
New-SPWebApplicationAppDomain -AppDomain "cfapps.com" -WebApplication "https://intranet.cfcode2016.com" -Zone Default -Port 11111 -SecureSocketsLayer
$contentService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$contentService.SupportMultipleAppDomains = $true
$contentService.Update();
IIsreset
$regKeyPath = "HKLM:\System\CurrentControlSet\Control\Lsa"
$key = "DisableLoopbackCheck"
New-ItemProperty –Path $regKeyPath –Name $key –Value "1" –PropertyType dword
Register-SPWorkflowService -SPSite "https://intranet.cfcode2016.com" -WorkflowHostUri "https://cfsp2016.cfcode2016.com:12290"
@pmatthews05
pmatthews05 / pnpprogram.cs
Last active December 12, 2017 19:28
Provisioning
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Security;
using OfficeDevPnP.Core.Framework.Provisioning.Providers.Xml;
using OfficeDevPnP.Core.Framework.Provisioning.Model;
using OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers;
using Microsoft.SharePoint.Client;
#Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WinRM\Client
#Need to set AllowBasic, AllowDigest, AllowUnencryptedTraffic to 1
#Run this to connect to session
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName "Microsoft.Exchange" -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
##Be sure to disconnect at the end.
#Remove-PSSession $Session