From abfde41079d8188dd3d30f5203a43cba6e609df3 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 2 Oct 2015 23:35:09 +1000 Subject: [PATCH 1/5] Added full MinRole support, error trapping for conflicts in primary invoker --- .../MSFT_xSPCreateFarm.psm1 | 30 ++++++++++++++--- .../MSFT_xSPCreateFarm.schema.mof | 1 + .../xSharePoint.Util/xSharePoint.Util.psm1 | 23 +++++++++++-- Tests/xSharePoint/xSharePoint.Util.Tests.ps1 | 24 ++++++++++++++ .../xSharePoint.xSPCreateFarm.Tests.ps1 | 33 +++++++++++++++++-- 5 files changed, 102 insertions(+), 9 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 index 61983d91b..af9b56d41 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 @@ -10,11 +10,16 @@ function Get-TargetResource [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, [parameter(Mandatory = $true)] [System.String] $Passphrase, [parameter(Mandatory = $true)] [System.String] $AdminContentDatabaseName, - [parameter(Mandatory = $false)] [System.UInt32] $CentralAdministrationPort + [parameter(Mandatory = $false)] [System.UInt32] $CentralAdministrationPort, + [parameter(Mandatory = $false)] [ValidateSet("Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd")] $ServerRole ) Write-Verbose -Message "Checking for local SP Farm" + if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { + throw [Exception] "Server role is only supported in SharePoint 2016." + } + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] @@ -60,9 +65,14 @@ function Set-TargetResource [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, [parameter(Mandatory = $true)] [System.String] $Passphrase, [parameter(Mandatory = $true)] [System.String] $AdminContentDatabaseName, - [parameter(Mandatory = $false)] [System.UInt32] $CentralAdministrationPort + [parameter(Mandatory = $false)] [System.UInt32] $CentralAdministrationPort, + [parameter(Mandatory = $false)] [ValidateSet("Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd")] $ServerRole ) + if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { + throw [Exception] "Server role is only supported in SharePoint 2016." + } + if (-not $PSBoundParameters.ContainsKey("CentralAdministrationPort")) { $PSBoundParameters.Add("CentralAdministrationPort", 9999) } $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { @@ -82,8 +92,13 @@ function Set-TargetResource Write-Verbose -Message "Detected Version: SharePoint 2013" } 16 { - Write-Verbose -Message "Detected Version: SharePoint 2016" - $newFarmArgs.Add("LocalServerRole", "Custom") + if ($params.ContainsKey("ServerRole") -eq $true) { + Write-Verbose -Message "Detected Version: SharePoint 2016 - configuring server as $($params.ServerRole)" + $newFarmArgs.Add("LocalServerRole", $params.ServerRole) + } else { + Write-Verbose -Message "Detected Version: SharePoint 2016 - no server role provided, configuring server without a specific role" + $newFarmArgs.Add("ServerRoleOptional", $true) + } } Default { throw [Exception] "An unknown version of SharePoint (Major version $_) was detected. Only versions 15 (SharePoint 2013) or 16 (SharePoint 2016) are supported." @@ -112,9 +127,14 @@ function Test-TargetResource [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, [parameter(Mandatory = $true)] [System.String] $Passphrase, [parameter(Mandatory = $true)] [System.String] $AdminContentDatabaseName, - [parameter(Mandatory = $false)] [System.UInt32] $CentralAdministrationPort + [parameter(Mandatory = $false)] [System.UInt32] $CentralAdministrationPort, + [parameter(Mandatory = $false)] [ValidateSet("Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd")] $ServerRole ) + if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { + throw [Exception] "Server role is only supported in SharePoint 2016." + } + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose "Checking for local farm presence" if ($null -eq $CurrentValues) { return $false } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof index 7d3767e44..3c51d885e 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof @@ -9,4 +9,5 @@ class MSFT_xSPCreateFarm : OMI_BaseResource [Required] String Passphrase; [Required] String AdminContentDatabaseName; [Write] uint32 CentralAdministrationPort; + [Write, ValueMap{"Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd"}, Values{"Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd"}] string ServerRole; }; diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 7b5b5c388..fa7b44dc9 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -58,7 +58,17 @@ function Invoke-xSharePointCommand() { } Write-Verbose "Executing as the local run as user $($Env:USERDOMAIN)\$($Env:USERNAME)" - $result = Invoke-Command @invokeArgs -Verbose + try { + $result = Invoke-Command @invokeArgs -Verbose + } catch { + if ($_.Exception.Message.Contains("An update conflict has occurred, and you must re-try this action")) { + Write-Verbose "Detected an update conflict, restarting server to allow DSC to resume and retry" + $global:DSCMachineStatus = 1 + } else { + throw $_ + } + } + return $result } else { if ($Credential.UserName.Split("\")[1] -eq $Env:USERNAME) { @@ -76,7 +86,16 @@ function Invoke-xSharePointCommand() { if ($session) { $invokeArgs.Add("Session", $session) } - $result = Invoke-Command @invokeArgs -Verbose + try { + $result = Invoke-Command @invokeArgs -Verbose + } catch { + if ($_.Exception.Message.Contains("An update conflict has occurred, and you must re-try this action")) { + Write-Verbose "Detected an update conflict, restarting server to allow DSC to resume and retry" + $global:DSCMachineStatus = 1 + } else { + throw $_ + } + } if ($session) { Remove-PSSession $session } return $result diff --git a/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 b/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 index 0dcfc8c62..93b0e3329 100644 --- a/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 @@ -39,6 +39,30 @@ Describe "xSharePoint.Util" { It "throws an exception when the run as user is the same as the InstallAccount user" { { Invoke-xSharePointCommand -ScriptBlock { return "value" } -Credential (New-Object System.Management.Automation.PSCredential ("$($Env:USERDOMAIN)\$($Env:USERNAME)", (ConvertTo-SecureString "password" -AsPlainText -Force)))} | Should Throw } + + It "throws normal exceptions when triggered in the script block" { + Mock Invoke-Command { throw [Exception] "A random exception" } -ModuleName "xSharePoint.Util" + + { Invoke-xSharePointCommand -ScriptBlock { return "value" } } | Should Throw + } + + It "throws normal exceptions when triggered in the script block using InstallAccount" { + Mock Invoke-Command { throw [Exception] "A random exception" } -ModuleName "xSharePoint.Util" + + { Invoke-xSharePointCommand -ScriptBlock { return "value" } -Credential (New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)))} | Should Throw + } + + It "handles a SharePoint update conflict exception by rebooting the server to retry" { + Mock Invoke-Command { throw [Exception] "An update conflict has occurred, and you must re-try this action." } -ModuleName "xSharePoint.Util" + + { Invoke-xSharePointCommand -ScriptBlock { return "value" } } | Should Not Throw + } + + It "handles a SharePoint update conflict exception by rebooting the server to retry using InstallAccount" { + Mock Invoke-Command { throw [Exception] "An update conflict has occurred, and you must re-try this action." } -ModuleName "xSharePoint.Util" + + { Invoke-xSharePointCommand -ScriptBlock { return "value" } -Credential (New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)))} | Should Not Throw + } } Context "Validate Test-xSharePointSpecificParameters" { diff --git a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 index a897949bc..327757c9a 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 @@ -52,7 +52,7 @@ Describe "xSPCreateFarm" { Test-TargetResource @testParams | Should Be $false } - It "calls the appropriate cmdlets in the set method" { + It "calls the new configuration database cmdlet in the set method" { Set-TargetResource @testParams switch ($majorBuildNumber) { @@ -60,7 +60,7 @@ Describe "xSPCreateFarm" { Assert-MockCalled New-SPConfigurationDatabase } 16 { - Assert-MockCalled New-SPConfigurationDatabase -ParameterFilter { $LocalServerRole -ne $null } + Assert-MockCalled New-SPConfigurationDatabase -ParameterFilter { $ServerRoleOptional -eq $true } } Default { throw [Exception] "A supported version of SharePoint was not used in testing" @@ -68,6 +68,35 @@ Describe "xSPCreateFarm" { } } + + if ($majorBuildNumber -eq 16) { + $testParams.Add("ServerRole", "WebFrontEnd") + It "creates a farm with a specific server role" { + Set-TargetResource @testParams + Assert-MockCalled New-SPConfigurationDatabase -ParameterFilter { $LocalServerRole -eq "WebFrontEnd" } + } + $testParams.Remove("ServerRole") + } + } + + 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" { From a5ce00c7848183911a8c03837ffc7543fc33f3e9 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sat, 3 Oct 2015 21:24:45 +1000 Subject: [PATCH 2/5] Fixes for distributed cache timeout issues --- .../MSFT_xSPDistributedCacheService.psm1 | 46 +++++++++++-------- ...Point.xSPDistributedCacheService.Tests.ps1 | 1 + 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index f8a2dd321..c18bac757 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -29,7 +29,7 @@ function Get-TargetResource if ($null -eq $cacheHost) { return $nullReturnValue } $computerName = ([System.Net.Dns]::GetHostByName($env:computerName)).HostName - $cacheHostConfig = Get-AFCacheHostConfiguration -ComputerName $computerName -CachePort $cacheHost.PortNo -ErrorAction SilentlyContinue + $cacheHostConfig = Get-AFCacheHostConfiguration -ComputerName $computerName -CachePort ($cacheHost | Where-Object { $_.HostName -eq $computerName }).PortNo -ErrorAction SilentlyContinue $windowsService = Get-WmiObject "win32_service" -Filter "Name='AppFabricCachingService'" $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distributed Cache" -ErrorAction SilentlyContinue @@ -65,13 +65,6 @@ function Set-TargetResource ) $CurrentState = Get-TargetResource @PSBoundParameters - - $isLocalAdmin = Test-xSharePointUserIsLocalAdmin -UserName $ServiceAccount - - if (!$isLocalAdmin) - { - Add-xSharePointUserToLocalAdmin -UserName $ServiceAccount - } if ($Ensure -eq "Present") { Write-Verbose -Message "Adding the distributed cache to the server" @@ -99,16 +92,37 @@ function Set-TargetResource $params = $args[0] Add-SPDistributedCacheServiceInstance + + Get-SPServiceInstance | Where-Object { $_.TypeName -eq "Distributed Cache" } | Stop-SPServiceInstance -Confirm:$false + + $count = 0 + $maxCount = 30 + while (($count -lt $maxCount) -and ((Get-SPServiceInstance | ? { $_.TypeName -eq "Distributed Cache" -and $_.Status -ne "Disabled" }) -ne $null)) { + Start-Sleep -Seconds 60 + $count++ + } + Update-SPDistributedCacheSize -CacheSizeInMB $params.CacheSizeInMB + Get-SPServiceInstance | Where-Object { $_.TypeName -eq "Distributed Cache" } | Start-SPServiceInstance + + $count = 0 + $maxCount = 30 + while (($count -lt $maxCount) -and ((Get-SPServiceInstance | ? { $_.TypeName -eq "Distributed Cache" -and $_.Status -ne "Online" }) -ne $null)) { + Start-Sleep -Seconds 60 + $count++ + } + $farm = Get-SPFarm $cacheService = $farm.Services | Where-Object { $_.Name -eq "AppFabricCachingService" } - $cacheService.ProcessIdentity.CurrentIdentityType = "SpecificUser" - $account = Get-SPManagedAccount -Identity $params.ServiceAccount - $cacheService.ProcessIdentity.ManagedAccount = $account - $cacheService.ProcessIdentity.Update() - $cacheService.ProcessIdentity.Deploy() + if ($cacheService.ProcessIdentity.ManagedAccount.Username -ne $params.ServiceAccount) { + $cacheService.ProcessIdentity.CurrentIdentityType = "SpecificUser" + $account = Get-SPManagedAccount -Identity $params.ServiceAccount + $cacheService.ProcessIdentity.ManagedAccount = $account + $cacheService.ProcessIdentity.Update() + $cacheService.ProcessIdentity.Deploy() + } } } } else { @@ -130,12 +144,6 @@ function Set-TargetResource } Write-Verbose -Message "Distributed cache removed." } - - # Remove the FarmAccount from the local Administrators group, if it was added above - if (!$isLocalAdmin) - { - Remove-xSharePointUserToLocalAdmin -UserName $ServiceAccount - } } function Test-TargetResource diff --git a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 index 5b39ed05f..668ee24db 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 @@ -43,6 +43,7 @@ Describe "xSPDistributedCacheService" { Mock Add-xSharePointUserToLocalAdmin { } Mock Test-xSharePointUserIsLocalAdmin { return $false } Mock Remove-xSharePointUserToLocalAdmin { } + Mock Restart-Service { } Mock Get-SPFarm { return @{ Services = @(@{ Name = "AppFabricCachingService" From f9d910a06c5d7bbea892b6e6315153ca03f2f7ed Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 6 Oct 2015 13:47:48 +1100 Subject: [PATCH 3/5] Added MinRole to join farm command, updated readme --- .../MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 | 23 +++++++++++++++---- .../MSFT_xSPJoinFarm.schema.mof | 1 + README.md | 4 +++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 index 15007c946..4006ca092 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 @@ -7,11 +7,16 @@ function Get-TargetResource [parameter(Mandatory = $true)] [System.String] $FarmConfigDatabaseName, [parameter(Mandatory = $true)] [System.String] $DatabaseServer, [parameter(Mandatory = $true)] [System.String] $Passphrase, - [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $false)] [ValidateSet("Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd")] $ServerRole ) Write-Verbose -Message "Checking for local SP Farm" + if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { + throw [Exception] "Server role is only supported in SharePoint 2016." + } + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] @@ -45,11 +50,16 @@ function Set-TargetResource [parameter(Mandatory = $true)] [System.String] $FarmConfigDatabaseName, [parameter(Mandatory = $true)] [System.String] $DatabaseServer, [parameter(Mandatory = $true)] [System.String] $Passphrase, - [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $false)] [ValidateSet("Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd")] $ServerRole ) Write-Verbose -Message "Joining existing farm configuration database" + if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { + throw [Exception] "Server role is only supported in SharePoint 2016." + } + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] @@ -102,11 +112,16 @@ function Test-TargetResource [parameter(Mandatory = $true)] [System.String] $FarmConfigDatabaseName, [parameter(Mandatory = $true)] [System.String] $DatabaseServer, [parameter(Mandatory = $true)] [System.String] $Passphrase, - [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $false)] [ValidateSet("Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd")] $ServerRole ) + if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { + throw [Exception] "Server role is only supported in SharePoint 2016." + } + $CurrentValues = Get-TargetResource @PSBoundParameters - Write-Verbose "Checking for local farm presence" + Write-Verbose "Testing for local farm presence" return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("FarmConfigDatabaseName") } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof index da712b9ea..fbb84c6aa 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof @@ -5,5 +5,6 @@ class MSFT_xSPJoinFarm : OMI_BaseResource [Key] string DatabaseServer; [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Required] string Passphrase; + [Write, ValueMap{"Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd"}, Values{"Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd"}] string ServerRole; }; diff --git a/README.md b/README.md index 8ba0bfcb2..73190c936 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,9 @@ Additional detailed documentation is included on the wiki on GitHub. ### 0.7.0.0 - * Bug fixes and stability improvements + * Support for MinRole options in SharePoint 2016 + * Fix to distributed cache deployment of more than one server + * Additional bug fixes and stability improvements ### 0.6.0.0 From bfac64b48e27c3201ba5f30aac680122618b2519 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 6 Oct 2015 13:50:19 +1100 Subject: [PATCH 4/5] Formatting fixes --- .../DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof index fbb84c6aa..0284a63fa 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof @@ -5,6 +5,6 @@ class MSFT_xSPJoinFarm : OMI_BaseResource [Key] string DatabaseServer; [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Required] string Passphrase; - [Write, ValueMap{"Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd"}, Values{"Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd"}] string ServerRole; + [Write, ValueMap{"Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd"}, Values{"Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd"}] string ServerRole; }; From 7977c1c0cfbdfd3ecc2cf3c5b3598d705f7c9b23 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 6 Oct 2015 13:50:34 +1100 Subject: [PATCH 5/5] Formatting fixes --- .../DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 index 4006ca092..cc99c4c1c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 @@ -13,7 +13,7 @@ function Get-TargetResource Write-Verbose -Message "Checking for local SP Farm" - if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { + if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { throw [Exception] "Server role is only supported in SharePoint 2016." } @@ -56,7 +56,7 @@ function Set-TargetResource Write-Verbose -Message "Joining existing farm configuration database" - if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { + if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { throw [Exception] "Server role is only supported in SharePoint 2016." } @@ -116,7 +116,7 @@ function Test-TargetResource [parameter(Mandatory = $false)] [ValidateSet("Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd")] $ServerRole ) - if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { + if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { throw [Exception] "Server role is only supported in SharePoint 2016." }