diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPAntivirusSettings/MSFT_xSPAntivirusSettings.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPAntivirusSettings/MSFT_xSPAntivirusSettings.psm1
new file mode 100644
index 000000000..2c9944e80
--- /dev/null
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPAntivirusSettings/MSFT_xSPAntivirusSettings.psm1
@@ -0,0 +1,118 @@
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.Boolean] $ScanOnDownload,
+ [parameter(Mandatory = $false)] [System.Boolean] $ScanOnUpload,
+ [parameter(Mandatory = $false)] [System.Boolean] $AllowDownloadInfected,
+ [parameter(Mandatory = $false)] [System.Boolean] $AttemptToClean,
+ [parameter(Mandatory = $false)] [System.UInt16] $TimeoutDuration,
+ [parameter(Mandatory = $false)] [System.UInt16] $NumberOfThreads,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ Write-Verbose -Message "Getting antivirus configuration settings"
+
+ $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ try {
+ $spFarm = Get-SPFarm
+ } catch {
+ Write-Verbose -Verbose "No local SharePoint farm was detected. Antivirus settings will not be applied"
+ return $null
+ }
+
+ # Get a reference to the Administration WebService
+ $admService = Get-xSharePointContentService
+
+ return @{
+ # Set the antivirus settings
+ AllowDownloadInfected = $admService.AntivirusSettings.AllowDownload
+ ScanOnDownload = $admService.AntivirusSettings.DownloadScanEnabled
+ ScanOnUpload = $admService.AntivirusSettings.UploadScanEnabled
+ AttemptToClean = $admService.AntivirusSettings.CleaningEnabled
+ NumberOfThreads = $admService.AntivirusSettings.NumberOfThreads
+ TimeoutDuration = $admService.AntivirusSettings.Timeout.TotalSeconds
+ InstallAccount = $params.InstallAccount
+ }
+ }
+
+ return $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.Boolean] $ScanOnDownload,
+ [parameter(Mandatory = $false)] [System.Boolean] $ScanOnUpload,
+ [parameter(Mandatory = $false)] [System.Boolean] $AllowDownloadInfected,
+ [parameter(Mandatory = $false)] [System.Boolean] $AttemptToClean,
+ [parameter(Mandatory = $false)] [System.UInt16] $TimeoutDuration,
+ [parameter(Mandatory = $false)] [System.UInt16] $NumberOfThreads,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ Write-Verbose -Message "Setting antivirus configuration settings"
+
+ Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ try {
+ $spFarm = Get-SPFarm
+ } catch {
+ throw "No local SharePoint farm was detected. Antivirus settings will not be applied"
+ return
+ }
+
+ Write-Verbose -Message "Start update"
+ $admService = Get-xSharePointContentService
+
+ # Set the antivirus settings
+ if ($params.ContainsKey("AllowDownloadInfected")) {
+ Write-Verbose -Message "Setting Allow Download"
+ $admService.AntivirusSettings.AllowDownload = $params.AllowDownloadInfected
+ }
+ if ($params.ContainsKey("ScanOnDownload")) { $admService.AntivirusSettings.DownloadScanEnabled = $params.ScanOnDownload }
+ if ($params.ContainsKey("ScanOnUpload")) { $admService.AntivirusSettings.UploadScanEnabled = $params.ScanOnUpload }
+ if ($params.ContainsKey("AttemptToClean")) { $admService.AntivirusSettings.CleaningEnabled = $params.AttemptToClean }
+ if ($params.ContainsKey("NumberOfThreads")) { $admService.AntivirusSettings.NumberOfThreads = $params.NumberOfThreads }
+ if ($params.ContainsKey("TimeoutDuration")) {
+ $timespan = New-TimeSpan -Seconds $params.TimeoutDuration
+ $admService.AntivirusSettings.Timeout = $timespan
+ }
+
+ $admService.Update()
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.Boolean] $ScanOnDownload,
+ [parameter(Mandatory = $false)] [System.Boolean] $ScanOnUpload,
+ [parameter(Mandatory = $false)] [System.Boolean] $AllowDownloadInfected,
+ [parameter(Mandatory = $false)] [System.Boolean] $AttemptToClean,
+ [parameter(Mandatory = $false)] [System.UInt16] $TimeoutDuration,
+ [parameter(Mandatory = $false)] [System.UInt16] $NumberOfThreads,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ Write-Verbose -Message "Testing antivirus configuration settings"
+ $CurrentValues = Get-TargetResource @PSBoundParameters
+
+ if ($null -eq $CurrentValues) { return $false }
+
+ return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters
+}
+
+Export-ModuleMember -Function *-TargetResource
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPAntivirusSettings/MSFT_xSPAntivirusSettings.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPAntivirusSettings/MSFT_xSPAntivirusSettings.schema.mof
new file mode 100644
index 000000000..59389c869
--- /dev/null
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPAntivirusSettings/MSFT_xSPAntivirusSettings.schema.mof
@@ -0,0 +1,30 @@
+/*
+**Description**
+
+This resource is used to set the global antivirus settings for the local form.
+These settings will be used to control the behavior of an external anti-virus scanning tool that is able to integrate with SharePoint.
+Note that this will not scan documents for viruses on it's own, an external tool still needs to be installed on the servers that integrates with SharePoint.
+
+**Example**
+
+ xSPAntivirusSettings AVSettings
+ {
+ ScanOnDownload = $true
+ ScanOnUpload = $true
+ AllowDownloadInfected = $false
+ AttemptToClean = $false
+ }
+*/
+
+[ClassVersion("1.0.0.0"), FriendlyName("xSPAntivirusSettings")]
+class MSFT_xSPAntivirusSettings : OMI_BaseResource
+{
+ [Key] Boolean ScanOnDownload;
+ [Write] Boolean ScanOnUpload;
+ [Write] Boolean AllowDownloadInfected;
+ [Write] Boolean AttemptToClean;
+ [Write] Uint16 TimeoutDuration;
+ [Write] Uint16 NumberOfThreads;
+ [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount;
+};
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.schema.mof
index 08020d3ab..9c74b6b6b 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.schema.mof
@@ -1,4 +1,22 @@
+/*
+**Description**
+This resource is used to provision and manage an instance of the Business Connectivity Services Service Application.
+It will identify an instance of the BCS app through the application display name.
+Currently the resource will provision the app if it does not yet exist, and will change the service account associated to the app if it does not match the configuration.
+Database names or server name will not be changed if the configuration does not match, these parameters are only used for the initial provisioning of the service application.
+
+**Example**
+
+ xSPBCSServiceApp BCSServiceApp
+ {
+ Name = "BCS Service Application"
+ ApplicationPool = "SharePoint Service Applications"
+ DatabaseName = "SP_BCS"
+ DatabaseServer = $DatabaseServer
+ InstallAccount = $InstallAccount
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPBCSServiceApp")]
class MSFT_xSPBCSServiceApp : OMI_BaseResource
{
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.schema.mof
index 9ebdce416..8ab123936 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.schema.mof
@@ -1,4 +1,18 @@
+/*
+**Description**
+This resource is used to set the "super user" and "super reader" cache accounts for the specified web application object (as described in the TechNet article [Configure object cache user accounts in SharePoint Server 2013](https://technet.microsoft.com/en-us/library/ff758656.aspx)).
+
+**Example**
+
+ xSPCacheAccounts SetCacheAccounts
+ {
+ WebAppUrl = "http://sharepoint.contoso.com"
+ SuperUserAlias = "DEMO\svcSPSuperUser"
+ SuperReaderAlias = "DEMO\svcSPReader"
+ PsDscRunAsCredential = $InstallAccount
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPCacheAccounts")]
class MSFT_xSPCacheAccounts : OMI_BaseResource
{
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof
index 3c51d885e..32955ca6d 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof
@@ -1,3 +1,29 @@
+/*
+**Description**
+
+This resource is used to provision a new SharePoint farm.
+It should only be used on the first server in the farm to create the configuration database, all servers to join the farm after the first server creates the configuration database should use [xSPJoinFarm](xSPJoinFarm).
+Once the config DB has been created, the resource will install local help collections, secure resources, activate features and provision the central admin site.
+
+The port of the Central Admin website can be set by using the CentralAdministrationPort property, if this is not defined the site will be provisioned on port 9999.
+However this setting will not impact existing deployments that already have Central Admin provisioned on another port.
+Also when a farm is created, the current behavior is to not enroll the server as a cache server (which is the default behavior of SharePoint).
+This means you need to use [xSPDistributedCacheService](xSPDistributedCacheService) on at least one server in the farm to designate it as a cache server.
+
+**Example**
+
+ xSPCreateFarm CreateSPFarm
+ {
+ DatabaseServer = "SQL.contoso.local\SQLINSTANCE"
+ FarmConfigDatabaseName = "SP_Config"
+ Passphrase = "Example Passphrase"
+ FarmAccount = $FarmAccount
+ PsDscRunAsCredential = $SetupAccount
+ AdminContentDatabaseName = "SP_AdminContent"
+ CentralAdministrationPort = 2000
+ ServerRole = Custom
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPCreateFarm")]
class MSFT_xSPCreateFarm : OMI_BaseResource
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.schema.mof
index 26731d015..ede389a1d 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.schema.mof
@@ -1,4 +1,34 @@
+/*
+**Description**
+This resource is responsible for configuring settings to do with the diagnostic (ULS) logging on servers in the farm.
+These settings are applied to the diagnostic logging service for the farm and do not need to be applied to each server individually, the settings will be propagated throughout the farm when they are set.
+
+**Example**
+
+ xSPDiagnosticLoggingSettings ApplyDiagnosticLogSettings
+ {
+ PsDscRunAsCredential = $InstallAccount
+ LogPath = "L:\ULSLogs"
+ LogSpaceInGB = 10
+ AppAnalyticsAutomaticUploadEnabled = $false
+ CustomerExperienceImprovementProgramEnabled = $true
+ DaysToKeepLogs = 7
+ DownloadErrorReportingUpdatesEnabled = $false
+ ErrorReportingAutomaticUploadEnabled = $false
+ ErrorReportingEnabled = $false
+ EventLogFloodProtectionEnabled = $true
+ EventLogFloodProtectionNotifyInterval = 5
+ EventLogFloodProtectionQuietPeriod = 2
+ EventLogFloodProtectionThreshold = 5
+ EventLogFloodProtectionTriggerPeriod = 2
+ LogCutInterval = 15
+ LogMaxDiskSpaceUsageEnabled = $true
+ ScriptErrorReportingDelay = 30
+ ScriptErrorReportingEnabled = $true
+ ScriptErrorReportingRequireAuth = $true
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPDiagnosticLoggingSettings")]
class MSFT_xSPDiagnosticLoggingSettings : OMI_BaseResource
{
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.schema.mof
index eebec204a..13e856455 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.schema.mof
@@ -1,3 +1,23 @@
+/*
+**Description**
+
+This resource is responsible for provisioning the distributed cache to the service it runs on.
+This is required in your farm on at least one server (as the behavior of [xSPCreateFarm](xSPCreateFarm) and [xSPJoinFarm](xSPJoinFarm) is to not enroll every server as a cache server).
+The service will be provisioned or de-provisioned based on the Ensure property, and when provisioned the CacheSizeInMB property and ServiceAccount property will be used to configure it.
+The property createFirewallRules is used to determine if exceptions should be added to the windows firewall to allow communication between servers on the appropriate ports.
+
+**Example**
+
+ xSPDistributedCacheService EnableDistributedCache
+ {
+ Name = "AppFabricCachingService"
+ Ensure = "Present"
+ CacheSizeInMB = 8192
+ ServiceAccount = "DEMO\ServiceAccount"
+ InstallAccount = $InstallAccount
+ CreateFirewallRules = $true
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPDistributedCacheService")]
class MSFT_xSPDistributedCacheService : OMI_BaseResource
{
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPFarmAdministrators/MSFT_xSPFarmAdministrators.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPFarmAdministrators/MSFT_xSPFarmAdministrators.psm1
new file mode 100644
index 000000000..d7a568742
--- /dev/null
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPFarmAdministrators/MSFT_xSPFarmAdministrators.psm1
@@ -0,0 +1,260 @@
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $Name,
+ [parameter(Mandatory = $false)] [System.String[]] $Members,
+ [parameter(Mandatory = $false)] [System.String[]] $MembersToInclude,
+ [parameter(Mandatory = $false)] [System.String[]] $MembersToExclude,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) {
+ Throw "Cannot use the Members parameter together with the MembersToInclude or MembersToExclude parameters"
+ }
+
+ if (!$Members -and !$MembersToInclude -and !$MembersToExclude) {
+ throw "At least one of the following parameters must be specified: Members, MembersToInclude, MembersToExclude"
+ }
+
+ Write-Verbose -Message "Getting all Farm Administrators"
+
+ $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ $caWebapp = Get-SPwebapplication -includecentraladministration | where {$_.IsAdministrationWebApplication}
+ if ($null -eq $caWebapp) {
+ Write-Verbose "Unable to locate central administration website"
+ return $null
+ }
+ $caWeb = Get-SPweb($caWebapp.Url)
+ $farmAdminGroup = $caWeb.AssociatedOwnerGroup
+ $farmAdministratorsGroup = $caWeb.SiteGroups.GetByName($farmAdminGroup)
+ return @{
+ Name = $params.Name
+ Members = $farmAdministratorsGroup.users.UserLogin
+ MembersToInclude = $params.MembersToInclude
+ MembersToExclude = $params.MembersToExclude
+ InstallAccount = $params.InstallAccount
+ }
+ }
+ return $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $Name,
+ [parameter(Mandatory = $false)] [System.String[]] $Members,
+ [parameter(Mandatory = $false)] [System.String[]] $MembersToInclude,
+ [parameter(Mandatory = $false)] [System.String[]] $MembersToExclude,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ Write-Verbose -Message "Setting Farm Administrator config"
+
+ if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) {
+ Throw "Cannot use the Members parameter together with the MembersToInclude or MembersToExclude parameters"
+ }
+
+ if (!$Members -and !$MembersToInclude -and !$MembersToExclude) {
+ throw "At least one of the following parameters must be specified: Members, MembersToInclude, MembersToExclude"
+ }
+
+ $CurrentValues = Get-TargetResource @PSBoundParameters
+ if ($null -eq $CurrentValues) {
+ throw "Unable to locate central administration website"
+ }
+
+ $changeUsers = @{}
+ $runChange = $false
+
+ if ($Members) {
+ Write-Verbose "Processing Members parameter"
+
+ $differences = Compare-Object -ReferenceObject $CurrentValues.Members -DifferenceObject $Members
+
+ if ($differences -eq $null) {
+ Write-Verbose "Farm Administrators group matches. No further processing required"
+ } else {
+ Write-Verbose "Farm Administrators group does not match. Perform corrective action"
+ $addUsers = @()
+ $removeUsers = @()
+ ForEach ($difference in $differences) {
+ if ($difference.SideIndicator -eq "=>") {
+ # Add account
+ $user = $difference.InputObject
+ Write-Verbose "Add $user to Add list"
+ $addUsers += $user
+ } elseif ($difference.SideIndicator -eq "<=") {
+ # Remove account
+ $user = $difference.InputObject
+ Write-Verbose "Add $user to Remove list"
+ $removeUsers += $user
+ }
+ }
+
+ if($addUsers.count -gt 0) {
+ Write-Verbose "Adding $($addUsers.Count) users to the Farm Administrators group"
+ $changeUsers.Add = $addUsers
+ $runChange = $true
+ }
+
+ if($removeUsers.count -gt 0) {
+ Write-Verbose "Removing $($removeUsers.Count) users from the Farm Administrators group"
+ $changeUsers.Remove = $removeUsers
+ $runChange = $true
+ }
+ }
+ }
+
+ if ($MembersToInclude) {
+ Write-Verbose "Processing MembersToInclude parameter"
+
+ $addUsers = @()
+ ForEach ($member in $MembersToInclude) {
+ if (-not($CurrentValues.Members.Contains($member))) {
+ Write-Verbose "$member is not a Farm Administrator. Add user to Add list"
+ $addUsers += $member
+ } else {
+ Write-Verbose "$member is already a Farm Administrator. Skipping"
+ }
+ }
+
+ if($addUsers.count -gt 0) {
+ Write-Verbose "Adding $($addUsers.Count) users to the Farm Administrators group"
+ $changeUsers.Add = $addUsers
+ $runChange = $true
+ }
+ }
+
+ if ($MembersToExclude) {
+ Write-Verbose "Processing MembersToExclude parameter"
+
+ $removeUsers = @()
+ ForEach ($member in $MembersToExclude) {
+ if ($CurrentValues.Members.Contains($member)) {
+ Write-Verbose "$member is a Farm Administrator. Add user to Remove list"
+ $removeUsers += $member
+ } else {
+ Write-Verbose "$member is not a Farm Administrator. Skipping"
+ }
+ }
+
+ if($removeUsers.count -gt 0) {
+ Write-Verbose "Removing $($removeUsers.Count) users from the Farm Administrators group"
+ $changeUsers.Remove = $removeUsers
+ $runChange = $true
+ }
+ }
+
+ if ($runChange) {
+ Write-Verbose "Apply changes"
+ Change-SPFarmAdministrators $changeUsers
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $Name,
+ [parameter(Mandatory = $false)] [System.String[]] $Members,
+ [parameter(Mandatory = $false)] [System.String[]] $MembersToInclude,
+ [parameter(Mandatory = $false)] [System.String[]] $MembersToExclude,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ Write-Verbose -Message "Testing Farm Administrator settings"
+
+ if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) {
+ Throw "Cannot use the Members parameter together with the MembersToInclude or MembersToExclude parameters"
+ }
+
+ if (!$Members -and !$MembersToInclude -and !$MembersToExclude) {
+ throw "At least one of the following parameters must be specified: Members, MembersToInclude, MembersToExclude"
+ }
+
+ $CurrentValues = Get-TargetResource @PSBoundParameters
+
+ if ($null -eq $CurrentValues) { return $false }
+
+ if ($Members) {
+ Write-Verbose "Processing Members parameter"
+ $differences = Compare-Object -ReferenceObject $CurrentValues.Members -DifferenceObject $Members
+
+ if ($differences -eq $null) {
+ Write-Verbose "Farm Administrators group matches"
+ return $true
+ } else {
+ Write-Verbose "Farm Administrators group does not match"
+ return $false
+ }
+ }
+
+ $result = $true
+ if ($MembersToInclude) {
+ Write-Verbose "Processing MembersToInclude parameter"
+ ForEach ($member in $MembersToInclude) {
+ if (-not($CurrentValues.Members.Contains($member))) {
+ Write-Verbose "$member is not a Farm Administrator. Set result to false"
+ $result = $false
+ } else {
+ Write-Verbose "$member is already a Farm Administrator. Skipping"
+ }
+ }
+ }
+
+ if ($MembersToExclude) {
+ Write-Verbose "Processing MembersToExclude parameter"
+ ForEach ($member in $MembersToExclude) {
+ if ($CurrentValues.Members.Contains($member)) {
+ Write-Verbose "$member is a Farm Administrator. Set result to false"
+ $result = $false
+ } else {
+ Write-Verbose "$member is not a Farm Administrator. Skipping"
+ }
+ }
+ }
+
+ return $result
+}
+
+function Change-SPFarmAdministrators {
+Param ([Hashtable] $changeUsers)
+
+ $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $changeUsers -ScriptBlock {
+ $changeUsers = $args[0]
+
+ $caWebapp = Get-SPwebapplication -includecentraladministration | where {$_.IsAdministrationWebApplication}
+ if ($null -eq $caWebapp) {
+ throw "Unable to locate central administration website"
+ }
+ $caWeb = Get-SPweb($caWebapp.Url)
+ $farmAdminGroup = $caWeb.AssociatedOwnerGroup
+
+ if ($changeUsers.ContainsKey("Add")) {
+ ForEach ($loginName in $changeUsers.Add) {
+ $caWeb.SiteGroups.GetByName($farmAdminGroup).AddUser($loginName,"","","")
+ }
+ }
+
+ if ($changeUsers.ContainsKey("Remove")) {
+ ForEach ($loginName in $changeUsers.Remove) {
+ $removeUser = get-spuser $loginName -web $caWebapp.Url
+ $caWeb.SiteGroups.GetByName($farmAdminGroup).RemoveUser($removeUser)
+ }
+ }
+ }
+}
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPFarmAdministrators/MSFT_xSPFarmAdministrators.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPFarmAdministrators/MSFT_xSPFarmAdministrators.schema.mof
new file mode 100644
index 000000000..2692d405c
--- /dev/null
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPFarmAdministrators/MSFT_xSPFarmAdministrators.schema.mof
@@ -0,0 +1,27 @@
+/*
+**Description**
+
+This resource is used to manage the membership of the farm administrators group.
+There are a number of approaches to how this can be implemented.
+The "members" property will set a specific list of members for the group, making sure that every user/group in the list is in the group and all others that are members and who are not in this list will be removed.
+The "MembersToInclude" and "MembersToExclude" properties will allow you to control a specific set of users to add or remove, without changing any other members that are in the group already that may not be specified here, allowing for some manual management outside of this configuration resource.
+
+**Example**
+
+ xSPFarmAdministrators LocalFarmAdmins
+ {
+ Name = "Farm Administrators"
+ Members = @("CONTOSO\user1", "CONTOSO\user2")
+ }
+*/
+
+[ClassVersion("1.0.0.0"), FriendlyName("xSPFarmAdministrators")]
+class MSFT_xSPFarmAdministrators : OMI_BaseResource
+{
+ [Key] String Name;
+ [Write] String Members[];
+ [Write] String MembersToInclude[];
+ [Write] String MembersToExclude[];
+ [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount;
+};
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.schema.mof
index 98cea1450..be07bcbbc 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.schema.mof
@@ -1,3 +1,21 @@
+/*
+**Description**
+
+This resource is used to make sure that a specific feature is either enabled or disabled at a given URL/scope.
+The Ensure property will dictate if the feature should be on or off.
+The name property is the name of the feature based on its folder name in the FEATURES folder in the SharePoint hive directory.
+
+**Example**
+
+ xSPFeature EnableViewFormsLockDown
+ {
+ Name = "ViewFormPagesLockDown"
+ Url = "http://www.contoso.com"
+ Ensure = "Present"
+ Scope = "Site"
+ PsDscRunAsCredential = $SetupAccuount
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPFeature")]
class MSFT_xSPFeature : OMI_BaseResource
{
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.schema.mof
index fea52d9f5..b3405b8d4 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.schema.mof
@@ -1,3 +1,33 @@
+/*
+**Description**
+
+This resource is used to install the SharePoint binaries.
+The BinaryDir parameter should point to the path that setup.exe is located (not to setup.exe itself).
+The ProductKey parameter is used to inject in to the configuration file and validate the license key during the installation process.
+This module depends on the prerequisites already being installed, which can be done through the use of [xSPInstallPreReqs](xSPInstallPreReqs).
+
+**Example**
+
+ xSPInstall InstallBinaries
+ {
+ BinaryDir = "C:\SPInstall"
+ ProductKey = $ProductKey
+ }
+
+**Installing SharePoint Foundation 2013**
+
+Currently SharePoint Foundation is not supported by xSPInstall (see [Issue #81](https://github.com/PowerShell/xSharePoint/issues/81) for the details). A workaround for this is to use the package resource as demonstrated below.
+
+ Package InstallSharePointFoundation
+ {
+ Ensure = "Present"
+ Name = "Microsoft SharePoint Foundation 2013 Core"
+ Path = "E:\SharePoint2013\Setup.exe"
+ Arguments = "/config E:\SharePoint2013\files\setupfarmsilent\config.xml"
+ ProductID = "90150000-1014-0000-1000-0000000FF1CE"
+ ReturnCode = 0
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPInstall")]
class MSFT_xSPInstall : OMI_BaseResource
{
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1
index 41f852290..46fcce03f 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1
@@ -19,6 +19,8 @@ function Get-TargetResource
[parameter(Mandatory = $false)] [System.String] $WCFDataServices56,
[parameter(Mandatory = $false)] [System.String] $KB2898850,
[parameter(Mandatory = $false)] [System.String] $MSVCRT12,
+ [parameter(Mandatory = $false)] [System.String] $ODBC,
+ [parameter(Mandatory = $false)] [System.String] $DotNet452,
[parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure
)
@@ -35,10 +37,10 @@ function Get-TargetResource
Write-Verbose -Message "Getting installed windows features"
if ($majorVersion -eq 15) {
- $WindowsFeatures = Get-WindowsFeature -Name Net-Framework-Features,Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Security,Web-Basic-Auth,Web-Windows-Auth,Web-Filtering,Web-Digest-Auth,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Application-Server,AS-Web-Support,AS-TCP-Port-Sharing,AS-WAS-Support, AS-HTTP-Activation,AS-TCP-Activation,AS-Named-Pipes,AS-Net-Framework,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Web-Lgcy-Scripting,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer
+ $WindowsFeatures = Get-WindowsFeature -Name Application-Server, AS-NET-Framework, AS-TCP-Port-Sharing, AS-Web-Support, AS-WAS-Support, AS-HTTP-Activation, AS-Named-Pipes, AS-TCP-Activation, Web-Server, Web-WebServer, Web-Common-Http, Web-Default-Doc, Web-Dir-Browsing, Web-Http-Errors, Web-Static-Content, Web-Http-Redirect, Web-Health, Web-Http-Logging, Web-Log-Libraries, Web-Request-Monitor, Web-Http-Tracing, Web-Performance, Web-Stat-Compression, Web-Dyn-Compression, Web-Security, Web-Filtering, Web-Basic-Auth, Web-Client-Auth, Web-Digest-Auth, Web-Cert-Auth, Web-IP-Security, Web-Url-Auth, Web-Windows-Auth, Web-App-Dev, Web-Net-Ext, Web-Net-Ext45, Web-Asp-Net, Web-Asp-Net45, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Mgmt-Tools, Web-Mgmt-Console, Web-Mgmt-Compat, Web-Metabase, Web-Lgcy-Scripting, Web-WMI, Web-Scripting-Tools, NET-Framework-Features, NET-Framework-Core, NET-Framework-45-ASPNET, NET-WCF-HTTP-Activation45, NET-WCF-Pipe-Activation45, NET-WCF-TCP-Activation45, Server-Media-Foundation, Windows-Identity-Foundation, PowerShell-V2, WAS, WAS-Process-Model, WAS-NET-Environment, WAS-Config-APIs, XPS-Viewer
}
if ($majorVersion -eq 16) {
- $WindowsFeatures = Get-WindowsFeature -Name Application-Server,AS-NET-Framework,AS-Web-Support,Web-Server,Web-WebServer,Web-Common-Http,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-Static-Content,Web-Http-Redirect,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Security,Web-Filtering,Web-Basic-Auth,Web-Client-Auth,Web-Digest-Auth,Web-Cert-Auth,Web-IP-Security,Web-Url-Auth,Web-Windows-Auth,Web-App-Dev,Web-Net-Ext,Web-Net-Ext45,Web-Asp-Net45,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Web-Lgcy-Mgmt-Console,Web-Lgcy-Scripting,Web-WMI,Web-Scripting-Tools,NET-Framework-Features,NET-Framework-Core,NET-HTTP-Activation,NET-Non-HTTP-Activ,NET-Framework-45-ASPNET,NET-WCF-HTTP-Activation45,Windows-Identity-Foundation,PowerShell-V2,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs
+ $WindowsFeatures = Get-WindowsFeature -Name Application-Server, AS-NET-Framework, AS-Web-Support, Web-Server, Web-WebServer, Web-Common-Http, Web-Default-Doc, Web-Dir-Browsing, Web-Http-Errors, Web-Static-Content, Web-Http-Redirect, Web-Health, Web-Http-Logging, Web-Log-Libraries, Web-Request-Monitor, Web-Performance, Web-Stat-Compression, Web-Dyn-Compression, Web-Security, Web-Filtering, Web-Basic-Auth, Web-Client-Auth, Web-Digest-Auth, Web-Cert-Auth, Web-IP-Security, Web-Url-Auth, Web-Windows-Auth, Web-App-Dev, Web-Net-Ext, Web-Net-Ext45, Web-Asp-Net45, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Mgmt-Tools, Web-Mgmt-Console, Web-Mgmt-Compat, Web-Metabase, Web-Lgcy-Mgmt-Console, Web-Lgcy-Scripting, Web-WMI, Web-Scripting-Tools, NET-Framework-Features, NET-Framework-Core, NET-HTTP-Activation, NET-Non-HTTP-Activ, NET-Framework-45-ASPNET, NET-WCF-HTTP-Activation45, Windows-Identity-Foundation, PowerShell-V2, WAS, WAS-Process-Model, WAS-NET-Environment, WAS-Config-APIs
}
foreach ($feature in $WindowsFeatures) {
@@ -49,26 +51,28 @@ function Get-TargetResource
$installedItems = Get-CimInstance -ClassName Win32_Product
#Common prereqs
- $returnValue.Add("Microsoft Identity Extensions", (@(Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\ -Recurse | ? {$_.GetValue("DisplayName") -eq "Microsoft Identity Extensions" }).Count -gt 0))
+ $returnValue.Add("AppFabric 1.1 for Windows Server", (($installedItems | ? {$_.Name -eq "AppFabric 1.1 for Windows Server"}) -ne $null))
$returnValue.Add("Microsoft CCR and DSS Runtime 2008 R3", (($installedItems | ? {$_.Name -eq "Microsoft CCR and DSS Runtime 2008 R3"}) -ne $null))
+ $returnValue.Add("Microsoft Identity Extensions", (@(Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\ -Recurse | ? {$_.GetValue("DisplayName") -eq "Microsoft Identity Extensions" }).Count -gt 0))
$returnValue.Add("Microsoft Sync Framework Runtime v1.0 SP1 (x64)", (($installedItems | ? {$_.Name -eq "Microsoft Sync Framework Runtime v1.0 SP1 (x64)"}) -ne $null))
- $returnValue.Add("AppFabric 1.1 for Windows Server", (($installedItems | ? {$_.Name -eq "AppFabric 1.1 for Windows Server"}) -ne $null))
$returnValue.Add("WCF Data Services 5.6.0 Runtime", (($installedItems | ? {$_.Name -eq "WCF Data Services 5.6.0 Runtime"}) -ne $null))
#SP2013 prereqs
if ($majorVersion -eq 15) {
- $returnValue.Add("WCF Data Services 5.0 (for OData v3) Primary Components", (($installedItems | ? {$_.Name -eq "WCF Data Services 5.0 (for OData v3) Primary Components"}) -ne $null))
- $returnValue.Add("Microsoft SQL Server 2008 R2 Native Client", (($installedItems | ? {$_.Name -eq "Microsoft SQL Server 2008 R2 Native Client"}) -ne $null))
$returnValue.Add("Active Directory Rights Management Services Client 2.0", (($installedItems | ? {$_.Name -eq "Active Directory Rights Management Services Client 2.0"}) -ne $null))
+ $returnValue.Add("Microsoft SQL Server 2008 R2 Native Client", (($installedItems | ? {$_.Name -eq "Microsoft SQL Server 2008 R2 Native Client"}) -ne $null))
+ $returnValue.Add("WCF Data Services 5.0 (for OData v3) Primary Components", (($installedItems | ? {$_.Name -eq "WCF Data Services 5.0 (for OData v3) Primary Components"}) -ne $null))
}
#SP2016 prereqs
if ($majorVersion -eq 16) {
- $returnValue.Add("Microsoft ODBC Driver 11 for SQL Server", (($installedItems | ? {$_.Name -eq "Microsoft ODBC Driver 11 for SQL Server"}) -ne $null))
- $returnValue.Add("Microsoft Visual C++ 2013 x64 Minimum Runtime - 12.0.21005", (($installedItems | ? {$_.Name -eq "Microsoft Visual C++ 2013 x64 Minimum Runtime - 12.0.21005"}) -ne $null))
- $returnValue.Add("Microsoft Visual C++ 2013 x64 Additional Runtime - 12.0.21005", (($installedItems | ? {$_.Name -eq "Microsoft Visual C++ 2013 x64 Additional Runtime - 12.0.21005"}) -ne $null))
- $returnValue.Add("Microsoft SQL Server 2012 Native Client", (($installedItems | ? {$_.Name -ne $null -and $_.Name.Trim() -eq "Microsoft SQL Server 2012 Native Client"}) -ne $null))
$returnValue.Add("Active Directory Rights Management Services Client 2.1", (($installedItems | ? {$_.Name -eq "Active Directory Rights Management Services Client 2.1"}) -ne $null))
+ $returnValue.Add("Microsoft SQL Server 2012 Native Client", (($installedItems | ? {$_.Name -ne $null -and $_.Name.Trim() -eq "Microsoft SQL Server 2012 Native Client"}) -ne $null))
+ $returnValue.Add("Microsoft ODBC Driver 11 for SQL Server", (($installedItems | ? {$_.Name -eq "Microsoft ODBC Driver 11 for SQL Server"}) -ne $null))
+ $returnValue.Add("Microsoft Visual C++ 2012 x64 Minimum Runtime - 11.0.61030", (($installedItems | ? {$_.Name -eq "Microsoft Visual C++ 2012 x64 Minimum Runtime - 11.0.61030"}) -ne $null))
+ $returnValue.Add("Microsoft Visual C++ 2012 x64 Additional Runtime - 11.0.61030", (($installedItems | ? {$_.Name -eq "Microsoft Visual C++ 2012 x64 Additional Runtime - 11.0.61030"}) -ne $null))
+ $returnValue.Add("Microsoft Visual C++ 2015 x64 Minimum Runtime - 14.0.23026", (($installedItems | ? {$_.Name -eq "Microsoft Visual C++ 2015 x64 Minimum Runtime - 14.0.23026"}) -ne $null))
+ $returnValue.Add("Microsoft Visual C++ 2015 x64 Additional Runtime - 14.0.23026", (($installedItems | ? {$_.Name -eq "Microsoft Visual C++ 2015 x64 Additional Runtime - 14.0.23026"}) -ne $null))
}
$results = $PSBoundParameters
@@ -101,6 +105,8 @@ function Set-TargetResource
[parameter(Mandatory = $false)] [System.String] $WCFDataServices56,
[parameter(Mandatory = $false)] [System.String] $KB2898850,
[parameter(Mandatory = $false)] [System.String] $MSVCRT12,
+ [parameter(Mandatory = $false)] [System.String] $ODBC,
+ [parameter(Mandatory = $false)] [System.String] $DotNet452,
[parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure
)
@@ -117,7 +123,7 @@ function Set-TargetResource
}
if ($majorVersion -eq 16) {
Write-Verbose -Message "Version: SharePoint 2016"
- $requiredParams = @("SQLNCli","Sync","AppFabric","IDFX11","MSIPCClient","WCFDataServices","KB2671763","WCFDataServices56","KB2898850","MSVCRT12")
+ $requiredParams = @("SQLNCli","Sync","AppFabric","IDFX11","MSIPCClient","WCFDataServices","KB2671763","WCFDataServices56","KB2898850","MSVCRT12","ODBC","DotNet452")
}
$prereqArgs = "/unattended"
@@ -126,9 +132,12 @@ function Set-TargetResource
if (($PSBoundParameters.ContainsKey($_) -and [string]::IsNullOrEmpty($PSBoundParameters.$_)) -or (-not $PSBoundParameters.ContainsKey($_))) {
throw "In offline mode for version $majorVersion parameter $_ is required"
}
+ if ((Test-Path $PSBoundParameters.$_) -eq $false) {
+ throw "The $_ parameter has been passed but the file cannot be found at the path supplied: `"$($PSBoundParameters.$_)`""
+ }
}
$requiredParams | ForEach-Object {
- $prereqArgs += " /$_ `"$($PSBoundParameters.$_)`""
+ $prereqArgs += " /$_`:`"$($PSBoundParameters.$_)`""
}
}
@@ -138,8 +147,7 @@ function Set-TargetResource
switch ($process.ExitCode) {
0 {
- Write-Verbose -Message "Prerequisite installer completed successfully. Rebooting to finalise installations"
- $global:DSCMachineStatus = 1
+ Write-Verbose -Message "Prerequisite installer completed successfully."
}
1 {
throw "Another instance of the prerequisite installer is already running"
@@ -183,6 +191,8 @@ function Test-TargetResource
[parameter(Mandatory = $false)] [System.String] $WCFDataServices56,
[parameter(Mandatory = $false)] [System.String] $KB2898850,
[parameter(Mandatory = $false)] [System.String] $MSVCRT12,
+ [parameter(Mandatory = $false)] [System.String] $ODBC,
+ [parameter(Mandatory = $false)] [System.String] $DotNet452,
[parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure
)
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof
index 94c9b902c..6d500e2b1 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof
@@ -1,3 +1,48 @@
+/*
+**Description**
+
+This resource is responsible for ensuring the installation of all SharePoint prerequisites.
+It makes use of the PrerequisiteInstaller.exe file that is part of the SharePoint binaries, and will install the required Windows features as well as additional software.
+The OnlineMode boolean will tell the prerequisite installer which mode to run in, if it is online you do not need to list any other parameters for this resource.
+If you do not use online mode, you must include all other parameters to specify where the installation files are located.
+These additional parameters map directly to the options passed to prerequisiteinstaller.exe.
+
+Additionally, the process of installing the prerequisites on a Windows Server usually results in 2-3 restarts of the system being required. To ensure the DSC configuration is able to restart the server when needed, ensure the below settings for the local configuration manager are included in your DSC file.
+
+ LocalConfigurationManager
+ {
+ RebootNodeIfNeeded = $true
+ }
+
+**Examples**
+
+Online example:
+
+ xSPInstallPrereqs InstallPrerequisites
+ {
+ InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe"
+ OnlineMode = $true
+ }
+
+Offline example:
+
+ xSPInstallPrereqs InstallPrerequisites
+ {
+ InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe"
+ OnlineMode = $false
+ SQLNCli = "C:\SPInstall\prerequisiteinstallerfiles\sqlncli.msi"
+ PowerShell = "C:\SPInstall\prerequisiteinstallerfiles\Windows6.1-KB2506143-x64.msu"
+ NETFX = "C:\SPInstall\prerequisiteinstallerfiles\dotNetFx45_Full_setup.exe"
+ IDFX = "C:\SPInstall\prerequisiteinstallerfiles\Windows6.1-KB974405-x64.msu"
+ Sync = "C:\SPInstall\prerequisiteinstallerfiles\Synchronization.msi"
+ AppFabric = "C:\SPInstall\prerequisiteinstallerfiles\WindowsServerAppFabricSetup_x64.exe"
+ IDFX11 = "C:\SPInstall\prerequisiteinstallerfiles\MicrosoftIdentityExtensions-64.msi"
+ MSIPCClient = "C:\SPInstall\prerequisiteinstallerfiles\setup_msipc_x64.msi"
+ WCFDataServices = "C:\SPInstall\prerequisiteinstallerfiles\WcfDataServices.exe"
+ KB2671763 = "C:\SPInstall\prerequisiteinstallerfiles\AppFabric1.1-RTM-KB2671763-x64-ENU.exe"
+ WCFDataServices56 = "C:\SPInstall\prerequisiteinstallerfiles\WcfDataServices56.exe"
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPInstallPrereqs")]
class MSFT_xSPInstallPrereqs : OMI_BaseResource
{
@@ -16,6 +61,8 @@ class MSFT_xSPInstallPrereqs : OMI_BaseResource
[Write] String WCFDataServices56;
[Write] String KB2898850;
[Write] String MSVCRT12;
+ [Write] String ODBC;
+ [Write] String DotNet452;
[Required, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure;
};
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof
index 0284a63fa..dcf244734 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof
@@ -1,3 +1,20 @@
+/*
+**Description**
+
+This resource will be responsible for joining a server to an existing SharePoint farm.
+To create a new farm use the [xSPCreateFarm](xSPCreateFarm) resource on a different server to begin with, and then pass the same database server and configuration database name parameters to the additional servers using this resource.
+After the server has joined the farm, the process will wait for 5 minutes to allow farm specific configuration to take place on the server, before allowing further DSC configuration to take place.
+
+**Example**
+
+ xSPJoinFarm JoinSPFarm
+ {
+ DatabaseServer = $DatabaseServer
+ FarmConfigDatabaseName = "SP_Config"
+ Passphrase = $FarmPassPhrase
+ PsDscRunAsCredential = $InstallAccount
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPJoinFarm")]
class MSFT_xSPJoinFarm : OMI_BaseResource
{
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.schema.mof
index a0258492a..4f5133fd3 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.schema.mof
@@ -1,3 +1,19 @@
+/*
+**Description**
+
+This resource will ensure a managed account is provisioned in to the SharePoint farm.
+The Account object specific the credential to store (including username and password) to set as the managed account.
+The settings for EmailNotification, PreExpireDays and Schedule all relate to enabling automatic password change for the managed account, leaving these option out of the resource will ensure that no automatic password changing from SharePoint occurs.
+
+**Example**
+
+ xSPManagedAccount WebPoolManagedAccount
+ {
+ AccountName = $WebPoolManagedAccount.UserName
+ Account = $WebPoolManagedAccount
+ PsDscRunAsCredential = $InstallAccount
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPManagedAccount")]
class MSFT_xSPManagedAccount : OMI_BaseResource
{
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.schema.mof
index 84f36e3db..d4e073221 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.schema.mof
@@ -1,3 +1,21 @@
+/*
+**Description**
+
+Creates a managed metadata service application.
+The application pool property specifies which application pool it should use, and will reset the application back to this pool if it is changed after its initial provisioning.
+The database server and database name properties are only used during provisioning, and will not be altered as part of the ongoing operation of the DSC resource.
+
+**Example**
+
+ xSPManagedMetaDataServiceApp ManagedMetadataServiceApp
+ {
+ Name = "Managed Metadata Service Application"
+ InstallAccount = $InstallAccount
+ ApplicationPool = "SharePoint Service Applications"
+ DatabaseServer = $DatabaseServer
+ DatabaseName = "SP_ManagedMetadata"
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPManagedMetaDataServiceApp")]
class MSFT_xSPManagedMetaDataServiceApp : OMI_BaseResource
{
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.schema.mof
index db74c22c0..d3b7d02b4 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.schema.mof
@@ -1,3 +1,22 @@
+/*
+**Description**
+
+This resource is responsible for creating managed paths associated with a specific web application.
+The WebAppUrl parameter is used to specify the web application to create the path against, and the RelativeUrl parameter lets you set the URL.
+Explicit when set to true will create an explicit inclusion path, if set to false the path is created as wildcard inclusion.
+If you are using host named site collections set HostHeader to true and the path will be created as a host header path to be applied for host named site collections.
+
+**Example**
+
+ xSPManagedPath TeamsManagedPath
+ {
+ WebAppUrl = "http://sharepoint.contoso.com"
+ InstallAccount = $InstallAccount
+ RelativeUrl = "teams"
+ Explicit = $false
+ HostHeader = $true
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPManagedPath")]
class MSFT_xSPManagedPath : OMI_BaseResource
{
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPOutgoingEmailSettings/MSFT_xSPOutgoingEmailSettings.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPOutgoingEmailSettings/MSFT_xSPOutgoingEmailSettings.psm1
new file mode 100644
index 000000000..6db88c98e
--- /dev/null
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPOutgoingEmailSettings/MSFT_xSPOutgoingEmailSettings.psm1
@@ -0,0 +1,87 @@
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $WebAppUrl,
+ [parameter(Mandatory = $true)] [System.String] $SMTPServer,
+ [parameter(Mandatory = $true)] [System.String] $FromAddress,
+ [parameter(Mandatory = $true)] [System.String] $ReplyToAddress,
+ [parameter(Mandatory = $true)] [System.String] $CharacterSet,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+
+ )
+
+ Write-Verbose -Message "Retrieving outgoing email settings configuration "
+
+ $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $webApp = Get-SPWebApplication $params.WebAppUrl -IncludeCentralAdministration -ErrorAction SilentlyContinue
+
+ if ($null -eq $webApp) {
+ return $null
+ }
+ return @{
+ WebAppUrl = $webApp.Url
+ SMTPServer= $webApp.OutboundMailServiceInstance
+ FromAddress= $webApp.OutboundMailSenderAddress
+ ReplyToAddress= $webApp.OutboundMailReplyToAddress
+ CharacterSet = $webApp.OutboundMailCodePage
+ }
+ }
+ return $result
+}
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $WebAppUrl,
+ [parameter(Mandatory = $true)] [System.String] $SMTPServer,
+ [parameter(Mandatory = $true)] [System.String] $FromAddress,
+ [parameter(Mandatory = $true)] [System.String] $ReplyToAddress,
+ [parameter(Mandatory = $true)] [System.String] $CharacterSet,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ Write-Verbose -Message "Updating outgoing email settings configuration for $WebAppUrl"
+ Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $webApp = $null
+ Write-Verbose -Message "retrieving $($params.WebAppUrl) settings"
+ $webApp = Get-SPWebApplication $params.WebAppUrl -IncludeCentralAdministration
+ if($null -eq $webApp)
+ {
+ throw "Web Application $webAppUrl not found"
+ }
+ $webApp.UpdateMailSettings($params.SMTPServer, $params.FromAddress, $params.ReplyToAddress, $params.CharacterSet)
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $WebAppUrl,
+ [parameter(Mandatory = $true)] [System.String] $SMTPServer,
+ [parameter(Mandatory = $true)] [System.String] $FromAddress,
+ [parameter(Mandatory = $true)] [System.String] $ReplyToAddress,
+ [parameter(Mandatory = $true)] [System.String] $CharacterSet,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ $CurrentValues = Get-TargetResource @PSBoundParameters
+ Write-Verbose -Message "Comparing Current and Target Outgoing email settings"
+ if ($null -eq $CurrentValues) { return $false }
+
+ return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("SMTPServer","FromAddress","ReplyToAddress","CharacterSet")
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPOutgoingEmailSettings/MSFT_xSPOutgoingEmailSettings.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPOutgoingEmailSettings/MSFT_xSPOutgoingEmailSettings.schema.mof
new file mode 100644
index 000000000..292799962
--- /dev/null
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPOutgoingEmailSettings/MSFT_xSPOutgoingEmailSettings.schema.mof
@@ -0,0 +1,29 @@
+/*
+**Description**
+
+This resource is used to set the outgoing email settings for either a single web application, or the whole farm.
+To configure the resource for a specific web app, use the URL of the web application for the WebAppUrl property, to change the settings for the whole farm use the URL of the central admin website instead.
+It is possible to set the outgoing server, from address, reply to address and the character set to be used for emails.
+
+**Example**
+
+ xSPOutgoingEmailSettings FarmWideEmailSettings
+ {
+ WebAppUrl = "http://sharepoint1:2013"
+ SMTPServer = "smtp.contoso.com"
+ FromAddress = "sharepoint@contoso.com"
+ ReplyToAddress = "noreply@contoso.com"
+ PsDscRunAsCredential = $InstallAccount
+ }
+*/
+[ClassVersion("1.0.0.0"), FriendlyName("xSPOutgoingEmailSettings")]
+class MSFT_xSPOutgoingEmailSettings : OMI_BaseResource
+{
+ [key] string WebAppUrl;
+ [Required] string SMTPServer;
+ [Required] string FromAddress;
+ [Required] string ReplyToAddress;
+ [Required] string CharacterSet;
+ [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount;
+};
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPPasswordChangeSettings/MSFT_xSPPasswordChangeSettings.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPPasswordChangeSettings/MSFT_xSPPasswordChangeSettings.psm1
new file mode 100644
index 000000000..083a038b5
--- /dev/null
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPPasswordChangeSettings/MSFT_xSPPasswordChangeSettings.psm1
@@ -0,0 +1,87 @@
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $MailAddress,
+ [parameter(Mandatory = $false)] [ValidateRange(0,356)] [System.UInt32] $DaysBeforeExpiry,
+ [parameter(Mandatory = $false)] [ValidateRange(0,36000)][System.UInt32] $PasswordChangeWaitTimeSeconds,
+ [parameter(Mandatory = $false)] [ValidateRange(0,99)] [System.UInt32] $NumberOfRetries,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ Write-Verbose -Message "Retrieving farm wide automatic password change settings"
+
+ $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ $farm = Get-SPFarm
+ if ($null -eq $farm ) { return $null }
+ return @{
+ MailAddress = $farm.PasswordChangeEmailAddress
+ PasswordChangeWaitTimeSeconds= $farm.PasswordChangeGuardTime
+ NumberOfRetries= $farm.PasswordChangeMaximumTries
+ DaysBeforeExpiry = $farm.DaysBeforePasswordExpirationToSendEmail
+ }
+ }
+ return $result
+}
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $MailAddress,
+ [parameter(Mandatory = $false)] [ValidateRange(0,356)] [System.UInt32] $DaysBeforeExpiry,
+ [parameter(Mandatory = $false)] [ValidateRange(0,36000)][System.UInt32] $PasswordChangeWaitTimeSeconds,
+ [parameter(Mandatory = $false)] [ValidateRange(0,99)] [System.UInt32] $NumberOfRetries,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ Write-Verbose -Message "Updating farm wide automatic password change settings"
+ Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $farm = Get-SPFarm -ErrorAction Continue
+
+ if ($null -eq $farm ) { return $null }
+
+ $farm.PasswordChangeEmailAddress = $params.MailAddress;
+ if($params.PasswordChangeWaitTimeSeconds -ne $null) {
+ $farm.PasswordChangeGuardTime = $params.PasswordChangeWaitTimeSeconds
+ }
+ if($params.NumberOfRetries -ne $null) {
+ $farm.PasswordChangeMaximumTries = $params.NumberOfRetries
+ }
+ if($params.DaysBeforeExpiry -ne $null) {
+ $farm.DaysBeforePasswordExpirationToSendEmail = $params.DaysBeforeExpiry
+ }
+ $farm.Update();
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $MailAddress,
+ [parameter(Mandatory = $false)] [ValidateRange(0,356)] [System.UInt32] $DaysBeforeExpiry,
+ [parameter(Mandatory = $false)] [ValidateRange(0,36000)][System.UInt32] $PasswordChangeWaitTimeSeconds,
+ [parameter(Mandatory = $false)] [ValidateRange(0,99)] [System.UInt32] $NumberOfRetries,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ $CurrentValues = Get-TargetResource @PSBoundParameters
+ Write-Verbose -Message "Testing retrieving farm wide automatic password change settings"
+ if ($null -eq $CurrentValues) { return $false }
+
+ return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("MailAddress", "DaysBeforeExpiry","PasswordChangeWaitTimeSeconds","NumberOfRetries")
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPPasswordChangeSettings/MSFT_xSPPasswordChangeSettings.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPPasswordChangeSettings/MSFT_xSPPasswordChangeSettings.schema.mof
new file mode 100644
index 000000000..8a9b15557
--- /dev/null
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPPasswordChangeSettings/MSFT_xSPPasswordChangeSettings.schema.mof
@@ -0,0 +1,27 @@
+/*
+**Description**
+
+This resource is used to control settings that relate to the automatic changing of passwords for managed accounts (where they opt-in to be managed by SharePoint).
+These settings can be manually controlled through central administration, or configured in this resource.
+The settings relate to email notifications of when passwords are reset, as well as behavior when a reset occurs such as a time out and number of retries.
+
+**Example**
+
+ xSPPasswordChangeSettings ManagedAccountPasswordResetSettings
+ {
+ MailAddress = "sharepoint@contoso.com"
+ DaysBeforeExpiry = "14"
+ PasswordChangeWaitTimeSeconds = "60"
+ NumberOfRetries = "3"
+ PsDscRunAsCredential = $InstallAccount
+ }
+*/
+[ClassVersion("1.0.0.0"), FriendlyName("xSPPasswordChangeSettings")]
+class MSFT_xSPPasswordChangeSettings : OMI_BaseResource
+{
+ [key] string MailAddress;
+ [Write] Uint32 DaysBeforeExpiry;
+ [Write] Uint32 PasswordChangeWaitTimeSeconds;
+ [Write] Uint32 NumberOfRetries;
+ [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount;
+};
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.schema.mof
index 09d9cd3da..3928e8293 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.schema.mof
@@ -1,3 +1,21 @@
+/*
+**Description**
+
+This resource is responsible for provisioning the search service application.
+The current version lets you specify the database name and server, as well as the application pool.
+If the application pool is changed the DSC resource will set it back as per what is set in the resource.
+The database name parameter is used as the prefix for all search databases (so you will end up with one for the admin database which matches the name, and then "_analyticsreportingstore", "_crawlstore" and "_linkstore" databases as well).
+
+**Example**
+
+ xSPSearchServiceApp SearchServiceApp
+ {
+ Name = "Search Service Application"
+ DatabaseName = "SP_Search"
+ ApplicationPool = "SharePoint Service Applications"
+ PsDscRunAsCredential = $InstallAccount
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPSearchServiceApp")]
class MSFT_xSPSearchServiceApp : OMI_BaseResource
{
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1
index a27731b3c..00c48bd64 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1
@@ -9,12 +9,11 @@ function Get-TargetResource
[parameter(Mandatory = $true)] [System.Boolean] $AuditingEnabled,
[parameter(Mandatory = $false)] [System.UInt32] $AuditlogMaxSize,
[parameter(Mandatory = $false)] [System.String] $DatabaseName,
- [parameter(Mandatory = $false)] [System.String] $DatabasePassword,
[parameter(Mandatory = $false)] [System.String] $DatabaseServer,
- [parameter(Mandatory = $false)] [System.String] $DatabaseUsername,
[parameter(Mandatory = $false)] [System.String] $FailoverDatabaseServer,
[parameter(Mandatory = $false)] [System.Boolean] $PartitionMode,
[parameter(Mandatory = $false)] [System.Boolean] $Sharing,
+ [parameter(Mandatory = $false)] [ValidateSet("Windows", "SQL")] [System.String] $DatabaseAuthenticationType,
[parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials,
[parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
)
@@ -23,7 +22,6 @@ function Get-TargetResource
$result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock {
$params = $args[0]
-
$serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue
if ($null -eq $serviceApps) {
@@ -58,12 +56,11 @@ function Set-TargetResource
[parameter(Mandatory = $true)] [System.Boolean] $AuditingEnabled,
[parameter(Mandatory = $false)] [System.UInt32] $AuditlogMaxSize,
[parameter(Mandatory = $false)] [System.String] $DatabaseName,
- [parameter(Mandatory = $false)] [System.String] $DatabasePassword,
[parameter(Mandatory = $false)] [System.String] $DatabaseServer,
- [parameter(Mandatory = $false)] [System.String] $DatabaseUsername,
[parameter(Mandatory = $false)] [System.String] $FailoverDatabaseServer,
[parameter(Mandatory = $false)] [System.Boolean] $PartitionMode,
[parameter(Mandatory = $false)] [System.Boolean] $Sharing,
+ [parameter(Mandatory = $false)] [ValidateSet("Windows", "SQL")] [System.String] $DatabaseAuthenticationType,
[parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials,
[parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
)
@@ -71,11 +68,19 @@ function Set-TargetResource
$result = Get-TargetResource @PSBoundParameters
$params = $PSBoundParameters
+ if((($params.ContainsKey("DatabaseAuthenticationType") -eq $true) -and `
+ ($params.ContainsKey("DatabaseCredentials") -eq $false)) -or `
+ (($params.ContainsKey("DatabaseCredentials") -eq $true) -and `
+ ($params.ContainsKey("DatabaseAuthenticationType") -eq $false))) {
+ throw "Where DatabaseCredentials are specified you must also specify DatabaseAuthenticationType to identify the type of credentials being passed"
+ return;
+ }
+
switch((Get-xSharePointInstalledProductVersion).FileMajorPart) {
16 {
$hasOptionalParams = $false
- @("AuditlogMaxSize","DatabaseName","DatabasePassword","DatabaseServer","DatabaseUsername", `
- "FailoverDatabaseServer","PartitionMode","Sharing","DatabaseCredentials") | ForEach-Object {
+ @("AuditlogMaxSize","DatabaseName","DatabaseServer","FailoverDatabaseServer",`
+ "PartitionMode","Sharing","DatabaseCredentials") | ForEach-Object {
if ($PSBoundParameters.ContainsKey($_) -eq $true) { $hasOptionalParams = $true }
}
if ($hasOptionalParams -eq $false) {
@@ -92,6 +97,14 @@ function Set-TargetResource
if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null }
+ if($params.ContainsKey("DatabaseAuthenticationType")) {
+ if ($params.DatabaseAuthenticationType -eq "SQL") {
+ $params.Add("DatabaseUsername", $params.DatabaseCredentials.Username)
+ $params.Add("DatabasePassword", (ConvertTo-SecureString $params.DatabaseCredentials.GetNetworkCredential().Password -AsPlainText -Force))
+ }
+ $params.Remove("DatabaseAuthenticationType")
+ }
+
New-SPSecureStoreServiceApplication @params | New-SPSecureStoreServiceApplicationProxy -Name "$($params.Name) Proxy"
}
} else {
@@ -130,12 +143,11 @@ function Test-TargetResource
[parameter(Mandatory = $true)] [System.Boolean] $AuditingEnabled,
[parameter(Mandatory = $false)] [System.UInt32] $AuditlogMaxSize,
[parameter(Mandatory = $false)] [System.String] $DatabaseName,
- [parameter(Mandatory = $false)] [System.String] $DatabasePassword,
[parameter(Mandatory = $false)] [System.String] $DatabaseServer,
- [parameter(Mandatory = $false)] [System.String] $DatabaseUsername,
[parameter(Mandatory = $false)] [System.String] $FailoverDatabaseServer,
[parameter(Mandatory = $false)] [System.Boolean] $PartitionMode,
[parameter(Mandatory = $false)] [System.Boolean] $Sharing,
+ [parameter(Mandatory = $false)] [ValidateSet("Windows", "SQL")] [System.String] $DatabaseAuthenticationType,
[parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials,
[parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
)
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.schema.mof
index 8b4bc052d..083cc00d7 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.schema.mof
@@ -1,3 +1,21 @@
+/*
+**Description**
+
+This resource is responsible for provisioning and configuring the secure store service application.
+The parameters passed in (except those related to database specifics) are validated and set when the resource is run, the database values are only used in provisioning of the service application.
+
+**Example**
+
+ xSPSecureStoreServiceApp SecureStoreServiceApp
+ {
+ Name = "Secure Store Service Application"
+ ApplicationPool = "SharePoint Service Applications"
+ AuditingEnabled = $true
+ AuditlogMaxSize = 30
+ DatabaseName = "SP_SecureStore"
+ InstallAccount = $InstallAccount
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPSecureStoreServiceApp")]
class MSFT_xSPSecureStoreServiceApp : OMI_BaseResource
{
@@ -7,9 +25,8 @@ class MSFT_xSPSecureStoreServiceApp : OMI_BaseResource
[Write] uint32 AuditlogMaxSize;
[Write, EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials;
[Write] string DatabaseName;
- [Write] string DatabasePassword;
[Write] string DatabaseServer;
- [Write] string DatabaseUsername;
+ [Write, ValueMap {"Windows","SQL"}, Values{"Windows","SQL"}] string DatabaseAuthenticationType;
[Write] string FailoverDatabaseServer;
[Write] boolean PartitionMode;
[Write] boolean Sharing;
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.schema.mof
index 6db5884ac..6af668629 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.schema.mof
@@ -1,3 +1,18 @@
+/*
+**Description**
+
+This resource is used for provisioning an application pool that can be used for service applications.
+The account used for the service account must already be registered as a managed account (which can be provisioned through [xSPManagedAccount](xSPManagedAccount)).
+
+**Example**
+
+ xSPServiceAppPool MainServiceAppPool
+ {
+ Name = "SharePoint Service Applications"
+ ServiceAccount = "Demo\ServiceAccount"
+ InstallAccount = $InstallAccount
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPServiceAppPool")]
class MSFT_xSPServiceAppPool : OMI_BaseResource
{
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.schema.mof
index 04d098e42..20166fd82 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.schema.mof
@@ -1,3 +1,25 @@
+/*
+**Description**
+
+This resource is used to specify if a specific service should be running (Ensure = "Present") or not running (Ensure = "Absent") on the current server.
+The name is the display name of the service as shown in the Central Admin website.
+
+**Examples**
+
+ xSPServiceInstance ManagedMetadataServiceInstance
+ {
+ Name = "Managed Metadata Web Service"
+ Ensure = "Present"
+ InstallAccount = $InstallAccount
+ }
+
+ xSPServiceInstance StopBCSServiceInstance
+ {
+ Name = "Business Data Connectivity Service"
+ Ensure = "Absent"
+ InstallAccount = $InstallAccount
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPServiceInstance")]
class MSFT_xSPServiceInstance : OMI_BaseResource
{
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.schema.mof
index 57f943d3a..c15fdf69c 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.schema.mof
@@ -1,3 +1,23 @@
+/*
+**Description**
+
+This resource will provision a site collection to the current farm, based on the settings that are passed through.
+These settings map to the New-SPSite cmdlet and accept the same values and types.
+
+The current version of xSharePoint is only able to check for the existence of a site collection, the additional parameters are not checked for yet, but will be in a later release
+
+**Example**
+
+ xSPSite TeamSite
+ {
+ Url = "http://sharepoint.contoso.com"
+ OwnerAlias = "CONTOSO\ExampleUser"
+ HostHeaderWebApplication = "http://spsites.contoso.com"
+ Name = "Team Sites"
+ Template = "STS#0"
+ PsDscRunAsCredential = $InstallAccount
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPSite")]
class MSFT_xSPSite : OMI_BaseResource
{
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.schema.mof
index c068a9051..771f73a26 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.schema.mof
@@ -1,3 +1,18 @@
+/*
+**Description**
+
+This resource provisions an instance of the state service in to the local farm.
+The database specific parameters are only used during initial provisioning of the app, and will not change database settings beyond the initial deployment.
+
+**Example**
+
+ xSPStateServiceApp StateServiceApp
+ {
+ Name = "State Service Application"
+ DatabaseName = "SP_State"
+ PsDscRunAsCredential = $InstallAccount
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPStateServiceApp")]
class MSFT_xSPStateServiceApp : OMI_BaseResource
{
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1
index 4fd51fefe..18adf7e2e 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1
@@ -7,9 +7,8 @@ function Get-TargetResource
[parameter(Mandatory = $true)] [System.String] $Name,
[parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount,
[parameter(Mandatory = $false)] [System.String] $DatabaseName,
- [parameter(Mandatory = $false)] [System.String] $DatabasePassword,
[parameter(Mandatory = $false)] [System.String] $DatabaseServer,
- [parameter(Mandatory = $false)] [System.String] $DatabaseUsername,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials,
[parameter(Mandatory = $false)] [System.String] $FailoverDatabaseServer,
[parameter(Mandatory = $false)] [System.UInt32] $UsageLogCutTime,
[parameter(Mandatory = $false)] [System.String] $UsageLogLocation,
@@ -63,9 +62,8 @@ function Set-TargetResource
[parameter(Mandatory = $true)] [System.String] $Name,
[parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount,
[parameter(Mandatory = $false)] [System.String] $DatabaseName,
- [parameter(Mandatory = $false)] [System.String] $DatabasePassword,
[parameter(Mandatory = $false)] [System.String] $DatabaseServer,
- [parameter(Mandatory = $false)] [System.String] $DatabaseUsername,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials,
[parameter(Mandatory = $false)] [System.String] $FailoverDatabaseServer,
[parameter(Mandatory = $false)] [System.UInt32] $UsageLogCutTime,
[parameter(Mandatory = $false)] [System.String] $UsageLogLocation,
@@ -84,9 +82,11 @@ function Set-TargetResource
$newParams = @{}
$newParams.Add("Name", $params.Name)
if ($params.ContainsKey("DatabaseName")) { $newParams.Add("DatabaseName", $params.DatabaseName) }
- if ($params.ContainsKey("DatabasePassword")) { $newParams.Add("DatabasePassword", (ConvertTo-SecureString -String $params.DatabasePassword -AsPlainText -force)) }
+ if ($params.ContainsKey("DatabaseCredentials")) {
+ $params.Add("DatabaseUsername", $params.DatabaseCredentials.Username)
+ $params.Add("DatabasePassword", (ConvertTo-SecureString $params.DatabaseCredentials.GetNetworkCredential().Password -AsPlainText -Force))
+ }
if ($params.ContainsKey("DatabaseServer")) { $newParams.Add("DatabaseServer", $params.DatabaseServer) }
- if ($params.ContainsKey("DatabaseUsername")) { $newParams.Add("DatabaseUsername", $params.DatabaseUsername) }
if ($params.ContainsKey("FailoverDatabaseServer")) { $newParams.Add("FailoverDatabaseServer", $params.FailoverDatabaseServer) }
New-SPUsageApplication @newParams
@@ -118,9 +118,8 @@ function Test-TargetResource
[parameter(Mandatory = $true)] [System.String] $Name,
[parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount,
[parameter(Mandatory = $false)] [System.String] $DatabaseName,
- [parameter(Mandatory = $false)] [System.String] $DatabasePassword,
[parameter(Mandatory = $false)] [System.String] $DatabaseServer,
- [parameter(Mandatory = $false)] [System.String] $DatabaseUsername,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials,
[parameter(Mandatory = $false)] [System.String] $FailoverDatabaseServer,
[parameter(Mandatory = $false)] [System.UInt32] $UsageLogCutTime,
[parameter(Mandatory = $false)] [System.String] $UsageLogLocation,
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.schema.mof
index 81c7bdd83..9b8c513e6 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.schema.mof
@@ -1,12 +1,29 @@
+/*
+**Description**
+
+This resource provisions an instance of the usage and health monitoring service application.
+The database settings are only used for initial provisioning, but the usage settings can be changed and will be enforced as the resource is executed.
+
+**Example**
+
+ xSPUsageApplication UsageApplication
+ {
+ Name = "Usage Service Application"
+ DatabaseName = "SP_Usage"
+ UsageLogCutTime = 5
+ UsageLogLocation = "L:\UsageLogs"
+ UsageLogMaxFileSizeKB = 1024
+ InstallAccount = $InstallAccount
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPUsageApplication")]
class MSFT_xSPUsageApplication : OMI_BaseResource
{
[Key] string Name;
[Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount;
[Write] string DatabaseName;
- [Write] string DatabasePassword;
[Write] string DatabaseServer;
- [Write] string DatabaseUsername;
+ [Write, EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials;
[Write] string FailoverDatabaseServer;
[Write] uint32 UsageLogCutTime;
[Write] string UsageLogLocation;
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.schema.mof
index 6e5592696..c64f0ce4e 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.schema.mof
@@ -1,3 +1,28 @@
+/*
+**Description**
+
+This resource will provision an instance of the user profile service to the farm.
+It creates the required databases using the parameters that are passed in to it (although these are only used during the initial provisioning).
+The farm account is used during the provisioning of the service only (in the set method), and the install account is used in the get and test methods.
+This is done to ensure that the databases are created with the correct schema owners and allow the user profile sync service to operate correctly.
+
+**Example**
+
+ xSPUserProfileServiceApp UserProfileServiceApp
+ {
+ Name = "User Profile Service Application"
+ ApplicationPool = "SharePoint Service Applications"
+ MySiteHostLocation = "http://my.sharepoint.contoso.local"
+ ProfileDBName = "SP_UserProfiles"
+ ProfileDBServer = "SQL.contoso.local\SQLINSTANCE"
+ SocialDBName = "SP_Social"
+ SocialDBServer = "SQL.contoso.local\SQLINSTANCE"
+ SyncDBName = "SP_ProfileSync"
+ SyncDBServer = "SQL.contoso.local\SQLINSTANCE"
+ FarmAccount = $FarmAccount
+ PsDscRunAsCredential = $SetupAccount
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPUserProfileServiceApp")]
class MSFT_xSPUserProfileServiceApp : OMI_BaseResource
{
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.schema.mof
index eef2f3df5..f92ad42a3 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.schema.mof
@@ -1,3 +1,21 @@
+/*
+**Description**
+
+This resource is responsible for ensuring that the user profile sync service has been provisioned (Ensure = "Present") or is not running (Ensure = "Absent") on the current server.
+This resource uses the InstallAccount to validate the current state only, the set method which will do the provisioning uses the FarmAccount to do the actual work - this means that CredSSP authentication will need to be permitted to allow a connection to the local server.
+To allow successful provisioning the farm account must be in the local administrators group, however it is not best practice to leave this account in the Administrators group.
+Therefore this resource will add the FarmAccount credential to the local administrators group at the beginning of the set method, and then remove it once it has completed its work.
+
+**Example**
+
+ xSPUserProfileSyncService UserProfileSyncService
+ {
+ UserProfileServiceAppName = "User Profile Service Application"
+ Ensure = "Present"
+ FarmAccount = $FarmAccount
+ InstallAccount = $InstallAccount
+ }
+*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPUserProfileSyncService")]
class MSFT_xSPUserProfileSyncService : OMI_BaseResource
{
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppBlockedFileTypes/MSFT_xSPWebAppBlockedFileTypes.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppBlockedFileTypes/MSFT_xSPWebAppBlockedFileTypes.psm1
new file mode 100644
index 000000000..d18569e3b
--- /dev/null
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppBlockedFileTypes/MSFT_xSPWebAppBlockedFileTypes.psm1
@@ -0,0 +1,88 @@
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $Url,
+ [parameter(Mandatory = $false)] [System.String[]] $Blocked,
+ [parameter(Mandatory = $false)] [System.String[]] $EnsureBlocked,
+ [parameter(Mandatory = $false)] [System.String[]] $EnsureAllowed,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ Write-Verbose -Message "Getting web application '$url' blocked file types"
+
+ $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments @($PSBoundParameters,$PSScriptRoot) -ScriptBlock {
+ $params = $args[0]
+ $ScriptRoot = $args[1]
+
+
+ $wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue
+ if ($null -eq $wa) { return $null }
+
+ Import-Module (Join-Path $ScriptRoot "..\..\Modules\xSharePoint.WebApplication\xSPWebApplication.BlockedFileTypes.psm1" -Resolve)
+
+ $result = Get-xSPWebApplicationBlockedFileTypes -WebApplication $wa
+ $result.Add("Url", $params.Url)
+ $result.Add("InstallAccount", $params.InstallAccount)
+ return $result
+ }
+ return $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $Url,
+ [parameter(Mandatory = $false)] [System.String[]] $Blocked,
+ [parameter(Mandatory = $false)] [System.String[]] $EnsureBlocked,
+ [parameter(Mandatory = $false)] [System.String[]] $EnsureAllowed,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ Write-Verbose -Message "Setting web application '$Url' blocked file types"
+ $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments @($PSBoundParameters,$PSScriptRoot) -ScriptBlock {
+ $params = $args[0]
+ $ScriptRoot = $args[1]
+
+ $wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue
+ if ($null -eq $wa) {
+ throw "Web application $($params.Url) was not found"
+ return
+ }
+
+ Import-Module (Join-Path $ScriptRoot "..\..\Modules\xSharePoint.WebApplication\xSPWebApplication.BlockedFileTypes.psm1" -Resolve)
+ Set-xSPWebApplicationBlockedFileTypes -WebApplication $wa -Settings $params
+ $wa.Update()
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $Url,
+ [parameter(Mandatory = $false)] [System.String[]] $Blocked,
+ [parameter(Mandatory = $false)] [System.String[]] $EnsureBlocked,
+ [parameter(Mandatory = $false)] [System.String[]] $EnsureAllowed,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ $CurrentValues = Get-TargetResource @PSBoundParameters
+ Write-Verbose -Message "Testing for web application '$Url' blocked file types"
+ if ($null -eq $CurrentValues) { return $false }
+
+ Import-Module (Join-Path $PSScriptRoot "..\..\Modules\xSharePoint.WebApplication\xSPWebApplication.BlockedFileTypes.psm1" -Resolve)
+ return Test-xSPWebApplicationBlockedFileTypes -CurrentSettings $CurrentValues -DesiredSettings $PSBoundParameters
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppBlockedFileTypes/MSFT_xSPWebAppBlockedFileTypes.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppBlockedFileTypes/MSFT_xSPWebAppBlockedFileTypes.schema.mof
new file mode 100644
index 000000000..123a88276
--- /dev/null
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppBlockedFileTypes/MSFT_xSPWebAppBlockedFileTypes.schema.mof
@@ -0,0 +1,30 @@
+/*
+**Description**
+
+This resource is responsible for controlling the blocked file type setting on a specific web application.
+It has two modes of operation, the first is to use the 'blocked' property, where you are able to define a specific list of file types that will be blocked.
+In this mode when it is detected that the list does not match the local farm, it is set to match this list exactly.
+The second mode is to use the 'EnsureBlocked' and 'EnsureAllowed' properties.
+EnsureBlocked will check to make sure that the specified file types are on the list, and if not they will be added.
+EnsureAllowed checks to make sure that a file type is not on the list, and if it is it will be removed.
+Both of these properties will only make changes to the file types in their list and will leave the full list as it is otherwise, whereas the blocked property resets the list in full.
+
+**Example**
+
+ xSPBlockedFileTypes PrimaryWebAppBlockedFileTypes
+ {
+ Url = "Shttp://exmaple.contoso.local"
+ EnsureBlocked = @("exe", "dll", "msi")
+ EnsureAllowed = @("pdf", "docx", "xlsx")
+ PsDscRunAsCredential = $InstallAccount
+ }
+*/
+[ClassVersion("1.0.0"), FriendlyName("xSPWebAppBlockedFileTypes")]
+Class MSFT_xSPWebAppBlockedFileTypes : OMI_BaseResource
+{
+ [Key] string Url;
+ [write] string Blocked[];
+ [write] string EnsureBlocked[];
+ [write] string EnsureAllowed[];
+ [Write, EmbeddedInstance("MSFT_Credential")] string InstallAccount;
+};
\ No newline at end of file
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppGeneralSettings/MSFT_xSPWebAppGeneralSettings.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppGeneralSettings/MSFT_xSPWebAppGeneralSettings.psm1
new file mode 100644
index 000000000..167a00d21
--- /dev/null
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppGeneralSettings/MSFT_xSPWebAppGeneralSettings.psm1
@@ -0,0 +1,124 @@
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $Url,
+ [parameter(Mandatory = $false)] [System.UInt32] $TimeZone,
+ [parameter(Mandatory = $false)] [System.Boolean] $Alerts,
+ [parameter(Mandatory = $false)] [System.UInt32] $AlertsLimit,
+ [parameter(Mandatory = $false)] [System.Boolean] $RSS,
+ [parameter(Mandatory = $false)] [System.Boolean] $BlogAPI,
+ [parameter(Mandatory = $false)] [System.Boolean] $BlogAPIAuthenticated,
+ [parameter(Mandatory = $false)] [ValidateSet("Stric","Permissive")] [System.String] $BrowserFileHandling,
+ [parameter(Mandatory = $false)] [System.Boolean] $SecurityValidation,
+ [parameter(Mandatory = $false)] [System.Boolean] $RecycleBinEnabled,
+ [parameter(Mandatory = $false)] [System.Boolean] $RecycleBinCleanupEnabled,
+ [parameter(Mandatory = $false)] [System.UInt32] $RecycleBinRetentionPeriod,
+ [parameter(Mandatory = $false)] [System.UInt32] $SecondStageRecycleBinQuota,
+ [parameter(Mandatory = $false)] [System.UInt32] $MaximumUploadSize,
+ [parameter(Mandatory = $false)] [System.Boolean] $CustomerExperienceProgram,
+ [parameter(Mandatory = $false)] [System.Boolean] $PresenceEnabled,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ Write-Verbose -Message "Getting web application '$url' general settings"
+
+ $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments @($PSBoundParameters,$PSScriptRoot) -ScriptBlock {
+ $params = $args[0]
+ $ScriptRoot = $args[1]
+
+
+ $wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue
+ if ($null -eq $wa) { return $null }
+
+ Import-Module (Join-Path $ScriptRoot "..\..\Modules\xSharePoint.WebApplication\xSPWebApplication.GeneralSettings.psm1" -Resolve)
+
+ $result = Get-xSPWebApplicationGeneralSettings -WebApplication $wa
+ $result.Add("Url", $params.Url)
+ $result.Add("InstallAccount", $params.InstallAccount)
+ return $result
+ }
+ return $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $Url,
+ [parameter(Mandatory = $false)] [System.UInt32] $TimeZone,
+ [parameter(Mandatory = $false)] [System.Boolean] $Alerts,
+ [parameter(Mandatory = $false)] [System.UInt32] $AlertsLimit,
+ [parameter(Mandatory = $false)] [System.Boolean] $RSS,
+ [parameter(Mandatory = $false)] [System.Boolean] $BlogAPI,
+ [parameter(Mandatory = $false)] [System.Boolean] $BlogAPIAuthenticated,
+ [parameter(Mandatory = $false)] [ValidateSet("Stric","Permissive")] [System.String] $BrowserFileHandling,
+ [parameter(Mandatory = $false)] [System.Boolean] $SecurityValidation,
+ [parameter(Mandatory = $false)] [System.Boolean] $RecycleBinEnabled,
+ [parameter(Mandatory = $false)] [System.Boolean] $RecycleBinCleanupEnabled,
+ [parameter(Mandatory = $false)] [System.UInt32] $RecycleBinRetentionPeriod,
+ [parameter(Mandatory = $false)] [System.UInt32] $SecondStageRecycleBinQuota,
+ [parameter(Mandatory = $false)] [System.UInt32] $MaximumUploadSize,
+ [parameter(Mandatory = $false)] [System.Boolean] $CustomerExperienceProgram,
+ [parameter(Mandatory = $false)] [System.Boolean] $PresenceEnabled,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ Write-Verbose -Message "Applying general settings '$Url'"
+ $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments @($PSBoundParameters,$PSScriptRoot) -ScriptBlock {
+ $params = $args[0]
+ $ScriptRoot = $args[1]
+
+ $wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue
+ if ($null -eq $wa) {
+ throw "Web application $($params.Url) was not found"
+ return
+ }
+
+ Import-Module (Join-Path $ScriptRoot "..\..\Modules\xSharePoint.WebApplication\xSPWebApplication.GeneralSettings.psm1" -Resolve)
+ Set-xSPWebApplicationGeneralSettings -WebApplication $wa -Settings $params
+ $wa.Update()
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $Url,
+ [parameter(Mandatory = $false)] [System.UInt32] $TimeZone,
+ [parameter(Mandatory = $false)] [System.Boolean] $Alerts,
+ [parameter(Mandatory = $false)] [System.UInt32] $AlertsLimit,
+ [parameter(Mandatory = $false)] [System.Boolean] $RSS,
+ [parameter(Mandatory = $false)] [System.Boolean] $BlogAPI,
+ [parameter(Mandatory = $false)] [System.Boolean] $BlogAPIAuthenticated,
+ [parameter(Mandatory = $false)] [ValidateSet("Stric","Permissive")] [System.String] $BrowserFileHandling,
+ [parameter(Mandatory = $false)] [System.Boolean] $SecurityValidation,
+ [parameter(Mandatory = $false)] [System.Boolean] $RecycleBinEnabled,
+ [parameter(Mandatory = $false)] [System.Boolean] $RecycleBinCleanupEnabled,
+ [parameter(Mandatory = $false)] [System.UInt32] $RecycleBinRetentionPeriod,
+ [parameter(Mandatory = $false)] [System.UInt32] $SecondStageRecycleBinQuota,
+ [parameter(Mandatory = $false)] [System.UInt32] $MaximumUploadSize,
+ [parameter(Mandatory = $false)] [System.Boolean] $CustomerExperienceProgram,
+ [parameter(Mandatory = $false)] [System.Boolean] $PresenceEnabled,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ $CurrentValues = Get-TargetResource @PSBoundParameters
+ Write-Verbose -Message "Testing for web application general settings '$Url'"
+ if ($null -eq $CurrentValues) { return $false }
+
+ Import-Module (Join-Path $PSScriptRoot "..\..\Modules\xSharePoint.WebApplication\xSPWebApplication.GeneralSettings.psm1" -Resolve)
+ return Test-xSPWebApplicationGeneralSettings -CurrentSettings $CurrentValues -DesiredSettings $PSBoundParameters
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppGeneralSettings/MSFT_xSPWebAppGeneralSettings.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppGeneralSettings/MSFT_xSPWebAppGeneralSettings.schema.mof
new file mode 100644
index 000000000..f6e535682
--- /dev/null
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppGeneralSettings/MSFT_xSPWebAppGeneralSettings.schema.mof
@@ -0,0 +1,39 @@
+/*
+**Description**
+
+This resource is responsible for setting web application settings that are found under the "general settings" screen in central admin.
+The web application is specified through the URL property, and then any combination of settings can be applied.
+Any settings not included will be left as the default (or whatever they have been manually changed to within SharePoint).
+
+**Example**
+
+ xSPWebAppGeneralSettings PrimaryWebAppGeneralSettings
+ {
+ Url = "Shttp://exmaple.contoso.local"
+ TimeZone = 76
+ Alerts = $true
+ RSS = $false
+ PsDscRunAsCredential = $InstallAccount
+ }
+*/
+[ClassVersion("1.0.0"), FriendlyName("xSPWebAppGeneralSettings")]
+Class MSFT_xSPWebAppGeneralSettings : OMI_BaseResource
+{
+ [Key] string Url;
+ [write] uint32 TimeZone;
+ [write] boolean Alerts;
+ [write] uint32 AlertsLimit;
+ [write] boolean RSS;
+ [write] boolean BlogAPI;
+ [write] boolean BlogAPIAuthenticated;
+ [write, ValueMap{"Strict","Permissive"}, Values{"Stric","Permissive"}] String BrowserFileHandling;
+ [write] boolean SecurityValidation;
+ [write] boolean RecycleBinEnabled;
+ [write] boolean RecycleBinCleanupEnabled;
+ [write] uint32 RecycleBinRetentionPeriod;
+ [write] uint32 SecondStageRecycleBinQuota;
+ [write] uint32 MaximumUploadSize;
+ [write] boolean CustomerExperienceProgram;
+ [write] boolean PresenceEnabled;
+ [Write, EmbeddedInstance("MSFT_Credential")] string InstallAccount;
+};
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppThrottlingSettings/MSFT_xSPWebAppThrottlingSettings.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppThrottlingSettings/MSFT_xSPWebAppThrottlingSettings.psm1
new file mode 100644
index 000000000..9484b4ecc
--- /dev/null
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppThrottlingSettings/MSFT_xSPWebAppThrottlingSettings.psm1
@@ -0,0 +1,118 @@
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $Url,
+ [parameter(Mandatory = $false)] [System.UInt32] $ListViewThreshold,
+ [parameter(Mandatory = $false)] [System.Boolean] $AllowObjectModelOverride,
+ [parameter(Mandatory = $false)] [System.UInt32] $AdminThreshold,
+ [parameter(Mandatory = $false)] [System.UInt32] $ListViewLookupThreshold,
+ [parameter(Mandatory = $false)] [System.Boolean] $HappyHourEnabled,
+ [parameter(Mandatory = $false)] [Microsoft.Management.Infrastructure.CimInstance] $HappyHour,
+ [parameter(Mandatory = $false)] [System.UInt32] $UniquePermissionThreshold,
+ [parameter(Mandatory = $false)] [System.Boolean] $RequestThrottling,
+ [parameter(Mandatory = $false)] [System.Boolean] $ChangeLogEnabled,
+ [parameter(Mandatory = $false)] [System.UInt32] $ChangeLogExpiryDays,
+ [parameter(Mandatory = $false)] [System.Boolean] $EventHandlersEnabled,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ Write-Verbose -Message "Getting web application '$url' throttling settings"
+
+ $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments @($PSBoundParameters,$PSScriptRoot) -ScriptBlock {
+ $params = $args[0]
+ $ScriptRoot = $args[1]
+
+ $wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue
+ if ($null -eq $wa) { return $null }
+
+ Import-Module (Join-Path $ScriptRoot "..\..\Modules\xSharePoint.WebApplication\xSPWebApplication.Throttling.psm1" -Resolve)
+
+ $result = Get-xSPWebApplicationThrottlingSettings -WebApplication $wa
+ $result.Add("Url", $params.Url)
+ $result.Add("InstallAccount", $params.InstallAccount)
+ return $result
+ }
+ return $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $Url,
+ [parameter(Mandatory = $false)] [System.UInt32] $ListViewThreshold,
+ [parameter(Mandatory = $false)] [System.Boolean] $AllowObjectModelOverride,
+ [parameter(Mandatory = $false)] [System.UInt32] $AdminThreshold,
+ [parameter(Mandatory = $false)] [System.UInt32] $ListViewLookupThreshold,
+ [parameter(Mandatory = $false)] [System.Boolean] $HappyHourEnabled,
+ [parameter(Mandatory = $false)] [Microsoft.Management.Infrastructure.CimInstance] $HappyHour,
+ [parameter(Mandatory = $false)] [System.UInt32] $UniquePermissionThreshold,
+ [parameter(Mandatory = $false)] [System.Boolean] $RequestThrottling,
+ [parameter(Mandatory = $false)] [System.Boolean] $ChangeLogEnabled,
+ [parameter(Mandatory = $false)] [System.UInt32] $ChangeLogExpiryDays,
+ [parameter(Mandatory = $false)] [System.Boolean] $EventHandlersEnabled,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ Write-Verbose -Message "Setting web application '$Url' throttling settings"
+ $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments @($PSBoundParameters,$PSScriptRoot) -ScriptBlock {
+ $params = $args[0]
+ $ScriptRoot = $args[1]
+
+ $wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue
+ if ($null -eq $wa) {
+ throw "Web application $($params.Url) was not found"
+ return
+ }
+
+ Import-Module (Join-Path $ScriptRoot "..\..\Modules\xSharePoint.WebApplication\xSPWebApplication.Throttling.psm1" -Resolve)
+ Set-xSPWebApplicationThrottlingSettings -WebApplication $wa -Settings $params
+ $wa.Update()
+
+ # Happy hour settings
+ if ($params.ContainsKey("HappyHour") -eq $true) {
+ # Happy hour settins use separate update method so use a fresh web app to update these
+ $wa2 = Get-SPWebApplication -Identity $params.Url
+ Set-xSPWebApplicationHappyHourSettings -WebApplication $wa2 -Settings $params.HappyHour
+ }
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $Url,
+ [parameter(Mandatory = $false)] [System.UInt32] $ListViewThreshold,
+ [parameter(Mandatory = $false)] [System.Boolean] $AllowObjectModelOverride,
+ [parameter(Mandatory = $false)] [System.UInt32] $AdminThreshold,
+ [parameter(Mandatory = $false)] [System.UInt32] $ListViewLookupThreshold,
+ [parameter(Mandatory = $false)] [System.Boolean] $HappyHourEnabled,
+ [parameter(Mandatory = $false)] [Microsoft.Management.Infrastructure.CimInstance] $HappyHour,
+ [parameter(Mandatory = $false)] [System.UInt32] $UniquePermissionThreshold,
+ [parameter(Mandatory = $false)] [System.Boolean] $RequestThrottling,
+ [parameter(Mandatory = $false)] [System.Boolean] $ChangeLogEnabled,
+ [parameter(Mandatory = $false)] [System.UInt32] $ChangeLogExpiryDays,
+ [parameter(Mandatory = $false)] [System.Boolean] $EventHandlersEnabled,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ $CurrentValues = Get-TargetResource @PSBoundParameters
+ Write-Verbose -Message "Testing for web application '$Url' throttling settings"
+ if ($null -eq $CurrentValues) { return $false }
+
+ Import-Module (Join-Path $PSScriptRoot "..\..\Modules\xSharePoint.WebApplication\xSPWebApplication.Throttling.psm1" -Resolve)
+ return Test-xSPWebApplicationThrottlingSettings -CurrentSettings $CurrentValues -DesiredSettings $PSBoundParameters
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppThrottlingSettings/MSFT_xSPWebAppThrottlingSettings.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppThrottlingSettings/MSFT_xSPWebAppThrottlingSettings.schema.mof
new file mode 100644
index 000000000..e7673af15
--- /dev/null
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppThrottlingSettings/MSFT_xSPWebAppThrottlingSettings.schema.mof
@@ -0,0 +1,50 @@
+[ClassVersion("1.0.0")]
+Class MSFT_xSPWebApplicationHappyHour
+{
+ [write] uint32 Hour;
+ [write] uint32 Minute;
+ [write] uint32 Duration;
+
+};
+/*
+**Description**
+
+This resource is responsible for setting web application settings that are found under the "resource throttling" screen in central admin.
+The web application is specified through the URL property, and then any combination of settings can be applied.
+Any settings not included will be left as the default (or whatever they have been manually changed to within SharePoint).
+Happy hour is the setting used to control the window where threshold do not apply throughout the day.
+You can specify the start time of this window as well as how many hours it will last.
+
+**Example**
+
+ xSPWebAppThrottlingSettings PrimaryWebAppThrottlingSettings
+ {
+ Url = "Shttp://exmaple.contoso.local"
+ ListViewThreshold = 5000
+ AllowObjectModelOverride = $false
+ HappyHourEnabled = $true
+ HappyHour = MSFT_xSPWebApplicationHappyHour {
+ Hour = 3
+ Minute = 0
+ Duration = 1
+ }
+ PsDscRunAsCredential = $InstallAccount
+ }
+*/
+[ClassVersion("1.0.0"), FriendlyName("xSPWebAppThrottlingSettings")]
+Class MSFT_xSPWebAppThrottlingSettings : OMI_BaseResource
+{
+ [Key] string Url;
+ [write] uint32 ListViewThreshold;
+ [write] boolean AllowObjectModelOverride;
+ [write] uint32 AdminThreshold;
+ [write] uint32 ListViewLookupThreshold;
+ [write] boolean HappyHourEnabled;
+ [Write, EmbeddedInstance("MSFT_xSPWebApplicationHappyHour")] string HappyHour;
+ [write] uint32 UniquePermissionThreshold;
+ [write] boolean RequestThrottling;
+ [write] boolean ChangeLogEnabled;
+ [write] uint32 ChangeLogExpiryDays;
+ [write] boolean EventHandlersEnabled;
+ [Write, EmbeddedInstance("MSFT_Credential")] string InstallAccount;
+};
\ No newline at end of file
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppWorkflowSettings/MSFT_xSPWebAppWorkflowSettings.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppWorkflowSettings/MSFT_xSPWebAppWorkflowSettings.psm1
new file mode 100644
index 000000000..c5841a5d6
--- /dev/null
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppWorkflowSettings/MSFT_xSPWebAppWorkflowSettings.psm1
@@ -0,0 +1,87 @@
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $Url,
+ [parameter(Mandatory = $false)] [System.Boolean] $ExternalWorkflowParticipantsEnabled,
+ [parameter(Mandatory = $false)] [System.Boolean] $UserDefinedWorkflowsEnabled,
+ [parameter(Mandatory = $false)] [System.Boolean] $EmailToNoPermissionWorkflowParticipantsEnable,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ Write-Verbose -Message "Getting web application '$url' workflow settings"
+
+ $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments @($PSBoundParameters,$PSScriptRoot) -ScriptBlock {
+ $params = $args[0]
+ $ScriptRoot = $args[1]
+
+
+ $wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue
+ if ($null -eq $wa) { return $null }
+
+ Import-Module (Join-Path $ScriptRoot "..\..\Modules\xSharePoint.WebApplication\xSPWebApplication.Workflow.psm1" -Resolve)
+
+ $result = Get-xSPWebApplicationWorkflowSettings -WebApplication $wa
+ $result.Add("Url", $params.Url)
+ $result.Add("InstallAccount", $params.InstallAccount)
+ return $result
+ }
+ return $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $Url,
+ [parameter(Mandatory = $false)] [System.Boolean] $ExternalWorkflowParticipantsEnabled,
+ [parameter(Mandatory = $false)] [System.Boolean] $UserDefinedWorkflowsEnabled,
+ [parameter(Mandatory = $false)] [System.Boolean] $EmailToNoPermissionWorkflowParticipantsEnable,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ Write-Verbose -Message "Setting web application '$Url' workflow settings"
+ $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments @($PSBoundParameters,$PSScriptRoot) -ScriptBlock {
+ $params = $args[0]
+ $ScriptRoot = $args[1]
+
+ $wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue
+ if ($null -eq $wa) {
+ throw "Web application $($params.Url) was not found"
+ return
+ }
+
+ Import-Module (Join-Path $ScriptRoot "..\..\Modules\xSharePoint.WebApplication\xSPWebApplication.Workflow.psm1" -Resolve)
+ Set-xSPWebApplicationWorkflowSettings -WebApplication $wa -Settings $params
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)] [System.String] $Url,
+ [parameter(Mandatory = $false)] [System.Boolean] $ExternalWorkflowParticipantsEnabled,
+ [parameter(Mandatory = $false)] [System.Boolean] $UserDefinedWorkflowsEnabled,
+ [parameter(Mandatory = $false)] [System.Boolean] $EmailToNoPermissionWorkflowParticipantsEnable,
+ [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
+ )
+
+ $CurrentValues = Get-TargetResource @PSBoundParameters
+ Write-Verbose -Message "Testing for web application '$Url' workflow settings"
+ if ($null -eq $CurrentValues) { return $false }
+
+ Import-Module (Join-Path $PSScriptRoot "..\..\Modules\xSharePoint.WebApplication\xSPWebApplication.Workflow.psm1" -Resolve)
+ return Test-xSPWebApplicationWorkflowSettings -CurrentSettings $CurrentValues -DesiredSettings $PSBoundParameters
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppWorkflowSettings/MSFT_xSPWebAppWorkflowSettings.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppWorkflowSettings/MSFT_xSPWebAppWorkflowSettings.schema.mof
new file mode 100644
index 000000000..4dfa86c7f
--- /dev/null
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebAppWorkflowSettings/MSFT_xSPWebAppWorkflowSettings.schema.mof
@@ -0,0 +1,26 @@
+/*
+**Description**
+
+This resource is responsible for setting web application settings that are found under the "workflow settings" screen in central admin.
+The web application is specified through the URL property, and then any combination of settings can be applied.
+Any settings not included will be left as the default (or whatever they have been manually changed to within SharePoint).
+
+**Example**
+
+ xSPWebAppWorkflowSettings PrimaryWebAppWorkflowSettings
+ {
+ Url = "Shttp://exmaple.contoso.local"
+ ExternalWorkflowParticipantsEnabled = $false
+ EmailToNoPermissionWorkflowParticipantsEnable = $false
+ PsDscRunAsCredential = $InstallAccount
+ }
+*/
+[ClassVersion("1.0.0"), FriendlyName("xSPWebAppWorkflowSettings")]
+Class MSFT_xSPWebAppWorkflowSettings : OMI_BaseResource
+{
+ [Key] string Url;
+ [write] boolean ExternalWorkflowParticipantsEnabled;
+ [write] boolean UserDefinedWorkflowsEnabled;
+ [write] boolean EmailToNoPermissionWorkflowParticipantsEnable;
+ [Write, EmbeddedInstance("MSFT_Credential")] string InstallAccount;
+};
\ No newline at end of file
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1
index 1b519c8a6..1aaffa8cc 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1
@@ -20,15 +20,14 @@ function Get-TargetResource
Write-Verbose -Message "Getting web application '$Name'"
- $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock {
+ $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments @($PSBoundParameters,$PSScriptRoot) -ScriptBlock {
$params = $args[0]
-
+ $ScriptRoot = $args[1]
$wa = Get-SPWebApplication -Identity $params.Name -ErrorAction SilentlyContinue
if ($null -eq $wa) { return $null }
$authProvider = Get-SPAuthenticationProvider -WebApplication $wa.Url -Zone "Default"
-
if ($authProvider.DisableKerberos -eq $true) { $localAuthMode = "NTLM" } else { $localAuthMode = "Kerberos" }
return @{
@@ -70,30 +69,36 @@ function Set-TargetResource
)
Write-Verbose -Message "Creating web application '$Name'"
-
- $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock {
+ $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments @($PSBoundParameters,$PSScriptRoot) -ScriptBlock {
$params = $args[0]
-
+ $ScriptRoot = $args[1]
$wa = Get-SPWebApplication -Identity $params.Name -ErrorAction SilentlyContinue
if ($null -eq $wa) {
+ $newWebAppParams = @{
+ Name = $params.Name
+ ApplicationPool = $params.ApplicationPool
+ ApplicationPoolAccount = $params.ApplicationPoolAccount
+ Url = $params.Url
+ }
if ($params.ContainsKey("AuthenticationMethod") -eq $true) {
if ($params.AuthenticationMethod -eq "NTLM") {
$ap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication -DisableKerberos
} else {
$ap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication
}
- $params.Remove("AuthenticationMethod")
- $params.Add("AuthenticationProvider", $ap)
+ $newWebAppParams.Add("AuthenticationProvider", $ap)
}
-
- if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null }
if ($params.ContainsKey("AllowAnonymous")) {
- $params.Remove("AllowAnonymous") | Out-Null
- $params.Add("AllowAnonymousAccess", $true)
+ $newWebAppParams.Add("AllowAnonymousAccess", $true)
}
-
- New-SPWebApplication @params
+ if ($params.ContainsKey("DatabaseName") -eq $true) { $newWebAppParams.Add("DatabaseName", $params.DatabaseName) }
+ if ($params.ContainsKey("DatabaseServer") -eq $true) { $newWebAppParams.Add("DatabaseServer", $params.DatabaseServer) }
+ if ($params.ContainsKey("HostHeader") -eq $true) { $newWebAppParams.Add("HostHeader", $params.HostHeader) }
+ if ($params.ContainsKey("Path") -eq $true) { $newWebAppParams.Add("Path", $params.Path) }
+ if ($params.ContainsKey("Port") -eq $true) { $newWebAppParams.Add("Port", $params.Port) }
+
+ $wa = New-SPWebApplication @newWebAppParams
}
}
}
@@ -122,7 +127,11 @@ function Test-TargetResource
$CurrentValues = Get-TargetResource @PSBoundParameters
Write-Verbose -Message "Testing for web application '$Name'"
if ($null -eq $CurrentValues) { return $false }
- return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("ApplicationPool")
+
+ $testReturn = Test-xSharePointSpecificParameters -CurrentValues $CurrentValues `
+ -DesiredValues $PSBoundParameters `
+ -ValuesToCheck @("ApplicationPool")
+ return $testReturn
}
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.schema.mof
index fc82bdb44..fff10e1a3 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.schema.mof
@@ -1,4 +1,26 @@
-[ClassVersion("1.0.0.0"), FriendlyName("xSPWebApplication")]
+/*
+**Description**
+
+This resource is responsible for creating a web application within the local SharePoint farm.
+The resource will provision the web application with all of the current settings, and then ensure that it stays part of the correct application pool beyond that (additional checking and setting of properties will be added in future releases).
+
+**Example**
+
+ xSPWebApplication HostNameSiteCollectionWebApp
+ {
+ Name = "SharePoint Sites"
+ ApplicationPool = "SharePoint Sites"
+ ApplicationPoolAccount = "CONTOSO\svcSPWebApp"
+ AllowAnonymous = $false
+ AuthenticationMethod = "NTLM"
+ DatabaseName = "SP_Content_01"
+ DatabaseServer = "SQL.contoso.local\SQLINSTANCE"
+ Url = "http://example.contoso.local"
+ Port = 80
+ PsDscRunAsCredential = $InstallAccount
+ }
+*/
+[ClassVersion("1.1.0.0"), FriendlyName("xSPWebApplication")]
class MSFT_xSPWebApplication : OMI_BaseResource
{
[Key] string Name;
@@ -12,6 +34,6 @@ class MSFT_xSPWebApplication : OMI_BaseResource
[Write] string HostHeader;
[Write] string Path;
[Write] string Port;
- [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount;
+ [Write, EmbeddedInstance("MSFT_Credential")] string InstallAccount;
};
diff --git a/Modules/xSharePoint/Examples/Single Server/SharePoint.ps1 b/Modules/xSharePoint/Examples/Single Server/SharePoint.ps1
index bdd56999e..80f620084 100644
--- a/Modules/xSharePoint/Examples/Single Server/SharePoint.ps1
+++ b/Modules/xSharePoint/Examples/Single Server/SharePoint.ps1
@@ -1,29 +1,20 @@
Configuration SharePointServer
{
param (
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $CredSSPDelegates,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $SPBinaryPath,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $ULSViewerPath,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $SPBinaryPathCredential,
[Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $FarmAccount,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $InstallAccount,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $ProductKey,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $DatabaseServer,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $FarmPassPhrase,
+ [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $SPSetupAccount,
[Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $WebPoolManagedAccount,
[Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $ServicePoolManagedAccount,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $WebAppUrl,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $TeamSiteUrl,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $MySiteHostUrl,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [int] $CacheSizeInMB
+ [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $domainAdminCredential
)
+
+ Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DscResource -ModuleName xSharePoint
Import-DscResource -ModuleName xWebAdministration
Import-DscResource -ModuleName xCredSSP
- Import-DscResource -ModuleName xDisk
- node "localhost"
- {
+ node $AllNodes.NodeName
+ {
#**********************************************************
# Server configuration
#
@@ -31,71 +22,10 @@ Configuration SharePointServer
# server level configuration, such as disks, registry
# settings etc.
#**********************************************************
-
- xDisk LogsDisk { DiskNumber = 2; DriveLetter = "l" }
- xDisk IndexDisk { DiskNumber = 3; DriveLetter = "i" }
- xCredSSP CredSSPServer { Ensure = "Present"; Role = "Server" }
- xCredSSP CredSSPClient { Ensure = "Present"; Role = "Client"; DelegateComputers = $CredSSPDelegates }
-
-
- #**********************************************************
- # Software downloads
- #
- # This section details where any binary downloads should
- # be downloaded from and put locally on the server before
- # installation takes place
- #**********************************************************
-
- File SPBinaryDownload
- {
- DestinationPath = "C:\SPInstall"
- Credential = $SPBinaryPathCredential
- Ensure = "Present"
- SourcePath = $SPBinaryPath
- Type = "Directory"
- Recurse = $true
- }
- File UlsViewerDownload
- {
- DestinationPath = "L:\UlsViewer.exe"
- Credential = $SPBinaryPathCredential
- Ensure = "Present"
- SourcePath = $ULSViewerPath
- Type = "File"
- DependsOn = "[xDisk]LogsDisk"
- }
-
- #**********************************************************
- # Binary installation
- #
- # This section triggers installation of both SharePoint
- # as well as the prerequisites required
- #**********************************************************
- xSPInstallPrereqs InstallPrerequisites
- {
- InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe"
- OnlineMode = $true
- SQLNCli = "C:\SPInstall\prerequisiteinstallerfiles\sqlncli.msi"
- PowerShell = "C:\SPInstall\prerequisiteinstallerfiles\Windows6.1-KB2506143-x64.msu"
- NETFX = "C:\SPInstall\prerequisiteinstallerfiles\dotNetFx45_Full_setup.exe"
- IDFX = "C:\SPInstall\prerequisiteinstallerfiles\Windows6.1-KB974405-x64.msu"
- Sync = "C:\SPInstall\prerequisiteinstallerfiles\Synchronization.msi"
- AppFabric = "C:\SPInstall\prerequisiteinstallerfiles\WindowsServerAppFabricSetup_x64.exe"
- IDFX11 = "C:\SPInstall\prerequisiteinstallerfiles\MicrosoftIdentityExtensions-64.msi"
- MSIPCClient = "C:\SPInstall\prerequisiteinstallerfiles\setup_msipc_x64.msi"
- WCFDataServices = "C:\SPInstall\prerequisiteinstallerfiles\WcfDataServices.exe"
- KB2671763 = "C:\SPInstall\prerequisiteinstallerfiles\AppFabric1.1-RTM-KB2671763-x64-ENU.exe"
- WCFDataServices56 = "C:\SPInstall\prerequisiteinstallerfiles\WcfDataServices56.exe"
- DependsOn = "[xSPClearRemoteSessions]ClearRemotePowerShellSessions"
- }
- xSPInstall InstallBinaries
- {
- BinaryDir = "C:\SPInstall"
- ProductKey = $ProductKey
- Ensure = "Present"
- DependsOn = "[xSPInstallPrereqs]InstallPrerequisites"
- }
-
+
+ xCredSSP CredSSPServer { Ensure = "Present"; Role = "Server"; }
+ xCredSSP CredSSPClient { Ensure = "Present"; Role = "Client"; DelegateComputers = "*.$($ConfigurationData.NonNodeData.DomainDetails.DomainName)" }
+
#**********************************************************
# IIS clean up
#
@@ -103,13 +33,13 @@ Configuration SharePointServer
# pools from IIS as they are not required
#**********************************************************
- xWebAppPool RemoveDotNet2Pool { Name = ".NET v2.0"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
- xWebAppPool RemoveDotNet2ClassicPool { Name = ".NET v2.0 Classic"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
- xWebAppPool RemoveDotNet45Pool { Name = ".NET v4.5"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites"; }
- xWebAppPool RemoveDotNet45ClassicPool { Name = ".NET v4.5 Classic"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites"; }
- xWebAppPool RemoveClassicDotNetPool { Name = "Classic .NET AppPool"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
- xWebAppPool RemoveDefaultAppPool { Name = "DefaultAppPool"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
- xWebSite RemoveDefaultWebSite { Name = "Default Web Site"; Ensure = "Absent"; PhysicalPath = "C:\inetpub\wwwroot"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
+ xWebAppPool RemoveDotNet2Pool { Name = ".NET v2.0"; Ensure = "Absent" }
+ xWebAppPool RemoveDotNet2ClassicPool { Name = ".NET v2.0 Classic"; Ensure = "Absent" }
+ xWebAppPool RemoveDotNet45Pool { Name = ".NET v4.5"; Ensure = "Absent"; }
+ xWebAppPool RemoveDotNet45ClassicPool { Name = ".NET v4.5 Classic"; Ensure = "Absent"; }
+ xWebAppPool RemoveClassicDotNetPool { Name = "Classic .NET AppPool"; Ensure = "Absent" }
+ xWebAppPool RemoveDefaultAppPool { Name = "DefaultAppPool"; Ensure = "Absent" }
+ xWebSite RemoveDefaultWebSite { Name = "Default Web Site"; Ensure = "Absent"; PhysicalPath = "C:\inetpub\wwwroot" }
#**********************************************************
@@ -119,41 +49,37 @@ Configuration SharePointServer
# provisions generic services and components used by the
# whole farm
#**********************************************************
-
xSPCreateFarm CreateSPFarm
{
- DatabaseServer = $DatabaseServer
- FarmConfigDatabaseName = "SP_Config"
- Passphrase = $FarmPassPhrase
+ DatabaseServer = $ConfigurationData.NonNodeData.SQLServer.FarmDatabaseServer
+ FarmConfigDatabaseName = $ConfigurationData.NonNodeData.SharePoint.Farm.ConfigurationDatabase
+ Passphrase = $ConfigurationData.NonNodeData.SharePoint.Farm.Passphrase
FarmAccount = $FarmAccount
- InstallAccount = $InstallAccount
- AdminContentDatabaseName = "SP_AdminContent"
- DependsOn = "[xSPInstall]InstallBinaries"
+ PsDscRunAsCredential = $SPSetupAccount
+ AdminContentDatabaseName = $ConfigurationData.NonNodeData.SharePoint.Farm.AdminContentDatabase
}
xSPManagedAccount ServicePoolManagedAccount
{
- AccountName = $ServicePoolManagedAccount.UserName
- Account = $ServicePoolManagedAccount
- Schedule = ""
- InstallAccount = $InstallAccount
- DependsOn = "[xSPCreateFarm]CreateSPFarm"
+ AccountName = $ServicePoolManagedAccount.UserName
+ Account = $ServicePoolManagedAccount
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPCreateFarm]CreateSPFarm"
}
xSPManagedAccount WebPoolManagedAccount
{
- AccountName = $WebPoolManagedAccount.UserName
- Account = $WebPoolManagedAccount
- Schedule = ""
- InstallAccount = $InstallAccount
- DependsOn = "[xSPCreateFarm]CreateSPFarm"
+ AccountName = $WebPoolManagedAccount.UserName
+ Account = $WebPoolManagedAccount
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPCreateFarm]CreateSPFarm"
}
xSPDiagnosticLoggingSettings ApplyDiagnosticLogSettings
{
- InstallAccount = $InstallAccount
- LogPath = "L:\ULSLogs"
- LogSpaceInGB = 10
+ PsDscRunAsCredential = $SPSetupAccount
+ LogPath = $ConfigurationData.NonNodeData.SharePoint.DiagnosticLogs.Path
+ LogSpaceInGB = $ConfigurationData.NonNodeData.SharePoint.DiagnosticLogs.MaxSize
AppAnalyticsAutomaticUploadEnabled = $false
CustomerExperienceImprovementProgramEnabled = $true
- DaysToKeepLogs = 7
+ DaysToKeepLogs = $ConfigurationData.NonNodeData.SharePoint.DiagnosticLogs.DaysToKeep
DownloadErrorReportingUpdatesEnabled = $false
ErrorReportingAutomaticUploadEnabled = $false
ErrorReportingEnabled = $false
@@ -172,28 +98,29 @@ Configuration SharePointServer
xSPUsageApplication UsageApplication
{
Name = "Usage Service Application"
- DatabaseName = "SP_Usage"
+ DatabaseName = $ConfigurationData.NonNodeData.SharePoint.UsageLogs.DatabaseName
UsageLogCutTime = 5
- UsageLogLocation = "L:\UsageLogs"
+ UsageLogLocation = $ConfigurationData.NonNodeData.SharePoint.UsageLogs.Path
UsageLogMaxFileSizeKB = 1024
- InstallAccount = $InstallAccount
+ PsDscRunAsCredential = $SPSetupAccount
DependsOn = "[xSPCreateFarm]CreateSPFarm"
}
xSPStateServiceApp StateServiceApp
{
- Name = "State Service Application"
- DatabaseName = "SP_State"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPCreateFarm]CreateSPFarm"
+ Name = "State Service Application"
+ DatabaseName = $ConfigurationData.NonNodeData.SharePoint.StateService.DatabaseName
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPCreateFarm]CreateSPFarm"
}
xSPDistributedCacheService EnableDistributedCache
{
- Name = "AppFabricCachingService"
- Ensure = "Present"
- CacheSizeInMB = $CacheSizeInMB
- ServiceAccount = $ServicePoolManagedAccount.UserName
- InstallAccount = $InstallAccount
- DependsOn = @('[xSPCreateFarm]CreateSPFarm','[xSPManagedAccount]ServicePoolManagedAccount')
+ Name = "AppFabricCachingService"
+ Ensure = "Present"
+ CacheSizeInMB = 1024
+ ServiceAccount = $ServicePoolManagedAccount.UserName
+ PsDscRunAsCredential = $SPSetupAccount
+ CreateFirewallRules = $true
+ DependsOn = @('[xSPCreateFarm]CreateSPFarm','[xSPManagedAccount]ServicePoolManagedAccount')
}
#**********************************************************
@@ -204,47 +131,72 @@ Configuration SharePointServer
# application settings
#**********************************************************
- xSPWebApplication HostNameSiteCollectionWebApp
- {
- Name = "SharePoint Sites"
- ApplicationPool = "SharePoint Sites"
- ApplicationPoolAccount = $WebPoolManagedAccount.UserName
- AllowAnonymous = $false
- AuthenticationMethod = "NTLM"
- DatabaseName = "SP_Content_01"
- DatabaseServer = $DatabaseServer
- Url = $WebAppUrl
- Port = 80
- InstallAccount = $InstallAccount
- DependsOn = "[xSPManagedAccount]WebPoolManagedAccount"
- }
- xSPManagedPath TeamsManagedPath
- {
- WebAppUrl = "http://$WebAppUrl"
- InstallAccount = $InstallAccount
- RelativeUrl = "teams"
- Explicit = $false
- HostHeader = $true
- DependsOn = "[xSPWebApplication]HostNameSiteCollectionWebApp"
- }
- xSPManagedPath PersonalManagedPath
- {
- WebAppUrl = "http://$WebAppUrl"
- InstallAccount = $InstallAccount
- RelativeUrl = "personal"
- Explicit = $false
- HostHeader = $true
- DependsOn = "[xSPWebApplication]HostNameSiteCollectionWebApp"
- }
- xSPCacheAccounts SetCacheAccounts
- {
- WebAppUrl = "http://$WebAppUrl"
- SuperUserAlias = "DEMO\svxSPSuperUser"
- SuperReaderAlias = "DEMO\svxSPReader"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPWebApplication]HostNameSiteCollectionWebApp"
+ foreach($webApp in $ConfigurationData.NonNodeData.SharePoint.WebApplications) {
+ $webAppInternalName = $webApp.Name.Replace(" ", "")
+ xSPWebApplication $webAppInternalName
+ {
+ Name = $webApp.Name
+ ApplicationPool = $webApp.AppPool
+ ApplicationPoolAccount = $webApp.APpPoolAccount
+ AllowAnonymous = $webApp.Anonymous
+ AuthenticationMethod = $webApp.Authentication
+ DatabaseName = $webApp.DatabaseName
+ DatabaseServer = $ConfigurationData.NonNodeData.SQLServer.ContentDatabaseServer
+ Url = $webApp.Url
+ Port = [Uri]::new($webApp.Url).Port
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPManagedAccount]WebPoolManagedAccount"
+ }
+
+ foreach($managedPath in $webApp.ManagedPaths) {
+ xSPManagedPath "$($webAppInternalName)Path$($managedPath.Path)"
+ {
+ WebAppUrl = $webApp.Url
+ PsDscRunAsCredential = $SPSetupAccount
+ RelativeUrl = $managedPath.Path
+ Explicit = $managedPath.Explicit
+ HostHeader = $webApp.UseHostNamedSiteCollections
+ DependsOn = "[xSPWebApplication]$webAppInternalName"
+ }
+ }
+
+ xSPCacheAccounts "$($webAppInternalName)CacheAccounts"
+ {
+ WebAppUrl = $webApp.Url
+ SuperUserAlias = $webApp.SuperUser
+ SuperReaderAlias = $webApp.SuperReader
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPWebApplication]$webAppInternalName"
+ }
+
+ foreach($siteCollection in $webApp.SiteCollections) {
+ $internalSiteName = "$($webAppInternalName)Site$($siteCollection.Name.Replace(' ', ''))"
+ if ($webApp.UseHostNamedSiteCollections -eq $true) {
+ xSPSite $internalSiteName
+ {
+ Url = $siteCollection.Url
+ OwnerAlias = $siteCollection.Owner
+ HostHeaderWebApplication = $webApp.Url
+ Name = $siteCollection.Name
+ Template = $siteCollection.Template
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPWebApplication]$webAppInternalName"
+ }
+ } else {
+ xSPSite $internalSiteName
+ {
+ Url = $siteCollection.Url
+ OwnerAlias = $siteCollection.Owner
+ Name = $siteCollection.Name
+ Template = $siteCollection.Template
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPWebApplication]$webAppInternalName"
+ }
+ }
+ }
}
+
#**********************************************************
# Service instances
#
@@ -254,48 +206,65 @@ Configuration SharePointServer
xSPServiceInstance ClaimsToWindowsTokenServiceInstance
{
- Name = "Claims to Windows Token Service"
- Ensure = "Present"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPCreateFarm]CreateSPFarm"
- }
- xSPServiceInstance UserProfileServiceInstance
- {
- Name = "User Profile Service"
- Ensure = "Present"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPCreateFarm]CreateSPFarm"
- }
- xSPServiceInstance SecureStoreServiceInstance
- {
- Name = "Secure Store Service"
- Ensure = "Present"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPCreateFarm]CreateSPFarm"
+ Name = "Claims to Windows Token Service"
+ Ensure = "Present"
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPCreateFarm]CreateSPFarm"
}
- xSPServiceInstance ManagedMetadataServiceInstance
- {
- Name = "Managed Metadata Web Service"
- Ensure = "Present"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPCreateFarm]CreateSPFarm"
+
+ # App server service instances
+ if ($Node.ServiceRoles.AppServer -eq $true) {
+ xSPServiceInstance UserProfileServiceInstance
+ {
+ Name = "User Profile Service"
+ Ensure = "Present"
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPCreateFarm]CreateSPFarm"
+ }
+ xSPServiceInstance SecureStoreServiceInstance
+ {
+ Name = "Secure Store Service"
+ Ensure = "Present"
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPCreateFarm]CreateSPFarm"
+ }
+
+ xSPUserProfileSyncService UserProfileSyncService
+ {
+ UserProfileServiceAppName = "User Profile Service Application"
+ Ensure = "Present"
+ FarmAccount = $FarmAccount
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPUserProfileServiceApp]UserProfileServiceApp"
+ }
}
- xSPServiceInstance BCSServiceInstance
- {
- Name = "Business Data Connectivity Service"
- Ensure = "Present"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPCreateFarm]CreateSPFarm"
+
+ # Front end service instances
+ if ($Node.ServiceRoles.WebFrontEnd -eq $true) {
+ xSPServiceInstance ManagedMetadataServiceInstance
+ {
+ Name = "Managed Metadata Web Service"
+ Ensure = "Present"
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPCreateFarm]CreateSPFarm"
+ }
+ xSPServiceInstance BCSServiceInstance
+ {
+ Name = "Business Data Connectivity Service"
+ Ensure = "Present"
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPCreateFarm]CreateSPFarm"
+ }
}
- xSPUserProfileSyncService UserProfileSyncService
+
+ xSPServiceInstance SearchServiceInstance
{
- UserProfileServiceAppName = "User Profile Service Application"
- Ensure = "Present"
- FarmAccount = $FarmAccount
- InstallAccount = $InstallAccount
- DependsOn = "[xSPUserProfileServiceApp]UserProfileServiceApp"
+ Name = "SharePoint Server Search"
+ Ensure = "Present"
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPCreateFarm]CreateSPFarm"
}
-
+
#**********************************************************
# Service applications
#
@@ -303,90 +272,65 @@ Configuration SharePointServer
# dependencies
#**********************************************************
+ $serviceAppPoolName = "SharePoint Service Applications"
xSPServiceAppPool MainServiceAppPool
{
- Name = "SharePoint Service Applications"
- ServiceAccount = $ServicePoolManagedAccount.UserName
- InstallAccount = $InstallAccount
- DependsOn = "[xSPCreateFarm]CreateSPFarm"
+ Name = $serviceAppPoolName
+ ServiceAccount = $ServicePoolManagedAccount.UserName
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPCreateFarm]CreateSPFarm"
}
xSPUserProfileServiceApp UserProfileServiceApp
{
- Name = "User Profile Service Application"
- ApplicationPool = "SharePoint Service Applications"
- MySiteHostLocation = "http://$MySiteHostUrl"
- ProfileDBName = "SP_UserProfiles"
- ProfileDBServer = $DatabaseServer
- SocialDBName = "SP_Social"
- SocialDBServer = $DatabaseServer
- SyncDBName = "SP_ProfileSync"
- SyncDBServer = $DatabaseServer
- FarmAccount = $FarmAccount
- InstallAccount = $InstallAccount
- DependsOn = @('[xSPServiceAppPool]MainServiceAppPool', '[xSPManagedPath]PersonalManagedPath', '[xSPSite]MySiteHost', '[xSPManagedMetaDataServiceApp]ManagedMetadataServiceApp', '[xSPSearchServiceApp]SearchServiceApp')
+ Name = "User Profile Service Application"
+ ApplicationPool = $serviceAppPoolName
+ MySiteHostLocation = $ConfigurationData.NonNodeData.SharePoint.UserProfileService.MySiteUrl
+ ProfileDBName = $ConfigurationData.NonNodeData.SharePoint.UserProfileService.ProfileDB
+ ProfileDBServer = $ConfigurationData.NonNodeData.SQLServer.ServiceAppDatabaseServer
+ SocialDBName = $ConfigurationData.NonNodeData.SharePoint.UserProfileService.SocialDB
+ SocialDBServer = $ConfigurationData.NonNodeData.SQLServer.ServiceAppDatabaseServer
+ SyncDBName = $ConfigurationData.NonNodeData.SharePoint.UserProfileService.SyncDB
+ SyncDBServer = $ConfigurationData.NonNodeData.SQLServer.ServiceAppDatabaseServer
+ FarmAccount = $FarmAccount
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = @('[xSPServiceAppPool]MainServiceAppPool', '[xSPManagedMetaDataServiceApp]ManagedMetadataServiceApp', '[xSPSearchServiceApp]SearchServiceApp')
}
xSPSecureStoreServiceApp SecureStoreServiceApp
{
- Name = "Secure Store Service Application"
- ApplicationPool = "SharePoint Service Applications"
- AuditingEnabled = $true
- AuditlogMaxSize = 30
- DatabaseName = "SP_SecureStore"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPServiceAppPool]MainServiceAppPool"
+ Name = "Secure Store Service Application"
+ ApplicationPool = $serviceAppPoolName
+ AuditingEnabled = $true
+ AuditlogMaxSize = 30
+ DatabaseName = $ConfigurationData.NonNodeData.SharePoint.SecureStoreService.DatabaseName
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPServiceAppPool]MainServiceAppPool"
}
xSPManagedMetaDataServiceApp ManagedMetadataServiceApp
{
- Name = "Managed Metadata Service Application"
- InstallAccount = $InstallAccount
- ApplicationPool = "SharePoint Service Applications"
- DatabaseServer = $DatabaseServer
- DatabaseName = "SP_ManagedMetadata"
- DependsOn = "[xSPServiceAppPool]MainServiceAppPool"
- }
- xSPSearchServiceApp SearchServiceApp
- {
- Name = "Search Service Application"
- DatabaseName = "SP_Search"
- ApplicationPool = "SharePoint Service Applications"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPServiceAppPool]MainServiceAppPool"
+ Name = "Managed Metadata Service Application"
+ PsDscRunAsCredential = $SPSetupAccount
+ ApplicationPool = $serviceAppPoolName
+ DatabaseServer = $ConfigurationData.NonNodeData.SQLServer.ServiceAppDatabaseServer
+ DatabaseName = $ConfigurationData.NonNodeData.SharePoint.ManagedMetadataService.DatabaseName
+ DependsOn = "[xSPServiceAppPool]MainServiceAppPool"
}
xSPBCSServiceApp BCSServiceApp
{
- Name = "BCS Service Application"
- ApplicationPool = "SharePoint Service Applications"
- DatabaseName = "SP_BCS"
- DatabaseServer = $DatabaseServer
- InstallAccount = $InstallAccount
- DependsOn = @('[xSPServiceAppPool]MainServiceAppPool', '[xSPSecureStoreServiceApp]SecureStoreServiceApp')
- }
-
- #**********************************************************
- # Site Collections
- #
- # This section contains the site collections to provision
- #**********************************************************
-
- xSPSite TeamSite
- {
- Url = "http://$TeamSiteUrl"
- OwnerAlias = $InstallAccount.UserName
- HostHeaderWebApplication = "http://$WebAppUrl"
- Name = "Team Sites"
- Template = "STS#0"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPWebApplication]HostNameSiteCollectionWebApp"
+ Name = "BCS Service Application"
+ ApplicationPool = $serviceAppPoolName
+ DatabaseName = $ConfigurationData.NonNodeData.SharePoint.BCSService.DatabaseName
+ DatabaseServer = $ConfigurationData.NonNodeData.SQLServer.ServiceAppDatabaseServer
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = @('[xSPServiceAppPool]MainServiceAppPool', '[xSPSecureStoreServiceApp]SecureStoreServiceApp')
}
- xSPSite MySiteHost
- {
- Url = "http://$MySiteHostUrl"
- OwnerAlias = $InstallAccount.UserName
- HostHeaderWebApplication = "http://$WebAppUrl"
- Name = "My Site Host"
- Template = "SPSMSITEHOST#0"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPWebApplication]HostNameSiteCollectionWebApp"
+ xSPSearchServiceApp SearchServiceApp
+ {
+ Name = "Search Service Application"
+ DatabaseName = $ConfigurationData.NonNodeData.SharePoint.Search.DatabaseName
+ DatabaseServer = $ConfigurationData.NonNodeData.SQLServer.ServiceAppDatabaseServer
+ ApplicationPool = $serviceAppPoolName
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPServiceAppPool]MainServiceAppPool"
}
#**********************************************************
diff --git a/Modules/xSharePoint/Examples/Single Server/SharePoint.psd1 b/Modules/xSharePoint/Examples/Single Server/SharePoint.psd1
new file mode 100644
index 000000000..5595b3490
--- /dev/null
+++ b/Modules/xSharePoint/Examples/Single Server/SharePoint.psd1
@@ -0,0 +1,102 @@
+@{
+ AllNodes = @(
+ @{
+ NodeName = "*"
+ },
+ @{
+ NodeName = "sharepoint1"
+ ServiceRoles = @{
+ WebFrontEnd = $true
+ DistributedCache = $true
+ AppServer = $true
+ }
+ }
+ )
+ NonNodeData = @{
+ DomainDetails = @{
+ DomainName = "contoso.local"
+ NetbiosName = "Contoso"
+ }
+ SQLServer = @{
+ ContentDatabaseServer = "sql1.contoso.local"
+ SearchDatabaseServer = "sql1.contoso.local"
+ ServiceAppDatabaseServer = "sql1.contoso.local"
+ FarmDatabaseServer = "sql1.contoso.local"
+ }
+ SharePoint = @{
+ Farm = @{
+ ConfigurationDatabase = "SP_Config"
+ Passphrase = "ExamplePassphase!"
+ AdminContentDatabase = "SP_AdminContent"
+ }
+ DiagnosticLogs = @{
+ Path = "C:\ULSLogs"
+ MaxSize = 10
+ DaysToKeep = 7
+ }
+ UsageLogs = @{
+ DatabaseName = "SP_Usage"
+ Path = "C:\UsageLogs"
+ }
+ StateService = @{
+ DatabaseName = "SP_State"
+ }
+ WebApplications = @(
+ @{
+ Name = "SharePoint Sites"
+ DatabaeName = "SP_Content_01"
+ Url = "http://sites.sharepoint.contoso.local"
+ Authentication = "NTLM"
+ Anonymous = $false
+ AppPool = "SharePoint Sites"
+ AppPoolAccount = "Contoso\svcSPWebApp"
+ SuperUser = "Contoso\svcSPSuperUser"
+ SuperReader = "Contoso\svcSPReader"
+ UseHostNamedSiteCollections = $true
+ ManagedPaths = @(
+ @{
+ Path = "teams"
+ Explicit = $false
+ },
+ @{
+ Path = "personal"
+ Explicit = $false
+ }
+ )
+ SiteCollections = @(
+ @{
+ Url = "http://sites.sharepoint.contoso.local"
+ Owner = "Contoso\svcSPFarm"
+ Name = "Team Sites"
+ Template = "STS#0"
+ },
+ @{
+ Url = "http://my.sharepoint.contoso.local"
+ Owner = "Contoso\svcSPFarm"
+ Name = "My Sites"
+ Template = "SPSMSITEHOST#0"
+ }
+ )
+ }
+ )
+ UserProfileService = @{
+ MySiteUrl = "http://my.sharepoint.contoso.local"
+ ProfileDB = "SP_UserProfiles"
+ SocialDB = "SP_Social"
+ SyncDB = "SP_ProfileSync"
+ }
+ SecureStoreService = @{
+ DatabaseName = "SP_SecureStore"
+ }
+ ManagedMetadataService = @{
+ DatabaseName = "SP_ManagedMetadata"
+ }
+ BCSService = @{
+ DatabaseName = "SP_BCS"
+ }
+ Search = @{
+ DatabaseName = "SP_Search"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Modules/xSharePoint/Examples/Small Farm/AppServer.ps1 b/Modules/xSharePoint/Examples/Small Farm/AppServer.ps1
deleted file mode 100644
index 0578e3cb5..000000000
--- a/Modules/xSharePoint/Examples/Small Farm/AppServer.ps1
+++ /dev/null
@@ -1,165 +0,0 @@
-Configuration SharePointAppServer
-{
- param (
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $CredSSPDelegates,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $SPBinaryPath,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $ULSViewerPath,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $SPBinaryPathCredential,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $FarmAccount,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $InstallAccount,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $ProductKey,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $DatabaseServer,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $FarmPassPhrase,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $WebPoolManagedAccount,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $ServicePoolManagedAccount,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $WebAppUrl,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $MySiteHostUrl,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $TeamSiteUrl,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [int] $CacheSizeInMB
- )
- Import-DscResource -ModuleName xSharePoint
- Import-DscResource -ModuleName xWebAdministration
- Import-DscResource -ModuleName xCredSSP
- Import-DscResource -ModuleName xDisk
-
- node "localhost"
- {
- #**********************************************************
- # Server configuration
- #
- # This section of the configuration includes details of the
- # server level configuration, such as disks, registry
- # settings etc.
- #**********************************************************
-
- xDisk LogsDisk { DiskNumber = 2; DriveLetter = "l" }
- xDisk IndexDisk { DiskNumber = 3; DriveLetter = "i" }
- xCredSSP CredSSPServer { Ensure = "Present"; Role = "Server" }
- xCredSSP CredSSPClient { Ensure = "Present"; Role = "Client"; DelegateComputers = $CredSSPDelegates }
-
-
- #**********************************************************
- # Software downloads
- #
- # This section details where any binary downloads should
- # be downloaded from and put locally on the server before
- # installation takes place
- #**********************************************************
-
- File SPBinaryDownload
- {
- DestinationPath = "C:\SPInstall"
- Credential = $SPBinaryPathCredential
- Ensure = "Present"
- SourcePath = $SPBinaryPath
- Type = "Directory"
- Recurse = $true
- }
- File UlsViewerDownload
- {
- DestinationPath = "L:\UlsViewer.exe"
- Credential = $SPBinaryPathCredential
- Ensure = "Present"
- SourcePath = $ULSViewerPath
- Type = "File"
- DependsOn = "[xDisk]LogsDisk"
- }
-
- #**********************************************************
- # Binary installation
- #
- # This section triggers installation of both SharePoint
- # as well as the prerequisites required
- #**********************************************************
- xSPInstallPrereqs InstallPrerequisites
- {
- InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe"
- OnlineMode = $true
- SQLNCli = "C:\SPInstall\prerequisiteinstallerfiles\sqlncli.msi"
- PowerShell = "C:\SPInstall\prerequisiteinstallerfiles\Windows6.1-KB2506143-x64.msu"
- NETFX = "C:\SPInstall\prerequisiteinstallerfiles\dotNetFx45_Full_setup.exe"
- IDFX = "C:\SPInstall\prerequisiteinstallerfiles\Windows6.1-KB974405-x64.msu"
- Sync = "C:\SPInstall\prerequisiteinstallerfiles\Synchronization.msi"
- AppFabric = "C:\SPInstall\prerequisiteinstallerfiles\WindowsServerAppFabricSetup_x64.exe"
- IDFX11 = "C:\SPInstall\prerequisiteinstallerfiles\MicrosoftIdentityExtensions-64.msi"
- MSIPCClient = "C:\SPInstall\prerequisiteinstallerfiles\setup_msipc_x64.msi"
- WCFDataServices = "C:\SPInstall\prerequisiteinstallerfiles\WcfDataServices.exe"
- KB2671763 = "C:\SPInstall\prerequisiteinstallerfiles\AppFabric1.1-RTM-KB2671763-x64-ENU.exe"
- WCFDataServices56 = "C:\SPInstall\prerequisiteinstallerfiles\WcfDataServices56.exe"
- DependsOn = "[xSPClearRemoteSessions]ClearRemotePowerShellSessions"
- }
- xSPInstall InstallBinaries
- {
- BinaryDir = "C:\SPInstall"
- ProductKey = $ProductKey
- Ensure = "Present"
- DependsOn = "[xSPInstallPrereqs]InstallPrerequisites"
- }
-
- #**********************************************************
- # IIS clean up
- #
- # This section removes all default sites and application
- # pools from IIS as they are not required
- #**********************************************************
-
- xWebAppPool RemoveDotNet2Pool { Name = ".NET v2.0"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
- xWebAppPool RemoveDotNet2ClassicPool { Name = ".NET v2.0 Classic"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
- xWebAppPool RemoveDotNet45Pool { Name = ".NET v4.5"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites"; }
- xWebAppPool RemoveDotNet45ClassicPool { Name = ".NET v4.5 Classic"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites"; }
- xWebAppPool RemoveClassicDotNetPool { Name = "Classic .NET AppPool"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
- xWebAppPool RemoveDefaultAppPool { Name = "DefaultAppPool"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
- xWebSite RemoveDefaultWebSite { Name = "Default Web Site"; Ensure = "Absent"; PhysicalPath = "C:\inetpub\wwwroot"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
-
-
- #**********************************************************
- # Basic farm configuration
- #
- # This section creates the new SharePoint farm object, and
- # provisions generic services and components used by the
- # whole farm
- #**********************************************************
-
- xSPJoinFarm JoinSPFarm
- {
- DatabaseServer = $DatabaseServer
- FarmConfigDatabaseName = "SP_Config"
- Passphrase = $FarmPassPhrase
- InstallAccount = $InstallAccount
- DependsOn = "[xSPInstall]InstallBinaries"
- }
-
- #**********************************************************
- # Service instances
- #
- # This section describes which services should be running
- # and not running on the server
- #**********************************************************
-
- xSPServiceInstance ClaimsToWindowsTokenServiceInstance
- {
- Name = "Claims to Windows Token Service"
- Ensure = "Present"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPJoinFarm]JoinSPFarm"
- }
- xSPServiceInstance UserProfileServiceInstance
- {
- Name = "User Profile Service"
- Ensure = "Present"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPJoinFarm]JoinSPFarm"
- }
-
- #**********************************************************
- # Local configuration manager settings
- #
- # This section contains settings for the LCM of the host
- # that this configuration is applied to
- #**********************************************************
- LocalConfigurationManager
- {
- RebootNodeIfNeeded = $true
- }
- }
-}
diff --git a/Modules/xSharePoint/Examples/Small Farm/FirstServer.ps1 b/Modules/xSharePoint/Examples/Small Farm/FirstServer.ps1
deleted file mode 100644
index 776d54b37..000000000
--- a/Modules/xSharePoint/Examples/Small Farm/FirstServer.ps1
+++ /dev/null
@@ -1,373 +0,0 @@
-Configuration SharePointFarmServer
-{
- param (
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $CredSSPDelegates,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $SPBinaryPath,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $ULSViewerPath,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $SPBinaryPathCredential,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $FarmAccount,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $InstallAccount,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $ProductKey,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $DatabaseServer,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $FarmPassPhrase,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $WebPoolManagedAccount,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $ServicePoolManagedAccount,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $WebAppUrl,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $MySiteHostUrl,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $TeamSiteUrl,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [int] $CacheSizeInMB
- )
- Import-DscResource -ModuleName xSharePoint
- Import-DscResource -ModuleName xWebAdministration
- Import-DscResource -ModuleName xCredSSP
- Import-DscResource -ModuleName xDisk
-
- node "localhost"
- {
- #**********************************************************
- # Server configuration
- #
- # This section of the configuration includes details of the
- # server level configuration, such as disks, registry
- # settings etc.
- #**********************************************************
-
- xDisk LogsDisk { DiskNumber = 2; DriveLetter = "l" }
- xDisk IndexDisk { DiskNumber = 3; DriveLetter = "i" }
- xCredSSP CredSSPServer { Ensure = "Present"; Role = "Server" }
- xCredSSP CredSSPClient { Ensure = "Present"; Role = "Client"; DelegateComputers = $CredSSPDelegates }
-
-
- #**********************************************************
- # Software downloads
- #
- # This section details where any binary downloads should
- # be downloaded from and put locally on the server before
- # installation takes place
- #**********************************************************
-
- File SPBinaryDownload
- {
- DestinationPath = "C:\SPInstall"
- Credential = $SPBinaryPathCredential
- Ensure = "Present"
- SourcePath = $SPBinaryPath
- Type = "Directory"
- Recurse = $true
- }
- File UlsViewerDownload
- {
- DestinationPath = "L:\UlsViewer.exe"
- Credential = $SPBinaryPathCredential
- Ensure = "Present"
- SourcePath = $ULSViewerPath
- Type = "File"
- DependsOn = "[xDisk]LogsDisk"
- }
-
- #**********************************************************
- # Binary installation
- #
- # This section triggers installation of both SharePoint
- # as well as the prerequisites required
- #**********************************************************
- xSPInstallPrereqs InstallPrerequisites
- {
- InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe"
- OnlineMode = $true
- SQLNCli = "C:\SPInstall\prerequisiteinstallerfiles\sqlncli.msi"
- PowerShell = "C:\SPInstall\prerequisiteinstallerfiles\Windows6.1-KB2506143-x64.msu"
- NETFX = "C:\SPInstall\prerequisiteinstallerfiles\dotNetFx45_Full_setup.exe"
- IDFX = "C:\SPInstall\prerequisiteinstallerfiles\Windows6.1-KB974405-x64.msu"
- Sync = "C:\SPInstall\prerequisiteinstallerfiles\Synchronization.msi"
- AppFabric = "C:\SPInstall\prerequisiteinstallerfiles\WindowsServerAppFabricSetup_x64.exe"
- IDFX11 = "C:\SPInstall\prerequisiteinstallerfiles\MicrosoftIdentityExtensions-64.msi"
- MSIPCClient = "C:\SPInstall\prerequisiteinstallerfiles\setup_msipc_x64.msi"
- WCFDataServices = "C:\SPInstall\prerequisiteinstallerfiles\WcfDataServices.exe"
- KB2671763 = "C:\SPInstall\prerequisiteinstallerfiles\AppFabric1.1-RTM-KB2671763-x64-ENU.exe"
- WCFDataServices56 = "C:\SPInstall\prerequisiteinstallerfiles\WcfDataServices56.exe"
- DependsOn = "[xSPClearRemoteSessions]ClearRemotePowerShellSessions"
- }
- xSPInstall InstallBinaries
- {
- BinaryDir = "C:\SPInstall"
- ProductKey = $ProductKey
- Ensure = "Present"
- DependsOn = "[xSPInstallPrereqs]InstallPrerequisites"
- }
-
- #**********************************************************
- # IIS clean up
- #
- # This section removes all default sites and application
- # pools from IIS as they are not required
- #**********************************************************
-
- xWebAppPool RemoveDotNet2Pool { Name = ".NET v2.0"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
- xWebAppPool RemoveDotNet2ClassicPool { Name = ".NET v2.0 Classic"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
- xWebAppPool RemoveDotNet45Pool { Name = ".NET v4.5"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites"; }
- xWebAppPool RemoveDotNet45ClassicPool { Name = ".NET v4.5 Classic"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites"; }
- xWebAppPool RemoveClassicDotNetPool { Name = "Classic .NET AppPool"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
- xWebAppPool RemoveDefaultAppPool { Name = "DefaultAppPool"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
- xWebSite RemoveDefaultWebSite { Name = "Default Web Site"; Ensure = "Absent"; PhysicalPath = "C:\inetpub\wwwroot"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
-
-
- #**********************************************************
- # Basic farm configuration
- #
- # This section creates the new SharePoint farm object, and
- # provisions generic services and components used by the
- # whole farm
- #**********************************************************
-
- xSPCreateFarm CreateSPFarm
- {
- DatabaseServer = $DatabaseServer
- FarmConfigDatabaseName = "SP_Config"
- Passphrase = $FarmPassPhrase
- FarmAccount = $FarmAccount
- InstallAccount = $InstallAccount
- AdminContentDatabaseName = "SP_AdminContent"
- DependsOn = "[xSPInstall]InstallBinaries"
- }
- xSPManagedAccount ServicePoolManagedAccount
- {
- AccountName = $ServicePoolManagedAccount.UserName
- Account = $ServicePoolManagedAccount
- Schedule = ""
- InstallAccount = $InstallAccount
- DependsOn = "[xSPCreateFarm]CreateSPFarm"
- }
- xSPManagedAccount WebPoolManagedAccount
- {
- AccountName = $WebPoolManagedAccount.UserName
- Account = $WebPoolManagedAccount
- Schedule = ""
- InstallAccount = $InstallAccount
- DependsOn = "[xSPCreateFarm]CreateSPFarm"
- }
- xSPDiagnosticLoggingSettings ApplyDiagnosticLogSettings
- {
- InstallAccount = $InstallAccount
- LogPath = "L:\ULSLogs"
- LogSpaceInGB = 10
- AppAnalyticsAutomaticUploadEnabled = $false
- CustomerExperienceImprovementProgramEnabled = $true
- DaysToKeepLogs = 7
- DownloadErrorReportingUpdatesEnabled = $false
- ErrorReportingAutomaticUploadEnabled = $false
- ErrorReportingEnabled = $false
- EventLogFloodProtectionEnabled = $true
- EventLogFloodProtectionNotifyInterval = 5
- EventLogFloodProtectionQuietPeriod = 2
- EventLogFloodProtectionThreshold = 5
- EventLogFloodProtectionTriggerPeriod = 2
- LogCutInterval = 15
- LogMaxDiskSpaceUsageEnabled = $true
- ScriptErrorReportingDelay = 30
- ScriptErrorReportingEnabled = $true
- ScriptErrorReportingRequireAuth = $true
- DependsOn = @("[xSPCreateFarm]CreateSPFarm", "[xDisk]LogsDisk")
- }
- xSPUsageApplication UsageApplication
- {
- Name = "Usage Service Application"
- DatabaseName = "SP_Usage"
- UsageLogCutTime = 5
- UsageLogLocation = "L:\UsageLogs"
- UsageLogMaxFileSizeKB = 1024
- InstallAccount = $InstallAccount
- DependsOn = "[xSPCreateFarm]CreateSPFarm"
- }
- xSPStateServiceApp StateServiceApp
- {
- Name = "State Service Application"
- DatabaseName = "SP_State"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPCreateFarm]CreateSPFarm"
- }
-
- #**********************************************************
- # Web applications
- #
- # This section creates the web applications in the
- # SharePoint farm, as well as managed paths and other web
- # application settings
- #**********************************************************
-
- xSPWebApplication HostNameSiteCollectionWebApp
- {
- Name = "SharePoint Sites"
- ApplicationPool = "SharePoint Sites"
- ApplicationPoolAccount = $WebPoolManagedAccount.UserName
- AllowAnonymous = $false
- AuthenticationMethod = "NTLM"
- DatabaseName = "SP_Content_01"
- DatabaseServer = $DatabaseServer
- Url = $WebAppUrl
- Port = 80
- InstallAccount = $InstallAccount
- DependsOn = "[xSPManagedAccount]WebPoolManagedAccount"
- }
- xSPManagedPath TeamsManagedPath
- {
- WebAppUrl = "http://$WebAppUrl"
- InstallAccount = $InstallAccount
- RelativeUrl = "teams"
- Explicit = $false
- HostHeader = $true
- DependsOn = "[xSPWebApplication]HostNameSiteCollectionWebApp"
- }
- xSPManagedPath PersonalManagedPath
- {
- WebAppUrl = "http://$WebAppUrl"
- InstallAccount = $InstallAccount
- RelativeUrl = "personal"
- Explicit = $false
- HostHeader = $true
- DependsOn = "[xSPWebApplication]HostNameSiteCollectionWebApp"
- }
- xSPCacheAccounts SetCacheAccounts
- {
- WebAppUrl = "http://$WebAppUrl"
- SuperUserAlias = "DEMO\svxSPSuperUser"
- SuperReaderAlias = "DEMO\svxSPReader"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPWebApplication]HostNameSiteCollectionWebApp"
- }
-
- #**********************************************************
- # Service instances
- #
- # This section describes which services should be running
- # and not running on the server
- #**********************************************************
-
- xSPServiceInstance ClaimsToWindowsTokenServiceInstance
- {
- Name = "Claims to Windows Token Service"
- Ensure = "Present"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPCreateFarm]CreateSPFarm"
- }
- xSPServiceInstance UserProfileServiceInstance
- {
- Name = "User Profile Service"
- Ensure = "Present"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPCreateFarm]CreateSPFarm"
- }
- xSPUserProfileSyncService UserProfileSyncService
- {
- UserProfileServiceAppName = "User Profile Service Application"
- Ensure = "Present"
- FarmAccount = $FarmAccount
- InstallAccount = $InstallAccount
- DependsOn = "[xSPUserProfileServiceApp]UserProfileServiceApp"
- }
-
- #**********************************************************
- # Service applications
- #
- # This section creates service applications and required
- # dependencies
- #**********************************************************
-
- xSPServiceAppPool MainServiceAppPool
- {
- Name = "SharePoint Service Applications"
- ServiceAccount = $ServicePoolManagedAccount.UserName
- InstallAccount = $InstallAccount
- DependsOn = "[xSPCreateFarm]CreateSPFarm"
- }
- xSPUserProfileServiceApp UserProfileServiceApp
- {
- Name = "User Profile Service Application"
- ApplicationPool = "SharePoint Service Applications"
- MySiteHostLocation = "http://$MySiteHostUrl"
- ProfileDBName = "SP_UserProfiles"
- ProfileDBServer = $DatabaseServer
- SocialDBName = "SP_Social"
- SocialDBServer = $DatabaseServer
- SyncDBName = "SP_ProfileSync"
- SyncDBServer = $DatabaseServer
- FarmAccount = $FarmAccount
- InstallAccount = $InstallAccount
- DependsOn = @('[xSPServiceAppPool]MainServiceAppPool', '[xSPManagedPath]PersonalManagedPath', '[xSPSite]MySiteHost', '[xSPManagedMetaDataServiceApp]ManagedMetadataServiceApp', '[xSPSearchServiceApp]SearchServiceApp')
- }
- xSPSecureStoreServiceApp SecureStoreServiceApp
- {
- Name = "Secure Store Service Application"
- ApplicationPool = "SharePoint Service Applications"
- AuditingEnabled = $true
- AuditlogMaxSize = 30
- DatabaseName = "SP_SecureStore"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPServiceAppPool]MainServiceAppPool"
- }
- xSPManagedMetaDataServiceApp ManagedMetadataServiceApp
- {
- Name = "Managed Metadata Service Application"
- InstallAccount = $InstallAccount
- ApplicationPool = "SharePoint Service Applications"
- DatabaseServer = $DatabaseServer
- DatabaseName = "SP_ManagedMetadata"
- DependsOn = "[xSPServiceAppPool]MainServiceAppPool"
- }
- xSPSearchServiceApp SearchServiceApp
- {
- Name = "Search Service Application"
- DatabaseName = "SP_Search"
- ApplicationPool = "SharePoint Service Applications"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPServiceAppPool]MainServiceAppPool"
- }
- xSPBCSServiceApp BCSServiceApp
- {
- Name = "BCS Service Application"
- ApplicationPool = "SharePoint Service Applications"
- DatabaseName = "SP_BCS"
- DatabaseServer = $DatabaseServer
- InstallAccount = $InstallAccount
- DependsOn = @('[xSPServiceAppPool]MainServiceAppPool', '[xSPSecureStoreServiceApp]SecureStoreServiceApp')
- }
-
- #**********************************************************
- # Site Collections
- #
- # This section contains the site collections to provision
- #**********************************************************
-
- xSPSite TeamSite
- {
- Url = "http://$TeamSiteUrl"
- OwnerAlias = $InstallAccount.UserName
- HostHeaderWebApplication = "http://$WebAppUrl"
- Name = "Team Sites"
- Template = "STS#0"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPWebApplication]HostNameSiteCollectionWebApp"
- }
- xSPSite MySiteHost
- {
- Url = "http://$MySiteHostUrl"
- OwnerAlias = $InstallAccount.UserName
- HostHeaderWebApplication = "http://$WebAppUrl"
- Name = "My Site Host"
- Template = "SPSMSITEHOST#0"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPWebApplication]HostNameSiteCollectionWebApp"
- }
-
- #**********************************************************
- # Local configuration manager settings
- #
- # This section contains settings for the LCM of the host
- # that this configuraiton is applied to
- #**********************************************************
- LocalConfigurationManager
- {
- RebootNodeIfNeeded = $true
- }
- }
-}
\ No newline at end of file
diff --git a/Modules/xSharePoint/Examples/Small Farm/SharePoint.ps1 b/Modules/xSharePoint/Examples/Small Farm/SharePoint.ps1
new file mode 100644
index 000000000..82c20f0a1
--- /dev/null
+++ b/Modules/xSharePoint/Examples/Small Farm/SharePoint.ps1
@@ -0,0 +1,466 @@
+Configuration SharePointServer
+{
+ param (
+ [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $FarmAccount,
+ [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $SPSetupAccount,
+ [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $WebPoolManagedAccount,
+ [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $ServicePoolManagedAccount,
+ [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $domainAdminCredential
+ )
+
+ Import-DscResource -ModuleName PSDesiredStateConfiguration
+ Import-DscResource -ModuleName xSharePoint
+ Import-DscResource -ModuleName xWebAdministration
+ Import-DscResource -ModuleName xCredSSP
+
+ node $AllNodes.NodeName
+ {
+ #**********************************************************
+ # Server configuration
+ #
+ # This section of the configuration includes details of the
+ # server level configuration, such as disks, registry
+ # settings etc.
+ #**********************************************************
+
+ xCredSSP CredSSPServer { Ensure = "Present"; Role = "Server"; DependsOn = "[xComputer]DomainJoin" }
+ xCredSSP CredSSPClient { Ensure = "Present"; Role = "Client"; DelegateComputers = "*.$($ConfigurationData.NonNodeData.DomainDetails.DomainName)"; DependsOn = "[xComputer]DomainJoin" }
+
+ if ($Node.DisableIISLoopbackCheck -eq $true) {
+ Registry DisableLoopBackCheck {
+ Ensure = "Present"
+ Key = "HKLM:\System\CurrentControlSet\Control\Lsa"
+ ValueName = "DisableLoopbackCheck"
+ ValueData = "1"
+ ValueType = "Dword"
+ }
+ }
+
+
+ #**********************************************************
+ # IIS clean up
+ #
+ # This section removes all default sites and application
+ # pools from IIS as they are not required
+ #**********************************************************
+
+ xWebAppPool RemoveDotNet2Pool { Name = ".NET v2.0"; Ensure = "Absent"; }
+ xWebAppPool RemoveDotNet2ClassicPool { Name = ".NET v2.0 Classic"; Ensure = "Absent"; }
+ xWebAppPool RemoveDotNet45Pool { Name = ".NET v4.5"; Ensure = "Absent"; }
+ xWebAppPool RemoveDotNet45ClassicPool { Name = ".NET v4.5 Classic"; Ensure = "Absent"; }
+ xWebAppPool RemoveClassicDotNetPool { Name = "Classic .NET AppPool"; Ensure = "Absent"; }
+ xWebAppPool RemoveDefaultAppPool { Name = "DefaultAppPool"; Ensure = "Absent"; }
+ xWebSite RemoveDefaultWebSite { Name = "Default Web Site"; Ensure = "Absent"; PhysicalPath = "C:\inetpub\wwwroot"; }
+
+
+ #**********************************************************
+ # Basic farm configuration
+ #
+ # This section creates the new SharePoint farm object, and
+ # provisions generic services and components used by the
+ # whole farm
+ #**********************************************************
+
+ # Determine the first app server and let it create the farm, all other servers will join that afterwards
+ $FirstAppServer = ($AllNodes | Where-Object { $_.ServiceRoles.AppServer -eq $true } | Select-Object -First 1).NodeName
+
+ if ($Node.NodeName -eq $FirstAppServer) {
+ xSPCreateFarm CreateSPFarm
+ {
+ DatabaseServer = $ConfigurationData.NonNodeData.SQLServer.FarmDatabaseServer
+ FarmConfigDatabaseName = $ConfigurationData.NonNodeData.SharePoint.Farm.ConfigurationDatabase
+ Passphrase = $ConfigurationData.NonNodeData.SharePoint.Farm.Passphrase
+ FarmAccount = $FarmAccount
+ PsDscRunAsCredential = $SPSetupAccount
+ AdminContentDatabaseName = $ConfigurationData.NonNodeData.SharePoint.Farm.AdminContentDatabase
+ DependsOn = "[xComputer]DomainJoin"
+ }
+
+ $FarmWaitTask = "[xSPCreateFarm]CreateSPFarm"
+ } else {
+ WaitForAll WaitForFarmToExist
+ {
+ ResourceName = "[xSPCreateFarm]CreateSPFarm"
+ NodeName = $FirstAppServer
+ RetryIntervalSec = 60
+ RetryCount = 60
+ PsDscRunAsCredential = $SPSetupAccount
+ }
+ xSPJoinFarm JoinSPFarm
+ {
+ DatabaseServer = $ConfigurationData.NonNodeData.SQLServer.FarmDatabaseServer
+ FarmConfigDatabaseName = $ConfigurationData.NonNodeData.SharePoint.Farm.ConfigurationDatabase
+ Passphrase = $ConfigurationData.NonNodeData.SharePoint.Farm.Passphrase
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[WaitForAll]WaitForFarmToExist"
+ }
+
+ $FarmWaitTask = "[xSPJoinFarm]JoinSPFarm"
+ }
+
+
+ # Apply farm wide configuration and logical components only on the first server
+ if ($Node.NodeName -eq $FirstAppServer) {
+ xSPManagedAccount ServicePoolManagedAccount
+ {
+ AccountName = $ServicePoolManagedAccount.UserName
+ Account = $ServicePoolManagedAccount
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = $FarmWaitTask
+ }
+ xSPManagedAccount WebPoolManagedAccount
+ {
+ AccountName = $WebPoolManagedAccount.UserName
+ Account = $WebPoolManagedAccount
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = $FarmWaitTask
+ }
+ xSPDiagnosticLoggingSettings ApplyDiagnosticLogSettings
+ {
+ PsDscRunAsCredential = $SPSetupAccount
+ LogPath = $ConfigurationData.NonNodeData.SharePoint.DiagnosticLogs.Path
+ LogSpaceInGB = $ConfigurationData.NonNodeData.SharePoint.DiagnosticLogs.MaxSize
+ AppAnalyticsAutomaticUploadEnabled = $false
+ CustomerExperienceImprovementProgramEnabled = $true
+ DaysToKeepLogs = $ConfigurationData.NonNodeData.SharePoint.DiagnosticLogs.DaysToKeep
+ DownloadErrorReportingUpdatesEnabled = $false
+ ErrorReportingAutomaticUploadEnabled = $false
+ ErrorReportingEnabled = $false
+ EventLogFloodProtectionEnabled = $true
+ EventLogFloodProtectionNotifyInterval = 5
+ EventLogFloodProtectionQuietPeriod = 2
+ EventLogFloodProtectionThreshold = 5
+ EventLogFloodProtectionTriggerPeriod = 2
+ LogCutInterval = 15
+ LogMaxDiskSpaceUsageEnabled = $true
+ ScriptErrorReportingDelay = 30
+ ScriptErrorReportingEnabled = $true
+ ScriptErrorReportingRequireAuth = $true
+ DependsOn = @($FarmWaitTask, "[xDisk]LogsDisk")
+ }
+ xSPUsageApplication UsageApplication
+ {
+ Name = "Usage Service Application"
+ DatabaseName = $ConfigurationData.NonNodeData.SharePoint.UsageLogs.DatabaseName
+ UsageLogCutTime = 5
+ UsageLogLocation = $ConfigurationData.NonNodeData.SharePoint.UsageLogs.Path
+ UsageLogMaxFileSizeKB = 1024
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = $FarmWaitTask
+ }
+ xSPStateServiceApp StateServiceApp
+ {
+ Name = "State Service Application"
+ DatabaseName = $ConfigurationData.NonNodeData.SharePoint.StateService.DatabaseName
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = $FarmWaitTask
+ }
+ }
+
+
+ #**********************************************************
+ # Distributed cache
+ #
+ # This section calculates which servers should be running
+ # DCache and which servers they depend on
+ #**********************************************************
+
+ if ($Node.ServiceRoles.DistributedCache -eq $true) {
+ $AllDCacheNodes = $AllNodes | Where-Object { $_.ServiceRoles.DistributedCache -eq $true }
+ $CurrentDcacheNode = [Array]::IndexOf($AllDCacheNodes, $Node)
+
+ if ($Node.NodeName -ne $FirstAppServer) {
+ # Node is not the first app server so won't have the dependency for the service account
+ WaitForAll WaitForServiceAccount
+ {
+ ResourceName = "[xSPManagedAccount]ServicePoolManagedAccount"
+ NodeName = $FirstAppServer
+ RetryIntervalSec = 60
+ RetryCount = 20
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = $FarmWaitTask
+ }
+ $DCacheWaitFor = "[WaitForAll]WaitForServiceAccount"
+ } else {
+ $DCacheWaitFor = "[xSPManagedAccount]ServicePoolManagedAccount"
+ }
+
+ if ($CurrentDcacheNode -eq 0) {
+ # The first distributed cache node doesn't wait on anything
+ xSPDistributedCacheService EnableDistributedCache
+ {
+ Name = "AppFabricCachingService"
+ Ensure = "Present"
+ CacheSizeInMB = 1024
+ ServiceAccount = $ServicePoolManagedAccount.UserName
+ PsDscRunAsCredential = $SPSetupAccount
+ CreateFirewallRules = $true
+ DependsOn = @($FarmWaitTask,$DCacheWaitFor)
+ }
+ } else {
+ # All other distributed cache nodes depend on the node previous to it
+ $previousDCacheNode = $AllDCacheNodes[$CurrentDcacheNode - 1]
+ WaitForAll WaitForDCache
+ {
+ ResourceName = "[xSPDistributedCacheService]EnableDistributedCache"
+ NodeName = $previousDCacheNode.NodeName
+ RetryIntervalSec = 60
+ RetryCount = 60
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = $FarmWaitTask
+ }
+ xSPDistributedCacheService EnableDistributedCache
+ {
+ Name = "AppFabricCachingService"
+ Ensure = "Present"
+ CacheSizeInMB = 1024
+ ServiceAccount = $ServicePoolManagedAccount.UserName
+ PsDscRunAsCredential = $SPSetupAccount
+ CreateFirewallRules = $true
+ DependsOn = "[WaitForAll]WaitForDCache"
+ }
+ }
+ }
+
+
+ #**********************************************************
+ # Web applications
+ #
+ # This section creates the web applications in the
+ # SharePoint farm, as well as managed paths and other web
+ # application settings
+ #**********************************************************
+
+ if ($Node.NodeName -eq $FirstAppServer) {
+ foreach($webApp in $ConfigurationData.NonNodeData.SharePoint.WebApplications) {
+ $webAppInternalName = $webApp.Name.Replace(" ", "")
+ xSPWebApplication $webAppInternalName
+ {
+ Name = $webApp.Name
+ ApplicationPool = $webApp.AppPool
+ ApplicationPoolAccount = $webApp.APpPoolAccount
+ AllowAnonymous = $webApp.Anonymous
+ AuthenticationMethod = $webApp.Authentication
+ DatabaseName = $webApp.DatabaseName
+ DatabaseServer = $ConfigurationData.NonNodeData.SQLServer.ContentDatabaseServer
+ Url = $webApp.Url
+ Port = [Uri]::new($webApp.Url).Port
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPManagedAccount]WebPoolManagedAccount"
+ }
+
+ # If using host named site collections, create the empty path based site here
+ if ($webApp.UseHostNamedSiteCollections -eq $true) {
+ xSPSite HNSCRootSite
+ {
+ Url = $webApp.Url
+ OwnerAlias = $SPSetupAccount.Username
+ Name = "Root site"
+ Template = "STS#0"
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPWebApplication]$webAppInternalName"
+ }
+ }
+
+ foreach($managedPath in $webApp.ManagedPaths) {
+ xSPManagedPath "$($webAppInternalName)Path$($managedPath.Path)"
+ {
+ WebAppUrl = $webApp.Url
+ PsDscRunAsCredential = $SPSetupAccount
+ RelativeUrl = $managedPath.Path
+ Explicit = $managedPath.Explicit
+ HostHeader = $webApp.UseHostNamedSiteCollections
+ DependsOn = "[xSPWebApplication]$webAppInternalName"
+ }
+ }
+
+ xSPCacheAccounts "$($webAppInternalName)CacheAccounts"
+ {
+ WebAppUrl = $webApp.Url
+ SuperUserAlias = $webApp.SuperUser
+ SuperReaderAlias = $webApp.SuperReader
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPWebApplication]$webAppInternalName"
+ }
+
+ foreach($siteCollection in $webApp.SiteCollections) {
+ $internalSiteName = "$($webAppInternalName)Site$($siteCollection.Name.Replace(' ', ''))"
+ if ($webApp.UseHostNamedSiteCollections -eq $true) {
+ xSPSite $internalSiteName
+ {
+ Url = $siteCollection.Url
+ OwnerAlias = $siteCollection.Owner
+ HostHeaderWebApplication = $webApp.Url
+ Name = $siteCollection.Name
+ Template = $siteCollection.Template
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPWebApplication]$webAppInternalName"
+ }
+ } else {
+ xSPSite $internalSiteName
+ {
+ Url = $siteCollection.Url
+ OwnerAlias = $siteCollection.Owner
+ Name = $siteCollection.Name
+ Template = $siteCollection.Template
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPWebApplication]$webAppInternalName"
+ }
+ }
+ }
+ }
+ }
+
+ #**********************************************************
+ # Service instances
+ #
+ # This section describes which services should be running
+ # and not running on the server
+ #**********************************************************
+
+ xSPServiceInstance ClaimsToWindowsTokenServiceInstance
+ {
+ Name = "Claims to Windows Token Service"
+ Ensure = "Present"
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = $FarmWaitTask
+ }
+
+ # App server service instances
+ if ($Node.ServiceRoles.AppServer -eq $true) {
+ xSPServiceInstance UserProfileServiceInstance
+ {
+ Name = "User Profile Service"
+ Ensure = "Present"
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = $FarmWaitTask
+ }
+ xSPServiceInstance SecureStoreServiceInstance
+ {
+ Name = "Secure Store Service"
+ Ensure = "Present"
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = $FarmWaitTask
+ }
+
+ if ($Node.NodeName -eq $FirstAppServer) {
+ xSPUserProfileSyncService UserProfileSyncService
+ {
+ UserProfileServiceAppName = "User Profile Service Application"
+ Ensure = "Present"
+ FarmAccount = $FarmAccount
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPUserProfileServiceApp]UserProfileServiceApp"
+ }
+ }
+ }
+
+ # Front end service instances
+ if ($Node.ServiceRoles.WebFrontEnd -eq $true) {
+ xSPServiceInstance ManagedMetadataServiceInstance
+ {
+ Name = "Managed Metadata Web Service"
+ Ensure = "Present"
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = $FarmWaitTask
+ }
+ xSPServiceInstance BCSServiceInstance
+ {
+ Name = "Business Data Connectivity Service"
+ Ensure = "Present"
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = $FarmWaitTask
+ }
+ }
+
+ xSPServiceInstance SearchServiceInstance
+ {
+ Name = "SharePoint Server Search"
+ Ensure = "Present"
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = $FarmWaitTask
+ }
+
+
+ #**********************************************************
+ # Service applications
+ #
+ # This section creates service applications and required
+ # dependencies
+ #**********************************************************
+
+ if ($Node.NodeName -eq $FirstAppServer) {
+ $serviceAppPoolName = "SharePoint Service Applications"
+ xSPServiceAppPool MainServiceAppPool
+ {
+ Name = $serviceAppPoolName
+ ServiceAccount = $ServicePoolManagedAccount.UserName
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = $FarmWaitTask
+ }
+ xSPUserProfileServiceApp UserProfileServiceApp
+ {
+ Name = "User Profile Service Application"
+ ApplicationPool = $serviceAppPoolName
+ MySiteHostLocation = $ConfigurationData.NonNodeData.SharePoint.UserProfileService.MySiteUrl
+ ProfileDBName = $ConfigurationData.NonNodeData.SharePoint.UserProfileService.ProfileDB
+ ProfileDBServer = $ConfigurationData.NonNodeData.SQLServer.ServiceAppDatabaseServer
+ SocialDBName = $ConfigurationData.NonNodeData.SharePoint.UserProfileService.SocialDB
+ SocialDBServer = $ConfigurationData.NonNodeData.SQLServer.ServiceAppDatabaseServer
+ SyncDBName = $ConfigurationData.NonNodeData.SharePoint.UserProfileService.SyncDB
+ SyncDBServer = $ConfigurationData.NonNodeData.SQLServer.ServiceAppDatabaseServer
+ FarmAccount = $FarmAccount
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = @('[xSPServiceAppPool]MainServiceAppPool', '[xSPManagedMetaDataServiceApp]ManagedMetadataServiceApp', '[xSPSearchServiceApp]SearchServiceApp')
+ }
+ xSPSecureStoreServiceApp SecureStoreServiceApp
+ {
+ Name = "Secure Store Service Application"
+ ApplicationPool = $serviceAppPoolName
+ AuditingEnabled = $true
+ AuditlogMaxSize = 30
+ DatabaseName = $ConfigurationData.NonNodeData.SharePoint.SecureStoreService.DatabaseName
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPServiceAppPool]MainServiceAppPool"
+ }
+ xSPManagedMetaDataServiceApp ManagedMetadataServiceApp
+ {
+ Name = "Managed Metadata Service Application"
+ PsDscRunAsCredential = $SPSetupAccount
+ ApplicationPool = $serviceAppPoolName
+ DatabaseServer = $ConfigurationData.NonNodeData.SQLServer.ServiceAppDatabaseServer
+ DatabaseName = $ConfigurationData.NonNodeData.SharePoint.ManagedMetadataService.DatabaseName
+ DependsOn = "[xSPServiceAppPool]MainServiceAppPool"
+ }
+ xSPBCSServiceApp BCSServiceApp
+ {
+ Name = "BCS Service Application"
+ ApplicationPool = $serviceAppPoolName
+ DatabaseName = $ConfigurationData.NonNodeData.SharePoint.BCSService.DatabaseName
+ DatabaseServer = $ConfigurationData.NonNodeData.SQLServer.ServiceAppDatabaseServer
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = @('[xSPServiceAppPool]MainServiceAppPool', '[xSPSecureStoreServiceApp]SecureStoreServiceApp')
+ }
+ xSPSearchServiceApp SearchServiceApp
+ {
+ Name = "Search Service Application"
+ DatabaseName = $ConfigurationData.NonNodeData.SharePoint.Search.DatabaseName
+ DatabaseServer = $ConfigurationData.NonNodeData.SQLServer.ServiceAppDatabaseServer
+ ApplicationPool = $serviceAppPoolName
+ PsDscRunAsCredential = $SPSetupAccount
+ DependsOn = "[xSPServiceAppPool]MainServiceAppPool"
+ }
+ }
+
+ #**********************************************************
+ # Local configuration manager settings
+ #
+ # This section contains settings for the LCM of the host
+ # that this configuraiton is applied to
+ #**********************************************************
+ LocalConfigurationManager
+ {
+ RebootNodeIfNeeded = $true
+ }
+ }
+}
\ No newline at end of file
diff --git a/Modules/xSharePoint/Examples/Small Farm/SharePoint.psd1 b/Modules/xSharePoint/Examples/Small Farm/SharePoint.psd1
new file mode 100644
index 000000000..066e2959b
--- /dev/null
+++ b/Modules/xSharePoint/Examples/Small Farm/SharePoint.psd1
@@ -0,0 +1,127 @@
+@{
+ AllNodes = @(
+ @{
+ NodeName = "*"
+ DisableIISLoopbackCheck = $true
+ },
+ @{
+ NodeName = "sharepoint1"
+ ServiceRoles = @{
+ WebFrontEnd = $false
+ DistributedCache = $false
+ AppServer = $true
+ }
+ },
+ @{
+ NodeName = "sharepoint2"
+ ServiceRoles = @{
+ WebFrontEnd = $false
+ DistributedCache = $false
+ AppServer = $true
+ }
+ },
+ @{
+ NodeName = "sharepoint3"
+ ServiceRoles = @{
+ WebFrontEnd = $true
+ DistributedCache = $true
+ AppServer = $false
+ }
+ },
+ @{
+ NodeName = "sharepoint4"
+ ServiceRoles = @{
+ WebFrontEnd = $true
+ DistributedCache = $true
+ AppServer = $false
+ }
+ }
+ )
+ NonNodeData = @{
+ DomainDetails = @{
+ DomainName = "contoso.local"
+ NetbiosName = "CONTOSO"
+ }
+ SQLServer = @{
+ ContentDatabaseServer = "sql1.contoso.local"
+ SearchDatabaseServer = "sql1.contoso.local"
+ ServiceAppDatabaseServer = "sql1.contoso.local"
+ FarmDatabaseServer = "sql1.contoso.local"
+ }
+ SharePoint = @{
+ Farm = @{
+ ConfigurationDatabase = "SP_Config"
+ Passphrase = "SharePoint156!"
+ AdminContentDatabase = "SP_AdminContent"
+ }
+ DiagnosticLogs = @{
+ Path = "L:\ULSLogs"
+ MaxSize = 10
+ DaysToKeep = 7
+ }
+ UsageLogs = @{
+ DatabaseName = "SP_Usage"
+ Path = "L:\UsageLogs"
+ }
+ StateService = @{
+ DatabaseName = "SP_State"
+ }
+ WebApplications = @(
+ @{
+ Name = "SharePoint Sites"
+ DatabaeName = "SP_Content_01"
+ Url = "http://sites.sharepoint.contoso.local"
+ Authentication = "NTLM"
+ Anonymous = $false
+ AppPool = "SharePoint Sites"
+ AppPoolAccount = "CONTOSO\svcSPWebApp"
+ SuperUser = "CONTOSO\svcSPSuperUser"
+ SuperReader = "CONTOSO\svcSPReader"
+ UseHostNamedSiteCollections = $true
+ ManagedPaths = @(
+ @{
+ Path = "teams"
+ Explicit = $false
+ },
+ @{
+ Path = "personal"
+ Explicit = $false
+ }
+ )
+ SiteCollections = @(
+ @{
+ Url = "http://teams.sharepoint.contoso.local"
+ Owner = "CONTOSO\svcSPFarm"
+ Name = "Team Sites"
+ Template = "STS#0"
+ },
+ @{
+ Url = "http://my.sharepoint.contoso.local"
+ Owner = "CONTOSO\svcSPFarm"
+ Name = "My Sites"
+ Template = "SPSMSITEHOST#0"
+ }
+ )
+ }
+ )
+ UserProfileService = @{
+ MySiteUrl = "http://my.sharepoint.contoso.local"
+ ProfileDB = "SP_UserProfiles"
+ SocialDB = "SP_Social"
+ SyncDB = "SP_ProfileSync"
+ }
+ SecureStoreService = @{
+ DatabaseName = "SP_SecureStore"
+ }
+ ManagedMetadataService = @{
+ DatabaseName = "SP_ManagedMetadata"
+ }
+ BCSService = @{
+ DatabaseName = "SP_BCS"
+ }
+ Search = @{
+ DatabaseName = "SP_Search"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Modules/xSharePoint/Examples/Small Farm/WFEServer.ps1 b/Modules/xSharePoint/Examples/Small Farm/WFEServer.ps1
deleted file mode 100644
index 7461de9ea..000000000
--- a/Modules/xSharePoint/Examples/Small Farm/WFEServer.ps1
+++ /dev/null
@@ -1,189 +0,0 @@
-Configuration SharePointWFEServer
-{
- param (
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $CredSSPDelegates,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $SPBinaryPath,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $ULSViewerPath,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $SPBinaryPathCredential,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $FarmAccount,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $InstallAccount,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $ProductKey,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $DatabaseServer,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $FarmPassPhrase,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $WebPoolManagedAccount,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [PSCredential] $ServicePoolManagedAccount,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $WebAppUrl,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $MySiteHostUrl,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [string] $TeamSiteUrl,
- [Parameter(Mandatory=$true)] [ValidateNotNullorEmpty()] [int] $CacheSizeInMB
- )
- Import-DscResource -ModuleName xSharePoint
- Import-DscResource -ModuleName xWebAdministration
- Import-DscResource -ModuleName xCredSSP
- Import-DscResource -ModuleName xDisk
-
- node "localhost"
- {
- #**********************************************************
- # Server configuration
- #
- # This section of the configuration includes details of the
- # server level configuration, such as disks, registry
- # settings etc.
- #**********************************************************
-
- xDisk LogsDisk { DiskNumber = 2; DriveLetter = "l" }
- xDisk IndexDisk { DiskNumber = 3; DriveLetter = "i" }
- xCredSSP CredSSPServer { Ensure = "Present"; Role = "Server" }
- xCredSSP CredSSPClient { Ensure = "Present"; Role = "Client"; DelegateComputers = $CredSSPDelegates }
-
-
- #**********************************************************
- # Software downloads
- #
- # This section details where any binary downloads should
- # be downloaded from and put locally on the server before
- # installation takes place
- #**********************************************************
-
- File SPBinaryDownload
- {
- DestinationPath = "C:\SPInstall"
- Credential = $SPBinaryPathCredential
- Ensure = "Present"
- SourcePath = $SPBinaryPath
- Type = "Directory"
- Recurse = $true
- }
- File UlsViewerDownload
- {
- DestinationPath = "L:\UlsViewer.exe"
- Credential = $SPBinaryPathCredential
- Ensure = "Present"
- SourcePath = $ULSViewerPath
- Type = "File"
- DependsOn = "[xDisk]LogsDisk"
- }
-
- #**********************************************************
- # Binary installation
- #
- # This section triggers installation of both SharePoint
- # as well as the prerequisites required
- #**********************************************************
- xSPInstallPrereqs InstallPrerequisites
- {
- InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe"
- OnlineMode = $true
- SQLNCli = "C:\SPInstall\prerequisiteinstallerfiles\sqlncli.msi"
- PowerShell = "C:\SPInstall\prerequisiteinstallerfiles\Windows6.1-KB2506143-x64.msu"
- NETFX = "C:\SPInstall\prerequisiteinstallerfiles\dotNetFx45_Full_setup.exe"
- IDFX = "C:\SPInstall\prerequisiteinstallerfiles\Windows6.1-KB974405-x64.msu"
- Sync = "C:\SPInstall\prerequisiteinstallerfiles\Synchronization.msi"
- AppFabric = "C:\SPInstall\prerequisiteinstallerfiles\WindowsServerAppFabricSetup_x64.exe"
- IDFX11 = "C:\SPInstall\prerequisiteinstallerfiles\MicrosoftIdentityExtensions-64.msi"
- MSIPCClient = "C:\SPInstall\prerequisiteinstallerfiles\setup_msipc_x64.msi"
- WCFDataServices = "C:\SPInstall\prerequisiteinstallerfiles\WcfDataServices.exe"
- KB2671763 = "C:\SPInstall\prerequisiteinstallerfiles\AppFabric1.1-RTM-KB2671763-x64-ENU.exe"
- WCFDataServices56 = "C:\SPInstall\prerequisiteinstallerfiles\WcfDataServices56.exe"
- DependsOn = "[xSPClearRemoteSessions]ClearRemotePowerShellSessions"
- }
- xSPInstall InstallBinaries
- {
- BinaryDir = "C:\SPInstall"
- ProductKey = $ProductKey
- Ensure = "Present"
- DependsOn = "[xSPInstallPrereqs]InstallPrerequisites"
- }
-
- #**********************************************************
- # IIS clean up
- #
- # This section removes all default sites and application
- # pools from IIS as they are not required
- #**********************************************************
-
- xWebAppPool RemoveDotNet2Pool { Name = ".NET v2.0"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
- xWebAppPool RemoveDotNet2ClassicPool { Name = ".NET v2.0 Classic"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
- xWebAppPool RemoveDotNet45Pool { Name = ".NET v4.5"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites"; }
- xWebAppPool RemoveDotNet45ClassicPool { Name = ".NET v4.5 Classic"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites"; }
- xWebAppPool RemoveClassicDotNetPool { Name = "Classic .NET AppPool"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
- xWebAppPool RemoveDefaultAppPool { Name = "DefaultAppPool"; Ensure = "Absent"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
- xWebSite RemoveDefaultWebSite { Name = "Default Web Site"; Ensure = "Absent"; PhysicalPath = "C:\inetpub\wwwroot"; DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" }
-
-
- #**********************************************************
- # Basic farm configuration
- #
- # This section creates the new SharePoint farm object, and
- # provisions generic services and components used by the
- # whole farm
- #**********************************************************
-
- xSPJoinFarm JoinSPFarm
- {
- DatabaseServer = $DatabaseServer
- FarmConfigDatabaseName = "SP_Config"
- Passphrase = $FarmPassPhrase
- InstallAccount = $InstallAccount
- DependsOn = "[xSPInstall]InstallBinaries"
- }
- xSPDistributedCacheService EnableDistributedCache
- {
- Name = "AppFabricCachingService"
- Ensure = "Present"
- CacheSizeInMB = $CacheSizeInMB
- ServiceAccount = $ServicePoolManagedAccount.UserName
- InstallAccount = $InstallAccount
- CreateFirewallRules = $true
- DependsOn = "[xSPJoinFarm]JoinSPFarm"
- }
-
- #**********************************************************
- # Service instances
- #
- # This section describes which services should be running
- # and not running on the server
- #**********************************************************
-
- xSPServiceInstance ClaimsToWindowsTokenServiceInstance
- {
- Name = "Claims to Windows Token Service"
- Ensure = "Present"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPJoinFarm]JoinSPFarm"
- }
- xSPServiceInstance SecureStoreServiceInstance
- {
- Name = "Secure Store Service"
- Ensure = "Present"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPJoinFarm]JoinSPFarm"
- }
- xSPServiceInstance ManagedMetadataServiceInstance
- {
- Name = "Managed Metadata Web Service"
- Ensure = "Present"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPJoinFarm]JoinSPFarm"
- }
- xSPServiceInstance BCSServiceInstance
- {
- Name = "Business Data Connectivity Service"
- Ensure = "Present"
- InstallAccount = $InstallAccount
- DependsOn = "[xSPJoinFarm]JoinSPFarm"
- }
-
- #**********************************************************
- # Local configuration manager settings
- #
- # This section contains settings for the LCM of the host
- # that this configuraiton is applied to
- #**********************************************************
- LocalConfigurationManager
- {
- RebootNodeIfNeeded = $true
- }
- }
-}
\ No newline at end of file
diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1
index fa7b44dc9..c858f01d0 100644
--- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1
+++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1
@@ -27,6 +27,11 @@ function Get-xSharePointAssemblyVersion() {
return (Get-Command $PathToAssembly).FileVersionInfo.FileMajorPart
}
+function Get-xSharePointContentService() {
+ [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") | Out-Null
+ return [Microsoft.SharePoint.Administration.SPWebService]::ContentService
+}
+
function Get-xSharePointInstalledProductVersion() {
$pathToSearch = "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\*\ISAPI\Microsoft.SharePoint.dll"
$fullPath = Get-Item $pathToSearch | Sort-Object { $_.Directory } -Descending | Select-Object -First 1
@@ -38,7 +43,7 @@ function Invoke-xSharePointCommand() {
param
(
[parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $Credential,
- [parameter(Mandatory = $false)] [HashTable] $Arguments,
+ [parameter(Mandatory = $false)] [Object[]] $Arguments,
[parameter(Mandatory = $true)] [ScriptBlock] $ScriptBlock
)
@@ -136,17 +141,42 @@ function Remove-xSharePointUserToLocalAdmin() {
([ADSI]"WinNT://$($env:computername)/Administrators,group").Remove("WinNT://$domainName/$accountName") | Out-Null
}
+function Test-xSharePointObjectHasProperty() {
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true,Position=1)] [Object] $Object,
+ [parameter(Mandatory = $true,Position=2)] [String] $PropertyName
+ )
+ if (([bool]($Object.PSobject.Properties.name -contains $PropertyName)) -eq $true) {
+ if ($Object.$PropertyName -ne $null) {
+ return $true
+ }
+ }
+ return $false
+}
+
function Test-xSharePointSpecificParameters() {
[CmdletBinding()]
param
(
[parameter(Mandatory = $true,Position=1)] [HashTable] $CurrentValues,
- [parameter(Mandatory = $true,Position=2)] [HashTable] $DesiredValues,
+ [parameter(Mandatory = $true,Position=2)] [Object] $DesiredValues,
[parameter(Mandatory = $false,Position=3)] [Array] $ValuesToCheck
)
$returnValue = $true
+ if (($DesiredValues.GetType().Name -ne "HashTable") `
+ -and ($DesiredValues.GetType().Name -ne "CimInstance") `
+ -and ($DesiredValues.GetType().Name -ne "PSBoundParametersDictionary")) {
+ throw "Property 'DesiredValues' in Test-xSharePointSpecificParameters must be either a Hashtable or CimInstance. Type detected was $($DesiredValues.GetType().Name)"
+ }
+
+ if (($DesiredValues.GetType().Name -eq "CimInstance") -and ($null -eq $ValuesToCheck)) {
+ throw "If 'DesiredValues' is a Hashtable then property 'ValuesToCheck' must contain a value"
+ }
+
if (($ValuesToCheck -eq $null) -or ($ValuesToCheck.Count -lt 1)) {
$KeyList = $DesiredValues.Keys
} else {
@@ -154,9 +184,15 @@ function Test-xSharePointSpecificParameters() {
}
$KeyList | ForEach-Object {
- if ($_ -ne "Verbose") {
+ if (($_ -ne "Verbose") -and ($_ -ne "InstallAccount")) {
if (($CurrentValues.ContainsKey($_) -eq $false) -or ($CurrentValues.$_ -ne $DesiredValues.$_)) {
- if ($DesiredValues.ContainsKey($_)) {
+ if ($DesiredValues.GetType().Name -eq "HashTable" -or $DesiredValues.GetType().Name -eq "PSBoundParametersDictionary") {
+ $CheckDesiredValue = $DesiredValues.ContainsKey($_)
+ } else {
+ $CheckDesiredValue = Test-xSharePointObjectHasProperty $DesiredValues $_
+ }
+
+ if ($CheckDesiredValue) {
$desiredType = $DesiredValues.$_.GetType()
$fieldName = $_
switch ($desiredType.Name) {
@@ -170,14 +206,18 @@ function Test-xSharePointSpecificParameters() {
$returnValue = $false
}
}
+ "Int16" {
+ if (($DesiredValues.$fieldName -eq 0) -and ($CurrentValues.$fieldName -eq $null)) {} else {
+ $returnValue = $false
+ }
+ }
default {
$returnValue = $false
}
}
}
}
- }
-
+ }
}
return $returnValue
}
@@ -201,4 +241,24 @@ function Test-xSharePointUserIsLocalAdmin() {
Where-Object { $_ -eq $accountName }
}
+function Set-xSharePointObjectPropertyIfValueExists() {
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true,Position=1)] [object] $ObjectToSet,
+ [parameter(Mandatory = $true,Position=1)] [string] $PropertyToSet,
+ [parameter(Mandatory = $true,Position=1)] [object] $ParamsValue,
+ [parameter(Mandatory = $true,Position=1)] [string] $ParamKey
+ )
+ if ($ParamsValue.PSobject.Methods.name -contains "ContainsKey") {
+ if ($ParamsValue.ContainsKey($ParamKey) -eq $true) {
+ $ObjectToSet.$PropertyToSet = $ParamsValue.$ParamKey
+ }
+ } else {
+ if (((Test-xSharePointObjectHasProperty $ParamsValue $ParamKey) -eq $true) -and ($null -ne $ParamsValue.$ParamKey)) {
+ $ObjectToSet.$PropertyToSet = $ParamsValue.$ParamKey
+ }
+ }
+}
+
Export-ModuleMember -Function *
diff --git a/Modules/xSharePoint/Modules/xSharePoint.WebApplication/xSPWebApplication.BlockedFileTypes.psm1 b/Modules/xSharePoint/Modules/xSharePoint.WebApplication/xSPWebApplication.BlockedFileTypes.psm1
new file mode 100644
index 000000000..3adb153eb
--- /dev/null
+++ b/Modules/xSharePoint/Modules/xSharePoint.WebApplication/xSPWebApplication.BlockedFileTypes.psm1
@@ -0,0 +1,85 @@
+function Get-xSPWebApplicationBlockedFileTypes {
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param(
+ [parameter(Mandatory = $true)] $WebApplication
+ )
+ $result = @()
+ $WebApplication.BlockedFileExtensions | ForEach-Object { $result += $_ }
+ return @{
+ Blocked = $result
+ }
+}
+
+function Set-xSPWebApplicationBlockedFileTypes {
+ [CmdletBinding()]
+ param(
+ [parameter(Mandatory = $true)] $WebApplication,
+ [parameter(Mandatory = $true)] $Settings
+ )
+
+ if (($Settings.ContainsKey("Blocked") -eq $true) -and (($Settings.ContainsKey("EnsureBlocked") -eq $true) -or ($Settings.ContainsKey("EnsureAllowed") -eq $true))) {
+ throw "Blocked file types must use either the 'blocked' property or the 'EnsureBlocked' and/or 'EnsureAllowed' properties, but not both."
+ }
+
+ if (($Settings.ContainsKey("Blocked") -eq $false) -and ($Settings.ContainsKey("EnsureBlocked") -eq $false) -and ($Settings.ContainsKey("EnsureAllowed") -eq $false)) {
+ throw "Blocked file types must specify at least one property (either 'Blocked, 'EnsureBlocked' or 'EnsureAllowed')"
+ }
+
+ if($Settings.ContainsKey("Blocked") -eq $true) {
+ $WebApplication.BlockedFileExtensions.Clear();
+ $Settings.Blocked | ForEach-Object {
+ $WebApplication.BlockedFileExtensions.Add($_.ToLower());
+ }
+ }
+
+ if($Settings.ContainsKey("EnsureBlocked") -eq $true) {
+ $Settings.EnsureBlocked | ForEach-Object {
+ if(!$WebApplication.BlockedFileExtensions.Contains($_.ToLower())){
+ $WebApplication.BlockedFileExtensions.Add($_.ToLower());
+ }
+ }
+ }
+
+ if($Settings.ContainsKey("EnsureAllowed") -eq $true) {
+ $Settings.EnsureAllowed | ForEach-Object {
+ if($WebApplication.BlockedFileExtensions.Contains($_.ToLower())){
+ $WebApplication.BlockedFileExtensions.Remove($_.ToLower());
+ }
+ }
+ }
+}
+
+function Test-xSPWebApplicationBlockedFileTypes {
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param(
+ [parameter(Mandatory = $true)] $CurrentSettings,
+ [parameter(Mandatory = $true)] $DesiredSettings
+ )
+ if (($DesiredSettings.ContainsKey("Blocked") -eq $true) -and (($DesiredSettings.ContainsKey("EnsureBlocked") -eq $true) -or ($DesiredSettings.ContainsKey("EnsureAllowed") -eq $true))) {
+ throw "Blocked file types must use either the 'blocked' property or the 'EnsureBlocked' and/or 'EnsureAllowed' properties, but not both."
+ }
+
+ if (($DesiredSettings.ContainsKey("Blocked") -eq $false) -and ($DesiredSettings.ContainsKey("EnsureBlocked") -eq $false) -and ($DesiredSettings.ContainsKey("EnsureAllowed") -eq $false)) {
+ throw "Blocked file types must specify at least one property (either 'Blocked, 'EnsureBlocked' or 'EnsureAllowed')"
+ }
+
+ if($DesiredSettings.ContainsKey("Blocked") -eq $true) {
+ $compareResult = Compare-Object -ReferenceObject $CurrentSettings.Blocked -DifferenceObject $DesiredSettings.Blocked
+ if ($compareResult -eq $null) { return $true } else { return $false }
+ }
+
+ if($DesiredSettings.ContainsKey("EnsureBlocked") -eq $true) {
+ $itemsToAdd = Compare-Object -ReferenceObject $CurrentSettings.Blocked -DifferenceObject $DesiredSettings.EnsureBlocked | Where-Object { $_.SideIndicator -eq "=>"}
+ if ($itemsToAdd -ne $null) { return $false }
+ }
+
+ if($DesiredSettings.ContainsKey("EnsureAllowed") -eq $true) {
+ $itemsToRemove = Compare-Object -ReferenceObject $CurrentSettings.Blocked -DifferenceObject $DesiredSettings.EnsureAllowed -ExcludeDifferent -IncludeEqual
+ if ($itemsToRemove -ne $null) { return $false }
+ }
+
+ return $true
+}
+
diff --git a/Modules/xSharePoint/Modules/xSharePoint.WebApplication/xSPWebApplication.GeneralSettings.psm1 b/Modules/xSharePoint/Modules/xSharePoint.WebApplication/xSPWebApplication.GeneralSettings.psm1
new file mode 100644
index 000000000..feb2197c3
--- /dev/null
+++ b/Modules/xSharePoint/Modules/xSharePoint.WebApplication/xSPWebApplication.GeneralSettings.psm1
@@ -0,0 +1,80 @@
+function Get-xSPWebApplicationGeneralSettings {
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param(
+ [parameter(Mandatory = $true)] $WebApplication
+ )
+
+ return @{
+ TimeZone = $WebApplication.DefaultTimeZone
+ Alerts = $WebApplication.AlertsEnabled
+ AlertsLimit = $WebApplication.AlertsMaximum
+ RSS = $WebApplication.SyndicationEnabled
+ BlogAPI = $WebApplication.MetaWeblogEnabled
+ BlogAPIAuthenticated = $WebApplication.MetaWeblogAuthenticationEnabled
+ BrowserFileHandling = $WebApplication.BrowserFileHandling
+ SecurityValidation = $WebApplication.FormDigestSettings.Enabled
+ RecycleBinEnabled = $WebApplication.RecycleBinEnabled
+ RecycleBinCleanupEnabled = $WebApplication.RecycleBinCleanupEnabled
+ RecycleBinRetentionPeriod = $WebApplication.RecycleBinRetentionPeriod
+ SecondStageRecycleBinQuota = $WebApplication.SecondStageRecycleBinQuota
+ MaximumUploadSize = $WebApplication.MaximumFileSize
+ CustomerExperienceProgram = $WebApplication.BrowserCEIPEnabled
+ PresenceEnabled = $WebApplication.PresenceEnabled
+ }
+}
+
+function Set-xSPWebApplicationGeneralSettings {
+ [CmdletBinding()]
+ param(
+ [parameter(Mandatory = $true)] $WebApplication,
+ [parameter(Mandatory = $true)] $Settings
+ )
+
+ # Format here is SPWebApplication property = Custom settings property
+ $mapping = @{
+ DefaultTimeZone = "TimeZone"
+ AlertsEnabled = "Alerts"
+ AlertsMaximum = "AlertsLimit"
+ SyndicationEnabled = "RSS"
+ MetaWeblogEnabled = "BlogAPI"
+ MetaWeblogAuthenticationEnabled = "BlogAPIAuthenticated"
+ BrowserFileHandling = "BrowserFileHandling"
+ MaximumFileSize = "MaximumUploadSize"
+ RecycleBinEnabled = "RecycleBinEnabled"
+ RecycleBinCleanupEnabled = "RecycleBinCleanupEnabled"
+ RecycleBinRetentionPeriod = "RecycleBinRetentionPeriod"
+ SecondStageRecycleBinQuota = "SecondStageRecycleBinQuota"
+ BrowserCEIPEnabled = "CustomerExperienceProgram"
+ PresenceEnabled = "Presence"
+ }
+ $mapping.Keys | ForEach-Object {
+ Set-xSharePointObjectPropertyIfValueExists -ObjectToSet $WebApplication `
+ -PropertyToSet $_ `
+ -ParamsValue $settings `
+ -ParamKey $mapping[$_]
+ }
+
+ # Set form digest setting child property
+ Set-xSharePointObjectPropertyIfValueExists -ObjectToSet $WebApplication.FormDigestSettings `
+ -PropertyToSet "Enabled" `
+ -ParamsValue $settings `
+ -ParamKey "SecurityValidation"
+}
+
+function Test-xSPWebApplicationGeneralSettings {
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param(
+ [parameter(Mandatory = $true)] $CurrentSettings,
+ [parameter(Mandatory = $true)] $DesiredSettings
+ )
+
+
+ Import-Module (Join-Path $PSScriptRoot "..\..\Modules\xSharePoint.Util\xSharePoint.Util.psm1" -Resolve)
+ $testReturn = Test-xSharePointSpecificParameters -CurrentValues $CurrentSettings `
+ -DesiredValues $DesiredSettings `
+ -ValuesToCheck @("TimeZone", "Alerts", "AlertsLimit", "RSS", "BlogAPI", "BlogAPIAuthenticated", "BrowserFileHandling", "SecurityValidation", "RecycleBinEnabled", "RecycleBinCleanupEnabled", "RecycleBinRetentionPeriod", "SecondStageRecycleBinQuota", "MaximumUploadSize", "CustomerExperienceProgram", "PresenceEnabled")
+ return $testReturn
+}
+
diff --git a/Modules/xSharePoint/Modules/xSharePoint.WebApplication/xSPWebApplication.Throttling.psm1 b/Modules/xSharePoint/Modules/xSharePoint.WebApplication/xSPWebApplication.Throttling.psm1
new file mode 100644
index 000000000..cf6dff20f
--- /dev/null
+++ b/Modules/xSharePoint/Modules/xSharePoint.WebApplication/xSPWebApplication.Throttling.psm1
@@ -0,0 +1,119 @@
+function Get-xSPWebApplicationThrottlingSettings {
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param(
+ [parameter(Mandatory = $true)] $WebApplication
+ )
+ return @{
+ ListViewThreshold = $WebApplication.MaxItemsPerThrottledOperation
+ AllowObjectModelOverride = $WebApplication.AllowOMCodeOverrideThrottleSettings
+ AdminThreshold = $WebApplication.MaxItemsPerThrottledOperationOverride
+ ListViewLookupThreshold = $WebApplication.MaxQueryLookupFields
+ HappyHourEnabled = $WebApplication.UnthrottledPrivilegedOperationWindowEnabled
+ HappyHour = @{
+ Hour = $WebApplication.DailyStartUnthrottledPrivilegedOperationsHour
+ Minute = $WebApplication.DailyStartUnthrottledPrivilegedOperationsMinute
+ Duration = $WebApplication.DailyUnthrottledPrivilegedOperationsDuration
+ }
+ UniquePermissionThreshold = $WebApplication.MaxUniquePermScopesPerList
+ RequestThrottling = $WebApplication.HttpThrottleSettings.PerformThrottle
+ ChangeLogEnabled = $WebApplication.ChangeLogExpirationEnabled
+ ChangeLogExpiryDays = $WebApplication.ChangeLogRetentionPeriod.Days
+ EventHandlersEnabled = $WebApplication.EventHandlersEnabled
+ }
+}
+
+function Set-xSPWebApplicationThrottlingSettings {
+ [CmdletBinding()]
+ param(
+ [parameter(Mandatory = $true)] $WebApplication,
+ [parameter(Mandatory = $true)] $Settings
+ )
+
+ # Format here is SPWebApplication property = Custom settings property
+ $mapping = @{
+ MaxItemsPerThrottledOperation = "ListViewThreshold"
+ AllowOMCodeOverrideThrottleSettings = "AllowObjectModelOverride"
+ MaxItemsPerThrottledOperationOverride = "AdminThreshold"
+ MaxQueryLookupFields = "ListViewLookupThreshold"
+ UnthrottledPrivilegedOperationWindowEnabled = "HappyHourEnabled"
+ MaxUniquePermScopesPerList = "UniquePermissionThreshold"
+ EventHandlersEnabled = "EventHandlersEnabled"
+ ChangeLogExpirationEnabled = "ChangeLogEnabled"
+ }
+ $mapping.Keys | ForEach-Object {
+ Set-xSharePointObjectPropertyIfValueExists -ObjectToSet $WebApplication `
+ -PropertyToSet $_ `
+ -ParamsValue $settings `
+ -ParamKey $mapping[$_]
+ }
+
+ # Set throttle settings child property seperately
+ Set-xSharePointObjectPropertyIfValueExists -ObjectToSet $WebApplication.HttpThrottleSettings `
+ -PropertyToSet "PerformThrottle" `
+ -ParamsValue $Settings `
+ -ParamKey "RequestThrottling"
+
+ # Create time span object separately
+ if ((Test-xSharePointObjectHasProperty $Settings "ChangeLogExpiryDays") -eq $true) {
+ $WebApplication.ChangeLogRetentionPeriod = New-TimeSpan -Days $Settings.ChangeLogExpiryDays
+ }
+}
+
+
+function Set-xSPWebApplicationHappyHourSettings {
+ [CmdletBinding()]
+ param(
+ [parameter(Mandatory = $true)] $WebApplication,
+ [parameter(Mandatory = $true)] $Settings
+ )
+
+ if ((Test-xSharePointObjectHasProperty $Settings "Hour") -eq $false -or (Test-xSharePointObjectHasProperty $Settings "Minute") -eq $false -or (Test-xSharePointObjectHasProperty $Settings "Duration") -eq $false) {
+ throw "Happy hour settings must include 'hour', 'minute' and 'duration'"
+ } else {
+ if ($Settings.Hour -lt 0 -or $Settings.Hour -gt 23) {
+ throw "Happy hour setting 'hour' must be between 0 and 23"
+ }
+ if ($Settings.Minute -lt 0 -or $Settings.Minute -gt 59) {
+ throw "Happy hour setting 'minute' must be between 0 and 59"
+ }
+ if ($Settings.Duration -lt 0 -or $Settings.Duration -gt 23) {
+ throw "Happy hour setting 'hour' must be between 0 and 23"
+ }
+ $WebApplication.SetDailyUnthrottledPrivilegedOperationWindow($happyHour.Hour, $happyHour.Minute, $happyHour.Duration)
+ }
+}
+
+function Test-xSPWebApplicationThrottlingSettings {
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param(
+ [parameter(Mandatory = $true)] $CurrentSettings,
+ [parameter(Mandatory = $true)] $DesiredSettings
+ )
+
+ Import-Module (Join-Path $PSScriptRoot "..\..\Modules\xSharePoint.Util\xSharePoint.Util.psm1" -Resolve)
+ $testReturn = Test-xSharePointSpecificParameters -CurrentValues $CurrentSettings `
+ -DesiredValues $DesiredSettings `
+ -ValuesToCheck @(
+ "ListViewThreshold",
+ "AllowObjectModelOverride",
+ "AdminThreshold",
+ "ListViewLookupThreshold",
+ "HappyHourEnabled",
+ "UniquePermissionThreshold",
+ "RequestThrottling",
+ "ChangeLogEnabled",
+ "ChangeLogExpiryDays",
+ "EventHandlersEnabled"
+ )
+ if ($testReturn -eq $true) {
+ if ((Test-xSharePointObjectHasProperty $DesiredSettings "HappyHour") -eq $true) {
+ $testReturn = Test-xSharePointSpecificParameters -CurrentValues $CurrentSettings.HappyHour `
+ -DesiredValues $DesiredSettings.HappyHour `
+ -ValuesToCheck @("Hour", "Minute", "Duration")
+ }
+ }
+ return $testReturn
+}
+
diff --git a/Modules/xSharePoint/Modules/xSharePoint.WebApplication/xSPWebApplication.Workflow.psm1 b/Modules/xSharePoint/Modules/xSharePoint.WebApplication/xSPWebApplication.Workflow.psm1
new file mode 100644
index 000000000..8a6485c3c
--- /dev/null
+++ b/Modules/xSharePoint/Modules/xSharePoint.WebApplication/xSPWebApplication.Workflow.psm1
@@ -0,0 +1,46 @@
+function Get-xSPWebApplicationWorkflowSettings {
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param(
+ [parameter(Mandatory = $true)] $WebApplication
+ )
+ return @{
+ ExternalWorkflowParticipantsEnabled = $WebApplication.ExternalWorkflowParticipantsEnabled
+ UserDefinedWorkflowsEnabled = $WebApplication.UserDefinedWorkflowsEnabled
+ EmailToNoPermissionWorkflowParticipantsEnable = $WebApplication.EmailToNoPermissionWorkflowParticipantsEnabled
+ }
+}
+
+function Set-xSPWebApplicationWorkflowSettings {
+ [CmdletBinding()]
+ param(
+ [parameter(Mandatory = $true)] $WebApplication,
+ [parameter(Mandatory = $true)] $Settings
+ )
+ if($Settings.ContainsKey("UserDefinedWorkflowsEnabled") -eq $true) {
+ $WebApplication.UserDefinedWorkflowsEnabled = $Settings.UserDefinedWorkflowsEnabled;
+ }
+ if($Settings.ContainsKey("EmailToNoPermissionWorkflowParticipantsEnable") -eq $true) {
+ $WebApplication.EmailToNoPermissionWorkflowParticipantsEnabled = $Settings.EmailToNoPermissionWorkflowParticipantsEnable;
+ }
+ if($Settings.ContainsKey("ExternalWorkflowParticipantsEnabled") -eq $true) {
+ $WebApplication.ExternalWorkflowParticipantsEnabled = $Settings.ExternalWorkflowParticipantsEnabled;
+ }
+ $WebApplication.UpdateWorkflowConfigurationSettings();
+}
+
+function Test-xSPWebApplicationWorkflowSettings {
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param(
+ [parameter(Mandatory = $true)] $CurrentSettings,
+ [parameter(Mandatory = $true)] $DesiredSettings
+ )
+
+ Import-Module (Join-Path $PSScriptRoot "..\..\Modules\xSharePoint.Util\xSharePoint.Util.psm1" -Resolve)
+ $testReturn = Test-xSharePointSpecificParameters -CurrentValues $CurrentSettings `
+ -DesiredValues $DesiredSettings `
+ -ValuesToCheck @("UserDefinedWorkflowsEnabled","EmailToNoPermissionWorkflowParticipantsEnable","ExternalWorkflowParticipantsEnabled")
+ return $testReturn
+}
+
diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1
index 7d7cf4054..ed8503211 100644
--- a/Modules/xSharePoint/xSharePoint.psd1
+++ b/Modules/xSharePoint/xSharePoint.psd1
@@ -12,7 +12,7 @@
# RootModule = ''
# Version number of this module.
-ModuleVersion = '0.7.0.0'
+ModuleVersion = '0.8.0.0'
# ID used to uniquely identify this module
GUID = '6c1176a0-4fac-4134-8ca2-3fa8a21a7b90'
@@ -71,11 +71,14 @@ FunctionsToExport = '*'
# Cmdlets to export from this module
CmdletsToExport = @("Invoke-xSharePointCommand",
"Get-xSharePointInstalledProductVersion",
+ "Get-xSharePointContentService",
"Rename-xSharePointParamValue",
"Add-xSharePointUserToLocalAdmin",
"Remove-xSharePointUserToLocalAdmin",
+ "Test-xSharePointObjectHasProperty",
"Test-xSharePointUserIsLocalAdmin",
- "Test-xSharePointSpecificParameters")
+ "Test-xSharePointSpecificParameters",
+ "Set-xSharePointObjectPropertyIfValueExists")
# Variables to export from this module
VariablesToExport = '*'
@@ -95,8 +98,9 @@ AliasesToExport = '*'
# HelpInfo URI of this module
# HelpInfoURI = ''
-# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
+# Default prefix for commands exported from this module. Override the default prefix using Import-Module -prefix.
# DefaultCommandPrefix = ''
+
}
diff --git a/Modules/xSharePoint/xSharePoint.pssproj b/Modules/xSharePoint/xSharePoint.pssproj
index dd7740cee..340a110cd 100644
--- a/Modules/xSharePoint/xSharePoint.pssproj
+++ b/Modules/xSharePoint/xSharePoint.pssproj
@@ -50,11 +50,13 @@
+
+
@@ -62,6 +64,7 @@
+
@@ -72,13 +75,21 @@
+
+
+
+
+
+
+
+
@@ -89,6 +100,8 @@
+
+
@@ -103,6 +116,9 @@
+
+
+
@@ -121,16 +137,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
diff --git a/README.md b/README.md
index 73190c936..2b80689fc 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@ Please leave comments, feature requests, and bug reports in the Q & A tab for th
If you would like to modify xSharePoint module, please feel free.
When modifying, please update the module name, resource friendly name, and MOF class name (instructions below).
As specified in the license, you may copy or modify this resource as long as they are used on the Windows Platform.
-Pleaes refer to the [Contribution Guidelines](https://github.com/PowerShell/xSharePoint/wiki/Contributing%20to%20xSharePoint) for information about style guides, testing and patterns for contributing to DSC resources.
+Please refer to the [Contribution Guidelines](https://github.com/PowerShell/xSharePoint/wiki/Contributing%20to%20xSharePoint) for information about style guides, testing and patterns for contributing to DSC resources.
## Installation
@@ -32,12 +32,13 @@ Please read the installation instructions that are present on both the download
Below is a list of DSC resource types that are currently provided by xSharePoint:
+ - xSPAntivirusSettings
- xBCSServiceApp
- xSPCacheAccounts
- - xSPClearRemoteSessions
- xSPCreateFarm
- xSPDiagnosticLoggingSettings
- xSPDistributedCacheService
+ - xSPFarmAdministrators
- xSPFeature
- xSPInstall
- xSPInstallPreReqs
@@ -45,6 +46,8 @@ Below is a list of DSC resource types that are currently provided by xSharePoint
- xSPManagedAccount
- xSPManagedMetadataServiceApp
- xSPManagedPath
+ - xSPOutgoingEmailSettings
+ - xSPPasswordChangeSettings
- xSPSearchServiceApp
- xSPSecureStoreServiceApp
- xSPServiceAppPool
@@ -54,7 +57,11 @@ Below is a list of DSC resource types that are currently provided by xSharePoint
- xSPUsageApplication
- xSPUserProfileServiceApp
- xSPUserProfileSyncService
+ - xSPWebAppBlockedFileTypes
+ - xSPWebAppGeneralSettings
- xSPWebApplication
+ - xSPWebAppThrottlingSettings
+ - xSPWebAppWorkflowSettings
## Preview status
@@ -68,6 +75,13 @@ Additional detailed documentation is included on the wiki on GitHub.
## Version History
+### 0.8.0.0
+ * Added xSPAntivirusSettings, xSPFarmAdministrators, xSPOutgoingEmailSettings, xSPPasswordChangeSettings, xSPWebAppBlockedFileTypes, xSPWebAppGeneralSettings, xSPWebAppThrottlingSettings and xSPWebAppWorkflowSettings
+ * Fixed issue with xSPInstallPrereqs using wrong parameters in offline install mode
+ * Fixed issue with xSPInstallPrereqs where it would not validate that installer paths exist
+ * Fixed xSPSecureStoreServiceApp and xSPUsageApplication to use PSCredentials instead of plain text username/password for database credentials
+ * Added built in PowerShell help (for calling "Get-Help about_[resource]", such as "Get-Help about_xSPCreateFarm")
+
### 0.7.0.0
* Support for MinRole options in SharePoint 2016
diff --git a/Tests/Generate-xSharePointHelpFiles.ps1 b/Tests/Generate-xSharePointHelpFiles.ps1
new file mode 100644
index 000000000..a767f237f
--- /dev/null
+++ b/Tests/Generate-xSharePointHelpFiles.ps1
@@ -0,0 +1,38 @@
+param
+(
+ [parameter(Mandatory = $true)] [System.String] $OutPutPath
+)
+
+Import-Module (Join-Path $PSScriptRoot "xSharePoint\xSharePoint.TestHelpers.psm1")
+
+$repoDir = Join-Path $PSScriptRoot "..\" -Resolve
+
+Get-ChildItem "$repoDir\modules\xSharePoint\**\*.schema.mof" -Recurse | `
+ ForEach-Object {
+ $mofFileObject = $_
+ $result = (Get-MofSchemaObject $_.FullName) | Where-Object { $_.ClassName -eq $mofFileObject.Name.Replace(".schema.mof", "") -and $_.FriendlyName -ne $null }
+ if ($result -ne $null) {
+ Write-Output "Generating help document for $($result.FriendlyName)"
+
+ $output = "NAME" + [Environment]::NewLine
+ $output += " $($result.FriendlyName)" + [Environment]::NewLine + [Environment]::NewLine
+ $output += "PARAMETERS" + [Environment]::NewLine
+
+ foreach($property in $result.Attributes) {
+ $output += " $($property.Name) ($($property.State), $($property.DataType)"
+ if ([string]::IsNullOrEmpty($property.ValueMap) -ne $true) {
+ $output += ", Allowed values: "
+ $property.ValueMap | ForEach-Object {
+ $output += $_ + ", "
+ }
+ $output = $output.TrimEnd(" ")
+ $output = $output.TrimEnd(",")
+ }
+ $output += ")" + [Environment]::NewLine
+ }
+
+ $output += [Environment]::NewLine + $result.Documentation.Replace("**Description**", "DESCRIPTION").Replace("**Example**","EXAMPLE")
+
+ $output | Out-File -FilePath (Join-Path $OutPutPath "about_$($result.FriendlyName).help.txt") -Encoding utf8 -Force
+ }
+ }
\ No newline at end of file
diff --git a/Tests/Generate-xSharePointWikiPages.ps1 b/Tests/Generate-xSharePointWikiPages.ps1
new file mode 100644
index 000000000..1b3abe8b7
--- /dev/null
+++ b/Tests/Generate-xSharePointWikiPages.ps1
@@ -0,0 +1,33 @@
+param
+(
+ [parameter(Mandatory = $true)] [System.String] $OutPutPath
+)
+
+Import-Module (Join-Path $PSScriptRoot "xSharePoint\xSharePoint.TestHelpers.psm1")
+
+$repoDir = Join-Path $PSScriptRoot "..\" -Resolve
+
+Get-ChildItem "$repoDir\modules\xSharePoint\**\*.schema.mof" -Recurse | `
+ ForEach-Object {
+ $result = (Get-MofSchemaObject $_.FullName) | Where-Object { $_.ClassName -eq $_.Name.Replace(".schema.mof", "") }
+ Write-Output "Generating wiki page for $($result.FriendlyName)"
+
+ $output = "**Parameters**" + [Environment]::NewLine + [Environment]::NewLine
+
+ foreach($property in $result.Attributes) {
+ $output += " - $($property.Name) ($($property.State), $($property.DataType)"
+ if ([string]::IsNullOrEmpty($property.ValueMap) -ne $true) {
+ $output += ", Allowed values: "
+ $property.ValueMap | ForEach-Object {
+ $output += $_ + ", "
+ }
+ $output = $output.TrimEnd(" ")
+ $output = $output.TrimEnd(",")
+ }
+ $output += ")" + [Environment]::NewLine
+ }
+
+ $output += [Environment]::NewLine + $result.Documentation
+
+ $output | Out-File -FilePath (Join-Path $OutPutPath "$($result.FriendlyName).md") -Encoding utf8 -Force
+ }
\ No newline at end of file
diff --git a/Tests/Tests.pssproj b/Tests/Tests.pssproj
index 09c494faf..1ab144884 100644
--- a/Tests/Tests.pssproj
+++ b/Tests/Tests.pssproj
@@ -59,13 +59,23 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 b/Tests/xSharePoint/xSharePoint.Global.Tests.ps1
index cfe9684bf..c1f212a9e 100644
--- a/Tests/xSharePoint/xSharePoint.Global.Tests.ps1
+++ b/Tests/xSharePoint/xSharePoint.Global.Tests.ps1
@@ -2,7 +2,6 @@
param(
[string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve)
)
-
$ErrorActionPreference = 'stop'
Set-StrictMode -Version latest
@@ -22,11 +21,13 @@ Describe 'xSharePoint whole of module tests' {
$mofFiles | ForEach-Object {
$fileHasInstallAccount = $false
- $mofSchema = Get-MofSchemaObject $_.FullName
- $installAccount = $mofSchema.Attributes | Where-Object { $_.Name -eq "InstallAccount" }
- if (($null -ne $installAccount) -and ($installAccount.State -eq "Required")) {
- $mofFilesWithNoInstallAccount += 1
- Write-Warning "File $($_.FullName) has InstallAccount listed as a required parameter. After v0.6 of xSharePoint this should be changed to 'write' instead of 'required'"
+ $mofSchemas = Get-MofSchemaObject $_.FullName
+ foreach($mofSchema in $mofSchemas) {
+ $installAccount = $mofSchema.Attributes | Where-Object { $_.Name -eq "InstallAccount" }
+ if (($null -ne $installAccount) -and ($installAccount.State -eq "Required")) {
+ $mofFilesWithNoInstallAccount += 1
+ Write-Warning "File $($_.FullName) has InstallAccount listed as a required parameter. After v0.6 of xSharePoint this should be changed to 'write' instead of 'required'"
+ }
}
}
$mofFilesWithNoInstallAccount | Should Be 0
@@ -92,4 +93,4 @@ Describe 'xSharePoint whole of module tests' {
$errors.Count | Should Be 0
}
}
-}
\ No newline at end of file
+}
diff --git a/Tests/xSharePoint/xSharePoint.TestHelpers.psm1 b/Tests/xSharePoint/xSharePoint.TestHelpers.psm1
index 0d2001041..17b735acc 100644
--- a/Tests/xSharePoint/xSharePoint.TestHelpers.psm1
+++ b/Tests/xSharePoint/xSharePoint.TestHelpers.psm1
@@ -5,31 +5,55 @@ function Get-MofSchemaObject() {
)
$contents = Get-Content $fileName
- $results = @{
+ $results = @()
+
+ $currentResult = @{
ClassVersion = $null
FriendlyName = $null
ClassName = $null
Attributes = @()
+ Documentation = $null
}
+ $currentComment = ""
+ $currentlyInCommentBlock = $false
foreach($textLine in $contents) {
- if ($textLine.Contains("ClassVersion") -or $textLine.Contains("ClassVersion")) {
+ if ($textLine.StartsWith("/*")) {
+ $currentlyInCommentBlock = $true
+ } elseif($textLine.StartsWith("*/")) {
+ $currentlyInCommentBlock = $false
+ $currentResult.Documentation = $currentComment
+ } elseif($currentlyInCommentBlock -eq $true) {
+ $currentComment += $textLine + [Environment]::NewLine
+ } elseif ($textLine -match "ClassVersion" -or $textLine -match "FriendlyName") {
if ($textLine -match "ClassVersion(`"*.`")") {
$start = $textLine.IndexOf("ClassVersion(`"") + 14
$end = $textLine.IndexOf("`")", $start)
- $results.ClassVersion = $textLine.Substring($start, $end - $start)
+ $currentResult.ClassVersion = $textLine.Substring($start, $end - $start)
}
if ($textLine -match "FriendlyName(`"*.`")") {
$start = $textLine.IndexOf("FriendlyName(`"") + 14
$end = $textLine.IndexOf("`")", $start)
- $results.FriendlyName = $textLine.Substring($start, $end - $start)
+ $currentResult.FriendlyName = $textLine.Substring($start, $end - $start)
}
- } elseif ($textLine.Contains("class ")) {
- $start = $textLine.IndexOf("class ") + 6
+ } elseif ($textLine -match "class ") {
+ $start = $textLine.ToLower().IndexOf("class ") + 6
$end = $textLine.IndexOf(" ", $start)
- $results.ClassName = $textLine.Substring($start, $end - $start)
- } elseif ($textLine.Trim() -eq "{" -or $textLine.Trim() -eq "};" -or [string]::IsNullOrEmpty($textLine)) {
+ if ($end -eq -1) {
+ $end = $textLine.Length
+ }
+ $currentResult.ClassName = $textLine.Substring($start, $end - $start)
+ } elseif ($textLine.Trim() -eq "{" -or [string]::IsNullOrEmpty($textLine.Trim())) {
+ } elseif ($textLine.Trim() -eq "};") {
+ $results += $currentResult
+ $currentResult = @{
+ ClassVersion = $null
+ FriendlyName = $null
+ ClassName = $null
+ Attributes = @()
+ Documentation = $null
+ }
} else {
$attributeValue = @{
State = $null
@@ -66,7 +90,7 @@ function Get-MofSchemaObject() {
$attributeValue.DataType = $nonMetadataObjects[1]
$attributeValue.Name = $nonMetadataObjects[2]
- $results.Attributes += $attributeValue
+ $currentResult.Attributes += $attributeValue
}
}
return $results
@@ -78,7 +102,8 @@ function Assert-MofSchemaScriptParameters() {
[string]$mofFileName
)
$hasErrors = $false
- $mofData = Get-MofSchemaObject -fileName $mofFileName
+ $mofSchemas = Get-MofSchemaObject -fileName $mofFileName
+ $mofData = $mofSchemas | Where-Object { $_.ClassName -eq $mofFileName.Replace(".schema.mof", "") }
$psFile = $mofFileName.Replace(".schema.mof", ".psm1")
$tokens = $null
@@ -190,4 +215,4 @@ function Get-ParseErrors {
return $errors
}
-Export-ModuleMember *
\ No newline at end of file
+Export-ModuleMember *
diff --git a/Tests/xSharePoint/xSharePoint.xSPAntivirusSettings.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPAntivirusSettings.Tests.ps1
new file mode 100644
index 000000000..ec71788e0
--- /dev/null
+++ b/Tests/xSharePoint/xSharePoint.xSPAntivirusSettings.Tests.ps1
@@ -0,0 +1,112 @@
+[CmdletBinding()]
+param(
+ [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve)
+)
+
+$ErrorActionPreference = 'stop'
+Set-StrictMode -Version latest
+
+$RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path
+$Global:CurrentSharePointStubModule = $SharePointCmdletModule
+
+$ModuleName = "MSFT_xSPAntivirusSettings"
+Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1")
+
+Describe "xSPAntivirusSettings" {
+ InModuleScope $ModuleName {
+ $testParams = @{
+ ScanOnDownload = $true
+ ScanOnUpload = $true
+ AllowDownloadInfected = $true
+ AttemptToClean = $true
+ TimeoutDuration = 60
+ NumberOfThreads = 5
+ }
+ Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint")
+
+ Mock Invoke-xSharePointCommand {
+ return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope
+ }
+
+ Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue
+
+ Context "The server is not part of SharePoint farm" {
+ Mock Get-SPFarm { throw "Unable to detect local farm" }
+
+ It "return null from the get method" {
+ Get-TargetResource @testParams | Should Be $null
+ }
+
+ It "returns false from the test method" {
+ Test-TargetResource @testParams | Should Be $false
+ }
+
+ It "throws an exception in the set method to say there is no local farm" {
+ { Set-TargetResource @testParams } | Should throw "No local SharePoint farm was detected"
+ }
+ }
+
+ Context "The server is in a farm and the incorrect settings have been applied" {
+ Mock Get-xSharePointContentService {
+ $returnVal = @{
+ AntivirusSettings = @{
+ AllowDownload = $false
+ DownloadScanEnabled = $false
+ UploadScanEnabled = $false
+ CleaningEnabled = $false
+ NumberOfThreads = 0
+ Timeout = @{
+ TotalSeconds = 0;
+ }
+ }
+ }
+ $returnVal = $returnVal | Add-Member ScriptMethod Update { $Global:xSharePointAntivirusUpdated = $true } -PassThru
+ return $returnVal
+ }
+ Mock Get-SPFarm { return @{} }
+
+ It "return values from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "returns false from the test method" {
+ Test-TargetResource @testParams | Should Be $false
+ }
+
+ $Global:xSharePointAntivirusUpdated = $false
+ It "updates the antivirus settings" {
+ Set-TargetResource @testParams
+ $Global:xSharePointAntivirusUpdated | Should Be $true
+ }
+ }
+
+ Context "The server is in a farm and the correct settings have been applied" {
+ Mock Get-xSharePointContentService {
+ $returnVal = @{
+ AntivirusSettings = @{
+ AllowDownload = $true
+ DownloadScanEnabled = $true
+ UploadScanEnabled = $true
+ CleaningEnabled = $true
+ NumberOfThreads = 5
+ Timeout = @{
+ TotalSeconds = 60;
+ }
+ }
+ }
+ $returnVal = $returnVal | Add-Member ScriptMethod Update { $Global:xSharePointAntivirusUpdated = $true } -PassThru
+ return $returnVal
+ }
+ Mock Get-SPFarm { return @{} }
+
+ It "return values from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "returns true from the test method" {
+ Test-TargetResource @testParams | Should Be $true
+ }
+
+ }
+ }
+}
diff --git a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1
index 4f8a2023e..3237bc766 100644
--- a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1
+++ b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1
@@ -3,11 +3,6 @@ param(
[string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve)
)
-if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0
-{
- $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path)
-}
-
$ErrorActionPreference = 'stop'
Set-StrictMode -Version latest
diff --git a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1
index 668ee24db..450ce8645 100644
--- a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1
+++ b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1
@@ -53,11 +53,33 @@ Describe "xSPDistributedCacheService" {
Add-Member ScriptMethod Update {} -PassThru |
Add-Member ScriptMethod Deploy {} -PassThru
})
- } }
+ } }
+ Mock Stop-SPServiceInstance { $Global:xSharePointDCacheOnline = $false }
+ Mock Start-SPServiceInstance { $Global:xSharePointDCacheOnline = $true }
+
+ Mock Get-SPServiceInstance {
+ if ($Global:xSharePointDCacheOnline -eq $false) {
+ return @(New-Object Object |
+ Add-Member NoteProperty TypeName "Distributed Cache" -PassThru |
+ Add-Member NoteProperty Status "Disabled" -PassThru |
+ Add-Member NoteProperty Service "SPDistributedCacheService Name=AppFabricCachingService" -PassThru |
+ Add-Member NoteProperty Server @{ Name = $env:COMPUTERNAME } -PassThru |
+ Add-Member ScriptMethod Delete {} -PassThru)
+ } else {
+ return @(New-Object Object |
+ Add-Member NoteProperty TypeName "Distributed Cache" -PassThru |
+ Add-Member NoteProperty Status "Online" -PassThru |
+ Add-Member NoteProperty Service "SPDistributedCacheService Name=AppFabricCachingService" -PassThru |
+ Add-Member NoteProperty Server @{ Name = $env:COMPUTERNAME } -PassThru |
+ Add-Member ScriptMethod Delete {} -PassThru)
+ }
+
+ }
Context "Distributed cache is not configured" {
Mock Use-CacheCluster { throw [Exception] "ERRPS001 Error in reading provider and connection string values." }
-
+ $Global:xSharePointDCacheOnline = $false
+
It "returns null from the get method" {
(Get-TargetResource @testParams).Ensure | Should Be "Absent"
}
@@ -73,6 +95,8 @@ Describe "xSPDistributedCacheService" {
}
Context "Distributed cache is configured correctly and running as required" {
+ $Global:xSharePointDCacheOnline = $true
+
Mock Get-AFCacheHostConfiguration { return @{
Size = $testParams.CacheSizeInMB
}}
@@ -84,6 +108,7 @@ Describe "xSPDistributedCacheService" {
}
Context "Distributed cache is configured but the required firewall rules are not deployed" {
+ $Global:xSharePointDCacheOnline = $true
Mock Get-NetFirewallRule { return $null }
It "returns false from the test method" {
@@ -97,17 +122,13 @@ Describe "xSPDistributedCacheService" {
}
Context "Distributed cache is confgured but should not be running on this machine" {
+ $Global:xSharePointDCacheOnline = $true
$testParams.Ensure = "Absent"
Mock Get-AFCacheHostConfiguration { return @{
Size = $testParams.CacheSizeInMB
}}
Mock Get-CacheHost { return @{ PortNo = 22233 } }
Mock Get-NetFirewallRule { return @{} }
- Mock Get-SPServiceInstance { return @(New-Object Object |
- Add-Member NoteProperty Service "SPDistributedCacheService Name=AppFabricCachingService" -PassThru |
- Add-Member NoteProperty Server @{ Name = $env:COMPUTERNAME } -PassThru |
- Add-Member ScriptMethod Delete {} -PassThru
- )}
Mock Remove-SPDistributedCacheServiceInstance { }
It "returns false from the test method" {
diff --git a/Tests/xSharePoint/xSharePoint.xSPFarmAdministrators.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPFarmAdministrators.Tests.ps1
new file mode 100644
index 000000000..b69e3d64c
--- /dev/null
+++ b/Tests/xSharePoint/xSharePoint.xSPFarmAdministrators.Tests.ps1
@@ -0,0 +1,319 @@
+[CmdletBinding()]
+param(
+ [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve)
+)
+
+$ErrorActionPreference = 'stop'
+Set-StrictMode -Version latest
+
+$RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path
+$Global:CurrentSharePointStubModule = $SharePointCmdletModule
+
+$ModuleName = "MSFT_xSPFarmAdministrators"
+Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1")
+
+Describe "xSPFarmAdministrators" {
+ InModuleScope $ModuleName {
+ $testParams = @{
+ Name = "Farm Administrators"
+ Members = @("Demo\User1", "Demo\User2")
+ }
+ Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint")
+
+
+ Mock Invoke-xSharePointCommand {
+ return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope
+ }
+
+ Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue
+
+
+ Context "No central admin site exists" {
+ Mock Get-SPwebapplication { return $null }
+
+ It "should return null from the get method" {
+ Get-TargetResource @testParams | Should BeNullOrEmpty
+ }
+
+ It "should return false from the test method" {
+ Test-TargetResource @testParams | Should Be $false
+ }
+
+ It "should throw an exception in the set method" {
+ { Set-TargetResource @testParams } | Should throw "Unable to locate central administration website"
+ }
+ }
+
+ Context "Central admin exists and a fixed members list is used which matches" {
+ Mock Get-SPwebapplication { return @{
+ IsAdministrationWebApplication = $true
+ Url = "http://admin.shareopoint.contoso.local"
+ }}
+ Mock Get-SPWeb {
+ $web = @{
+ AssociatedOwnerGroup = "Farm Administrators"
+ SiteGroups = New-Object Object | Add-Member ScriptMethod GetByName {
+ return @{
+ Users = @(
+ @{ UserLogin = "Demo\User1" },
+ @{ UserLogin = "Demo\User2" }
+ )
+ }
+ } -PassThru
+ }
+ return $web
+ }
+
+ It "should return values from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "should return true from the test method" {
+ Test-TargetResource @testParams | Should Be $true
+ }
+ }
+
+ Context "Central admin exists and a fixed members list is used which does not match" {
+ Mock Get-SPwebapplication { return @{
+ IsAdministrationWebApplication = $true
+ Url = "http://admin.shareopoint.contoso.local"
+ }}
+ Mock Get-SPWeb {
+ return @{
+ AssociatedOwnerGroup = "Farm Administrators"
+ SiteGroups = New-Object Object | Add-Member ScriptMethod GetByName {
+ return New-Object Object | Add-Member ScriptProperty Users {
+ return @(
+ @{ UserLogin = "Demo\User1" }
+ )
+ } -PassThru | Add-Member ScriptMethod AddUser { } -PassThru `
+ | Add-Member ScriptMethod RemoveUser { } -PassThru
+ } -PassThru
+ }
+ }
+ Mock Get-SPUser { return @{} }
+
+ It "should return values from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "should return false from the test method" {
+ Test-TargetResource @testParams | Should Be $false
+ }
+
+ It "should update the members list" {
+ Set-TargetResource @testParams
+ }
+ }
+
+ Context "Central admin exists and a members to include is set where the members are in the group" {
+ $testParams = @{
+ Name = "Farm Administrators"
+ MembersToInclude = @("Demo\User2")
+ }
+ Mock Get-SPwebapplication { return @{
+ IsAdministrationWebApplication = $true
+ Url = "http://admin.shareopoint.contoso.local"
+ }}
+ Mock Get-SPWeb {
+ return @{
+ AssociatedOwnerGroup = "Farm Administrators"
+ SiteGroups = New-Object Object | Add-Member ScriptMethod GetByName {
+ return New-Object Object | Add-Member ScriptProperty Users {
+ return @(
+ @{ UserLogin = "Demo\User1" },
+ @{ UserLogin = "Demo\User2" }
+ )
+ } -PassThru | Add-Member ScriptMethod AddUser { } -PassThru `
+ | Add-Member ScriptMethod RemoveUser { } -PassThru
+ } -PassThru
+ }
+ }
+
+ It "should return values from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "should return true from the test method" {
+ Test-TargetResource @testParams | Should Be $true
+ }
+ }
+
+ Context "Central admin exists and a members to include is set where the members are not in the group" {
+ $testParams = @{
+ Name = "Farm Administrators"
+ MembersToInclude = @("Demo\User2")
+ }
+ Mock Get-SPwebapplication { return @{
+ IsAdministrationWebApplication = $true
+ Url = "http://admin.shareopoint.contoso.local"
+ }}
+ Mock Get-SPWeb {
+ return @{
+ AssociatedOwnerGroup = "Farm Administrators"
+ SiteGroups = New-Object Object | Add-Member ScriptMethod GetByName {
+ return New-Object Object | Add-Member ScriptProperty Users {
+ return @(
+ @{ UserLogin = "Demo\User1" }
+ )
+ } -PassThru | Add-Member ScriptMethod AddUser { } -PassThru `
+ | Add-Member ScriptMethod RemoveUser { } -PassThru
+ } -PassThru
+ }
+ }
+
+ It "should return values from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "should return true from the test method" {
+ Test-TargetResource @testParams | Should Be $false
+ }
+
+ It "should update the members list" {
+ Set-TargetResource @testParams
+ }
+ }
+
+ Context "Central admin exists and a members to exclude is set where the members are in the group" {
+ $testParams = @{
+ Name = "Farm Administrators"
+ MembersToExclude = @("Demo\User1")
+ }
+ Mock Get-SPwebapplication { return @{
+ IsAdministrationWebApplication = $true
+ Url = "http://admin.shareopoint.contoso.local"
+ }}
+ Mock Get-SPWeb {
+ return @{
+ AssociatedOwnerGroup = "Farm Administrators"
+ SiteGroups = New-Object Object | Add-Member ScriptMethod GetByName {
+ return New-Object Object | Add-Member ScriptProperty Users {
+ return @(
+ @{ UserLogin = "Demo\User1" },
+ @{ UserLogin = "Demo\User2" }
+ )
+ } -PassThru | Add-Member ScriptMethod AddUser { } -PassThru `
+ | Add-Member ScriptMethod RemoveUser { } -PassThru
+ } -PassThru
+ }
+ }
+
+ It "should return values from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "should return false from the test method" {
+ Test-TargetResource @testParams | Should Be $false
+ }
+
+ It "should update the members list" {
+ Set-TargetResource @testParams
+ }
+ }
+
+ Context "Central admin exists and a members to exclude is set where the members are not in the group" {
+ $testParams = @{
+ Name = "Farm Administrators"
+ MembersToExclude = @("Demo\User1")
+ }
+ Mock Get-SPwebapplication { return @{
+ IsAdministrationWebApplication = $true
+ Url = "http://admin.shareopoint.contoso.local"
+ }}
+ Mock Get-SPWeb {
+ return @{
+ AssociatedOwnerGroup = "Farm Administrators"
+ SiteGroups = New-Object Object | Add-Member ScriptMethod GetByName {
+ return New-Object Object | Add-Member ScriptProperty Users {
+ return @(
+ @{ UserLogin = "Demo\User2" }
+ )
+ } -PassThru | Add-Member ScriptMethod AddUser { } -PassThru `
+ | Add-Member ScriptMethod RemoveUser { } -PassThru
+ } -PassThru
+ }
+ }
+
+ It "should return values from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "should return true from the test method" {
+ Test-TargetResource @testParams | Should Be $true
+ }
+ }
+
+ Context "The resource is called with both an explicit members list as well as members to include/exclude" {
+ $testParams = @{
+ Name = "Farm Administrators"
+ Members = @("Demo\User1")
+ MembersToExclude = @("Demo\User1")
+ }
+ Mock Get-SPwebapplication { return @{
+ IsAdministrationWebApplication = $true
+ Url = "http://admin.shareopoint.contoso.local"
+ }}
+ Mock Get-SPWeb {
+ return @{
+ AssociatedOwnerGroup = "Farm Administrators"
+ SiteGroups = New-Object Object | Add-Member ScriptMethod GetByName {
+ return New-Object Object | Add-Member ScriptProperty Users {
+ return @(
+ @{ UserLogin = "Demo\User2" }
+ )
+ } -PassThru | Add-Member ScriptMethod AddUser { } -PassThru `
+ | Add-Member ScriptMethod RemoveUser { } -PassThru
+ } -PassThru
+ }
+ }
+
+ It "should throw in the get method" {
+ { Get-TargetResource @testParams } | Should throw
+ }
+
+ It "should throw in the test method" {
+ { Test-TargetResource @testParams } | Should throw
+ }
+
+ It "should throw in the set method" {
+ { Set-TargetResource @testParams } | Should throw
+ }
+ }
+
+ Context "The resource is called without either the specific members list or the include/exclude lists" {
+ $testParams = @{
+ Name = "Farm Administrators"
+ }
+ Mock Get-SPwebapplication { return @{
+ IsAdministrationWebApplication = $true
+ Url = "http://admin.shareopoint.contoso.local"
+ }}
+ Mock Get-SPWeb {
+ return @{
+ AssociatedOwnerGroup = "Farm Administrators"
+ SiteGroups = New-Object Object | Add-Member ScriptMethod GetByName {
+ return New-Object Object | Add-Member ScriptProperty Users {
+ return @(
+ @{ UserLogin = "Demo\User2" }
+ )
+ } -PassThru | Add-Member ScriptMethod AddUser { } -PassThru `
+ | Add-Member ScriptMethod RemoveUser { } -PassThru
+ } -PassThru
+ }
+ }
+
+ It "should throw in the get method" {
+ { Get-TargetResource @testParams } | Should throw
+ }
+
+ It "should throw in the test method" {
+ { Test-TargetResource @testParams } | Should throw
+ }
+
+ It "should throw in the set method" {
+ { Set-TargetResource @testParams } | Should throw
+ }
+ }
+ }
+}
diff --git a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1
index e66f9f35c..4c1aeb030 100644
--- a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1
+++ b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1
@@ -14,11 +14,7 @@ Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName
Describe "xSPInstallPrereqs" {
InModuleScope $ModuleName {
- $testParams = @{
- InstallerPath = "C:\SPInstall"
- OnlineMode = $true
- Ensure = "Present"
- }
+
Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint")
Mock Invoke-xSharePointCommand {
@@ -37,6 +33,12 @@ Describe "xSPInstallPrereqs" {
Mock Get-ChildItem { return $null }
Context "Prerequisites are not installed but should be and are to be installed in online mode" {
+ $testParams = @{
+ InstallerPath = "C:\SPInstall"
+ OnlineMode = $true
+ Ensure = "Present"
+ }
+
Mock Get-WindowsFeature { @( @{ Name = "ExampleFeature"; Installed = $false}) }
Mock Get-CimInstance { return @() }
Mock Get-ChildItem { return @() }
@@ -90,6 +92,12 @@ Describe "xSPInstallPrereqs" {
}
Context "Prerequisites are installed and should be" {
+ $testParams = @{
+ InstallerPath = "C:\SPInstall"
+ OnlineMode = $true
+ Ensure = "Present"
+ }
+
Mock Get-WindowsFeature { @( @{ Name = "ExampleFeature"; Installed = $true }) }
if ($majorBuildNumber -eq 15) {
Mock Get-CimInstance { return @(
@@ -109,8 +117,10 @@ Describe "xSPInstallPrereqs" {
@{ Name = "AppFabric 1.1 for Windows Server"}
@{ Name = "WCF Data Services 5.6.0 Runtime"}
@{ Name = "Microsoft ODBC Driver 11 for SQL Server"}
- @{ Name = "Microsoft Visual C++ 2013 x64 Minimum Runtime - 12.0.21005"}
- @{ Name = "Microsoft Visual C++ 2013 x64 Additional Runtime - 12.0.21005"}
+ @{ Name = "Microsoft Visual C++ 2012 x64 Minimum Runtime - 11.0.61030"}
+ @{ Name = "Microsoft Visual C++ 2012 x64 Additional Runtime - 11.0.61030"}
+ @{ Name = "Microsoft Visual C++ 2015 x64 Minimum Runtime - 14.0.23026"}
+ @{ Name = "Microsoft Visual C++ 2015 x64 Additional Runtime - 14.0.23026"}
@{ Name = "Microsoft SQL Server 2012 Native Client"}
@{ Name = "Active Directory Rights Management Services Client 2.1"}
)}
@@ -131,7 +141,11 @@ Describe "xSPInstallPrereqs" {
}
Context "Prerequisites are installed but should not be" {
- $testParams.Ensure = "Absent"
+ $testParams = @{
+ InstallerPath = "C:\SPInstall"
+ OnlineMode = $true
+ Ensure = "Absent"
+ }
It "throws an exception from the set method" {
{Test-TargetResource @testParams} | Should Throw
@@ -143,8 +157,12 @@ Describe "xSPInstallPrereqs" {
}
Context "Prerequisites are not installed but should be and are to be installed in offline mode" {
- $testParams.OnlineMode = $false
- $testParams.Ensure = "Present"
+ $testParams = @{
+ InstallerPath = "C:\SPInstall"
+ OnlineMode = $false
+ Ensure = "Present"
+ }
+
Mock Get-WindowsFeature { @( @{ Name = "ExampleFeature"; Installed = $false}) }
Mock Get-CimInstance { return @() }
Mock Get-ChildItem { return @() }
@@ -157,7 +175,7 @@ Describe "xSPInstallPrereqs" {
$requiredParams = @("SQLNCli","PowerShell","NETFX","IDFX","Sync","AppFabric","IDFX11","MSIPCClient","WCFDataServices","KB2671763","WCFDataServices56")
}
if ($majorBuildNumber -eq 16) {
- $requiredParams = @("SQLNCli","Sync","AppFabric","IDFX11","MSIPCClient","WCFDataServices","KB2671763","WCFDataServices56","KB2898850","MSVCRT12")
+ $requiredParams = @("SQLNCli","Sync","AppFabric","IDFX11","MSIPCClient","WCFDataServices","KB2671763","WCFDataServices56","KB2898850","MSVCRT12","ODBC","DotNet452")
}
$requiredParams | ForEach-Object {
$testParams.Add($_, "C:\fake\value.exe")
@@ -165,9 +183,43 @@ Describe "xSPInstallPrereqs" {
It "does not throw an exception where the required parameters are included" {
Mock Start-Process { return @{ ExitCode = 0 } }
+ Mock Test-Path { return $true }
{Set-TargetResource @testParams} | Should Not Throw
}
}
+
+ Context "Prerequisites are not installed but should be and are to be installed in offline mode, but invalid paths have been passed" {
+ $testParams = @{
+ InstallerPath = "C:\SPInstall"
+ OnlineMode = $false
+ Ensure = "Present"
+ }
+
+ Mock Get-WindowsFeature { @( @{ Name = "ExampleFeature"; Installed = $false }) }
+ Mock Get-CimInstance { return @() }
+ Mock Get-ChildItem { return @() }
+
+ It "throws an exception in the set method if required parameters are not set" {
+ {Set-TargetResource @testParams} | Should Throw
+ }
+
+ if ($majorBuildNumber -eq 15) {
+ $requiredParams = @("SQLNCli","PowerShell","NETFX","IDFX","Sync","AppFabric","IDFX11","MSIPCClient","WCFDataServices","KB2671763","WCFDataServices56")
+ }
+ if ($majorBuildNumber -eq 16) {
+ $requiredParams = @("SQLNCli","Sync","AppFabric","IDFX11","MSIPCClient","WCFDataServices","KB2671763","WCFDataServices56","KB2898850","MSVCRT12")
+ }
+ $requiredParams | ForEach-Object {
+ $testParams.Add($_, "C:\fake\value.exe")
+ }
+
+ It "does not throw an exception where the required parameters are included" {
+ Mock Start-Process { return @{ ExitCode = 0 } }
+ Mock Test-Path { return $false }
+
+ {Set-TargetResource @testParams} | Should Throw
+ }
+ }
}
}
\ No newline at end of file
diff --git a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1
index 91d3d969e..81e26a8bf 100644
--- a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1
+++ b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1
@@ -71,6 +71,26 @@ Describe "xSPJoinFarm" {
}
}
+ if ($majorBuildNumber -eq 15) {
+ $testParams.Add("ServerRole", "WebFrontEnd")
+
+ Context "only valid parameters for SharePoint 2013 are used" {
+ It "throws if server role is used in the get method" {
+ { Get-TargetResource @testParams } | Should Throw
+ }
+
+ It "throws if server role is used in the test method" {
+ { Test-TargetResource @testParams } | Should Throw
+ }
+
+ It "throws if server role is used in the set method" {
+ { Set-TargetResource @testParams } | Should Throw
+ }
+ }
+
+ $testParams.Remove("ServerRole")
+ }
+
Context "no farm is configured locally and an unsupported version of SharePoint is installed on the server" {
Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 14 } }
diff --git a/Tests/xSharePoint/xSharePoint.xSPOutgoingEmailSettings.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPOutgoingEmailSettings.Tests.ps1
new file mode 100644
index 000000000..375748c55
--- /dev/null
+++ b/Tests/xSharePoint/xSharePoint.xSPOutgoingEmailSettings.Tests.ps1
@@ -0,0 +1,100 @@
+[CmdletBinding()]
+param(
+ [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve)
+)
+
+$ErrorActionPreference = 'stop'
+Set-StrictMode -Version latest
+
+$RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path
+$Global:CurrentSharePointStubModule = $SharePointCmdletModule
+
+$ModuleName = "MSFT_xSPOutgoingEmailSettings"
+Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1")
+
+Describe "xSPOutgoingEmailSettings" {
+ InModuleScope $ModuleName {
+ $testParams = @{
+ WebAppUrl = "http://sharepoint.contoso.com"
+ SMTPServer = "smtp.contoso.com"
+ FromAddress = "from@email.com"
+ ReplyToAddress = "reply@email.com"
+ CharacterSet= "65001"
+ }
+ Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint")
+
+ Mock Invoke-xSharePointCommand {
+ return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope
+ }
+
+ Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue
+
+
+ Context "The Web Application isn't available" {
+ Mock Get-SPWebApplication -MockWith { return $null
+ }
+
+ It "returns null from the get method" {
+ Get-TargetResource @testParams | Should BeNullOrEmpty
+ }
+
+ It "returns false from the test method" {
+ Test-TargetResource @testParams | Should be $false
+ }
+
+ It "throws an exception in the set method" {
+ { Set-TargetResource @testParams } | Should throw
+ }
+ }
+
+
+ Context "The web application exists and the properties match" {
+ Mock Get-SPWebApplication {
+ return @{
+ Url= "http://sharepoint.contoso.com"
+ OutboundMailServiceInstance= "smtp.contoso.com"
+ OutboundMailSenderAddress = "from@email.com"
+ OutboundMailReplyToAddress= "reply@email.com"
+ OutboundMailCodePage= "65001"
+ }
+ }
+
+ It "returns web app properties from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "returns true from the test method" {
+ Test-TargetResource @testParams | Should Be $true
+ }
+ }
+
+
+ Context "The web application exists and the properties don't match" {
+ Mock Get-SPWebApplication {
+ $result = @{
+ Url= "http://sharepoint.contoso.com"
+ OutboundMailServiceInstance= "smtp2.contoso.com"
+ OutboundMailSenderAddress = "from@email.com"
+ OutboundMailReplyToAddress= "reply@email.com"
+ OutboundMailCodePage= "65001"
+ }
+ $result = $result | Add-Member ScriptMethod UpdateMailSettings {
+ param( [string]$SMTPServer, [string]$FromAddress, [string]$ReplyToAddress, [string]$CharacterSet )
+ $Global:UpdateMailSettingsCalled = $true;
+ return ; } -passThru
+ return $result
+ }
+
+ It "returns false from the test method" {
+ Test-TargetResource @testParams | Should Be $false
+ }
+
+ It "calls the new and set methods from the set function" {
+ $Global:UpdateMailSettingsCalled=$false;
+ Set-TargetResource @testParams
+ Assert-MockCalled Get-SPWebApplication
+ $Global:UpdateMailSettingsCalled | Should Be $true
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Tests/xSharePoint/xSharePoint.xSPPasswordChangeSettings.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPPasswordChangeSettings.Tests.ps1
new file mode 100644
index 000000000..510fed3c7
--- /dev/null
+++ b/Tests/xSharePoint/xSharePoint.xSPPasswordChangeSettings.Tests.ps1
@@ -0,0 +1,99 @@
+[CmdletBinding()]
+param(
+ [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve)
+)
+
+$ErrorActionPreference = 'stop'
+Set-StrictMode -Version latest
+
+$RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path
+$Global:CurrentSharePointStubModule = $SharePointCmdletModule
+
+$ModuleName = "MSFT_xSPPasswordChangeSettings"
+Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1")
+
+Describe "xSPPasswordChangeSettings" {
+ InModuleScope $ModuleName {
+ $testParams = @{
+ MailAddress = "e@mail.com"
+ DaysBeforeExpiry = 7
+ PasswordChangeWaitTimeSeconds = 60
+
+ }
+ Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint")
+
+ Mock Invoke-xSharePointCommand {
+ return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope
+ }
+
+ Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue
+
+ Context "No local SharePoint farm is available" {
+ Mock Get-SPFarm { return $null }
+
+ It "returns null from the get method" {
+ Get-TargetResource @testParams | Should Throw
+ }
+
+ It "returns false from the test method" {
+ Test-TargetResource @testParams | Should be $false
+ }
+ }
+
+
+ Context "There is a local SharePoint farm and the properties are set correctly" {
+ Mock Get-SPFarm {
+ return @{
+ PasswordChangeEmailAddress = "e@mail.com"
+ DaysBeforePasswordExpirationToSendEmail = 7
+ PasswordChangeGuardTime = 60
+ PasswordChangeMaximumTries = 3
+ }
+ }
+
+ It "returns farm properties from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "returns true from the test method" {
+ Test-TargetResource @testParams | Should Be $true
+ }
+ }
+
+
+ Context "There is a local SharePoint farm and the properties are not set correctly" {
+ Mock Get-SPFarm {
+ $result = @{
+ PasswordChangeEmailAddress = "";
+ PasswordChangeGuardTime = 0
+ PasswordChangeMaximumTries = 0
+ DaysBeforePasswordExpirationToSendEmail = 0
+ }
+ $result = $result | Add-Member ScriptMethod Update {
+ $Global:SPFarmUpdateCalled = $true;
+ return $true;
+
+ } -PassThru
+ return $result
+ }
+
+ It "returns farm properties from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "returns false from the test method" {
+ Test-TargetResource @testParams | Should Be $false
+ }
+
+ It "calls the new and set methods from the set function" {
+ $Global:SPFarmUpdateCalled = $false;
+ Set-TargetResource @testParams
+ Assert-MockCalled Get-SPFarm
+ $Global:SPFarmUpdateCalled | Should Be $true
+ }
+ }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1
index 4dd73048c..c3459ad80 100644
--- a/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1
+++ b/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1
@@ -151,5 +151,67 @@ Describe "xSPSecureStoreServiceApp" {
{ Set-TargetResource @testParams } | Should Throw
}
}
+
+ Context "When specific windows credentials are to be used for the database" {
+ $testParams = @{
+ Name = "Secure Store Service Application"
+ ApplicationPool = "SharePoint Search Services"
+ AuditingEnabled = $false
+ DatabaseName = "SP_ManagedMetadata"
+ DatabaseCredentials = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force))
+ DatabaseAuthenticationType = "Windows"
+ }
+
+ Mock Get-SPServiceApplication { return $null }
+ Mock New-SPSecureStoreServiceApplication { }
+ Mock New-SPSecureStoreServiceApplicationProxy { }
+
+ It "allows valid Windows credentials can be passed" {
+ Set-TargetResource @testParams
+ Assert-MockCalled New-SPSecureStoreServiceApplication
+ }
+
+ It "throws an exception if database authentication type is not specified" {
+ $testParams.Remove("DatabaseAuthenticationType")
+ { Set-TargetResource @testParams } | Should Throw
+ }
+
+ It "throws an exception if the credentials aren't provided and the authentication type is set" {
+ $testParams.Add("DatabaseAuthenticationType", "Windows")
+ $testParams.Remove("DatabaseCredentials")
+ { Set-TargetResource @testParams } | Should Throw
+ }
+ }
+
+ Context "When specific SQL credentials are to be used for the database" {
+ $testParams = @{
+ Name = "Secure Store Service Application"
+ ApplicationPool = "SharePoint Search Services"
+ AuditingEnabled = $false
+ DatabaseName = "SP_ManagedMetadata"
+ DatabaseCredentials = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force))
+ DatabaseAuthenticationType = "SQL"
+ }
+
+ Mock Get-SPServiceApplication { return $null }
+ Mock New-SPSecureStoreServiceApplication { }
+ Mock New-SPSecureStoreServiceApplicationProxy { }
+
+ It "allows valid SQL credentials can be passed" {
+ Set-TargetResource @testParams
+ Assert-MockCalled New-SPSecureStoreServiceApplication
+ }
+
+ It "throws an exception if database authentication type is not specified" {
+ $testParams.Remove("DatabaseAuthenticationType")
+ { Set-TargetResource @testParams } | Should Throw
+ }
+
+ It "throws an exception if the credentials aren't provided and the authentication type is set" {
+ $testParams.Add("DatabaseAuthenticationType", "Windows")
+ $testParams.Remove("DatabaseCredentials")
+ { Set-TargetResource @testParams } | Should Throw
+ }
+ }
}
}
\ No newline at end of file
diff --git a/Tests/xSharePoint/xSharePoint.xSPWebAppBlockedFileTypes.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPWebAppBlockedFileTypes.Tests.ps1
new file mode 100644
index 000000000..81d906782
--- /dev/null
+++ b/Tests/xSharePoint/xSharePoint.xSPWebAppBlockedFileTypes.Tests.ps1
@@ -0,0 +1,279 @@
+[CmdletBinding()]
+param(
+ [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve)
+)
+
+$ErrorActionPreference = 'stop'
+Set-StrictMode -Version latest
+
+$RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path
+$Global:CurrentSharePointStubModule = $SharePointCmdletModule
+
+$ModuleName = "MSFT_xSPWebAppBlockedFileTypes"
+Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1")
+
+Describe "xSPWebAppBlockedFileTypes" {
+ InModuleScope $ModuleName {
+ $testParams = @{
+ Url = "http://sites.sharepoint.com"
+ Blocked = @("exe", "dll", "ps1")
+ }
+
+ Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint")
+
+ Mock Invoke-xSharePointCommand {
+ return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope
+ }
+
+ Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue
+
+ Mock New-SPAuthenticationProvider { }
+ Mock New-SPWebApplication { }
+ Mock Get-SPAuthenticationProvider { return @{ DisableKerberos = $true; AllowAnonymous = $false } }
+
+ Context "The web appliation exists and a specific blocked file type list matches" {
+ Mock Get-SPWebApplication {
+ [Collections.Generic.List[String]]$CurrentBlockedFiles = @("exe", "ps1", "dll")
+ $webApp = @{
+ DisplayName = $testParams.Name
+ ApplicationPool = @{
+ Name = $testParams.ApplicationPool
+ Username = $testParams.ApplicationPoolAccount
+ }
+ ContentDatabases = @(
+ @{
+ Name = "SP_Content_01"
+ Server = "sql.domain.local"
+ }
+ )
+ IisSettings = @(
+ @{ Path = "C:\inetpub\wwwroot\something" }
+ )
+ Url = $testParams.Url
+ BlockedFileExtensions = $CurrentBlockedFiles
+ }
+ $webApp = $webApp | Add-Member ScriptMethod Update {
+ $Global:xSPWebApplicationUpdateCalled = $true
+ } -PassThru
+ return @($webApp)
+ }
+
+ It "returns the current data from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "returns true from the test method" {
+ Test-TargetResource @testParams | Should Be $true
+ }
+ }
+
+ Context "The web appliation exists and a specific blocked file type list does not match" {
+ Mock Get-SPWebApplication {
+ [Collections.Generic.List[String]]$CurrentBlockedFiles = @("exe", "pdf", "dll")
+ $webApp = @{
+ DisplayName = $testParams.Name
+ ApplicationPool = @{
+ Name = $testParams.ApplicationPool
+ Username = $testParams.ApplicationPoolAccount
+ }
+ ContentDatabases = @(
+ @{
+ Name = "SP_Content_01"
+ Server = "sql.domain.local"
+ }
+ )
+ IisSettings = @(
+ @{ Path = "C:\inetpub\wwwroot\something" }
+ )
+ Url = $testParams.Url
+ BlockedFileExtensions = $CurrentBlockedFiles
+ }
+ $webApp = $webApp | Add-Member ScriptMethod Update {
+ $Global:xSPWebApplicationUpdateCalled = $true
+ } -PassThru
+ return @($webApp)
+ }
+
+ It "returns the current data from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "returns false from the test method" {
+ Test-TargetResource @testParams | Should Be $false
+ }
+
+ $Global:xSPWebApplicationUpdateCalled = $false
+ It "updates the workflow settings" {
+ Set-TargetResource @testParams
+ $Global:xSPWebApplicationUpdateCalled | Should Be $true
+ }
+ }
+
+ $testParams = @{
+ Url = "http://sites.sharepoint.com"
+ EnsureBlocked = @("exe")
+ EnsureAllowed = @("pdf")
+ }
+
+ Context "The web appliation exists and a list of types to include and exclude both match" {
+ Mock Get-SPWebApplication {
+ [Collections.Generic.List[String]]$CurrentBlockedFiles = @("exe", "ps1", "dll")
+ $webApp = @{
+ DisplayName = $testParams.Name
+ ApplicationPool = @{
+ Name = $testParams.ApplicationPool
+ Username = $testParams.ApplicationPoolAccount
+ }
+ ContentDatabases = @(
+ @{
+ Name = "SP_Content_01"
+ Server = "sql.domain.local"
+ }
+ )
+ IisSettings = @(
+ @{ Path = "C:\inetpub\wwwroot\something" }
+ )
+ Url = $testParams.Url
+ BlockedFileExtensions = $CurrentBlockedFiles
+ }
+ $webApp = $webApp | Add-Member ScriptMethod Update {
+ $Global:xSPWebApplicationUpdateCalled = $true
+ } -PassThru
+ return @($webApp)
+ }
+
+ It "returns the current data from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "returns true from the test method" {
+ Test-TargetResource @testParams | Should Be $true
+ }
+ }
+
+ Context "The web appliation exists and a list of types to include and exclude both failed" {
+ Mock Get-SPWebApplication {
+ [Collections.Generic.List[String]]$CurrentBlockedFiles = @("pdf", "dll")
+ $webApp = @{
+ DisplayName = $testParams.Name
+ ApplicationPool = @{
+ Name = $testParams.ApplicationPool
+ Username = $testParams.ApplicationPoolAccount
+ }
+ ContentDatabases = @(
+ @{
+ Name = "SP_Content_01"
+ Server = "sql.domain.local"
+ }
+ )
+ IisSettings = @(
+ @{ Path = "C:\inetpub\wwwroot\something" }
+ )
+ Url = $testParams.Url
+ BlockedFileExtensions = $CurrentBlockedFiles
+ }
+ $webApp = $webApp | Add-Member ScriptMethod Update {
+ $Global:xSPWebApplicationUpdateCalled = $true
+ } -PassThru
+ return @($webApp)
+ }
+
+ It "returns the current data from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "returns false from the test method" {
+ Test-TargetResource @testParams | Should Be $false
+ }
+
+ $Global:xSPWebApplicationUpdateCalled = $false
+ It "updates the workflow settings" {
+ Set-TargetResource @testParams
+ $Global:xSPWebApplicationUpdateCalled | Should Be $true
+ }
+ }
+
+ Context "All blocked file type parameters are passed to the methods" {
+ Mock Get-SPWebApplication {
+ [Collections.Generic.List[String]]$CurrentBlockedFiles = @("pdf", "dll")
+ $webApp = @{
+ DisplayName = $testParams.Name
+ ApplicationPool = @{
+ Name = $testParams.ApplicationPool
+ Username = $testParams.ApplicationPoolAccount
+ }
+ ContentDatabases = @(
+ @{
+ Name = "SP_Content_01"
+ Server = "sql.domain.local"
+ }
+ )
+ IisSettings = @(
+ @{ Path = "C:\inetpub\wwwroot\something" }
+ )
+ Url = $testParams.Url
+ BlockedFileExtensions = $CurrentBlockedFiles
+ }
+ $webApp = $webApp | Add-Member ScriptMethod Update {
+ $Global:xSPWebApplicationUpdateCalled = $true
+ } -PassThru
+ return @($webApp)
+ }
+
+ $testParams = @{
+ Url = "http://sites.sharepoint.com"
+ Blocked = @("exe", "dll", "ps1")
+ EnsureBlocked = @("exe", "dll")
+ EnsureAllowed = @("ps1")
+ }
+
+ It "throws an exception on the test method" {
+ { Test-TargetResource @testParams } | Should throw
+ }
+
+ It "throws an exception on the set method" {
+ { Set-TargetResource @testParams } | Should throw
+ }
+ }
+
+ Context "No blocked file type parameters are passed to the methods" {
+ Mock Get-SPWebApplication {
+ [Collections.Generic.List[String]]$CurrentBlockedFiles = @("pdf", "dll")
+ $webApp = @{
+ DisplayName = $testParams.Name
+ ApplicationPool = @{
+ Name = $testParams.ApplicationPool
+ Username = $testParams.ApplicationPoolAccount
+ }
+ ContentDatabases = @(
+ @{
+ Name = "SP_Content_01"
+ Server = "sql.domain.local"
+ }
+ )
+ IisSettings = @(
+ @{ Path = "C:\inetpub\wwwroot\something" }
+ )
+ Url = $testParams.Url
+ BlockedFileExtensions = $CurrentBlockedFiles
+ }
+ $webApp = $webApp | Add-Member ScriptMethod Update {
+ $Global:xSPWebApplicationUpdateCalled = $true
+ } -PassThru
+ return @($webApp)
+ }
+
+ $testParams = @{
+ Url = "http://sites.sharepoint.com"
+ }
+
+ It "throws an exception on the test method" {
+ { Test-TargetResource @testParams } | Should throw
+ }
+
+ It "throws an exception on the set method" {
+ { Set-TargetResource @testParams } | Should throw
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Tests/xSharePoint/xSharePoint.xSPWebAppGeneralSettings.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPWebAppGeneralSettings.Tests.ps1
new file mode 100644
index 000000000..154fc4bc2
--- /dev/null
+++ b/Tests/xSharePoint/xSharePoint.xSPWebAppGeneralSettings.Tests.ps1
@@ -0,0 +1,157 @@
+[CmdletBinding()]
+param(
+ [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve)
+)
+
+$ErrorActionPreference = 'stop'
+Set-StrictMode -Version latest
+
+$RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path
+$Global:CurrentSharePointStubModule = $SharePointCmdletModule
+
+$ModuleName = "MSFT_xSPWebAppGeneralSettings"
+Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1")
+
+
+Describe "xSPWebAppGeneralSettings" {
+ InModuleScope $ModuleName {
+ $testParams = @{
+ Url = "http://sites.sharepoint.com"
+ TimeZone = 3081
+ Alerts = $true
+ AlertsLimit = 10
+ RSS = $true
+ BlogAPI = $true
+ BlogAPIAuthenticated = $true
+ BrowserFileHandling = "Permissive"
+ SecurityValidation = $true
+ RecycleBinEnabled = $true
+ RecycleBinCleanupEnabled = $true
+ RecycleBinRetentionPeriod = 30
+ SecondStageRecycleBinQuota = 30
+ MaximumUploadSize = 100
+ CustomerExperienceProgram = $true
+ PresenceEnabled = $true
+ }
+
+ Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint")
+
+ Mock Invoke-xSharePointCommand {
+ return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope
+ }
+
+ Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue
+
+ Mock New-SPAuthenticationProvider { }
+ Mock New-SPWebApplication { }
+ Mock Get-SPAuthenticationProvider { return @{ DisableKerberos = $true; AllowAnonymous = $false } }
+
+ Context "The web appliation exists and has the correct general settings" {
+ Mock Get-SPWebApplication {
+ $webApp = @{
+ DisplayName = $testParams.Name
+ ApplicationPool = @{
+ Name = $testParams.ApplicationPool
+ Username = $testParams.ApplicationPoolAccount
+ }
+ ContentDatabases = @(
+ @{
+ Name = "SP_Content_01"
+ Server = "sql.domain.local"
+ }
+ )
+ IisSettings = @(
+ @{ Path = "C:\inetpub\wwwroot\something" }
+ )
+ Url = $testParams.Url
+ DefaultTimeZone = $testParams.TimeZone
+ AlertsEnabled = $testParams.Alerts
+ AlertsMaximum = $testParams.AlertsLimit
+ SyndicationEnabled = $testParams.RSS
+ MetaWeblogEnabled = $testParams.BlogAPI
+ MetaWeblogAuthenticationEnabled = $testParams.BlogAPIAuthenticated
+ BrowserFileHandling = $testParams.BrowserFileHandling
+ FormDigestSettings = @{
+ Enabled = $testParams.SecurityValidation
+ }
+ RecycleBinEnabled = $testParams.RecycleBinEnabled
+ RecycleBinCleanupEnabled = $testParams.RecycleBinCleanupEnabled
+ RecycleBinRetentionPeriod = $testParams.RecycleBinRetentionPeriod
+ SecondStageRecycleBinQuota = $testParams.SecondStageRecycleBinQuota
+ MaximumFileSize = $testParams.MaximumUploadSize
+ BrowserCEIPEnabled = $testParams.CustomerExperienceProgram
+ PresenceEnabled = $testParams.PresenceEnabled
+ }
+ $webApp = $webApp | Add-Member ScriptMethod Update {
+ $Global:xSPWebApplicationUpdateCalled = $true
+ } -PassThru
+ return @($webApp)
+ }
+
+ It "returns the current data from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "returns true from the test method" {
+ Test-TargetResource @testParams | Should Be $true
+ }
+ }
+
+ Context "The web appliation exists and uses incorrect general settings" {
+ Mock Get-SPWebApplication {
+ $webApp = @{
+ DisplayName = $testParams.Name
+ ApplicationPool = @{
+ Name = $testParams.ApplicationPool
+ Username = $testParams.ApplicationPoolAccount
+ }
+ ContentDatabases = @(
+ @{
+ Name = "SP_Content_01"
+ Server = "sql.domain.local"
+ }
+ )
+ IisSettings = @(
+ @{ Path = "C:\inetpub\wwwroot\something" }
+ )
+ Url = $testParams.Url
+ DefaultTimeZone = 1
+ AlertsEnabled = $false
+ AlertsMaximum = 1
+ SyndicationEnabled = $false
+ MetaWeblogEnabled = $false
+ MetaWeblogAuthenticationEnabled = $false
+ BrowserFileHandling = "Strict"
+ FormDigestSettings = @{
+ Enabled = $false
+ }
+ RecycleBinEnabled = $false
+ RecycleBinCleanupEnabled = $false
+ RecycleBinRetentionPeriod = 1
+ SecondStageRecycleBinQuota = 1
+ MaximumFileSize = 1
+ BrowserCEIPEnabled = $false
+ PresenceEnabled = $false
+ }
+ $webApp = $webApp | Add-Member ScriptMethod Update {
+ $Global:xSPWebApplicationUpdateCalled = $true
+ } -PassThru
+ return @($webApp)
+ }
+
+ It "returns the current data from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "returns false from the test method" {
+ Test-TargetResource @testParams | Should Be $false
+ }
+
+ $Global:xSPWebApplicationUpdateCalled = $false
+ It "updates the general settings" {
+ Set-TargetResource @testParams
+ $Global:xSPWebApplicationUpdateCalled | Should Be $true
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Tests/xSharePoint/xSharePoint.xSPWebAppThrottlingSettings.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPWebAppThrottlingSettings.Tests.ps1
new file mode 100644
index 000000000..22dff8dfd
--- /dev/null
+++ b/Tests/xSharePoint/xSharePoint.xSPWebAppThrottlingSettings.Tests.ps1
@@ -0,0 +1,232 @@
+[CmdletBinding()]
+param(
+ [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve)
+)
+
+$ErrorActionPreference = 'stop'
+Set-StrictMode -Version latest
+
+$RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path
+$Global:CurrentSharePointStubModule = $SharePointCmdletModule
+
+$ModuleName = "MSFT_xSPWebAppThrottlingSettings"
+Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1")
+
+Describe "xSPWebAppThrottlingSettings" {
+ InModuleScope $ModuleName {
+ $testParams = @{
+ Url = "http://sites.sharepoint.com"
+ ListViewThreshold = 1000
+ AllowObjectModelOverride = $true
+ AdminThreshold = 2000
+ ListViewLookupThreshold = 12
+ HappyHourEnabled = $true
+ HappyHour = (New-CimInstance -ClassName MSFT_xSPWebApplicationHappyHour -Property @{
+ Hour = 2
+ Minute = 0
+ Duration = 1
+ } -ClientOnly)
+ UniquePermissionThreshold = 100
+ RequestThrottling = $true
+ ChangeLogEnabled = $true
+ ChangeLogExpiryDays = 30
+ EventHandlersEnabled = $true
+ }
+
+ Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint")
+
+ Mock Invoke-xSharePointCommand {
+ return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope
+ }
+
+ Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue
+
+ Mock New-SPAuthenticationProvider { }
+ Mock New-SPWebApplication { }
+ Mock Get-SPAuthenticationProvider { return @{ DisableKerberos = $true; AllowAnonymous = $false } }
+
+ Context "The web appliation exists and has the correct throttling settings" {
+ Mock Get-SPWebApplication { return @(@{
+ DisplayName = $testParams.Name
+ ApplicationPool = @{
+ Name = $testParams.ApplicationPool
+ Username = $testParams.ApplicationPoolAccount
+ }
+ ContentDatabases = @(
+ @{
+ Name = "SP_Content_01"
+ Server = "sql.domain.local"
+ }
+ )
+ IisSettings = @(
+ @{ Path = "C:\inetpub\wwwroot\something" }
+ )
+ Url = $testParams.Url
+ MaxItemsPerThrottledOperation = $testParams.ListViewThreshold
+ AllowOMCodeOverrideThrottleSettings = $testParams.AllowObjectModelOverride
+ MaxItemsPerThrottledOperationOverride = $testParams.AdminThreshold
+ MaxQueryLookupFields = $testParams.ListViewLookupThreshold
+ UnthrottledPrivilegedOperationWindowEnabled = $testParams.HappyHourEnabled
+ DailyStartUnthrottledPrivilegedOperationsHour = $testParams.HappyHour.Hour
+ DailyStartUnthrottledPrivilegedOperationsMinute = $testParams.HappyHour.Minute
+ DailyUnthrottledPrivilegedOperationsDuration = $testParams.HappyHour.Duration
+ MaxUniquePermScopesPerList = $testParams.UniquePermissionThreshold
+ HttpThrottleSettings = @{
+ PerformThrottle = $testParams.RequestThrottling
+ }
+ ChangeLogExpirationEnabled = $testParams.ChangeLogEnabled
+ ChangeLogRetentionPeriod = @{
+ Days = $testParams.ChangeLogExpiryDays
+ }
+ EventHandlersEnabled = $testParams.EventHandlersEnabled
+ })}
+
+ It "returns the current data from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "returns true from the test method" {
+ Test-TargetResource @testParams | Should Be $true
+ }
+ }
+
+ Context "The web appliation exists and uses incorrect throttling settings" {
+ Mock Get-SPWebApplication {
+ $webApp = @{
+ DisplayName = $testParams.Name
+ ApplicationPool = @{
+ Name = $testParams.ApplicationPool
+ Username = $testParams.ApplicationPoolAccount
+ }
+ ContentDatabases = @(
+ @{
+ Name = "SP_Content_01"
+ Server = "sql.domain.local"
+ }
+ )
+ IisSettings = @(
+ @{ Path = "C:\inetpub\wwwroot\something" }
+ )
+ Url = $testParams.Url
+ MaxItemsPerThrottledOperation = 1
+ AllowOMCodeOverrideThrottleSettings = $testParams.AllowObjectModelOverride
+ MaxItemsPerThrottledOperationOverride = $testParams.AdminThreshold
+ MaxQueryLookupFields = $testParams.ListViewLookupThreshold
+ UnthrottledPrivilegedOperationWindowEnabled = $testParams.HappyHourEnabled
+ DailyStartUnthrottledPrivilegedOperationsHour = $testParams.HappyHour.Hour
+ DailyStartUnthrottledPrivilegedOperationsMinute = $testParams.HappyHour.Minute
+ DailyUnthrottledPrivilegedOperationsDuration = $testParams.HappyHour.Duration
+ MaxUniquePermScopesPerList = $testParams.UniquePermissionThreshold
+ HttpThrottleSettings = @{
+ PerformThrottle = $testParams.RequestThrottling
+ }
+ ChangeLogExpirationEnabled = $testParams.ChangeLogEnabled
+ ChangeLogRetentionPeriod = @{
+ Days = $testParams.ChangeLogExpiryDays
+ }
+ EventHandlersEnabled = $testParams.EventHandlersEnabled
+ }
+ $webApp = $webApp | Add-Member ScriptMethod Update {
+ $Global:xSPWebApplicationUpdateCalled = $true
+ } -PassThru | Add-Member ScriptMethod SetDailyUnthrottledPrivilegedOperationWindow {
+ $Global:xSPWebApplicationUpdateHappyHourCalled = $true
+ } -PassThru
+ return @($webApp)
+ }
+
+ It "returns the current data from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "returns false from the test method" {
+ Test-TargetResource @testParams | Should Be $false
+ }
+
+ $Global:xSPWebApplicationUpdateCalled = $false
+ $Global:xSPWebApplicationUpdateHappyHourCalled = $false
+ It "updates the throttling settings" {
+ Set-TargetResource @testParams
+ $Global:xSPWebApplicationUpdateCalled | Should Be $true
+ }
+
+ $testParams = @{
+ Url = "http://sites.sharepoint.com"
+ ListViewThreshold = 1000
+ AllowObjectModelOverride = $true
+ AdminThreshold = 2000
+ ListViewLookupThreshold = 12
+ HappyHourEnabled = $true
+ HappyHour = (New-CimInstance -ClassName MSFT_xSPWebApplicationHappyHour -Property @{
+ Hour = 5
+ Minute = 0
+ Duration = 1
+ } -ClientOnly)
+ UniquePermissionThreshold = 100
+ RequestThrottling = $true
+ ChangeLogEnabled = $true
+ ChangeLogExpiryDays = 30
+ EventHandlersEnabled = $true
+ }
+ $Global:xSPWebApplicationUpdateCalled = $false
+ $Global:xSPWebApplicationUpdateHappyHourCalled = $false
+ It "updates the incorrect happy hour settings" {
+ Set-TargetResource @testParams
+ $Global:xSPWebApplicationUpdateCalled | Should Be $true
+ $Global:xSPWebApplicationUpdateHappyHourCalled | Should Be $true
+ }
+
+ it "throws exceptions where invalid happy hour settings are provided" {
+ $testParams = @{
+ Name = "SharePoint Sites"
+ ApplicationPool = "SharePoint Web Apps"
+ ApplicationPoolAccount = "DEMO\ServiceAccount"
+ Url = "http://sites.sharepoint.com"
+ AuthenticationMethod = "NTLM"
+ ThrottlingSettings = (New-CimInstance -ClassName MSFT_xSPWebApplicationThrottling -Property @{
+ HappyHourEnabled = $true
+ HappyHour = (New-CimInstance -ClassName MSFT_xSPWebApplicationHappyHour -Property @{
+ Hour = 100
+ Minute = 0
+ Duration = 1
+ } -ClientOnly)
+ } -ClientOnly)
+ }
+ { Set-TargetResource @testParams } | Should throw
+
+ $testParams = @{
+ Name = "SharePoint Sites"
+ ApplicationPool = "SharePoint Web Apps"
+ ApplicationPoolAccount = "DEMO\ServiceAccount"
+ Url = "http://sites.sharepoint.com"
+ AuthenticationMethod = "NTLM"
+ ThrottlingSettings = (New-CimInstance -ClassName MSFT_xSPWebApplicationThrottling -Property @{
+ HappyHourEnabled = $true
+ HappyHour = (New-CimInstance -ClassName MSFT_xSPWebApplicationHappyHour -Property @{
+ Hour = 5
+ Minute = 100
+ Duration = 1
+ } -ClientOnly)
+ } -ClientOnly)
+ }
+ { Set-TargetResource @testParams } | Should throw
+
+ $testParams = @{
+ Name = "SharePoint Sites"
+ ApplicationPool = "SharePoint Web Apps"
+ ApplicationPoolAccount = "DEMO\ServiceAccount"
+ Url = "http://sites.sharepoint.com"
+ AuthenticationMethod = "NTLM"
+ ThrottlingSettings = (New-CimInstance -ClassName MSFT_xSPWebApplicationThrottling -Property @{
+ HappyHourEnabled = $true
+ HappyHour = (New-CimInstance -ClassName MSFT_xSPWebApplicationHappyHour -Property @{
+ Hour = 5
+ Minute = 0
+ Duration = 100
+ } -ClientOnly)
+ } -ClientOnly)
+ }
+ { Set-TargetResource @testParams } | Should throw
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Tests/xSharePoint/xSharePoint.xSPWebAppWorkflowSettings.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPWebAppWorkflowSettings.Tests.ps1
new file mode 100644
index 000000000..78695e312
--- /dev/null
+++ b/Tests/xSharePoint/xSharePoint.xSPWebAppWorkflowSettings.Tests.ps1
@@ -0,0 +1,113 @@
+[CmdletBinding()]
+param(
+ [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve)
+)
+
+$ErrorActionPreference = 'stop'
+Set-StrictMode -Version latest
+
+$RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path
+$Global:CurrentSharePointStubModule = $SharePointCmdletModule
+
+$ModuleName = "MSFT_xSPWebAppWorkflowSettings"
+Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1")
+
+Describe "xSPWebAppWorkflowSettings" {
+ InModuleScope $ModuleName {
+ $testParams = @{
+ Url = "http://sites.sharepoint.com"
+ ExternalWorkflowParticipantsEnabled = $true
+ UserDefinedWorkflowsEnabled = $true
+ EmailToNoPermissionWorkflowParticipantsEnable = $true
+ }
+
+ Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint")
+
+ Mock Invoke-xSharePointCommand {
+ return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope
+ }
+
+ Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue
+
+ Mock New-SPAuthenticationProvider { }
+ Mock New-SPWebApplication { }
+ Mock Get-SPAuthenticationProvider { return @{ DisableKerberos = $true; AllowAnonymous = $false } }
+
+ Context "The web appliation exists and has the correct workflow settings" {
+ Mock Get-SPWebApplication { return @(@{
+ DisplayName = $testParams.Name
+ ApplicationPool = @{
+ Name = $testParams.ApplicationPool
+ Username = $testParams.ApplicationPoolAccount
+ }
+ ContentDatabases = @(
+ @{
+ Name = "SP_Content_01"
+ Server = "sql.domain.local"
+ }
+ )
+ IisSettings = @(
+ @{ Path = "C:\inetpub\wwwroot\something" }
+ )
+ Url = $testParams.Url
+ UserDefinedWorkflowsEnabled = $true
+ EmailToNoPermissionWorkflowParticipantsEnabled = $true
+ ExternalWorkflowParticipantsEnabled = $true
+ })}
+
+ It "returns the current data from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "returns true from the test method" {
+ Test-TargetResource @testParams | Should Be $true
+ }
+ }
+
+ Context "The web appliation exists and uses incorrect workflow settings" {
+ Mock Get-SPWebApplication {
+ $webApp = @{
+ DisplayName = $testParams.Name
+ ApplicationPool = @{
+ Name = $testParams.ApplicationPool
+ Username = $testParams.ApplicationPoolAccount
+ }
+ ContentDatabases = @(
+ @{
+ Name = "SP_Content_01"
+ Server = "sql.domain.local"
+ }
+ )
+ IisSettings = @(
+ @{ Path = "C:\inetpub\wwwroot\something" }
+ )
+ Url = $testParams.Url
+ UserDefinedWorkflowsEnabled = $false
+ EmailToNoPermissionWorkflowParticipantsEnabled = $false
+ ExternalWorkflowParticipantsEnabled = $false
+ }
+ $webApp = $webApp | Add-Member ScriptMethod Update {
+ $Global:xSPWebApplicationUpdateCalled = $true
+ } -PassThru | Add-Member ScriptMethod UpdateWorkflowConfigurationSettings {
+ $Global:xSPWebApplicationUpdateWorkflowCalled = $true
+ } -PassThru
+ return @($webApp)
+ }
+
+ It "returns the current data from the get method" {
+ Get-TargetResource @testParams | Should Not BeNullOrEmpty
+ }
+
+ It "returns false from the test method" {
+ Test-TargetResource @testParams | Should Be $false
+ }
+
+ $Global:xSPWebApplicationUpdateCalled = $false
+ $Global:xSPWebApplicationUpdateWorkflowCalled = $false
+ It "updates the workflow settings" {
+ Set-TargetResource @testParams
+ $Global:xSPWebApplicationUpdateWorkflowCalled | Should Be $true
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1
index 9bcb0d0bf..40752361f 100644
--- a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1
+++ b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1
@@ -11,16 +11,18 @@ $Global:CurrentSharePointStubModule = $SharePointCmdletModule
$ModuleName = "MSFT_xSPWebApplication"
Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1")
+Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\Modules\xSharePoint.Util\xSharePoint.Util.psm1")
Describe "xSPWebApplication" {
InModuleScope $ModuleName {
$testParams = @{
- Name = "Managed Metadata Service App"
+ Name = "SharePoint Sites"
ApplicationPool = "SharePoint Web Apps"
ApplicationPoolAccount = "DEMO\ServiceAccount"
Url = "http://sites.sharepoint.com"
AuthenticationMethod = "NTLM"
}
+
Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint")
Mock Invoke-xSharePointCommand {
@@ -151,4 +153,4 @@ Describe "xSPWebApplication" {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1
index b95d44197..702e12bda 100644
--- a/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1
+++ b/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1
@@ -22,8 +22,6 @@ Describe "xSPUsageApplication" {
UsageLogMaxSpaceGB = 10
DatabaseName = "SP_Usage"
DatabaseServer = "sql.test.domain"
- DatabaseUsername = "user"
- DatabasePassword = "password"
FailoverDatabaseServer = "anothersql.test.domain"
}
Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint")
@@ -60,6 +58,12 @@ Describe "xSPUsageApplication" {
Set-TargetResource @testParams
Assert-MockCalled New-SPUsageApplication
}
+
+ It "creates a new service application with custom database credentials" {
+ $testParams.Add("DatabaseCredentials", (New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force))))
+ Set-TargetResource @testParams
+ Assert-MockCalled New-SPUsageApplication
+ }
}
Context "When service applications exist in the current farm but not the specific usage service app" {
diff --git a/appveyor.yml b/appveyor.yml
index f37a60a92..d8879089c 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,4 +1,4 @@
-version: 0.7.{build}.0
+version: 0.8.{build}.0
install:
- cinst -y pester
@@ -22,9 +22,12 @@ test_script:
after_test:
- ps: |
+ New-Item "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint\en-US" -ItemType Directory
+ & "$env:APPVEYOR_BUILD_FOLDER\Tests\Generate-xSharePointHelpFiles.ps1" -OutputPath "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint\en-US"
+
Remove-Item (Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.pssproj")
$manifest = Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.psd1"
- (Get-Content $manifest -Raw).Replace("0.7.0.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest
+ (Get-Content $manifest -Raw).Replace("0.8.0.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest
Add-Type -assemblyname System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory("$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint", "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip")
Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }