diff --git a/.vscode/GetTestCoverage.ps1 b/.vscode/GetTestCoverage.ps1 new file mode 100644 index 000000000..82fc2ae3b --- /dev/null +++ b/.vscode/GetTestCoverage.ps1 @@ -0,0 +1,32 @@ +[CmdletBinding()] +param( + [Parameter(Mandatory = $true)] + [string] + $UnitTestFilePath, + + [Parameter(Mandatory = $true)] + [string] + $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) +) + +if ($UnitTestFilePath.EndsWith("Tests.ps1")) +{ + + $pesterParameters = @{ + Path = $unitTestFilePath + Parameters = @{ + SharePointCmdletModule = $SharePointCmdletModule + } + } + + $unitTest = Get-Item -Path $UnitTestFilePath + $unitTestName = "$($unitTest.Name.Split('.')[1])" + + $unitTestFilePath = (Join-Path -Path $PSScriptRoot ` + -ChildPath "..\Modules\SharePointDsc\DSCResources\MSFT_$($unitTestName)\MSFT_$($unitTestName).psm1" ` + -Resolve) + + Invoke-Pester -Script $pesterParameters -CodeCoverage $UnitTestFilePath -Verbose +} diff --git a/.vscode/launch.json b/.vscode/launch.json index 991306295..b28a8a4e5 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -34,6 +34,39 @@ "cwd": "${file}", "createTemporaryIntegratedConsole": true }, + { + "type": "PowerShell", + "request": "launch", + "name": "Get current unit test code overage (SP2013)", + "script": "${workspaceRoot}/.vscode/GetTestCoverage.ps1", + "args": [ + "${file}", + "${workspaceRoot}/Tests/Unit/Stubs/SharePoint/15.0.4805.1000/Microsoft.SharePoint.PowerShell.psm1" + ], + "createTemporaryIntegratedConsole": true + }, + { + "type": "PowerShell", + "request": "launch", + "name": "Get current unit test code overage (SP2016)", + "script": "${workspaceRoot}/.vscode/GetTestCoverage.ps1", + "args": [ + "${file}", + "${workspaceRoot}/Tests/Unit/Stubs/SharePoint/16.0.4456.1000/Microsoft.SharePoint.PowerShell.psm1" + ], + "createTemporaryIntegratedConsole": true + }, + { + "type": "PowerShell", + "request": "launch", + "name": "Get current unit test code overage (SP2019)", + "script": "${workspaceRoot}/.vscode/GetTestCoverage.ps1", + "args": [ + "${file}", + "${workspaceRoot}/Tests/Unit/Stubs/SharePoint/16.0.10337.12109/Microsoft.SharePoint.PowerShell.psm1" + ], + "createTemporaryIntegratedConsole": true + }, { "name": "Debug current file", "type": "PowerShell", diff --git a/CHANGELOG.md b/CHANGELOG.md index 4beb310ef..76a88fe5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Change log for SharePointDsc +## v3.6 + +* SharePointDsc generic + * Added new launch actions to vscode to allow code coverage reports for + the current unit test file. +* SPFarm + * Moved check for CentralAdministrationUrl is HTTP to Set method, + to prevent issues with ReverseDsc. +* SPInstall + * Updated error code checks to force reboot. +* SPProductUpdate + * Fixes an issue using ShutdownServices when no Farm is available. +* SPTrustedRootAuthority + * Fixes issue where Set method throws an error because the + parameter CertificateFilePath is not read correctly. +* SPTrustedSecurityTokenIssuer + * New resource for configuring OAuth trusts + ## v3.5 * SharePointDsc generic diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.psm1 index a5a35b3cc..406611502 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.psm1 @@ -17,7 +17,7 @@ function Get-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -29,17 +29,17 @@ function Get-TargetResource Write-Verbose -Message "Getting Access Services service app '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue $nullReturn = @{ - Name = $params.Name + Name = $params.Name ApplicationPool = $params.ApplicationPool - DatabaseServer = $params.DatabaseServer - Ensure = "Absent" - InstallAccount = $params.InstallAccount + DatabaseServer = $params.DatabaseServer + Ensure = "Absent" + InstallAccount = $params.InstallAccount } if ($null -eq $serviceApps) { @@ -59,10 +59,10 @@ function Get-TargetResource $context = [Microsoft.SharePoint.SPServiceContext]::GetContext($serviceApp.ServiceApplicationProxyGroup, [Microsoft.SharePoint.SPSiteSubscriptionIdentifier]::Default) $dbserver = (Get-SPAccessServicesDatabaseServer $context).ServerName return @{ - Name = $serviceApp.DisplayName - DatabaseServer = $dbserver + Name = $serviceApp.DisplayName + DatabaseServer = $dbserver ApplicationPool = $serviceApp.ApplicationPool.Name - Ensure = "Present" + Ensure = "Present" } } } @@ -87,7 +87,7 @@ function Set-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -104,15 +104,15 @@ function Set-TargetResource { Write-Verbose -Message "Creating Access Services Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $app = New-SPAccessServicesApplication -Name $params.Name ` - -ApplicationPool $params.ApplicationPool ` - -Default ` - -DatabaseServer $params.DatabaseServer + -ApplicationPool $params.ApplicationPool ` + -Default ` + -DatabaseServer $params.DatabaseServer $app | New-SPAccessServicesApplicationProxy | Out-Null } @@ -121,8 +121,8 @@ function Set-TargetResource { Write-Verbose -Message "Removing Access Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] @@ -163,7 +163,7 @@ function Test-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -184,14 +184,14 @@ function Test-TargetResource if ($CurrentValues.DatabaseServer -ne $DatabaseServer) { Write-Verbose -Message ("Specified database server does not match the actual " + ` - "database server. This resource cannot move the database " + ` - "to a different SQL instance.") + "database server. This resource cannot move the database " + ` + "to a different SQL instance.") return $false } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.psm1 index 35738d170..2095ba673 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.psm1 @@ -13,7 +13,7 @@ function Get-TargetResource $ApplicationPool, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -25,15 +25,15 @@ function Get-TargetResource Write-Verbose -Message "Getting Access 2010 Service app '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $nullReturn = @{ - Name = $params.Name + Name = $params.Name ApplicationPool = $params.ApplicationPool - Ensure = "Absent" + Ensure = "Absent" } if ($null -eq $serviceApps) { @@ -51,14 +51,14 @@ function Get-TargetResource else { return @{ - Name = $serviceApp.DisplayName + Name = $serviceApp.DisplayName ApplicationPool = $serviceApp.ApplicationPool.Name - Ensure = "Present" - InstallAccount = $params.InstallAccount + Ensure = "Present" + InstallAccount = $params.InstallAccount } } } - return $result + return $result } function Set-TargetResource @@ -75,7 +75,7 @@ function Set-TargetResource $ApplicationPool, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -91,26 +91,26 @@ function Set-TargetResource { Write-Verbose "Creating Access 2010 Service Application '$Name'" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $accessApp = New-SPAccessServiceApplication -Name $params.Name ` - -ApplicationPool $params.ApplicationPool + -ApplicationPool $params.ApplicationPool } } if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") { Write-Verbose "Updating Access 2010 service application '$Name'" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - $apps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue - if ($null -ne $apps) - { + -Arguments $PSBoundParameters ` + -ScriptBlock { + $params = $args[0] + $apps = Get-SPServiceApplication -Name $params.Name ` + -ErrorAction SilentlyContinue + if ($null -ne $apps) + { $app = $apps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Access.Server.MossHost.AccessServerWebServiceApplication" + $_.GetType().FullName -eq "Microsoft.Office.Access.Server.MossHost.AccessServerWebServiceApplication" } if ($null -ne $app) { @@ -122,29 +122,29 @@ function Set-TargetResource return; } } - } + } - $accessApp = New-SPAccessServiceApplication -Name $params.Name ` - -ApplicationPool $params.ApplicationPool + $accessApp = New-SPAccessServiceApplication -Name $params.Name ` + -ApplicationPool $params.ApplicationPool } } if ($Ensure -eq "Absent") { Write-Verbose "Removing Access 2010 service application '$Name'" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $apps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $apps) { return } $app = $apps | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Access.Server.MossHost.AccessServerWebServiceApplication" + $_.GetType().FullName -eq "Microsoft.Office.Access.Server.MossHost.AccessServerWebServiceApplication" } if ($null -ne $app) @@ -170,7 +170,7 @@ function Test-TargetResource $ApplicationPool, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -187,8 +187,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name", "ApplicationPool", "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Name", "ApplicationPool", "Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.psm1 index a24809920..831cdea37 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.psm1 @@ -9,7 +9,7 @@ function Get-TargetResource $WebAppName, [Parameter(Mandatory = $true)] - [ValidateSet("Default","Intranet","Extranet","Custom","Internet")] + [ValidateSet("Default", "Intranet", "Extranet", "Custom", "Internet")] [System.String] $Zone, @@ -22,7 +22,7 @@ function Get-TargetResource $Internal = $false, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -34,20 +34,20 @@ function Get-TargetResource Write-Verbose -Message "Getting Alternate URL for $Zone in $WebAppName" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $aam = Get-SPAlternateURL -Identity $params.Url ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $aam) { return @{ WebAppName = $params.WebAppName - Zone = $params.Zone - Url = $params.Url - Ensure = "Absent" + Zone = $params.Zone + Url = $params.Url + Ensure = "Absent" } } @@ -60,11 +60,11 @@ function Get-TargetResource $wa = Get-SPWebApplication -Identity $aam.PublicUrl return @{ - WebAppName = $wa.DisplayName - Zone = $aam.Zone - Url = $aam.IncomingUrl - Internal = $internal - Ensure = "Present" + WebAppName = $wa.DisplayName + Zone = $aam.Zone + Url = $aam.IncomingUrl + Internal = $internal + Ensure = "Present" InstallAccount = $params.InstallAccount } } @@ -81,7 +81,7 @@ function Set-TargetResource $WebAppName, [Parameter(Mandatory = $true)] - [ValidateSet("Default","Intranet","Extranet","Custom","Internet")] + [ValidateSet("Default", "Intranet", "Extranet", "Custom", "Internet")] [System.String] $Zone, @@ -94,7 +94,7 @@ function Set-TargetResource $Internal = $false, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -109,8 +109,8 @@ function Set-TargetResource if ($Ensure -eq "Present") { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $webapp = Get-SPWebApplication -IncludeCentralAdministration | Where-Object -FilterScript { @@ -123,11 +123,11 @@ function Set-TargetResource } $urlAam = Get-SPAlternateURL -Identity $params.Url ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $webAppAams = Get-SPAlternateURL -WebApplication $webapp ` - -Zone $params.Zone ` - -ErrorAction SilentlyContinue + -Zone $params.Zone ` + -ErrorAction SilentlyContinue if ($null -eq $webAppAams) { @@ -137,8 +137,8 @@ function Set-TargetResource # urlAAM not found, so it is safe to create AAM on specified zone $cmdParams = @{ WebApplication = $webapp - Url = $params.Url - Zone = $params.Zone + Url = $params.Url + Zone = $params.Zone } if ($params.ContainsKey("Internal") -eq $true) { @@ -149,20 +149,20 @@ function Set-TargetResource else { throw ("Specified URL found on different WebApp/Zone: WebApp " + ` - "$($urlAam.PublicUrl) in zone $($urlAam.Zone)") + "$($urlAam.PublicUrl) in zone $($urlAam.Zone)") } } else { # WebApp has one or more AAMs, check for URL $aamForUrl = $webAppAams | Where-Object -FilterScript { - $_.IncomingUrl -eq $params.Url - } + $_.IncomingUrl -eq $params.Url + } if ($null -eq $aamForUrl) { # URL not configured on WebApp - if ($null -eq $urlAam) + if ($null -eq $urlAam) { # urlAAM not found, so it is safe to create AAM on specified zone (or modify existing if CA) # If this is Central Admin and Default zone, we want to update the existing AAM instead of adding a new one @@ -179,8 +179,8 @@ function Set-TargetResource { $cmdParams = @{ WebApplication = $webapp - Url = $params.Url - Zone = $params.Zone + Url = $params.Url + Zone = $params.Zone } if (($params.ContainsKey("Internal") -eq $true)) { @@ -192,11 +192,11 @@ function Set-TargetResource else { throw ("Specified URL ($($params.Url)) found on different WebApp/Zone: " + ` - "WebApp $($urlAam.PublicUrl) in zone $($urlAam.Zone)") + "WebApp $($urlAam.PublicUrl) in zone $($urlAam.Zone)") } - } - else - { + } + else + { if ($params.Internal -eq $false) { if (($urlAam.PublicUrl -eq $aamForUrl.PublicUrl) -and ` @@ -207,25 +207,25 @@ function Set-TargetResource else { throw ("Specified URL found on different WebApp/Zone: WebApp " + ` - "$($urlAam.PublicUrl) in zone $($urlAam.Zone)") + "$($urlAam.PublicUrl) in zone $($urlAam.Zone)") } } else { Write-Verbose -Message "URL already exists!" } - } + } } } } else { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $aam = Get-SPAlternateURL -Identity $params.Url ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue Remove-SPAlternateURL -Identity $aam -Confirm:$false } @@ -243,7 +243,7 @@ function Test-TargetResource $WebAppName, [Parameter(Mandatory = $true)] - [ValidateSet("Default","Intranet","Extranet","Custom","Internet")] + [ValidateSet("Default", "Intranet", "Extranet", "Custom", "Internet")] [System.String] $Zone, @@ -256,7 +256,7 @@ function Test-TargetResource $Internal = $false, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -279,17 +279,17 @@ function Test-TargetResource if ($Ensure -eq "Present") { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("WebAppName", ` - "Zone", ` - "Url", ` - "Ensure", ` - "Internal") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("WebAppName", ` + "Zone", ` + "Url", ` + "Ensure", ` + "Internal") } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.psm1 index 2a3a7bac2..a06b9e3d9 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.psm1 @@ -41,8 +41,8 @@ function Get-TargetResource Write-Verbose -Message "Getting antivirus configuration settings" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -52,17 +52,17 @@ function Get-TargetResource catch { Write-Verbose -Message ("No local SharePoint farm was detected. Antivirus " + ` - "settings will not be applied") + "settings will not be applied") return @{ - IsSingleInstance = "Yes" + IsSingleInstance = "Yes" # Set the antivirus settings AllowDownloadInfected = $false - ScanOnDownload = $false - ScanOnUpload = $false - AttemptToClean = $false - NumberOfThreads = 0 - TimeoutDuration = 0 - InstallAccount = $params.InstallAccount + ScanOnDownload = $false + ScanOnUpload = $false + AttemptToClean = $false + NumberOfThreads = 0 + TimeoutDuration = 0 + InstallAccount = $params.InstallAccount } } @@ -70,15 +70,15 @@ function Get-TargetResource $admService = Get-SPDscContentService return @{ - IsSingleInstance = "Yes" + IsSingleInstance = "Yes" # 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 + 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 @@ -126,8 +126,8 @@ function Set-TargetResource Write-Verbose -Message "Setting antivirus configuration settings" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -222,7 +222,7 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters + -DesiredValues $PSBoundParameters } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.psm1 index 54ec24d9e..cfefd951c 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.psm1 @@ -16,13 +16,13 @@ function Get-TargetResource Write-Verbose -Message "Getting app catalog status of $SiteUrl" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $site = Get-SPSite $params.SiteUrl -ErrorAction SilentlyContinue $nullreturn = @{ - SiteUrl = $null + SiteUrl = $null InstallAccount = $params.InstallAccount } if ($null -eq $site) @@ -40,7 +40,7 @@ function Get-TargetResource return $nullreturn } return @{ - SiteUrl = $site.Url + SiteUrl = $site.Url InstallAccount = $params.InstallAccount } } @@ -65,8 +65,8 @@ function Set-TargetResource Write-Verbose -Message "Retrieving farm account" $farmAccount = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { return Get-SPDscFarmAccount } @@ -120,8 +120,8 @@ function Set-TargetResource } Invoke-SPDscCommand -Credential $farmAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try { @@ -130,8 +130,8 @@ function Set-TargetResource catch [System.UnauthorizedAccessException] { throw ("This resource must be run as the farm account (not a setup account). " + ` - "Please ensure either the PsDscRunAsCredential or InstallAccount " + ` - "credentials are set to the farm account and run this resource again") + "Please ensure either the PsDscRunAsCredential or InstallAccount " + ` + "credentials are set to the farm account and run this resource again") } } | Out-Null @@ -172,8 +172,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("SiteUrl") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("SiteUrl") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.psm1 index 6243993c3..bfba2f42e 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.psm1 @@ -20,15 +20,15 @@ function Get-TargetResource Write-Verbose -Message "Getting app domain settings" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] - $appDomain = Get-SPAppDomain + $appDomain = Get-SPAppDomain $prefix = Get-SPAppSiteSubscriptionName -ErrorAction Continue return @{ - AppDomain = $appDomain - Prefix= $prefix + AppDomain = $appDomain + Prefix = $prefix InstallAccount = $params.InstallAccount } } @@ -56,8 +56,8 @@ function Set-TargetResource Write-Verbose -Message "Setting app domain settings" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] Set-SPAppDomain $params.AppDomain @@ -92,8 +92,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("AppDomain", "Prefix") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("AppDomain", "Prefix") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.schema.mof b/Modules/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.schema.mof index d24a57c9b..0820ecf25 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.schema.mof +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.schema.mof @@ -4,5 +4,5 @@ class MSFT_SPAppDomain : OMI_BaseResource [Key, Description("The domain name for apps to use in this farm")] string AppDomain; [Required, Description("The prefix to go on to app URLs")] string Prefix; [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; - + }; diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.psm1 index bce0fd123..481fa8815 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.psm1 @@ -25,7 +25,7 @@ function Get-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -37,16 +37,16 @@ function Get-TargetResource Write-Verbose -Message "Getting App management service app '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue $nullReturn = @{ - Name = $params.Name + Name = $params.Name ApplicationPool = $params.ApplicationPool - Ensure = "Absent" - InstallAccount = $params.InstallAccount + Ensure = "Absent" + InstallAccount = $params.InstallAccount } if ($null -eq $serviceApps) { @@ -77,13 +77,13 @@ function Get-TargetResource } return @{ - Name = $serviceApp.DisplayName - ProxyName = $proxyName + Name = $serviceApp.DisplayName + ProxyName = $proxyName ApplicationPool = $serviceApp.ApplicationPool.Name - DatabaseName = $serviceApp.Databases.Name - DatabaseServer = $serviceApp.Databases.NormalizedDataSource - Ensure = "Present" - InstallAccount = $params.InstallAccount + DatabaseName = $serviceApp.Databases.Name + DatabaseServer = $serviceApp.Databases.NormalizedDataSource + Ensure = "Present" + InstallAccount = $params.InstallAccount } } } @@ -117,7 +117,7 @@ function Set-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -136,12 +136,12 @@ function Set-TargetResource Write-Verbose -Message "Creating App management Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $newParams = @{ - Name = $params.Name + Name = $params.Name ApplicationPool = $params.ApplicationPool } if ($params.ContainsKey("DatabaseName") -eq $true) @@ -163,9 +163,9 @@ function Set-TargetResource $pName = $params.ProxyName } New-SPAppManagementServiceApplicationProxy -Name $pName ` - -UseDefaultProxyGroup ` - -ServiceApplication $appService ` - -ErrorAction Stop | Out-Null + -UseDefaultProxyGroup ` + -ServiceApplication $appService ` + -ErrorAction Stop | Out-Null } } @@ -178,8 +178,8 @@ function Set-TargetResource { Write-Verbose -Message "Proxy not found, creating proxy" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $app = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { @@ -195,9 +195,9 @@ function Set-TargetResource $pName = $params.ProxyName } New-SPAppManagementServiceApplicationProxy -Name $pName ` - -UseDefaultProxyGroup ` - -ServiceApplication $app ` - -ErrorAction Stop | Out-Null + -UseDefaultProxyGroup ` + -ServiceApplication $app ` + -ErrorAction Stop | Out-Null } } @@ -206,8 +206,8 @@ function Set-TargetResource { Write-Verbose -Message "Updating Application Pool" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool @@ -225,8 +225,8 @@ function Set-TargetResource # The service app should not exit Write-Verbose -Message "Removing App management Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $app = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { @@ -274,7 +274,7 @@ function Test-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -298,9 +298,9 @@ function Test-TargetResource } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ApplicationPool", ` - "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("ApplicationPool", ` + "Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.psm1 index fd58cd3aa..2969c1a67 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.psm1 @@ -24,12 +24,12 @@ function Get-TargetResource Write-Verbose -Message "Getting app store settings of $WebAppUrl" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $nullreturn = @{ - WebAppUrl = $null + WebAppUrl = $null InstallAccount = $params.InstallAccount } @@ -45,10 +45,10 @@ function Get-TargetResource $AllowAppsForOffice = [System.Convert]::ToBoolean($currentAAFO) return @{ - WebAppUrl = $params.WebAppUrl - AllowAppPurchases = $AllowAppPurchases + WebAppUrl = $params.WebAppUrl + AllowAppPurchases = $AllowAppPurchases AllowAppsForOffice = $AllowAppsForOffice - InstallAccount = $params.InstallAccount + InstallAccount = $params.InstallAccount } } return $result @@ -79,8 +79,8 @@ function Set-TargetResource Write-Verbose -Message "Setting app store settings of $WebAppUrl" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue @@ -96,7 +96,7 @@ function Set-TargetResource if ($AllowAppPurchases -ne $params.AllowAppPurchases) { Set-SPAppAcquisitionConfiguration -WebApplication $params.WebAppUrl ` - -Enable $params.AllowAppPurchases + -Enable $params.AllowAppPurchases } } @@ -107,7 +107,7 @@ function Set-TargetResource if ($AllowAppsForOffice -ne $params.AllowAppsForOffice) { Set-SPOfficeStoreAppsDefaultActivation -WebApplication $params.WebAppUrl ` - -Enable $params.AllowAppsForOffice + -Enable $params.AllowAppsForOffice } } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPAuthenticationRealm/MSFT_SPAuthenticationRealm.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPAuthenticationRealm/MSFT_SPAuthenticationRealm.psm1 index 6a457ed86..8256de827 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPAuthenticationRealm/MSFT_SPAuthenticationRealm.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPAuthenticationRealm/MSFT_SPAuthenticationRealm.psm1 @@ -20,13 +20,13 @@ function Get-TargetResource() Write-Verbose -Message "Getting farm authentication realm" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -ScriptBlock { + -ScriptBlock { $currentRealm = Get-SPAuthenticationRealm Write-Verbose -Message "Current farm authentication realm is '$currentRealm'" return @{ - IsSingleInstance = "Yes" + IsSingleInstance = "Yes" AuthenticationRealm = $currentRealm } } @@ -91,8 +91,8 @@ function Test-TargetResource() Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("AuthenticationRealm") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("AuthenticationRealm") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.psm1 index e7a516a74..508778776 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.psm1 @@ -25,7 +25,7 @@ function Get-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -37,18 +37,18 @@ function Get-TargetResource Write-Verbose -Message "Getting BCS service app '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue $nullReturn = @{ - Name = $params.Name + Name = $params.Name ApplicationPool = $params.ApplicationPool - DatabaseName = $null - DatabaseServer = $null - Ensure = "Absent" - InstallAccount = $params.InstallAccount + DatabaseName = $null + DatabaseServer = $null + Ensure = "Absent" + InstallAccount = $params.InstallAccount } if ($null -eq $serviceApps) { @@ -76,14 +76,14 @@ function Get-TargetResource } } - $returnVal = @{ - Name = $serviceApp.DisplayName - ProxyName = $proxyName + $returnVal = @{ + Name = $serviceApp.DisplayName + ProxyName = $proxyName ApplicationPool = $serviceApp.ApplicationPool.Name - DatabaseName = $serviceApp.Database.Name - DatabaseServer = $serviceApp.Database.NormalizedDataSource - Ensure = "Present" - InstallAccount = $params.InstallAccount + DatabaseName = $serviceApp.Database.Name + DatabaseServer = $serviceApp.Database.NormalizedDataSource + Ensure = "Present" + InstallAccount = $params.InstallAccount } return $returnVal } @@ -117,7 +117,7 @@ function Set-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -130,7 +130,7 @@ function Set-TargetResource if ($Ensure -eq "Present" -and ($PSBoundParameters.ContainsKey("DatabaseName") -eq $false -or - $PSBoundParameters.ContainsKey("DatabaseServer") -eq $false)) + $PSBoundParameters.ContainsKey("DatabaseServer") -eq $false)) { Throw "Parameter DatabaseName and DatabaseServer are required when Ensure=Present" } @@ -142,14 +142,14 @@ function Set-TargetResource # The service app doesn't exist but should Write-Verbose -Message "Creating BCS Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $bcsServiceApp = New-SPBusinessDataCatalogServiceApplication -Name $params.Name ` - -ApplicationPool $params.ApplicationPool ` - -DatabaseName $params.DatabaseName ` - -DatabaseServer $params.DatabaseServer + -ApplicationPool $params.ApplicationPool ` + -DatabaseName $params.DatabaseName ` + -DatabaseServer $params.DatabaseServer if ($params.ContainsKey("ProxyName")) { @@ -165,7 +165,7 @@ function Set-TargetResource } New-SPBusinessDataCatalogServiceApplicationProxy -Name $params.ProxyName ` - -ServiceApplication $bcsServiceApp | Out-Null + -ServiceApplication $bcsServiceApp | Out-Null } } } @@ -177,17 +177,17 @@ function Set-TargetResource { Write-Verbose -Message "Updating BCS Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.BusinessData.SharedService.BdcServiceApplication" - } ` - | Set-SPBusinessDataCatalogServiceApplication -ApplicationPool $appPool + | Where-Object -FilterScript { + $_.GetType().FullName -eq "Microsoft.SharePoint.BusinessData.SharedService.BdcServiceApplication" + } ` + | Set-SPBusinessDataCatalogServiceApplication -ApplicationPool $appPool } } } @@ -197,8 +197,8 @@ function Set-TargetResource # The service app should not exit Write-Verbose -Message "Removing BCS Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $app = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { @@ -246,7 +246,7 @@ function Test-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -265,8 +265,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ApplicationPool", "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("ApplicationPool", "Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.psm1 index e076ffac6..6810c13d3 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.psm1 @@ -41,16 +41,16 @@ function Get-TargetResource Write-Verbose -Message "Getting blob cache settings for $WebAppUrl" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $webappsi = Get-SPServiceInstance -Server $env:COMPUTERNAME ` - -ErrorAction SilentlyContinue ` - | Where-Object -FilterScript { - $_.GetType().Name -eq "SPWebServiceInstance" -and ` - $_.Name -eq "" - } + -ErrorAction SilentlyContinue ` + | Where-Object -FilterScript { + $_.GetType().Name -eq "SPWebServiceInstance" -and ` + $_.Name -eq "" + } if ($null -eq $webappsi) { @@ -68,7 +68,7 @@ function Get-TargetResource } $wa = Get-SPWebApplication -Identity $params.WebAppUrl ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $wa) { @@ -186,7 +186,7 @@ function Set-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters - $changes = @{} + $changes = @{ } if ($PSBoundParameters.ContainsKey("EnableCache")) { @@ -232,17 +232,17 @@ function Set-TargetResource { ## Perform changes Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $changes) ` - -ScriptBlock { - $params = $args[0] + -Arguments @($PSBoundParameters, $changes) ` + -ScriptBlock { + $params = $args[0] $changes = $args[1] $webappsi = Get-SPServiceInstance -Server $env:COMPUTERNAME ` - -ErrorAction SilentlyContinue ` - | Where-Object -FilterScript { - $_.GetType().Name -eq "SPWebServiceInstance" -and ` - $_.Name -eq "" - } + -ErrorAction SilentlyContinue ` + | Where-Object -FilterScript { + $_.GetType().Name -eq "SPWebServiceInstance" -and ` + $_.Name -eq "" + } if ($null -eq $webappsi) { @@ -260,7 +260,7 @@ function Set-TargetResource $zone = [Microsoft.SharePoint.Administration.SPUrlZone]::$($params.Zone) - $sitePath = $wa.IisSettings[$zone].Path + $sitePath = $wa.IisSettings[$zone].Path $timestamp = Get-Date -Format "yyyyMMdd_HHmmss" $webconfiglocation = Join-Path -Path $sitePath -ChildPath "web.config" $webconfigbackuplocation = Join-Path -Path $sitePath -ChildPath "web_config-$timestamp.backup" @@ -270,27 +270,27 @@ function Set-TargetResource if ($changes.ContainsKey("EnableCache")) { - $webconfig.configuration.SharePoint.BlobCache.SetAttribute("enabled",$changes.EnableCache.ToString()) + $webconfig.configuration.SharePoint.BlobCache.SetAttribute("enabled", $changes.EnableCache.ToString()) } if ($changes.ContainsKey("Location")) { - $webconfig.configuration.SharePoint.BlobCache.SetAttribute("location",$changes.Location) + $webconfig.configuration.SharePoint.BlobCache.SetAttribute("location", $changes.Location) } if ($changes.ContainsKey("MaxSizeInGB")) { - $webconfig.configuration.SharePoint.BlobCache.SetAttribute("maxSize",$changes.MaxSizeInGB.ToString()) + $webconfig.configuration.SharePoint.BlobCache.SetAttribute("maxSize", $changes.MaxSizeInGB.ToString()) } if ($changes.ContainsKey("MaxAgeInSeconds")) { - $webconfig.configuration.SharePoint.BlobCache.SetAttribute("max-age",$($changes.MaxAgeInSeconds.ToString())) + $webconfig.configuration.SharePoint.BlobCache.SetAttribute("max-age", $($changes.MaxAgeInSeconds.ToString())) } if ($changes.ContainsKey("FileTypes")) { - $webconfig.configuration.SharePoint.BlobCache.SetAttribute("path",$changes.FileTypes) + $webconfig.configuration.SharePoint.BlobCache.SetAttribute("path", $changes.FileTypes) } $webconfig.Save($webconfiglocation) } @@ -375,12 +375,12 @@ function Test-TargetResource } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("EnableCache", - "Location", - "MaxSizeInGB", - "FileType", - "MaxAgeInSeconds") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("EnableCache", + "Location", + "MaxSizeInGB", + "FileType", + "MaxAgeInSeconds") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.schema.mof b/Modules/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.schema.mof index 81ac90cf5..66f2a30ae 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.schema.mof +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.schema.mof @@ -10,5 +10,3 @@ class MSFT_SPBlobCacheSettings : OMI_BaseResource [Write, Description("Specify the file types that must be stored by the blob cache")] string FileTypes; [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - - diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.psm1 index c99327daf..8a5d00067 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.psm1 @@ -28,8 +28,8 @@ function Get-TargetResource Write-Verbose -Message "Getting cache accounts for $WebAppUrl" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue @@ -56,8 +56,8 @@ function Get-TargetResource if ($wa.Properties.ContainsKey("portalsuperuseraccount")) { $claim = New-SPClaimsPrincipal -Identity $wa.Properties["portalsuperuseraccount"] ` - -IdentityType EncodedClaim ` - -ErrorAction SilentlyContinue + -IdentityType EncodedClaim ` + -ErrorAction SilentlyContinue if ($null -ne $claim) { $returnVal.Add("SuperUserAlias", $claim.Value) @@ -74,8 +74,8 @@ function Get-TargetResource if ($wa.Properties.ContainsKey("portalsuperreaderaccount")) { $claim = New-SPClaimsPrincipal -Identity $wa.Properties["portalsuperreaderaccount"] ` - -IdentityType EncodedClaim ` - -ErrorAction SilentlyContinue + -IdentityType EncodedClaim ` + -ErrorAction SilentlyContinue if ($null -ne $claim) { $returnVal.Add("SuperReaderAlias", $claim.Value) @@ -90,13 +90,13 @@ function Get-TargetResource $returnVal.Add("SuperReaderAlias", "") } if ($wa.Policies.UserName -notcontains ((New-SPClaimsPrincipal -Identity $params.SuperReaderAlias ` - -IdentityType WindowsSamAccountName).ToEncodedString())) + -IdentityType WindowsSamAccountName).ToEncodedString())) { $policiesSet = $false } if ($wa.Policies.UserName -notcontains ((New-SPClaimsPrincipal -Identity $params.SuperUserAlias ` - -IdentityType WindowsSamAccountName).ToEncodedString())) + -IdentityType WindowsSamAccountName).ToEncodedString())) { $policiesSet = $false } @@ -180,9 +180,9 @@ function Set-TargetResource if ($wa.UseClaimsAuthentication -eq $true) { $wa.Properties["portalsuperuseraccount"] = (New-SPClaimsPrincipal -Identity $params.SuperUserAlias ` - -IdentityType WindowsSamAccountName).ToEncodedString() + -IdentityType WindowsSamAccountName).ToEncodedString() $wa.Properties["portalsuperreaderaccount"] = (New-SPClaimsPrincipal -Identity $params.SuperReaderAlias ` - -IdentityType WindowsSamAccountName).ToEncodedString() + -IdentityType WindowsSamAccountName).ToEncodedString() } else { @@ -195,22 +195,22 @@ function Set-TargetResource if ($wa.UseClaimsAuthentication -eq $true) { $claimsReader = (New-SPClaimsPrincipal -Identity $params.SuperReaderAlias ` - -IdentityType WindowsSamAccountName).ToEncodedString() + -IdentityType WindowsSamAccountName).ToEncodedString() if ($wa.Policies.UserName -contains $claimsReader) { $wa.Policies.Remove($claimsReader) } - $policy = $wa.Policies.Add($claimsReader, "Super Reader (Claims)") + $policy = $wa.Policies.Add($claimsReader, "Super Reader (Claims)") $policyRole = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullRead) $policy.PolicyRoleBindings.Add($policyRole) $claimsSuper = (New-SPClaimsPrincipal -Identity $params.SuperUserAlias ` - -IdentityType WindowsSamAccountName).ToEncodedString() + -IdentityType WindowsSamAccountName).ToEncodedString() if ($wa.Policies.UserName -contains $claimsSuper) { $wa.Policies.Remove($claimsSuper) } - $policy = $wa.Policies.Add($claimsSuper, "Super User (Claims)") + $policy = $wa.Policies.Add($claimsSuper, "Super User (Claims)") $policyRole = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullControl) $policy.PolicyRoleBindings.Add($policyRole) } @@ -221,7 +221,7 @@ function Set-TargetResource $wa.Policies.Remove($params.SuperReaderAlias) } - $readPolicy = $wa.Policies.Add($params.SuperReaderAlias, "Super Reader") + $readPolicy = $wa.Policies.Add($params.SuperReaderAlias, "Super Reader") $readPolicyRole = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullRead) $readPolicy.PolicyRoleBindings.Add($readPolicyRole) @@ -229,7 +229,7 @@ function Set-TargetResource { $wa.Policies.Remove($params.SuperUserAlias) } - $policy = $wa.Policies.Add($params.SuperUserAlias, "Super User") + $policy = $wa.Policies.Add($params.SuperUserAlias, "Super User") $policyRole = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullControl) $policy.PolicyRoleBindings.Add($policyRole) } @@ -278,17 +278,17 @@ function Test-TargetResource if ($SetWebAppPolicy -eq $true) { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("SuperUserAlias", ` - "SuperReaderAlias", ` - "SetWebAppPolicy") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("SuperUserAlias", ` + "SuperReaderAlias", ` + "SetWebAppPolicy") } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("SuperUserAlias", ` - "SuperReaderAlias") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("SuperUserAlias", ` + "SuperReaderAlias") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.psm1 index 388ba8db2..c106a3eb8 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.psm1 @@ -10,12 +10,12 @@ function Get-TargetResource $IsSingleInstance, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", [Parameter()] - [ValidateSet("mon","tue","wed","thu","fri","sat","sun")] + [ValidateSet("mon", "tue", "wed", "thu", "fri", "sat", "sun")] [System.String[]] $DatabaseUpgradeDays, @@ -33,11 +33,11 @@ function Get-TargetResource # Check which version of SharePoint is installed if ((Get-SPDscInstalledProductVersion).FileMajorPart -eq 15) { - $wssRegKey ="hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS" + $wssRegKey = "hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS" } else { - $wssRegKey ="hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\16.0\WSS" + $wssRegKey = "hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\16.0\WSS" } # Read LanguagePackInstalled and SetupType registry keys @@ -77,12 +77,12 @@ function Set-TargetResource $IsSingleInstance, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", [Parameter()] - [ValidateSet("mon","tue","wed","thu","fri","sat","sun")] + [ValidateSet("mon", "tue", "wed", "thu", "fri", "sat", "sun")] [System.String[]] $DatabaseUpgradeDays, @@ -112,24 +112,24 @@ function Set-TargetResource if ($DatabaseUpgradeDays) { Write-Verbose -Message "DatabaseUpgradeDays parameter exists, check if current day is specified" - $currentDayOfWeek = $now.DayOfWeek.ToString().ToLower().Substring(0,3) + $currentDayOfWeek = $now.DayOfWeek.ToString().ToLower().Substring(0, 3) if ($DatabaseUpgradeDays -contains $currentDayOfWeek) { Write-Verbose -Message ("Current day is present in the parameter DatabaseUpgradeDays. " + ` - "Configuration wizard can be run today.") + "Configuration wizard can be run today.") } else { Write-Verbose -Message ("Current day is not present in the parameter DatabaseUpgradeDays, " + ` - "skipping the Configuration Wizard") + "skipping the Configuration Wizard") return } } else { Write-Verbose -Message ("No DatabaseUpgradeDays specified, Configuration Wizard can be " + ` - "ran on any day.") + "ran on any day.") } # Check if DatabaseUpdateTime parameter exists @@ -146,12 +146,12 @@ function Set-TargetResource } else { - if ([datetime]::TryParse($upgradeTimes[0],[ref]$starttime) -ne $true) + if ([datetime]::TryParse($upgradeTimes[0], [ref]$starttime) -ne $true) { throw "Error converting start time" } - if ([datetime]::TryParse($upgradeTimes[2],[ref]$endtime) -ne $true) + if ([datetime]::TryParse($upgradeTimes[2], [ref]$endtime) -ne $true) { throw "Error converting end time" } @@ -165,25 +165,25 @@ function Set-TargetResource if (($starttime -lt $now) -and ($endtime -gt $now)) { Write-Verbose -Message ("Current time is inside of the window specified in " + ` - "DatabaseUpgradeTime. Starting wizard") + "DatabaseUpgradeTime. Starting wizard") } else { Write-Verbose -Message ("Current time is outside of the window specified in " + ` - "DatabaseUpgradeTime, skipping the Configuration Wizard") + "DatabaseUpgradeTime, skipping the Configuration Wizard") return } } else { Write-Verbose -Message ("No DatabaseUpgradeTime specified, Configuration Wizard can be " + ` - "ran at any time. Starting wizard.") + "ran at any time. Starting wizard.") } if ($Ensure -eq "Absent") { Write-Verbose -Message ("Ensure is set to Absent, so running the Configuration " + ` - "Wizard is not required") + "Wizard is not required") return } @@ -201,16 +201,16 @@ function Set-TargetResource # Start wizard Write-Verbose -Message "Starting Configuration Wizard" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $psconfigExe ` - -ScriptBlock { + -Arguments $psconfigExe ` + -ScriptBlock { $psconfigExe = $args[0] $stdOutTempFile = "$env:TEMP\$((New-Guid).Guid)" $psconfig = Start-Process -FilePath $psconfigExe ` - -ArgumentList "-cmd upgrade -inplace b2b -wait -cmd applicationcontent -install -cmd installfeatures -cmd secureresources -cmd services -install" ` - -RedirectStandardOutput $stdOutTempFile ` - -Wait ` - -PassThru + -ArgumentList "-cmd upgrade -inplace b2b -wait -cmd applicationcontent -install -cmd installfeatures -cmd secureresources -cmd services -install" ` + -RedirectStandardOutput $stdOutTempFile ` + -Wait ` + -PassThru $cmdOutput = Get-Content -Path $stdOutTempFile -Raw Remove-Item -Path $stdOutTempFile @@ -227,13 +227,15 @@ function Set-TargetResource # Error codes: https://aka.ms/installerrorcodes switch ($result) { - 0 { + 0 + { Write-Verbose -Message "SharePoint Post Setup Configuration Wizard ran successfully" } - Default { + Default + { throw ("SharePoint Post Setup Configuration Wizard failed, " + ` - "exit code was $result. Error codes can be found at " + ` - "https://aka.ms/installerrorcodes") + "exit code was $result. Error codes can be found at " + ` + "https://aka.ms/installerrorcodes") } } } @@ -251,12 +253,12 @@ function Test-TargetResource $IsSingleInstance, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", [Parameter()] - [ValidateSet("mon","tue","wed","thu","fri","sat","sun")] + [ValidateSet("mon", "tue", "wed", "thu", "fri", "sat", "sun")] [System.String[]] $DatabaseUpgradeDays, @@ -276,7 +278,7 @@ function Test-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message ("Ensure is set to Absent, so running the Configuration Wizard " + ` - "is not required") + "is not required") return $true } @@ -286,8 +288,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.psm1 index 8c0f1674f..2034b5b8b 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.psm1 @@ -29,7 +29,7 @@ function Get-TargetResource $MaximumSiteCount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -41,27 +41,27 @@ function Get-TargetResource Write-Verbose -Message "Getting content database configuration settings" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $cdb = Get-SPDatabase | Where-Object -FilterScript { $_.GetType().FullName -eq "Microsoft.SharePoint.Administration.SPContentDatabase" -and ` - $_.Name -eq $params.Name + $_.Name -eq $params.Name } if ($null -eq $cdb) { # Database does not exist return @{ - Name = $params.Name - DatabaseServer = $params.DatabaseServer - WebAppUrl = $params.WebAppUrl - Enabled = $params.Enabled + Name = $params.Name + DatabaseServer = $params.DatabaseServer + WebAppUrl = $params.WebAppUrl + Enabled = $params.Enabled WarningSiteCount = $params.WarningSiteCount MaximumSiteCount = $params.MaximumSiteCount - Ensure = "Absent" - InstallAccount = $params.InstallAccount + Ensure = "Absent" + InstallAccount = $params.InstallAccount } } else @@ -77,14 +77,14 @@ function Get-TargetResource } $returnVal = @{ - Name = $params.Name - DatabaseServer = $cdb.Server - WebAppUrl = $cdb.WebApplication.Url.Trim("/") - Enabled = $cdbenabled + Name = $params.Name + DatabaseServer = $cdb.Server + WebAppUrl = $cdb.WebApplication.Url.Trim("/") + Enabled = $cdbenabled WarningSiteCount = $cdb.WarningSiteCount MaximumSiteCount = $cdb.MaximumSiteCount - Ensure = "Present" - InstallAccount = $params.InstallAccount + Ensure = "Present" + InstallAccount = $params.InstallAccount } return $returnVal } @@ -124,7 +124,7 @@ function Set-TargetResource $MaximumSiteCount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -136,8 +136,8 @@ function Set-TargetResource Write-Verbose -Message "Setting content database configuration settings" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] # Use Get-SPDatabase instead of Get-SPContentDatabase because the Get-SPContentDatabase @@ -165,8 +165,8 @@ function Set-TargetResource if ($cdb.Server -ne $params.DatabaseServer) { throw ("Specified database server does not match the actual database " + ` - "server. This resource cannot move the database to a different " + ` - "SQL instance.") + "server. This resource cannot move the database to a different " + ` + "SQL instance.") } # Check and change attached web application. @@ -175,7 +175,7 @@ function Set-TargetResource { Dismount-SPContentDatabase $params.Name -Confirm:$false - $newParams= @{} + $newParams = @{ } foreach ($param in $params.GetEnumerator()) { $skipParams = @("Enabled", "Ensure", "InstallAccount", "MaximumSiteCount", "WebAppUrl") @@ -255,9 +255,9 @@ function Set-TargetResource $cdb.Status = [Microsoft.SharePoint.Administration.SPObjectStatus]::Disabled } } - } + } - # Check and change site count settings + # Check and change site count settings if ($null -ne $params.WarningSiteCount -and $params.WarningSiteCount -ne $cdb.WarningSiteCount) { $cdb.WarningSiteCount = $params.WarningSiteCount @@ -271,7 +271,7 @@ function Set-TargetResource else { # Database does not exist, but should. Create/mount database - $newParams= @{} + $newParams = @{ } foreach ($param in $params.GetEnumerator()) { $skipParams = @("Enabled", "Ensure", "InstallAccount", "MaximumSiteCount", "WebAppUrl") @@ -313,7 +313,7 @@ function Set-TargetResource } if ($params.ContainsKey("Enabled") -eq $true -and ` - $params.Enabled -ne $cdbenabled) + $params.Enabled -ne $cdbenabled) { switch ($params.Enabled) { @@ -373,7 +373,7 @@ function Test-TargetResource $MaximumSiteCount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -394,13 +394,13 @@ function Test-TargetResource if ($CurrentValues.DatabaseServer -ne $DatabaseServer) { Write-Verbose -Message ("Specified database server does not match the actual " + ` - "database server. This resource cannot move the database " + ` - "to a different SQL instance.") + "database server. This resource cannot move the database " + ` + "to a different SQL instance.") return $false } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters + -DesiredValues $PSBoundParameters } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.psm1 index 1aedd633e..455abc613 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.psm1 @@ -17,7 +17,7 @@ function Get-TargetResource $FileShare, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -30,19 +30,19 @@ function Get-TargetResource # Check if the April 2014 CU has been installed. The cmdlets have been added in this CU if ((Get-SPDscInstalledProductVersion).FileMajorPart -eq 15 ` - -and (Get-SPDscInstalledProductVersion).FileBuildPart -lt 4605) + -and (Get-SPDscInstalledProductVersion).FileBuildPart -lt 4605) { throw [Exception] ("Adding databases to SQL Always-On Availability Groups " + ` - "require the SharePoint 2013 April 2014 CU to be installed. " + ` - "http://support.microsoft.com/kb/2880551") + "require the SharePoint 2013 April 2014 CU to be installed. " + ` + "http://support.microsoft.com/kb/2880551") } if ($Ensure -eq "Present") { Write-Verbose -Message "Database(s) must be included in AAG $AGName" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments ($PSBoundParameters) ` - -ScriptBlock { + -Arguments ($PSBoundParameters) ` + -ScriptBlock { $params = $args[0] $Ensure = "Present" @@ -76,10 +76,10 @@ function Get-TargetResource } return @{ - DatabaseName = $dbname - AGName = $params.AGName - FileShare = $params.FileShare - Ensure = $Ensure + DatabaseName = $dbname + AGName = $params.AGName + FileShare = $params.FileShare + Ensure = $Ensure InstallAccount = $params.InstallAccount } } @@ -88,8 +88,8 @@ function Get-TargetResource { Write-Verbose -Message "Database(s) must not be included in an AAG $AGName" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $Ensure = "Absent" @@ -116,10 +116,10 @@ function Get-TargetResource } return @{ - DatabaseName = $dbname - AGName = $params.AGName - FileShare = $params.FileShare - Ensure = $Ensure + DatabaseName = $dbname + AGName = $params.AGName + FileShare = $params.FileShare + Ensure = $Ensure InstallAccount = $params.InstallAccount } } @@ -145,7 +145,7 @@ function Set-TargetResource $FileShare, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -158,19 +158,19 @@ function Set-TargetResource # Check if the April 2014 CU has been installed. The cmdlets have been added in this CU if ((Get-SPDscInstalledProductVersion).FileMajorPart -eq 15 ` - -and (Get-SPDscInstalledProductVersion).FileBuildPart -lt 4605) + -and (Get-SPDscInstalledProductVersion).FileBuildPart -lt 4605) { throw [Exception] ("Adding databases to SQL Always-On Availability Groups " + ` - "require the SharePoint 2013 April 2014 CU to be installed. " + ` - "http://support.microsoft.com/kb/2880551") + "require the SharePoint 2013 April 2014 CU to be installed. " + ` + "http://support.microsoft.com/kb/2880551") } if ($Ensure -eq "Present") { Write-Verbose -Message "Checking AAG settings for $DatabaseName" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments ($PSBoundParameters) ` - -ScriptBlock { + -Arguments ($PSBoundParameters) ` + -ScriptBlock { $params = $args[0] $databases = Get-SPDatabase | Where-Object -FilterScript { @@ -188,12 +188,12 @@ function Set-TargetResource { # Remove it from the current AAG first Remove-DatabaseFromAvailabilityGroup -AGName $params.AGName ` - -DatabaseName $database.Name ` - -Force + -DatabaseName $database.Name ` + -Force # Now add it to the AAG it's meant to be in $addParams = @{ - AGName = $params.AGName + AGName = $params.AGName DatabaseName = $database.Name } if ($params.ContainsKey("FileShare")) @@ -207,7 +207,7 @@ function Set-TargetResource { Write-Verbose -Message "Adding $DatabaseName to $AGName" $cmdParams = @{ - AGName = $params.AGName + AGName = $params.AGName DatabaseName = $database.Name } if ($params.ContainsKey("FileShare")) @@ -228,8 +228,8 @@ function Set-TargetResource { Write-Verbose -Message "Removing $DatabaseName from $AGName" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $databases = Get-SPDatabase | Where-Object -FilterScript { @@ -241,8 +241,8 @@ function Set-TargetResource foreach ($database in $databases) { Remove-DatabaseFromAvailabilityGroup -AGName $params.AGName ` - -DatabaseName $database.Name ` - -Force + -DatabaseName $database.Name ` + -Force } } else @@ -272,7 +272,7 @@ function Test-TargetResource $FileShare, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -291,7 +291,7 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure", "DatabaseName") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure", "DatabaseName") } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.psm1 index cc37d6f28..28cf1fdc9 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.psm1 @@ -9,7 +9,7 @@ function Get-TargetResource $WebAppUrl, [Parameter(Mandatory = $true)] - [ValidateSet("WebApplication","SiteCollection")] + [ValidateSet("WebApplication", "SiteCollection")] [System.String] $SettingsScope, @@ -50,22 +50,23 @@ function Get-TargetResource switch ($SettingsScope) { - "WebApplication" { + "WebApplication" + { $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $nullReturn = @{ - WebAppUrl = $params.WebAppUrl - SettingsScope = $params.SettingsScope - AllowSharePointDesigner = $null - AllowDetachPagesFromDefinition = $null - AllowCustomiseMasterPage = $null - AllowManageSiteURLStructure = $null - AllowCreateDeclarativeWorkflow = $null - AllowSavePublishDeclarativeWorkflow = $null - AllowSaveDeclarativeWorkflowAsTemplate = $null + WebAppUrl = $params.WebAppUrl + SettingsScope = $params.SettingsScope + AllowSharePointDesigner = $null + AllowDetachPagesFromDefinition = $null + AllowCustomiseMasterPage = $null + AllowManageSiteURLStructure = $null + AllowCreateDeclarativeWorkflow = $null + AllowSavePublishDeclarativeWorkflow = $null + AllowSaveDeclarativeWorkflowAsTemplate = $null } try @@ -75,7 +76,7 @@ function Get-TargetResource catch { Write-Verbose -Message ("No local SharePoint farm was detected. " + ` - "SharePoint Designer settings will not be applied") + "SharePoint Designer settings will not be applied") return $nullReturn } @@ -86,7 +87,7 @@ function Get-TargetResource if ($null -eq $webapp) { Write-Verbose -Message ("Web application not found. SharePoint Designer " + ` - "settings will not be applied") + "settings will not be applied") return $nullReturn } else @@ -96,41 +97,42 @@ function Get-TargetResource return @{ # Set the SPD settings - WebAppUrl = $params.WebAppUrl - SettingsScope = $params.SettingsScope - AllowSharePointDesigner = $spdSettings.AllowDesigner - AllowDetachPagesFromDefinition = $spdSettings.AllowRevertFromTemplate - AllowCustomiseMasterPage = $spdSettings.AllowMasterPageEditing - AllowManageSiteURLStructure = $spdSettings.ShowURLStructure - AllowCreateDeclarativeWorkflow = ` + WebAppUrl = $params.WebAppUrl + SettingsScope = $params.SettingsScope + AllowSharePointDesigner = $spdSettings.AllowDesigner + AllowDetachPagesFromDefinition = $spdSettings.AllowRevertFromTemplate + AllowCustomiseMasterPage = $spdSettings.AllowMasterPageEditing + AllowManageSiteURLStructure = $spdSettings.ShowURLStructure + AllowCreateDeclarativeWorkflow = ` $spdSettings.AllowCreateDeclarativeWorkflow - AllowSavePublishDeclarativeWorkflow = ` + AllowSavePublishDeclarativeWorkflow = ` $spdSettings.AllowSavePublishDeclarativeWorkflow - AllowSaveDeclarativeWorkflowAsTemplate = ` + AllowSaveDeclarativeWorkflowAsTemplate = ` $spdSettings.AllowSaveDeclarativeWorkflowAsTemplate - InstallAccount = $params.InstallAccount + InstallAccount = $params.InstallAccount } } } } - "SiteCollection" { + "SiteCollection" + { if ((Test-SPDscRunAsCredential -Credential $InstallAccount) -eq $true) { $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $nullReturn = @{ - WebAppUrl = $params.WebAppUrl - SettingsScope = $params.SettingsScope - AllowSharePointDesigner = $null - AllowDetachPagesFromDefinition = $null - AllowCustomiseMasterPage = $null - AllowManageSiteURLStructure = $null - AllowCreateDeclarativeWorkflow = $null - AllowSavePublishDeclarativeWorkflow = $null - AllowSaveDeclarativeWorkflowAsTemplate = $null + WebAppUrl = $params.WebAppUrl + SettingsScope = $params.SettingsScope + AllowSharePointDesigner = $null + AllowDetachPagesFromDefinition = $null + AllowCustomiseMasterPage = $null + AllowManageSiteURLStructure = $null + AllowCreateDeclarativeWorkflow = $null + AllowSavePublishDeclarativeWorkflow = $null + AllowSaveDeclarativeWorkflowAsTemplate = $null } try @@ -140,7 +142,7 @@ function Get-TargetResource catch { Write-Verbose -Message ("No local SharePoint farm was detected. " + ` - "SharePoint Designer settings will not be applied") + "SharePoint Designer settings will not be applied") return $nullReturn } @@ -149,25 +151,25 @@ function Get-TargetResource if ($null -eq $site) { Write-Verbose -Message ("Site collection not found. SharePoint " + ` - "Designer settings will not be applied") + "Designer settings will not be applied") return $nullReturn } else { return @{ # Set the SPD settings - WebAppUrl = $params.WebAppUrl - SettingsScope = $params.SettingsScope - AllowSharePointDesigner = $site.AllowDesigner - AllowDetachPagesFromDefinition = $site.AllowRevertFromTemplate - AllowCustomiseMasterPage = $site.AllowMasterPageEditing - AllowManageSiteURLStructure = $site.ShowURLStructure - AllowCreateDeclarativeWorkflow = $site.AllowCreateDeclarativeWorkflow - AllowSavePublishDeclarativeWorkflow = ` + WebAppUrl = $params.WebAppUrl + SettingsScope = $params.SettingsScope + AllowSharePointDesigner = $site.AllowDesigner + AllowDetachPagesFromDefinition = $site.AllowRevertFromTemplate + AllowCustomiseMasterPage = $site.AllowMasterPageEditing + AllowManageSiteURLStructure = $site.ShowURLStructure + AllowCreateDeclarativeWorkflow = $site.AllowCreateDeclarativeWorkflow + AllowSavePublishDeclarativeWorkflow = ` $site.AllowSavePublishDeclarativeWorkflow - AllowSaveDeclarativeWorkflowAsTemplate = ` + AllowSaveDeclarativeWorkflowAsTemplate = ` $site.AllowSaveDeclarativeWorkflowAsTemplate - InstallAccount = $params.InstallAccount + InstallAccount = $params.InstallAccount } } } @@ -175,8 +177,8 @@ function Get-TargetResource else { throw ("A known issue exists that prevents these settings from being managed " + ` - "when InstallAccount is used instead of PsDscRunAsAccount. See " + ` - "http://aka.ms/xSharePointRemoteIssues for details.") + "when InstallAccount is used instead of PsDscRunAsAccount. See " + ` + "http://aka.ms/xSharePointRemoteIssues for details.") } } } @@ -194,7 +196,7 @@ function Set-TargetResource $WebAppUrl, [Parameter(Mandatory = $true)] - [ValidateSet("WebApplication","SiteCollection")] + [ValidateSet("WebApplication", "SiteCollection")] [System.String] $SettingsScope, @@ -235,10 +237,11 @@ function Set-TargetResource switch ($SettingsScope) { - "WebApplication" { + "WebApplication" + { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -248,7 +251,7 @@ function Set-TargetResource catch { throw ("No local SharePoint farm was detected. SharePoint " + ` - "Designer settings will not be applied") + "Designer settings will not be applied") return } @@ -261,7 +264,7 @@ function Set-TargetResource if ($null -eq $webapp) { throw ("Web application not found. SharePoint Designer settings " + ` - "will not be applied") + "will not be applied") return } else @@ -302,12 +305,13 @@ function Set-TargetResource } } } - "SiteCollection" { + "SiteCollection" + { if ((Test-SPDscRunAsCredential -Credential $InstallAccount) -eq $true) { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -317,7 +321,7 @@ function Set-TargetResource catch { throw ("No local SharePoint farm was detected. SharePoint Designer " + ` - "settings will not be applied") + "settings will not be applied") return } @@ -328,7 +332,7 @@ function Set-TargetResource if ($null -eq $site) { throw ("Site collection not found. SharePoint Designer settings " + ` - "will not be applied") + "will not be applied") return $null } else @@ -363,7 +367,7 @@ function Set-TargetResource if ($params.ContainsKey("AllowSaveDeclarativeWorkflowAsTemplate")) { $site.AllowSaveDeclarativeWorkflowAsTemplate = ` - $params.AllowSaveDeclarativeWorkflowAsTemplate + $params.AllowSaveDeclarativeWorkflowAsTemplate } } } @@ -371,8 +375,8 @@ function Set-TargetResource else { throw ("A known issue exists that prevents these settings from being " + ` - "managed when InstallAccount is used instead of PsDscRunAsAccount. " + ` - "See http://aka.ms/xSharePointRemoteIssues for details.") + "managed when InstallAccount is used instead of PsDscRunAsAccount. " + ` + "See http://aka.ms/xSharePointRemoteIssues for details.") } } } @@ -390,7 +394,7 @@ function Test-TargetResource $WebAppUrl, [Parameter(Mandatory = $true)] - [ValidateSet("WebApplication","SiteCollection")] + [ValidateSet("WebApplication", "SiteCollection")] [System.String] $SettingsScope, @@ -435,7 +439,7 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters + -DesiredValues $PSBoundParameters } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.psm1 index eea7af41f..ccf3b2564 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.psm1 @@ -89,8 +89,8 @@ function Get-TargetResource Write-Verbose -Message "Getting diagnostic configuration settings" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $nullReturn = @{ @@ -239,8 +239,8 @@ function Set-TargetResource Write-Verbose -Message "Setting diagnostic configuration settings" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] if ($params.ContainsKey("IsSingleInstance")) @@ -253,9 +253,9 @@ function Set-TargetResource $params.Remove("InstallAccount") | Out-Null } $params = $params | Rename-SPDscParamValue -oldName "LogPath" ` - -newName "LogLocation" ` - | Rename-SPDscParamValue -oldName "LogSpaceInGB" ` - -newName "LogDiskSpaceUsageGB" + -newName "LogLocation" ` + | Rename-SPDscParamValue -oldName "LogSpaceInGB" ` + -newName "LogDiskSpaceUsageGB" Set-SPDiagnosticConfig @params } @@ -357,7 +357,7 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters + -DesiredValues $PSBoundParameters } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPDiagnosticsProvider/MSFT_SPDiagnosticsProvider.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPDiagnosticsProvider/MSFT_SPDiagnosticsProvider.psm1 index cff65e719..30dd53891 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPDiagnosticsProvider/MSFT_SPDiagnosticsProvider.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPDiagnosticsProvider/MSFT_SPDiagnosticsProvider.psm1 @@ -25,7 +25,7 @@ function Get-TargetResource $InstallAccount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present" ) @@ -33,18 +33,18 @@ function Get-TargetResource Write-Verbose -Message "Getting the Diagnostics Provider" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] - $diagnosticProvider = Get-SPDiagnosticsProvider | Where-Object {$_.Name -eq $params.Name} + $diagnosticProvider = Get-SPDiagnosticsProvider | Where-Object { $_.Name -eq $params.Name } $nullReturn = @{ - Name = $params.Name - Retention = $params.Retention + Name = $params.Name + Retention = $params.Retention MaxTotalSizeInBytes = $params.MaxTotalSizeInBytes - Enabled = $params.Enabled - Ensure = "Absent" - InstallAccount = $params.InstallAccount + Enabled = $params.Enabled + Ensure = "Absent" + InstallAccount = $params.InstallAccount } if ($null -eq $diagnosticProvider) { @@ -52,12 +52,12 @@ function Get-TargetResource } return @{ - Name = $diagnosticProvider.Name - Retention = $diagnosticProvider.Retention + Name = $diagnosticProvider.Name + Retention = $diagnosticProvider.Retention MaxTotalSizeInBytes = $diagnosticProvider.MaxTotalSizeInBytes - Enabled = $diagnosticProvider.Enabled - Ensure = "Present" - InstallAccount = $params.InstallAccount + Enabled = $diagnosticProvider.Enabled + Ensure = "Present" + InstallAccount = $params.InstallAccount } } return $result @@ -89,7 +89,7 @@ function Set-TargetResource $InstallAccount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present" ) @@ -102,10 +102,10 @@ function Set-TargetResource } Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] - $diagnosticProvider = Get-SPDiagnosticsProvider | Where-Object {$_.Name -eq $params.Name} + $diagnosticProvider = Get-SPDiagnosticsProvider | Where-Object { $_.Name -eq $params.Name } if ($null -eq $diagnosticProvider) { @@ -162,7 +162,7 @@ function Test-TargetResource $InstallAccount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present" ) @@ -177,12 +177,12 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure", - "Name", - "Retention", - "MaxTotalSizeInBytes", - "Enabled") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure", + "Name", + "Retention", + "MaxTotalSizeInBytes", + "Enabled") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.psm1 index aceba7bfa..a629568de 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.psm1 @@ -216,17 +216,17 @@ function Get-TargetResource if ($installedVersion.FileMajorPart -eq 15) { throw ("The following parameters are only supported in SharePoint 2016 and above: " + ` - "DFLTCMaxConnectionsToServer, DFLTCRequestTimeout, DFLTCChannelOpenTimeOut, " + ` - "DSWUCMaxConnectionsToServer, DSWUCRequestTimeout, DSWUCChannelOpenTimeOut, " + ` - "DUGCMaxConnectionsToServer, DUGCRequestTimeout, DUGCChannelOpenTimeOut, " + ` - "DRTCMaxConnectionsToServer, DRTCRequestTimeout, DRTCChannelOpenTimeOut, " + ` - "DHSCMaxConnectionsToServer, DHSCRequestTimeout and DHSCChannelOpenTimeOut") + "DFLTCMaxConnectionsToServer, DFLTCRequestTimeout, DFLTCChannelOpenTimeOut, " + ` + "DSWUCMaxConnectionsToServer, DSWUCRequestTimeout, DSWUCChannelOpenTimeOut, " + ` + "DUGCMaxConnectionsToServer, DUGCRequestTimeout, DUGCChannelOpenTimeOut, " + ` + "DRTCMaxConnectionsToServer, DRTCRequestTimeout, DRTCChannelOpenTimeOut, " + ` + "DHSCMaxConnectionsToServer, DHSCRequestTimeout and DHSCChannelOpenTimeOut") } } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $nullReturnValue = @{ @@ -573,17 +573,17 @@ function Set-TargetResource if ($installedVersion.FileMajorPart -eq 15) { throw ("The following parameters are only supported in SharePoint 2016 and above: " + ` - "DFLTCMaxConnectionsToServer, DFLTCRequestTimeout, DFLTCChannelOpenTimeOut, " + ` - "DSWUCMaxConnectionsToServer, DSWUCRequestTimeout, DSWUCChannelOpenTimeOut, " + ` - "DUGCMaxConnectionsToServer, DUGCRequestTimeout, DUGCChannelOpenTimeOut, " + ` - "DRTCMaxConnectionsToServer, DRTCRequestTimeout, DRTCChannelOpenTimeOut, " + ` - "DHSCMaxConnectionsToServer, DHSCRequestTimeout and DHSCChannelOpenTimeOut") + "DFLTCMaxConnectionsToServer, DFLTCRequestTimeout, DFLTCChannelOpenTimeOut, " + ` + "DSWUCMaxConnectionsToServer, DSWUCRequestTimeout, DSWUCChannelOpenTimeOut, " + ` + "DUGCMaxConnectionsToServer, DUGCRequestTimeout, DUGCChannelOpenTimeOut, " + ` + "DRTCMaxConnectionsToServer, DRTCRequestTimeout, DRTCChannelOpenTimeOut, " + ` + "DHSCMaxConnectionsToServer, DHSCRequestTimeout and DHSCChannelOpenTimeOut") } } Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] #DistributedLogonTokenCache @@ -1038,53 +1038,53 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("DLTCMaxConnectionsToServer", - "DLTCRequestTimeout", - "DLTCChannelOpenTimeOut", - "DVSCMaxConnectionsToServer", - "DVSCRequestTimeout", - "DVSCChannelOpenTimeOut", - "DACMaxConnectionsToServer", - "DACRequestTimeout", - "DACChannelOpenTimeOut", - "DAFMaxConnectionsToServer", - "DAFRequestTimeout", - "DAFChannelOpenTimeOut", - "DAFCMaxConnectionsToServer", - "DAFCRequestTimeout", - "DAFCChannelOpenTimeOut", - "DBCMaxConnectionsToServer", - "DBCRequestTimeout", - "DBCChannelOpenTimeOut", - "DDCMaxConnectionsToServer", - "DDCRequestTimeout", - "DDCChannelOpenTimeOut", - "DSCMaxConnectionsToServer", - "DSCRequestTimeout", - "DSCChannelOpenTimeOut", - "DTCMaxConnectionsToServer", - "DTCRequestTimeout", - "DTCChannelOpenTimeOut", - "DSTACMaxConnectionsToServer", - "DSTACRequestTimeout", - "DSTACChannelOpenTimeOut", - "DFLTCMaxConnectionsToServer", - "DFLTCRequestTimeout", - "DFLTCChannelOpenTimeOut", - "DSWUCMaxConnectionsToServer", - "DSWUCRequestTimeout", - "DSWUCChannelOpenTimeOut", - "DUGCMaxConnectionsToServer", - "DUGCRequestTimeout", - "DUGCChannelOpenTimeOut", - "DRTCMaxConnectionsToServer", - "DRTCRequestTimeout", - "DRTCChannelOpenTimeOut", - "DHSCMaxConnectionsToServer", - "DHSCRequestTimeout", - "DHSCChannelOpenTimeOut" - ) + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("DLTCMaxConnectionsToServer", + "DLTCRequestTimeout", + "DLTCChannelOpenTimeOut", + "DVSCMaxConnectionsToServer", + "DVSCRequestTimeout", + "DVSCChannelOpenTimeOut", + "DACMaxConnectionsToServer", + "DACRequestTimeout", + "DACChannelOpenTimeOut", + "DAFMaxConnectionsToServer", + "DAFRequestTimeout", + "DAFChannelOpenTimeOut", + "DAFCMaxConnectionsToServer", + "DAFCRequestTimeout", + "DAFCChannelOpenTimeOut", + "DBCMaxConnectionsToServer", + "DBCRequestTimeout", + "DBCChannelOpenTimeOut", + "DDCMaxConnectionsToServer", + "DDCRequestTimeout", + "DDCChannelOpenTimeOut", + "DSCMaxConnectionsToServer", + "DSCRequestTimeout", + "DSCChannelOpenTimeOut", + "DTCMaxConnectionsToServer", + "DTCRequestTimeout", + "DTCChannelOpenTimeOut", + "DSTACMaxConnectionsToServer", + "DSTACRequestTimeout", + "DSTACChannelOpenTimeOut", + "DFLTCMaxConnectionsToServer", + "DFLTCRequestTimeout", + "DFLTCChannelOpenTimeOut", + "DSWUCMaxConnectionsToServer", + "DSWUCRequestTimeout", + "DSWUCChannelOpenTimeOut", + "DUGCMaxConnectionsToServer", + "DUGCRequestTimeout", + "DUGCChannelOpenTimeOut", + "DRTCMaxConnectionsToServer", + "DRTCRequestTimeout", + "DRTCChannelOpenTimeOut", + "DHSCMaxConnectionsToServer", + "DHSCRequestTimeout", + "DHSCChannelOpenTimeOut" + ) } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.psm1 index 60faa8020..a313f415f 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.psm1 @@ -21,7 +21,7 @@ function Get-TargetResource $CreateFirewallRules, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -37,8 +37,8 @@ function Get-TargetResource Write-Verbose -Message "Getting the cache host information" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $nullReturnValue = @{ Name = $params.Name @@ -57,15 +57,15 @@ function Get-TargetResource } $computerName = ([System.Net.Dns]::GetHostByName($env:computerName)).HostName $cachePort = ($cacheHost | Where-Object -FilterScript { - $_.HostName -eq $computerName - }).PortNo + $_.HostName -eq $computerName + }).PortNo $cacheHostConfig = Get-AFCacheHostConfiguration -ComputerName $computerName ` - -CachePort $cachePort ` - -ErrorAction SilentlyContinue + -CachePort $cachePort ` + -ErrorAction SilentlyContinue $windowsService = Get-CimInstance -Class Win32_Service -Filter "Name='AppFabricCachingService'" $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distributed Cache" ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue return @{ Name = $params.Name @@ -108,7 +108,7 @@ function Set-TargetResource $CreateFirewallRules, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -134,29 +134,29 @@ function Set-TargetResource Invoke-SPDscCommand -Credential $InstallAccount -ScriptBlock { $icmpRuleName = "File and Printer Sharing (Echo Request - ICMPv4-In)" $icmpFirewallRule = Get-NetFirewallRule -DisplayName $icmpRuleName ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $icmpFirewallRule ) { New-NetFirewallRule -Name Allow_Ping -DisplayName $icmpRuleName ` - -Description "Allow ICMPv4 ping" ` - -Protocol ICMPv4 ` - -IcmpType 8 ` - -Enabled True ` - -Profile Any ` - -Action Allow + -Description "Allow ICMPv4 ping" ` + -Protocol ICMPv4 ` + -IcmpType 8 ` + -Enabled True ` + -Profile Any ` + -Action Allow } Enable-NetFirewallRule -DisplayName $icmpRuleName $spRuleName = "SharePoint Distributed Cache" $firewallRule = Get-NetFirewallRule -DisplayName $spRuleName ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $firewallRule) { New-NetFirewallRule -Name "SPDistCache" ` - -DisplayName $spRuleName ` - -Protocol TCP ` - -LocalPort 22233-22236 ` - -Group "SharePoint" + -DisplayName $spRuleName ` + -Protocol TCP ` + -LocalPort 22233-22236 ` + -Group "SharePoint" } Enable-NetFirewallRule -DisplayName $spRuleName } @@ -164,14 +164,14 @@ function Set-TargetResource } Write-Verbose -Message ("Current state is '$($CurrentState.Ensure)' " + ` - "and desired state is '$Ensure'") + "and desired state is '$Ensure'") if ($CurrentState.Ensure -ne $Ensure) { Write-Verbose -Message "Enabling distributed cache service" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] if ($params.ContainsKey("ServerProvisionOrder")) @@ -187,8 +187,8 @@ function Set-TargetResource # Attempt to see if we can find the service with just the computer # name, or if we need to use the FQDN $si = Get-SPServiceInstance -Server $currentServer ` - | Where-Object -FilterScript { - $_.GetType().Name -eq "SPDistributedCacheServiceInstance" + | Where-Object -FilterScript { + $_.GetType().Name -eq "SPDistributedCacheServiceInstance" } if ($null -eq $si) @@ -199,38 +199,38 @@ function Set-TargetResource Write-Verbose "Waiting for cache on $currentServer" $serviceCheck = Get-SPServiceInstance -Server $currentServer ` - | Where-Object -FilterScript { - $_.GetType().Name -eq "SPDistributedCacheServiceInstance" -and ` + | Where-Object -FilterScript { + $_.GetType().Name -eq "SPDistributedCacheServiceInstance" -and ` $_.Status -eq "Online" } while (($count -lt $maxCount) -and ($null -eq $serviceCheck)) { Write-Verbose -Message ("$([DateTime]::Now.ToShortTimeString()) - " + ` - "Waiting for distributed cache to start " + ` - "on $currentServer (waited $count of " + ` - "$maxCount minutes)") + "Waiting for distributed cache to start " + ` + "on $currentServer (waited $count of " + ` + "$maxCount minutes)") Start-Sleep -Seconds 60 $serviceCheck = Get-SPServiceInstance -Server $currentServer ` - | Where-Object -FilterScript { - $_.GetType().Name -eq "SPDistributedCacheServiceInstance" -and ` + | Where-Object -FilterScript { + $_.GetType().Name -eq "SPDistributedCacheServiceInstance" -and ` $_.Status -eq "Online" } $count++ } $serviceCheck = Get-SPServiceInstance -Server $currentServer ` - | Where-Object -FilterScript { - $_.GetType().Name -eq "SPDistributedCacheServiceInstance" ` - -and $_.Status -eq "Online" - } + | Where-Object -FilterScript { + $_.GetType().Name -eq "SPDistributedCacheServiceInstance" ` + -and $_.Status -eq "Online" + } if ($null -eq $serviceCheck) { Write-Warning -Message ("Server $currentServer is not running " + ` - "distributed cache after waiting 30 " + ` - "minutes. No longer waiting for this " + ` - "server, progressing to next action") + "distributed cache after waiting 30 " + ` + "minutes. No longer waiting for this " + ` + "server, progressing to next action") } $serverCount++ @@ -238,7 +238,7 @@ function Set-TargetResource if ($ServerCount -ge $params.ServerProvisionOrder.Length) { throw ("The server $($env:COMPUTERNAME) was not found in the " + ` - "array for distributed cache servers") + "array for distributed cache servers") } $currentServer = $params.ServerProvisionOrder[$serverCount] } @@ -264,18 +264,18 @@ function Set-TargetResource $serviceCheck = Get-SPServiceInstance | Where-Object -FilterScript { $_.GetType().Name -eq "SPDistributedCacheServiceInstance" -and ` - $_.Status -ne "Disabled" + $_.Status -ne "Disabled" } while (($count -lt $maxCount) -and ($null -ne $serviceCheck)) { Write-Verbose -Message ("$([DateTime]::Now.ToShortTimeString()) - Waiting " + ` - "for distributed cache to stop on all servers " + ` - "(waited $count of $maxCount minutes)") + "for distributed cache to stop on all servers " + ` + "(waited $count of $maxCount minutes)") Start-Sleep -Seconds 60 $serviceCheck = Get-SPServiceInstance | Where-Object -FilterScript { $_.GetType().Name -eq "SPDistributedCacheServiceInstance" -and ` - $_.Status -ne "Disabled" + $_.Status -ne "Disabled" } $count++ } @@ -291,18 +291,18 @@ function Set-TargetResource $serviceCheck = Get-SPServiceInstance | Where-Object -FilterScript { $_.GetType().Name -eq "SPDistributedCacheServiceInstance" -and ` - $_.Status -ne "Online" + $_.Status -ne "Online" } while (($count -lt $maxCount) -and ($null -ne $serviceCheck)) { Write-Verbose -Message ("$([DateTime]::Now.ToShortTimeString()) - Waiting " + ` - "for distributed cache to start on all servers " + ` - "(waited $count of $maxCount minutes)") + "for distributed cache to start on all servers " + ` + "(waited $count of $maxCount minutes)") Start-Sleep -Seconds 60 $serviceCheck = Get-SPServiceInstance | Where-Object -FilterScript { $_.GetType().Name -eq "SPDistributedCacheServiceInstance" -and ` - $_.Status -ne "Online" + $_.Status -ne "Online" } $count++ } @@ -326,7 +326,7 @@ function Set-TargetResource { # In SharePoint 2019, ProcessIdentity.Deploy() may throw an exception Write-Verbose -Message ("An error has occurred while updating the " + ` - "ServiceAccount. The change will be retried.") + "ServiceAccount. The change will be retried.") } } } @@ -336,8 +336,8 @@ function Set-TargetResource if ($CurrentState.ServiceAccount -ne $ServiceAccount.UserName) { Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $farm = Get-SPFarm $cacheService = $farm.Services | Where-Object -FilterScript { @@ -358,7 +358,7 @@ function Set-TargetResource { # In SharePoint 2019, ProcessIdentity.Deploy() may throw an exception Write-Verbose -Message ("An error has occurred while updating the " + ` - "ServiceAccount. The change will be retried.") + "ServiceAccount. The change will be retried.") } } } @@ -368,8 +368,8 @@ function Set-TargetResource { Write-Verbose -Message "Updating distributed cache service cache size" Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] Get-SPServiceInstance | Where-Object -FilterScript { @@ -381,18 +381,18 @@ function Set-TargetResource $serviceCheck = Get-SPServiceInstance | Where-Object -FilterScript { $_.GetType().Name -eq "SPDistributedCacheServiceInstance" -and ` - $_.Status -ne "Disabled" + $_.Status -ne "Disabled" } while (($count -lt $maxCount) -and ($null -ne $serviceCheck)) { Write-Verbose -Message ("$([DateTime]::Now.ToShortTimeString()) - Waiting " + ` - "for distributed cache to stop on all servers " + ` - "(waited $count of $maxCount minutes)") + "for distributed cache to stop on all servers " + ` + "(waited $count of $maxCount minutes)") Start-Sleep -Seconds 60 $serviceCheck = Get-SPServiceInstance | Where-Object -FilterScript { $_.GetType().Name -eq "SPDistributedCacheServiceInstance" -and ` - $_.Status -ne "Disabled" + $_.Status -ne "Disabled" } $count++ } @@ -408,18 +408,18 @@ function Set-TargetResource $serviceCheck = Get-SPServiceInstance | Where-Object -FilterScript { $_.GetType().Name -eq "SPDistributedCacheServiceInstance" -and ` - $_.Status -ne "Online" + $_.Status -ne "Online" } while (($count -lt $maxCount) -and ($null -ne $serviceCheck)) { Write-Verbose -Message ("$([DateTime]::Now.ToShortTimeString()) - Waiting " + ` - "for distributed cache to start on all servers " + ` - "(waited $count of $maxCount minutes)") + "for distributed cache to start on all servers " + ` + "(waited $count of $maxCount minutes)") Start-Sleep -Seconds 60 $serviceCheck = Get-SPServiceInstance | Where-Object -FilterScript { $_.GetType().Name -eq "SPDistributedCacheServiceInstance" -and ` - $_.Status -ne "Online" + $_.Status -ne "Online" } $count++ } @@ -434,8 +434,8 @@ function Set-TargetResource Remove-SPDistributedCacheServiceInstance $serviceInstance = Get-SPServiceInstance -Server $env:computername ` - | Where-Object -FilterScript { - $_.GetType().Name -eq "SPDistributedCacheServiceInstance" + | Where-Object -FilterScript { + $_.GetType().Name -eq "SPDistributedCacheServiceInstance" } if ($null -eq $serviceInstance) @@ -443,8 +443,8 @@ function Set-TargetResource $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain $currentServer = "$($env:computername).$domain" $serviceInstance = Get-SPServiceInstance -Server $currentServer ` - | Where-Object -FilterScript { - $_.GetType().Name -eq "SPDistributedCacheServiceInstance" + | Where-Object -FilterScript { + $_.GetType().Name -eq "SPDistributedCacheServiceInstance" } } if ($null -ne $serviceInstance) @@ -456,7 +456,7 @@ function Set-TargetResource { Invoke-SPDscCommand -Credential $InstallAccount -ScriptBlock { $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distribute Cache" ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -ne $firewallRule) { Write-Verbose -Message "Disabling firewall rules." @@ -491,7 +491,7 @@ function Test-TargetResource $CreateFirewallRules, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -524,16 +524,16 @@ function Test-TargetResource } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure", ` - "CreateFirewallRules", ` - "CacheSizeInMB") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure", ` + "CreateFirewallRules", ` + "CacheSizeInMB") } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.psm1 index c7da97bd0..5ccaa4683 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.psm1 @@ -27,7 +27,7 @@ $Script:ServiceAppObjectType = "Microsoft.Office.Excel.Server.MossHost.ExcelServ function Get-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Collections.Hashtable])] param ( [Parameter(Mandatory = $true)] @@ -51,7 +51,7 @@ function Get-TargetResource $CrossDomainAccessAllowed, [Parameter()] - [ValidateSet("None","Connection")] + [ValidateSet("None", "Connection")] [System.String] $EncryptedUserConnectionRequired, @@ -60,12 +60,12 @@ function Get-TargetResource $ExternalDataConnectionLifetime, [Parameter()] - [ValidateSet("UseImpersonation","UseFileAccessAccount")] + [ValidateSet("UseImpersonation", "UseFileAccessAccount")] [System.String] $FileAccessMethod, [Parameter()] - [ValidateSet("RoundRobin","Local","WorkbookURL")] + [ValidateSet("RoundRobin", "Local", "WorkbookURL")] [System.String] $LoadBalancingScheme, @@ -110,7 +110,7 @@ function Get-TargetResource $WorkbookCacheSizeMax, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -124,20 +124,20 @@ function Get-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -ne 15) { throw [Exception] ("Only SharePoint 2013 is supported to deploy Excel Services " + ` - "service applications via DSC, as SharePoint 2016 and SharePoint 2019 deprecated " + ` - "this service. See " + ` - "https://technet.microsoft.com/en-us/library/mt346112(v=office.16).aspx " + ` - "for more info.") + "service applications via DSC, as SharePoint 2016 and SharePoint 2019 deprecated " + ` + "this service. See " + ` + "https://technet.microsoft.com/en-us/library/mt346112(v=office.16).aspx " + ` + "for more info.") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $Script:ServiceAppObjectType) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $Script:ServiceAppObjectType) ` + -ScriptBlock { $params = $args[0] $serviceAppObjectType = $args[1] $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $nullReturn = @{ Name = $params.Name ApplicationPool = $params.ApplicationPool @@ -187,7 +187,7 @@ function Get-TargetResource } } - $returnVal = @{ + $returnVal = @{ Name = $serviceApp.DisplayName ApplicationPool = $serviceApp.ApplicationPool.Name Ensure = "Present" @@ -219,7 +219,7 @@ function Get-TargetResource function Set-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] param ( [Parameter(Mandatory = $true)] @@ -243,7 +243,7 @@ function Set-TargetResource $CrossDomainAccessAllowed, [Parameter()] - [ValidateSet("None","Connection")] + [ValidateSet("None", "Connection")] [System.String] $EncryptedUserConnectionRequired, @@ -252,12 +252,12 @@ function Set-TargetResource $ExternalDataConnectionLifetime, [Parameter()] - [ValidateSet("UseImpersonation","UseFileAccessAccount")] + [ValidateSet("UseImpersonation", "UseFileAccessAccount")] [System.String] $FileAccessMethod, [Parameter()] - [ValidateSet("RoundRobin","Local","WorkbookURL")] + [ValidateSet("RoundRobin", "Local", "WorkbookURL")] [System.String] $LoadBalancingScheme, @@ -302,7 +302,7 @@ function Set-TargetResource $WorkbookCacheSizeMax, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -316,10 +316,10 @@ function Set-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -ne 15) { throw [Exception] ("Only SharePoint 2013 is supported to deploy Excel Services " + ` - "service applications via DSC, as SharePoint 2016 and SharePoint 2019 are deprecated " + ` - "this service. See " + ` - "https://technet.microsoft.com/en-us/library/mt346112(v=office.16).aspx " + ` - "for more info.") + "service applications via DSC, as SharePoint 2016 and SharePoint 2019 are deprecated " + ` + "this service. See " + ` + "https://technet.microsoft.com/en-us/library/mt346112(v=office.16).aspx " + ` + "for more info.") } $result = Get-TargetResource @PSBoundParameters @@ -327,13 +327,13 @@ function Set-TargetResource { Write-Verbose -Message "Creating Excel Services Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] New-SPExcelServiceApplication -Name $params.Name ` - -ApplicationPool $params.ApplicationPool ` - -Default + -ApplicationPool $params.ApplicationPool ` + -Default } } @@ -341,20 +341,20 @@ function Set-TargetResource { Write-Verbose -Message "Updating settings for Excel Services Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $params.Add("Identity", $params.Name) # Remove parameters that do not belong on the set method @("InstallAccount", "Ensure", "TrustedFileLocations", "Name", "ApplicationPool") | - ForEach-Object -Process { - if ($params.ContainsKey($_) -eq $true) - { - $params.Remove($_) | Out-Null - } + ForEach-Object -Process { + if ($params.ContainsKey($_) -eq $true) + { + $params.Remove($_) | Out-Null } + } Set-SPExcelServiceApplication @params } @@ -372,14 +372,14 @@ function Set-TargetResource { Write-Verbose -Message "Adding trusted location '$($desiredLocation.Address)' to service app" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $desiredLocation, $Script:TrustLocationProperties, $Script:ServiceAppObjectType) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $desiredLocation, $Script:TrustLocationProperties, $Script:ServiceAppObjectType) ` + -ScriptBlock { $params = $args[0] $desiredLocation = $args[1] $trustLocationProperties = $args[2] - $serviceAppObjectType = $args[3] + $serviceAppObjectType = $args[3] - $newArgs = @{} + $newArgs = @{ } $trustLocationProperties | ForEach-Object -Process { if ($null -ne $desiredLocation.$_) { @@ -398,14 +398,14 @@ function Set-TargetResource { Write-Verbose -Message "Updating trusted location '$($desiredLocation.Address)' in service app" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $desiredLocation, $Script:TrustLocationProperties, $Script:ServiceAppObjectType) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $desiredLocation, $Script:TrustLocationProperties, $Script:ServiceAppObjectType) ` + -ScriptBlock { $params = $args[0] $desiredLocation = $args[1] $trustLocationProperties = $args[2] - $serviceAppObjectType = $args[3] + $serviceAppObjectType = $args[3] - $updateArgs = @{} + $updateArgs = @{ } $trustLocationProperties | ForEach-Object -Process { if ($null -ne $desiredLocation.$_) { @@ -433,8 +433,8 @@ function Set-TargetResource { Write-Verbose -Message "Removing trusted location '$($currentLocation.Address)' from service app" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($Name, $currentLocation) ` - -ScriptBlock { + -Arguments @($Name, $currentLocation) ` + -ScriptBlock { $name = $args[0] $currentLocation = $args[1] @@ -449,12 +449,12 @@ function Set-TargetResource { Write-Verbose -Message "Removing Excel Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $Script:ServiceAppObjectType) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $Script:ServiceAppObjectType) ` + -ScriptBlock { $params = $args[0] $serviceAppObjectType = $args[1] - $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { + $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { $_.GetType().FullName -eq $serviceAppObjectType } @@ -475,7 +475,7 @@ function Set-TargetResource function Test-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Boolean])] param ( @@ -500,7 +500,7 @@ function Test-TargetResource $CrossDomainAccessAllowed, [Parameter()] - [ValidateSet("None","Connection")] + [ValidateSet("None", "Connection")] [System.String] $EncryptedUserConnectionRequired, @@ -509,12 +509,12 @@ function Test-TargetResource $ExternalDataConnectionLifetime, [Parameter()] - [ValidateSet("UseImpersonation","UseFileAccessAccount")] + [ValidateSet("UseImpersonation", "UseFileAccessAccount")] [System.String] $FileAccessMethod, [Parameter()] - [ValidateSet("RoundRobin","Local","WorkbookURL")] + [ValidateSet("RoundRobin", "Local", "WorkbookURL")] [System.String] $LoadBalancingScheme, @@ -559,7 +559,7 @@ function Test-TargetResource $WorkbookCacheSizeMax, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -575,10 +575,10 @@ function Test-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -ne 15) { throw [Exception] ("Only SharePoint 2013 is supported to deploy Excel Services " + ` - "service applications via DSC, as SharePoint 2016 and SharePoint 2019 are deprecated " + ` - "this service. See " + ` - "https://technet.microsoft.com/en-us/library/mt346112(v=office.16).aspx " + ` - "for more info.") + "service applications via DSC, as SharePoint 2016 and SharePoint 2019 are deprecated " + ` + "this service. See " + ` + "https://technet.microsoft.com/en-us/library/mt346112(v=office.16).aspx " + ` + "for more info.") } $CurrentValues = Get-TargetResource @PSBoundParameters @@ -587,26 +587,26 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" $mainCheck = Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @( - "Ensure", - "CachingOfUnusedFilesEnable", - "CrossDomainAccessAllowed", - "EncryptedUserConnectionRequired", - "ExternalDataConnectionLifetime", - "FileAccessMethod", - "LoadBalancingScheme", - "MemoryCacheThreshold", - "PrivateBytesMax", - "SessionsPerUserMax", - "SiteCollectionAnonymousSessionsMax", - "TerminateProcessOnAccessViolation", - "ThrottleAccessViolationsPerSiteCollection", - "UnattendedAccountApplicationId", - "UnusedObjectAgeMax", - "WorkbookCache", - "WorkbookCacheSizeMax" - ) + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @( + "Ensure", + "CachingOfUnusedFilesEnable", + "CrossDomainAccessAllowed", + "EncryptedUserConnectionRequired", + "ExternalDataConnectionLifetime", + "FileAccessMethod", + "LoadBalancingScheme", + "MemoryCacheThreshold", + "PrivateBytesMax", + "SessionsPerUserMax", + "SiteCollectionAnonymousSessionsMax", + "TerminateProcessOnAccessViolation", + "ThrottleAccessViolationsPerSiteCollection", + "UnattendedAccountApplicationId", + "UnusedObjectAgeMax", + "WorkbookCache", + "WorkbookCacheSizeMax" + ) if ($Ensure -eq "Present" -and $mainCheck -eq $true -and $null -ne $TrustedFileLocations) @@ -620,7 +620,7 @@ function Test-TargetResource if ($null -eq $matchingCurrentValue) { Write-Verbose -Message ("Trusted file location '$($_.Address)' was not found " + ` - "in the Excel service app. Desired state is false.") + "in the Excel service app. Desired state is false.") return $false } else @@ -631,9 +631,9 @@ function Test-TargetResource if ($desiredLocation.$_ -ne $matchingCurrentValue.$_) { Write-Verbose -Message ("Trusted file location '$($desiredLocation.Address)' did not match " + ` - "desired property '$_'. Desired value is " + ` - "'$($desiredLocation.$_)' but the current value is " + ` - "'$($matchingCurrentValue.$_)'") + "desired property '$_'. Desired value is " + ` + "'$($desiredLocation.$_)' but the current value is " + ` + "'$($matchingCurrentValue.$_)'") return $false } } @@ -655,8 +655,8 @@ function Test-TargetResource if ($null -eq $matchingDesiredValue) { Write-Verbose -Message ("Existing trusted file location '$($_.Address)' was not " + ` - "found in the desired state for this service " + ` - "application. Desired state is false.") + "found in the desired state for this service " + ` + "application. Desired state is false.") return $false } return $true diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 index 2b4e18345..e0d06610f 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 @@ -10,7 +10,7 @@ function Get-TargetResource $IsSingleInstance, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -48,24 +48,24 @@ function Get-TargetResource [Parameter()] [System.String] - [ValidateSet("NTLM","Kerberos")] + [ValidateSet("NTLM", "Kerberos")] $CentralAdministrationAuth, [Parameter()] [System.String] [ValidateSet("Application", - "ApplicationWithSearch", - "Custom", - "DistributedCache", - "Search", - "SingleServer", - "SingleServerFarm", - "WebFrontEnd", - "WebFrontEndWithDistributedCache")] + "ApplicationWithSearch", + "Custom", + "DistributedCache", + "Search", + "SingleServer", + "SingleServerFarm", + "WebFrontEnd", + "WebFrontEndWithDistributedCache")] $ServerRole, [Parameter()] - [ValidateSet("Off","On","OnDemand")] + [ValidateSet("Off", "On", "OnDemand")] [System.String] $DeveloperDashboard, @@ -82,7 +82,7 @@ function Get-TargetResource if ($CentralAdministrationPort -notin 1..65535) { throw ("An invalid value for CentralAdministrationPort is specified: " + ` - "$CentralAdministrationPort") + "$CentralAdministrationPort") } } @@ -91,43 +91,48 @@ function Get-TargetResource $uri = $CentralAdministrationUrl -as [System.Uri] if ($null -eq $uri.AbsoluteUri) { - throw "CentralAdministrationUrl is not a valid URI. It should include the scheme (http/https) and address." + Write-Verbose -Message ("CentralAdministrationUrl is not a valid URI. It should " + ` + "include the scheme (http/https) and address.") } if ($uri.scheme -ne 'https') { - throw "Currently, the CentralAdministrationUrl parameter can only be used with HTTPS. To provision CA on " + ` - "HTTP, omit the CentralAdministrationUrl parameter to provision CA on http://servername:port." + Write-Verbose -Message ("Currently, the CentralAdministrationUrl parameter can only " + ` + "be used with HTTPS. To provision CA on HTTP, omit the CentralAdministrationUrl " + ` + "parameter to provision CA on http://servername:port.") } if ($CentralAdministrationUrl -match ':\d+') { - throw "CentralAdministrationUrl should not specify port. Use CentralAdministrationPort instead." + Write-Verbose -Message ("CentralAdministrationUrl should not specify port. Use " + ` + "CentralAdministrationPort instead.") } } if ($Ensure -eq "Absent") { throw ("SharePointDsc does not support removing a server from a farm, please set the " + ` - "ensure property to 'present'") + "ensure property to 'present'") } $installedVersion = Get-SPDscInstalledProductVersion switch ($installedVersion.FileMajorPart) { - 15 { + 15 + { Write-Verbose -Message "Detected installation of SharePoint 2013" } - 16 { + 16 + { if ($DeveloperDashboard -eq "OnDemand") { throw ("The DeveloperDashboard value 'OnDemand' is not allowed in SharePoint " + ` - "2016 and 2019") + "2016 and 2019") } if ($DeveloperDashboard -eq "On") { Write-Verbose -Message ("Please make sure you also provision the Usage and Health " + ` - "service application to make sure the Developer Dashboard " + ` - "works properly") + "service application to make sure the Developer Dashboard " + ` + "works properly") } if ($installedVersion.ProductBuildPart.ToString().Length -eq 4) @@ -139,42 +144,43 @@ function Get-TargetResource Write-Verbose -Message "Detected installation of SharePoint 2019" } } - default { + default + { throw ("Detected an unsupported major version of SharePoint. SharePointDsc only " + ` - "supports SharePoint 2013, 2016 or 2019.") + "supports SharePoint 2013, 2016 or 2019.") } } if (($PSBoundParameters.ContainsKey("ServerRole") -eq $true) ` - -and $installedVersion.FileMajorPart -ne 16) + -and $installedVersion.FileMajorPart -ne 16) { throw [Exception] "Server role is only supported in SharePoint 2016 and 2019." } if (($PSBoundParameters.ContainsKey("ServerRole") -eq $true) ` - -and $installedVersion.FileMajorPart -eq 16 ` - -and $installedVersion.FileBuildPart -lt 4456 ` - -and ($ServerRole -eq "ApplicationWithSearch" ` - -or $ServerRole -eq "WebFrontEndWithDistributedCache")) + -and $installedVersion.FileMajorPart -eq 16 ` + -and $installedVersion.FileBuildPart -lt 4456 ` + -and ($ServerRole -eq "ApplicationWithSearch" ` + -or $ServerRole -eq "WebFrontEndWithDistributedCache")) { throw [Exception] ("ServerRole values of 'ApplicationWithSearch' or " + ` - "'WebFrontEndWithDistributedCache' require the SharePoint 2016 " + ` - "Feature Pack 1 to be installed. See " + ` - "https://support.microsoft.com/en-us/kb/3127940") + "'WebFrontEndWithDistributedCache' require the SharePoint 2016 " + ` + "Feature Pack 1 to be installed. See " + ` + "https://support.microsoft.com/en-us/kb/3127940") } # Determine if a connection to a farm already exists $majorVersion = $installedVersion.FileMajorPart - $regPath = "hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\$majorVersion.0\Secure\ConfigDB" - $dsnValue = Get-SPDscRegistryKey -Key $regPath -Value "dsn" -ErrorAction SilentlyContinue + $regPath = "hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\$majorVersion.0\Secure\ConfigDB" + $dsnValue = Get-SPDscRegistryKey -Key $regPath -Value "dsn" -ErrorAction SilentlyContinue if ($null -ne $dsnValue) { Write-Verbose -Message "This node has already been connected to a farm" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -206,19 +212,19 @@ function Get-TargetResource } $centralAdminSite = Get-SPWebApplication -IncludeCentralAdministration ` - | Where-Object -FilterScript { - $_.IsAdministrationWebApplication -eq $true - } + | Where-Object -FilterScript { + $_.IsAdministrationWebApplication -eq $true + } $centralAdminProvisioned = $false $ca = Get-SPServiceInstance -Server $env:ComputerName if ($null -ne $ca) { $ca = $ca | Where-Object -Filterscript { - $_.GetType().Name -eq "SPWebServiceInstance" -and ` - $_.Name -eq "WSS_Administration" -and ` - $_.Status -eq "Online" - } + $_.GetType().Name -eq "SPWebServiceInstance" -and ` + $_.Name -eq "WSS_Administration" -and ` + $_.Status -eq "Online" + } } if ($null -ne $ca) @@ -228,7 +234,7 @@ function Get-TargetResource $centralAdminAuth = $null if ($null -ne $centralAdminSite -and ` - $centralAdminSite.IisSettings[0].DisableKerberos -eq $false) + $centralAdminSite.IisSettings[0].DisableKerberos -eq $false) { $centralAdminAuth = "Kerberos" } @@ -237,9 +243,9 @@ function Get-TargetResource $centralAdminAuth = "NTLM" } - $admService = Get-SPDscContentService + $admService = Get-SPDscContentService $developerDashboardSettings = $admService.DeveloperDashboardSettings - $developerDashboardStatus = $developerDashboardSettings.DisplayLevel + $developerDashboardStatus = $developerDashboardSettings.DisplayLevel $returnValue = @{ IsSingleInstance = "Yes" @@ -282,10 +288,10 @@ function Get-TargetResource # The node is currently connected to a farm but was unable to retrieve the values # of current farm settings, most likely due to connectivity issues with the SQL box Write-Verbose -Message ("This server appears to be connected to a farm already, " + ` - "but the configuration database is currently unable to be " + ` - "accessed. Values returned from the get method will be " + ` - "incomplete, however the 'Ensure' property should be " + ` - "considered correct") + "but the configuration database is currently unable to be " + ` + "accessed. Values returned from the get method will be " + ` + "incomplete, however the 'Ensure' property should be " + ` + "considered correct") return @{ IsSingleInstance = "Yes" FarmConfigDatabaseName = $null @@ -339,7 +345,7 @@ function Set-TargetResource $IsSingleInstance, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -377,24 +383,24 @@ function Set-TargetResource [Parameter()] [System.String] - [ValidateSet("NTLM","Kerberos")] + [ValidateSet("NTLM", "Kerberos")] $CentralAdministrationAuth, [Parameter()] [System.String] [ValidateSet("Application", - "ApplicationWithSearch", - "Custom", - "DistributedCache", - "Search", - "SingleServer", - "SingleServerFarm", - "WebFrontEnd", - "WebFrontEndWithDistributedCache")] + "ApplicationWithSearch", + "Custom", + "DistributedCache", + "Search", + "SingleServer", + "SingleServerFarm", + "WebFrontEnd", + "WebFrontEndWithDistributedCache")] $ServerRole, [Parameter()] - [ValidateSet("Off","On","OnDemand")] + [ValidateSet("Off", "On", "OnDemand")] [System.String] $DeveloperDashboard, @@ -409,7 +415,25 @@ function Set-TargetResource if ($Ensure -eq "Absent") { throw ("SharePointDsc does not support removing a server from a farm, please set the " + ` - "ensure property to 'present'") + "ensure property to 'present'") + } + + if ($PSBoundParameters.ContainsKey("CentralAdministrationUrl")) + { + $uri = $CentralAdministrationUrl -as [System.Uri] + if ($null -eq $uri.AbsoluteUri) + { + throw "CentralAdministrationUrl is not a valid URI. It should include the scheme (http/https) and address." + } + if ($uri.scheme -ne 'https') + { + throw "Currently, the CentralAdministrationUrl parameter can only be used with HTTPS. To provision CA on " + ` + "HTTP, omit the CentralAdministrationUrl parameter to provision CA on http://servername:port." + } + if ($CentralAdministrationUrl -match ':\d+') + { + throw "CentralAdministrationUrl should not specify port. Use CentralAdministrationPort instead." + } } $CurrentValues = Get-TargetResource @PSBoundParameters @@ -441,8 +465,8 @@ function Set-TargetResource if ($CurrentValues.RunCentralAdmin -ne $RunCentralAdmin) { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] # Provision central administration @@ -453,16 +477,16 @@ function Set-TargetResource if ($null -eq $serviceInstance) { $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain - $fqdn = "$($env:COMPUTERNAME).$domain" + $fqdn = "$($env:COMPUTERNAME).$domain" $serviceInstance = Get-SPServiceInstance -Server $fqdn } if ($null -ne $serviceInstance) { $serviceInstance = $serviceInstance | Where-Object -FilterScript { - $_.GetType().Name -eq "SPWebServiceInstance" -and ` - $_.Name -eq "WSS_Administration" - } + $_.GetType().Name -eq "SPWebServiceInstance" -and ` + $_.Name -eq "WSS_Administration" + } } if ($null -eq $serviceInstance) @@ -478,16 +502,16 @@ function Set-TargetResource if ($null -eq $serviceInstance) { $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain - $fqdn = "$($env:COMPUTERNAME).$domain" + $fqdn = "$($env:COMPUTERNAME).$domain" $serviceInstance = Get-SPServiceInstance -Server $fqdn } if ($null -ne $serviceInstance) { $serviceInstance = $serviceInstance | Where-Object -FilterScript { - $_.GetType().Name -eq "SPWebServiceInstance" -and ` - $_.Name -eq "WSS_Administration" - } + $_.GetType().Name -eq "SPWebServiceInstance" -and ` + $_.Name -eq "WSS_Administration" + } } if ($null -eq $serviceInstance) @@ -510,8 +534,8 @@ function Set-TargetResource { Write-Verbose -Message "Updating CentralAdmin port to HTTPS" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $reprovisionCentralAdmin = $false @@ -536,7 +560,7 @@ function Set-TargetResource { # check to see if secureBindings host header and port match what we want them to be if ($desiredUri.Host -ne $secureBindings[0].HostHeader -or ` - $desiredUri.Port -ne $secureBindings[0].Port) + $desiredUri.Port -ne $secureBindings[0].Port) { Write-Verbose -Message "Re-provisioning CA because $($desiredUri.Host) does not equal $($secureBindings[0].HostHeader) or $($desiredUri.Port) does not equal $($secureBindings[0].Port)" $reprovisionCentralAdmin = $true @@ -573,8 +597,8 @@ function Set-TargetResource { Write-Verbose -Message "Updating CentralAdmin port to $CentralAdministrationPort" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] Write-Verbose -Message "Updating Central Admin port" @@ -587,12 +611,12 @@ function Set-TargetResource { Write-Verbose -Message "Updating DeveloperDashboard to $DeveloperDashboard" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] Write-Verbose -Message "Updating Developer Dashboard setting" - $admService = Get-SPDscContentService + $admService = Get-SPDscContentService $developerDashboardSettings = $admService.DeveloperDashboardSettings $developerDashboardSettings.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::$params.DeveloperDashboard $developerDashboardSettings.Update() @@ -606,9 +630,9 @@ function Set-TargetResource Write-Verbose -Message "Server not part of farm, creating or joining farm" $actionResult = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { - $params = $args[0] + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { + $params = $args[0] $scriptRoot = $args[1] $modulePath = "..\..\Modules\SharePointDsc.Farm\SPFarm.psm1" @@ -622,16 +646,16 @@ function Set-TargetResource } $dbStatus = Get-SPDscConfigDBStatus -SQLServer $params.DatabaseServer ` - -Database $params.FarmConfigDatabaseName + -Database $params.FarmConfigDatabaseName while ($dbStatus.Locked -eq $true) { Write-Verbose -Message ("[$([DateTime]::Now.ToShortTimeString())] The configuration " + ` - "database is currently being provisioned by a remote " + ` - "server, this server will wait for this to complete") + "database is currently being provisioned by a remote " + ` + "server, this server will wait for this to complete") Start-Sleep -Seconds 30 $dbStatus = Get-SPDscConfigDBStatus -SQLServer $params.DatabaseServer ` - -Database $params.FarmConfigDatabaseName + -Database $params.FarmConfigDatabaseName } if ($dbStatus.ValidPermissions -eq $false) @@ -649,21 +673,23 @@ function Set-TargetResource $installedVersion = Get-SPDscInstalledProductVersion switch ($installedVersion.FileMajorPart) { - 15 { + 15 + { Write-Verbose -Message "Detected Version: SharePoint 2013" } - 16 { + 16 + { if ($params.ContainsKey("ServerRole") -eq $true) { if ($installedVersion.ProductBuildPart.ToString().Length -eq 4) { Write-Verbose -Message ("Detected Version: SharePoint 2016 - " + ` - "configuring server as $($params.ServerRole)") + "configuring server as $($params.ServerRole)") } else { Write-Verbose -Message ("Detected Version: SharePoint 2019 - " + ` - "configuring server as $($params.ServerRole)") + "configuring server as $($params.ServerRole)") } $executeArgs.Add("LocalServerRole", $params.ServerRole) } @@ -672,30 +698,31 @@ function Set-TargetResource if ($installedVersion.ProductBuildPart.ToString().Length -eq 4) { Write-Verbose -Message ("Detected Version: SharePoint 2016 - no server " + ` - "role provided, configuring server without a " + ` - "specific role") + "role provided, configuring server without a " + ` + "specific role") } else { Write-Verbose -Message ("Detected Version: SharePoint 2019 - no server " + ` - "role provided, configuring server without a " + ` - "specific role") + "role provided, configuring server without a " + ` + "specific role") } $executeArgs.Add("ServerRoleOptional", $true) } } - Default { + Default + { throw [Exception] ("An unknown version of SharePoint (Major version $_) " + ` - "was detected. Only versions 15 (SharePoint 2013) and" + ` - "16 (SharePoint 2016 or SharePoint 2019) are supported.") + "was detected. Only versions 15 (SharePoint 2013) and" + ` + "16 (SharePoint 2016 or SharePoint 2019) are supported.") } } if ($dbStatus.DatabaseExists -eq $true) { Write-Verbose -Message ("The SharePoint config database " + ` - "'$($params.FarmConfigDatabaseName)' already exists, so " + ` - "this server will join the farm.") + "'$($params.FarmConfigDatabaseName)' already exists, so " + ` + "this server will join the farm.") $createFarm = $false } elseif ($dbStatus.DatabaseExists -eq $false -and $params.RunCentralAdmin -eq $false) @@ -703,17 +730,17 @@ function Set-TargetResource # Only allow the farm to be created by a server that will run central admin # to avoid a ghost CA site appearing on this server and causing issues Write-Verbose -Message ("The SharePoint config database " + ` - "'$($params.FarmConfigDatabaseName)' does not exist, but " + ` - "this server will not be running the central admin " + ` - "website, so it will wait to join the farm rather than " + ` - "create one.") + "'$($params.FarmConfigDatabaseName)' does not exist, but " + ` + "this server will not be running the central admin " + ` + "website, so it will wait to join the farm rather than " + ` + "create one.") $createFarm = $false } else { Write-Verbose -Message ("The SharePoint config database " + ` - "'$($params.FarmConfigDatabaseName)' does not exist, so " + ` - "this server will create the farm.") + "'$($params.FarmConfigDatabaseName)' does not exist, so " + ` + "this server will create the farm.") $createFarm = $true } @@ -721,17 +748,17 @@ function Set-TargetResource if ($createFarm -eq $false) { $dbStatus = Get-SPDscConfigDBStatus -SQLServer $params.DatabaseServer ` - -Database $params.FarmConfigDatabaseName + -Database $params.FarmConfigDatabaseName $loopCount = 0 while ($dbStatus.DatabaseExists -eq $false -and $loopCount -lt 15) { Write-Verbose -Message ("The configuration database is not yet provisioned " + ` - "by a remote server, this server will wait for up to " + ` - "15 minutes for this to complete") + "by a remote server, this server will wait for up to " + ` + "15 minutes for this to complete") Start-Sleep -Seconds 60 $loopCount++ $dbStatus = Get-SPDscConfigDBStatus -SQLServer $params.DatabaseServer ` - -Database $params.FarmConfigDatabaseName + -Database $params.FarmConfigDatabaseName } Write-Verbose -Message "The database exists, so attempt to join the server to the farm" @@ -744,10 +771,10 @@ function Set-TargetResource } Write-Verbose -Message ("The server will attempt to join the farm now once every " + ` - "60 seconds for the next 15 minutes.") - $loopCount = 0 + "60 seconds for the next 15 minutes.") + $loopCount = 0 $connectedToFarm = $false - $lastException = $null + $lastException = $null while ($connectedToFarm -eq $false -and $loopCount -lt 15) { try @@ -759,11 +786,11 @@ function Set-TargetResource { $lastException = $_.Exception Write-Verbose -Message ("$([DateTime]::Now.ToShortTimeString()) - An error " + ` - "occured joining config database " + ` - "'$($params.FarmConfigDatabaseName)' on " + ` - "'$($params.DatabaseServer)'. This resource will " + ` - "wait and retry automatically for up to 15 minutes. " + ` - "(waited $loopCount of 15 minutes)") + "occured joining config database " + ` + "'$($params.FarmConfigDatabaseName)' on " + ` + "'$($params.DatabaseServer)'. This resource will " + ` + "wait and retry automatically for up to 15 minutes. " + ` + "(waited $loopCount of 15 minutes)") $loopCount++ Start-Sleep -Seconds 60 } @@ -781,14 +808,14 @@ function Set-TargetResource Write-Verbose -Message "The database does not exist, so create a new farm" Write-Verbose -Message ("Creating Lock database to prevent two servers creating " + ` - "the same farm") + "the same farm") Add-SPDscConfigDBLock -SQLServer $params.DatabaseServer ` - -Database $params.FarmConfigDatabaseName + -Database $params.FarmConfigDatabaseName try { $executeArgs += @{ - FarmCredentials = $params.FarmAccount + FarmCredentials = $params.FarmAccount AdministrationContentDatabaseName = $params.AdminContentDatabaseName } @@ -801,7 +828,7 @@ function Set-TargetResource { Write-Verbose -Message "Removing Lock database" Remove-SPDscConfigDBLock -SQLServer $params.DatabaseServer ` - -Database $params.FarmConfigDatabaseName + -Database $params.FarmConfigDatabaseName } } @@ -823,9 +850,9 @@ function Set-TargetResource { Write-Verbose -Message "RunCentralAdmin is True, provisioning Central Admin" $centralAdminSite = Get-SPWebApplication -IncludeCentralAdministration ` - | Where-Object -FilterScript { - $_.IsAdministrationWebApplication -eq $true - } + | Where-Object -FilterScript { + $_.IsAdministrationWebApplication -eq $true + } $centralAdminProvisioned = $false if ((New-Object -TypeName System.Uri $centralAdminSite.Url).Port -eq $params.CentralAdministrationPort) @@ -836,7 +863,7 @@ function Set-TargetResource if ($centralAdminProvisioned -eq $false) { New-SPCentralAdministration -Port $params.CentralAdministrationPort ` - -WindowsAuthProvider $params.CentralAdministrationAuth + -WindowsAuthProvider $params.CentralAdministrationAuth # if central admin is to be SSL, let's remove and re-provision if (-not [string]::IsNullOrEmpty($params.CentralAdministrationUrl) -and ` @@ -845,7 +872,7 @@ function Set-TargetResource Write-Verbose -Message "Removing Central Admin to properly provision as SSL" $centralAdminSite = Get-SPWebApplication -IncludeCentralAdministration ` - | Where-Object -FilterScript { + | Where-Object -FilterScript { $_.IsAdministrationWebApplication -eq $true } @@ -882,7 +909,7 @@ function Set-TargetResource { $serviceInstance = $serviceInstance | Where-Object -FilterScript { $_.GetType().Name -eq "SPWebServiceInstance" -and ` - $_.Name -eq "WSS_Administration" + $_.Name -eq "WSS_Administration" } } @@ -900,7 +927,7 @@ function Set-TargetResource if ($params.ContainsKey("DeveloperDashboard") -and $params.DeveloperDashboard -ne "Off") { Write-Verbose -Message "Updating Developer Dashboard setting" - $admService = Get-SPDscContentService + $admService = Get-SPDscContentService $developerDashboardSettings = $admService.DeveloperDashboardSettings $developerDashboardSettings.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::$params.DeveloperDashboard $developerDashboardSettings.Update() @@ -915,10 +942,10 @@ function Set-TargetResource Start-Service -Name sptimerv4 Write-Verbose -Message ("Pausing for 5 minutes to allow the timer service to " + ` - "fully provision the server") + "fully provision the server") Start-Sleep -Seconds 300 Write-Verbose -Message ("Join farm complete. Restarting computer to allow " + ` - "configuration to continue") + "configuration to continue") $global:DSCMachineStatus = 1 } @@ -937,7 +964,7 @@ function Test-TargetResource $IsSingleInstance, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -975,24 +1002,24 @@ function Test-TargetResource [Parameter()] [System.String] - [ValidateSet("NTLM","Kerberos")] + [ValidateSet("NTLM", "Kerberos")] $CentralAdministrationAuth, [Parameter()] [System.String] [ValidateSet("Application", - "ApplicationWithSearch", - "Custom", - "DistributedCache", - "Search", - "SingleServer", - "SingleServerFarm", - "WebFrontEnd", - "WebFrontEndWithDistributedCache")] + "ApplicationWithSearch", + "Custom", + "DistributedCache", + "Search", + "SingleServer", + "SingleServerFarm", + "WebFrontEnd", + "WebFrontEndWithDistributedCache")] $ServerRole, [Parameter()] - [ValidateSet("Off","On","OnDemand")] + [ValidateSet("Off", "On", "OnDemand")] [System.String] $DeveloperDashboard, @@ -1012,12 +1039,12 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure", - "RunCentralAdmin", - "CentralAdministrationUrl", - "CentralAdministrationPort", - "DeveloperDashboard") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure", + "RunCentralAdmin", + "CentralAdministrationUrl", + "CentralAdministrationPort", + "DeveloperDashboard") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.psm1 index 64cb3ff4f..d40da3d71 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.psm1 @@ -31,18 +31,18 @@ function Get-TargetResource if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) { throw ("Cannot use the Members parameter together with the " + ` - "MembersToInclude or MembersToExclude parameters") + "MembersToInclude or MembersToExclude parameters") } if (!$Members -and !$MembersToInclude -and !$MembersToExclude) { throw ("At least one of the following parameters must be specified: " + ` - "Members, MembersToInclude, MembersToExclude") + "Members, MembersToInclude, MembersToExclude") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $nullReturn = @{ @@ -110,13 +110,13 @@ function Set-TargetResource if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) { throw ("Cannot use the Members parameter together with the " + ` - "MembersToInclude or MembersToExclude parameters") + "MembersToInclude or MembersToExclude parameters") } if (!$Members -and !$MembersToInclude -and !$MembersToExclude) { throw ("At least one of the following parameters must be specified: " + ` - "Members, MembersToInclude, MembersToExclude") + "Members, MembersToInclude, MembersToExclude") } $CurrentValues = Get-TargetResource @PSBoundParameters @@ -125,7 +125,7 @@ function Set-TargetResource throw "Unable to locate central administration website" } - $changeUsers = @{} + $changeUsers = @{ } $runChange = $false if ($Members) @@ -133,7 +133,7 @@ function Set-TargetResource Write-Verbose "Processing Members parameter" $differences = Compare-Object -ReferenceObject $CurrentValues.Members ` - -DifferenceObject $Members + -DifferenceObject $Members if ($null -eq $differences) { @@ -142,7 +142,7 @@ function Set-TargetResource else { Write-Verbose "Farm Administrators group does not match. Perform corrective action" - $addUsers = @() + $addUsers = @() $removeUsers = @() foreach ($difference in $differences) { @@ -271,13 +271,13 @@ function Test-TargetResource if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) { throw ("Cannot use the Members parameter together with the " + ` - "MembersToInclude or MembersToExclude parameters") + "MembersToInclude or MembersToExclude parameters") } if (!$Members -and !$MembersToInclude -and !$MembersToExclude) { throw ("At least one of the following parameters must be specified: " + ` - "Members, MembersToInclude, MembersToExclude") + "Members, MembersToInclude, MembersToExclude") } $CurrentValues = Get-TargetResource @PSBoundParameters @@ -294,7 +294,7 @@ function Test-TargetResource { Write-Verbose "Processing Members parameter" $differences = Compare-Object -ReferenceObject $CurrentValues.Members ` - -DifferenceObject $Members + -DifferenceObject $Members if ($null -eq $differences) { @@ -355,8 +355,8 @@ function Merge-SPDscFarmAdminList ) $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $changeUsers ` - -ScriptBlock { + -Arguments $changeUsers ` + -ScriptBlock { $changeUsers = $args[0] $webApps = Get-SPWebApplication -IncludeCentralAdministration @@ -374,7 +374,7 @@ function Merge-SPDscFarmAdminList { foreach ($loginName in $changeUsers.Add) { - $caWeb.SiteGroups.GetByName($farmAdminGroup).AddUser($loginName,"","","") + $caWeb.SiteGroups.GetByName($farmAdminGroup).AddUser($loginName, "", "", "") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.psm1 index 9b79c7177..02321c9ce 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.psm1 @@ -13,7 +13,7 @@ function Get-TargetResource() $Value, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = 'Present', @@ -25,8 +25,8 @@ function Get-TargetResource() Write-Verbose -Message "Looking for SPFarm property '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -49,12 +49,12 @@ function Get-TargetResource() { if ($spFarm.Properties.Contains($params.Key) -eq $true) { - $localEnsure = "Present" + $localEnsure = "Present" $currentValue = $spFarm.Properties[$params.Key] } else { - $localEnsure = "Absent" + $localEnsure = "Absent" $currentValue = $null } } @@ -62,7 +62,7 @@ function Get-TargetResource() else { $currentValue = $null - $localEnsure = 'Absent' + $localEnsure = 'Absent' } return @{ @@ -88,7 +88,7 @@ function Set-TargetResource() $Value, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = 'Present', @@ -100,8 +100,8 @@ function Set-TargetResource() Write-Verbose -Message "Setting SPFarm property '$Name'" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -151,7 +151,7 @@ function Test-TargetResource() $Value, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = 'Present', @@ -168,8 +168,8 @@ function Test-TargetResource() Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @('Ensure','Key','Value') + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @('Ensure', 'Key', 'Value') } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.psm1 index 3945b0f02..3a55fe65a 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.psm1 @@ -17,7 +17,7 @@ function Get-TargetResource $WebAppUrls = @(), [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -30,7 +30,7 @@ function Get-TargetResource $Deployed = $true, [Parameter()] - [ValidateSet("14","15","All")] + [ValidateSet("14", "15", "All")] [System.String] $SolutionLevel, @@ -42,38 +42,38 @@ function Get-TargetResource Write-Verbose -Message "Getting farm solution '$Name' settings" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $solution = Get-SPSolution -Identity $params.Name ` - -ErrorAction SilentlyContinue ` - -Verbose:$false + -ErrorAction SilentlyContinue ` + -Verbose:$false if ($null -ne $solution) { $currentState = "Present" - $deployed = $solution.Deployed - $version = $Solution.Properties["Version"] + $deployed = $solution.Deployed + $version = $Solution.Properties["Version"] $deployedWebApplications = @($solution.DeployedWebApplications ` - | Select-Object -ExpandProperty Url) + | Select-Object -ExpandProperty Url) } else { $currentState = "Absent" - $deployed = $false - $version = "0.0.0.0" + $deployed = $false + $version = "0.0.0.0" $deployedWebApplications = @() } return @{ - Name = $params.Name - LiteralPath = $LiteralPath - Deployed = $deployed - Ensure = $currentState - Version = $version - WebAppUrls = $deployedWebApplications - SolutionLevel = $params.SolutionLevel + Name = $params.Name + LiteralPath = $LiteralPath + Deployed = $deployed + Ensure = $currentState + Version = $version + WebAppUrls = $deployedWebApplications + SolutionLevel = $params.SolutionLevel } } return $result @@ -97,7 +97,7 @@ function Set-TargetResource $WebAppUrls = @(), [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -110,7 +110,7 @@ function Set-TargetResource $Deployed = $true, [Parameter()] - [ValidateSet("14","15","All")] + [ValidateSet("14", "15", "All")] [System.String] $SolutionLevel, @@ -123,8 +123,8 @@ function Set-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters - $PSBoundParameters.Ensure = $Ensure - $PSBoundParameters.Version = $Version + $PSBoundParameters.Ensure = $Ensure + $PSBoundParameters.Version = $Version $PSBoundParameters.Deployed = $Deployed if ($Ensure -eq "Present") @@ -134,11 +134,11 @@ function Set-TargetResource Write-Verbose -Message "Upload solution to the farm." $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] - $runParams = @{} + $runParams = @{ } $runParams.Add("LiteralPath", $params.LiteralPath) $runParams.Add("Verbose", $false) @@ -160,21 +160,21 @@ function Set-TargetResource if (-not $CurrentValues.Deployed) { Write-Verbose -Message ("Remove current version " + ` - "('$($CurrentValues.Version)') of solution...") + "('$($CurrentValues.Version)') of solution...") $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] - $runParams = @{} + $runParams = @{ } $runParams.Add("Identity", $params.Name) $runParams.Add("Confirm", $false) $runParams.Add("Verbose", $false) Remove-SPSolution $runParams - $runParams = @{} + $runParams = @{ } $runParams.Add("LiteralPath", $params.LiteralPath) $solution = Add-SPSolution @runParams @@ -190,16 +190,16 @@ function Set-TargetResource else { Write-Verbose -Message ("Update solution from " + ` - "'$($CurrentValues.Version)' to $Version...") + "'$($CurrentValues.Version)' to $Version...") $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $solution = Get-SPSolution -Identity $params.Name -Verbose:$false - $runParams = @{} + $runParams = @{ } $runParams.Add("Identity", $params.Name) $runParams.Add("LiteralPath", $params.LiteralPath) $runParams.Add("GACDeployment", $solution.ContainsGlobalAssembly) @@ -229,16 +229,16 @@ function Set-TargetResource if ($Deployed -ne $CurrentValues.Deployed) { Write-Verbose -Message ("The deploy state of $Name is " + ` - "'$($CurrentValues.Deployed)' but should be '$Deployed'.") + "'$($CurrentValues.Deployed)' but should be '$Deployed'.") if ($CurrentValues.Deployed) { # Retract Solution globally $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] - $runParams = @{} + $runParams = @{ } $runParams.Add("Identity", $params.Name) $runParams.Add("Confirm", $false) $runParams.Add("Verbose", $false) @@ -273,17 +273,17 @@ function Set-TargetResource { # Deploy solution $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $solution = Get-SPSolution -Identity $params.Name -Verbose:$false $runParams = @{ - Identity = $solution + Identity = $solution GACDeployment = $solution.ContainsGlobalAssembly - Local = $false - Verbose = $false + Local = $false + Verbose = $false } if ($params.ContainsKey("SolutionLevel") -eq $true) { @@ -321,8 +321,8 @@ function Set-TargetResource if ($Ensure -eq "Absent") { $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $runParams = @{ @@ -356,7 +356,7 @@ function Test-TargetResource $WebAppUrls = @(), [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -369,7 +369,7 @@ function Test-TargetResource $Deployed = $true, [Parameter()] - [ValidateSet("14","15","All")] + [ValidateSet("14", "15", "All")] [System.String] $SolutionLevel, @@ -394,8 +394,8 @@ function Test-TargetResource } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck $valuesToCheck + -DesiredValues $PSBoundParameters ` + -ValuesToCheck $valuesToCheck } function Wait-SPDscSolutionJob @@ -415,8 +415,8 @@ function Wait-SPDscSolutionJob Start-Sleep -Seconds 5 $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @{ Name = $SolutionName } ` - -ScriptBlock { + -Arguments @{ Name = $SolutionName } ` + -ScriptBlock { $params = $args[0] $gc = Start-SPAssignment -Verbose:$false @@ -432,7 +432,7 @@ function Wait-SPDscSolutionJob $solution = Get-SPSolution -Identity $params.Name -Verbose:$false -AssignmentCollection $gc Write-Verbose -Message ("$([DateTime]::Now.ToShortTimeString()) - Waiting for a " + ` - "job for solution '$($params.Name)' to complete") + "job for solution '$($params.Name)' to complete") $loopCount++ Start-Sleep -Seconds 5 @@ -445,7 +445,7 @@ function Wait-SPDscSolutionJob { Write-Verbose -Message "Solution '$($params.Name)' has no job pending." return @{ - LastOperationResult = "DeploymentSucceeded" + LastOperationResult = "DeploymentSucceeded" LastOperationDetails = "Solution '$($params.Name)' has no job pending." } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.psm1 index 4340ed71d..36d8d1f98 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.psm1 @@ -13,7 +13,7 @@ function Get-TargetResource $Url, [Parameter(Mandatory = $true)] - [ValidateSet("Farm","WebApplication","Site","Web")] + [ValidateSet("Farm", "WebApplication", "Site", "Web")] [System.String] $FeatureScope, @@ -22,7 +22,7 @@ function Get-TargetResource $InstallAccount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -34,8 +34,8 @@ function Get-TargetResource Write-Verbose -Message "Getting feature $Name at $FeatureScope scope" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $checkParams = @{ @@ -87,7 +87,7 @@ function Set-TargetResource $Url, [Parameter(Mandatory = $true)] - [ValidateSet("Farm","WebApplication","Site","Web")] + [ValidateSet("Farm", "WebApplication", "Site", "Web")] [System.String] $FeatureScope, @@ -96,7 +96,7 @@ function Set-TargetResource $InstallAccount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -115,8 +115,8 @@ function Set-TargetResource if ($Ensure -eq "Present") { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $currentValues = $params["CurrentValues"] @@ -134,20 +134,20 @@ function Set-TargetResource # Disable the feature first if it already exists. $runParams.Add("Confirm", $false) Write-Verbose -Message ("Disable Feature '$($params.Name)' because it is " + ` - "already active at scope '$($params.FeatureScope)'...") + "already active at scope '$($params.FeatureScope)'...") Disable-SPFeature @runParams } Write-Verbose -Message ("Enable Feature '$($params.Name)' at scope " + ` - "'$($params.FeatureScope)'...") + "'$($params.FeatureScope)'...") Enable-SPFeature @runParams } } if ($Ensure -eq "Absent") { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $currentValues = $params["CurrentValues"] @@ -163,7 +163,7 @@ function Set-TargetResource $runParams.Add("Confirm", $false) Write-Verbose -Message ("Disable Feature '$($params.Name)' because 'Ensure' is " + ` - "'$($params.Ensure)'...") + "'$($params.Ensure)'...") Disable-SPFeature @runParams } } @@ -185,7 +185,7 @@ function Test-TargetResource $Url, [Parameter(Mandatory = $true)] - [ValidateSet("Farm","WebApplication","Site","Web")] + [ValidateSet("Farm", "WebApplication", "Site", "Web")] [System.String] $FeatureScope, @@ -194,7 +194,7 @@ function Test-TargetResource $InstallAccount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -213,8 +213,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure", "Version") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure", "Version") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.psm1 index 1392c1d54..def848adb 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.psm1 @@ -13,12 +13,12 @@ function Get-TargetResource $Enabled, [Parameter()] - [ValidateSet("All Servers","Any Server")] + [ValidateSet("All Servers", "Any Server")] [System.String] $RuleScope, [Parameter()] - [ValidateSet("Hourly","Daily","Weekly","Monthly","OnDemandOnly")] + [ValidateSet("Hourly", "Daily", "Weekly", "Monthly", "OnDemandOnly")] [System.String] $Schedule, @@ -34,8 +34,8 @@ function Get-TargetResource Write-Verbose -Message "Getting Health Rule configuration settings" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $nullReturn = @{ @@ -54,13 +54,13 @@ function Get-TargetResource catch { Write-Verbose -Message ("No local SharePoint farm was detected. Health " + ` - "Analyzer Rule settings will not be applied") + "Analyzer Rule settings will not be applied") return $nullReturn } $caWebapp = Get-SPwebapplication -IncludeCentralAdministration ` - | Where-Object -FilterScript { - $_.IsAdministrationWebApplication + | Where-Object -FilterScript { + $_.IsAdministrationWebApplication } if ($null -eq $caWebapp) @@ -79,7 +79,7 @@ function Get-TargetResource { $spQuery = New-Object Microsoft.SharePoint.SPQuery $querytext = "" + ` - "$($params.Name)" + "$($params.Name)" $spQuery.Query = $querytext $results = $healthRulesList.GetItems($spQuery) if ($results.Count -eq 1) @@ -96,18 +96,18 @@ function Get-TargetResource return @{ # Set the Health Analyzer Rule settings - Name = $params.Name - Enabled = $item["HealthRuleCheckEnabled"] - RuleScope = $item["HealthRuleScope"] - Schedule = $ruleschedule + Name = $params.Name + Enabled = $item["HealthRuleCheckEnabled"] + RuleScope = $item["HealthRuleScope"] + Schedule = $ruleschedule FixAutomatically = $item["HealthRuleAutoRepairEnabled"] - InstallAccount = $params.InstallAccount + InstallAccount = $params.InstallAccount } } else { Write-Verbose -Message ("Unable to find specified Health Analyzer Rule. Make " + ` - "sure any related service applications exists.") + "sure any related service applications exists.") return $nullReturn } } @@ -135,12 +135,12 @@ function Set-TargetResource $Enabled, [Parameter()] - [ValidateSet("All Servers","Any Server")] + [ValidateSet("All Servers", "Any Server")] [System.String] $RuleScope, [Parameter()] - [ValidateSet("Hourly","Daily","Weekly","Monthly","OnDemandOnly")] + [ValidateSet("Hourly", "Daily", "Weekly", "Monthly", "OnDemandOnly")] [System.String] $Schedule, @@ -156,8 +156,8 @@ function Set-TargetResource Write-Verbose -Message "Setting Health Analyzer Rule configuration settings" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -167,18 +167,18 @@ function Set-TargetResource catch { throw ("No local SharePoint farm was detected. Health Analyzer Rule " + ` - "settings will not be applied") + "settings will not be applied") } $caWebapp = Get-SPwebapplication -IncludeCentralAdministration ` - | Where-Object -FilterScript { - $_.IsAdministrationWebApplication + | Where-Object -FilterScript { + $_.IsAdministrationWebApplication } if ($null -eq $caWebapp) { throw ("No Central Admin web application was found. Health Analyzer Rule " + ` - "settings will not be applied") + "settings will not be applied") } # Get Central Admin SPWeb @@ -191,7 +191,7 @@ function Set-TargetResource { $spQuery = New-Object Microsoft.SharePoint.SPQuery $querytext = "" + ` - "$($params.Name)" + "$($params.Name)" $spQuery.Query = $querytext $results = $healthRulesList.GetItems($spQuery) if ($results.Count -eq 1) @@ -217,14 +217,14 @@ function Set-TargetResource else { throw ("Could not find specified Health Analyzer Rule. Health Analyzer Rule " + ` - "settings will not be applied. Make sure any related service " + ` - "applications exists") + "settings will not be applied. Make sure any related service " + ` + "applications exists") } } else { throw ("Could not find Health Analyzer Rules list. Health Analyzer Rule settings " + ` - "will not be applied") + "will not be applied") } } } @@ -245,12 +245,12 @@ function Test-TargetResource $Enabled, [Parameter()] - [ValidateSet("All Servers","Any Server")] + [ValidateSet("All Servers", "Any Server")] [System.String] $RuleScope, [Parameter()] - [ValidateSet("Hourly","Daily","Weekly","Monthly","OnDemandOnly")] + [ValidateSet("Hourly", "Daily", "Weekly", "Monthly", "OnDemandOnly")] [System.String] $Schedule, @@ -271,7 +271,7 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters + -DesiredValues $PSBoundParameters } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPIncomingEmailSettings/MSFT_SPIncomingEmailSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPIncomingEmailSettings/MSFT_SPIncomingEmailSettings.psm1 index cd371cc53..f25064bc8 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPIncomingEmailSettings/MSFT_SPIncomingEmailSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPIncomingEmailSettings/MSFT_SPIncomingEmailSettings.psm1 @@ -60,7 +60,7 @@ $result = Invoke-SPDscCommand -Credential $InstallAccount ` -ScriptBlock { - $spEmailServiceInstance = (Get-SPServiceInstance | Where-Object {$_.GetType().FullName -eq "Microsoft.SharePoint.Administration.SPIncomingEmailServiceInstance" }) | Select-Object -First 1 + $spEmailServiceInstance = (Get-SPServiceInstance | Where-Object { $_.GetType().FullName -eq "Microsoft.SharePoint.Administration.SPIncomingEmailServiceInstance" }) | Select-Object -First 1 $spEmailService = $spEmailServiceInstance.service # some simple error checking, just incase we didn't capture the service for some reason @@ -199,30 +199,30 @@ function Set-TargetResource if ($Ensure -eq 'Present') { if (-not $PSBoundParameters.containskey("UseAutomaticSettings")) - { - throw "UseAutomaticSettings parameter must be specified when enabling incoming email." - } + { + throw "UseAutomaticSettings parameter must be specified when enabling incoming email." + } - if (-not $PSBoundParameters.containskey("ServerDisplayAddress")) - { - throw "ServerDisplayAddress parameter must be specified when enabling incoming email" - } + if (-not $PSBoundParameters.containskey("ServerDisplayAddress")) + { + throw "ServerDisplayAddress parameter must be specified when enabling incoming email" + } - if (($PSBoundParameters.UseDirectoryManagementService -eq 'Remote' -and $null -eq $PSBoundParameters.RemoteDirectoryManagementURL) ` - -or ($PSBoundParameters.containskey('RemoteDirectoryManagementURL') -and $PSBoundParameters.UseDirectoryManagementService -ne 'Remote')) - { - throw "RemoteDirectoryManagementURL must be specified only when UseDirectoryManagementService is set to 'Remote'" - } + if (($PSBoundParameters.UseDirectoryManagementService -eq 'Remote' -and $null -eq $PSBoundParameters.RemoteDirectoryManagementURL) ` + -or ($PSBoundParameters.containskey('RemoteDirectoryManagementURL') -and $PSBoundParameters.UseDirectoryManagementService -ne 'Remote')) + { + throw "RemoteDirectoryManagementURL must be specified only when UseDirectoryManagementService is set to 'Remote'" + } - if ($PSBoundParameters.UseAutomaticSettings -eq $true -and $PSBoundParameters.containskey("DropFolder")) - { - throw "DropFolder parameter is not valid when using Automatic Mode" - } + if ($PSBoundParameters.UseAutomaticSettings -eq $true -and $PSBoundParameters.containskey("DropFolder")) + { + throw "DropFolder parameter is not valid when using Automatic Mode" + } - if ($PSBoundParameters.UseAutomaticSettings -eq $false -and (-not $PSBoundParameters.containskey("DropFolder"))) - { - throw "DropFolder parameter must be specified when not using Automatic Mode" - } + if ($PSBoundParameters.UseAutomaticSettings -eq $false -and (-not $PSBoundParameters.containskey("DropFolder"))) + { + throw "DropFolder parameter must be specified when not using Automatic Mode" + } } Invoke-SPDscCommand -Credential $InstallAccount ` @@ -230,7 +230,7 @@ function Set-TargetResource -ScriptBlock { $params = $args[0] - $spEmailServiceInstance = (Get-SPServiceInstance | Where-Object {$_.GetType().FullName -eq "Microsoft.SharePoint.Administration.SPIncomingEmailServiceInstance" }) | Select-Object -First 1 + $spEmailServiceInstance = (Get-SPServiceInstance | Where-Object { $_.GetType().FullName -eq "Microsoft.SharePoint.Administration.SPIncomingEmailServiceInstance" }) | Select-Object -First 1 $spEmailService = $spEmailServiceInstance.service #some simple error checking, just incase we didn't capture the service for some reason @@ -377,7 +377,7 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters + -DesiredValues $PSBoundParameters } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPInfoPathFormsServiceConfig/MSFT_SPInfoPathFormsServiceConfig.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPInfoPathFormsServiceConfig/MSFT_SPInfoPathFormsServiceConfig.psm1 index 980cf6dc2..6abb1412b 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPInfoPathFormsServiceConfig/MSFT_SPInfoPathFormsServiceConfig.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPInfoPathFormsServiceConfig/MSFT_SPInfoPathFormsServiceConfig.psm1 @@ -10,7 +10,7 @@ function Get-TargetResource $IsSingleInstance, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure, @@ -78,8 +78,8 @@ function Get-TargetResource Write-Verbose -Message "Getting InfoPath Forms Service Configuration" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $config = Get-SPInfoPathFormsService @@ -141,7 +141,7 @@ function Set-TargetResource $IsSingleInstance, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure, @@ -215,8 +215,8 @@ function Set-TargetResource } Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $config = Get-SPInfoPathFormsService @@ -306,7 +306,7 @@ function Test-TargetResource $IsSingleInstance, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure, @@ -381,22 +381,22 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure", - "AllowUserFormBrowserEnabling", - "AllowUserFormBrowserRendering", - "MaxDataConnectionTimeout", - "DefaultDataConnectionTimeout", - "MaxDataConnectionResponseSize", - "RequireSslForDataConnections", - "AllowEmbeddedSqlForDataConnections", - "AllowUdcAuthenticationForDataConnections", - "AllowUserFormCrossDomainDataConnections", - "AllowEventPropagation", - "MaxPostbacksPerSession", - "MaxUserActionsPerPostback", - "ActiveSessionsTimeout", - "MaxSizeOfUserFormState") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure", + "AllowUserFormBrowserEnabling", + "AllowUserFormBrowserRendering", + "MaxDataConnectionTimeout", + "DefaultDataConnectionTimeout", + "MaxDataConnectionResponseSize", + "RequireSslForDataConnections", + "AllowEmbeddedSqlForDataConnections", + "AllowUdcAuthenticationForDataConnections", + "AllowUserFormCrossDomainDataConnections", + "AllowEventPropagation", + "MaxPostbacksPerSession", + "MaxUserActionsPerPostback", + "ActiveSessionsTimeout", + "MaxSizeOfUserFormState") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPInstall/MSFT_SPInstall.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPInstall/MSFT_SPInstall.psm1 index 083c73a53..4b3cc6cce 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPInstall/MSFT_SPInstall.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPInstall/MSFT_SPInstall.psm1 @@ -26,7 +26,7 @@ function Get-TargetResource $DataPath, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present" ) @@ -78,7 +78,7 @@ function Get-TargetResource if ($null -ne $zone) { throw ("Setup file is blocked! Please use 'Unblock-File -Path $InstallerPath' " + ` - "to unblock the file before continuing.") + "to unblock the file before continuing.") } Write-Verbose -Message "File not blocked, continuing." } @@ -149,7 +149,7 @@ function Set-TargetResource $DataPath, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present" ) @@ -159,7 +159,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { throw [Exception] ("SharePointDsc does not support uninstalling SharePoint or " + ` - "its prerequisites. Please remove this manually.") + "its prerequisites. Please remove this manually.") } Write-Verbose -Message "Check if Binary folder exists" @@ -174,7 +174,7 @@ function Set-TargetResource throw "Setup.exe cannot be found in {$BinaryDir}" } - $majorVersion = (Get-SPDscAssemblyVersion -PathToAssembly $InstallerPath) + $majorVersion = (Get-SPDscAssemblyVersion -PathToAssembly $InstallerPath) if ($majorVersion -eq 15) { $svrsetupDll = Join-Path -Path $BinaryDir -ChildPath "updates\svrsetup.dll" @@ -209,8 +209,8 @@ function Set-TargetResource if ($dotNet46Installed -eq $true) { throw [Exception] ("A known issue prevents installation of SharePoint 2013 on " + ` - "servers that have .NET 4.6 already installed. See details " + ` - "at https://support.microsoft.com/en-us/kb/3087184") + "servers that have .NET 4.6 already installed. See details " + ` + "at https://support.microsoft.com/en-us/kb/3087184") return } } @@ -249,7 +249,7 @@ function Set-TargetResource if ($null -ne $zone) { throw ("Setup file is blocked! Please use 'Unblock-File -Path $InstallerPath' " + ` - "to unblock the file before continuing.") + "to unblock the file before continuing.") } Write-Verbose -Message "File not blocked, continuing." } @@ -259,7 +259,7 @@ function Set-TargetResource if ($BinaryDir.StartsWith("\\")) { Write-Verbose -Message ("Specified BinaryDir is an UNC path. Adding servername to Local " + - "Intranet Zone") + "Intranet Zone") $uncInstall = $true @@ -316,9 +316,9 @@ function Set-TargetResource $setupExe = Join-Path -Path $BinaryDir -ChildPath "setup.exe" $setup = Start-Process -FilePath $setupExe ` - -ArgumentList "/config `"$configPath`"" ` - -Wait ` - -PassThru + -ArgumentList "/config `"$configPath`"" ` + -Wait ` + -PassThru if ($uncInstall -eq $true) { @@ -326,36 +326,45 @@ function Set-TargetResource Remove-SPDscZoneMap -ServerName $serverName } + # Exit codes: https://docs.microsoft.com/en-us/windows/desktop/msi/error-codes switch ($setup.ExitCode) { - 0 { + 0 + { Write-Verbose -Message "SharePoint binary installation complete" $global:DSCMachineStatus = 1 } - 30066 { + 3010 + { + Write-Verbose -Message "SharePoint binary installation complete, but reboot is required" + $global:DSCMachineStatus = 1 + } + 30066 + { $pr1 = ("HKLM:\Software\Microsoft\Windows\CurrentVersion\" + ` "Component Based Servicing\RebootPending") $pr2 = ("HKLM:\Software\Microsoft\Windows\CurrentVersion\" + ` "WindowsUpdate\Auto Update\RebootRequired") $pr3 = "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" if ( ($null -ne (Get-Item -Path $pr1 -ErrorAction SilentlyContinue)) ` - -or ($null -ne (Get-Item -Path $pr2 -ErrorAction SilentlyContinue)) ` - -or ((Get-Item -Path $pr3 | Get-ItemProperty).PendingFileRenameOperations.count -gt 0) ` - ) + -or ($null -ne (Get-Item -Path $pr2 -ErrorAction SilentlyContinue)) ` + -or ((Get-Item -Path $pr3 | Get-ItemProperty).PendingFileRenameOperations.count -gt 0) ` + ) { Write-Verbose -Message ("SPInstall has detected the server has pending " + ` - "a reboot. Flagging to the DSC engine that the " + ` - "server should reboot before continuing.") + "a reboot. Flagging to the DSC engine that the " + ` + "server should reboot before continuing.") $global:DSCMachineStatus = 1 } else { throw ("SharePoint installation has failed due to an issue with prerequisites " + ` - "not being installed correctly. Please review the setup logs.") + "not being installed correctly. Please review the setup logs.") } } - Default { + Default + { throw "SharePoint install failed, exit code was $($setup.ExitCode)" } } @@ -390,7 +399,7 @@ function Test-TargetResource $DataPath, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present" ) @@ -402,7 +411,7 @@ function Test-TargetResource if ($Ensure -eq "Absent") { throw [Exception] ("SharePointDsc does not support uninstalling SharePoint or " + ` - "its prerequisites. Please remove this manually.") + "its prerequisites. Please remove this manually.") } $CurrentValues = Get-TargetResource @PSBoundParameters @@ -411,8 +420,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 index 69411b01d..abe869c3a 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 @@ -9,7 +9,7 @@ function Get-TargetResource $BinaryDir, [Parameter()] - [ValidateSet("mon","tue","wed","thu","fri","sat","sun")] + [ValidateSet("mon", "tue", "wed", "thu", "fri", "sat", "sun")] [System.String[]] $BinaryInstallDays, @@ -18,7 +18,7 @@ function Get-TargetResource $BinaryInstallTime, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -75,13 +75,13 @@ function Get-TargetResource if ($null -ne $zone) { throw ("Setup file is blocked! Please use 'Unblock-File -Path $setupExe' " + ` - "to unblock the file before continuing.") + "to unblock the file before continuing.") } Write-Verbose -Message "File not blocked, continuing." } $osrvFolder = Get-ChildItem -Path (Join-Path -Path $BinaryDir ` - -ChildPath "\osmui*.*") + -ChildPath "\osmui*.*") if ($osrvFolder.Count -ne 1) { @@ -96,8 +96,11 @@ function Get-TargetResource $parsedProduct = $product -split " - " switch -Regex ($parsedProduct) { - "Dari" { $languageEN = "Dari"} - "Serbian" { + "Dari" + { $languageEN = "Dari" + } + "Serbian" + { if ($parsedProduct[1] -match "srpski") { $languageEN = "Serbian (Latin)" @@ -107,11 +110,13 @@ function Get-TargetResource $languageEN = "Serbian (Cyrillic)" } } - "Chinese" { + "Chinese" + { $parsedENProduct = $parsedProduct[1] -split "/" $languageEN = $parsedENProduct[0] } - "Portuguese" { + "Portuguese" + { if ($parsedProduct[1] -match "\(Brasil\)") { $languageEN = "Portuguese (Brasil)" @@ -121,7 +126,8 @@ function Get-TargetResource $languageEN = "Portuguese (Portugal)" } } - Default { + Default + { $parsedENProduct = $parsedProduct[1] -split "/" $parsedENProduct = $parsedENProduct[0] -split " " $languageEN = $parsedENProduct[0] @@ -143,7 +149,7 @@ function Get-TargetResource try { $cultureInfo = New-Object -TypeName System.Globalization.CultureInfo ` - -ArgumentList $language + -ArgumentList $language } catch { @@ -160,19 +166,36 @@ function Get-TargetResource $updateLanguage = $cultureInfo.EnglishName switch ($cultureInfo.EnglishName) { - "Dari (Afghanistan)" { $languageEnglish = "Dari" } - "Chinese (Simplified, China)" { $languageEnglish = "Chinese (PRC)" } - "Chinese (Traditional, Taiwan)" { $languageEnglish = "Chinese (Taiwan)" } - "Portuguese (Brazil)" { $languageEnglish = "Portuguese (Brasil)" } - "Portuguese (Portugal)" { $languageEnglish = "Portuguese (Portugal)" } - "Serbian (Cyrillic, Serbia)" { $languageEnglish = "Serbian (Cyrillic)" } - "Serbian (Latin, Serbia)" { $languageEnglish = "Serbian (Latin)" } - "Norwegian Bokmål (Norway)" { $languageEnglish = "Norwegian" } - Default { + "Dari (Afghanistan)" + { $languageEnglish = "Dari" + } + "Chinese (Simplified, China)" + { $languageEnglish = "Chinese (PRC)" + } + "Chinese (Traditional, Taiwan)" + { $languageEnglish = "Chinese (Taiwan)" + } + "Portuguese (Brazil)" + { $languageEnglish = "Portuguese (Brasil)" + } + "Portuguese (Portugal)" + { $languageEnglish = "Portuguese (Portugal)" + } + "Serbian (Cyrillic, Serbia)" + { $languageEnglish = "Serbian (Cyrillic)" + } + "Serbian (Latin, Serbia)" + { $languageEnglish = "Serbian (Latin)" + } + "Norwegian Bokmål (Norway)" + { $languageEnglish = "Norwegian" + } + Default + { if ($cultureInfo.EnglishName -match "(\w*,*\s*\w*) \([^)]*\)") { $languageEnglish = $matches[1] - $updateLanguage = $matches[0] + $updateLanguage = $matches[0] if ($languageEnglish.contains(",")) { $languages = $languageEnglish.Split(",") @@ -219,7 +242,7 @@ function Set-TargetResource $BinaryDir, [Parameter()] - [ValidateSet("mon","tue","wed","thu","fri","sat","sun")] + [ValidateSet("mon", "tue", "wed", "thu", "fri", "sat", "sun")] [System.String[]] $BinaryInstallDays, @@ -228,7 +251,7 @@ function Set-TargetResource $BinaryInstallTime, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -242,7 +265,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { throw [Exception] ("SharePointDsc does not support uninstalling SharePoint " + ` - "Language Packs. Please remove this manually.") + "Language Packs. Please remove this manually.") return } @@ -292,7 +315,7 @@ function Set-TargetResource if ($null -ne $zone) { throw ("Setup file is blocked! Please use 'Unblock-File -Path $setupExe' " + ` - "to unblock the file before continuing.") + "to unblock the file before continuing.") } Write-Verbose -Message "File not blocked, continuing." } @@ -302,17 +325,17 @@ function Set-TargetResource if ($BinaryInstallDays) { Write-Verbose -Message "BinaryInstallDays parameter exists, check if current day is specified" - $currentDayOfWeek = $now.DayOfWeek.ToString().ToLower().Substring(0,3) + $currentDayOfWeek = $now.DayOfWeek.ToString().ToLower().Substring(0, 3) if ($BinaryInstallDays -contains $currentDayOfWeek) { Write-Verbose -Message ("Current day is present in the parameter BinaryInstallDays. " + ` - "Update can be run today.") + "Update can be run today.") } else { Write-Verbose -Message ("Current day is not present in the parameter BinaryInstallDays, " + ` - "skipping the update") + "skipping the update") return } } @@ -335,12 +358,12 @@ function Set-TargetResource } else { - if ([datetime]::TryParse($upgradeTimes[0],[ref]$starttime) -ne $true) + if ([datetime]::TryParse($upgradeTimes[0], [ref]$starttime) -ne $true) { throw "Error converting start time" } - if ([datetime]::TryParse($upgradeTimes[2],[ref]$endtime) -ne $true) + if ([datetime]::TryParse($upgradeTimes[2], [ref]$endtime) -ne $true) { throw "Error converting end time" } @@ -354,29 +377,29 @@ function Set-TargetResource if (($starttime -lt $now) -and ($endtime -gt $now)) { Write-Verbose -Message ("Current time is inside of the window specified in " + ` - "BinaryInstallTime. Starting update") + "BinaryInstallTime. Starting update") } else { Write-Verbose -Message ("Current time is outside of the window specified in " + ` - "BinaryInstallTime, skipping the update") + "BinaryInstallTime, skipping the update") return } } else { Write-Verbose -Message ("No BinaryInstallTime specified, Update can be ran at " + ` - "any time. Starting update.") + "any time. Starting update.") } Write-Verbose -Message "To prevent an endless loop: Check if an upgrade is required." if ((Get-SPDscInstalledProductVersion).FileMajorPart -eq 15) { - $wssRegKey ="hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS" + $wssRegKey = "hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS" } else { - $wssRegKey ="hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\16.0\WSS" + $wssRegKey = "hklm:SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\16.0\WSS" } Write-Verbose -Message "Checking if BinaryDir is an UNC path" @@ -434,9 +457,9 @@ function Set-TargetResource Write-Verbose -Message "Beginning installation of the SharePoint Language Pack" $setup = Start-Process -FilePath $setupExe ` - -ArgumentList "/config `"$configPath`"" ` - -Wait ` - -PassThru + -ArgumentList "/config `"$configPath`"" ` + -Wait ` + -PassThru if ($uncInstall -eq $true) { @@ -446,14 +469,17 @@ function Set-TargetResource switch ($setup.ExitCode) { - 0 { + 0 + { Write-Verbose -Message "SharePoint Language Pack binary installation complete" } - 17022 { + 17022 + { Write-Verbose -Message "SharePoint Language Pack binary installation complete. Reboot required." $global:DSCMachineStatus = 1 } - Default { + Default + { throw "SharePoint Language Pack install failed, exit code was $($setup.ExitCode)" } } @@ -471,7 +497,7 @@ function Test-TargetResource $BinaryDir, [Parameter()] - [ValidateSet("mon","tue","wed","thu","fri","sat","sun")] + [ValidateSet("mon", "tue", "wed", "thu", "fri", "sat", "sun")] [System.String[]] $BinaryInstallDays, @@ -480,7 +506,7 @@ function Test-TargetResource $BinaryInstallTime, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -496,7 +522,7 @@ function Test-TargetResource if ($Ensure -eq "Absent") { throw [Exception] ("SharePointDsc does not support uninstalling SharePoint " + ` - "Language Packs. Please remove this manually.") + "Language Packs. Please remove this manually.") return } @@ -506,8 +532,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.psm1 index 63fb85e82..85b083db8 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.psm1 @@ -1,97 +1,97 @@ $Script:SP2013Features = @("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") + "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") $Script:SP2016Win19Features = @("Web-Server", "Web-WebServer", - "Web-Common-Http", "Web-Default-Doc", "Web-Dir-Browsing", - "Web-Http-Errors", "Web-Static-Content", "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-Digest-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", - "NET-Framework-Features", "NET-HTTP-Activation", "NET-Non-HTTP-Activ", - "NET-Framework-45-ASPNET", "NET-WCF-Pipe-Activation45", - "Windows-Identity-Foundation", "WAS", "WAS-Process-Model", - "WAS-NET-Environment", "WAS-Config-APIs", "XPS-Viewer") + "Web-Common-Http", "Web-Default-Doc", "Web-Dir-Browsing", + "Web-Http-Errors", "Web-Static-Content", "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-Digest-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", + "NET-Framework-Features", "NET-HTTP-Activation", "NET-Non-HTTP-Activ", + "NET-Framework-45-ASPNET", "NET-WCF-Pipe-Activation45", + "Windows-Identity-Foundation", "WAS", "WAS-Process-Model", + "WAS-NET-Environment", "WAS-Config-APIs", "XPS-Viewer") $Script:SP2016Win16Features = @("Web-Server", "Web-WebServer", - "Web-Common-Http", "Web-Default-Doc", "Web-Dir-Browsing", - "Web-Http-Errors", "Web-Static-Content", "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-Digest-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", - "NET-Framework-Features", "NET-HTTP-Activation", "NET-Non-HTTP-Activ", - "NET-Framework-45-ASPNET", "NET-WCF-Pipe-Activation45", - "Windows-Identity-Foundation", "WAS", "WAS-Process-Model", - "WAS-NET-Environment", "WAS-Config-APIs", "XPS-Viewer") + "Web-Common-Http", "Web-Default-Doc", "Web-Dir-Browsing", + "Web-Http-Errors", "Web-Static-Content", "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-Digest-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", + "NET-Framework-Features", "NET-HTTP-Activation", "NET-Non-HTTP-Activ", + "NET-Framework-45-ASPNET", "NET-WCF-Pipe-Activation45", + "Windows-Identity-Foundation", "WAS", "WAS-Process-Model", + "WAS-NET-Environment", "WAS-Config-APIs", "XPS-Viewer") $Script:SP2016Win12r2Features = @("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") + "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") $Script:SP2019Win16Features = @("Web-Server", "Web-WebServer", - "Web-Common-Http", "Web-Default-Doc", "Web-Dir-Browsing", - "Web-Http-Errors", "Web-Static-Content", "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-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", - "NET-Framework-Features", "NET-HTTP-Activation", "NET-Non-HTTP-Activ", - "NET-Framework-45-ASPNET", "NET-WCF-Pipe-Activation45", - "Windows-Identity-Foundation", "WAS", "WAS-Process-Model", - "WAS-NET-Environment", "WAS-Config-APIs", "XPS-Viewer") + "Web-Common-Http", "Web-Default-Doc", "Web-Dir-Browsing", + "Web-Http-Errors", "Web-Static-Content", "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-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", + "NET-Framework-Features", "NET-HTTP-Activation", "NET-Non-HTTP-Activ", + "NET-Framework-45-ASPNET", "NET-WCF-Pipe-Activation45", + "Windows-Identity-Foundation", "WAS", "WAS-Process-Model", + "WAS-NET-Environment", "WAS-Config-APIs", "XPS-Viewer") $Script:SP2019Win19Features = @("Web-Server", "Web-WebServer", - "Web-Common-Http", "Web-Default-Doc", "Web-Dir-Browsing", - "Web-Http-Errors", "Web-Static-Content", "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-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", - "NET-Framework-Features", "NET-HTTP-Activation", "NET-Non-HTTP-Activ", - "NET-Framework-45-ASPNET", "NET-WCF-Pipe-Activation45", - "Windows-Identity-Foundation", "WAS", "WAS-Process-Model", - "WAS-NET-Environment", "WAS-Config-APIs", "XPS-Viewer") + "Web-Common-Http", "Web-Default-Doc", "Web-Dir-Browsing", + "Web-Http-Errors", "Web-Static-Content", "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-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", + "NET-Framework-Features", "NET-HTTP-Activation", "NET-Non-HTTP-Activ", + "NET-Framework-45-ASPNET", "NET-WCF-Pipe-Activation45", + "Windows-Identity-Foundation", "WAS", "WAS-Process-Model", + "WAS-NET-Environment", "WAS-Config-APIs", "XPS-Viewer") function Get-TargetResource { @@ -189,7 +189,7 @@ function Get-TargetResource $DotNet472, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present" ) @@ -235,7 +235,7 @@ function Get-TargetResource if ($null -ne $zone) { throw ("PrerequisitesInstaller is blocked! Please use 'Unblock-File -Path " + ` - "$InstallerPath' to unblock the file before continuing.") + "$InstallerPath' to unblock the file before continuing.") } Write-Verbose -Message "File not blocked, continuing." } @@ -424,9 +424,9 @@ function Get-TargetResource SearchValue = "Microsoft Visual C++ 2012 x64 Additional Runtime - 11.0.*" }, [PSObject]@{ - Name = "Microsoft Visual C++ 2015 Redistributable (x64)" - SearchType = "BundleUpgradeCode" - SearchValue = "{C146EF48-4D31-3C3D-A2C5-1E91AF8A0A9B}" + Name = "Microsoft Visual C++ 2015 Redistributable (x64)" + SearchType = "BundleUpgradeCode" + SearchValue = "{C146EF48-4D31-3C3D-A2C5-1E91AF8A0A9B}" MinimumRequiredVersion = "14.0.23026.0" } ) @@ -446,16 +446,16 @@ function Get-TargetResource SearchValue = "Microsoft SQL Server 2012 Native Client" }, [PSObject]@{ - Name = "Microsoft Visual C++ 2017 Redistributable (x64)" - SearchType = "BundleUpgradeCode" - SearchValue = "{C146EF48-4D31-3C3D-A2C5-1E91AF8A0A9B}" + Name = "Microsoft Visual C++ 2017 Redistributable (x64)" + SearchType = "BundleUpgradeCode" + SearchValue = "{C146EF48-4D31-3C3D-A2C5-1E91AF8A0A9B}" MinimumRequiredVersion = "14.13.26020.0" } ) } } $prereqsInstalled = Test-SPDscPrereqInstallStatus -InstalledItems $installedItems ` - -PrereqsToCheck $prereqsToTest + -PrereqsToCheck $prereqsToTest $results = @{ IsSingleInstance = "Yes" @@ -591,7 +591,7 @@ function Set-TargetResource $DotNet472, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present" ) @@ -601,7 +601,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { throw [Exception] ("SharePointDsc does not support uninstalling SharePoint or its " + ` - "prerequisites. Please remove this manually.") + "prerequisites. Please remove this manually.") } Write-Verbose -Message "Check if InstallerPath folder exists" @@ -643,7 +643,7 @@ function Set-TargetResource if ($null -ne $zone) { throw ("PrerequisitesInstaller is blocked! Please use 'Unblock-File -Path " + ` - "$InstallerPath' to unblock the file before continuing.") + "$InstallerPath' to unblock the file before continuing.") } Write-Verbose -Message "File not blocked, continuing." } @@ -654,24 +654,30 @@ function Set-TargetResource $osVersion = Get-SPDscOSVersion switch ($osVersion.Major) { - 6 { + 6 + { switch ($osVersion.Minor) { - 0 { + 0 + { Write-Verbose -Message "Operating System: Windows Server 2008" } - 1 { + 1 + { Write-Verbose -Message "Operating System: Windows Server 2008 R2" } - 2 { + 2 + { Write-Verbose -Message "Operating System: Windows Server 2012" } - 3 { + 3 + { Write-Verbose -Message "Operating System: Windows Server 2012 R2" } } } - 10 { + 10 + { if ($osVersion.Build -lt 17763) { Write-Verbose -Message "Operating System: Windows Server 2016" @@ -690,7 +696,7 @@ function Set-TargetResource throw "SharePoint 2013 only supports Windows Server 2012 R2 and below" } - $BinaryDir = Split-Path -Path $InstallerPath + $BinaryDir = Split-Path -Path $InstallerPath $svrsetupDll = Join-Path -Path $BinaryDir -ChildPath "updates\svrsetup.dll" $checkDotNet = $true if (Test-Path -Path $svrsetupDll) @@ -723,14 +729,14 @@ function Set-TargetResource if ($dotNet46Installed -eq $true) { throw [Exception] ("A known issue prevents installation of SharePoint 2013 on " + ` - "servers that have .NET 4.6 already installed. See details " + ` - "at https://support.microsoft.com/en-us/kb/3087184") + "servers that have .NET 4.6 already installed. See details " + ` + "at https://support.microsoft.com/en-us/kb/3087184") } } Write-Verbose -Message "Version: SharePoint 2013" - $requiredParams = @("SQLNCli","PowerShell","NETFX","IDFX","Sync","AppFabric","IDFX11", - "MSIPCClient","WCFDataServices","KB2671763","WCFDataServices56") + $requiredParams = @("SQLNCli", "PowerShell", "NETFX", "IDFX", "Sync", "AppFabric", "IDFX11", + "MSIPCClient", "WCFDataServices", "KB2671763", "WCFDataServices56") $WindowsFeatures = Get-WindowsFeature -Name $Script:SP2013Features } elseif ($majorVersion -eq 16) @@ -738,8 +744,8 @@ function Set-TargetResource if ($buildVersion -lt 5000) { Write-Verbose -Message "Version: SharePoint 2016" - $requiredParams = @("SQLNCli","Sync","AppFabric","IDFX11","MSIPCClient","KB3092423", - "WCFDataServices56","DotNetFx","MSVCRT11","MSVCRT14","ODBC") + $requiredParams = @("SQLNCli", "Sync", "AppFabric", "IDFX11", "MSIPCClient", "KB3092423", + "WCFDataServices56", "DotNetFx", "MSVCRT11", "MSVCRT14", "ODBC") if ($osVersion.Major -eq 10) { if ($osVersion.Build -lt 17763) @@ -767,8 +773,8 @@ function Set-TargetResource elseif ($buildVersion -ge 5000) { Write-Verbose -Message "Version: SharePoint 2019" - $requiredParams = @("SQLNCli","Sync","AppFabric","IDFX11","MSIPCClient","KB3092423", - "WCFDataServices56","DotNet472","MSVCRT11","MSVCRT141") + $requiredParams = @("SQLNCli", "Sync", "AppFabric", "IDFX11", "MSIPCClient", "KB3092423", + "WCFDataServices56", "DotNet472", "MSVCRT11", "MSVCRT141") if ($osVersion.Major -eq 10) { @@ -824,15 +830,15 @@ function Set-TargetResource { $requiredParams | ForEach-Object -Process { if (($PSBoundParameters.ContainsKey($_) -eq $true ` - -and [string]::IsNullOrEmpty($PSBoundParameters.$_)) ` - -or (-not $PSBoundParameters.ContainsKey($_))) + -and [string]::IsNullOrEmpty($PSBoundParameters.$_)) ` + -or (-not $PSBoundParameters.ContainsKey($_))) { throw "In offline mode for version $majorVersion parameter $_ is required" } if ((Test-Path -Path $PSBoundParameters.$_) -eq $false) { throw ("The $_ parameter has been passed but the file cannot be found at the " + ` - "path supplied: `"$($PSBoundParameters.$_)`"") + "path supplied: `"$($PSBoundParameters.$_)`"") } } $requiredParams | ForEach-Object -Process { @@ -845,7 +851,7 @@ function Set-TargetResource if ($InstallerPath.StartsWith("\\")) { Write-Verbose -Message ("Specified InstallerPath is an UNC path. Adding servername to Local " + - "Intranet Zone") + "Intranet Zone") $uncInstall = $true @@ -889,39 +895,39 @@ function Set-TargetResource 1001 { Write-Verbose -Message ("A pending restart is blocking the prerequisite " + ` - "installer from running. Scheduling a reboot.") + "installer from running. Scheduling a reboot.") $global:DSCMachineStatus = 1 } 3010 { Write-Verbose -Message ("The prerequisite installer has run correctly and needs " + ` - "to reboot the machine before continuing.") + "to reboot the machine before continuing.") $global:DSCMachineStatus = 1 } default { throw ("The prerequisite installer ran with the following unknown " + ` - "exit code $($process.ExitCode)") + "exit code $($process.ExitCode)") } } $rebootKey1 = "HKLM:\Software\Microsoft\Windows\CurrentVersion\" + ` - "Component Based Servicing\RebootPending" + "Component Based Servicing\RebootPending" $rebootTest1 = Get-Item -Path $rebootKey1 -ErrorAction SilentlyContinue $rebootKey2 = "HKLM:\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\" + ` - "Auto Update\RebootRequired" + "Auto Update\RebootRequired" $rebootTest2 = Get-Item -Path $rebootKey2 -ErrorAction SilentlyContinue - $sessionManagerKey = "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" - $sessionManager = Get-Item -Path $sessionManagerKey | Get-ItemProperty + $sessionManagerKey = "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager" + $sessionManager = Get-Item -Path $sessionManagerKey | Get-ItemProperty $pendingFileRenames = $sessionManager.PendingFileRenameOperations.Count if (($null -ne $rebootTest1) -or ($null -ne $rebootTest2) -or ($pendingFileRenames -gt 0)) { Write-Verbose -Message ("SPInstallPrereqs has detected the server has pending a " + ` - "reboot. Flagging to the DSC engine that the server should " + ` - "reboot before continuing.") + "reboot. Flagging to the DSC engine that the server should " + ` + "reboot before continuing.") $global:DSCMachineStatus = 1 } } @@ -1023,7 +1029,7 @@ function Test-TargetResource $DotNet472, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present" ) @@ -1035,7 +1041,7 @@ function Test-TargetResource if ($Ensure -eq "Absent") { throw [Exception] ("SharePointDsc does not support uninstalling SharePoint or its " + ` - "prerequisites. Please remove this manually.") + "prerequisites. Please remove this manually.") } $CurrentValues = Get-TargetResource @PSBoundParameters @@ -1044,8 +1050,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } function Test-SPDscPrereqInstallStatus @@ -1074,34 +1080,34 @@ function Test-SPDscPrereqInstallStatus "Equals" { if ($null -eq ($InstalledItems | Where-Object -FilterScript { - $null -ne $_.DisplayName -and $_.DisplayName.Trim() -eq $itemToCheck.SearchValue - })) + $null -ne $_.DisplayName -and $_.DisplayName.Trim() -eq $itemToCheck.SearchValue + })) { $itemsInstalled = $false Write-Verbose -Message ("Prerequisite $($itemToCheck.Name) was not found " + ` - "on this system") + "on this system") } } "Match" { if ($null -eq ($InstalledItems | Where-Object -FilterScript { - $null -ne $_.DisplayName -and $_.DisplayName.Trim() -match $itemToCheck.SearchValue - })) + $null -ne $_.DisplayName -and $_.DisplayName.Trim() -match $itemToCheck.SearchValue + })) { $itemsInstalled = $false Write-Verbose -Message ("Prerequisite $($itemToCheck.Name) was not found " + ` - "on this system") + "on this system") } } "Like" { if ($null -eq ($InstalledItems | Where-Object -FilterScript { - $null -ne $_.DisplayName -and $_.DisplayName.Trim() -like $itemToCheck.SearchValue - })) + $null -ne $_.DisplayName -and $_.DisplayName.Trim() -like $itemToCheck.SearchValue + })) { $itemsInstalled = $false Write-Verbose -Message ("Prerequisite $($itemToCheck.Name) was not found " + ` - "on this system") + "on this system") } } "BundleUpgradeCode" @@ -1113,7 +1119,7 @@ function Test-SPDscPrereqInstallStatus { $itemsInstalled = $false Write-Verbose -Message ("Prerequisite $($itemToCheck.Name) was not found " + ` - "on this system") + "on this system") } else { @@ -1129,15 +1135,15 @@ function Test-SPDscPrereqInstallStatus { $itemsInstalled = $false Write-Verbose -Message ("Prerequisite $($itemToCheck.Name) was found but had " + ` - "unexpected version. Expected minimum version $($itemToCheck.MinimumVersion) " + ` - "but found version $($installedItem.DisplayVersion).") + "unexpected version. Expected minimum version $($itemToCheck.MinimumVersion) " + ` + "but found version $($installedItem.DisplayVersion).") } } } Default { throw ("Unable to search for a prereq with mode '$($itemToCheck.SearchType)'. " + ` - "please use either 'Equals', 'Like' or 'Match', or 'BundleUpgradeCode'") + "please use either 'Equals', 'Like' or 'Match', or 'BundleUpgradeCode'") } } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.psm1 index 608862683..aa11b7d99 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.psm1 @@ -11,7 +11,7 @@ function Get-TargetResource [Parameter()] [System.String] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] $Ensure, [Parameter()] @@ -30,8 +30,8 @@ function Get-TargetResource Write-Verbose "Getting SharePoint IRM Settings" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -41,7 +41,7 @@ function Get-TargetResource catch { Write-Verbose -Message ("No local SharePoint farm was detected. IRM settings " + ` - "will not be applied") + "will not be applied") return @{ IsSingleInstance = "Yes" Ensure = "Absent" @@ -68,9 +68,9 @@ function Get-TargetResource UseADRMS = $admService.IrmSettings.IrmRMSUseAD RMSserver = $admService.IrmSettings.IrmRMSCertServer } - } + } - return $result + return $result } function Set-TargetResource @@ -85,7 +85,7 @@ function Set-TargetResource [Parameter()] [System.String] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] $Ensure, [Parameter()] @@ -104,8 +104,8 @@ function Set-TargetResource Write-Verbose "Setting SharePoint IRM Settings" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -159,7 +159,7 @@ function Test-TargetResource [Parameter()] [System.String] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] $Ensure, [Parameter()] @@ -188,7 +188,7 @@ function Test-TargetResource } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters + -DesiredValues $PSBoundParameters } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPLogLevel/MSFT_SPLogLevel.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPLogLevel/MSFT_SPLogLevel.psm1 index 61b46bb8a..16706a883 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPLogLevel/MSFT_SPLogLevel.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPLogLevel/MSFT_SPLogLevel.psm1 @@ -1,7 +1,7 @@ function Get-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Collections.Hashtable])] param ( @@ -48,7 +48,7 @@ function Get-TargetResource } } - if ($null -ne $DesiredSetting.TraceLevel -and @("None","Unexpected","Monitorable","High","Medium","Verbose","VerboseEx","Default") -notcontains $DesiredSetting.TraceLevel) + if ($null -ne $DesiredSetting.TraceLevel -and @("None", "Unexpected", "Monitorable", "High", "Medium", "Verbose", "VerboseEx", "Default") -notcontains $DesiredSetting.TraceLevel) { Write-Verbose -Message "TraceLevel $($DesiredSetting.TraceLevel) is not valid, must specify exactly one of None,Unexpected,Monitorable,High,Medium,Verbose,VerboseEx, or Default" return @{ @@ -57,7 +57,7 @@ function Get-TargetResource } } - if ($null -ne $DesiredSetting.EventLevel -and @("None","ErrorCritical","Error","Warning","Information","Verbose","Default") -notcontains $DesiredSetting.EventLevel) + if ($null -ne $DesiredSetting.EventLevel -and @("None", "ErrorCritical", "Error", "Warning", "Information", "Verbose", "Default") -notcontains $DesiredSetting.EventLevel) { Write-Verbose -Message "EventLevel $($DesiredSetting.EventLevel) is not valid, must specify exactly one of None,ErrorCritical,Error,Warning,Informational,Verbose, or Default" return @{ @@ -70,13 +70,13 @@ function Get-TargetResource Write-Verbose -Message "Getting SP Log Level Settings for provided Areas" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] + -Arguments $PSBoundParameters ` + -ScriptBlock { + $params = $args[0] - $CurrentLogLevelSettings = @() - foreach ($DesiredSetting in $params.SPLogLevelSetting) - { + $CurrentLogLevelSettings = @() + foreach ($DesiredSetting in $params.SPLogLevelSetting) + { Write-Verbose -Message "Getting SP Log Level Settings for $($DesiredSetting.Area):$($DesiredSetting.Name)" $CurrentLogItemSettings = Get-SPLogLevel -Identity "$($DesiredSetting.Area):$($DesiredSetting.Name)" @@ -107,13 +107,13 @@ function Get-TargetResource else { #return a csv list of current unique trace level settings for the provided Area/Name - $Tracelevel = [System.String]::Join(",",(($CurrentLogItemSettings.traceseverity) | Select-Object -Unique)) + $Tracelevel = [System.String]::Join(",", (($CurrentLogItemSettings.traceseverity) | Select-Object -Unique)) } } #default was not specified, so we return the unique current trace severity across all provided settings. else { - $Tracelevel = [System.String]::Join(",",(($CurrentLogItemSettings.traceseverity) | Select-Object -Unique)) + $Tracelevel = [System.String]::Join(",", (($CurrentLogItemSettings.traceseverity) | Select-Object -Unique)) } #EventLevels @@ -136,13 +136,13 @@ function Get-TargetResource else { #return a csv list of current unique Event level settings for the provided Area/Name - $Eventlevel = [System.String]::Join(",",(($CurrentLogItemSettings.Eventseverity) | Select-Object -Unique)) + $Eventlevel = [System.String]::Join(",", (($CurrentLogItemSettings.Eventseverity) | Select-Object -Unique)) } } #default was not specified, so we return the unique current Event severity across all provided settings. else { - $Eventlevel = [System.String]::Join(",",(($CurrentLogItemSettings.Eventseverity) | Select-Object -Unique)) + $Eventlevel = [System.String]::Join(",", (($CurrentLogItemSettings.Eventseverity) | Select-Object -Unique)) } $CurrentLogLevelSettings += New-Object -TypeName PSObject -Property @{ @@ -150,7 +150,7 @@ function Get-TargetResource Name = $DesiredSetting.Name TraceLevel = $TraceLevel EventLevel = $EventLevel - } + } } return @{ @@ -163,7 +163,7 @@ function Get-TargetResource function Set-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] param ( [Parameter(Mandatory = $true)] @@ -196,12 +196,12 @@ function Set-TargetResource throw "TraceLevel and / or EventLevel must be provided for each Area" } - if ($null -ne $DesiredSetting.TraceLevel -and @("None","Unexpected","Monitorable","High","Medium","Verbose","VerboseEx","Default") -notcontains $DesiredSetting.TraceLevel) + if ($null -ne $DesiredSetting.TraceLevel -and @("None", "Unexpected", "Monitorable", "High", "Medium", "Verbose", "VerboseEx", "Default") -notcontains $DesiredSetting.TraceLevel) { throw "TraceLevel $($DesiredSetting.TraceLevel) is not valid, must specify exactly one of None,Unexpected,Monitorable,High,Medium,Verbose,VerboseEx, or Default" } - if ($null -ne $DesiredSetting.EventLevel -and @("None","ErrorCritical","Error","Warning","Information","Verbose","Default") -notcontains $DesiredSetting.EventLevel) + if ($null -ne $DesiredSetting.EventLevel -and @("None", "ErrorCritical", "Error", "Warning", "Information", "Verbose", "Default") -notcontains $DesiredSetting.EventLevel) { throw "EventLevel $($DesiredSetting.EventLevel) is not valid, must specify exactly one of None,ErrorCritical,Error,Warning,Information,Verbose, or Default" } @@ -210,8 +210,8 @@ function Set-TargetResource Write-Verbose -Message "Setting SP Log Level settings for the provided areas" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] foreach ($DesiredSetting in $params.SPLogLevelSetting) @@ -264,7 +264,7 @@ function Set-TargetResource function Test-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Boolean])] param ( @@ -299,7 +299,7 @@ function Test-TargetResource { Write-Verbose -Message "Testing SP Log Level setting for $($DesiredSetting.Area):$($DesiredSetting.Name)" - $CurrentSetting = $CurrentValues.SPLogLevelSetting | Where-Object -FilterScript {$_.Area -eq $DesiredSetting.Area -and $_.Name -eq $DesiredSetting.Name} + $CurrentSetting = $CurrentValues.SPLogLevelSetting | Where-Object -FilterScript { $_.Area -eq $DesiredSetting.Area -and $_.Name -eq $DesiredSetting.Name } if (($null -ne $DesiredSetting.TraceLevel -and $CurrentSetting.TraceLevel -ne $DesiredSetting.TraceLevel) -or ($null -ne $DesiredSetting.EventLevel -and $CurrentSetting.EventLevel -ne $DesiredSetting.EventLevel)) { diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.psm1 index 5d58631c1..3d56857d5 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.psm1 @@ -25,7 +25,7 @@ function Get-TargetResource $ApplicationPool, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -36,8 +36,8 @@ function Get-TargetResource Write-Verbose -Message "Getting Machine Translation Service Application '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue @@ -63,7 +63,8 @@ function Get-TargetResource { return $nullReturn } - else { + else + { $serviceAppProxies = Get-SPServiceApplicationProxy -ErrorAction SilentlyContinue if ($null -ne $serviceAppProxies) { @@ -117,7 +118,7 @@ function Set-TargetResource $ApplicationPool, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -134,8 +135,8 @@ function Set-TargetResource Write-Verbose "Resetting Machine Translation Service Application." Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Identity $params.Name @@ -144,8 +145,8 @@ function Set-TargetResource } $serviceApp | Set-SPTranslationServiceApplication -ApplicationPool $params.ApplicationPool ` - -DatabaseName $params.DatabaseName ` - -DatabaseServer $params.DatabaseServer + -DatabaseName $params.DatabaseName ` + -DatabaseServer $params.DatabaseServer } } if ($CurrentValues.Ensure -eq "Absent" -and $Ensure -eq "Present") @@ -153,14 +154,14 @@ function Set-TargetResource Write-Verbose "Creating Machine Translation Service Application." $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $tsServiceApp = New-SPTranslationServiceApplication -Name $params.Name ` - -DatabaseName $params.DatabaseName ` - -DatabaseServer $params.DatabaseServer ` - -ApplicationPool $params.ApplicationPool + -DatabaseName $params.DatabaseName ` + -DatabaseServer $params.DatabaseServer ` + -ApplicationPool $params.ApplicationPool if ($params.ContainsKey("ProxyName")) { @@ -176,7 +177,7 @@ function Set-TargetResource } New-SPTranslationServiceApplicationProxy -Name $params.ProxyName ` - -ServiceApplication $tsServiceApp | Out-Null + -ServiceApplication $tsServiceApp | Out-Null } } @@ -186,8 +187,8 @@ function Set-TargetResource Write-Verbose "Removing Machine Translation Service Application." $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Identity $params.Name @@ -228,7 +229,7 @@ function Test-TargetResource $ApplicationPool, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -247,12 +248,12 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name", - "ApplicationPool", - "DatabaseName", - "DatabaseServer", - "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Name", + "ApplicationPool", + "DatabaseName", + "DatabaseServer", + "Ensure") } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.psm1 index 3325aed30..9252180ef 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.psm1 @@ -9,7 +9,7 @@ function Get-TargetResource $Account, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -37,12 +37,12 @@ function Get-TargetResource Write-Verbose -Message "Getting managed account $AccountName" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $ma = Get-SPManagedAccount -Identity $params.AccountName ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $ma) { return @{ @@ -80,7 +80,7 @@ function Set-TargetResource $Account, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -110,7 +110,7 @@ function Set-TargetResource if ($Ensure -eq "Present" -and $null -eq $Account) { throw ("You must specify the 'Account' property as a PSCredential to create a " + ` - "managed account") + "managed account") return } @@ -118,10 +118,10 @@ function Set-TargetResource if ($currentValues.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message ("Managed account does not exist but should, creating " + ` - "the managed account") + "the managed account") Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] New-SPManagedAccount -Credential $params.Account } @@ -131,8 +131,8 @@ function Set-TargetResource { Write-Verbose -Message "Updating settings for managed account" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $updateParams = @{ @@ -157,8 +157,8 @@ function Set-TargetResource { Write-Verbose -Message "Removing managed account" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] Remove-SPManagedAccount -Identity $params.AccountName -Confirm:$false } @@ -176,7 +176,7 @@ function Test-TargetResource $Account, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -211,12 +211,12 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("AccountName", - "Schedule", - "PreExpireDays", - "EmailNotification", - "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("AccountName", + "Schedule", + "PreExpireDays", + "EmailNotification", + "Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.psm1 index f9d9de6a5..ea7872ce1 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.psm1 @@ -61,12 +61,12 @@ function Get-TargetResource Write-Verbose -Message "Getting managed metadata service application $Name" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $nullReturn = @{ Name = $params.Name Ensure = "Absent" @@ -112,7 +112,7 @@ function Get-TargetResource } $proxy = Get-SPMetadataServiceApplicationProxy -Identity $proxyName ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -ne $proxy) { $contentTypePushDownEnabled = $proxy.Properties["IsContentTypePushdownEnabled"] @@ -180,7 +180,7 @@ function Get-TargetResource } $centralAdminSite = Get-SPWebApplication -IncludeCentralAdministration ` - | Where-Object -FilterScript { + | Where-Object -FilterScript { $_.IsAdministrationWebApplication -eq $true } $session = Get-SPTaxonomySession -Site $centralAdminSite.Url @@ -329,8 +329,8 @@ function Set-TargetResource { Write-Verbose -Message "Creating Managed Metadata Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments ($PSBoundParameters, $pName) ` - -ScriptBlock { + -Arguments ($PSBoundParameters, $pName) ` + -ScriptBlock { $params = $args[0] $pName = $args[1] @@ -350,9 +350,9 @@ function Set-TargetResource if ($null -ne $app) { New-SPMetadataServiceApplicationProxy -Name $pName ` - -ServiceApplication $app ` - -DefaultProxyGroup ` - -ContentTypePushdownEnabled + -ServiceApplication $app ` + -DefaultProxyGroup ` + -ContentTypePushdownEnabled } } $result = Get-TargetResource @PSBoundParameters @@ -361,16 +361,16 @@ function Set-TargetResource if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") { if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and ` - $ApplicationPool -ne $result.ApplicationPool) + $ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating application pool of Managed Metadata Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApp = Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { + | Where-Object -FilterScript { $_.GetType().FullName -eq "Microsoft.SharePoint.Taxonomy.MetadataWebServiceApplication" } $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool @@ -382,13 +382,13 @@ function Set-TargetResource { Write-Verbose -Message "Updating Managed Metadata Service Application Proxy" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $pName) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $pName) ` + -ScriptBlock { $params = $args[0] $pName = $args[1] $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $serviceApp = $serviceApps | Where-Object -FilterScript { $_.GetType().FullName -eq "Microsoft.SharePoint.Taxonomy.MetadataWebServiceApplication" } @@ -410,9 +410,9 @@ function Set-TargetResource { Write-Verbose -Message "Creating Service Application Proxy '$pName'" New-SPMetadataServiceApplicationProxy -Name $pName ` - -ServiceApplication $serviceApp ` - -DefaultProxyGroup ` - -ContentTypePushdownEnabled + -ServiceApplication $serviceApp ` + -DefaultProxyGroup ` + -ContentTypePushdownEnabled } } } @@ -428,7 +428,7 @@ function Set-TargetResource $params = $args[0] $serviceApp = Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { + | Where-Object -FilterScript { $_.GetType().FullName -eq "Microsoft.SharePoint.Taxonomy.MetadataWebServiceApplication" } Set-SPMetadataServiceApplication -Identity $serviceApp -HubUri $params.ContentTypeHubUrl @@ -450,7 +450,7 @@ function Set-TargetResource $pName = $args[2] $centralAdminSite = Get-SPWebApplication -IncludeCentralAdministration ` - | Where-Object -FilterScript { + | Where-Object -FilterScript { $_.IsAdministrationWebApplication -eq $true } $session = Get-SPTaxonomySession -Site $centralAdminSite.Url @@ -511,7 +511,7 @@ function Set-TargetResource $pName = $args[1] $centralAdminSite = Get-SPWebApplication -IncludeCentralAdministration ` - | Where-Object -FilterScript { + | Where-Object -FilterScript { $_.IsAdministrationWebApplication -eq $true } $session = Get-SPTaxonomySession -Site $centralAdminSite.Url @@ -556,7 +556,7 @@ function Set-TargetResource $pName = $args[2] $centralAdminSite = Get-SPWebApplication -IncludeCentralAdministration ` - | Where-Object -FilterScript { + | Where-Object -FilterScript { $_.IsAdministrationWebApplication -eq $true } $session = Get-SPTaxonomySession -Site $centralAdminSite.Url @@ -757,18 +757,18 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" $valuesToCheck = @("ApplicationPool", - "ContentTypeHubUrl" - "ContentTypePushdownEnabled" - "ContentTypeSyndicationEnabled" - "DefaultLanguage" - "Ensure", - "Languages" - "TermStoreAdministrators" - "ProxyName") + "ContentTypeHubUrl" + "ContentTypePushdownEnabled" + "ContentTypeSyndicationEnabled" + "DefaultLanguage" + "Ensure", + "Languages" + "TermStoreAdministrators" + "ProxyName") return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck $valuesToCheck + -DesiredValues $PSBoundParameters ` + -ValuesToCheck $valuesToCheck } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceAppDefault/MSFT_SPManagedMetadataServiceAppDefault.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceAppDefault/MSFT_SPManagedMetadataServiceAppDefault.psm1 index 5ad3bac51..b3144e007 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceAppDefault/MSFT_SPManagedMetadataServiceAppDefault.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceAppDefault/MSFT_SPManagedMetadataServiceAppDefault.psm1 @@ -188,8 +188,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck $valuesToCheck + -DesiredValues $PSBoundParameters ` + -ValuesToCheck $valuesToCheck } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.psm1 index aeb962c28..3f09e2ef5 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.psm1 @@ -21,7 +21,7 @@ function Get-TargetResource $HostHeader, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -33,8 +33,8 @@ function Get-TargetResource Write-Verbose -Message "Getting managed path $RelativeUrl in $WebAppUrl" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $getParams = @{ @@ -95,7 +95,7 @@ function Set-TargetResource $HostHeader, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -112,13 +112,13 @@ function Set-TargetResource { Write-Verbose -Message "Creating the managed path $RelativeUrl in $WebAppUrl" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $newParams = @{ RelativeURL = $params.RelativeUrl - Explicit = $params.Explicit + Explicit = $params.Explicit } if ($params.HostHeader) { @@ -136,8 +136,8 @@ function Set-TargetResource { Write-Verbose -Message "Removing the managed path $RelativeUrl from $WebAppUrl" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $removeParams = @{ @@ -180,7 +180,7 @@ function Test-TargetResource $HostHeader, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -199,12 +199,12 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("WebAppUrl", - "RelativeUrl", - "Explicit", - "HostHeader", - "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("WebAppUrl", + "RelativeUrl", + "Explicit", + "HostHeader", + "Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPMinRoleCompliance/MSFT_SPMinRoleCompliance.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPMinRoleCompliance/MSFT_SPMinRoleCompliance.psm1 index 20d868cac..f37e27fa8 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPMinRoleCompliance/MSFT_SPMinRoleCompliance.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPMinRoleCompliance/MSFT_SPMinRoleCompliance.psm1 @@ -10,7 +10,7 @@ function Get-TargetResource $IsSingleInstance, [Parameter(Mandatory = $true)] - [ValidateSet("Compliant","NonCompliant")] + [ValidateSet("Compliant", "NonCompliant")] [System.String] $State, @@ -28,8 +28,8 @@ function Get-TargetResource } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $nonCompliantServices = Get-SPService | Where-Object -FilterScript { $_.CompliantWithMinRole -eq $false } @@ -60,7 +60,7 @@ function Get-SPDscRoleTestMethod $assembly = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") $type = $assembly.GetType("Microsoft.SharePoint.Administration.SPServerRoleManager") $flags = [Reflection.BindingFlags] "NonPublic,Static" - return $type.GetMethod("IsCompliantWithMinRole",$flags) + return $type.GetMethod("IsCompliantWithMinRole", $flags) } function Set-TargetResource @@ -74,7 +74,7 @@ function Set-TargetResource $IsSingleInstance, [Parameter(Mandatory = $true)] - [ValidateSet("Compliant","NonCompliant")] + [ValidateSet("Compliant", "NonCompliant")] [System.String] $State, @@ -94,12 +94,12 @@ function Set-TargetResource if ($State -eq "NonCompliant") { throw ("State can only be configured to 'Compliant'. The 'NonCompliant' value is only " + ` - "used to report when the farm is not compliant") + "used to report when the farm is not compliant") } Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $method = Get-SPDscRoleTestMethod Get-SPService | Where-Object -FilterScript { @@ -138,7 +138,7 @@ function Test-TargetResource $IsSingleInstance, [Parameter(Mandatory = $true)] - [ValidateSet("Compliant","NonCompliant")] + [ValidateSet("Compliant", "NonCompliant")] [System.String] $State, @@ -152,7 +152,7 @@ function Test-TargetResource if ($State -eq "NonCompliant") { throw ("State can only be configured to 'Compliant'. The 'NonCompliant' value is only " + ` - "used to report when the farm is not compliant") + "used to report when the farm is not compliant") } $CurrentValues = Get-TargetResource @PSBoundParameters @@ -161,8 +161,11 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("State") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("State") } -Export-ModuleMember -Function *-TargetResource +Export-ModuleMember -Function Get-TargetResource, ` + Test-TargetResource, ` + Set-TargetResource, ` + Get-SPDscRoleTestMethod diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.psm1 index f098d8e7e..520811ccc 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.psm1 @@ -5,7 +5,7 @@ function Get-TargetResource param ( [Parameter(Mandatory = $true)] - [ValidateSet("Internal-HTTP","Internal-HTTPS","External-HTTP","External-HTTPS")] + [ValidateSet("Internal-HTTP", "Internal-HTTPS", "External-HTTP", "External-HTTPS")] [System.String] $Zone, @@ -14,7 +14,7 @@ function Get-TargetResource $DnsName, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -26,8 +26,8 @@ function Get-TargetResource Write-Verbose -Message "Getting Office Online Server details for '$Zone' zone" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $currentZone = Get-SPWOPIZone @@ -61,7 +61,7 @@ function Set-TargetResource param ( [Parameter(Mandatory = $true)] - [ValidateSet("Internal-HTTP","Internal-HTTPS","External-HTTP","External-HTTPS")] + [ValidateSet("Internal-HTTP", "Internal-HTTPS", "External-HTTP", "External-HTTPS")] [System.String] $Zone, @@ -70,7 +70,7 @@ function Set-TargetResource $DnsName, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -88,21 +88,21 @@ function Set-TargetResource if ($DnsName -ne $CurrentResults.DnsName -or $Zone -ne $CurrentResults.Zone) { if ([String]::IsNullOrEmpty($CurrentResults.DnsName) -eq $false ` - -or $Zone -ne $CurrentResults.Zone) + -or $Zone -ne $CurrentResults.Zone) { Write-Verbose -Message ("Removing bindings for zone '$Zone' so new bindings " + ` - "can be added") + "can be added") Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] Get-SPWOPIBinding -WOPIZone $params.Zone | Remove-SPWOPIBinding -Confirm:$false } } Write-Verbose -Message "Creating new bindings for '$DnsName' and setting zone to '$Zone'" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $newParams = @{ @@ -122,8 +122,8 @@ function Set-TargetResource { Write-Verbose -Message "Removing bindings for zone '$Zone'" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] Get-SPWOPIBinding -WOPIZone $params.Zone | Remove-SPWOPIBinding -Confirm:$false } @@ -137,7 +137,7 @@ function Test-TargetResource param ( [Parameter(Mandatory = $true)] - [ValidateSet("Internal-HTTP","Internal-HTTPS","External-HTTP","External-HTTPS")] + [ValidateSet("Internal-HTTP", "Internal-HTTPS", "External-HTTP", "External-HTTPS")] [System.String] $Zone, @@ -146,7 +146,7 @@ function Test-TargetResource $DnsName, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -167,11 +167,11 @@ function Test-TargetResource $paramsToCheck = @("Ensure") if ($Ensure -eq "Present") { - $paramsToCheck += @("Zone","DnsName") + $paramsToCheck += @("Zone", "DnsName") } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck $paramsToCheck + -DesiredValues $PSBoundParameters ` + -ValuesToCheck $paramsToCheck } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.schema.mof b/Modules/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.schema.mof index bdf0cc3e2..0cb157e00 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.schema.mof +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.schema.mof @@ -2,7 +2,7 @@ **Example** - SPOfficeOnlineServerBinding OosBinding + SPOfficeOnlineServerBinding OosBinding { Zone = "internal-https" DnsName = "webapps.contoso.com" diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.psm1 index b4a34e7e8..c025cb1e7 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.psm1 @@ -41,24 +41,24 @@ function Get-TargetResource $installedVersion = Get-SPDscInstalledProductVersion if (($PSBoundParameters.ContainsKey("UseTLS") -eq $true) -and ` - $installedVersion.FileMajorPart -ne 16) + $installedVersion.FileMajorPart -ne 16) { throw [Exception] "UseTLS is only supported in SharePoint 2016 and SharePoint 2019." } if (($PSBoundParameters.ContainsKey("SMTPPort") -eq $true) -and ` - $installedVersion.FileMajorPart -ne 16) + $installedVersion.FileMajorPart -ne 16) { throw [Exception] "SMTPPort is only supported in SharePoint 2016 and SharePoint 2019." } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $webApp = Get-SPWebApplication -Identity $params.WebAppUrl ` - -IncludeCentralAdministration ` - -ErrorAction SilentlyContinue + -IncludeCentralAdministration ` + -ErrorAction SilentlyContinue if ($null -eq $webApp) { @@ -135,20 +135,20 @@ function Set-TargetResource $installedVersion = Get-SPDscInstalledProductVersion if (($PSBoundParameters.ContainsKey("UseTLS") -eq $true) -and ` - $installedVersion.FileMajorPart -lt 16) + $installedVersion.FileMajorPart -lt 16) { throw [Exception] "UseTLS is only supported in SharePoint 2016 and SharePoint 2019." } if (($PSBoundParameters.ContainsKey("SMTPPort") -eq $true) -and ` - $installedVersion.FileMajorPart -lt 16) + $installedVersion.FileMajorPart -lt 16) { throw [Exception] "SMTPPort is only supported in SharePoint 2016 and SharePoint 2019." } $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $webApp = $null @@ -163,13 +163,15 @@ function Set-TargetResource $installedVersion = Get-SPDscInstalledProductVersion switch ($installedVersion.FileMajorPart) { - 15 { + 15 + { $webApp.UpdateMailSettings($params.SMTPServer, ` - $params.FromAddress, ` - $params.ReplyToAddress, ` - $params.CharacterSet) + $params.FromAddress, ` + $params.ReplyToAddress, ` + $params.CharacterSet) } - 16 { + 16 + { if ($params.ContainsKey("UseTLS") -eq $false) { $UseTLS = $false @@ -189,15 +191,16 @@ function Set-TargetResource } $webApp.UpdateMailSettings($params.SMTPServer, ` - $params.FromAddress, ` - $params.ReplyToAddress, ` - $params.CharacterSet, ` - $UseTLS, ` - $SMTPPort) + $params.FromAddress, ` + $params.ReplyToAddress, ` + $params.CharacterSet, ` + $UseTLS, ` + $SMTPPort) } - default { + default + { throw ("Detected an unsupported major version of SharePoint. SharePointDsc only " + ` - "supports SharePoint 2013, 2016 or 2019.") + "supports SharePoint 2013, 2016 or 2019.") } } } @@ -250,13 +253,13 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("SMTPServer", - "FromAddress", - "ReplyToAddress", - "CharacterSet", - "UseTLS", - "SMTPPort") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("SMTPServer", + "FromAddress", + "ReplyToAddress", + "CharacterSet", + "UseTLS", + "SMTPPort") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.psm1 index 2cb4ccbe1..82240c22c 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.psm1 @@ -14,17 +14,17 @@ function Get-TargetResource $MailAddress, [Parameter()] - [ValidateRange(0,356)] + [ValidateRange(0, 356)] [System.UInt32] $DaysBeforeExpiry, [Parameter()] - [ValidateRange(0,36000)] + [ValidateRange(0, 36000)] [System.UInt32] $PasswordChangeWaitTimeSeconds, [Parameter()] - [ValidateRange(0,99)] + [ValidateRange(0, 99)] [System.UInt32] $NumberOfRetries, @@ -36,8 +36,8 @@ function Get-TargetResource Write-Verbose -Message "Getting farm wide automatic password change settings" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $farm = Get-SPFarm if ($null -eq $farm ) { @@ -76,17 +76,17 @@ function Set-TargetResource $MailAddress, [Parameter()] - [ValidateRange(0,356)] + [ValidateRange(0, 356)] [System.UInt32] $DaysBeforeExpiry, [Parameter()] - [ValidateRange(0,36000)] + [ValidateRange(0, 36000)] [System.UInt32] $PasswordChangeWaitTimeSeconds, [Parameter()] - [ValidateRange(0,99)] + [ValidateRange(0, 99)] [System.UInt32] $NumberOfRetries, @@ -98,8 +98,8 @@ function Set-TargetResource Write-Verbose -Message "Setting farm wide automatic password change settings" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $farm = Get-SPFarm -ErrorAction Continue @@ -141,17 +141,17 @@ function Test-TargetResource $MailAddress, [Parameter()] - [ValidateRange(0,356)] + [ValidateRange(0, 356)] [System.UInt32] $DaysBeforeExpiry, [Parameter()] - [ValidateRange(0,36000)] + [ValidateRange(0, 36000)] [System.UInt32] $PasswordChangeWaitTimeSeconds, [Parameter()] - [ValidateRange(0,99)] + [ValidateRange(0, 99)] [System.UInt32] $NumberOfRetries, @@ -168,11 +168,11 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("MailAddress", - "DaysBeforeExpiry", - "PasswordChangeWaitTimeSeconds", - "NumberOfRetries") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("MailAddress", + "DaysBeforeExpiry", + "PasswordChangeWaitTimeSeconds", + "NumberOfRetries") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.psm1 index 70f3444fb..1e90fcdd1 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.psm1 @@ -25,7 +25,7 @@ function Get-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -37,16 +37,16 @@ function Get-TargetResource Write-Verbose -Message "Getting for PerformancePoint Service Application '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue $nullReturn = @{ - Name = $params.Name + Name = $params.Name ApplicationPool = $params.ApplicationPool - Ensure = "Absent" - InstallAccount = $params.InstallAccount + Ensure = "Absent" + InstallAccount = $params.InstallAccount } if ($null -eq $serviceApps) { @@ -112,7 +112,7 @@ function Set-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -129,12 +129,12 @@ function Set-TargetResource { Write-Verbose -Message "Creating PerformancePoint Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $newParams = @{ - Name = $params.Name + Name = $params.Name ApplicationPool = $params.ApplicationPool } if ($params.ContainsKey("DatabaseName") -eq $true) @@ -156,8 +156,8 @@ function Set-TargetResource $pName = $params.ProxyName } New-SPPerformancePointServiceApplicationProxy -Name $pName ` - -ServiceApplication $params.Name ` - -Default + -ServiceApplication $params.Name ` + -Default } } @@ -167,16 +167,16 @@ function Set-TargetResource { Write-Verbose -Message "Updating PerformancePoint Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.PerformancePoint.Scorecards.BIMonitoringServiceApplication" - } | Set-SPPerformancePointServiceApplication -ApplicationPool $appPool + | Where-Object -FilterScript { + $_.GetType().FullName -eq "Microsoft.PerformancePoint.Scorecards.BIMonitoringServiceApplication" + } | Set-SPPerformancePointServiceApplication -ApplicationPool $appPool } } } @@ -184,8 +184,8 @@ function Set-TargetResource { Write-Verbose -Message "Removing PerformancePoint Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $app = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { @@ -233,7 +233,7 @@ function Test-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -252,8 +252,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ApplicationPool", "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("ApplicationPool", "Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.psm1 index 01e089fee..1989b51e1 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.psm1 @@ -37,7 +37,7 @@ function Get-TargetResource $WorkerTimeoutInSeconds, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -49,12 +49,12 @@ function Get-TargetResource Write-Verbose -Message "Getting PowerPoint Automation service app '$Name'" if (($ApplicationPool ` - -or $ProxyName ` - -or $CacheExpirationPeriodInSeconds ` - -or $MaximumConversionsPerWorker ` - -or $WorkerKeepAliveTimeoutInSeconds ` - -or $WorkerProcessCount ` - -or $WorkerTimeoutInSeconds) -and ($Ensure -eq "Absent")) + -or $ProxyName ` + -or $CacheExpirationPeriodInSeconds ` + -or $MaximumConversionsPerWorker ` + -or $WorkerKeepAliveTimeoutInSeconds ` + -or $WorkerProcessCount ` + -or $WorkerTimeoutInSeconds) -and ($Ensure -eq "Absent")) { throw "You cannot use any of the parameters when Ensure is specified as Absent" } @@ -62,15 +62,15 @@ function Get-TargetResource if (($Ensure -eq "Present") -and -not $ApplicationPool) { throw ("An Application Pool is required to configure the PowerPoint " + ` - "Automation Service Application") + "Automation Service Application") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $nullReturn = @{ Name = $params.Name Ensure = "Absent" @@ -160,7 +160,7 @@ function Set-TargetResource $WorkerTimeoutInSeconds, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -172,28 +172,28 @@ function Set-TargetResource Write-Verbose -Message "Setting PowerPoint Automation service app '$Name'" if (($ApplicationPool ` - -or $ProxyName ` - -or $CacheExpirationPeriodInSeconds ` - -or $MaximumConversionsPerWorker ` - -or $WorkerKeepAliveTimeoutInSeconds ` - -or $WorkerProcessCount ` - -or $WorkerTimeoutInSeconds) -and ($Ensure -eq "Absent")) - { - throw "You cannot use any of the parameters when Ensure is specified as Absent" - } + -or $ProxyName ` + -or $CacheExpirationPeriodInSeconds ` + -or $MaximumConversionsPerWorker ` + -or $WorkerKeepAliveTimeoutInSeconds ` + -or $WorkerProcessCount ` + -or $WorkerTimeoutInSeconds) -and ($Ensure -eq "Absent")) + { + throw "You cannot use any of the parameters when Ensure is specified as Absent" + } if (($Ensure -eq "Present") -and -not $ApplicationPool) { throw ("An Application Pool is required to configure the PowerPoint " + ` - "Automation Service Application") + "Automation Service Application") } $result = Get-TargetResource @PSBoundParameters - if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") - { + if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") + { Write-Verbose -Message "Creating PowerPoint Automation Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $proxyName = $params.ProxyName @@ -235,32 +235,32 @@ function Set-TargetResource throw "Specified application pool does not exist" } } - } - if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") - { + } + if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") + { Write-Verbose -Message "Updating PowerPoint Automation Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters, $result ` - -ScriptBlock { + -Arguments $PSBoundParameters, $result ` + -ScriptBlock { $params = $args[0] $result = $args[1] $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $serviceApps) { throw "No Service applications are available in the farm." } $serviceApp = $serviceApps ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.PowerPoint.Administration.PowerPointConversionServiceApplication" + | Where-Object -FilterScript { + $_.GetType().FullName -eq "Microsoft.Office.Server.PowerPoint.Administration.PowerPointConversionServiceApplication" } if ($null -eq $serviceApp) { throw "Unable to find specified service application." } if ([string]::IsNullOrEmpty($params.ApplicationPool) -eq $false ` - -and $params.ApplicationPool -ne $result.ApplicationPool) + -and $params.ApplicationPool -ne $result.ApplicationPool) { $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool if ($null -eq $appPool) @@ -270,7 +270,7 @@ function Set-TargetResource $serviceApp.ApplicationPool = $appPool } if ([string]::IsNullOrEmpty($params.ProxyName) -eq $false ` - -and $params.ProxyName -ne $result.ProxyName) + -and $params.ProxyName -ne $result.ProxyName) { $proxies = Get-SPServiceApplicationProxy foreach ($proxyInstance in $proxies) @@ -302,11 +302,11 @@ function Set-TargetResource { $serviceApp.WorkerTimeoutInSeconds = $params.WorkerTimeoutInSeconds } - $serviceApp.Update(); + $serviceApp.Update(); } - } - if ($Ensure -eq "Absent") - { + } + if ($Ensure -eq "Absent") + { Write-Verbose -Message "Removing PowerPoint Automation Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] @@ -332,7 +332,7 @@ function Set-TargetResource Remove-SPServiceApplication -Identity $serviceApp -Confirm:$false } } - } + } } @@ -375,7 +375,7 @@ function Test-TargetResource $WorkerTimeoutInSeconds, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure, @@ -386,12 +386,12 @@ function Test-TargetResource Write-Verbose -Message "Testing PowerPoint Automation service app '$Name'" if (($ApplicationPool -or ` - $ProxyName -or ` - $CacheExpirationPeriodInSeconds -or ` - $MaximumConversionsPerWorker -or ` - $WorkerKeepAliveTimeoutInSeconds -or ` - $WorkerProcessCount -or ` - $WorkerTimeoutInSeconds) -and ($Ensure -eq "Absent")) + $ProxyName -or ` + $CacheExpirationPeriodInSeconds -or ` + $MaximumConversionsPerWorker -or ` + $WorkerKeepAliveTimeoutInSeconds -or ` + $WorkerProcessCount -or ` + $WorkerTimeoutInSeconds) -and ($Ensure -eq "Absent")) { throw "You cannot use any of the parameters when Ensure is specified as Absent" } @@ -399,7 +399,7 @@ function Test-TargetResource if (($Ensure -eq "Present") -and -not $ApplicationPool) { throw ("An Application Pool is required to configure the PowerPoint " + ` - "Automation Service Application") + "Automation Service Application") } $CurrentValues = Get-TargetResource @PSBoundParameters @@ -410,13 +410,13 @@ function Test-TargetResource if ($Ensure -eq "Absent") { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters + -DesiredValues $PSBoundParameters } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.psm1 index 29478569d..b2eae99af 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.psm1 @@ -83,7 +83,7 @@ function Get-TargetResource if ($null -ne $zone) { throw ("Setup file is blocked! Please use 'Unblock-File -Path $SetupFile' " + ` - "to unblock the file before continuing.") + "to unblock the file before continuing.") } Write-Verbose -Message "File not blocked, continuing." } @@ -311,7 +311,7 @@ function Set-TargetResource if ($null -ne $zone) { throw ("Setup file is blocked! Please use 'Unblock-File -Path $SetupFile' " + ` - "to unblock the file before continuing.") + "to unblock the file before continuing.") } Write-Verbose -Message "File not blocked, continuing." } @@ -344,7 +344,7 @@ function Set-TargetResource if ($BinaryInstallTime) { Write-Verbose -Message ("BinaryInstallTime parameter exists, check if current time is inside " + ` - "of time window") + "of time window") $upgradeTimes = $BinaryInstallTime.Split(" ") $starttime = 0 $endtime = 0 @@ -391,7 +391,19 @@ function Set-TargetResource $installedVersion = Get-SPDscInstalledProductVersion - if ($ShutdownServices) + Write-Verbose -Message "Try to load local Farm" + + $farmIsAvailable = Invoke-SPDscCommand -Credential $InstallAccount ` + -ScriptBlock { + $farm = Get-SPFarm -ErrorAction SilentlyContinue + if ($null -eq $farm) + { + return $false + } + return $true + } + + if ($ShutdownServices -and $farmIsAvailable) { Write-Verbose -Message "Stopping services to speed up installation process" @@ -412,7 +424,7 @@ function Set-TargetResource $hostControllerSvc = Get-Service -Name "SPSearchHostController" Invoke-SPDscCommand -Credential $InstallAccount ` - -ScriptBlock { + -ScriptBlock { $searchSAs = Get-SPEnterpriseSearchServiceApplication foreach ($searchSA in $searchSAs) { @@ -452,9 +464,9 @@ function Set-TargetResource Set-Service -Name "SPTimerV4" -StartupType Disabled $null = Start-Process -FilePath "iisreset.exe" ` - -ArgumentList "-stop -noforce" ` - -Wait ` - -PassThru + -ArgumentList "-stop -noforce" ` + -Wait ` + -PassThru $timerSvc = Get-Service -Name "SPTimerV4" if ($timerSvc.Status -eq "Running") @@ -466,8 +478,8 @@ function Set-TargetResource Write-Verbose -Message "Beginning installation of the SharePoint update" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $SetupFile ` - -ScriptBlock { + -Arguments $SetupFile ` + -ScriptBlock { $setupFile = $args[0] Write-Verbose -Message "Checking if SetupFile is an UNC path" @@ -527,7 +539,7 @@ function Set-TargetResource } } - if ($ShutdownServices) + if ($ShutdownServices -and $farmIsAvailable) { Write-Verbose -Message "Restart stopped services" Set-Service -Name "SPTimerV4" -StartupType Automatic @@ -542,9 +554,9 @@ function Set-TargetResource $timerSvc.Start() Start-Process -FilePath "iisreset.exe" ` - -ArgumentList "-start" ` - -Wait ` - -PassThru + -ArgumentList "-start" ` + -Wait ` + -PassThru $osearchSvc = Get-Service -Name $searchServiceName $hostControllerSvc = Get-Service -Name "SPSearchHostController" @@ -566,7 +578,7 @@ function Set-TargetResource { # Resuming Search Service Application if paused### Invoke-SPDscCommand -Credential $InstallAccount ` - -ScriptBlock { + -ScriptBlock { $searchSAs = Get-SPEnterpriseSearchServiceApplication foreach ($searchSA in $searchSAs) { @@ -631,8 +643,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } function Get-SPDscLocalVersionInfo @@ -677,9 +689,10 @@ function Get-SPDscLocalVersionInfo $nullVersion = New-Object -TypeName System.Version $versionInfoValue = New-Object -TypeName System.Version - $officeProductKeys = $installerEntries | Where-Object -FilterScript {$_.PsPath -like "*00000000F01FEC"} + $officeProductKeys = $installerEntries | Where-Object -FilterScript { $_.PsPath -like "*00000000F01FEC" } - if ($null -eq $installerEntries -or $null -eq $officeProductKeys ){ + if ($null -eq $installerEntries -or $null -eq $officeProductKeys ) + { return $nullVersion } @@ -689,7 +702,8 @@ function Get-SPDscLocalVersionInfo $productInfo = Get-ItemProperty "Registry::$($officeProductKey)\InstallProperties" -ErrorAction SilentlyContinue - if ($null -eq $productInfo){ + if ($null -eq $productInfo) + { break } @@ -778,7 +792,7 @@ function Clear-ComObject { param ( - [Parameter(Mandatory=$true)] + [Parameter(Mandatory = $true)] [System.Object] $ComObject ) diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerADResourcePoolSync/MSFT_SPProjectServerADResourcePoolSync.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerADResourcePoolSync/MSFT_SPProjectServerADResourcePoolSync.psm1 index 8431afc4b..ff9430c47 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerADResourcePoolSync/MSFT_SPProjectServerADResourcePoolSync.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerADResourcePoolSync/MSFT_SPProjectServerADResourcePoolSync.psm1 @@ -13,7 +13,7 @@ function Get-TargetResource $GroupNames, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -31,12 +31,12 @@ function Get-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -lt 16) { throw [Exception] ("Support for Project Server in SharePointDsc is only valid for " + ` - "SharePoint 2016 and 2019.") + "SharePoint 2016 and 2019.") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -46,8 +46,8 @@ function Get-TargetResource $webAppUrl = (Get-SPSite -Identity $params.Url).WebApplication.Url $useKerberos = -not (Get-SPAuthenticationProvider -WebApplication $webAppUrl -Zone Default).DisableKerberos $adminService = New-SPDscProjectServerWebService -PwaUrl $params.Url ` - -EndpointName Admin ` - -UseKerberos:$useKerberos + -EndpointName Admin ` + -UseKerberos:$useKerberos $script:currentSettings = $null $script:reactivateUsers = $false @@ -60,11 +60,11 @@ function Get-TargetResource if ($null -eq $script:currentSettings) { return @{ - Url = $params.Url - GroupNames = @() - Ensure = "Absent" + Url = $params.Url + GroupNames = @() + Ensure = "Absent" AutoReactivateUsers = $false - InstallAccount = $params.InstallAccount + InstallAccount = $params.InstallAccount } } else @@ -72,11 +72,11 @@ function Get-TargetResource if ($null -eq $script:currentSettings.ADGroupGuids -or $script:currentSettings.ADGroupGuids.Length -lt 1) { return @{ - Url = $params.Url - GroupNames = @() - Ensure = "Absent" + Url = $params.Url + GroupNames = @() + Ensure = "Absent" AutoReactivateUsers = $script:reactivateUsers - InstallAccount = $params.InstallAccount + InstallAccount = $params.InstallAccount } } else @@ -88,11 +88,11 @@ function Get-TargetResource } return @{ - Url = $params.Url - GroupNames = $adGroups - Ensure = "Present" + Url = $params.Url + GroupNames = $adGroups + Ensure = "Present" AutoReactivateUsers = $script:reactivateUsers - InstallAccount = $params.InstallAccount + InstallAccount = $params.InstallAccount } } } @@ -115,7 +115,7 @@ function Set-TargetResource $GroupNames, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -133,14 +133,14 @@ function Set-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -lt 16) { throw [Exception] ("Support for Project Server in SharePointDsc is only valid for " + ` - "SharePoint 2016 and 2019.") + "SharePoint 2016 and 2019.") } if ($Ensure -eq "Present") { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] @@ -152,19 +152,19 @@ function Set-TargetResource } Enable-SPProjectActiveDirectoryEnterpriseResourcePoolSync -Url $params.Url ` - -GroupUids $groupIDs.ToArray() + -GroupUids $groupIDs.ToArray() if ($params.ContainsKey("AutoReactivateUsers") -eq $true) { $webAppUrl = (Get-SPSite -Identity $params.Url).WebApplication.Url $useKerberos = -not (Get-SPAuthenticationProvider -WebApplication $webAppUrl -Zone Default).DisableKerberos $adminService = New-SPDscProjectServerWebService -PwaUrl $params.Url ` - -EndpointName Admin ` - -UseKerberos:$useKerberos + -EndpointName Admin ` + -UseKerberos:$useKerberos Use-SPDscProjectServerWebService -Service $adminService -ScriptBlock { $settings = $adminService.GetActiveDirectorySyncEnterpriseResourcePoolSettings() - $settings.AutoReactivateInactiveUsers = $params.AutoReactivateUsers + $settings.AutoReactivateInactiveUsers = $params.AutoReactivateUsers $adminService.SetActiveDirectorySyncEnterpriseResourcePoolSettings($settings) } } @@ -173,8 +173,8 @@ function Set-TargetResource else { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] @@ -199,7 +199,7 @@ function Test-TargetResource $GroupNames, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -233,8 +233,8 @@ function Test-TargetResource } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck $paramsToCheck + -DesiredValues $PSBoundParameters ` + -ValuesToCheck $paramsToCheck } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerAdditionalSettings/MSFT_SPProjectServerAdditionalSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerAdditionalSettings/MSFT_SPProjectServerAdditionalSettings.psm1 index 1075a7470..25b1b0643 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerAdditionalSettings/MSFT_SPProjectServerAdditionalSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerAdditionalSettings/MSFT_SPProjectServerAdditionalSettings.psm1 @@ -30,12 +30,12 @@ function Get-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -lt 16) { throw [Exception] ("Support for Project Server in SharePointDsc is only valid for " + ` - "SharePoint 2016 and 2019.") + "SharePoint 2016 and 2019.") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -45,8 +45,8 @@ function Get-TargetResource $webAppUrl = (Get-SPSite -Identity $params.Url).WebApplication.Url $useKerberos = -not (Get-SPAuthenticationProvider -WebApplication $webAppUrl -Zone Default).DisableKerberos $adminService = New-SPDscProjectServerWebService -PwaUrl $params.Url ` - -EndpointName Admin ` - -UseKerberos:$useKerberos + -EndpointName Admin ` + -UseKerberos:$useKerberos $script:ProjectProfessionalMinBuildNumberValue = $null $script:ServerCurrencyValue = $null @@ -59,11 +59,11 @@ function Get-TargetResource } return @{ - Url = $params.Url + Url = $params.Url ProjectProfessionalMinBuildNumber = $script:ProjectProfessionalMinBuildNumberValue - ServerCurrency = $script:ServerCurrencyValue - EnforceServerCurrency = $script:EnforceServerCurrencyValue - InstallAccount = $params.InstallAccount + ServerCurrency = $script:ServerCurrencyValue + EnforceServerCurrency = $script:EnforceServerCurrencyValue + InstallAccount = $params.InstallAccount } } return $result @@ -101,12 +101,12 @@ function Set-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -lt 16) { throw [Exception] ("Support for Project Server in SharePointDsc is only valid for " + ` - "SharePoint 2016 and 2019.") + "SharePoint 2016 and 2019.") } Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -116,8 +116,8 @@ function Set-TargetResource $webAppUrl = (Get-SPSite -Identity $params.Url).WebApplication.Url $useKerberos = -not (Get-SPAuthenticationProvider -WebApplication $webAppUrl -Zone Default).DisableKerberos $adminService = New-SPDscProjectServerWebService -PwaUrl $params.Url ` - -EndpointName Admin ` - -UseKerberos:$useKerberos + -EndpointName Admin ` + -UseKerberos:$useKerberos Use-SPDscProjectServerWebService -Service $adminService -ScriptBlock { if ($params.ContainsKey("ProjectProfessionalMinBuildNumber") -eq $true) @@ -180,12 +180,12 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @( - "ProjectProfessionalMinBuildNumber" - "ServerCurrency", - "EnforceServerCurrency" - ) + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @( + "ProjectProfessionalMinBuildNumber" + "ServerCurrency", + "EnforceServerCurrency" + ) } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerGlobalPermissions/MSFT_SPProjectServerGlobalPermissions.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerGlobalPermissions/MSFT_SPProjectServerGlobalPermissions.psm1 index 1038255d5..5f30ba397 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerGlobalPermissions/MSFT_SPProjectServerGlobalPermissions.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerGlobalPermissions/MSFT_SPProjectServerGlobalPermissions.psm1 @@ -35,19 +35,19 @@ function Get-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -lt 16) { throw [Exception] ("Support for Project Server in SharePointDsc is only valid for " + ` - "SharePoint 2016 and 2019.") + "SharePoint 2016 and 2019.") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] if ((Get-SPProjectPermissionMode -Url $params.Url) -ne "ProjectServer") { throw [Exception] ("SPProjectServerGlobalPermissions is designed for Project Server " + ` - "permissions mode only, and this site is set to SharePoint mode") + "permissions mode only, and this site is set to SharePoint mode") } $modulePath = "..\..\Modules\SharePointDsc.ProjectServer\ProjectServerConnector.psm1" @@ -57,29 +57,31 @@ function Get-TargetResource $denyPermissions = @() $script:resultDataSet = $null - switch($params.EntityType) + switch ($params.EntityType) { - "User" { + "User" + { $webAppUrl = (Get-SPSite -Identity $params.Url).WebApplication.Url $useKerberos = -not (Get-SPAuthenticationProvider -WebApplication $webAppUrl -Zone Default).DisableKerberos $resourceService = New-SPDscProjectServerWebService -PwaUrl $params.Url ` - -EndpointName Resource ` - -UseKerberos:$useKerberos + -EndpointName Resource ` + -UseKerberos:$useKerberos $userId = Get-SPDscProjectServerResourceId -PwaUrl $params.Url -ResourceName $params.EntityName Use-SPDscProjectServerWebService -Service $resourceService -ScriptBlock { $script:resultDataSet = $resourceService.ReadResourceAuthorization($userId) } } - "Group" { + "Group" + { $webAppUrl = (Get-SPSite -Identity $params.Url).WebApplication.Url $useKerberos = -not (Get-SPAuthenticationProvider -WebApplication $webAppUrl -Zone Default).DisableKerberos $securityService = New-SPDscProjectServerWebService -PwaUrl $params.Url ` - -EndpointName Security ` - -UseKerberos:$useKerberos + -EndpointName Security ` + -UseKerberos:$useKerberos Use-SPDscProjectServerWebService -Service $securityService -ScriptBlock { - $groupInfo = $securityService.ReadGroupList().SecurityGroups | Where-Object -FilterScript { + $groupInfo = $securityService.ReadGroupList().SecurityGroups | Where-Object -FilterScript { $_.WSEC_GRP_NAME -eq $params.EntityName } $script:resultDataSet = $securityService.ReadGroup($groupInfo.WSEC_GRP_UID) @@ -100,11 +102,11 @@ function Get-TargetResource } return @{ - Url = $params.Url - EntityName = $params.EntityName - EntityType = $params.EntityType + Url = $params.Url + EntityName = $params.EntityName + EntityType = $params.EntityType AllowPermissions = $allowPermissions - DenyPermissions = $denyPermissions + DenyPermissions = $denyPermissions } } return $result @@ -147,8 +149,8 @@ function Set-TargetResource $currentValues = Get-TargetResource @PSBoundParameters $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot, $currentValues) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot, $currentValues) ` + -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] $currentValues = $args[2] @@ -165,16 +167,18 @@ function Set-TargetResource if ($params.ContainsKey("AllowPermissions") -eq $true) { $allowPermsDifference = Compare-Object -ReferenceObject $currentValues.AllowPermissions ` - -DifferenceObject $params.AllowPermissions + -DifferenceObject $params.AllowPermissions $allowPermsDifference | ForEach-Object -Process { $diff = $_ switch ($diff.SideIndicator) { - "<=" { + "<=" + { $allowPermsToRemove += $diff.InputObject } - "=>" { + "=>" + { $allowPermsToAdd += $diff.InputObject } } @@ -183,30 +187,33 @@ function Set-TargetResource if ($params.ContainsKey("DenyPermissions") -eq $true) { $denyPermsDifference = Compare-Object -ReferenceObject $currentValues.DenyPermissions ` - -DifferenceObject $params.DenyPermissions + -DifferenceObject $params.DenyPermissions $denyPermsDifference | ForEach-Object -Process { $diff = $_ switch ($diff.SideIndicator) { - "<=" { + "<=" + { $denyPermsToRemove += $diff.InputObject } - "=>" { + "=>" + { $denyPermsToAdd += $diff.InputObject } } } } - switch($params.EntityType) + switch ($params.EntityType) { - "User" { + "User" + { $webAppUrl = (Get-SPSite -Identity $params.Url).WebApplication.Url $useKerberos = -not (Get-SPAuthenticationProvider -WebApplication $webAppUrl -Zone Default).DisableKerberos $resourceService = New-SPDscProjectServerWebService -PwaUrl $params.Url ` - -EndpointName Resource ` - -UseKerberos:$useKerberos + -EndpointName Resource ` + -UseKerberos:$useKerberos $userId = Get-SPDscProjectServerResourceId -PwaUrl $params.Url -ResourceName $params.EntityName Use-SPDscProjectServerWebService -Service $resourceService -ScriptBlock { @@ -247,15 +254,16 @@ function Set-TargetResource $resourceService.UpdateResources($dataSet, $false, $true) } } - "Group" { + "Group" + { $webAppUrl = (Get-SPSite -Identity $params.Url).WebApplication.Url $useKerberos = -not (Get-SPAuthenticationProvider -WebApplication $webAppUrl -Zone Default).DisableKerberos $securityService = New-SPDscProjectServerWebService -PwaUrl $params.Url ` - -EndpointName Security ` - -UseKerberos:$useKerberos + -EndpointName Security ` + -UseKerberos:$useKerberos Use-SPDscProjectServerWebService -Service $securityService -ScriptBlock { - $groupInfo = $securityService.ReadGroupList().SecurityGroups | Where-Object -FilterScript { + $groupInfo = $securityService.ReadGroupList().SecurityGroups | Where-Object -FilterScript { $_.WSEC_GRP_NAME -eq $params.EntityName } $dataSet = $securityService.ReadGroup($groupInfo.WSEC_GRP_UID) @@ -341,11 +349,11 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @( - "AllowPermissions", - "DenyPermissions" - ) + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @( + "AllowPermissions", + "DenyPermissions" + ) } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerGroup/MSFT_SPProjectServerGroup.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerGroup/MSFT_SPProjectServerGroup.psm1 index 07f8b407d..95cb0b124 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerGroup/MSFT_SPProjectServerGroup.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerGroup/MSFT_SPProjectServerGroup.psm1 @@ -33,7 +33,7 @@ function Get-TargetResource $MembersToExclude, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -47,36 +47,36 @@ function Get-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -lt 16) { throw [Exception] ("Support for Project Server in SharePointDsc is only valid for " + ` - "SharePoint 2016 and 2019.") + "SharePoint 2016 and 2019.") } if ($PSBoundParameters.ContainsKey("ADGroup") -eq $true -and ` ($PSBoundParameters.ContainsKey("Members") -eq $true -or ` - $PSBoundParameters.ContainsKey("MembersToInclude") -eq $true -or ` - $PSBoundParameters.ContainsKey("MembersToExclude") -eq $true)) + $PSBoundParameters.ContainsKey("MembersToInclude") -eq $true -or ` + $PSBoundParameters.ContainsKey("MembersToExclude") -eq $true)) { throw ("Property ADGroup can not be used at the same time as Members, " + ` - "MembersToInclude or MembersToExclude") + "MembersToInclude or MembersToExclude") } if ($PSBoundParameters.ContainsKey("Members") -eq $true -and ` ($PSBoundParameters.ContainsKey("MembersToInclude") -eq $true -or ` - $PSBoundParameters.ContainsKey("MembersToExclude") -eq $true)) + $PSBoundParameters.ContainsKey("MembersToExclude") -eq $true)) { throw ("Property Members can not be used at the same time as " + ` - "MembersToInclude or MembersToExclude") + "MembersToInclude or MembersToExclude") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] if ((Get-SPProjectPermissionMode -Url $params.Url) -ne "ProjectServer") { throw [Exception] ("SPProjectServerGroup is design for Project Server permissions " + ` - "mode only, and this site is set to SharePoint mode") + "mode only, and this site is set to SharePoint mode") } $modulePath = "..\..\Modules\SharePointDsc.ProjectServer\ProjectServerConnector.psm1" @@ -85,12 +85,12 @@ function Get-TargetResource $webAppUrl = (Get-SPSite -Identity $params.Url).WebApplication.Url $useKerberos = -not (Get-SPAuthenticationProvider -WebApplication $webAppUrl -Zone Default).DisableKerberos $securityService = New-SPDscProjectServerWebService -PwaUrl $params.Url ` - -EndpointName Security ` - -UseKerberos:$useKerberos + -EndpointName Security ` + -UseKerberos:$useKerberos $script:groupDataSet = $null Use-SPDscProjectServerWebService -Service $securityService -ScriptBlock { - $groupInfo = $securityService.ReadGroupList().SecurityGroups | Where-Object -FilterScript { + $groupInfo = $securityService.ReadGroupList().SecurityGroups | Where-Object -FilterScript { $_.WSEC_GRP_NAME -eq $params.Name } @@ -137,7 +137,7 @@ function Get-TargetResource if ($groupMembers[$i].Contains(":0") -eq $true) { $realUserName = New-SPClaimsPrincipal -Identity $groupMembers[$i] ` - -IdentityType EncodedClaim + -IdentityType EncodedClaim $groupMembers[$i] = $realUserName.Value } } @@ -193,7 +193,7 @@ function Set-TargetResource $MembersToExclude, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -209,8 +209,8 @@ function Set-TargetResource if ($Ensure -eq "Present") { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot, $currentSettings) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot, $currentSettings) ` + -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -222,11 +222,11 @@ function Set-TargetResource $webAppUrl = (Get-SPSite -Identity $params.Url).WebApplication.Url $useKerberos = -not (Get-SPAuthenticationProvider -WebApplication $webAppUrl -Zone Default).DisableKerberos $securityService = New-SPDscProjectServerWebService -PwaUrl $params.Url ` - -EndpointName Security ` - -UseKerberos:$useKerberos + -EndpointName Security ` + -UseKerberos:$useKerberos Use-SPDscProjectServerWebService -Service $securityService -ScriptBlock { - $groupInfo = $securityService.ReadGroupList().SecurityGroups | Where-Object -FilterScript { + $groupInfo = $securityService.ReadGroupList().SecurityGroups | Where-Object -FilterScript { $_.WSEC_GRP_NAME -eq $params.Name } @@ -240,7 +240,7 @@ function Set-TargetResource $newGroupDS.SecurityGroups.AddSecurityGroupsRow($newGroup) $securityService.CreateGroups($newGroupDS) - $groupInfo = $securityService.ReadGroupList().SecurityGroups | Where-Object -FilterScript { + $groupInfo = $securityService.ReadGroupList().SecurityGroups | Where-Object -FilterScript { $_.WSEC_GRP_NAME -eq $params.Name } } @@ -313,8 +313,8 @@ function Set-TargetResource else { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -325,11 +325,11 @@ function Set-TargetResource $webAppUrl = (Get-SPSite -Identity $params.Url).WebApplication.Url $useKerberos = -not (Get-SPAuthenticationProvider -WebApplication $webAppUrl -Zone Default).DisableKerberos $securityService = New-SPDscProjectServerWebService -PwaUrl $params.Url ` - -EndpointName Security ` - -UseKerberos:$useKerberos + -EndpointName Security ` + -UseKerberos:$useKerberos Use-SPDscProjectServerWebService -Service $securityService -ScriptBlock { - $groupInfo = $securityService.ReadGroupList().SecurityGroups | Where-Object -FilterScript { + $groupInfo = $securityService.ReadGroupList().SecurityGroups | Where-Object -FilterScript { $_.WSEC_GRP_NAME -eq $params.Name } @@ -379,7 +379,7 @@ function Test-TargetResource $MembersToExclude, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -400,8 +400,8 @@ function Test-TargetResource if ($PSBoundParameters.ContainsKey("Members") -eq $true) { $membersMatch = Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Members") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Members") if ($membersMatch -eq $false) { return $false @@ -443,13 +443,13 @@ function Test-TargetResource } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @( - "Name", - "Description", - "ADGroup", - "Ensure" - ) + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @( + "Name", + "Description", + "ADGroup", + "Ensure" + ) } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerLicense/MSFT_SPProjectServerLicense.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerLicense/MSFT_SPProjectServerLicense.psm1 index 8a325c0df..45c05369e 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerLicense/MSFT_SPProjectServerLicense.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerLicense/MSFT_SPProjectServerLicense.psm1 @@ -10,7 +10,7 @@ function Get-TargetResource $IsSingleInstance, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -28,12 +28,12 @@ function Get-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -lt 16) { throw [Exception] ("Support for Project Server in SharePointDsc is only valid for " + ` - "SharePoint 2016 and 2019.") + "SharePoint 2016 and 2019.") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -65,9 +65,9 @@ function Get-TargetResource return @{ IsSingleInstance = "Yes" - Ensure = $status - ProductKey = $params.ProductKey - InstallAccount = $params.InstallAccount + Ensure = $status + ProductKey = $params.ProductKey + InstallAccount = $params.InstallAccount } } else @@ -75,9 +75,9 @@ function Get-TargetResource Write-Verbose -Message "Unable to determine the license status for Project Server" return @{ IsSingleInstance = "Yes" - Ensure = "Absent" - ProductKey = $params.ProductKey - InstallAccount = $params.InstallAccount + Ensure = "Absent" + ProductKey = $params.ProductKey + InstallAccount = $params.InstallAccount } } } @@ -86,9 +86,9 @@ function Get-TargetResource Write-Verbose -Message "Unable to determine the license status for Project Server" return @{ IsSingleInstance = "Yes" - Ensure = "Absent" - ProductKey = $params.ProductKey - InstallAccount = $params.InstallAccount + Ensure = "Absent" + ProductKey = $params.ProductKey + InstallAccount = $params.InstallAccount } } } @@ -107,7 +107,7 @@ function Set-TargetResource $IsSingleInstance, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -125,7 +125,7 @@ function Set-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -lt 16) { throw [Exception] ("Support for Project Server in SharePointDsc is only valid for " + ` - "SharePoint 2016 and 2019.") + "SharePoint 2016 and 2019.") } if ($Ensure -eq "Present" -and $PSBoundParameters.ContainsKey("ProductKey") -eq $false) @@ -141,8 +141,8 @@ function Set-TargetResource if ($Ensure -eq "Present") { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] Enable-ProjectServerLicense -key $params.ProductKey @@ -151,8 +151,8 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { Disable-ProjectServerLicense } @@ -173,7 +173,7 @@ function Test-TargetResource $IsSingleInstance, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -196,8 +196,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerPermissionMode/MSFT_SPProjectServerPermissionMode.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerPermissionMode/MSFT_SPProjectServerPermissionMode.psm1 index e3bac7e76..dd86ba3be 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerPermissionMode/MSFT_SPProjectServerPermissionMode.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerPermissionMode/MSFT_SPProjectServerPermissionMode.psm1 @@ -9,7 +9,7 @@ function Get-TargetResource $Url, [Parameter(Mandatory = $true)] - [ValidateSet("SharePoint","ProjectServer")] + [ValidateSet("SharePoint", "ProjectServer")] [System.String] $PermissionMode, @@ -23,12 +23,12 @@ function Get-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -lt 16) { throw [Exception] ("Support for Project Server in SharePointDsc is only valid for " + ` - "SharePoint 2016 and 2019.") + "SharePoint 2016 and 2019.") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -59,7 +59,7 @@ function Set-TargetResource $Url, [Parameter(Mandatory = $true)] - [ValidateSet("SharePoint","ProjectServer")] + [ValidateSet("SharePoint", "ProjectServer")] [System.String] $PermissionMode, @@ -73,12 +73,12 @@ function Set-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -lt 16) { throw [Exception] ("Support for Project Server in SharePointDsc is only valid for " + ` - "SharePoint 2016 and 2019.") + "SharePoint 2016 and 2019.") } Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] Set-SPProjectPermissionMode -Url $params.Url -Mode $params.PermissionMode @@ -96,7 +96,7 @@ function Test-TargetResource $Url, [Parameter(Mandatory = $true)] - [ValidateSet("SharePoint","ProjectServer")] + [ValidateSet("SharePoint", "ProjectServer")] [System.String] $PermissionMode, @@ -113,8 +113,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("PermissionMode") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("PermissionMode") } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerServiceApp/MSFT_SPProjectServerServiceApp.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerServiceApp/MSFT_SPProjectServerServiceApp.psm1 index 7492afadf..b5cf1cad7 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerServiceApp/MSFT_SPProjectServerServiceApp.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerServiceApp/MSFT_SPProjectServerServiceApp.psm1 @@ -17,7 +17,7 @@ function Get-TargetResource $ProxyName, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -31,16 +31,16 @@ function Get-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -lt 16) { throw [Exception] ("Support for Project Server in SharePointDsc is only valid for " + ` - "SharePoint 2016 and 2019.") + "SharePoint 2016 and 2019.") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $nullReturn = @{ Name = $params.Name ApplicationPool = "" @@ -104,7 +104,7 @@ function Set-TargetResource $ProxyName, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -118,7 +118,7 @@ function Set-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -lt 16) { throw [Exception] ("Support for Project Server in SharePointDsc is only valid for " + ` - "SharePoint 2016 and 2019.") + "SharePoint 2016 and 2019.") } $result = Get-TargetResource @PSBoundParameters @@ -127,12 +127,12 @@ function Set-TargetResource { Write-Verbose -Message "Creating Project Server Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $pwaApp = New-SPProjectServiceApplication -Name $params.Name ` - -ApplicationPool $params.ApplicationPool + -ApplicationPool $params.ApplicationPool if ($params.ContainsKey("ProxyName") -eq $true) { $pName = $params.ProxyName @@ -154,16 +154,16 @@ function Set-TargetResource { Write-Verbose -Message "Updating Project Server Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Project.Server.Administration.PsiServiceApplication" - } | Set-SPProjectServiceApplication -ApplicationPool $appPool + | Where-Object -FilterScript { + $_.GetType().FullName -eq "Microsoft.Office.Project.Server.Administration.PsiServiceApplication" + } | Set-SPProjectServiceApplication -ApplicationPool $appPool } } } @@ -172,14 +172,14 @@ function Set-TargetResource { Write-Verbose -Message "Removing Project Server service application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $app = Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Project.Server.Administration.PsiServiceApplication" - } + | Where-Object -FilterScript { + $_.GetType().FullName -eq "Microsoft.Office.Project.Server.Administration.PsiServiceApplication" + } $proxies = Get-SPServiceApplicationProxy foreach ($proxyInstance in $proxies) @@ -214,7 +214,7 @@ function Test-TargetResource $ProxyName, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -235,14 +235,14 @@ function Test-TargetResource if ($Ensure -eq "Present") { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ApplicationPool", "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("ApplicationPool", "Ensure") } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerTimeSheetSettings/MSFT_SPProjectServerTimeSheetSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerTimeSheetSettings/MSFT_SPProjectServerTimeSheetSettings.psm1 index ce0e7008e..bdda942eb 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerTimeSheetSettings/MSFT_SPProjectServerTimeSheetSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerTimeSheetSettings/MSFT_SPProjectServerTimeSheetSettings.psm1 @@ -13,17 +13,17 @@ function Get-TargetResource $EnableOvertimeAndNonBillableTracking, [Parameter()] - [ValidateSet("CurrentTaskAssignments","CurrentProjects","NoPrepopulation")] + [ValidateSet("CurrentTaskAssignments", "CurrentProjects", "NoPrepopulation")] [System.String] $DefaultTimesheetCreationMode, [Parameter()] - [ValidateSet("Days","Weeks")] + [ValidateSet("Days", "Weeks")] [System.String] $DefaultTrackingUnit, [Parameter()] - [ValidateSet("Hours","Days")] + [ValidateSet("Hours", "Days")] [System.String] $DefaultReportingUnit, @@ -80,7 +80,7 @@ function Get-TargetResource $SingleEntryMode, [Parameter()] - [ValidateSet("PercentComplete","ActualDoneAndRemaining","HoursPerPeriod","FreeForm")] + [ValidateSet("PercentComplete", "ActualDoneAndRemaining", "HoursPerPeriod", "FreeForm")] [System.String] $DefaultTrackingMode, @@ -98,12 +98,12 @@ function Get-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -lt 16) { throw [Exception] ("Support for Project Server in SharePointDsc is only valid for " + ` - "SharePoint 2016 and 2019.") + "SharePoint 2016 and 2019.") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -113,8 +113,8 @@ function Get-TargetResource $webAppUrl = (Get-SPSite -Identity $params.Url).WebApplication.Url $useKerberos = -not (Get-SPAuthenticationProvider -WebApplication $webAppUrl -Zone Default).DisableKerberos $adminService = New-SPDscProjectServerWebService -PwaUrl $params.Url ` - -EndpointName Admin ` - -UseKerberos:$useKerberos + -EndpointName Admin ` + -UseKerberos:$useKerberos $script:currentSettings = $null Use-SPDscProjectServerWebService -Service $adminService -ScriptBlock { @@ -152,13 +152,16 @@ function Get-TargetResource $currentDefaultTimesheetCreationMode = "Unknown" switch ($script:currentSettings.WADMIN_TS_CREATE_MODE_ENUM) { - 1 { + 1 + { $currentDefaultTimesheetCreationMode = "CurrentTaskAssignments" } - 2 { + 2 + { $currentDefaultTimesheetCreationMode = "CurrentProjects" } - 0 { + 0 + { $currentDefaultTimesheetCreationMode = "NoPrepopulation" } } @@ -166,10 +169,12 @@ function Get-TargetResource $currentDefaultTrackingUnit = "Unknown" switch ($script:currentSettings.WADMIN_TS_DEF_ENTRY_MODE_ENUM) { - 1 { + 1 + { $currentDefaultTrackingUnit = "Weeks" } - 0 { + 0 + { $currentDefaultTrackingUnit = "Days" } } @@ -177,10 +182,12 @@ function Get-TargetResource $currentDefaultReportingUnit = "Unknown" switch ($script:currentSettings.WADMIN_TS_REPORT_UNIT_ENUM) { - 1 { + 1 + { $currentDefaultReportingUnit = "Days" } - 0 { + 0 + { $currentDefaultReportingUnit = "Hours" } } @@ -188,16 +195,20 @@ function Get-TargetResource $currentDefaultTrackingMode = "Unknown" switch ($script:currentSettings.WADMIN_DEFAULT_TRACKING_METHOD) { - 3 { + 3 + { $currentDefaultTrackingMode = "ActualDoneAndRemaining" } - 2 { + 2 + { $currentDefaultTrackingMode = "PercentComplete" } - 1 { + 1 + { $currentDefaultTrackingMode = "HoursPerPeriod" } - 0 { + 0 + { $currentDefaultTrackingMode = "FreeForm" } } @@ -205,10 +216,12 @@ function Get-TargetResource $currentEnableOvertimeAndNonBillableTracking = $false switch ($script:currentSettings.WADMIN_TS_DEF_DISPLAY_ENUM) { - 7 { + 7 + { $currentEnableOvertimeAndNonBillableTracking = $true } - 0 { + 0 + { $currentEnableOvertimeAndNonBillableTracking = $false } } @@ -256,17 +269,17 @@ function Set-TargetResource $EnableOvertimeAndNonBillableTracking, [Parameter()] - [ValidateSet("CurrentTaskAssignments","CurrentProjects","NoPrepopulation")] + [ValidateSet("CurrentTaskAssignments", "CurrentProjects", "NoPrepopulation")] [System.String] $DefaultTimesheetCreationMode, [Parameter()] - [ValidateSet("Days","Weeks")] + [ValidateSet("Days", "Weeks")] [System.String] $DefaultTrackingUnit, [Parameter()] - [ValidateSet("Hours","Days")] + [ValidateSet("Hours", "Days")] [System.String] $DefaultReportingUnit, @@ -323,7 +336,7 @@ function Set-TargetResource $SingleEntryMode, [Parameter()] - [ValidateSet("PercentComplete","ActualDoneAndRemaining","HoursPerPeriod","FreeForm")] + [ValidateSet("PercentComplete", "ActualDoneAndRemaining", "HoursPerPeriod", "FreeForm")] [System.String] $DefaultTrackingMode, @@ -341,20 +354,20 @@ function Set-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -lt 16) { throw [Exception] ("Support for Project Server in SharePointDsc is only valid for " + ` - "SharePoint 2016 and 2019.") + "SharePoint 2016 and 2019.") } Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $webAppUrl = (Get-SPSite -Identity $params.Url).WebApplication.Url $useKerberos = -not (Get-SPAuthenticationProvider -WebApplication $webAppUrl -Zone Default).DisableKerberos $adminService = New-SPDscProjectServerWebService -PwaUrl $params.Url ` - -EndpointName Admin ` - -UseKerberos:$useKerberos + -EndpointName Admin ` + -UseKerberos:$useKerberos Use-SPDscProjectServerWebService -Service $adminService -ScriptBlock { $settings = $adminService.ReadTimeSheetSettings() @@ -363,10 +376,12 @@ function Set-TargetResource { switch ($params.EnableOvertimeAndNonBillableTracking) { - $true { + $true + { $settings.TimeSheetSettings.Rows[0]["WADMIN_TS_DEF_DISPLAY_ENUM"] = 7 } - $false { + $false + { $settings.TimeSheetSettings.Rows[0]["WADMIN_TS_DEF_DISPLAY_ENUM"] = 0 } } @@ -375,13 +390,16 @@ function Set-TargetResource { switch ($params.DefaultTimesheetCreationMode) { - "CurrentTaskAssignments" { + "CurrentTaskAssignments" + { $settings.TimeSheetSettings.Rows[0]["WADMIN_TS_CREATE_MODE_ENUM"] = 1 } - "CurrentProjects" { + "CurrentProjects" + { $settings.TimeSheetSettings.Rows[0]["WADMIN_TS_CREATE_MODE_ENUM"] = 2 } - "NoPrepopulation" { + "NoPrepopulation" + { $settings.TimeSheetSettings.Rows[0]["WADMIN_TS_CREATE_MODE_ENUM"] = 0 } } @@ -390,10 +408,12 @@ function Set-TargetResource { switch ($params.DefaultTrackingUnit) { - "Weeks" { + "Weeks" + { $settings.TimeSheetSettings.Rows[0]["WADMIN_TS_DEF_ENTRY_MODE_ENUM"] = 1 } - "Days" { + "Days" + { $settings.TimeSheetSettings.Rows[0]["WADMIN_TS_DEF_ENTRY_MODE_ENUM"] = 0 } } @@ -402,10 +422,12 @@ function Set-TargetResource { switch ($params.DefaultReportingUnit) { - "Days" { + "Days" + { $settings.TimeSheetSettings.Rows[0]["WADMIN_TS_REPORT_UNIT_ENUM"] = 1 } - "Hours" { + "Hours" + { $settings.TimeSheetSettings.Rows[0]["WADMIN_TS_REPORT_UNIT_ENUM"] = 0 } } @@ -466,16 +488,20 @@ function Set-TargetResource { switch ($params.DefaultTrackingMode) { - "ActualDoneAndRemaining" { + "ActualDoneAndRemaining" + { $settings.TimeSheetSettings.Rows[0]["WADMIN_DEFAULT_TRACKING_METHOD"] = 3 } - "PercentComplete" { + "PercentComplete" + { $settings.TimeSheetSettings.Rows[0]["WADMIN_DEFAULT_TRACKING_METHOD"] = 2 } - "HoursPerPeriod" { + "HoursPerPeriod" + { $settings.TimeSheetSettings.Rows[0]["WADMIN_DEFAULT_TRACKING_METHOD"] = 1 } - "FreeForm" { + "FreeForm" + { $settings.TimeSheetSettings.Rows[0]["WADMIN_DEFAULT_TRACKING_METHOD"] = 0 } } @@ -506,17 +532,17 @@ function Test-TargetResource $EnableOvertimeAndNonBillableTracking, [Parameter()] - [ValidateSet("CurrentTaskAssignments","CurrentProjects","NoPrepopulation")] + [ValidateSet("CurrentTaskAssignments", "CurrentProjects", "NoPrepopulation")] [System.String] $DefaultTimesheetCreationMode, [Parameter()] - [ValidateSet("Days","Weeks")] + [ValidateSet("Days", "Weeks")] [System.String] $DefaultTrackingUnit, [Parameter()] - [ValidateSet("Hours","Days")] + [ValidateSet("Hours", "Days")] [System.String] $DefaultReportingUnit, @@ -573,7 +599,7 @@ function Test-TargetResource $SingleEntryMode, [Parameter()] - [ValidateSet("PercentComplete","ActualDoneAndRemaining","HoursPerPeriod","FreeForm")] + [ValidateSet("PercentComplete", "ActualDoneAndRemaining", "HoursPerPeriod", "FreeForm")] [System.String] $DefaultTrackingMode, @@ -594,7 +620,7 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters + -DesiredValues $PSBoundParameters } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerUserSyncSettings/MSFT_SPProjectServerUserSyncSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerUserSyncSettings/MSFT_SPProjectServerUserSyncSettings.psm1 index 42e5877b5..01df0f7d6 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerUserSyncSettings/MSFT_SPProjectServerUserSyncSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerUserSyncSettings/MSFT_SPProjectServerUserSyncSettings.psm1 @@ -30,12 +30,12 @@ function Get-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -lt 16) { throw [Exception] ("Support for Project Server in SharePointDsc is only valid for " + ` - "SharePoint 2016 and 2019.") + "SharePoint 2016 and 2019.") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -45,8 +45,8 @@ function Get-TargetResource $webAppUrl = (Get-SPSite -Identity $params.Url).WebApplication.Url $useKerberos = -not (Get-SPAuthenticationProvider -WebApplication $webAppUrl -Zone Default).DisableKerberos $wssService = New-SPDscProjectServerWebService -PwaUrl $params.Url ` - -EndpointName WssInterop ` - -UseKerberos:$useKerberos + -EndpointName WssInterop ` + -UseKerberos:$useKerberos $script:currentValue = $null Use-SPDscProjectServerWebService -Service $wssService -ScriptBlock { @@ -69,7 +69,7 @@ function Get-TargetResource } else { - $bits = [Convert]::ToString($script:currentValue,2).PadLeft(4, '0').ToCharArray() | Select-Object -Last 4 + $bits = [Convert]::ToString($script:currentValue, 2).PadLeft(4, '0').ToCharArray() | Select-Object -Last 4 return @{ Url = $params.Url @@ -113,8 +113,8 @@ function Set-TargetResource Write-Verbose -Message "Setting User Sync settings for $Url" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] @@ -181,7 +181,7 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters + -DesiredValues $PSBoundParameters } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerWssSettings/MSFT_SPProjectServerWssSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerWssSettings/MSFT_SPProjectServerWssSettings.psm1 index 01fbb03a5..bd0d1edcd 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerWssSettings/MSFT_SPProjectServerWssSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPProjectServerWssSettings/MSFT_SPProjectServerWssSettings.psm1 @@ -9,7 +9,7 @@ function Get-TargetResource $Url, [Parameter(Mandatory = $true)] - [ValidateSet("AutoCreate","UserChoice","DontCreate")] + [ValidateSet("AutoCreate", "UserChoice", "DontCreate")] [System.String] $CreateProjectSiteMode, @@ -23,12 +23,12 @@ function Get-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -lt 16) { throw [Exception] ("Support for Project Server in SharePointDsc is only valid for " + ` - "SharePoint 2016 and 2019.") + "SharePoint 2016 and 2019.") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -38,8 +38,8 @@ function Get-TargetResource $webAppUrl = (Get-SPSite -Identity $params.Url).WebApplication.Url $useKerberos = -not (Get-SPAuthenticationProvider -WebApplication $webAppUrl -Zone Default).DisableKerberos $wssService = New-SPDscProjectServerWebService -PwaUrl $params.Url ` - -EndpointName WssInterop ` - -UseKerberos:$useKerberos + -EndpointName WssInterop ` + -UseKerberos:$useKerberos $script:currentValue = $null Use-SPDscProjectServerWebService -Service $wssService -ScriptBlock { @@ -53,15 +53,18 @@ function Get-TargetResource $currentValue = "Unknown" if ($null -ne $script:currentValue) { - switch($script:currentValue) + switch ($script:currentValue) { - 0 { + 0 + { $currentValue = "UserChoice" } - 1 { + 1 + { $currentValue = "AutoCreate" } - 2 { + 2 + { $currentValue = "DontCreate" } } @@ -87,7 +90,7 @@ function Set-TargetResource $Url, [Parameter(Mandatory = $true)] - [ValidateSet("AutoCreate","UserChoice","DontCreate")] + [ValidateSet("AutoCreate", "UserChoice", "DontCreate")] [System.String] $CreateProjectSiteMode, @@ -99,8 +102,8 @@ function Set-TargetResource Write-Verbose -Message "Setting WSS settings for $Url" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -110,21 +113,24 @@ function Set-TargetResource $webAppUrl = (Get-SPSite -Identity $params.Url).WebApplication.Url $useKerberos = -not (Get-SPAuthenticationProvider -WebApplication $webAppUrl -Zone Default).DisableKerberos $wssService = New-SPDscProjectServerWebService -PwaUrl $params.Url ` - -EndpointName WssInterop ` - -UseKerberos:$useKerberos + -EndpointName WssInterop ` + -UseKerberos:$useKerberos Use-SPDscProjectServerWebService -Service $wssService -ScriptBlock { $settings = $wssService.ReadWssSettings() - switch($params.CreateProjectSiteMode) + switch ($params.CreateProjectSiteMode) { - "UserChoice" { + "UserChoice" + { $settings.WssAdmin.Rows[0]["WADMIN_AUTO_CREATE_SUBWEBS"] = 0 } - "AutoCreate" { + "AutoCreate" + { $settings.WssAdmin.Rows[0]["WADMIN_AUTO_CREATE_SUBWEBS"] = 1 } - "DontCreate" { + "DontCreate" + { $settings.WssAdmin.Rows[0]["WADMIN_AUTO_CREATE_SUBWEBS"] = 2 } } @@ -145,7 +151,7 @@ function Test-TargetResource $Url, [Parameter(Mandatory = $true)] - [ValidateSet("AutoCreate","UserChoice","DontCreate")] + [ValidateSet("AutoCreate", "UserChoice", "DontCreate")] [System.String] $CreateProjectSiteMode, @@ -162,7 +168,7 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters + -DesiredValues $PSBoundParameters } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.psm1 index aa3e7db20..986d3928e 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.psm1 @@ -13,7 +13,7 @@ function Get-TargetResource $InstallAccount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present" ) @@ -21,8 +21,8 @@ function Get-TargetResource Write-Verbose -Message "Getting service application publish status '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue @@ -36,7 +36,7 @@ function Get-TargetResource if ($null -eq $serviceApp.Uri) { Write-Verbose -Message ("Only Business Data Connectivity, Machine Translation, Managed Metadata, " + ` - "User Profile, Search, Secure Store are supported to be published via DSC.") + "User Profile, Search, Secure Store are supported to be published via DSC.") $sharedEnsure = "Absent" } else @@ -75,7 +75,7 @@ function Set-TargetResource $InstallAccount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present" ) @@ -83,8 +83,8 @@ function Set-TargetResource Write-Verbose -Message "Setting service application publish status '$Name'" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue @@ -96,7 +96,7 @@ function Set-TargetResource if ($null -eq $serviceApp.Uri) { throw [Exception] ("Only Business Data Connectivity, Machine Translation, Managed Metadata, " + ` - "User Profile, Search, Secure Store are supported to be published via DSC.") + "User Profile, Search, Secure Store are supported to be published via DSC.") } if ($Ensure -eq "Present") @@ -129,7 +129,7 @@ function Test-TargetResource $InstallAccount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present" ) @@ -142,8 +142,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name", "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Name", "Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.psm1 index 84dc27c26..3ea2db808 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.psm1 @@ -25,7 +25,7 @@ function Get-TargetResource $WarningUsagePointsSolutions, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -44,12 +44,12 @@ function Get-TargetResource if ($MaximumUsagePointsSolutions -lt $WarningUsagePointsSolutions) { throw ("MaximumUsagePointsSolutions must be equal to or larger than " + ` - "WarningUsagePointsSolutions.") + "WarningUsagePointsSolutions.") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -59,7 +59,7 @@ function Get-TargetResource catch { Write-Verbose -Message ("No local SharePoint farm was detected. Quota " + ` - "template settings will not be applied") + "template settings will not be applied") return @{ Name = $params.Name StorageMaxInMB = 0 @@ -127,7 +127,7 @@ function Set-TargetResource $WarningUsagePointsSolutions, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -146,16 +146,17 @@ function Set-TargetResource if ($MaximumUsagePointsSolutions -lt $WarningUsagePointsSolutions) { Throw ("MaximumUsagePointsSolutions must be equal to or larger than " + ` - "WarningUsagePointsSolutions.") + "WarningUsagePointsSolutions.") } switch ($Ensure) { - "Present" { + "Present" + { Write-Verbose "Ensure is set to Present - Add or update template" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -165,7 +166,7 @@ function Set-TargetResource catch { throw ("No local SharePoint farm was detected. Quota " + ` - "template settings will not be applied") + "template settings will not be applied") return } @@ -222,22 +223,23 @@ function Set-TargetResource } } } - "Absent" { + "Absent" + { Write-Verbose "Ensure is set to Absent - Removing template" if ($StorageMaxInMB ` - -or $StorageWarningInMB ` - -or $MaximumUsagePointsSolutions ` - -or $WarningUsagePointsSolutions) + -or $StorageWarningInMB ` + -or $MaximumUsagePointsSolutions ` + -or $WarningUsagePointsSolutions) { Throw ("Do not use StorageMaxInMB, StorageWarningInMB, " + ` - "MaximumUsagePointsSolutions or WarningUsagePointsSolutions " + ` - "when Ensure is specified as Absent") + "MaximumUsagePointsSolutions or WarningUsagePointsSolutions " + ` + "when Ensure is specified as Absent") } Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -247,7 +249,7 @@ function Set-TargetResource catch { Write-Verbose -Message ("No local SharePoint farm was detected. Quota " + ` - "template settings will not be applied") + "template settings will not be applied") return } @@ -290,7 +292,7 @@ function Test-TargetResource $WarningUsagePointsSolutions, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -309,7 +311,7 @@ function Test-TargetResource if ($MaximumUsagePointsSolutions -lt $WarningUsagePointsSolutions) { Throw ("MaximumUsagePointsSolutions must be equal to or larger than " + ` - "WarningUsagePointsSolutions.") + "WarningUsagePointsSolutions.") } $CurrentValues = Get-TargetResource @PSBoundParameters @@ -319,22 +321,24 @@ function Test-TargetResource switch ($Ensure) { - "Present" { + "Present" + { if ($CurrentValues.Ensure -eq "Absent") { return $false } return Test-SPDscParameterState -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters } - "Absent" { + "Absent" + { if ($StorageMaxInMB -or ` - $StorageWarningInMB -or ` - $MaximumUsagePointsSolutions -or ` - $WarningUsagePointsSolutions) + $StorageWarningInMB -or ` + $MaximumUsagePointsSolutions -or ` + $WarningUsagePointsSolutions) { throw ("Do not use StorageMaxInMB, StorageWarningInMB, " + ` - "MaximumUsagePointsSolutions or WarningUsagePointsSolutions " + ` - "when Ensure is specified as Absent") + "MaximumUsagePointsSolutions or WarningUsagePointsSolutions " + ` + "when Ensure is specified as Absent") } if ($CurrentValues.Ensure -eq "Present") diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.psm1 index 68e6d80a1..5dc0d5be3 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.psm1 @@ -16,7 +16,7 @@ function Get-TargetResource() $LocalWebAppUrl, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", [Parameter()] @@ -27,8 +27,8 @@ function Get-TargetResource() Write-Verbose -Message "Getting remote farm trust '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $returnValue = @{ @@ -40,13 +40,13 @@ function Get-TargetResource() } $issuer = Get-SPTrustedSecurityTokenIssuer -Identity $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $issuer) { return $returnValue } $rootAuthority = Get-SPTrustedRootAuthority -Identity $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $rootAuthority) { return $returnValue @@ -83,7 +83,7 @@ function Set-TargetResource() $LocalWebAppUrl, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", [Parameter()] @@ -98,36 +98,36 @@ function Set-TargetResource() Write-Verbose -Message "Adding remote farm trust '$Name'" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $remoteWebApp = $params.RemoteWebAppUrl.TrimEnd('/') $issuer = Get-SPTrustedSecurityTokenIssuer -Identity $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $issuer) { $endpoint = "$remoteWebApp/_layouts/15/metadata/json/1" $issuer = New-SPTrustedSecurityTokenIssuer -Name $params.Name ` - -IsTrustBroker:$false ` - -MetadataEndpoint $endpoint ` - -Confirm:$false + -IsTrustBroker:$false ` + -MetadataEndpoint $endpoint ` + -Confirm:$false } $rootAuthority = Get-SPTrustedRootAuthority -Identity $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $rootAuthority) { $endpoint = "$remoteWebApp/_layouts/15/metadata/json/1/rootcertificate" New-SPTrustedRootAuthority -Name $params.Name ` - -MetadataEndPoint $endpoint ` - -Confirm:$false + -MetadataEndPoint $endpoint ` + -Confirm:$false } $realm = $issuer.NameId.Split("@") $site = Get-SPSite -Identity $params.LocalWebAppUrl $serviceContext = Get-SPServiceContext -Site $site $currentRealm = Get-SPAuthenticationRealm -ServiceContext $serviceContext ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($realm[1] -ne $currentRealm) { @@ -135,12 +135,12 @@ function Set-TargetResource() } $appPrincipal = Get-SPAppPrincipal -Site $params.LocalWebAppUrl ` - -NameIdentifier $issuer.NameId + -NameIdentifier $issuer.NameId Set-SPAppPrincipalPermission -Site $params.LocalWebAppUrl ` - -AppPrincipal $appPrincipal ` - -Scope SiteCollection ` - -Right FullControl + -AppPrincipal $appPrincipal ` + -Scope SiteCollection ` + -Right FullControl } } @@ -149,25 +149,25 @@ function Set-TargetResource() Write-Verbose -Message "Removing remote farm trust '$Name'" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $issuer = Get-SPTrustedSecurityTokenIssuer -Identity $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -ne $issuer) { $appPrincipal = Get-SPAppPrincipal -Site $params.LocalWebAppUrl ` - -NameIdentifier $issuer.NameId + -NameIdentifier $issuer.NameId Remove-SPAppPrincipalPermission -Site $params.LocalWebAppUrl ` - -AppPrincipal $appPrincipal ` - -Scope SiteCollection ` - -Confirm:$false + -AppPrincipal $appPrincipal ` + -Scope SiteCollection ` + -Confirm:$false } Get-SPTrustedRootAuthority -Identity $params.Name ` - -ErrorAction SilentlyContinue ` - | Remove-SPTrustedRootAuthority -Confirm:$false + -ErrorAction SilentlyContinue ` + | Remove-SPTrustedRootAuthority -Confirm:$false if ($null -ne $issuer) { $issuer | Remove-SPTrustedSecurityTokenIssuer -Confirm:$false @@ -194,7 +194,7 @@ function Test-TargetResource() $LocalWebAppUrl, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", [Parameter()] @@ -212,8 +212,8 @@ function Test-TargetResource() Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.psm1 index 3f505290d..fac26dbae 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.psm1 @@ -18,12 +18,12 @@ function Get-TargetResource $Level, [Parameter()] - [ValidateSet("Authoratative","Demoted")] + [ValidateSet("Authoratative", "Demoted")] [System.String] $Action, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure, @@ -35,8 +35,8 @@ function Get-TargetResource Write-Verbose -Message "Getting Authoratative Page Setting for '$Path'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $nullReturn = @{ @@ -60,9 +60,9 @@ function Get-TargetResource if ($params.Action -eq "Authoratative") { $queryAuthority = Get-SPEnterpriseSearchQueryAuthority -Identity $params.Path ` - -Owner $searchOwner ` - -SearchApplication $serviceApp ` - -ErrorAction SilentlyContinue + -Owner $searchOwner ` + -SearchApplication $serviceApp ` + -ErrorAction SilentlyContinue if ($null -eq $queryAuthority) { return $nullReturn @@ -83,9 +83,9 @@ function Get-TargetResource else { $queryDemoted = $serviceApp | Get-SPEnterpriseSearchQueryDemoted -Identity $params.Path ` - -Owner $searchOwner ` - -SearchApplication $serviceApp ` - -ErrorAction SilentlyContinue + -Owner $searchOwner ` + -SearchApplication $serviceApp ` + -ErrorAction SilentlyContinue if ($null -eq $queryDemoted) { return $nullReturn @@ -126,12 +126,12 @@ function Set-TargetResource $Level, [Parameter()] - [ValidateSet("Authoratative","Demoted")] + [ValidateSet("Authoratative", "Demoted")] [System.String] $Action, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure, @@ -140,15 +140,15 @@ function Set-TargetResource $InstallAccount ) - Write-Verbose -Message "Setting Authoratative Page Settings for '$Path'" + Write-Verbose -Message "Setting Authoratative Page Settings for '$Path'" $CurrentResults = Get-TargetResource @PSBoundParameters if ($CurrentResults.Ensure -eq "Absent" -and $Ensure -eq "Present") { $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName @@ -161,10 +161,10 @@ function Set-TargetResource } if ($params.Action -eq "Authoratative") { - New-SPEnterpriseSearchQueryAuthority -Url $params.Path ` - -SearchApplication $serviceApp ` - -Owner $searchOwner ` - -Level $params.Level + New-SPEnterpriseSearchQueryAuthority -Url $params.Path ` + -SearchApplication $serviceApp ` + -Owner $searchOwner ` + -Level $params.Level } else { @@ -175,8 +175,8 @@ function Set-TargetResource if ($CurrentResults.Ensure -eq "Present" -and $Ensure -eq "Present") { $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName @@ -191,17 +191,17 @@ function Set-TargetResource if ($params.Action -eq "Authoratative") { Set-SPEnterpriseSearchQueryAuthority -Identity $params.ServiceAppName ` - -SearchApplication $serviceApp ` - -Owner $searchOwner ` - -Level $params.Level + -SearchApplication $serviceApp ` + -Owner $searchOwner ` + -Level $params.Level } } } if ($Ensure -eq "Absent") { $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName @@ -215,16 +215,16 @@ function Set-TargetResource if ($params.Action -eq "Authoratative") { Remove-SPEnterpriseSearchQueryAuthority -Identity $params.ServiceAppName ` - -SearchApplication $serviceApp ` - -Owner $searchOwner ` - -ErrorAction SilentlyContinue + -SearchApplication $serviceApp ` + -Owner $searchOwner ` + -ErrorAction SilentlyContinue } else { Remove-SPEnterpriseSearchQueryDemoted -Identity $params.ServiceAppName ` - -SearchApplication $serviceApp ` - -Owner $searchOwner ` - -ErrorAction SilentlyContinue + -SearchApplication $serviceApp ` + -Owner $searchOwner ` + -ErrorAction SilentlyContinue } } } @@ -251,12 +251,12 @@ function Test-TargetResource $Level, [Parameter()] - [ValidateSet("Authoratative","Demoted")] + [ValidateSet("Authoratative", "Demoted")] [System.String] $Action, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure, @@ -279,30 +279,30 @@ function Test-TargetResource if ($Action -eq "Authoratative") { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ServiceAppName", - "Path", - "Level", - "Action", - "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("ServiceAppName", + "Path", + "Level", + "Action", + "Ensure") } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ServiceAppName", - "Path", - "Action", - "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("ServiceAppName", + "Path", + "Action", + "Ensure") } } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ServiceAppName", - "Action", - "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("ServiceAppName", + "Action", + "Ensure") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.psm1 index 7d63dc812..ff8e0a054 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.psm1 @@ -1,7 +1,7 @@ function Get-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Collections.Hashtable])] param ( @@ -14,7 +14,7 @@ function Get-TargetResource $ServiceAppName, [Parameter(Mandatory = $true)] - [ValidateSet("SharePoint","Website","FileShare","Business")] + [ValidateSet("SharePoint", "Website", "FileShare", "Business")] [System.String] $ContentSourceType, @@ -23,7 +23,7 @@ function Get-TargetResource $Addresses, [Parameter()] - [ValidateSet("CrawlEverything","CrawlFirstOnly","Custom")] + [ValidateSet("CrawlEverything", "CrawlFirstOnly", "Custom")] [System.String] $CrawlSetting, @@ -40,7 +40,7 @@ function Get-TargetResource $FullSchedule, [Parameter()] - [ValidateSet("Normal","High")] + [ValidateSet("Normal", "High")] [System.String] $Priority, @@ -57,7 +57,7 @@ function Get-TargetResource $LOBSystemSet, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -73,20 +73,20 @@ function Get-TargetResource Write-Verbose -Message "Getting Content Source Setting for '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $ScriptRoot = $args[1] $relativePath = "..\..\Modules\SharePointDsc.Search\SPSearchContentSource.Schedules.psm1" $modulePath = Join-Path -Path $ScriptRoot ` - -ChildPath $relativePath ` - -Resolve + -ChildPath $relativePath ` + -Resolve Import-Module -Name $modulePath $source = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $params.ServiceAppName ` - -ErrorAction SilentlyContinue | ` - Where-Object {$_.Name -eq $params.Name} + -ErrorAction SilentlyContinue | ` + Where-Object { $_.Name -eq $params.Name } if ($null -eq $source) { return @{ @@ -99,7 +99,8 @@ function Get-TargetResource switch ($source.Type) { - "SharePoint" { + "SharePoint" + { $crawlSetting = "CrawlEverything" if ($source.SharePointCrawlBehavior -eq "CrawlSites") { @@ -107,9 +108,9 @@ function Get-TargetResource } $incrementalSchedule = Get-SPDscSearchCrawlSchedule ` - -Schedule $source.IncrementalCrawlSchedule + -Schedule $source.IncrementalCrawlSchedule $fullSchedule = Get-SPDscSearchCrawlSchedule ` - -Schedule $source.FullCrawlSchedule + -Schedule $source.FullCrawlSchedule $result = @{ Name = $params.Name @@ -125,7 +126,8 @@ function Get-TargetResource InstallAccount = $params.InstallAccount } } - "Web" { + "Web" + { $crawlSetting = "Custom" if ($source.MaxPageEnumerationDepth -eq [System.Int32]::MaxValue) { @@ -137,9 +139,9 @@ function Get-TargetResource } $incrementalSchedule = Get-SPDscSearchCrawlSchedule ` - -Schedule $source.IncrementalCrawlSchedule + -Schedule $source.IncrementalCrawlSchedule $fullSchedule = Get-SPDscSearchCrawlSchedule ` - -Schedule $source.FullCrawlSchedule + -Schedule $source.FullCrawlSchedule $result = @{ Name = $params.Name @@ -155,7 +157,8 @@ function Get-TargetResource Priority = $source.CrawlPriority } } - "File" { + "File" + { $crawlSetting = "CrawlFirstOnly" if ($source.FollowDirectories -eq $true) { @@ -163,12 +166,12 @@ function Get-TargetResource } $addresses = [array] $source.StartAddresses.AbsoluteUri - $addresses = $addresses.Replace("file:///","\\").Replace("/", "\") + $addresses = $addresses.Replace("file:///", "\\").Replace("/", "\") $incrementalSchedule = Get-SPDscSearchCrawlSchedule ` - -Schedule $source.IncrementalCrawlSchedule + -Schedule $source.IncrementalCrawlSchedule $fullSchedule = Get-SPDscSearchCrawlSchedule ` - -Schedule $source.FullCrawlSchedule + -Schedule $source.FullCrawlSchedule $result = @{ Name = $params.Name @@ -182,7 +185,8 @@ function Get-TargetResource Priority = $source.CrawlPriority } } - "Business" { + "Business" + { $result = @{ Name = $params.Name ServiceAppName = $params.ServiceAppName @@ -207,9 +211,10 @@ function Get-TargetResource } } } - Default { + Default + { throw ("SharePointDsc does not currently support '$($source.Type)' content " + ` - "sources. Please use only 'SharePoint', 'FileShare', 'Website' or 'Business'.") + "sources. Please use only 'SharePoint', 'FileShare', 'Website' or 'Business'.") } } return $result @@ -220,7 +225,7 @@ function Get-TargetResource function Set-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] param ( [Parameter(Mandatory = $true)] @@ -232,7 +237,7 @@ function Set-TargetResource $ServiceAppName, [Parameter(Mandatory = $true)] - [ValidateSet("SharePoint","Website","FileShare","Business")] + [ValidateSet("SharePoint", "Website", "FileShare", "Business")] [System.String] $ContentSourceType, @@ -241,7 +246,7 @@ function Set-TargetResource $Addresses, [Parameter()] - [ValidateSet("CrawlEverything","CrawlFirstOnly","Custom")] + [ValidateSet("CrawlEverything", "CrawlFirstOnly", "Custom")] [System.String] $CrawlSetting, @@ -258,7 +263,7 @@ function Set-TargetResource $FullSchedule, [Parameter()] - [ValidateSet("Normal","High")] + [ValidateSet("Normal", "High")] [System.String] $Priority, @@ -275,7 +280,7 @@ function Set-TargetResource $LOBSystemSet, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -292,7 +297,8 @@ function Set-TargetResource switch ($ContentSourceType) { - "SharePoint" { + "SharePoint" + { if ($PSBoundParameters.ContainsKey("LimitPageDepth") -eq $true) { throw "Parameter LimitPageDepth is not valid for SharePoint content sources" @@ -304,10 +310,11 @@ function Set-TargetResource if ($CrawlSetting -eq "Custom") { throw ("Parameter CrawlSetting can only be set to custom for website content " + ` - "sources") + "sources") } } - "Website" { + "Website" + { if ($PSBoundParameters.ContainsKey("ContinuousCrawl") -eq $true) { throw "Parameter ContinuousCrawl is not valid for website content sources" @@ -317,7 +324,8 @@ function Set-TargetResource throw "Parameter LimitServerHops is not valid for website content sources" } } - "FileShare" { + "FileShare" + { if ($PSBoundParameters.ContainsKey("LimitPageDepth") -eq $true) { throw "Parameter LimitPageDepth is not valid for file share content sources" @@ -331,7 +339,8 @@ function Set-TargetResource throw "Parameter CrawlSetting can only be set to custom for website content sources" } } - "Business" { + "Business" + { if ($PSBoundParameters.ContainsKey("ContinuousCrawl") -eq $true) { throw "Parameter ContinuousCrawl is not valid for Business content sources" @@ -352,23 +361,23 @@ function Set-TargetResource if ($ContentSourceType -ne $CurrentValues.ContentSourceType -and $Force -eq $false) { throw ("The type of the a search content source can not be changed from " + ` - "'$($CurrentValues.ContentSourceType)' to '$ContentSourceType' without " + ` - "deleting and adding it again. Specify 'Force = `$true' in order to allow " + ` - "DSC to do this, or manually remove the existing content source and re-run " + ` - "the configuration.") + "'$($CurrentValues.ContentSourceType)' to '$ContentSourceType' without " + ` + "deleting and adding it again. Specify 'Force = `$true' in order to allow " + ` + "DSC to do this, or manually remove the existing content source and re-run " + ` + "the configuration.") } if (($ContentSourceType -ne $CurrentValues.ContentSourceType -and $Force -eq $true) ` - -or ($Ensure -eq "Absent" -and $CurrentValues.Ensure -ne $Ensure)) + -or ($Ensure -eq "Absent" -and $CurrentValues.Ensure -ne $Ensure)) { # Remove the existing content source Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters) ` - -ScriptBlock { + -Arguments @($PSBoundParameters) ` + -ScriptBlock { $params = $args[0] Remove-SPEnterpriseSearchCrawlContentSource -Identity $params.Name ` - -SearchApplication $params.ServiceAppName ` - -Confirm:$false + -SearchApplication $params.ServiceAppName ` + -Confirm:$false } } @@ -376,98 +385,102 @@ function Set-TargetResource { # Create the new content source and then apply settings to it Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters) ` - -ScriptBlock { + -Arguments @($PSBoundParameters) ` + -ScriptBlock { $params = $args[0] $OFS = "," $startAddresses = "$($params.Addresses)" $source = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $params.ServiceAppName ` - -ErrorAction SilentlyContinue | ` - Where-Object {$_.Name -eq $params.Name} + -ErrorAction SilentlyContinue | ` + Where-Object { $_.Name -eq $params.Name } if ($null -eq $source) { switch ($params.ContentSourceType) { - "SharePoint" { + "SharePoint" + { $newType = "SharePoint" } - "Website" { + "Website" + { $newType = "Web" } - "FileShare" { + "FileShare" + { $newType = "File" } - "Business" { + "Business" + { $newType = "Business" } } if ($params.ContentSourceType -ne "Business") { $source = New-SPEnterpriseSearchCrawlContentSource ` - -SearchApplication $params.ServiceAppName ` - -Type $newType ` - -Name $params.Name ` - -StartAddresses $startAddresses + -SearchApplication $params.ServiceAppName ` + -Type $newType ` + -Name $params.Name ` + -StartAddresses $startAddresses } else { $proxyGroup = Get-SPServiceApplicationProxyGroup -Default $source = New-SPEnterpriseSearchCrawlContentSource ` - -SearchApplication $params.ServiceAppName ` - -Type $newType ` - -Name $params.Name ` - -BDCApplicationProxyGroup $proxyGroup ` - -LOBSystemSet $params.LOBSystemSet + -SearchApplication $params.ServiceAppName ` + -Type $newType ` + -Name $params.Name ` + -BDCApplicationProxyGroup $proxyGroup ` + -LOBSystemSet $params.LOBSystemSet } if ($null -eq $source) { throw ("An error occurred during creation of the Content Source, " + ` - "please check if all parameters are correct.") + "please check if all parameters are correct.") } } $allSetArguments = @{ - Identity = $params.Name + Identity = $params.Name SearchApplication = $params.ServiceAppName - Confirm = $false + Confirm = $false } if ($params.ContentSourceType -eq "SharePoint" -and ` - $source.EnableContinuousCrawls -eq $true) + $source.EnableContinuousCrawls -eq $true) { Set-SPEnterpriseSearchCrawlContentSource @allSetArguments ` - -EnableContinuousCrawls $false + -EnableContinuousCrawls $false Write-Verbose -Message ("Pausing to allow Continuous Crawl to shut down " + ` - "correctly before continuing updating the configuration.") + "correctly before continuing updating the configuration.") Start-Sleep -Seconds 300 } if ($source.CrawlStatus -ne "Idle") { Write-Verbose -Message ("Content source '$($params.Name)' is not idle, " + ` - "stopping current crawls to allow settings to be updated") + "stopping current crawls to allow settings to be updated") $source = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $params.ServiceAppName | ` - Where-Object {$_.Name -eq $params.Name} + Where-Object { $_.Name -eq $params.Name } $source.StopCrawl() $loopCount = 0 $sourceToWait = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $params.ServiceAppName | ` - Where-Object {$_.Name -eq $params.Name} + Where-Object { $_.Name -eq $params.Name } while ($sourceToWait.CrawlStatus -ne "Idle" -and $loopCount -lt 15) { $sourceToWait = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $params.ServiceAppName | ` - Where-Object {$_.Name -eq $params.Name} + Where-Object { $_.Name -eq $params.Name } Write-Verbose -Message ("$([DateTime]::Now.ToShortTimeString()) - Waiting " + ` - "for content source '$($params.Name)' to be idle " + ` - "(waited $loopCount of 15 minutes)") + "for content source '$($params.Name)' to be idle " + ` + "(waited $loopCount of 15 minutes)") Start-Sleep -Seconds 60 $loopCount++ } @@ -486,10 +499,12 @@ function Set-TargetResource { switch ($params.Priority) { - "High" { + "High" + { $primarySetArgs.Add("CrawlPriority", "2") } - "Normal" { + "Normal" + { $primarySetArgs.Add("CrawlPriority", "1") } } @@ -499,50 +514,54 @@ function Set-TargetResource # Set the incremental search values if ($params.ContainsKey("IncrementalSchedule") -eq $true -and ` - $null -ne $params.IncrementalSchedule) + $null -ne $params.IncrementalSchedule) { $incrementalSetArgs = @{ ScheduleType = "Incremental" } switch ($params.IncrementalSchedule.ScheduleType) { - "None" { + "None" + { $incrementalSetArgs.Add("RemoveCrawlSchedule", $true) } - "Daily" { + "Daily" + { $incrementalSetArgs.Add("DailyCrawlSchedule", $true) } - "Weekly" { + "Weekly" + { $incrementalSetArgs.Add("WeeklyCrawlSchedule", $true) $propertyTest = Test-SPDscObjectHasProperty ` - -Object $params.IncrementalSchedule ` - -PropertyName "CrawlScheduleDaysOfWeek" + -Object $params.IncrementalSchedule ` + -PropertyName "CrawlScheduleDaysOfWeek" if ($propertyTest -eq $true) { $OFS = "," $enumValue = ` [enum]::Parse([Microsoft.Office.Server.Search.Administration.DaysOfWeek], ` - "$($params.IncrementalSchedule.CrawlScheduleDaysOfWeek)") + "$($params.IncrementalSchedule.CrawlScheduleDaysOfWeek)") $incrementalSetArgs.Add("CrawlScheduleDaysOfWeek", $enumValue) } } - "Monthly" { + "Monthly" + { $incrementalSetArgs.Add("MonthlyCrawlSchedule", $true) $propertyTest = Test-SPDscObjectHasProperty ` - -Object $params.IncrementalSchedule ` - -PropertyName "CrawlScheduleDaysOfMonth" + -Object $params.IncrementalSchedule ` + -PropertyName "CrawlScheduleDaysOfMonth" if ($propertyTest -eq $true) { $incrementalSetArgs.Add("CrawlScheduleDaysOfMonth", ` - $params.IncrementalSchedule.CrawlScheduleDaysOfMonth) + $params.IncrementalSchedule.CrawlScheduleDaysOfMonth) } $propertyTest = Test-SPDscObjectHasProperty ` - -Object $params.IncrementalSchedule ` - -PropertyName "CrawlScheduleMonthsOfYear" + -Object $params.IncrementalSchedule ` + -PropertyName "CrawlScheduleMonthsOfYear" if ($propertyTest -eq $true) { @@ -556,7 +575,7 @@ function Set-TargetResource } $propertyTest = Test-SPDscObjectHasProperty -Object $params.IncrementalSchedule ` - -PropertyName "CrawlScheduleRepeatDuration" + -PropertyName "CrawlScheduleRepeatDuration" if ($propertyTest -eq $true) { $incrementalSetArgs.Add("CrawlScheduleRepeatDuration", @@ -564,7 +583,7 @@ function Set-TargetResource } $propertyTest = Test-SPDscObjectHasProperty -Object $params.IncrementalSchedule ` - -PropertyName "CrawlScheduleRepeatInterval" + -PropertyName "CrawlScheduleRepeatInterval" if ($propertyTest -eq $true) { $incrementalSetArgs.Add("CrawlScheduleRepeatInterval", @@ -572,7 +591,7 @@ function Set-TargetResource } $propertyTest = Test-SPDscObjectHasProperty -Object $params.IncrementalSchedule ` - -PropertyName "CrawlScheduleRunEveryInterval" + -PropertyName "CrawlScheduleRunEveryInterval" if ($propertyTest -eq $true) { $incrementalSetArgs.Add("CrawlScheduleRunEveryInterval", @@ -580,7 +599,7 @@ function Set-TargetResource } $propertyTest = Test-SPDscObjectHasProperty -Object $params.IncrementalSchedule ` - -PropertyName "StartHour" + -PropertyName "StartHour" if ($propertyTest -eq $true) { $incrementalSetArgs.Add("CrawlScheduleStartDateTime", @@ -597,16 +616,19 @@ function Set-TargetResource } switch ($params.FullSchedule.ScheduleType) { - "None" { + "None" + { $fullSetArgs.Add("RemoveCrawlSchedule", $true) } - "Daily" { + "Daily" + { $fullSetArgs.Add("DailyCrawlSchedule", $true) } - "Weekly" { + "Weekly" + { $fullSetArgs.Add("WeeklyCrawlSchedule", $true) $propertyTest = Test-SPDscObjectHasProperty -Object $params.FullSchedule ` - -PropertyName "CrawlScheduleDaysOfWeek" + -PropertyName "CrawlScheduleDaysOfWeek" if ($propertyTest -eq $true) { foreach ($day in $params.FullSchedule.CrawlScheduleDaysOfWeek) @@ -616,10 +638,11 @@ function Set-TargetResource $fullSetArgs.Add("CrawlScheduleDaysOfWeek", $daysOfweek) } } - "Monthly" { + "Monthly" + { $fullSetArgs.Add("MonthlyCrawlSchedule", $true) $propertyTest = Test-SPDscObjectHasProperty -Object $params.FullSchedule ` - -PropertyName "CrawlScheduleDaysOfMonth" + -PropertyName "CrawlScheduleDaysOfMonth" if ($propertyTest -eq $true) { $fullSetArgs.Add("CrawlScheduleDaysOfMonth", @@ -627,7 +650,7 @@ function Set-TargetResource } $propertyTest = Test-SPDscObjectHasProperty -Object $params.FullSchedule ` - -PropertyName "CrawlScheduleMonthsOfYear" + -PropertyName "CrawlScheduleMonthsOfYear" if ($propertyTest -eq $true) { foreach ($month in $params.FullSchedule.CrawlScheduleMonthsOfYear) @@ -640,7 +663,7 @@ function Set-TargetResource } $propertyTest = Test-SPDscObjectHasProperty -Object $params.FullSchedule ` - -PropertyName "CrawlScheduleRepeatDuration" + -PropertyName "CrawlScheduleRepeatDuration" if ($propertyTest -eq $true) { $fullSetArgs.Add("CrawlScheduleRepeatDuration", @@ -648,7 +671,7 @@ function Set-TargetResource } $propertyTest = Test-SPDscObjectHasProperty -Object $params.FullSchedule ` - -PropertyName "CrawlScheduleRepeatInterval" + -PropertyName "CrawlScheduleRepeatInterval" if ($propertyTest -eq $true) { $fullSetArgs.Add("CrawlScheduleRepeatInterval", @@ -656,7 +679,7 @@ function Set-TargetResource } $propertyTest = Test-SPDscObjectHasProperty -Object $params.FullSchedule ` - -PropertyName "CrawlScheduleRunEveryInterval" + -PropertyName "CrawlScheduleRunEveryInterval" if ($propertyTest -eq $true) { $fullSetArgs.Add("CrawlScheduleRunEveryInterval", @@ -664,7 +687,7 @@ function Set-TargetResource } $propertyTest = Test-SPDscObjectHasProperty -Object $params.FullSchedule ` - -PropertyName "StartHour" + -PropertyName "StartHour" if ($propertyTest -eq $true) { $fullSetArgs.Add("CrawlScheduleStartDateTime", @@ -679,7 +702,7 @@ function Set-TargetResource function Test-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Boolean])] param ( @@ -692,7 +715,7 @@ function Test-TargetResource $ServiceAppName, [Parameter(Mandatory = $true)] - [ValidateSet("SharePoint","Website","FileShare","Business")] + [ValidateSet("SharePoint", "Website", "FileShare", "Business")] [System.String] $ContentSourceType, @@ -701,7 +724,7 @@ function Test-TargetResource $Addresses, [Parameter()] - [ValidateSet("CrawlEverything","CrawlFirstOnly","Custom")] + [ValidateSet("CrawlEverything", "CrawlFirstOnly", "Custom")] [System.String] $CrawlSetting, @@ -718,7 +741,7 @@ function Test-TargetResource $FullSchedule, [Parameter()] - [ValidateSet("Normal","High")] + [ValidateSet("Normal", "High")] [System.String] $Priority, @@ -735,7 +758,7 @@ function Test-TargetResource $LOBSystemSet, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -754,7 +777,8 @@ function Test-TargetResource switch ($ContentSourceType) { - "SharePoint" { + "SharePoint" + { if ($PSBoundParameters.ContainsKey("LimitPageDepth") -eq $true) { throw "Parameter LimitPageDepth is not valid for SharePoint content sources" @@ -766,10 +790,11 @@ function Test-TargetResource if ($CrawlSetting -eq "Custom") { throw ("Parameter CrawlSetting can only be set to custom for website content " + ` - "sources") + "sources") } } - "Website" { + "Website" + { if ($PSBoundParameters.ContainsKey("ContinuousCrawl") -eq $true) { throw "Parameter ContinuousCrawl is not valid for website content sources" @@ -779,7 +804,8 @@ function Test-TargetResource throw "Parameter LimitServerHops is not valid for website content sources" } } - "FileShare" { + "FileShare" + { if ($PSBoundParameters.ContainsKey("LimitPageDepth") -eq $true) { throw "Parameter LimitPageDepth is not valid for file share content sources" @@ -793,7 +819,8 @@ function Test-TargetResource throw "Parameter CrawlSetting can only be set to custom for website content sources" } } - "Business" { + "Business" + { if ($PSBoundParameters.ContainsKey("ContinuousCrawl") -eq $true) { throw "Parameter ContinuousCrawl is not valid for Business content sources" @@ -817,20 +844,20 @@ function Test-TargetResource if ($Ensure -eq "Absent" -or $CurrentValues.Ensure -eq "Absent") { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } $relativePath = "..\..\Modules\SharePointDsc.Search\SPSearchContentSource.Schedules.psm1" $modulePath = Join-Path -Path $PSScriptRoot ` - -ChildPath $relativePath ` - -Resolve + -ChildPath $relativePath ` + -Resolve Import-Module -Name $modulePath if (($PSBoundParameters.ContainsKey("IncrementalSchedule") -eq $true) -and ($null -ne $IncrementalSchedule)) { $propertyTest = Test-SPDscSearchCrawlSchedule -CurrentSchedule $CurrentValues.IncrementalSchedule ` - -DesiredSchedule $IncrementalSchedule + -DesiredSchedule $IncrementalSchedule if ($propertyTest -eq $false) { return $false @@ -840,7 +867,7 @@ function Test-TargetResource if (($PSBoundParameters.ContainsKey("FullSchedule") -eq $true) -and ($null -ne $FullSchedule)) { $propertyTest = Test-SPDscSearchCrawlSchedule -CurrentSchedule $CurrentValues.FullSchedule ` - -DesiredSchedule $FullSchedule + -DesiredSchedule $FullSchedule if ($propertyTest -eq $false) { return $false @@ -860,21 +887,21 @@ function Test-TargetResource } if ($null -ne (Compare-Object -ReferenceObject $currentAddresses ` - -DifferenceObject $desiredAddresses)) + -DifferenceObject $desiredAddresses)) { return $false } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ContentSourceType", - "CrawlSetting", - "ContinuousCrawl", - "Priority", - "LimitPageDepth", - "LimitServerHops", - "LOBSystemSet", - "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("ContentSourceType", + "CrawlSetting", + "ContinuousCrawl", + "Priority", + "LimitPageDepth", + "LimitServerHops", + "LOBSystemSet", + "Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.psm1 index a6253d0d7..82d4416e6 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.psm1 @@ -17,7 +17,7 @@ function Get-TargetResource $Target, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -29,8 +29,8 @@ function Get-TargetResource Write-Verbose -Message "Getting Search Crawl Mapping for '$Url'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $searchApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName @@ -112,7 +112,7 @@ function Set-TargetResource $Target, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -120,7 +120,7 @@ function Set-TargetResource [System.Management.Automation.PSCredential] $InstallAccount ) - Write-Verbose -Message "Setting Search Crawl Mapping Rule '$Url'" + Write-Verbose -Message "Setting Search Crawl Mapping Rule '$Url'" $result = Get-TargetResource @PSBoundParameters if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") @@ -128,8 +128,8 @@ function Set-TargetResource Write-Verbose "Adding the Crawl Mapping '$Url'" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $searchApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName @@ -147,8 +147,8 @@ function Set-TargetResource { Write-Verbose "Updating the Crawl Mapping '$Url'" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $searchApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName @@ -163,8 +163,8 @@ function Set-TargetResource { Write-Verbose "Removing the Crawl Mapping '$Url'" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $searchapp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName @@ -195,7 +195,7 @@ function Test-TargetResource $Target, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -215,14 +215,14 @@ function Test-TargetResource if ($Ensure -eq "Present") { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ServiceAppName","Url","Target","Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("ServiceAppName", "Url", "Target", "Ensure") } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.psm1 index dcd122054..cfc2c8637 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.psm1 @@ -14,24 +14,24 @@ function Get-TargetResource [Parameter()] [ValidateSet("DefaultRuleAccess", - "BasicAccountRuleAccess", - "CertificateRuleAccess", - "NTLMAccountRuleAccess", - "FormRuleAccess", - "CookieRuleAccess", - "AnonymousAccess")] + "BasicAccountRuleAccess", + "CertificateRuleAccess", + "NTLMAccountRuleAccess", + "FormRuleAccess", + "CookieRuleAccess", + "AnonymousAccess")] [System.String] $AuthenticationType, [Parameter()] - [ValidateSet("InclusionRule","ExclusionRule")] + [ValidateSet("InclusionRule", "ExclusionRule")] [System.String] $RuleType, [Parameter()] [ValidateSet("FollowLinksNoPageCrawl", - "CrawlComplexUrls", - "CrawlAsHTTP")] + "CrawlComplexUrls", + "CrawlAsHTTP")] [System.String[]] $CrawlConfigurationRules, @@ -44,7 +44,7 @@ function Get-TargetResource $CertificateName, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -59,7 +59,7 @@ function Get-TargetResource if ($AuthenticationType -eq "CertificateRuleAccess" -and -not $CertificateName) { throw ("When AuthenticationType=CertificateRuleAccess, the parameter " + ` - "CertificateName is required") + "CertificateName is required") } # AuthenticationType=CertificateName and CertificateRuleAccess parameters not @@ -72,48 +72,48 @@ function Get-TargetResource # AuthenticationType=NTLMAccountRuleAccess and AuthenticationCredentialsparameters # not specified if (($AuthenticationType -eq "NTLMAccountRuleAccess" ` - -or $AuthenticationType -eq "BasicAccountRuleAccess") ` - -and -not $AuthenticationCredentials) + -or $AuthenticationType -eq "BasicAccountRuleAccess") ` + -and -not $AuthenticationCredentials) { throw ("When AuthenticationType is NTLMAccountRuleAccess or BasicAccountRuleAccess, " + ` - "the parameter AuthenticationCredentials is required") + "the parameter AuthenticationCredentials is required") } # AuthenticationCredentials parameters, but AuthenticationType is not NTLMAccountRuleAccess # or BasicAccountRuleAccess if ($AuthenticationCredentials ` - -and $AuthenticationType -ne "NTLMAccountRuleAccess" ` - -and $AuthenticationType -ne "BasicAccountRuleAccess") + -and $AuthenticationType -ne "NTLMAccountRuleAccess" ` + -and $AuthenticationType -ne "BasicAccountRuleAccess") { throw ("When specifying AuthenticationCredentials, the AuthenticationType " + ` - "parameter is required") + "parameter is required") } # ExclusionRule only with CrawlConfigurationRules=CrawlComplexUrls if ($RuleType -eq "ExclusionRule" ` - -and ($CrawlConfigurationRules -contains "CrawlAsHTTP" ` - -or $CrawlConfigurationRules -contains "FollowLinksNoPageCrawl")) + -and ($CrawlConfigurationRules -contains "CrawlAsHTTP" ` + -or $CrawlConfigurationRules -contains "FollowLinksNoPageCrawl")) { throw ("When RuleType=ExclusionRule, CrawlConfigurationRules cannot contain " + ` - "the values FollowLinksNoPageCrawl or CrawlAsHTTP") + "the values FollowLinksNoPageCrawl or CrawlAsHTTP") } # ExclusionRule cannot be used with AuthenticationCredentials, CertificateName or # AuthenticationType parameters if ($RuleType -eq "ExclusionRule" ` - -and ($AuthenticationCredentials -or $CertificateName -or $AuthenticationType)) + -and ($AuthenticationCredentials -or $CertificateName -or $AuthenticationType)) { throw ("When Type=ExclusionRule, parameters AuthenticationCredentials, " + ` - "CertificateName or AuthenticationType are not allowed") + "CertificateName or AuthenticationType are not allowed") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Name $params.ServiceAppName ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $nullReturn = @{ Path = $params.Path @@ -140,9 +140,9 @@ function Get-TargetResource else { $crawlRule = Get-SPEnterpriseSearchCrawlRule ` - -SearchApplication $params.ServiceAppName | Where-Object -FilterScript { - $_.Path -eq $params.Path - } + -SearchApplication $params.ServiceAppName | Where-Object -FilterScript { + $_.Path -eq $params.Path + } if ($null -eq $crawlRule) { @@ -167,8 +167,9 @@ function Get-TargetResource switch ($crawlRule.AuthenticationType) { - {@("BasicAccountRuleAccess", - "NTLMAccountRuleAccess") -contains $_ } { + { @("BasicAccountRuleAccess", + "NTLMAccountRuleAccess") -contains $_ } + { $returnVal = @{ Path = $params.Path ServiceAppName = $params.ServiceAppName @@ -180,7 +181,8 @@ function Get-TargetResource InstallAccount = $params.InstallAccount } } - "CertificateRuleAccess" { + "CertificateRuleAccess" + { $returnVal = @{ Path = $params.Path ServiceAppName = $params.ServiceAppName @@ -193,9 +195,10 @@ function Get-TargetResource } } { @("DefaultRuleAccess", - "FormRuleAccess", - "CookieRuleAccess", - "AnonymousAccess") -contains $_ } { + "FormRuleAccess", + "CookieRuleAccess", + "AnonymousAccess") -contains $_ } + { $returnVal = @{ Path = $params.Path ServiceAppName = $params.ServiceAppName @@ -206,14 +209,15 @@ function Get-TargetResource InstallAccount = $params.InstallAccount } } - default { - Path = $params.Path - ServiceAppName = $params.ServiceAppName - AuthenticationType = "Unknown" - RuleType = $crawlRule.Type.ToString() - CrawlConfigurationRules = $crawlConfigurationRules - Ensure = "Present" - InstallAccount = $params.InstallAccount + default + { + Path = $params.Path + ServiceAppName = $params.ServiceAppName + AuthenticationType = "Unknown" + RuleType = $crawlRule.Type.ToString() + CrawlConfigurationRules = $crawlConfigurationRules + Ensure = "Present" + InstallAccount = $params.InstallAccount } } return $returnVal @@ -238,24 +242,24 @@ function Set-TargetResource [Parameter()] [ValidateSet("DefaultRuleAccess", - "BasicAccountRuleAccess", - "CertificateRuleAccess", - "NTLMAccountRuleAccess", - "FormRuleAccess", - "CookieRuleAccess", - "AnonymousAccess")] + "BasicAccountRuleAccess", + "CertificateRuleAccess", + "NTLMAccountRuleAccess", + "FormRuleAccess", + "CookieRuleAccess", + "AnonymousAccess")] [System.String] $AuthenticationType, [Parameter()] - [ValidateSet("InclusionRule","ExclusionRule")] + [ValidateSet("InclusionRule", "ExclusionRule")] [System.String] $RuleType, [Parameter()] [ValidateSet("FollowLinksNoPageCrawl", - "CrawlComplexUrls", - "CrawlAsHTTP")] + "CrawlComplexUrls", + "CrawlAsHTTP")] [System.String[]] $CrawlConfigurationRules, @@ -268,7 +272,7 @@ function Set-TargetResource $CertificateName, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -285,7 +289,7 @@ function Set-TargetResource if ($AuthenticationType -eq "CertificateRuleAccess" -and -not $CertificateName) { throw ("When AuthenticationType=CertificateRuleAccess, the parameter " + ` - "CertificateName is required") + "CertificateName is required") } # AuthenticationType=CertificateName and CertificateRuleAccess parameters not @@ -298,51 +302,51 @@ function Set-TargetResource # AuthenticationType=NTLMAccountRuleAccess and AuthenticationCredentialsparameters # not specified if (($AuthenticationType -eq "NTLMAccountRuleAccess" ` - -or $AuthenticationType -eq "BasicAccountRuleAccess") ` - -and -not $AuthenticationCredentials) + -or $AuthenticationType -eq "BasicAccountRuleAccess") ` + -and -not $AuthenticationCredentials) { throw ("When AuthenticationType is NTLMAccountRuleAccess or BasicAccountRuleAccess, " + ` - "the parameter AuthenticationCredentials is required") + "the parameter AuthenticationCredentials is required") } # AuthenticationCredentials parameters, but AuthenticationType is not NTLMAccountRuleAccess # or BasicAccountRuleAccess if ($AuthenticationCredentials ` - -and $AuthenticationType -ne "NTLMAccountRuleAccess" ` - -and $AuthenticationType -ne "BasicAccountRuleAccess") + -and $AuthenticationType -ne "NTLMAccountRuleAccess" ` + -and $AuthenticationType -ne "BasicAccountRuleAccess") { throw ("When specifying AuthenticationCredentials, the AuthenticationType " + ` - "parameter is required") + "parameter is required") } # ExclusionRule only with CrawlConfigurationRules=CrawlComplexUrls if ($RuleType -eq "ExclusionRule" ` - -and ($CrawlConfigurationRules -contains "CrawlAsHTTP" ` - -or $CrawlConfigurationRules -contains "FollowLinksNoPageCrawl")) + -and ($CrawlConfigurationRules -contains "CrawlAsHTTP" ` + -or $CrawlConfigurationRules -contains "FollowLinksNoPageCrawl")) { throw ("When RuleType=ExclusionRule, CrawlConfigurationRules cannot contain " + ` - "the values FollowLinksNoPageCrawl or CrawlAsHTTP") + "the values FollowLinksNoPageCrawl or CrawlAsHTTP") } # ExclusionRule cannot be used with AuthenticationCredentials, CertificateName or # AuthenticationType parameters if ($RuleType -eq "ExclusionRule" ` - -and ($AuthenticationCredentials -or $CertificateName -or $AuthenticationType)) + -and ($AuthenticationCredentials -or $CertificateName -or $AuthenticationType)) { throw ("When Type=ExclusionRule, parameters AuthenticationCredentials, " + ` - "CertificateName or AuthenticationType are not allowed") + "CertificateName or AuthenticationType are not allowed") } if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message "Creating Crawl Rule $Path" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $newParams = @{ - Path = $params.Path + Path = $params.Path SearchApplication = $params.ServiceAppName } if ($params.ContainsKey("AuthenticationType") -eq $true) @@ -357,15 +361,15 @@ function Set-TargetResource { if ($params.CrawlConfigurationRules -contains "FollowLinksNoPageCrawl") { - $newParams.Add("SuppressIndexing",1) + $newParams.Add("SuppressIndexing", 1) } if ($params.CrawlConfigurationRules -contains "CrawlComplexUrls") { - $newParams.Add("FollowComplexUrls",1) + $newParams.Add("FollowComplexUrls", 1) } if ($params.CrawlConfigurationRules -contains "CrawlAsHTTP") { - $newParams.Add("CrawlAsHttp",1) + $newParams.Add("CrawlAsHttp", 1) } } if ($params.ContainsKey("AuthenticationCredentials") -eq $true) @@ -388,14 +392,14 @@ function Set-TargetResource $params = $args[0] $crawlRule = Get-SPEnterpriseSearchCrawlRule ` - -SearchApplication $params.ServiceAppName | Where-Object -FilterScript { - $_.Path -eq $params.Path - } + -SearchApplication $params.ServiceAppName | Where-Object -FilterScript { + $_.Path -eq $params.Path + } if ($null -ne $crawlRule) { $setParams = @{ - Identity = $params.Path + Identity = $params.Path SearchApplication = $params.ServiceAppName } if ($params.ContainsKey("AuthenticationType") -eq $true) @@ -410,15 +414,15 @@ function Set-TargetResource { if ($params.CrawlConfigurationRules -contains "FollowLinksNoPageCrawl") { - $setParams.Add("SuppressIndexing",1) + $setParams.Add("SuppressIndexing", 1) } if ($params.CrawlConfigurationRules -contains "CrawlComplexUrls") { - $setParams.Add("FollowComplexUrls",1) + $setParams.Add("FollowComplexUrls", 1) } if ($params.CrawlConfigurationRules -contains "CrawlAsHTTP") { - $setParams.Add("CrawlAsHttp",1) + $setParams.Add("CrawlAsHttp", 1) } } if ($params.ContainsKey("AuthenticationCredentials") -eq $true) @@ -439,13 +443,13 @@ function Set-TargetResource { Write-Verbose -Message "Removing Crawl Rule $Path" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] Remove-SPEnterpriseSearchCrawlRule -SearchApplication $params.ServiceAppName ` - -Identity $params.Path ` - -Confirm:$false + -Identity $params.Path ` + -Confirm:$false } } } @@ -466,24 +470,24 @@ function Test-TargetResource [Parameter()] [ValidateSet("DefaultRuleAccess", - "BasicAccountRuleAccess", - "CertificateRuleAccess", - "NTLMAccountRuleAccess", - "FormRuleAccess", - "CookieRuleAccess", - "AnonymousAccess")] + "BasicAccountRuleAccess", + "CertificateRuleAccess", + "NTLMAccountRuleAccess", + "FormRuleAccess", + "CookieRuleAccess", + "AnonymousAccess")] [System.String] $AuthenticationType, [Parameter()] - [ValidateSet("InclusionRule","ExclusionRule")] + [ValidateSet("InclusionRule", "ExclusionRule")] [System.String] $RuleType, [Parameter()] [ValidateSet("FollowLinksNoPageCrawl", - "CrawlComplexUrls", - "CrawlAsHTTP")] + "CrawlComplexUrls", + "CrawlAsHTTP")] [System.String[]] $CrawlConfigurationRules, @@ -496,7 +500,7 @@ function Test-TargetResource $CertificateName, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -521,8 +525,8 @@ function Test-TargetResource if ($CurrentValues.ContainsKey("CrawlConfigurationRules")) { $compareObject = Compare-Object ` - -ReferenceObject $CrawlConfigurationRules ` - -DifferenceObject $CurrentValues.CrawlConfigurationRules + -ReferenceObject $CrawlConfigurationRules ` + -DifferenceObject $CurrentValues.CrawlConfigurationRules if ($null -ne $compareObject) { return $false @@ -543,15 +547,17 @@ function Test-TargetResource } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure", - "AuthenticationType", - "RuleType", - "CertificateName") - } else { + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure", + "AuthenticationType", + "RuleType", + "CertificateName") + } + else + { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.psm1 index 30cd49b89..3e5acf6dc 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.psm1 @@ -21,7 +21,7 @@ function Get-TargetResource $WaitTime = 0, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -38,8 +38,8 @@ function Get-TargetResource } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $nullReturn = @{ @@ -119,7 +119,7 @@ function Set-TargetResource $WaitTime = 0, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -142,8 +142,8 @@ function Set-TargetResource { Write-Verbose -Message "Creating Crawler Impact Rule $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $behavior = "0" $hitRate = 0 @@ -164,17 +164,17 @@ function Set-TargetResource throw "The Search Service Application does not exist." } New-SPEnterpriseSearchSiteHitRule -Name $params.Name ` - -Behavior $behavior ` - -HitRate $hitRate ` - -SearchService $serviceApp + -Behavior $behavior ` + -HitRate $hitRate ` + -SearchService $serviceApp } } if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") { Write-Verbose -Message "Updating Crawler Impact Rule $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $behavior = "0" $hitRate = 0 @@ -195,13 +195,13 @@ function Set-TargetResource } Remove-SPEnterpriseSearchSiteHitRule -Identity $params.Name ` - -SearchService $serviceApp ` - -ErrorAction SilentlyContinue + -SearchService $serviceApp ` + -ErrorAction SilentlyContinue New-SPEnterpriseSearchSiteHitRule -Name $params.Name ` - -Behavior $behavior ` - -HitRate $hitRate ` - -SearchService $serviceApp + -Behavior $behavior ` + -HitRate $hitRate ` + -SearchService $serviceApp } } @@ -209,8 +209,8 @@ function Set-TargetResource { Write-Verbose -Message "Removing Crawler Impact Rule $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApp = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName if ($null -eq $serviceApp) @@ -218,8 +218,8 @@ function Set-TargetResource throw "The Search Service Application does not exist." } Remove-SPEnterpriseSearchSiteHitRule -Identity $params.Name ` - -SearchService $serviceApp ` - -ErrorAction SilentlyContinue + -SearchService $serviceApp ` + -ErrorAction SilentlyContinue } } @@ -249,7 +249,7 @@ function Test-TargetResource $WaitTime = 0, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -282,18 +282,18 @@ function Test-TargetResource if ($Ensure -eq "Present") { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ServiceAppName", - "Name", - $behavior) + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("ServiceAppName", + "Name", + $behavior) } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ServiceAppName", - "Name", - "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("ServiceAppName", + "Name", + "Ensure") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.psm1 index 1b0954716..6e1d14900 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.psm1 @@ -25,7 +25,7 @@ function Get-TargetResource $Enabled, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -38,24 +38,24 @@ function Get-TargetResource if ($Ensure -eq "Present" -and ` (-not($PSBoundParameters.ContainsKey("MimeType")) -or ` - -not($PSBoundParameters.ContainsKey("Description")))) + -not($PSBoundParameters.ContainsKey("Description")))) { Write-Verbose -Message "Ensure is configured as Present, but MimeType and/or Description is missing" $nullReturn = @{ - FileType = $FileType + FileType = $FileType ServiceAppName = $ServiceAppName - Ensure = "Absent" + Ensure = "Absent" } return $nullReturn } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Name $params.ServiceAppName ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $nullReturn = @{ FileType = $params.FileType @@ -82,9 +82,9 @@ function Get-TargetResource else { $fileType = Get-SPEnterpriseSearchFileFormat ` - -SearchApplication $params.ServiceAppName | Where-Object -FilterScript { - $_.Identity -eq $params.FileType - } + -SearchApplication $params.ServiceAppName | Where-Object -FilterScript { + $_.Identity -eq $params.FileType + } if ($null -eq $fileType) { @@ -136,7 +136,7 @@ function Set-TargetResource $Enabled, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -149,7 +149,7 @@ function Set-TargetResource if ($Ensure -eq "Present" -and ` (-not($PSBoundParameters.ContainsKey("MimeType")) -or ` - -not($PSBoundParameters.ContainsKey("Description")))) + -not($PSBoundParameters.ContainsKey("Description")))) { throw "Ensure is configured as Present, but MimeType and/or Description is missing" } @@ -160,12 +160,12 @@ function Set-TargetResource Write-Verbose -Message "Checking if Service Application '$ServiceAppName' exists" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Name $params.ServiceAppName ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $serviceApps) { @@ -186,8 +186,8 @@ function Set-TargetResource { Write-Verbose -Message "Creating File Type $FileType" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $newParams = @{ @@ -218,9 +218,9 @@ function Set-TargetResource $params = $args[0] $fileType = Get-SPEnterpriseSearchFileFormat ` - -SearchApplication $params.ServiceAppName | Where-Object -FilterScript { - $_.Identity -eq $params.FileType - } + -SearchApplication $params.ServiceAppName | Where-Object -FilterScript { + $_.Identity -eq $params.FileType + } if ($null -ne $fileType) { @@ -228,8 +228,8 @@ function Set-TargetResource ($fileType.Name -ne $params.Description)) { Remove-SPEnterpriseSearchFileFormat -Identity $params.FileType ` - -SearchApplication $params.ServiceAppName ` - -Confirm:$false + -SearchApplication $params.ServiceAppName ` + -Confirm:$false $newParams = @{ FormatId = $params.FileType @@ -262,13 +262,13 @@ function Set-TargetResource { Write-Verbose -Message "Removing Crawl Rule $Path" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] Remove-SPEnterpriseSearchFileFormat -Identity $params.FileType ` - -SearchApplication $params.ServiceAppName ` - -Confirm:$false + -SearchApplication $params.ServiceAppName ` + -Confirm:$false } } } @@ -300,7 +300,7 @@ function Test-TargetResource $Enabled, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -329,16 +329,16 @@ function Test-TargetResource } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure", - "Description", - "MimeType") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure", + "Description", + "MimeType") } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.psm1 index 03a93bafc..2a83ca2b2 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.psm1 @@ -28,8 +28,8 @@ function Get-TargetResource Write-Verbose -Message "Getting Search Index Partition '$Index' settings" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $ConfirmPreference = 'None' @@ -37,10 +37,10 @@ function Get-TargetResource $currentTopology = $ssa.ActiveTopology $searchComponent = Get-SPEnterpriseSearchComponent -SearchTopology $currentTopology | ` - Where-Object -FilterScript { - ($_.GetType().Name -eq "IndexComponent") ` - -and ($_.IndexPartitionOrdinal -eq $params.Index) - } + Where-Object -FilterScript { + ($_.GetType().Name -eq "IndexComponent") ` + -and ($_.IndexPartitionOrdinal -eq $params.Index) + } $IndexComponents = $searchComponent.ServerName $rootDirectory = $searchComponent.RootDirectory @@ -94,8 +94,8 @@ function Set-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $CurrentValues) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $CurrentValues) ` + -ScriptBlock { $params = $args[0] $CurrentValues = $args[1] $ConfirmPreference = 'None' @@ -142,7 +142,7 @@ function Set-TargetResource } # Get all service service instances to assign topology components to - $AllSearchServiceInstances = @{} + $AllSearchServiceInstances = @{ } foreach ($server in $AllSearchServers) { $si = Get-SPEnterpriseSearchServiceInstance -Identity $server @@ -153,8 +153,8 @@ function Set-TargetResource $ssa = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName $currentTopology = $ssa.ActiveTopology $newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa ` - -Clone ` - -SearchTopology $currentTopology + -Clone ` + -SearchTopology $currentTopology $componentTypes = @{ Servers = "IndexComponent" @@ -195,9 +195,10 @@ function Set-TargetResource SearchTopology = $newTopology SearchServiceInstance = $AllSearchServiceInstances.$componentToAdd } - switch($componentTypes.$CurrentSearchProperty) + switch ($componentTypes.$CurrentSearchProperty) { - "IndexComponent" { + "IndexComponent" + { $NewComponentParams.Add("IndexPartition", $params.Index) if ($params.ContainsKey("RootDirectory") -eq $true) { @@ -214,14 +215,14 @@ function Set-TargetResource { $component = Get-SPEnterpriseSearchComponent -SearchTopology $newTopology | ` Where-Object -FilterScript { - ($_.GetType().Name -eq $componentTypes.$CurrentSearchProperty) ` - -and ($_.ServerName -eq $componentToRemove) ` - -and ($_.IndexPartitionOrdinal -eq $params.Index) + ($_.GetType().Name -eq $componentTypes.$CurrentSearchProperty) ` + -and ($_.ServerName -eq $componentToRemove) ` + -and ($_.IndexPartitionOrdinal -eq $params.Index) } if ($null -ne $component) { $component | Remove-SPEnterpriseSearchComponent -SearchTopology $newTopology ` - -Confirm:$false + -Confirm:$false } } } @@ -266,8 +267,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Servers") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Servers") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchManagedProperty/MSFT_SPSearchManagedProperty.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchManagedProperty/MSFT_SPSearchManagedProperty.psm1 index 3e2e1ea6b..c6c98744e 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchManagedProperty/MSFT_SPSearchManagedProperty.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchManagedProperty/MSFT_SPSearchManagedProperty.psm1 @@ -13,7 +13,7 @@ function Get-TargetResource $ServiceAppName, [Parameter(Mandatory = $true)] - [ValidateSet("Binary","DateTime","Decimal","Double","Integer","Text","YesNo")] + [ValidateSet("Binary", "DateTime", "Decimal", "Double", "Integer", "Text", "YesNo")] [System.String] $PropertyType, @@ -66,7 +66,7 @@ function Get-TargetResource $CrawledProperties, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -78,8 +78,8 @@ function Get-TargetResource Write-Verbose -Message "Getting Managed Property Setting for '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters) ` - -ScriptBlock { + -Arguments @($PSBoundParameters) ` + -ScriptBlock { $params = $args[0] $ssa = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName @@ -89,7 +89,7 @@ function Get-TargetResource invalid. Please make sure you specify the name of an existing service application.") } $managedProperty = Get-SPEnterpriseSearchMetadataManagedProperty -SearchApplication $ssa | ` - Where-Object{$_.Name -eq $params.Name} + Where-Object { $_.Name -eq $params.Name } if ($null -eq $managedProperty) { return @{ @@ -156,7 +156,7 @@ function Set-TargetResource $ServiceAppName, [Parameter(Mandatory = $true)] - [ValidateSet("Binary","DateTime","Decimal","Double","Integer","Text","YesNo")] + [ValidateSet("Binary", "DateTime", "Decimal", "Double", "Integer", "Text", "YesNo")] [System.String] $PropertyType, @@ -209,7 +209,7 @@ function Set-TargetResource $CrawledProperties, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -225,9 +225,9 @@ function Set-TargetResource # Validate that the specified crawled properties are all valid and existing Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, ` - $CurrentValues) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, ` + $CurrentValues) ` + -ScriptBlock { $params = $args[0] $CurrentValues = $args[1] @@ -244,7 +244,7 @@ function Set-TargetResource foreach ($mappedCrawlProperty in $params.CrawledProperties) { $currentCrawlProperty = Get-SPEnterpriseSearchMetadataCrawledProperty -Name $mappedCrawlProperty ` - -SearchApplication $params.ServiceAppName + -SearchApplication $params.ServiceAppName if (!$currentCrawlProperty) { throw("The specified crawled property $($mappedCrawlProperty) does not exist. ` @@ -257,11 +257,11 @@ function Set-TargetResource # If the property should not be present and is, or if it should be present bu the current property type # differs from the desired one. if ($params.Ensure -eq "Absent" -and $CurrentValues.Ensure -eq "Present" -or ` - ($params.PropertyType -ne $CurrentValues.PropertyType -and ` - $CurrentValues.Ensure -eq "Present")) + ($params.PropertyType -ne $CurrentValues.PropertyType -and ` + $CurrentValues.Ensure -eq "Present")) { $managedProperty = Get-SPEnterpriseSearchMetadataManagedProperty -Identity $params.Name ` - -SearchApplication $params.ServiceAppName + -SearchApplication $params.ServiceAppName # In order to delete a Managed PRoperty we need to make sure it doesn't have any crawled properties # mapped to it first. @@ -270,8 +270,8 @@ function Set-TargetResource # Remove the existing managed property Write-Verbose "Removing Managed Property $($params.Name)" Remove-SPEnterpriseSearchMetadataManagedProperty -Identity $params.Name ` - -SearchApplication $params.ServiceAppName ` - -Confirm:$false + -SearchApplication $params.ServiceAppName ` + -Confirm:$false if ($params.PropertyType -ne $CurrentValues.PropertyType) { @@ -289,19 +289,19 @@ function Set-TargetResource Write-Verbose "Creating a new Managed Property $($params.Name)" New-SPEnterpriseSearchMetadataManagedProperty -Name $params.Name ` - -SearchApplication $params.ServiceAppName ` - -Type $managedTypeID + -SearchApplication $params.ServiceAppName ` + -Type $managedTypeID } # Set the specified properties on the Managed Property $managedProperty = Get-SPEnterpriseSearchMetadataManagedProperty -Identity $params.Name ` - -SearchApplication $params.ServiceAppName + -SearchApplication $params.ServiceAppName Set-SPEnterpriseSearchMetadataManagedProperty -Identity $managedProperty.Name ` - -SearchApplication $params.ServiceAppName ` - -Retrievable $params.Retrievable ` - -SafeForAnonymous $params.SafeForAnonymous ` - -NoWordBreaker $params.NoWordBreaker + -SearchApplication $params.ServiceAppName ` + -Retrievable $params.Retrievable ` + -SafeForAnonymous $params.SafeForAnonymous ` + -NoWordBreaker $params.NoWordBreaker $managedProperty.HasMultipleValues = $params.HasMultipleValues $managedProperty.Searchable = $params.Searchable @@ -318,7 +318,7 @@ function Set-TargetResource foreach ($alias in $params.Aliases) { - $currentAlias = $managedProperty.GetAliases() | Where-Object {$_ -eq $alias} + $currentAlias = $managedProperty.GetAliases() | Where-Object { $_ -eq $alias } if (!$currentAlias) { $managedProperty.AddAlias($alias) @@ -344,7 +344,7 @@ function Set-TargetResource foreach ($mappedCrawlProperty in $params.CrawledProperties) { $currentCrawlProperty = Get-SPEnterpriseSearchMetadataCrawledProperty -Name $mappedCrawlProperty ` - -SearchApplication $params.ServiceAppName + -SearchApplication $params.ServiceAppName $mapping = [Microsoft.Office.Server.Search.Administration.Mapping]::new() $mapping.CrawledPropertyName = $mappedCrawlProperty @@ -371,7 +371,7 @@ function Test-TargetResource $ServiceAppName, [Parameter(Mandatory = $true)] - [ValidateSet("Binary","DateTime","Decimal","Double","Integer","Text","YesNo")] + [ValidateSet("Binary", "DateTime", "Decimal", "Double", "Integer", "Text", "YesNo")] [System.String] $PropertyType, @@ -424,7 +424,7 @@ function Test-TargetResource $CrawledProperties, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -443,20 +443,20 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name", - "PropertyType", - "Ensure", - "HasMultipleValues", - "Retrievable", - "Searchable", - "Refinable", - "Searchable", - "NoWordBreaker", - "IncludeAllCrawledProperties", - "Aliases", - "Sortable", - "SafeForAnonymous") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Name", + "PropertyType", + "Ensure", + "HasMultipleValues", + "Retrievable", + "Searchable", + "Refinable", + "Searchable", + "NoWordBreaker", + "IncludeAllCrawledProperties", + "Aliases", + "Sortable", + "SafeForAnonymous") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchMetadataCategory/MSFT_SPSearchMetadataCategory.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchMetadataCategory/MSFT_SPSearchMetadataCategory.psm1 index fc302d093..97a13db78 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchMetadataCategory/MSFT_SPSearchMetadataCategory.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchMetadataCategory/MSFT_SPSearchMetadataCategory.psm1 @@ -25,7 +25,7 @@ function Get-TargetResource $MapToContents, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -37,8 +37,8 @@ function Get-TargetResource Write-Verbose -Message "Getting Metadata Category Setting for '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters) ` - -ScriptBlock { + -Arguments @($PSBoundParameters) ` + -ScriptBlock { $params = $args[0] $ssa = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName @@ -48,7 +48,7 @@ function Get-TargetResource invalid. Please make sure you specify the name of an existing service application.") } $category = Get-SPEnterpriseSearchMetadataCategory -SearchApplication $ssa | ` - Where-Object{$_.Name -eq $params.Name} + Where-Object { $_.Name -eq $params.Name } if ($null -eq $category) { return @{ @@ -102,7 +102,7 @@ function Set-TargetResource $MapToContents, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -115,8 +115,8 @@ function Set-TargetResource # Validate that the specified crawled properties are all valid and existing Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters) ` - -ScriptBlock { + -Arguments @($PSBoundParameters) ` + -ScriptBlock { $params = $args[0] $ssa = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName @@ -128,7 +128,7 @@ function Set-TargetResource # Set the specified properties on the Managed Property $category = Get-SPEnterpriseSearchMetadataCategory -Identity $params.Name ` - -SearchApplication $params.ServiceAppName + -SearchApplication $params.ServiceAppName # The category exists and it shouldn't, delete it; if ($params.Ensure -eq "Absent" -and $null -ne $category) @@ -137,25 +137,25 @@ function Set-TargetResource if ($category.CrawledPropertyCount -gt 0) { throw "Cannot delete Metadata Category $($param.Name) because it contains " + ` - "Crawled Properties. Please remove all associated Crawled Properties " + ` - "before attempting to delete this category." + "Crawled Properties. Please remove all associated Crawled Properties " + ` + "before attempting to delete this category." } Remove-SPEnterpriseSearchMetadataCategory -Identity $params.Name ` - -SearchApplication $params.ServiceAppName ` - -Confirm:$false + -SearchApplication $params.ServiceAppName ` + -Confirm:$false } # The category doesn't exist, but should if ($params.Ensure -eq "Present" -and $null -eq $category) { $category = New-SPEnterpriseSearchMetadataCategory -Name $params.Name ` - -SearchApplication $params.ServiceAppName + -SearchApplication $params.ServiceAppName } Set-SPEnterpriseSearchMetadataCategory -Identity $params.Name ` - -SearchApplication $params.ServiceAppName ` - -AutoCreateNewManagedProperties $params.AutoCreateNewManagedProperties ` - -DiscoverNewProperties $params.DiscoverNewProperties ` - -MapToContents $params.MapToContents + -SearchApplication $params.ServiceAppName ` + -AutoCreateNewManagedProperties $params.AutoCreateNewManagedProperties ` + -DiscoverNewProperties $params.DiscoverNewProperties ` + -MapToContents $params.MapToContents } } @@ -186,7 +186,7 @@ function Test-TargetResource $MapToContents, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -205,13 +205,13 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name", - "PropertyType", - "Ensure", - "AutoCreateNewManagedProperties", - "DiscoverNewProperties", - "MapToContents") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Name", + "PropertyType", + "Ensure", + "AutoCreateNewManagedProperties", + "DiscoverNewProperties", + "MapToContents") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.psm1 index c788ec84d..294aa3221 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.psm1 @@ -10,8 +10,8 @@ function Get-TargetResource [Parameter(Mandatory = $true)] [ValidateSet("SSA", - "SPSite", - "SPWeb")] + "SPSite", + "SPWeb")] [System.String] $ScopeName, @@ -36,7 +36,7 @@ function Get-TargetResource $ConnectionUrl, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -48,8 +48,8 @@ function Get-TargetResource Write-Verbose -Message "Getting search result source '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] [void] [Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.Search") @@ -68,7 +68,7 @@ function Get-TargetResource if ($null -eq $serviceApp) { Write-Verbose -Message ("Specified Search service application $($params.SearchServiceAppName)" + ` - "does not exist.") + "does not exist.") return $nullReturn } @@ -77,7 +77,7 @@ function Get-TargetResource if ($providers.Keys -notcontains $params.ProviderType) { Write-Verbose -Message ("Unknown ProviderType ($($params.ProviderType)) is used. Allowed " + ` - "values are: '" + ($providers.Keys -join "', '") + "'") + "values are: '" + ($providers.Keys -join "', '") + "'") return $nullReturn } @@ -93,7 +93,7 @@ function Get-TargetResource $filter = New-Object Microsoft.Office.Server.Search.Administration.SearchObjectFilter($searchOwner) $filter.IncludeHigherLevel = $true - $source = $fedManager.ListSources($filter,$true) | Where-Object -FilterScript { + $source = $fedManager.ListSources($filter, $true) | Where-Object -FilterScript { $_.Name -eq $params.Name } @@ -134,8 +134,8 @@ function Set-TargetResource [Parameter(Mandatory = $true)] [ValidateSet("SSA", - "SPSite", - "SPWeb")] + "SPSite", + "SPWeb")] [System.String] $ScopeName, @@ -160,7 +160,7 @@ function Set-TargetResource $ConnectionUrl, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -177,25 +177,25 @@ function Set-TargetResource { Write-Verbose -Message "Creating search result source $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] [void] [Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.Search") $serviceApp = Get-SPEnterpriseSearchServiceApplication ` - -Identity $params.SearchServiceAppName + -Identity $params.SearchServiceAppName if ($null -eq $serviceApp) { throw ("Specified Search service application $($params.SearchServiceAppName)" + ` - "does not exist.") + "does not exist.") } - $fedManager = New-Object Microsoft.Office.Server.Search.Administration.Query.FederationManager($serviceApp) + $fedManager = New-Object Microsoft.Office.Server.Search.Administration.Query.FederationManager($serviceApp) $providers = $fedManager.ListProviders() if ($providers.Keys -notcontains $params.ProviderType) { throw ("Unknown ProviderType ($($params.ProviderType)) is used. Allowed " + ` - "values are: '" + ($providers.Keys -join "', '") + "'") + "values are: '" + ($providers.Keys -join "', '") + "'") } $searchOwner = $null @@ -235,7 +235,7 @@ function Set-TargetResource [void] [Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.Search") $serviceApp = Get-SPEnterpriseSearchServiceApplication ` - -Identity $params.SearchServiceAppName + -Identity $params.SearchServiceAppName $fedManager = New-Object Microsoft.Office.Server.Search.Administration.Query.FederationManager($serviceApp) $searchOwner = $null @@ -269,8 +269,8 @@ function Test-TargetResource [Parameter(Mandatory = $true)] [ValidateSet("SSA", - "SPSite", - "SPWeb")] + "SPSite", + "SPWeb")] [System.String] $ScopeName, @@ -295,7 +295,7 @@ function Test-TargetResource $ConnectionUrl, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -314,8 +314,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.psm1 index 785155031..36755cfee 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.psm1 @@ -28,7 +28,7 @@ function Get-TargetResource $DatabaseName, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -62,12 +62,12 @@ function Get-TargetResource if ($PSBoundParameters.ContainsKey("WindowsServiceAccount")) { Write-Verbose -Message ("This parameter is deprecated in this resource. Please use " + ` - "SPSearchServiceSettings instead.") + "SPSearchServiceSettings instead.") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -80,11 +80,11 @@ function Get-TargetResource [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server") $serviceAppPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $serviceAppPool) { Write-Verbose -Message ("Specified service application pool $($params.ApplicationPool) " + ` - "does not exist.") + "does not exist.") } $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue @@ -111,18 +111,18 @@ function Get-TargetResource { $c = [Microsoft.Office.Server.Search.Administration.SearchContext]::GetContext($serviceApp.Name) $sc = New-Object -TypeName Microsoft.Office.Server.Search.Administration.Content ` - -ArgumentList $c; + -ArgumentList $c; $dummyPassword = ConvertTo-SecureString -String "-" -AsPlainText -Force if ($null -ne $sc.DefaultGatheringAccount) { $defaultAccount = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList @($sc.DefaultGatheringAccount, $dummyPassword) + -ArgumentList @($sc.DefaultGatheringAccount, $dummyPassword) } $cloudIndex = $false $version = Get-SPDscInstalledProductVersion if (($version.FileMajorPart -gt 15) ` - -or ($version.FileMajorPart -eq 15 -and $version.FileBuildPart -ge 4745)) + -or ($version.FileMajorPart -eq 15 -and $version.FileBuildPart -ge 4745)) { $cloudIndex = $serviceApp.CloudIndex } @@ -140,7 +140,7 @@ function Get-TargetResource } } - $returnVal = @{ + $returnVal = @{ Name = $serviceApp.DisplayName ProxyName = $pName ApplicationPool = $serviceApp.ApplicationPool.Name @@ -186,7 +186,7 @@ function Set-TargetResource $DatabaseName, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -220,7 +220,7 @@ function Set-TargetResource if ($PSBoundParameters.ContainsKey("WindowsServiceAccount")) { Write-Verbose -Message ("This parameter is deprecated in this resource. Please use " + ` - "SPSearchServiceSettings instead.") + "SPSearchServiceSettings instead.") } $result = Get-TargetResource @PSBoundParameters @@ -237,12 +237,12 @@ function Set-TargetResource if ($null -eq $serviceAppPool) { throw ("Specified service application pool $($params.ApplicationPool) does not " + ` - "exist. Please make sure it exists before continuing.") + "exist. Please make sure it exists before continuing.") } $serviceInstance = Get-SPEnterpriseSearchServiceInstance -Local Start-SPEnterpriseSearchServiceInstance -Identity $serviceInstance ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $newParams = @{ Name = $params.Name ApplicationPool = $params.ApplicationPool @@ -260,15 +260,15 @@ function Set-TargetResource { $version = Get-SPDscInstalledProductVersion if (($version.FileMajorPart -gt 15) ` - -or ($version.FileMajorPart -eq 15 -and $version.FileBuildPart -ge 4745)) + -or ($version.FileMajorPart -eq 15 -and $version.FileBuildPart -ge 4745)) { $newParams.Add("CloudIndex", $params.CloudIndex) } else { throw ("Please install SharePoint 2019, 2016 or SharePoint 2013 with August " + ` - "2015 CU or higher before attempting to create a cloud enabled " + ` - "search service application") + "2015 CU or higher before attempting to create a cloud enabled " + ` + "search service application") } } @@ -290,7 +290,7 @@ function Set-TargetResource if ($params.ContainsKey("DefaultContentAccessAccount") -eq $true) { Write-Verbose -Message ("Setting DefaultContentAccessAccount to " + ` - $params.DefaultContentAccessAccount.UserName) + $params.DefaultContentAccessAccount.UserName) $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool $account = $params.DefaultContentAccessAccount $setParams = @{ @@ -307,8 +307,8 @@ function Set-TargetResource Write-Verbose -Message "Setting SearchCenterUrl to $($params.SearchCenterUrl)" $serviceApp = Get-SPServiceApplication -Name $params.Name | ` Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - } + $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" + } $serviceApp.SearchCenterUrl = $params.SearchCenterUrl $serviceApp.Update() } @@ -318,8 +318,8 @@ function Set-TargetResource Write-Verbose -Message "Setting AlertsEnabled to $($params.AlertsEnabled)" $serviceApp = Get-SPServiceApplication -Name $params.Name | ` Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - } + $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" + } $serviceApp.AlertsEnabled = $params.AlertsEnabled $serviceApp.Update() } @@ -332,15 +332,15 @@ function Set-TargetResource # Update the service app that already exists Write-Verbose -Message "Updating Search Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $result) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $result) ` + -ScriptBlock { $params = $args[0] $result = $args[1] $serviceApp = Get-SPServiceApplication -Name $params.Name | ` Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - } + $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" + } if ($null -eq $params.ProxyName) { @@ -362,8 +362,8 @@ function Set-TargetResource { Write-Verbose -Message "Updating proxy name to $pName" $serviceAppProxy = Get-SPServiceApplicationProxy | Where-Object -FilterScript { - $_.Name -eq $result.ProxyName - } + $_.Name -eq $result.ProxyName + } $serviceAppProxy.Name = $pName $serviceAppProxy.Update() } @@ -382,10 +382,10 @@ function Set-TargetResource } if ($params.ContainsKey("DefaultContentAccessAccount") -eq $true -and ` - $result.DefaultContentAccessAccount.UserName -ne $params.DefaultContentAccessAccount.UserName) + $result.DefaultContentAccessAccount.UserName -ne $params.DefaultContentAccessAccount.UserName) { Write-Verbose -Message ("Updating DefaultContentAccessAccount to " + ` - $params.DefaultContentAccessAccount.UserName) + $params.DefaultContentAccessAccount.UserName) $account = $params.DefaultContentAccessAccount $setParams.Add("DefaultContentAccessAccountName", $account.UserName) @@ -398,25 +398,25 @@ function Set-TargetResource } if ($params.ContainsKey("SearchCenterUrl") -eq $true -and ` - $result.SearchCenterUrl -ne $params.SearchCenterUrl) + $result.SearchCenterUrl -ne $params.SearchCenterUrl) { Write-Verbose -Message "Updating SearchCenterUrl to $($params.SearchCenterUrl)" $serviceApp = Get-SPServiceApplication -Name $params.Name | ` Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - } + $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" + } $serviceApp.SearchCenterUrl = $params.SearchCenterUrl $serviceApp.Update() } if ($params.ContainsKey("AlertsEnabled") -eq $true -and ` - $result.AlertsEnabled -ne $params.AlertsEnabled) + $result.AlertsEnabled -ne $params.AlertsEnabled) { Write-Verbose -Message "Updating AlertsEnabled to $($params.AlertsEnabled)" $serviceApp = Get-SPServiceApplication -Name $params.Name | ` Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - } + $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" + } $serviceApp.AlertsEnabled = $params.AlertsEnabled $serviceApp.Update() } @@ -428,11 +428,11 @@ function Set-TargetResource # The service app should not exit Write-Verbose -Message "Removing Search Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] - $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { + $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" } @@ -478,7 +478,7 @@ function Test-TargetResource $DatabaseName, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -512,7 +512,7 @@ function Test-TargetResource if ($PSBoundParameters.ContainsKey("WindowsServiceAccount")) { Write-Verbose -Message ("This parameter is deprecated in this resource. Please use " + ` - "SPSearchServiceSettings instead.") + "SPSearchServiceSettings instead.") } $PSBoundParameters.Ensure = $Ensure @@ -523,7 +523,7 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" if ($PSBoundParameters.ContainsKey("DefaultContentAccessAccount") ` - -and $Ensure -eq "Present") + -and $Ensure -eq "Present") { $desired = $DefaultContentAccessAccount.UserName $current = $CurrentValues.DefaultContentAccessAccount.UserName @@ -539,18 +539,18 @@ function Test-TargetResource if ($Ensure -eq "Present") { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure", - "ApplicationPool", - "SearchCenterUrl", - "ProxyName", - "AlertsEnabled") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure", + "ApplicationPool", + "SearchCenterUrl", + "ProxyName", + "AlertsEnabled") } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchServiceSettings/MSFT_SPSearchServiceSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchServiceSettings/MSFT_SPSearchServiceSettings.psm1 index 599d0682e..b5503b623 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchServiceSettings/MSFT_SPSearchServiceSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchServiceSettings/MSFT_SPSearchServiceSettings.psm1 @@ -13,7 +13,7 @@ function Get-TargetResource $IsSingleInstance, [Parameter()] - [ValidateSet("Reduced","PartlyReduced","Maximum")] + [ValidateSet("Reduced", "PartlyReduced", "Maximum")] [System.String] $PerformanceLevel, @@ -33,11 +33,11 @@ function Get-TargetResource Write-Verbose -Message "Getting Search service settings" if ($PSBoundParameters.ContainsKey("PerformanceLevel") -eq $false -and - $PSBoundParameters.ContainsKey("ContactEmail") -eq $false -and ` - $PSBoundParameters.ContainsKey("WindowsServiceAccount") -eq $false) + $PSBoundParameters.ContainsKey("ContactEmail") -eq $false -and ` + $PSBoundParameters.ContainsKey("WindowsServiceAccount") -eq $false) { Write-Verbose -Message ("You have to specify at least one of the following parameters: " + ` - "PerformanceLevel, ContactEmail or WindowsServiceAccount") + "PerformanceLevel, ContactEmail or WindowsServiceAccount") return @{ IsSingleInstance = "Yes" PerformanceLevel = $null @@ -48,8 +48,8 @@ function Get-TargetResource } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -59,7 +59,7 @@ function Get-TargetResource catch { Write-Verbose -Message ("No local SharePoint farm was detected. Search service " + ` - "settings will not be applied") + "settings will not be applied") return @{ IsSingleInstance = "Yes" PerformanceLevel = $null @@ -73,9 +73,9 @@ function Get-TargetResource $dummyPassword = ConvertTo-SecureString -String "-" -AsPlainText -Force $windowsAccount = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList @($searchService.ProcessIdentity, $dummyPassword) + -ArgumentList @($searchService.ProcessIdentity, $dummyPassword) - $returnVal = @{ + $returnVal = @{ IsSingleInstance = "Yes" PerformanceLevel = $searchService.PerformanceLevel ContactEmail = $searchService.ContactEmail @@ -98,7 +98,7 @@ function Set-TargetResource $IsSingleInstance, [Parameter()] - [ValidateSet("Reduced","PartlyReduced","Maximum")] + [ValidateSet("Reduced", "PartlyReduced", "Maximum")] [System.String] $PerformanceLevel, @@ -118,19 +118,19 @@ function Set-TargetResource Write-Verbose -Message "Setting Search service settings" if ($PSBoundParameters.ContainsKey("PerformanceLevel") -eq $false -and - $PSBoundParameters.ContainsKey("ContactEmail") -eq $false -and ` - $PSBoundParameters.ContainsKey("WindowsServiceAccount") -eq $false) + $PSBoundParameters.ContainsKey("ContactEmail") -eq $false -and ` + $PSBoundParameters.ContainsKey("WindowsServiceAccount") -eq $false) { throw ("You have to specify at least one of the following parameters: " + ` - "PerformanceLevel, ContactEmail or WindowsServiceAccount") + "PerformanceLevel, ContactEmail or WindowsServiceAccount") } $result = Get-TargetResource @PSBoundParameters # Update the service app that already exists Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $result) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $result) ` + -ScriptBlock { $params = $args[0] $result = $args[1] @@ -141,30 +141,30 @@ function Set-TargetResource catch { throw ("No local SharePoint farm was detected. Search service " + ` - "settings will not be applied") + "settings will not be applied") } - $setParams = @{} + $setParams = @{ } if ($params.ContainsKey("PerformanceLevel") -eq $true -and ` - $result.PerformanceLevel -ne $params.PerformanceLevel) + $result.PerformanceLevel -ne $params.PerformanceLevel) { Write-Verbose -Message "Updating PerformanceLevel to $($params.PerformanceLevel)" $setParams.Add("PerformanceLevel", $params.PerformanceLevel) } if ($params.ContainsKey("ContactEmail") -eq $true -and ` - $result.ContactEmail -ne $params.ContactEmail) + $result.ContactEmail -ne $params.ContactEmail) { Write-Verbose -Message "Updating ContactEmail to $($params.ContactEmail)" $setParams.Add("ContactEmail", $params.ContactEmail) } if ($params.ContainsKey("WindowsServiceAccount") -eq $true -and ` - $result.WindowsServiceAccount.UserName -ne $params.WindowsServiceAccount.UserName) + $result.WindowsServiceAccount.UserName -ne $params.WindowsServiceAccount.UserName) { Write-Verbose -Message ("Updating WindowsServiceAccount to " + ` - $params.WindowsServiceAccount.UserName) + $params.WindowsServiceAccount.UserName) $setParams.Add("ServiceAccount", $params.WindowsServiceAccount.UserName) $setParams.Add("ServicePassword", $params.WindowsServiceAccount.Password) } @@ -188,7 +188,7 @@ function Test-TargetResource $IsSingleInstance, [Parameter()] - [ValidateSet("Reduced","PartlyReduced","Maximum")] + [ValidateSet("Reduced", "PartlyReduced", "Maximum")] [System.String] $PerformanceLevel, @@ -208,11 +208,11 @@ function Test-TargetResource Write-Verbose -Message "Testing Search service settings" if ($PSBoundParameters.ContainsKey("PerformanceLevel") -eq $false -and - $PSBoundParameters.ContainsKey("ContactEmail") -eq $false -and ` - $PSBoundParameters.ContainsKey("WindowsServiceAccount") -eq $false) + $PSBoundParameters.ContainsKey("ContactEmail") -eq $false -and ` + $PSBoundParameters.ContainsKey("WindowsServiceAccount") -eq $false) { Write-Verbose -Message ("You have to specify at least one of the following parameters: " + ` - "PerformanceLevel, ContactEmail or WindowsServiceAccount") + "PerformanceLevel, ContactEmail or WindowsServiceAccount") return $false } @@ -235,9 +235,9 @@ function Test-TargetResource } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("PerformanceLevel", - "ContactEmail") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("PerformanceLevel", + "ContactEmail") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.psm1 index fe868ebdb..13e104bc6 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.psm1 @@ -44,13 +44,13 @@ function Get-TargetResource Write-Verbose -Message "Getting Search Topology for '$ServiceAppName'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $ConfirmPreference = 'None' $ssa = Get-SPEnterpriseSearchServiceApplication -Identity $params.ServiceAppName ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $ssa) { @@ -69,86 +69,86 @@ function Get-TargetResource $currentTopology = $ssa.ActiveTopology $allServers = Get-SPServer | ForEach-Object -Process { - return New-Object -TypeName System.Object | ` - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value $_.Name ` - -PassThru | ` - Add-Member -MemberType NoteProperty ` - -Name Id ` - -Value $_.Id ` - -PassThru - } + return New-Object -TypeName System.Object | ` + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value $_.Name ` + -PassThru | ` + Add-Member -MemberType NoteProperty ` + -Name Id ` + -Value $_.Id ` + -PassThru + } $allComponents = Get-SPEnterpriseSearchComponent -SearchTopology $currentTopology ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $AdminComponents = @() $AdminComponents += ($allComponents | Where-Object -FilterScript { - ($_.GetType().Name -eq "AdminComponent") - }).ServerId | ForEach-Object -Process { - $serverId = $_ - $server = $allServers | Where-Object -FilterScript { - $_.Id -eq $serverId - } | Select-Object -First 1 - return $server.Name - } + ($_.GetType().Name -eq "AdminComponent") + }).ServerId | ForEach-Object -Process { + $serverId = $_ + $server = $allServers | Where-Object -FilterScript { + $_.Id -eq $serverId + } | Select-Object -First 1 + return $server.Name + } $CrawlComponents = @() $CrawlComponents += ($allComponents | Where-Object -FilterScript { - ($_.GetType().Name -eq "CrawlComponent") - }).ServerId | ForEach-Object -Process { - $serverId = $_ - $server = $allServers | Where-Object -FilterScript { - $_.Id -eq $serverId - } | Select-Object -First 1 - return $server.Name - } + ($_.GetType().Name -eq "CrawlComponent") + }).ServerId | ForEach-Object -Process { + $serverId = $_ + $server = $allServers | Where-Object -FilterScript { + $_.Id -eq $serverId + } | Select-Object -First 1 + return $server.Name + } $ContentProcessingComponents = @() $ContentProcessingComponents += ($allComponents | Where-Object -FilterScript { - ($_.GetType().Name -eq "ContentProcessingComponent") - }).ServerId | ForEach-Object -Process { - $serverId = $_ - $server = $allServers | Where-Object -FilterScript { - $_.Id -eq $serverId - } | Select-Object -First 1 - return $server.Name - } + ($_.GetType().Name -eq "ContentProcessingComponent") + }).ServerId | ForEach-Object -Process { + $serverId = $_ + $server = $allServers | Where-Object -FilterScript { + $_.Id -eq $serverId + } | Select-Object -First 1 + return $server.Name + } $AnalyticsProcessingComponents = @() $AnalyticsProcessingComponents += ($allComponents | Where-Object -FilterScript { - ($_.GetType().Name -eq "AnalyticsProcessingComponent") - }).ServerId | ForEach-Object -Process { - $serverId = $_ - $server = $allServers | Where-Object -FilterScript { - $_.Id -eq $serverId - } | Select-Object -First 1 - return $server.Name - } + ($_.GetType().Name -eq "AnalyticsProcessingComponent") + }).ServerId | ForEach-Object -Process { + $serverId = $_ + $server = $allServers | Where-Object -FilterScript { + $_.Id -eq $serverId + } | Select-Object -First 1 + return $server.Name + } $QueryProcessingComponents = @() $QueryProcessingComponents += ($allComponents | Where-Object -FilterScript { - ($_.GetType().Name -eq "QueryProcessingComponent") - }).ServerId | ForEach-Object -Process { - $serverId = $_ - $server = $allServers | Where-Object -FilterScript { - $_.Id -eq $serverId - } | Select-Object -First 1 - return $server.Name - } + ($_.GetType().Name -eq "QueryProcessingComponent") + }).ServerId | ForEach-Object -Process { + $serverId = $_ + $server = $allServers | Where-Object -FilterScript { + $_.Id -eq $serverId + } | Select-Object -First 1 + return $server.Name + } $IndexComponents = @() $IndexComponents += ($allComponents | Where-Object -FilterScript { - ($_.GetType().Name -eq "IndexComponent") -and ` - $_.IndexPartitionOrdinal -eq 0 - }).ServerId | ForEach-Object -Process { - $serverId = $_ - $server = $allServers | Where-Object -FilterScript { - $_.Id -eq $serverId - } | Select-Object -First 1 - return $server.Name - } + ($_.GetType().Name -eq "IndexComponent") -and ` + $_.IndexPartitionOrdinal -eq 0 + }).ServerId | ForEach-Object -Process { + $serverId = $_ + $server = $allServers | Where-Object -FilterScript { + $_.Id -eq $serverId + } | Select-Object -First 1 + return $server.Name + } $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain @@ -168,7 +168,8 @@ function Get-TargetResource { $firstPartition = $ssiComponents.IndexLocation } - elseif ($ssiComponents.IndexLocation.GetType().Name -eq "Object[]") { + elseif ($ssiComponents.IndexLocation.GetType().Name -eq "Object[]") + { $firstPartition = $ssiComponents.IndexLocation[0] } } @@ -237,8 +238,8 @@ function Set-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $CurrentValues) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $CurrentValues) ` + -ScriptBlock { $params = $args[0] $CurrentValues = $args[1] @@ -246,23 +247,23 @@ function Set-TargetResource $AllSearchServers = @() $AllSearchServers += ($params.Admin | Where-Object -FilterScript { - ($AllSearchServers -contains $_) -eq $false - }) + ($AllSearchServers -contains $_) -eq $false + }) $AllSearchServers += ($params.Crawler | Where-Object -FilterScript { - ($AllSearchServers -contains $_) -eq $false - }) + ($AllSearchServers -contains $_) -eq $false + }) $AllSearchServers += ($params.ContentProcessing | Where-Object -FilterScript { - ($AllSearchServers -contains $_) -eq $false - }) + ($AllSearchServers -contains $_) -eq $false + }) $AllSearchServers += ($params.AnalyticsProcessing | Where-Object -FilterScript { - ($AllSearchServers -contains $_) -eq $false - }) + ($AllSearchServers -contains $_) -eq $false + }) $AllSearchServers += ($params.QueryProcessing | Where-Object -FilterScript { - ($AllSearchServers -contains $_) -eq $false - }) + ($AllSearchServers -contains $_) -eq $false + }) $AllSearchServers += ($params.IndexPartition | Where-Object -FilterScript { - ($AllSearchServers -contains $_) -eq $false - }) + ($AllSearchServers -contains $_) -eq $false + }) # Ensure the search service instance is running on all servers foreach ($searchServer in $AllSearchServers) @@ -274,7 +275,7 @@ function Set-TargetResource } $searchService = Get-SPEnterpriseSearchServiceInstance -Identity $searchServer ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $searchService) { $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain @@ -295,8 +296,8 @@ function Set-TargetResource { $online = Get-SPEnterpriseSearchServiceInstance -Identity $searchServer Write-Verbose -Message ("$([DateTime]::Now.ToShortTimeString()) - Waiting for " + ` - "search service instance to start on $searchServer " + ` - "(waited $loopCount of 15 minutes)") + "search service instance to start on $searchServer " + ` + "(waited $loopCount of 15 minutes)") $loopCount++ Start-Sleep -Seconds 60 } @@ -306,7 +307,7 @@ function Set-TargetResource foreach ($IndexPartitionServer in $params.IndexPartition) { $networkPath = "\\$IndexPartitionServer\" + ` - $params.FirstPartitionDirectory.Replace(":\", "$\") + $params.FirstPartitionDirectory.Replace(":\", "$\") New-Item $networkPath -ItemType Directory -Force } @@ -317,7 +318,7 @@ function Set-TargetResource } # Get all service service instances to assign topology components to - $AllSearchServiceInstances = @{} + $AllSearchServiceInstances = @{ } foreach ($server in $AllSearchServers) { if ($server -like '*.*') @@ -328,7 +329,7 @@ function Set-TargetResource $serverName = $server $serviceToAdd = Get-SPEnterpriseSearchServiceInstance -Identity $server ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $serviceToAdd) { $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain @@ -351,8 +352,8 @@ function Set-TargetResource } $currentTopology = $ssa.ActiveTopology $newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa ` - -Clone ` - -SearchTopology $currentTopology + -Clone ` + -SearchTopology $currentTopology $componentTypes = @{ Admin = "AdminComponent" @@ -365,11 +366,11 @@ function Set-TargetResource # Build up the topology changes for each object type @("Admin", - "Crawler", - "ContentProcessing", - "AnalyticsProcessing", - "QueryProcessing", - "IndexPartition") | ForEach-Object -Process { + "Crawler", + "ContentProcessing", + "AnalyticsProcessing", + "QueryProcessing", + "IndexPartition") | ForEach-Object -Process { $CurrentSearchProperty = $_ Write-Verbose "Setting components for '$CurrentSearchProperty' property" @@ -391,27 +392,33 @@ function Set-TargetResource foreach ($ComponentToAdd in $ComponentsToAdd) { $NewComponentParams = @{ - SearchTopology = $newTopology + SearchTopology = $newTopology SearchServiceInstance = $AllSearchServiceInstances.$ComponentToAdd } - switch($componentTypes.$CurrentSearchProperty) + switch ($componentTypes.$CurrentSearchProperty) { - "AdminComponent" { + "AdminComponent" + { New-SPEnterpriseSearchAdminComponent @NewComponentParams } - "CrawlComponent" { + "CrawlComponent" + { New-SPEnterpriseSearchCrawlComponent @NewComponentParams } - "ContentProcessingComponent" { + "ContentProcessingComponent" + { New-SPEnterpriseSearchContentProcessingComponent @NewComponentParams } - "AnalyticsProcessingComponent" { + "AnalyticsProcessingComponent" + { New-SPEnterpriseSearchAnalyticsProcessingComponent @NewComponentParams } - "QueryProcessingComponent" { + "QueryProcessingComponent" + { New-SPEnterpriseSearchQueryProcessingComponent @NewComponentParams } - "IndexComponent" { + "IndexComponent" + { $NewComponentParams.Add("IndexPartition", 0) if ($params.ContainsKey("FirstPartitionDirectory") -eq $true) { @@ -430,41 +437,41 @@ function Set-TargetResource if ($componentTypes.$CurrentSearchProperty -eq "IndexComponent") { $component = Get-SPEnterpriseSearchComponent -SearchTopology $newTopology | ` - Where-Object -FilterScript { - ($_.GetType().Name -eq $componentTypes.$CurrentSearchProperty) ` - -and ($_.ServerName -eq $ComponentToRemove) ` - -and ($_.IndexPartitionOrdinal -eq 0) - } + Where-Object -FilterScript { + ($_.GetType().Name -eq $componentTypes.$CurrentSearchProperty) ` + -and ($_.ServerName -eq $ComponentToRemove) ` + -and ($_.IndexPartitionOrdinal -eq 0) + } } else { $component = Get-SPEnterpriseSearchComponent -SearchTopology $newTopology | ` - Where-Object -FilterScript { - ($_.GetType().Name -eq $componentTypes.$CurrentSearchProperty) ` - -and ($_.ServerName -eq $ComponentToRemove) - } + Where-Object -FilterScript { + ($_.GetType().Name -eq $componentTypes.$CurrentSearchProperty) ` + -and ($_.ServerName -eq $ComponentToRemove) + } } if ($null -ne $component) { $component | Remove-SPEnterpriseSearchComponent -SearchTopology $newTopology ` - -confirm:$false + -confirm:$false } } } # Look for components that have no server name and remove them $idsWithNoName = (Get-SPEnterpriseSearchComponent -SearchTopology $newTopology | ` - Where-Object -FilterScript { - $null -eq $_.ServerName - }).ComponentId + Where-Object -FilterScript { + $null -eq $_.ServerName + }).ComponentId $idsWithNoName | ForEach-Object -Process { $id = $_ Get-SPEnterpriseSearchComponent -SearchTopology $newTopology | ` Where-Object -FilterScript { - $_.ComponentId -eq $id - } | ` + $_.ComponentId -eq $id + } | ` Remove-SPEnterpriseSearchComponent -SearchTopology $newTopology ` - -confirm:$false + -confirm:$false } # Apply the new topology to the farm @@ -523,15 +530,15 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @( - "Admin", - "Crawler", - "ContentProcessing", - "AnalyticsProcessing", - "QueryProcessing", - "IndexPartition" - ) + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @( + "Admin", + "Crawler", + "ContentProcessing", + "AnalyticsProcessing", + "QueryProcessing", + "IndexPartition" + ) } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.psm1 index 27f5cdec8..6b7ec06d0 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.psm1 @@ -50,7 +50,7 @@ function Get-TargetResource $DatabaseAuthenticationType, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -66,8 +66,8 @@ function Get-TargetResource Write-Verbose -Message "Getting secure store service application '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $nullReturn = @{ @@ -105,7 +105,7 @@ function Get-TargetResource } $propertyFlags = [System.Reflection.BindingFlags]::Instance ` - -bor [System.Reflection.BindingFlags]::NonPublic + -bor [System.Reflection.BindingFlags]::NonPublic $propData = $serviceApp.GetType().GetProperties($propertyFlags) @@ -188,7 +188,7 @@ function Set-TargetResource $DatabaseAuthenticationType, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -207,12 +207,12 @@ function Set-TargetResource $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))) + ($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") + "DatabaseAuthenticationType to identify the type of credentials being passed") return } @@ -220,8 +220,8 @@ function Set-TargetResource { Write-Verbose -Message "Creating Secure Store Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $params ` - -ScriptBlock { + -Arguments $params ` + -ScriptBlock { $params = $args[0] if ($params.ContainsKey("Ensure")) @@ -258,27 +258,27 @@ function Set-TargetResource if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") { if ($PSBoundParameters.ContainsKey("DatabaseServer") -and ` - ($result.DatabaseServer -ne $DatabaseServer)) + ($result.DatabaseServer -ne $DatabaseServer)) { throw ("Specified database server does not match the actual " + ` - "database server. This resource cannot move the database " + ` - "to a different SQL instance.") + "database server. This resource cannot move the database " + ` + "to a different SQL instance.") } if ($PSBoundParameters.ContainsKey("DatabaseName") -and ` - ($result.DatabaseName -ne $DatabaseName)) + ($result.DatabaseName -ne $DatabaseName)) { throw ("Specified database name does not match the actual " + ` - "database name. This resource cannot rename the database.") + "database name. This resource cannot rename the database.") } if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false ` - -and $ApplicationPool -ne $result.ApplicationPool) + -and $ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating Secure Store Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { @@ -295,11 +295,11 @@ function Set-TargetResource # The service app should not exit Write-Verbose -Message "Removing Secure Store Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] - $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { + $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { $_.GetType().FullName -eq "Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplication" } @@ -370,7 +370,7 @@ function Test-TargetResource $DatabaseAuthenticationType, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -397,8 +397,8 @@ function Test-TargetResource ($CurrentValues.DatabaseServer -ne $DatabaseServer)) { Write-Verbose -Message ("Specified database server does not match the actual " + ` - "database server. This resource cannot move the database " + ` - "to a different SQL instance.") + "database server. This resource cannot move the database " + ` + "to a different SQL instance.") return $false } @@ -407,13 +407,13 @@ function Test-TargetResource ($CurrentValues.DatabaseName -ne $DatabaseName)) { Write-Verbose -Message ("Specified database name does not match the actual " + ` - "database name. This resource cannot rename the database.") + "database name. This resource cannot rename the database.") return $false } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ApplicationPool", "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("ApplicationPool", "Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSecurityTokenServiceConfig/MSFT_SPSecurityTokenServiceConfig.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSecurityTokenServiceConfig/MSFT_SPSecurityTokenServiceConfig.psm1 index 7895aaf69..47edee8aa 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSecurityTokenServiceConfig/MSFT_SPSecurityTokenServiceConfig.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSecurityTokenServiceConfig/MSFT_SPSecurityTokenServiceConfig.psm1 @@ -34,7 +34,7 @@ function Get-TargetResource $InstallAccount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present" ) @@ -42,8 +42,8 @@ function Get-TargetResource Write-Verbose -Message "Getting Security Token Service Configuration" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $config = Get-SPSecurityTokenServiceConfig @@ -111,7 +111,7 @@ function Set-TargetResource $InstallAccount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present" ) @@ -125,8 +125,8 @@ function Set-TargetResource } Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $config = Get-SPSecurityTokenServiceConfig $config.Name = $params.Name @@ -191,7 +191,7 @@ function Test-TargetResource $InstallAccount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present" ) @@ -206,12 +206,12 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure", - "NameIdentifier", - "UseSessionCookies", - "AllowOAuthOverHttp", - "AllowMetadataOverHttp") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure", + "NameIdentifier", + "UseSessionCookies", + "AllowOAuthOverHttp", + "AllowMetadataOverHttp") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSelfServiceSiteCreation/MSFT_SPSelfServiceSiteCreation.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSelfServiceSiteCreation/MSFT_SPSelfServiceSiteCreation.psm1 index d4d2880d1..f12b90781 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSelfServiceSiteCreation/MSFT_SPSelfServiceSiteCreation.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSelfServiceSiteCreation/MSFT_SPSelfServiceSiteCreation.psm1 @@ -33,7 +33,7 @@ function Get-TargetResource $ParentSiteUrl, [Parameter()] - [ValidateSet("MustHavePolicy","CanHavePolicy","NotHavePolicy")] + [ValidateSet("MustHavePolicy", "CanHavePolicy", "NotHavePolicy")] [System.String] $PolicyOption, @@ -54,7 +54,7 @@ function Get-TargetResource $AlternateUrl, [Parameter()] - [ValidateSet("Modern","Classic","Latest")] + [ValidateSet("Modern", "Classic", "Latest")] [System.String] $UserExperienceVersion, @@ -86,15 +86,15 @@ function Get-TargetResource else { if ($PSBoundParameters.ContainsKey("AlternateUrl") -eq $true -and - $PSBoundParameters.ContainsKey("ManagedPath") -eq $true) + $PSBoundParameters.ContainsKey("ManagedPath") -eq $true) { throw "You cannot specify both AlternateUrl and ManagedPath. Please use just one of these." } } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $webApplication = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue @@ -134,9 +134,15 @@ function Get-TargetResource { switch ($webApplication.SiteCreationUserExperienceVersion) { - "Version1" { $userExperienceVersion = "Classic" } - "Version2" { $userExperienceVersion = "Modern" } - "Latest" { $userExperienceVersion = "Latest" } + "Version1" + { $userExperienceVersion = "Classic" + } + "Version2" + { $userExperienceVersion = "Modern" + } + "Latest" + { $userExperienceVersion = "Latest" + } } } @@ -193,7 +199,7 @@ function Set-TargetResource $ParentSiteUrl, [Parameter()] - [ValidateSet("MustHavePolicy","CanHavePolicy","NotHavePolicy")] + [ValidateSet("MustHavePolicy", "CanHavePolicy", "NotHavePolicy")] [System.String] $PolicyOption, @@ -214,7 +220,7 @@ function Set-TargetResource $AlternateUrl, [Parameter()] - [ValidateSet("Modern","Classic","Latest")] + [ValidateSet("Modern", "Classic", "Latest")] [System.String] $UserExperienceVersion, @@ -246,7 +252,7 @@ function Set-TargetResource else { if ($PSBoundParameters.ContainsKey("AlternateUrl") -eq $true -and ` - $PSBoundParameters.ContainsKey("ManagedPath") -eq $true) + $PSBoundParameters.ContainsKey("ManagedPath") -eq $true) { throw "You cannot specify both AlternateUrl and ManagedPath. Please use just one of these." } @@ -258,12 +264,12 @@ function Set-TargetResource } Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] if ($params.ContainsKey("AlternateUrl") -and ` - $params.AlternateUrl.TrimEnd("/") -in (Get-SPWebApplication).Url.TrimEnd("/")) + $params.AlternateUrl.TrimEnd("/") -in (Get-SPWebApplication).Url.TrimEnd("/")) { throw ("Specified AlternateUrl is unknown as web application URL. " + ` "Please specify an existing URL") @@ -375,9 +381,15 @@ function Set-TargetResource { switch ($params.UserExperienceVersion) { - "Modern" { $newValue = [Microsoft.SharePoint.Administration.SiteCreationUserExperienceVersion]::Version2 } - "Classic" { $newValue = [Microsoft.SharePoint.Administration.SiteCreationUserExperienceVersion]::Version1 } - "Latest" { $newValue = [Microsoft.SharePoint.Administration.SiteCreationUserExperienceVersion]::Latest } + "Modern" + { $newValue = [Microsoft.SharePoint.Administration.SiteCreationUserExperienceVersion]::Version2 + } + "Classic" + { $newValue = [Microsoft.SharePoint.Administration.SiteCreationUserExperienceVersion]::Version1 + } + "Latest" + { $newValue = [Microsoft.SharePoint.Administration.SiteCreationUserExperienceVersion]::Latest + } } if ($newValue -ne $webApplication.SiteCreationUserExperienceVersion) @@ -448,7 +460,7 @@ function Test-TargetResource $ParentSiteUrl, [Parameter()] - [ValidateSet("MustHavePolicy","CanHavePolicy","NotHavePolicy")] + [ValidateSet("MustHavePolicy", "CanHavePolicy", "NotHavePolicy")] [System.String] $PolicyOption, @@ -469,7 +481,7 @@ function Test-TargetResource $AlternateUrl, [Parameter()] - [ValidateSet("Modern","Classic","Latest")] + [ValidateSet("Modern", "Classic", "Latest")] [System.String] $UserExperienceVersion, @@ -503,26 +515,26 @@ function Test-TargetResource if ($Enabled) { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("WebAppUrl", ` - "Enabled", ` - "OnlineEnabled", ` - "ShowStartASiteMenuItem", ` - "CreateIndividualSite", ` - "ParentSiteUrl", ` - "CustomFormUrl", ` - "ManagedPath", ` - "AlternateUrl", ` - "UserExperienceVersion", ` - "PolicyOption", ` - "RequireSecondaryContact") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("WebAppUrl", ` + "Enabled", ` + "OnlineEnabled", ` + "ShowStartASiteMenuItem", ` + "CreateIndividualSite", ` + "ParentSiteUrl", ` + "CustomFormUrl", ` + "ManagedPath", ` + "AlternateUrl", ` + "UserExperienceVersion", ` + "PolicyOption", ` + "RequireSecondaryContact") } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("WebAppUrl", ` - "Enabled", ` - "ShowStartASiteMenuItem") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("WebAppUrl", ` + "Enabled", ` + "ShowStartASiteMenuItem") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.psm1 index 53dd79e07..727bf98c8 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.psm1 @@ -13,7 +13,7 @@ function Get-TargetResource $ServiceAccount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -25,12 +25,12 @@ function Get-TargetResource Write-Verbose -Message "Getting service application pool '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $sap = Get-SPServiceApplicationPool -Identity $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $sap) { return @{ @@ -64,7 +64,7 @@ function Set-TargetResource $ServiceAccount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -81,21 +81,21 @@ function Set-TargetResource { Write-Verbose -Message "Creating Service Application Pool $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] New-SPServiceApplicationPool -Name $params.Name ` - -Account $params.ServiceAccount + -Account $params.ServiceAccount $sap = Get-SPServiceApplicationPool -Identity $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -ne $sap) { if ($sap.ProcessAccountName -ne $params.ServiceAccount) { Set-SPServiceApplicationPool -Identity $params.Name ` - -Account $params.ServiceAccount + -Account $params.ServiceAccount } } } @@ -104,16 +104,16 @@ function Set-TargetResource { Write-Verbose -Message "Updating Service Application Pool $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $sap = Get-SPServiceApplicationPool -Identity $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($sap.ProcessAccountName -ne $params.ServiceAccount) { Set-SPServiceApplicationPool -Identity $params.Name ` - -Account $params.ServiceAccount + -Account $params.ServiceAccount } } } @@ -121,8 +121,8 @@ function Set-TargetResource { Write-Verbose -Message "Removing Service Application Pool $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] Remove-SPServiceApplicationPool -Identity $params.Name -Confirm:$false } @@ -144,7 +144,7 @@ function Test-TargetResource $ServiceAccount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -165,14 +165,14 @@ function Test-TargetResource if ($Ensure -eq "Present") { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ServiceAccount", "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("ServiceAccount", "Ensure") } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.psm1 index efbb116c0..011c36992 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.psm1 @@ -10,7 +10,7 @@ function Get-TargetResource [Parameter()] [System.String] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] $Ensure = "Present", [Parameter()] @@ -41,60 +41,60 @@ function Get-TargetResource } if (($Ensure -eq "Present") -and ` - $ServiceAppProxies -and ` + $ServiceAppProxies -and ` (($ServiceAppProxiesToInclude) -or ($ServiceAppProxiesToExclude))) { Write-Verbose -Message ("Cannot use the ServiceAppProxies parameter together " + ` - "with the ServiceAppProxiesToInclude or " + ` - "ServiceAppProxiesToExclude parameters") + "with the ServiceAppProxiesToInclude or " + ` + "ServiceAppProxiesToExclude parameters") return $nullReturn } if (($Ensure -eq "Present") -and ` - !$ServiceAppProxies -and ` - !$ServiceAppProxiesToInclude -and ` - !$ServiceAppProxiesToExclude) + !$ServiceAppProxies -and ` + !$ServiceAppProxiesToInclude -and ` + !$ServiceAppProxiesToExclude) { Write-Verbose -Message ("At least one of the following parameters must be specified: " + ` - "ServiceAppProxies, ServiceAppProxiesToInclude, " + ` - "ServiceAppProxiesToExclude") + "ServiceAppProxies, ServiceAppProxiesToInclude, " + ` + "ServiceAppProxiesToExclude") return $nullReturn } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] + -Arguments $PSBoundParameters ` + -ScriptBlock { + $params = $args[0] - #Try to get the proxy group - if ($params.Name -eq "Default") - { - $ProxyGroup = Get-SPServiceApplicationProxyGroup -Default - } - else - { - $ProxyGroup = Get-SPServiceApplicationProxyGroup $params.Name -ErrorAction SilentlyContinue - } + #Try to get the proxy group + if ($params.Name -eq "Default") + { + $ProxyGroup = Get-SPServiceApplicationProxyGroup -Default + } + else + { + $ProxyGroup = Get-SPServiceApplicationProxyGroup $params.Name -ErrorAction SilentlyContinue + } - if ($ProxyGroup) - { - $Ensure = "Present" - } - else - { - $Ensure = "Absent" - } + if ($ProxyGroup) + { + $Ensure = "Present" + } + else + { + $Ensure = "Absent" + } - $ServiceAppProxies = $ProxyGroup.Proxies.DisplayName + $ServiceAppProxies = $ProxyGroup.Proxies.DisplayName - return @{ - Name = $params.name - Ensure = $Ensure - ServiceAppProxies = $ServiceAppProxies - ServiceAppProxiesToInclude = $params.ServiceAppProxiesToInclude - ServiceAppProxiesToExclude = $params.ServiceAppProxiesToExclude - InstallAccount = $params.InstallAccount - } + return @{ + Name = $params.name + Ensure = $Ensure + ServiceAppProxies = $ServiceAppProxies + ServiceAppProxiesToInclude = $params.ServiceAppProxiesToInclude + ServiceAppProxiesToExclude = $params.ServiceAppProxiesToExclude + InstallAccount = $params.InstallAccount + } } return $result @@ -111,7 +111,7 @@ function Set-TargetResource [Parameter()] [System.String] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] $Ensure = "Present", [Parameter()] @@ -134,27 +134,27 @@ function Set-TargetResource Write-Verbose -Message "Setting Service Application Proxy Group $Name" if (($Ensure -eq "Present") -and ` - $ServiceAppProxies -and ` + $ServiceAppProxies -and ` (($ServiceAppProxiesToInclude) -or ($ServiceAppProxiesToExclude))) { throw ("Cannot use the ServiceAppProxies parameter together " + ` - "with the ServiceAppProxiesToInclude or " + ` - "ServiceAppProxiesToExclude parameters") + "with the ServiceAppProxiesToInclude or " + ` + "ServiceAppProxiesToExclude parameters") } if (($Ensure -eq "Present") -and ` - !$ServiceAppProxies -and ` - !$ServiceAppProxiesToInclude -and ` - !$ServiceAppProxiesToExclude) + !$ServiceAppProxies -and ` + !$ServiceAppProxiesToInclude -and ` + !$ServiceAppProxiesToExclude) { throw ("At least one of the following parameters must be specified: " + ` - "ServiceAppProxies, ServiceAppProxiesToInclude, " + ` - "ServiceAppProxiesToExclude") + "ServiceAppProxies, ServiceAppProxiesToInclude, " + ` + "ServiceAppProxiesToExclude") } Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] if ($params.Ensure -eq "Present") @@ -166,7 +166,7 @@ function Set-TargetResource else { $ProxyGroup = Get-SPServiceApplicationProxyGroup -Identity $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue } if (!($ProxyGroup)) @@ -180,12 +180,12 @@ function Set-TargetResource if ($ProxyGroup.Proxies.DisplayName) { $differences = Compare-Object -ReferenceObject $ProxyGroup.Proxies.DisplayName ` - -DifferenceObject $params.ServiceAppProxies + -DifferenceObject $params.ServiceAppProxies if ($null -eq $Differences) { Write-Verbose -Message ("Service Proxy Group $($params.name) " + ` - "membership matches desired state") + "membership matches desired state") } else { @@ -196,8 +196,8 @@ function Set-TargetResource $ServiceProxyName = $difference.InputObject $ServiceProxy = Get-SPServiceApplicationProxy | ` Where-Object -FilterScript { - $_.DisplayName -eq $ServiceProxyName - } + $_.DisplayName -eq $ServiceProxyName + } if (!$ServiceProxy) { @@ -213,8 +213,8 @@ function Set-TargetResource $ServiceProxyName = $difference.InputObject $ServiceProxy = Get-SPServiceApplicationProxy | ` Where-Object -FilterScript { - $_.DisplayName -eq $ServiceProxyName - } + $_.DisplayName -eq $ServiceProxyName + } if (!$ServiceProxy) { @@ -251,7 +251,7 @@ function Set-TargetResource if ($ProxyGroup.Proxies.DisplayName) { $differences = Compare-Object -ReferenceObject $ProxyGroup.Proxies.DisplayName ` - -DifferenceObject $params.ServiceAppProxiesToInclude + -DifferenceObject $params.ServiceAppProxiesToInclude if ($null -eq $Differences) { @@ -266,8 +266,8 @@ function Set-TargetResource $ServiceProxyName = $difference.InputObject $ServiceProxy = Get-SPServiceApplicationProxy | ` Where-Object -FilterScript { - $_.DisplayName -eq $ServiceProxyName - } + $_.DisplayName -eq $ServiceProxyName + } if (!$ServiceProxy) { @@ -287,8 +287,8 @@ function Set-TargetResource { $ServiceProxy = Get-SPServiceApplicationProxy | ` Where-Object -FilterScript { - $_.DisplayName -eq $ServiceProxyName - } + $_.DisplayName -eq $ServiceProxyName + } if (!$ServiceProxy) { @@ -306,8 +306,8 @@ function Set-TargetResource if ($ProxyGroup.Proxies.Displayname) { $differences = Compare-Object -ReferenceObject $ProxyGroup.Proxies.DisplayName ` - -DifferenceObject $params.ServiceAppProxiesToExclude ` - -IncludeEqual + -DifferenceObject $params.ServiceAppProxiesToExclude ` + -IncludeEqual if ($null -eq $Differences) { @@ -357,7 +357,7 @@ function Test-TargetResource [Parameter()] [System.String] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] $Ensure = "Present", [Parameter()] @@ -399,7 +399,7 @@ function Test-TargetResource } $differences = Compare-Object -ReferenceObject $CurrentValues.ServiceAppProxies ` - -DifferenceObject $ServiceAppProxies + -DifferenceObject $ServiceAppProxies if ($null -eq $differences) { @@ -422,7 +422,7 @@ function Test-TargetResource } $differences = Compare-Object -ReferenceObject $CurrentValues.ServiceAppProxies ` - -DifferenceObject $ServiceAppProxiesToInclude + -DifferenceObject $ServiceAppProxiesToInclude if ($null -eq $differences) { @@ -445,12 +445,12 @@ function Test-TargetResource } $differences = Compare-Object -ReferenceObject $CurrentValues.ServiceAppProxies ` - -DifferenceObject $ServiceAppProxiesToExclude ` - -IncludeEqual + -DifferenceObject $ServiceAppProxiesToExclude ` + -IncludeEqual if ($null -eq $differences) { - return $false + return $false } elseif ($differences.sideindicator -contains "==") { diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.psm1 index 65e4be545..59b11792d 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.psm1 @@ -1,7 +1,7 @@ function Get-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Collections.Hashtable])] param ( @@ -10,7 +10,7 @@ function Get-TargetResource $ServiceAppName, [Parameter(Mandatory = $true)] - [ValidateSet("Administrators","SharingPermissions")] + [ValidateSet("Administrators", "SharingPermissions")] [System.String] $SecurityType, @@ -36,24 +36,24 @@ function Get-TargetResource if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) { throw ("Cannot use the Members parameter together with the MembersToInclude or " + ` - "MembersToExclude parameters") + "MembersToExclude parameters") } if ($null -eq $Members -and $null -eq $MembersToInclude -and $null -eq $MembersToExclude) { throw ("At least one of the following parameters must be specified: Members, " + ` - "MembersToInclude, MembersToExclude") + "MembersToInclude, MembersToExclude") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] Write-Verbose -Message "Getting Service Application $($params.ServiceAppName)" $serviceApp = Get-SPServiceApplication -Name $params.ServiceAppName - $nullReturn = @{ + $nullReturn = @{ ServiceAppName = "" SecurityType = $params.SecurityType InstallAccount = $params.InstallAccount @@ -95,8 +95,8 @@ function Get-TargetResource if ($availablePerms -notcontains $accessLevel) { Write-Verbose -Message ("Unknown AccessLevel is used ($accessLevel). " + ` - "Allowed values are '" + ` - ($availablePerms -join "', '") + "'") + "Allowed values are '" + ` + ($availablePerms -join "', '") + "'") return $nullReturn } } @@ -113,8 +113,8 @@ function Get-TargetResource if ($availablePerms -notcontains $accessLevel) { Write-Verbose -Message ("Unknown AccessLevel is used ($accessLevel). " + ` - "Allowed values are '" + ` - ($availablePerms -join "', '") + "'") + "Allowed values are '" + ` + ($availablePerms -join "', '") + "'") return $nullReturn } } @@ -131,8 +131,8 @@ function Get-TargetResource if ($availablePerms -notcontains $accessLevel) { Write-Verbose -Message ("Unknown AccessLevel is used ($accessLevel). " + ` - "Allowed values are '" + ` - ($availablePerms -join "', '") + "'") + "Allowed values are '" + ` + ($availablePerms -join "', '") + "'") return $nullReturn } } @@ -141,10 +141,12 @@ function Get-TargetResource switch ($params.SecurityType) { - "Administrators" { + "Administrators" + { $security = $serviceApp | Get-SPServiceApplicationSecurity -Admin - } - "SharingPermissions" { + } + "SharingPermissions" + { $security = $serviceApp | Get-SPServiceApplicationSecurity } } @@ -200,7 +202,7 @@ function Get-TargetResource function Set-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] param ( [Parameter(Mandatory = $true)] @@ -208,7 +210,7 @@ function Set-TargetResource $ServiceAppName, [Parameter(Mandatory = $true)] - [ValidateSet("Administrators","SharingPermissions")] + [ValidateSet("Administrators", "SharingPermissions")] [System.String] $SecurityType, @@ -234,20 +236,20 @@ function Set-TargetResource if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) { throw ("Cannot use the Members parameter together with the MembersToInclude or " + ` - "MembersToExclude parameters") + "MembersToExclude parameters") } if ($null -eq $Members -and $null -eq $MembersToInclude -and $null -eq $MembersToExclude) { throw ("At least one of the following parameters must be specified: Members, " + ` - "MembersToInclude, MembersToExclude") + "MembersToInclude, MembersToExclude") } $CurrentValues = Get-TargetResource @PSBoundParameters Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $CurrentValues) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $CurrentValues) ` + -ScriptBlock { $params = $args[0] $CurrentValues = $args[1] @@ -288,7 +290,7 @@ function Set-TargetResource if ($availablePerms -notcontains $accessLevel) { throw ("Unknown AccessLevel is used ($accessLevel). Allowed values are " + ` - "'" + ($availablePerms -join "', '") + "'") + "'" + ($availablePerms -join "', '") + "'") } } } @@ -304,7 +306,7 @@ function Set-TargetResource if ($availablePerms -notcontains $accessLevel) { throw ("Unknown AccessLevel is used ($accessLevel). Allowed values are " + ` - "'" + ($availablePerms -join "', '") + "'") + "'" + ($availablePerms -join "', '") + "'") } } } @@ -312,10 +314,12 @@ function Set-TargetResource switch ($params.SecurityType) { - "Administrators" { + "Administrators" + { $security = $serviceApp | Get-SPServiceApplicationSecurity -Admin - } - "SharingPermissions" { + } + "SharingPermissions" + { $security = $serviceApp | Get-SPServiceApplicationSecurity } } @@ -329,7 +333,7 @@ function Set-TargetResource if ($desiredMember.Username -eq "{LocalFarm}") { $claim = New-SPClaimsPrincipal -Identity $localFarmEncodedClaim ` - -IdentityType EncodedClaim + -IdentityType EncodedClaim } else { @@ -337,25 +341,25 @@ function Set-TargetResource if ($isUser -eq $true) { $claim = New-SPClaimsPrincipal -Identity $desiredMember.Username ` - -IdentityType WindowsSamAccountName + -IdentityType WindowsSamAccountName } else { $claim = New-SPClaimsPrincipal -Identity $desiredMember.Username ` - -IdentityType WindowsSecurityGroupName + -IdentityType WindowsSecurityGroupName } } if ($CurrentValues.Members.Username -contains $desiredMember.Username) { if ($null -ne (Compare-Object -ReferenceObject ($CurrentValues.Members | Where-Object -FilterScript { - $_.Username -eq $desiredMember.Username - } | Select-Object -First 1).AccessLevels -DifferenceObject $desiredMember.AccessLevels)) + $_.Username -eq $desiredMember.Username + } | Select-Object -First 1).AccessLevels -DifferenceObject $desiredMember.AccessLevels)) { Grant-SPObjectSecurity -Identity $security ` - -Principal $claim ` - -Rights $desiredMember.AccessLevels ` - -Replace + -Principal $claim ` + -Rights $desiredMember.AccessLevels ` + -Replace } } else @@ -371,7 +375,7 @@ function Set-TargetResource if ($currentMember.UserName -eq "{LocalFarm}") { $claim = New-SPClaimsPrincipal -Identity $localFarmEncodedClaim ` - -IdentityType EncodedClaim + -IdentityType EncodedClaim } else { @@ -379,12 +383,12 @@ function Set-TargetResource if ($isUser -eq $true) { $claim = New-SPClaimsPrincipal -Identity $currentMember.Username ` - -IdentityType WindowsSamAccountName + -IdentityType WindowsSamAccountName } else { $claim = New-SPClaimsPrincipal -Identity $currentMember.Username ` - -IdentityType WindowsSecurityGroupName + -IdentityType WindowsSecurityGroupName } } Revoke-SPObjectSecurity -Identity $security -Principal $claim @@ -399,7 +403,7 @@ function Set-TargetResource if ($desiredMember.Username -eq "{LocalFarm}") { $claim = New-SPClaimsPrincipal -Identity $localFarmEncodedClaim ` - -IdentityType EncodedClaim + -IdentityType EncodedClaim } else { @@ -407,32 +411,32 @@ function Set-TargetResource if ($isUser -eq $true) { $claim = New-SPClaimsPrincipal -Identity $desiredMember.Username ` - -IdentityType WindowsSamAccountName + -IdentityType WindowsSamAccountName } else { $claim = New-SPClaimsPrincipal -Identity $desiredMember.Username ` - -IdentityType WindowsSecurityGroupName + -IdentityType WindowsSecurityGroupName } } if ($CurrentValues.Members.Username -contains $desiredMember.Username) { if ($null -ne (Compare-Object -ReferenceObject ($CurrentValues.Members | Where-Object -FilterScript { - $_.Username -eq $desiredMember.Username - } | Select-Object -First 1).AccessLevels -DifferenceObject $desiredMember.AccessLevels)) + $_.Username -eq $desiredMember.Username + } | Select-Object -First 1).AccessLevels -DifferenceObject $desiredMember.AccessLevels)) { Grant-SPObjectSecurity -Identity $security ` - -Principal $claim ` - -Rights $desiredMember.AccessLevels ` - -Replace + -Principal $claim ` + -Rights $desiredMember.AccessLevels ` + -Replace } } else { Grant-SPObjectSecurity -Identity $security ` - -Principal $claim ` - -Rights $desiredMember.AccessLevels + -Principal $claim ` + -Rights $desiredMember.AccessLevels } } } @@ -446,7 +450,7 @@ function Set-TargetResource if ($excludeMember -eq "{LocalFarm}") { $claim = New-SPClaimsPrincipal -Identity $localFarmEncodedClaim ` - -IdentityType EncodedClaim + -IdentityType EncodedClaim } else { @@ -454,12 +458,12 @@ function Set-TargetResource if ($isUser -eq $true) { $claim = New-SPClaimsPrincipal -Identity $excludeMember ` - -IdentityType WindowsSamAccountName + -IdentityType WindowsSamAccountName } else { $claim = New-SPClaimsPrincipal -Identity $excludeMember ` - -IdentityType WindowsSecurityGroupName + -IdentityType WindowsSecurityGroupName } } Revoke-SPObjectSecurity -Identity $security -Principal $claim @@ -469,11 +473,13 @@ function Set-TargetResource switch ($params.SecurityType) { - "Administrators" { + "Administrators" + { $security = $serviceApp | Set-SPServiceApplicationSecurity -ObjectSecurity $security ` - -Admin - } - "SharingPermissions" { + -Admin + } + "SharingPermissions" + { $security = $serviceApp | Set-SPServiceApplicationSecurity -ObjectSecurity $security } } @@ -483,7 +489,7 @@ function Set-TargetResource function Test-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Boolean])] param ( @@ -492,7 +498,7 @@ function Test-TargetResource $ServiceAppName, [Parameter(Mandatory = $true)] - [ValidateSet("Administrators","SharingPermissions")] + [ValidateSet("Administrators", "SharingPermissions")] [System.String] $SecurityType, @@ -526,11 +532,11 @@ function Test-TargetResource } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $CurrentValues, $PSScriptRoot) ` - -ScriptBlock { - $params = $args[0] + -Arguments @($PSBoundParameters, $CurrentValues, $PSScriptRoot) ` + -ScriptBlock { + $params = $args[0] $CurrentValues = $args[1] - $ScriptRoot = $args[2] + $ScriptRoot = $args[2] $relPath = "..\..\Modules\SharePointDsc.ServiceAppSecurity\SPServiceAppSecurity.psm1" Import-Module (Join-Path -Path $ScriptRoot -ChildPath $relPath -Resolve) @@ -538,10 +544,12 @@ function Test-TargetResource $serviceApp = Get-SPServiceApplication -Name $params.ServiceAppName switch ($params.SecurityType) { - "Administrators" { + "Administrators" + { $security = $serviceApp | Get-SPServiceApplicationSecurity -Admin } - "SharingPermissions" { + "SharingPermissions" + { $security = $serviceApp | Get-SPServiceApplicationSecurity } } @@ -570,7 +578,7 @@ function Test-TargetResource } $differences = Compare-Object -ReferenceObject $CurrentValues.Members.Username ` - -DifferenceObject $params.Members.Username + -DifferenceObject $params.Members.Username if ($null -eq $differences) { @@ -578,8 +586,8 @@ function Test-TargetResource foreach ($currentMember in $CurrentValues.Members) { $expandedAccessLevels = Expand-AccessLevel -Security $security -AccessLevels ($params.Members | Where-Object -FilterScript { - $_.Username -eq $currentMember.Username - } | Select-Object -First 1).AccessLevels + $_.Username -eq $currentMember.Username + } | Select-Object -First 1).AccessLevels if ($null -ne (Compare-Object -DifferenceObject $currentMember.AccessLevels -ReferenceObject $expandedAccessLevels)) { Write-Verbose -Message "$($currentMember.Username) has incorrect permission level. Test failed." @@ -612,8 +620,8 @@ function Test-TargetResource $expandedAccessLevels = Expand-AccessLevel -Security $security -AccessLevels $member.AccessLevels if ($null -ne (Compare-Object -DifferenceObject $expandedAccessLevels -ReferenceObject ($CurrentValues.Members | Where-Object -FilterScript { - $_.Username -eq $member.Username - } | Select-Object -First 1).AccessLevels)) + $_.Username -eq $member.Username + } | Select-Object -First 1).AccessLevels)) { Write-Verbose -Message "$($member.Username) has incorrect permission level. Test failed." return $false diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPServiceIdentity/MSFT_SPServiceIdentity.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPServiceIdentity/MSFT_SPServiceIdentity.psm1 index c52d935a9..4375b14e7 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPServiceIdentity/MSFT_SPServiceIdentity.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPServiceIdentity/MSFT_SPServiceIdentity.psm1 @@ -29,8 +29,8 @@ function Get-TargetResource else { $serviceInstance = Get-SPServiceInstance -Server $env:computername | Where-Object { - $_.TypeName -eq $params.Name - } + $_.TypeName -eq $params.Name + } if ($null -eq $serviceInstance.service.processidentity) { @@ -42,10 +42,18 @@ function Get-TargetResource switch ($processIdentity.CurrentIdentityType) { - "LocalSystem" { $ManagedAccount = "LocalSystem" } - "NetworkService" { $ManagedAccount = "NetworkService" } - "LocalService" { $ManagedAccount = "LocalService" } - Default { $ManagedAccount = $processIdentity.Username } + "LocalSystem" + { $ManagedAccount = "LocalSystem" + } + "NetworkService" + { $ManagedAccount = "NetworkService" + } + "LocalService" + { $ManagedAccount = "LocalService" + } + Default + { $ManagedAccount = $processIdentity.Username + } } return @{ @@ -87,8 +95,8 @@ function Set-TargetResource else { $serviceInstance = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { - $_.TypeName -eq $params.Name - } + $_.TypeName -eq $params.Name + } if ($null -eq $serviceInstance) { throw [System.Exception] "Unable to locate service $($params.Name)" @@ -103,15 +111,15 @@ function Set-TargetResource } if ($params.ManagedAccount -eq "LocalSystem" -or ` - $params.ManagedAccount -eq "LocalService" -or ` - $params.ManagedAccount -eq "NetworkService") + $params.ManagedAccount -eq "LocalService" -or ` + $params.ManagedAccount -eq "NetworkService") { $processIdentity.CurrentIdentityType = $params.ManagedAccount } else { $managedAccount = Get-SPManagedAccount -Identity $params.ManagedAccount ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $managedAccount) { throw [System.Exception] "Unable to locate Managed Account $($params.ManagedAccount)" diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.psm1 index aa1da488e..840ceb193 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.psm1 @@ -13,7 +13,7 @@ function Get-TargetResource $InstallAccount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present" ) @@ -32,8 +32,8 @@ function Get-TargetResource $si = Get-SPServiceInstance -Server $env:COMPUTERNAME -All | Where-Object -FilterScript { $_.TypeName -eq $params.Name -or ` - $_.TypeName -eq $newName -or ` - $_.GetType().Name -eq $newName + $_.TypeName -eq $newName -or ` + $_.GetType().Name -eq $newName } if ($null -eq $si) @@ -42,16 +42,16 @@ function Get-TargetResource $fqdn = "$($env:COMPUTERNAME).$domain" $si = Get-SPServiceInstance -Server $fqdn -All | Where-Object -FilterScript { $_.TypeName -eq $params.Name -or ` - $_.TypeName -eq $newName -or ` - $_.GetType().Name -eq $newName + $_.TypeName -eq $newName -or ` + $_.GetType().Name -eq $newName } } if ($null -eq $si) { return @{ - Name = $params.Name - Ensure = "Absent" + Name = $params.Name + Ensure = "Absent" InstallAccount = $params.InstallAccount } } @@ -87,7 +87,7 @@ function Set-TargetResource $InstallAccount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present" ) @@ -97,7 +97,7 @@ function Set-TargetResource $newName = (Get-SPDscServiceTypeName -DisplayName $Name) $invokeArgs = @{ Credential = $InstallAccount - Arguments = @($PSBoundParameters, $newName) + Arguments = @($PSBoundParameters, $newName) } if ($Ensure -eq "Present") @@ -110,8 +110,8 @@ function Set-TargetResource $si = Get-SPServiceInstance -Server $env:COMPUTERNAME -All | Where-Object -FilterScript { $_.TypeName -eq $params.Name -or ` - $_.TypeName -eq $newName -or ` - $_.GetType().Name -eq $newName + $_.TypeName -eq $newName -or ` + $_.GetType().Name -eq $newName } if ($null -eq $si) @@ -120,8 +120,8 @@ function Set-TargetResource $fqdn = "$($env:COMPUTERNAME).$domain" $si = Get-SPServiceInstance -Server $fqdn -All | Where-Object -FilterScript { $_.TypeName -eq $params.Name -or ` - $_.TypeName -eq $newName -or ` - $_.GetType().Name -eq $newName + $_.TypeName -eq $newName -or ` + $_.GetType().Name -eq $newName } } if ($null -eq $si) @@ -141,8 +141,8 @@ function Set-TargetResource $si = Get-SPServiceInstance -Server $env:COMPUTERNAME -All | Where-Object -FilterScript { $_.TypeName -eq $params.Name -or ` - $_.TypeName -eq $newName -or ` - $_.GetType().Name -eq $newName + $_.TypeName -eq $newName -or ` + $_.GetType().Name -eq $newName } if ($null -eq $si) @@ -151,8 +151,8 @@ function Set-TargetResource $fqdn = "$($env:COMPUTERNAME).$domain" $si = Get-SPServiceInstance -Server $fqdn -All | Where-Object -FilterScript { $_.TypeName -eq $params.Name -or ` - $_.TypeName -eq $newName -or ` - $_.GetType().Name -eq $newName + $_.TypeName -eq $newName -or ` + $_.GetType().Name -eq $newName } } if ($null -eq $si) @@ -179,7 +179,7 @@ function Test-TargetResource $InstallAccount, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present" ) @@ -194,8 +194,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name", "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Name", "Ensure") } function Get-SPDscServiceTypeName @@ -209,88 +209,116 @@ function Get-SPDscServiceTypeName ) switch ($DisplayName) { - "Access Database Service 2010" { + "Access Database Service 2010" + { return "AccessServerWebServiceInstance" } - "Access Services" { + "Access Services" + { return "AccessServicesWebServiceInstance" } - "App Management Service" { + "App Management Service" + { return "AppManagementServiceInstance" } - "Business Data Connectivity Service" { + "Business Data Connectivity Service" + { return "BdcServiceInstance" } - "PerformancePoint Service" { + "PerformancePoint Service" + { return "BIMonitoringServiceInstance" } - "Excel Calculation Services" { + "Excel Calculation Services" + { return "ExcelServerWebServiceInstance" } - "Document Conversions Launcher Service" { + "Document Conversions Launcher Service" + { return "LauncherServiceInstance" } - "Document Conversions Load Balancer Service" { + "Document Conversions Load Balancer Service" + { return "LoadBalancerServiceInstance" } - "Managed Metadata Web Service" { + "Managed Metadata Web Service" + { return "MetadataWebServiceInstance" } - "Lotus Notes Connector" { + "Lotus Notes Connector" + { return "NotesWebServiceInstance" } - "PowerPoint Conversion Service" { + "PowerPoint Conversion Service" + { return "PowerPointConversionServiceInstance" } - "User Profile Synchronization Service" { + "User Profile Synchronization Service" + { return "ProfileSynchronizationServiceInstance" } - "Search Query and Site Settings Service" { + "Search Query and Site Settings Service" + { return "SearchQueryAndSiteSettingsServiceInstance" } - "Search Host Controller Service" { + "Search Host Controller Service" + { return "SearchRuntimeServiceInstance" } - "SharePoint Server Search" { + "SharePoint Server Search" + { return "SearchServiceInstance" } - "Secure Store Service" { + "Secure Store Service" + { return "SecureStoreServiceInstance" } - "Microsoft SharePoint Foundation Incoming E-Mail" { + "Microsoft SharePoint Foundation Incoming E-Mail" + { return "SPIncomingEmailServiceInstance" } - "Request Management" { + "Request Management" + { return "SPRequestManagementServiceInstance" } - "Microsoft SharePoint Foundation Subscription Settings Service" { + "Microsoft SharePoint Foundation Subscription Settings Service" + { return "SPSubscriptionSettingsServiceInstance" } - "Microsoft SharePoint Foundation Sandboxed Code Service" { + "Microsoft SharePoint Foundation Sandboxed Code Service" + { return "SPUserCodeServiceInstance" } - "Claims to Windows Token Service" { + "Claims to Windows Token Service" + { return "SPWindowsTokenServiceInstance" } - "Microsoft SharePoint Foundation Workflow Timer Service" { + "Microsoft SharePoint Foundation Workflow Timer Service" + { return "SPWorkflowTimerServiceInstance" } - "Machine Translation Service" { + "Machine Translation Service" + { return "TranslationServiceInstance" } - "User Profile Service" { + "User Profile Service" + { return "UserProfileServiceInstance" } - "Visio Graphics Service" { + "Visio Graphics Service" + { return "VisioGraphicsServiceInstance" } - "Word Automation Services" { + "Word Automation Services" + { return "WordServiceInstance" } - "Work Management Service" { + "Work Management Service" + { return "WorkManagementServiceInstance" } - Default { + Default + { return $DisplayName } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.psm1 index 5b06ec11c..c1c939e4f 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.psm1 @@ -13,7 +13,7 @@ function Get-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -29,8 +29,8 @@ function Get-TargetResource Write-Verbose -Message "Getting SPSessionStateService info" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $svc = Get-SPSessionStateService $Ensure = "Absent" if ($svc.SessionStateEnabled -eq $true) @@ -61,7 +61,7 @@ function Set-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -84,8 +84,8 @@ function Set-TargetResource if ($Ensure -eq "Present") { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $svc = Get-SPSessionStateService @@ -109,8 +109,8 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $svc = Get-SPSessionStateService if ($svc.SessionStateEnabled) { @@ -140,7 +140,7 @@ function Test-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -165,14 +165,14 @@ function Test-TargetResource if ($Ensure -eq "Present") { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure","SessionTimeout") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure", "SessionTimeout") } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.psm1 index 478f49cb9..b95ef6e07 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.psm1 @@ -1,7 +1,7 @@ function Get-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Collections.Hashtable])] param ( @@ -51,7 +51,7 @@ function Get-TargetResource if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) { Write-Verbose -Message ("Cannot use the Members parameter together with the " + ` - "MembersToInclude or MembersToExclude parameters") + "MembersToInclude or MembersToExclude parameters") return $nullreturn } @@ -60,21 +60,21 @@ function Get-TargetResource foreach ($database in $Databases) { if ($database.Members -and (($database.MembersToInclude) ` - -or ($database.MembersToExclude))) + -or ($database.MembersToExclude))) { Write-Verbose -Message ("Databases: Cannot use the Members parameter " + ` - "together with the MembersToInclude or " + ` - "MembersToExclude parameters") + "together with the MembersToInclude or " + ` + "MembersToExclude parameters") return $nullreturn } if (!$database.Members ` - -and !$database.MembersToInclude ` - -and !$database.MembersToExclude) + -and !$database.MembersToInclude ` + -and !$database.MembersToExclude) { Write-Verbose -Message ("Databases: At least one of the following " + ` - "parameters must be specified: Members, " + ` - "MembersToInclude, MembersToExclude") + "parameters must be specified: Members, " + ` + "MembersToInclude, MembersToExclude") return $nullreturn } } @@ -84,7 +84,7 @@ function Get-TargetResource if (!$Members -and !$MembersToInclude -and !$MembersToExclude) { Write-Verbose -Message ("At least one of the following parameters must be " + ` - "specified: Members, MembersToInclude, MembersToExclude") + "specified: Members, MembersToInclude, MembersToExclude") return $nullreturn } } @@ -92,20 +92,20 @@ function Get-TargetResource if ($Databases -and $AllDatabases) { Write-Verbose -Message ("Cannot use the Databases parameter together with the " + ` - "AllDatabases parameter") + "AllDatabases parameter") return $nullreturn } if ($Databases -and $ExcludeDatabases) { Write-Verbose -Message ("Cannot use the Databases parameter together with the " + ` - "ExcludeDatabases parameter") + "ExcludeDatabases parameter") return $nullreturn } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -118,7 +118,7 @@ function Get-TargetResource catch { Write-Verbose -Message ("No local SharePoint farm was detected. Shell admin " + ` - "settings will not be applied") + "settings will not be applied") return $nullreturn } @@ -129,8 +129,8 @@ function Get-TargetResource if ($params.ContainsKey("ExcludeDatabases")) { $databases = $databases | Where-Object -FilterScript { - $_.Name -notin $params.ExcludeDatabases - } + $_.Name -notin $params.ExcludeDatabases + } } foreach ($database in $databases) @@ -162,7 +162,7 @@ function Get-TargetResource function Set-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] param ( [Parameter(Mandatory = $true)] @@ -204,7 +204,7 @@ function Set-TargetResource if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) { throw ("Cannot use the Members parameter together with the " + ` - "MembersToInclude or MembersToExclude parameters") + "MembersToInclude or MembersToExclude parameters") } if ($Databases) @@ -212,20 +212,20 @@ function Set-TargetResource foreach ($database in $Databases) { if ($database.Members -and (($database.MembersToInclude) ` - -or ($database.MembersToExclude))) + -or ($database.MembersToExclude))) { throw ("Databases: Cannot use the Members parameter " + ` - "together with the MembersToInclude or " + ` - "MembersToExclude parameters") + "together with the MembersToInclude or " + ` + "MembersToExclude parameters") } if (!$database.Members ` - -and !$database.MembersToInclude ` - -and !$database.MembersToExclude) + -and !$database.MembersToInclude ` + -and !$database.MembersToExclude) { throw ("Databases: At least one of the following " + ` - "parameters must be specified: Members, " + ` - "MembersToInclude, MembersToExclude") + "parameters must be specified: Members, " + ` + "MembersToInclude, MembersToExclude") } } } @@ -234,25 +234,25 @@ function Set-TargetResource if (!$Members -and !$MembersToInclude -and !$MembersToExclude) { throw ("At least one of the following parameters must be " + ` - "specified: Members, MembersToInclude, MembersToExclude") + "specified: Members, MembersToInclude, MembersToExclude") } } if ($Databases -and $AllDatabases) { throw ("Cannot use the Databases parameter together with the " + ` - "AllDatabases parameter") + "AllDatabases parameter") } if ($Databases -and $ExcludeDatabases) { throw ("Cannot use the Databases parameter together with the " + ` - "ExcludeDatabases parameter") + "ExcludeDatabases parameter") } $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -265,7 +265,7 @@ function Set-TargetResource catch { throw ("No local SharePoint farm was detected. Shell admin " + ` - "settings will not be applied") + "settings will not be applied") } $shellAdmins = Get-SPShellAdmin @@ -276,17 +276,17 @@ function Set-TargetResource if ($shellAdmins) { $differences = Compare-Object -ReferenceObject $shellAdmins.UserName ` - -DifferenceObject $params.Members + -DifferenceObject $params.Members if ($null -eq $differences) { Write-Verbose -Message ("Shell Admins group matches. No further " + ` - "processing required") + "processing required") } else { Write-Verbose -Message ("Shell Admins group does not match. Perform " + ` - "corrective action") + "corrective action") foreach ($difference in $differences) { @@ -300,8 +300,8 @@ function Set-TargetResource catch { throw ("Error while setting the Shell Admin. The Shell " + ` - "Admin permissions will not be applied. Error " + ` - "details: $($_.Exception.Message)") + "Admin permissions will not be applied. Error " + ` + "details: $($_.Exception.Message)") return } } @@ -315,8 +315,8 @@ function Set-TargetResource catch { throw ("Error while removing the Shell Admin. The Shell Admin " + ` - "permissions will not be revoked. Error details: " + ` - "$($_.Exception.Message)") + "permissions will not be revoked. Error details: " + ` + "$($_.Exception.Message)") return } } @@ -334,8 +334,8 @@ function Set-TargetResource catch { throw ("Error while setting the Shell Admin. The Shell Admin " + ` - "permissions will not be applied. Error details: " + ` - "$($_.Exception.Message)") + "permissions will not be applied. Error details: " + ` + "$($_.Exception.Message)") return } } @@ -358,8 +358,8 @@ function Set-TargetResource catch { throw ("Error while setting the Shell Admin. The Shell Admin " + ` - "permissions will not be applied. Error details: " + ` - "$($_.Exception.Message)") + "permissions will not be applied. Error details: " + ` + "$($_.Exception.Message)") return } } @@ -376,7 +376,7 @@ function Set-TargetResource catch { throw ("Error while setting the Shell Admin. The Shell Admin " + ` - "permissions will not be applied. Error details: $($_.Exception.Message)") + "permissions will not be applied. Error details: $($_.Exception.Message)") return } } @@ -399,8 +399,8 @@ function Set-TargetResource catch { throw ("Error while removing the Shell Admin. The Shell Admin " + ` - "permissions will not be revoked. Error details: " + ` - "$($_.Exception.Message)") + "permissions will not be revoked. Error details: " + ` + "$($_.Exception.Message)") return } } @@ -432,7 +432,7 @@ function Set-TargetResource if ($dbShellAdmins) { $differences = Compare-Object -ReferenceObject $database.Members ` - -DifferenceObject $dbShellAdmins.UserName + -DifferenceObject $dbShellAdmins.UserName foreach ($difference in $differences) { if ($difference.SideIndicator -eq "<=") @@ -445,8 +445,8 @@ function Set-TargetResource catch { throw ("Error while setting the Shell Admin. The " + ` - "Shell Admin permissions will not be applied. " + ` - "Error details: $($_.Exception.Message)") + "Shell Admin permissions will not be applied. " + ` + "Error details: $($_.Exception.Message)") return } } @@ -456,14 +456,14 @@ function Set-TargetResource try { Remove-SPShellAdmin -Database $currentCDB.Id ` - -UserName $user ` - -Confirm:$false + -UserName $user ` + -Confirm:$false } catch { throw ("Error while removing the Shell Admin. The " + ` - "Shell Admin permissions will not be revoked. " + ` - "Error details: $($_.Exception.Message)") + "Shell Admin permissions will not be revoked. " + ` + "Error details: $($_.Exception.Message)") return } } @@ -480,8 +480,8 @@ function Set-TargetResource catch { throw ("Error while setting the Shell Admin. The Shell " + ` - "Admin permissions will not be applied. Error " + ` - "details: $($_.Exception.Message)") + "Admin permissions will not be applied. Error " + ` + "details: $($_.Exception.Message)") return } } @@ -504,8 +504,8 @@ function Set-TargetResource catch { throw ("Error while setting the Shell Admin. The " + ` - "Shell Admin permissions will not be applied. " + ` - "Error details: $($_.Exception.Message)") + "Shell Admin permissions will not be applied. " + ` + "Error details: $($_.Exception.Message)") return } } @@ -522,8 +522,8 @@ function Set-TargetResource catch { throw ("Error while setting the Shell Admin. The Shell " + ` - "Admin permissions will not be applied. Error " + ` - "details: $($_.Exception.Message)") + "Admin permissions will not be applied. Error " + ` + "details: $($_.Exception.Message)") return } } @@ -542,14 +542,14 @@ function Set-TargetResource try { Remove-SPShellAdmin -Database $currentCDB.Id ` - -UserName $member ` - -Confirm:$false + -UserName $member ` + -Confirm:$false } catch { throw ("Error while removing the Shell Admin. The " + ` - "Shell Admin permissions will not be revoked. " + ` - "Error details: $($_.Exception.Message)") + "Shell Admin permissions will not be revoked. " + ` + "Error details: $($_.Exception.Message)") return } } @@ -572,8 +572,8 @@ function Set-TargetResource if ($params.ContainsKey("ExcludeDatabases")) { $databases = $databases | Where-Object -FilterScript { - $_.Name -notin $params.ExcludeDatabases - } + $_.Name -notin $params.ExcludeDatabases + } } foreach ($database in $databases) { @@ -584,17 +584,17 @@ function Set-TargetResource if ($dbShellAdmins) { $differences = Compare-Object -ReferenceObject $dbShellAdmins.UserName ` - -DifferenceObject $params.Members + -DifferenceObject $params.Members if ($null -eq $differences) { Write-Verbose -Message ("Shell Admins group matches. No further " + ` - "processing required") + "processing required") } else { Write-Verbose -Message ("Shell Admins group does not match. Perform " + ` - "corrective action") + "corrective action") foreach ($difference in $differences) { @@ -608,8 +608,8 @@ function Set-TargetResource catch { throw ("Error while setting the Shell Admin. The " + ` - "Shell Admin permissions will not be applied. " + ` - "Error details: $($_.Exception.Message)") + "Shell Admin permissions will not be applied. " + ` + "Error details: $($_.Exception.Message)") return } } @@ -619,14 +619,14 @@ function Set-TargetResource try { Remove-SPShellAdmin -Database $database.Id ` - -UserName $user ` - -Confirm:$false + -UserName $user ` + -Confirm:$false } catch { throw ("Error while removing the Shell Admin. The " + ` - "Shell Admin permissions will not be revoked. " + ` - "Error details: $($_.Exception.Message)") + "Shell Admin permissions will not be revoked. " + ` + "Error details: $($_.Exception.Message)") return } } @@ -644,8 +644,8 @@ function Set-TargetResource catch { throw ("Error while setting the Shell Admin. The Shell Admin " + ` - "permissions will not be applied. Error details: " + ` - "$($_.Exception.Message)") + "permissions will not be applied. Error details: " + ` + "$($_.Exception.Message)") return } } @@ -667,8 +667,8 @@ function Set-TargetResource catch { throw ("Error while setting the Shell Admin. The Shell " + ` - "Admin permissions will not be applied. Error " + ` - "details: $($_.Exception.Message)") + "Admin permissions will not be applied. Error " + ` + "details: $($_.Exception.Message)") return } } @@ -685,8 +685,8 @@ function Set-TargetResource catch { throw ("Error while setting the Shell Admin. The Shell Admin " + ` - "permissions will not be applied. Error details: " + ` - "$($_.Exception.Message)") + "permissions will not be applied. Error details: " + ` + "$($_.Exception.Message)") return } } @@ -705,14 +705,14 @@ function Set-TargetResource try { Remove-SPShellAdmin -Database $database.Id ` - -UserName $member ` - -Confirm:$false + -UserName $member ` + -Confirm:$false } catch { throw ("Error while removing the Shell Admin. The Shell " + ` - "Admin permissions will not be revoked. Error " + ` - "details: $($_.Exception.Message)") + "Admin permissions will not be revoked. Error " + ` + "details: $($_.Exception.Message)") return } } @@ -727,7 +727,7 @@ function Set-TargetResource function Test-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Boolean])] param ( @@ -773,8 +773,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" if ($null -eq $CurrentValues.Members -and ` - $null -eq $CurrentValues.MembersToInclude -and ` - $null -eq $CurrentValues.MembersToExclude) + $null -eq $CurrentValues.MembersToInclude -and ` + $null -eq $CurrentValues.MembersToExclude) { return $false } @@ -788,7 +788,7 @@ function Test-TargetResource } $differences = Compare-Object -ReferenceObject $CurrentValues.Members ` - -DifferenceObject $Members + -DifferenceObject $Members if ($null -eq $differences) { @@ -862,7 +862,7 @@ function Test-TargetResource } $differences = Compare-Object -ReferenceObject $database.Members ` - -DifferenceObject $Members + -DifferenceObject $Members if ($null -eq $differences) { @@ -943,7 +943,7 @@ function Test-TargetResource } $differences = Compare-Object -ReferenceObject $currentCDB.Members ` - -DifferenceObject $database.Members + -DifferenceObject $database.Members if ($null -eq $differences) { diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.psm1 index 40999c382..bcaf288de 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.psm1 @@ -73,8 +73,8 @@ function Get-TargetResource Write-Verbose -Message "Getting site collection $Url" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $site = $null @@ -126,7 +126,7 @@ function Get-TargetResource if ($site.WebApplication.UseClaimsAuthentication) { $owner = (New-SPClaimsPrincipal -Identity $site.Owner.UserLogin ` - -IdentityType "EncodedClaim").Value + -IdentityType "EncodedClaim").Value } else { @@ -143,7 +143,7 @@ function Get-TargetResource if ($site.WebApplication.UseClaimsAuthentication) { $secondaryOwner = (New-SPClaimsPrincipal -Identity $site.SecondaryContact.UserLogin ` - -IdentityType "EncodedClaim").Value + -IdentityType "EncodedClaim").Value } else { @@ -153,9 +153,9 @@ function Get-TargetResource $admService = Get-SPDscContentService $quota = ($admService.QuotaTemplates | ` - Where-Object -FilterScript { - $_.QuotaID -eq $site.Quota.QuotaID - }).Name + Where-Object -FilterScript { + $_.QuotaID -eq $site.Quota.QuotaID + }).Name $CreateDefaultGroups = $true if ($null -eq $site.RootWeb.AssociatedVisitorGroup -and @@ -250,7 +250,7 @@ function Set-TargetResource $CreateDefaultGroups = $true, [Parameter()] - [ValidateSet("TenantAdministration","None")] + [ValidateSet("TenantAdministration", "None")] [System.String] $AdministrationSiteType, @@ -269,8 +269,8 @@ function Set-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters,$CurrentValues) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $CurrentValues) ` + -ScriptBlock { $params = $args[0] $CurrentValues = $args[1] $doCreateDefaultGroups = $false @@ -285,7 +285,7 @@ function Set-TargetResource if ($null -eq $site) { Write-Verbose -Message ("Starting New-SPSite with the following parameters: " + ` - "$(Convert-SPDscHashtableToString $params)") + "$(Convert-SPDscHashtableToString $params)") $site = New-SPSite @params if ($CreateDefaultGroups -eq $true) { @@ -295,7 +295,7 @@ function Set-TargetResource else { Write-Verbose -Message ("CreateDefaultGroups set to false. The default " + ` - "SharePoint groups will not be created") + "SharePoint groups will not be created") } } else @@ -340,7 +340,7 @@ function Set-TargetResource { Write-Verbose -Message "Updating existing site collection" Write-Verbose -Message ("Starting Set-SPSite with the following parameters: " + ` - "$(Convert-SPDscHashtableToString $newParams)") + "$(Convert-SPDscHashtableToString $newParams)") Set-SPSite @newParams } @@ -353,7 +353,7 @@ function Set-TargetResource else { Write-Verbose -Message ("CreateDefaultGroups set to false. The default " + ` - "SharePoint groups will not be created") + "SharePoint groups will not be created") } } } @@ -376,8 +376,8 @@ function Set-TargetResource } $systemAccountSite.RootWeb.CreateDefaultAssociatedGroups($systemAccountSite.Owner.UserLogin, - $secondaryOwnerLogin, - $null) + $secondaryOwnerLogin, + $null) } } } @@ -445,7 +445,7 @@ function Test-TargetResource $CreateDefaultGroups = $true, [Parameter()] - [ValidateSet("TenantAdministration","None")] + [ValidateSet("TenantAdministration", "None")] [System.String] $AdministrationSiteType, @@ -470,12 +470,12 @@ function Test-TargetResource } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Url", - "QuotaTemplate", - "OwnerAlias", - "SecondaryOwnerAlias", - "AdministrationSiteType") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Url", + "QuotaTemplate", + "OwnerAlias", + "SecondaryOwnerAlias", + "AdministrationSiteType") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSitePropertyBag/MSFT_SPSitePropertyBag.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSitePropertyBag/MSFT_SPSitePropertyBag.psm1 index 34c779dae..7053a3623 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSitePropertyBag/MSFT_SPSitePropertyBag.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSitePropertyBag/MSFT_SPSitePropertyBag.psm1 @@ -17,7 +17,7 @@ function Get-TargetResource() $Value, [Parameter()] - [ValidateSet('Present','Absent')] + [ValidateSet('Present', 'Absent')] [System.String] $Ensure = 'Present', @@ -29,8 +29,8 @@ function Get-TargetResource() Write-Verbose -Message "Looking for SPSite property '$Key'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $spSite = Get-SPSite -Identity $params.Url -ErrorAction SilentlyContinue @@ -41,7 +41,7 @@ function Get-TargetResource() } if ($null -ne $spSite.RootWeb.Properties -and ` - $spSite.RootWeb.Properties.ContainsKey($params.Key) -eq $true) + $spSite.RootWeb.Properties.ContainsKey($params.Key) -eq $true) { $localEnsure = 'Present' $currentValue = $spSite.RootWeb.Properties[$params.Key] @@ -80,7 +80,7 @@ function Set-TargetResource() $Value, [Parameter()] - [ValidateSet('Present','Absent')] + [ValidateSet('Present', 'Absent')] [System.String] $Ensure = 'Present', @@ -92,8 +92,8 @@ function Set-TargetResource() Write-Verbose -Message "Setting SPSite property '$Key'" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $spSite = Get-SPSite -Identity $params.Url -ErrorAction SilentlyContinue @@ -147,7 +147,7 @@ function Test-TargetResource() $Value, [Parameter()] - [ValidateSet('Present','Absent')] + [ValidateSet('Present', 'Absent')] [System.String] $Ensure = 'Present', @@ -166,14 +166,14 @@ function Test-TargetResource() if ($Ensure -eq 'Present') { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @('Ensure','Key', 'Value') + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @('Ensure', 'Key', 'Value') } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @('Ensure','Key') + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @('Ensure', 'Key') } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSiteUrl/MSFT_SPSiteUrl.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSiteUrl/MSFT_SPSiteUrl.psm1 index 85a0b83ac..b43c71511 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSiteUrl/MSFT_SPSiteUrl.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSiteUrl/MSFT_SPSiteUrl.psm1 @@ -40,8 +40,8 @@ function Get-TargetResource } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $nullreturn = @{ @@ -49,7 +49,7 @@ function Get-TargetResource } $site = Get-SPSite -Identity $params.Url ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $site) { @@ -60,7 +60,7 @@ function Get-TargetResource if ($site.HostHeaderIsSiteName -eq $false) { Write-Verbose -Message ("Specified site $($params.Url) is not a Host Named " + ` - "Site Collection") + "Site Collection") return $nullreturn } @@ -153,12 +153,12 @@ function Set-TargetResource } Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $site = Get-SPSite -Identity $params.Url ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $site) { @@ -224,7 +224,7 @@ function Set-TargetResource else { throw ("Specified URL $($params.Intranet) (Zone: Intranet) is already assigned " + ` - "to a site collection: $($siteurl[0].Url)") + "to a site collection: $($siteurl[0].Url)") } } @@ -238,7 +238,7 @@ function Set-TargetResource else { throw ("Specified URL $($params.Internet) (Zone: Internet) is already assigned " + ` - "to a site collection: $($siteurl[0].Url)") + "to a site collection: $($siteurl[0].Url)") } } @@ -252,7 +252,7 @@ function Set-TargetResource else { throw ("Specified URL $($params.Extranet) (Zone: Extranet) is already assigned " + ` - "to a site collection: $($siteurl[0].Url)") + "to a site collection: $($siteurl[0].Url)") } } @@ -266,7 +266,7 @@ function Set-TargetResource else { throw ("Specified URL $($params.Custom) (Zone: Custom) is already assigned " + ` - "to a site collection: $($siteurl[0].Url)") + "to a site collection: $($siteurl[0].Url)") } } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.psm1 index 85ac1ed9b..5d8940e06 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.psm1 @@ -21,7 +21,7 @@ function Get-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -37,12 +37,12 @@ function Get-TargetResource Write-Verbose -Message "Getting state service application '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApp = Get-SPStateServiceApplication -Identity $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $serviceApp) { @@ -101,7 +101,7 @@ function Set-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -121,12 +121,12 @@ function Set-TargetResource { Write-Verbose -Message "Creating State Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] - $dbParams = @{} + $dbParams = @{ } if ($params.ContainsKey("DatabaseName")) { @@ -153,8 +153,8 @@ function Set-TargetResource $database = New-SPStateServiceDatabase @dbParams $app = New-SPStateServiceApplication -Name $params.Name -Database $database New-SPStateServiceApplicationProxy -Name $pName ` - -ServiceApplication $app ` - -DefaultProxyGroup | Out-Null + -ServiceApplication $app ` + -DefaultProxyGroup | Out-Null } } if ($Ensure -eq "Absent") @@ -163,7 +163,7 @@ function Set-TargetResource Invoke-SPDscCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $serviceApp = Get-SPStateServiceApplication -Name $params.Name + $serviceApp = Get-SPStateServiceApplication -Name $params.Name # Remove the connected proxy(ies) $proxies = Get-SPServiceApplicationProxy @@ -204,7 +204,7 @@ function Test-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -227,8 +227,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name", "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Name", "Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.psm1 index dde7e4b91..92889dbd7 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.psm1 @@ -21,7 +21,7 @@ function Get-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -33,12 +33,12 @@ function Get-TargetResource Write-Verbose -Message "Getting Subscription Settings Service '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $nullReturn = @{ Name = $params.Name ApplicationPool = $params.ApplicationPool @@ -60,7 +60,7 @@ function Get-TargetResource else { $propertyFlags = [System.Reflection.BindingFlags]::Instance ` - -bor [System.Reflection.BindingFlags]::NonPublic + -bor [System.Reflection.BindingFlags]::NonPublic $propData = $serviceApp.GetType().GetProperties($propertyFlags) @@ -105,7 +105,7 @@ function Set-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -122,8 +122,8 @@ function Set-TargetResource { Write-Verbose -Message "Creating Subscription Settings Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $newParams = @{ @@ -146,12 +146,12 @@ function Set-TargetResource { Write-Verbose -Message "Checking proxy for Subscription Settings Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApp = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $serviceAppProxies = Get-SPServiceApplicationProxy -ErrorAction SilentlyContinue @@ -178,15 +178,15 @@ function Set-TargetResource { Write-Verbose -Message "Updating Subscription Settings Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool $service = Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.SPSubscriptionSettingsServiceApplication" - } + | Where-Object -FilterScript { + $_.GetType().FullName -eq "Microsoft.SharePoint.SPSubscriptionSettingsServiceApplication" + } $service.ApplicationPool = $appPool $service.Update() } @@ -196,14 +196,14 @@ function Set-TargetResource { Write-Verbose -Message "Removing Subscription Settings Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $service = Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.SPSubscriptionSettingsServiceApplication" - } + | Where-Object -FilterScript { + $_.GetType().FullName -eq "Microsoft.SharePoint.SPSubscriptionSettingsServiceApplication" + } Remove-SPServiceApplication $service -Confirm:$false } } @@ -232,7 +232,7 @@ function Test-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -255,12 +255,12 @@ function Test-TargetResource if ($CurrentValues.Ensure -eq "Present") { $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApp = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $serviceAppProxies = Get-SPServiceApplicationProxy -ErrorAction SilentlyContinue @@ -283,14 +283,14 @@ function Test-TargetResource } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ApplicationPool", "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("ApplicationPool", "Ensure") } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.psm1 index c37c21820..86a7e0cb2 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.psm1 @@ -30,12 +30,12 @@ function Get-TargetResource if ($TypeName -eq "Microsoft.SharePoint.Administration.Health.SPHealthAnalyzerJobDefinition") { throw ("You cannot use SPTimerJobState to change the schedule of " + ` - "health analyzer timer jobs.") + "health analyzer timer jobs.") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -45,7 +45,7 @@ function Get-TargetResource catch { throw ("No local SharePoint farm was detected. Timer job " + ` - "settings will not be applied") + "settings will not be applied") } $returnval = @{ @@ -61,7 +61,7 @@ function Get-TargetResource } $timerjob = Get-SPTimerJob -Type $params.TypeName ` - -WebApplication $wa + -WebApplication $wa if ($timerjob.Count -eq 0) { @@ -69,8 +69,8 @@ function Get-TargetResource } $returnval.WebAppUrl = $params.WebAppUrl - $returnval.Enabled = -not $timerjob.IsDisabled - $returnval.Schedule = $null + $returnval.Enabled = -not $timerjob.IsDisabled + $returnval.Schedule = $null if ($null -ne $timerjob.Schedule) { $returnval.Schedule = $timerjob.Schedule.ToString() @@ -82,8 +82,8 @@ function Get-TargetResource if ($timerjob.Count -eq 1) { $returnval.WebAppUrl = "N/A" - $returnval.Enabled = -not $timerjob.IsDisabled - $returnval.Schedule = $null + $returnval.Enabled = -not $timerjob.IsDisabled + $returnval.Schedule = $null if ($null -ne $timerjob.Schedule) { $returnval.Schedule = $timerjob.Schedule.ToString() @@ -92,7 +92,7 @@ function Get-TargetResource else { throw ("$($timerjob.Count) timer jobs found. Check input " + ` - "values or use the WebAppUrl parameter.") + "values or use the WebAppUrl parameter.") } } return $returnval @@ -132,12 +132,12 @@ function Set-TargetResource if ($TypeName -eq "Microsoft.SharePoint.Administration.Health.SPHealthAnalyzerJobDefinition") { throw ("You cannot use SPTimerJobState to change the schedule of " + ` - "health analyzer timer jobs.") + "health analyzer timer jobs.") } Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -160,7 +160,7 @@ function Set-TargetResource } $timerjob = Get-SPTimerJob -Type $params.TypeName ` - -WebApplication $wa + -WebApplication $wa if ($timerjob.Count -eq 0) { @@ -174,13 +174,13 @@ function Set-TargetResource try { Set-SPTimerJob -Identity $timerjob ` - -Schedule $params.Schedule ` - -ErrorAction Stop + -Schedule $params.Schedule ` + -ErrorAction Stop } catch { if ($_.Exception.Message -like ` - "*The time given was not given in the proper format*") + "*The time given was not given in the proper format*") { throw ("Incorrect schedule format used. New schedule will " + ` "not be applied.") @@ -241,13 +241,13 @@ function Set-TargetResource try { Set-SPTimerJob -Identity $timerjob ` - -Schedule $params.Schedule ` - -ErrorAction Stop + -Schedule $params.Schedule ` + -ErrorAction Stop } catch { if ($_.Exception.Message -like ` - "*The time given was not given in the proper format*") + "*The time given was not given in the proper format*") { throw ("Incorrect schedule format used. New schedule will " + ` "not be applied.") @@ -335,7 +335,7 @@ function Test-TargetResource if ($TypeName -eq "Microsoft.SharePoint.Administration.Health.SPHealthAnalyzerJobDefinition") { throw ("You cannot use SPTimerJobState to change the schedule of " + ` - "health analyzer timer jobs.") + "health analyzer timer jobs.") } $CurrentValues = Get-TargetResource @PSBoundParameters @@ -344,7 +344,7 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters + -DesiredValues $PSBoundParameters } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 index 765bb3ab9..5dcbff618 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 @@ -1,7 +1,7 @@ function Get-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Collections.Hashtable])] param ( @@ -38,7 +38,7 @@ $SigningCertificateFilePath, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [String] $Ensure = "Present", @@ -62,24 +62,24 @@ Write-Verbose -Message "Getting SPTrustedIdentityTokenIssuer '$Name' settings" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $claimsMappings = @() $spTrust = Get-SPTrustedIdentityTokenIssuer -Identity $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($spTrust) { - $description = $spTrust.Description - $realm = $spTrust.DefaultProviderRealm - $signInUrl = $spTrust.ProviderUri.OriginalString - $identifierClaim = $spTrust.IdentityClaimTypeInformation.MappedClaimType + $description = $spTrust.Description + $realm = $spTrust.DefaultProviderRealm + $signInUrl = $spTrust.ProviderUri.OriginalString + $identifierClaim = $spTrust.IdentityClaimTypeInformation.MappedClaimType $SigningCertificateThumbprint = $spTrust.SigningCertificate.Thumbprint - $currentState = "Present" - $claimProviderName = $sptrust.ClaimProviderName - $providerSignOutUri = $sptrust.ProviderSignOutUri.OriginalString - $useWReplyParameter = $sptrust.UseWReplyParameter + $currentState = "Present" + $claimProviderName = $sptrust.ClaimProviderName + $providerSignOutUri = $sptrust.ProviderSignOutUri.OriginalString + $useWReplyParameter = $sptrust.UseWReplyParameter $spTrust.ClaimTypeInformation | Foreach-Object -Process { $claimsMappings = $claimsMappings + @{ @@ -91,15 +91,15 @@ } else { - $description = "" - $realm = "" - $signInUrl = "" - $identifierClaim = "" + $description = "" + $realm = "" + $signInUrl = "" + $identifierClaim = "" $SigningCertificateThumbprint = "" - $currentState = "Absent" - $claimProviderName = "" - $providerSignOutUri = "" - $useWReplyParameter = $false + $currentState = "Absent" + $claimProviderName = "" + $providerSignOutUri = "" + $useWReplyParameter = $false } return @{ @@ -123,7 +123,7 @@ function Set-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] param ( [Parameter(Mandatory = $true)] @@ -159,7 +159,7 @@ function Set-TargetResource $SigningCertificateFilePath, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [String] $Ensure = "Present", @@ -189,29 +189,29 @@ function Set-TargetResource if ($CurrentValues.Ensure -eq "Absent") { if ($PSBoundParameters.ContainsKey("SigningCertificateThumbprint") -and ` - $PSBoundParameters.ContainsKey("SigningCertificateFilePath")) + $PSBoundParameters.ContainsKey("SigningCertificateFilePath")) { throw ("Cannot use both parameters SigningCertificateThumbprint and SigningCertificateFilePath at the same time.") return } if (!$PSBoundParameters.ContainsKey("SigningCertificateThumbprint") -and ` - !$PSBoundParameters.ContainsKey("SigningCertificateFilePath")) + !$PSBoundParameters.ContainsKey("SigningCertificateFilePath")) { throw ("At least one of the following parameters must be specified: " + ` - "SigningCertificateThumbprint, SigningCertificateFilePath.") + "SigningCertificateThumbprint, SigningCertificateFilePath.") return } Write-Verbose -Message "Creating SPTrustedIdentityTokenIssuer '$Name'" $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] if ($params.SigningCertificateThumbprint) { Write-Verbose -Message ("Getting signing certificate with thumbprint " + ` - "$($params.SigningCertificateThumbprint) from the certificate store 'LocalMachine\My'") + "$($params.SigningCertificateThumbprint) from the certificate store 'LocalMachine\My'") if ($params.SigningCertificateThumbprint -notmatch "^[A-Fa-f0-9]{40}$") { @@ -225,13 +225,13 @@ function Set-TargetResource if (!$cert) { throw ("Signing certificate with thumbprint $($params.SigningCertificateThumbprint) " + ` - "was not found in certificate store 'LocalMachine\My'.") + "was not found in certificate store 'LocalMachine\My'.") } if ($cert.HasPrivateKey) { throw ("SharePoint requires that the private key of the signing certificate" + ` - " is not installed in the certificate store.") + " is not installed in the certificate store.") } } else @@ -240,7 +240,7 @@ function Set-TargetResource try { $cert = New-Object -TypeName "System.Security.Cryptography.X509Certificates.X509Certificate2" ` - -ArgumentList @($params.SigningCertificateFilePath) + -ArgumentList @($params.SigningCertificateFilePath) } catch { @@ -249,8 +249,8 @@ function Set-TargetResource } $claimsMappingsArray = @() - $params.ClaimsMappings| Foreach-Object -Process { - $runParams = @{} + $params.ClaimsMappings | Foreach-Object -Process { + $runParams = @{ } $runParams.Add("IncomingClaimTypeDisplayName", $_.Name) $runParams.Add("IncomingClaimType", $_.IncomingClaimType) @@ -268,13 +268,13 @@ function Set-TargetResource } if (!($claimsMappingsArray | Where-Object -FilterScript { - $_.MappedClaimType -like $params.IdentifierClaim - })) + $_.MappedClaimType -like $params.IdentifierClaim + })) { throw ("IdentifierClaim does not match any claim type specified in ClaimsMappings.") } - $runParams = @{} + $runParams = @{ } $runParams.Add("ImportTrustCertificate", $cert) $runParams.Add("Name", $params.Name) $runParams.Add("Description", $params.Description) @@ -290,9 +290,9 @@ function Set-TargetResource throw "SharePoint failed to create the SPTrustedIdentityTokenIssuer." } - if ((Get-SPClaimProvider| Where-Object -FilterScript { - $_.DisplayName -eq $params.ClaimProviderName - })) + if ((Get-SPClaimProvider | Where-Object -FilterScript { + $_.DisplayName -eq $params.ClaimProviderName + })) { $trust.ClaimProviderName = $params.ClaimProviderName } @@ -302,15 +302,15 @@ function Set-TargetResource $trust.ProviderSignOutUri = New-Object -TypeName System.Uri ($params.ProviderSignOutUri) } $trust.Update() - } + } } } else { Write-Verbose "Removing SPTrustedIdentityTokenIssuer '$Name'" $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $Name = $params.Name # SPTrustedIdentityTokenIssuer must be removed from each zone of each web app before @@ -323,21 +323,21 @@ function Set-TargetResource $urlZones | Foreach-Object -Process { $zone = $_ $providers = Get-SPAuthenticationProvider -WebApplication $wa.Url ` - -Zone $zone ` - -ErrorAction SilentlyContinue + -Zone $zone ` + -ErrorAction SilentlyContinue if (!$providers) { return } $trustedProviderToRemove = $providers | Where-Object -FilterScript { $_ -is [Microsoft.SharePoint.Administration.SPTrustedAuthenticationProvider] ` - -and $_.LoginProviderName -like $params.Name + -and $_.LoginProviderName -like $params.Name } if ($trustedProviderToRemove) { Write-Verbose -Message ("Removing SPTrustedAuthenticationProvider " + ` - "'$Name' from web app '$webAppUrl' in zone " + ` - "'$zone'") + "'$Name' from web app '$webAppUrl' in zone " + ` + "'$zone'") $wa.GetIisSettingsWithFallback($zone).ClaimsAuthenticationProviders.Remove($trustedProviderToRemove) | Out-Null $update = $true } @@ -350,7 +350,7 @@ function Set-TargetResource $runParams = @{ Identity = $params.Name - Confirm = $false + Confirm = $false } Remove-SPTrustedIdentityTokenIssuer @runParams } @@ -360,7 +360,7 @@ function Set-TargetResource function Test-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([Boolean])] param ( @@ -397,7 +397,7 @@ function Test-TargetResource $SigningCertificateFilePath, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [String] $Ensure = "Present", @@ -421,17 +421,17 @@ function Test-TargetResource Write-Verbose -Message "Testing SPTrustedIdentityTokenIssuer '$Name' settings" if ($PSBoundParameters.ContainsKey("SigningCertificateThumbprint") -and ` - $PSBoundParameters.ContainsKey("SigningCertificateFilePath")) + $PSBoundParameters.ContainsKey("SigningCertificateFilePath")) { throw ("Cannot use both parameters SigningCertificateThumbprint and SigningCertificateFilePath at the same time.") return } if ($PSBoundParameters.ContainsKey("SigningCertificateThumbprint") -eq $false -and ` - $PSBoundParameters.ContainsKey("SigningCertificateFilePath") -eq $false) + $PSBoundParameters.ContainsKey("SigningCertificateFilePath") -eq $false) { throw ("At least one of the following parameters must be specified: " + ` - "SigningCertificateThumbprint, SigningCertificateFilePath.") + "SigningCertificateThumbprint, SigningCertificateFilePath.") return } @@ -441,8 +441,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuerProviderRealms/MSFT_SPTrustedIdentityTokenIssuerProviderRealms.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuerProviderRealms/MSFT_SPTrustedIdentityTokenIssuerProviderRealms.psm1 index d01ed7d72..beaa2982b 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuerProviderRealms/MSFT_SPTrustedIdentityTokenIssuerProviderRealms.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuerProviderRealms/MSFT_SPTrustedIdentityTokenIssuerProviderRealms.psm1 @@ -1,7 +1,7 @@ function Get-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Collections.Hashtable])] param ( @@ -33,13 +33,13 @@ function Get-TargetResource if ($ProviderRealms.Count -gt 0 -and ($ProviderRealmsToInclude.Count -gt 0 -or $ProviderRealmsToExclude.Count -gt 0)) { throw ("Cannot use the ProviderRealms parameter together with the " + ` - "ProviderRealmsToInclude or ProviderRealmsToExclude parameters") + "ProviderRealmsToInclude or ProviderRealmsToExclude parameters") } if ($ProviderRealms.Count -eq 0 -and $ProviderRealmsToInclude.Count -eq 0 -and $ProviderRealmsToExclude.Count -eq 0) { throw ("At least one of the following parameters must be specified: " + ` - "ProviderRealms, ProviderRealmsToInclude, ProviderRealmsToExclude") + "ProviderRealms, ProviderRealmsToInclude, ProviderRealmsToExclude") } $paramRealms = @{ } @@ -70,13 +70,13 @@ function Get-TargetResource Write-Verbose -Message "Getting SPTrustedIdentityTokenIssuer ProviderRealms" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $currentRealms = @{ } $spTrust = Get-SPTrustedIdentityTokenIssuer -Identity $params.IssuerName ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $spTrust) { @@ -106,26 +106,26 @@ function Get-TargetResource } } $currentStatus = Get-ProviderRealmsStatus -currentRealms $result ` - -desiredRealms $paramRealms ` - -includeRealms $includeRealms ` - -excludeRealms $excludeRealms ` - -Ensure $Ensure + -desiredRealms $paramRealms ` + -includeRealms $includeRealms ` + -excludeRealms $excludeRealms ` + -Ensure $Ensure return @{ - IssuerName = $IssuerName - ProviderRealms = $paramRealms - ProviderRealmsToInclude = $includeRealms - ProviderRealmsToExclude = $excludeRealms - CurrentRealms = $result - RealmsToAdd = $currentStatus.NewRealms - Ensure = $currentStatus.CurrentStatus - } + IssuerName = $IssuerName + ProviderRealms = $paramRealms + ProviderRealmsToInclude = $includeRealms + ProviderRealmsToExclude = $excludeRealms + CurrentRealms = $result + RealmsToAdd = $currentStatus.NewRealms + Ensure = $currentStatus.CurrentStatus + } } function Set-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] param ( [Parameter(Mandatory = $true)] @@ -162,12 +162,12 @@ function Set-TargetResource Write-Verbose -Message "Setting SPTrustedIdentityTokenIssuer provider realms" $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $trust = Get-SPTrustedIdentityTokenIssuer -Identity $params.IssuerName ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $trust) { @@ -187,7 +187,7 @@ function Set-TargetResource function Test-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([Boolean])] param ( @@ -225,8 +225,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } Export-ModuleMember -Function *-TargetResource @@ -326,7 +326,7 @@ function Get-ProviderRealmsStatus() if ($update.Count -gt 0) { - $update.Keys | ForEach-Object{ $currentRealms[$_] = $update[$_] } + $update.Keys | ForEach-Object { $currentRealms[$_] = $update[$_] } } if ($inclusion.Count -gt 0) @@ -345,7 +345,7 @@ function Get-ProviderRealmsStatus() if ($exclusion.Count -gt 0) { - $exclusion.Keys | ForEach-Object{ $currentRealms.Remove($_) } + $exclusion.Keys | ForEach-Object { $currentRealms.Remove($_) } } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.psm1 index ff3c3c016..e62735739 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.psm1 @@ -17,7 +17,7 @@ function Get-TargetResource $CertificateFilePath, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -29,17 +29,17 @@ function Get-TargetResource Write-Verbose "Getting Trusted Root Authority with name '$Name'" if ($PSBoundParameters.ContainsKey("CertificateThumbprint") -and ` - $PSBoundParameters.ContainsKey("CertificateFilePath")) + $PSBoundParameters.ContainsKey("CertificateFilePath")) { Write-Verbose -Message ("Cannot use both parameters CertificateThumbprint and " + ` - "CertificateFilePath at the same time.") + "CertificateFilePath at the same time.") } if (-not ($PSBoundParameters.ContainsKey("CertificateThumbprint")) -and ` - -not($PSBoundParameters.ContainsKey("CertificateFilePath"))) + -not($PSBoundParameters.ContainsKey("CertificateFilePath"))) { Write-Verbose -Message ("At least one of the following parameters must be specified: " + ` - "CertificateThumbprint, CertificateFilePath.") + "CertificateThumbprint, CertificateFilePath.") } if ($PSBoundParameters.ContainsKey("CertificateFilePath")) @@ -51,8 +51,8 @@ function Get-TargetResource } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $rootCert = Get-SPTrustedRootAuthority -Identity $params.Name -ErrorAction SilentlyContinue @@ -89,7 +89,7 @@ function Set-TargetResource [CmdletBinding()] param ( - [Parameter(Mandatory = $true)] + [Parameter(Mandatory = $true)] [System.String] $Name, @@ -102,7 +102,7 @@ function Set-TargetResource $CertificateFilePath, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -114,17 +114,17 @@ function Set-TargetResource Write-Verbose -Message "Setting SPTrustedRootAuthority '$Name'" if ($PSBoundParameters.ContainsKey("CertificateThumbprint") -and ` - $PSBoundParameters.ContainsKey("CertificateFilePath")) + $PSBoundParameters.ContainsKey("CertificateFilePath")) { throw ("Cannot use both parameters CertificateThumbprint and CertificateFilePath " + ` - "at the same time.") + "at the same time.") } if (-not ($PSBoundParameters.ContainsKey("CertificateThumbprint")) -and ` - -not($PSBoundParameters.ContainsKey("CertificateFilePath"))) + -not($PSBoundParameters.ContainsKey("CertificateFilePath"))) { throw ("At least one of the following parameters must be specified: " + ` - "CertificateThumbprint, CertificateFilePath.") + "CertificateThumbprint, CertificateFilePath.") } if ($PSBoundParameters.ContainsKey("CertificateFilePath")) @@ -140,15 +140,15 @@ function Set-TargetResource { Write-Verbose -Message "Updating SPTrustedRootAuthority '$Name'" $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] if ($params.ContainsKey("CertificateThumbprint")) { Write-Verbose -Message "Importing certificate from CertificateThumbprint" $cert = Get-Item -Path "CERT:\LocalMachine\My\$($params.CertificateThumbprint)" ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $cert) { @@ -162,7 +162,7 @@ function Set-TargetResource try { $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 - $cert.Import($CertificateFilePath) + $cert.Import($params.CertificateFilePath) } catch { @@ -193,15 +193,15 @@ function Set-TargetResource { Write-Verbose -Message "Adding SPTrustedRootAuthority '$Name'" $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] if ($params.ContainsKey("CertificateThumbprint")) { Write-Verbose -Message "Importing certificate from CertificateThumbprint" $cert = Get-Item -Path "CERT:\LocalMachine\My\$($params.CertificateThumbprint)" ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $cert) { @@ -215,7 +215,7 @@ function Set-TargetResource try { $cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 - $cert.Import($CertificateFilePath) + $cert.Import($params.CertificateFilePath) } catch { @@ -245,11 +245,11 @@ function Set-TargetResource { Write-Verbose -Message "Removing SPTrustedRootAuthority '$Name'" $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] Remove-SPTrustedRootAuthority -Identity $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue } } } @@ -273,7 +273,7 @@ function Test-TargetResource $CertificateFilePath, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -285,17 +285,17 @@ function Test-TargetResource Write-Verbose -Message "Testing SPTrustedRootAuthority '$Name'" if ($PSBoundParameters.ContainsKey("CertificateThumbprint") -and ` - $PSBoundParameters.ContainsKey("CertificateFilePath")) + $PSBoundParameters.ContainsKey("CertificateFilePath")) { throw ("Cannot use both parameters CertificateThumbprint and CertificateFilePath " + ` - "at the same time.") + "at the same time.") } if (-not ($PSBoundParameters.ContainsKey("CertificateThumbprint")) -and ` - -not($PSBoundParameters.ContainsKey("CertificateFilePath"))) + -not($PSBoundParameters.ContainsKey("CertificateFilePath"))) { throw ("At least one of the following parameters must be specified: " + ` - "CertificateThumbprint, CertificateFilePath.") + "CertificateThumbprint, CertificateFilePath.") } $CurrentValues = Get-TargetResource @PSBoundParameters @@ -316,14 +316,14 @@ function Test-TargetResource if ($Ensure -eq "Present") { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name","CertificateThumbprint","Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Name", "CertificateThumbprint", "Ensure") } else { - return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name","Ensure") + return Test-SPDscParameterState -CurrentValues $CurrentValues ` + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Name", "Ensure") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedSecurityTokenIssuer/MSFT_SPTrustedSecurityTokenIssuer.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedSecurityTokenIssuer/MSFT_SPTrustedSecurityTokenIssuer.psm1 new file mode 100644 index 000000000..bab86eb88 --- /dev/null +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedSecurityTokenIssuer/MSFT_SPTrustedSecurityTokenIssuer.psm1 @@ -0,0 +1,475 @@ +function Get-TargetResource +{ + [CmdletBinding()] + [OutputType([System.Collections.Hashtable])] + param + ( + [Parameter(Mandatory = $true)] + [String] + $Name, + + [Parameter()] + [String] + $Description, + + [String] + $RegisteredIssuerNameIdentifier, + + [Parameter()] + [String] + $RegisteredIssuerNameRealm, + + [Parameter()] + [String] + $SigningCertificateThumbprint, + + [Parameter()] + [String] + $SigningCertificateFilePath, + + [Parameter()] + [String] + $MetadataEndPoint, + + [Parameter()] + [System.Boolean] + $IsTrustBroker = $true, + + [Parameter()] + [ValidateSet("Present", "Absent")] + [String] + $Ensure = "Present", + + [Parameter()] + [System.Management.Automation.PSCredential] + $InstallAccount + ) + + Write-Verbose -Message "Getting SPTrustedSecurityTokenIssuer '$Name' settings" + + $result = Invoke-SPDscCommand -Credential $InstallAccount ` + -Arguments $PSBoundParameters ` + -ScriptBlock { + $params = $args[0] + + $spTrust = Get-SPTrustedSecurityTokenIssuer -Identity $params.Name ` + -ErrorAction SilentlyContinue + + if ($spTrust) + { + $description = $spTrust.Description + $registeredIssuerNameIdentifier = $spTrust.RegisteredIssuerName.Split("@")[0] + $registeredIssuerNameRealm = $spTrust.RegisteredIssuerName.Split("@")[1] + $signingCertificateThumbprint = $spTrust.SigningCertificate.Thumbprint + $metadataEndPoint = $spTrust.MetadataEndPoint.OriginalString + # Get-SPTrustedSecurityTokenIssuer does not return a property IsTrustBroker. But value of property IsSelfIssuer is the complement of IsTrustBroker + $isTrustBroker = $false + if ($spTrust.IsSelfIssuer -eq $false) + { + $isTrustBroker = $true + } + $currentState = "Present" + + # If the signing certificate is specified to Get method from its filepath, it must be retrieved to compare its thumbprint with + # the one set in the SPTrustedSecurityTokenIssuer ($signingCertificateThumbprint) + if ($params.SigningCertificateFilePath) + { + Write-Verbose -Message "Getting signing certificate from file system path '$($params.SigningCertificateFilePath)'" + $cert = $null + try + { + $cert = New-Object -TypeName "System.Security.Cryptography.X509Certificates.X509Certificate2" ` + -ArgumentList @($params.SigningCertificateFilePath) + } + catch + { + throw ("Signing certificate was not found in path '$($params.SigningCertificateFilePath)'.") + } + + if ($cert.Thumbprint -match $signingCertificateThumbprint) + { + # Signing certificate is conform to the one specified + # Set signingCertificateThumbprint and signingCertificateFilePath to same value as passed to Get + # so that Test method sees this is conform + $signingCertificateThumbprint = $params.SigningCertificateThumbprint + $signingCertificateFilePath = $params.SigningCertificateFilePath + Write-Verbose -Message "Existing signing certificate in SPTrustedSecurityTokenIssuer '$($params.Name)' has the same thumbprint as the signing certificate passed in parameter, as expected." + } + } + + # If parameter RegisteredIssuerNameRealm is null, it means that registeredIssuerNameRealm of the existing trust should be equal to the SPAuthenticationRealm + if ([string]::IsNullOrEmpty($params.RegisteredIssuerNameRealm)) + { + $farmAuthenticationRealm = Get-SPAuthenticationRealm + if ($registeredIssuerNameRealm -match $farmAuthenticationRealm) + { + # RegisteredIssuerNameRealm in the SPTrustedSecurityTokenIssuer is conform to expected value (SPAuthenticationRealm) + # Set it to $params.RegisteredIssuerNameRealm so that Test method sees this is conform + $registeredIssuerNameRealm = $params.RegisteredIssuerNameRealm + Write-Verbose -Message "Existing registeredIssuerNameRealm in SPTrustedSecurityTokenIssuer '$($params.Name)' is set with the SPAuthenticationRealm of the farm, as expected." + } + } + } + else + { + $description = "" + $registeredIssuerNameIdentifier = "" + $registeredIssuerNameRealm = "" + $signingCertificateThumbprint = "" + $signingCertificateFilePath = "" + $metadataEndPoint = "" + $isTrustBroker = $false + $currentState = "Absent" + } + + return @{ + Name = $params.Name + Description = $description + RegisteredIssuerNameIdentifier = $registeredIssuerNameIdentifier + RegisteredIssuerNameRealm = $registeredIssuerNameRealm + SigningCertificateThumbprint = $signingCertificateThumbprint + SigningCertificateFilePath = $signingCertificateFilePath + MetadataEndPoint = $metadataEndPoint + IsTrustBroker = $isTrustBroker + Ensure = $currentState + } + } + return $result +} + +function Set-TargetResource +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [String] + $Name, + + [Parameter()] + [String] + $Description, + + [String] + $RegisteredIssuerNameIdentifier, + + [Parameter()] + [String] + $RegisteredIssuerNameRealm, + + [Parameter()] + [String] + $SigningCertificateThumbprint, + + [Parameter()] + [String] + $SigningCertificateFilePath, + + [Parameter()] + [String] + $MetadataEndPoint, + + [Parameter()] + [System.Boolean] + $IsTrustBroker = $true, + + [Parameter()] + [ValidateSet("Present", "Absent")] + [String] + $Ensure = "Present", + + [Parameter()] + [System.Management.Automation.PSCredential] + $InstallAccount + ) + + Write-Verbose -Message "Setting SPTrustedSecurityTokenIssuer '$Name' settings" + + $CurrentValues = Get-TargetResource @PSBoundParameters + + if ($Ensure -eq "Present") + { + if ($PSBoundParameters.ContainsKey("SigningCertificateThumbprint") -and ` + $PSBoundParameters.ContainsKey("SigningCertificateFilePath")) + { + throw ("Cannot use both parameters SigningCertificateThumbprint and SigningCertificateFilePath at the same time.") + } + + if ($PSBoundParameters.ContainsKey("SigningCertificateThumbprint") -and ` + $PSBoundParameters.ContainsKey("MetadataEndPoint")) + { + throw ("Cannot use both parameters SigningCertificateThumbprint and MetadataEndPoint at the same time.") + } + + if ($PSBoundParameters.ContainsKey("SigningCertificateFilePath") -and ` + $PSBoundParameters.ContainsKey("MetadataEndPoint")) + { + throw ("Cannot use both parameters SigningCertificateFilePath and MetadataEndPoint at the same time.") + } + + if ($PSBoundParameters.ContainsKey("SigningCertificateThumbprint") -eq $false -and ` + $PSBoundParameters.ContainsKey("SigningCertificateFilePath") -eq $false -and ` + $PSBoundParameters.ContainsKey("MetadataEndPoint") -eq $false) + { + throw ("At least one of the following parameters must be specified: " + ` + "SigningCertificateThumbprint, SigningCertificateFilePath, MetadataEndPoint.") + } + + if ($PSBoundParameters.ContainsKey("MetadataEndPoint") -and ` + $PSBoundParameters.ContainsKey("RegisteredIssuerNameIdentifier")) + { + throw ("Cannot use both parameters MetadataEndPoint and RegisteredIssuerNameIdentifier at the same time.") + } + + if ($PSBoundParameters.ContainsKey("MetadataEndPoint") -and ` + $PSBoundParameters.ContainsKey("RegisteredIssuerNameRealm")) + { + throw ("Cannot use both parameters MetadataEndPoint and RegisteredIssuerNameRealm at the same time.") + } + + $PSBoundParameters.Add("CurrentValues", $CurrentValues) + + + $null = Invoke-SPDscCommand -Credential $InstallAccount ` + -Arguments $PSBoundParameters ` + -ScriptBlock { + $params = $args[0] + + $runParams = @{ } + if ($params.Description) + { + $runParams.Add("Description", $params.Description) + } + + if ($params.IsTrustBroker -eq $true) + { + $runParams.Add("IsTrustBroker", $null) + } + + if ($params.MetadataEndPoint) + { + # Configure OAuth trust automatically using metadata file specified in parameter MetadataEndPoint + $runParams.Add("MetadataEndPoint", $params.MetadataEndPoint) + } + else + { + # Configure OAuth trust with specified certificate and a RegisteredIssuerName + if ($params.SigningCertificateThumbprint) + { + Write-Verbose -Message ("Getting signing certificate with thumbprint " + ` + "$($params.SigningCertificateThumbprint) from the certificate store 'LocalMachine\My'") + + if ($params.SigningCertificateThumbprint -notmatch "^[A-Fa-f0-9]{40}$") + { + throw ("Parameter SigningCertificateThumbprint does not match valid format '^[A-Fa-f0-9]{40}$'.") + } + + $cert = Get-ChildItem -Path Cert:\LocalMachine\My | Where-Object -FilterScript { + $_.Thumbprint -match $params.SigningCertificateThumbprint + } + + if (!$cert) + { + throw ("Signing certificate with thumbprint $($params.SigningCertificateThumbprint) " + ` + "was not found in certificate store 'LocalMachine\My'.") + } + } + else + { + Write-Verbose -Message "Getting signing certificate from file system path '$($params.SigningCertificateFilePath)'" + try + { + $cert = New-Object -TypeName "System.Security.Cryptography.X509Certificates.X509Certificate2" ` + -ArgumentList @($params.SigningCertificateFilePath) + } + catch + { + throw ("Signing certificate was not found in path '$($params.SigningCertificateFilePath)'.") + } + } + + if ([string]::IsNullOrEmpty($params.RegisteredIssuerNameRealm)) + { + Write-Verbose -Message "RegisteredIssuerNameRealm is not specified, use Get-SPAuthenticationRealm instead." + $registeredIssuerNameRealm = Get-SPAuthenticationRealm + } + $registeredIssuerName = "$($params.RegisteredIssuerNameIdentifier)@$registeredIssuerNameRealm" + + $runParams.Add("RegisteredIssuerName", $registeredIssuerName) + $runParams.Add("Certificate", $cert) + } + + if ($params.CurrentValues.Ensure -eq "Absent") + { + $runParams.Add("Name", $params.Name) + Write-Verbose -Message "Creating SPTrustedSecurityTokenIssuer '$($params.Name)'" + New-SPTrustedSecurityTokenIssuer @runParams + } + else + { + $runParams.Add("Identity", $params.Name) + $runParams.Add("Confirm", $false) + Write-Verbose -Message "Updating SPTrustedSecurityTokenIssuer '$($params.Name)'" + Write-Verbose -Message "New Values: $(Convert-SPDscHashtableToString -Hashtable $runParams)" + Set-SPTrustedSecurityTokenIssuer @runParams + } + } + } + else + { + if ($CurrentValues.Ensure -eq "Present") + { + Write-Verbose "Removing SPTrustedSecurityTokenIssuer '$Name'" + $null = Invoke-SPDscCommand -Credential $InstallAccount ` + -Arguments $PSBoundParameters ` + -ScriptBlock { + $params = $args[0] + + $runParams = @{ + Identity = $params.Name + Confirm = $false + } + Remove-SPTrustedSecurityTokenIssuer @runParams + } + } + } +} + +function Test-TargetResource +{ + [CmdletBinding()] + [OutputType([Boolean])] + param + ( + [Parameter(Mandatory = $true)] + [String] + $Name, + + [Parameter()] + [String] + $Description, + + [String] + $RegisteredIssuerNameIdentifier, + + [Parameter()] + [String] + $RegisteredIssuerNameRealm, + + [Parameter()] + [String] + $SigningCertificateThumbprint, + + [Parameter()] + [String] + $SigningCertificateFilePath, + + [Parameter()] + [String] + $MetadataEndPoint, + + [Parameter()] + [System.Boolean] + $IsTrustBroker = $true, + + [Parameter()] + [ValidateSet("Present", "Absent")] + [String] + $Ensure = "Present", + + [Parameter()] + [System.Management.Automation.PSCredential] + $InstallAccount + ) + + Write-Verbose -Message "Testing SPTrustedSecurityTokenIssuer '$Name' settings" + + if ($PSBoundParameters.ContainsKey("SigningCertificateThumbprint") -and ` + $PSBoundParameters.ContainsKey("SigningCertificateFilePath")) + { + throw ("Cannot use both parameters SigningCertificateThumbprint and SigningCertificateFilePath at the same time.") + } + + if ($PSBoundParameters.ContainsKey("SigningCertificateThumbprint") -and ` + $PSBoundParameters.ContainsKey("MetadataEndPoint")) + { + throw ("Cannot use both parameters SigningCertificateThumbprint and MetadataEndPoint at the same time.") + } + + if ($PSBoundParameters.ContainsKey("SigningCertificateFilePath") -and ` + $PSBoundParameters.ContainsKey("MetadataEndPoint")) + { + throw ("Cannot use both parameters SigningCertificateFilePath and MetadataEndPoint at the same time.") + } + + if ($PSBoundParameters.ContainsKey("SigningCertificateThumbprint") -eq $false -and ` + $PSBoundParameters.ContainsKey("SigningCertificateFilePath") -eq $false -and ` + $PSBoundParameters.ContainsKey("MetadataEndPoint") -eq $false) + { + throw ("At least one of the following parameters must be specified: " + ` + "SigningCertificateThumbprint, SigningCertificateFilePath, MetadataEndPoint.") + } + + if ($PSBoundParameters.ContainsKey("MetadataEndPoint") -and ` + $PSBoundParameters.ContainsKey("RegisteredIssuerNameIdentifier")) + { + throw ("Cannot use both parameters MetadataEndPoint and RegisteredIssuerNameIdentifier at the same time.") + } + + if ($PSBoundParameters.ContainsKey("MetadataEndPoint") -and ` + $PSBoundParameters.ContainsKey("RegisteredIssuerNameRealm")) + { + throw ("Cannot use both parameters MetadataEndPoint and RegisteredIssuerNameRealm at the same time.") + } + + # If RegisteredIssuerNameRealm was not set, it won't be present in the $PSBoundParameters + # But it must be added to be actually tested by Test-SPDscParameterState + if ($PSBoundParameters.ContainsKey("RegisteredIssuerNameRealm") -eq $false) + { + $PSBoundParameters.Add("RegisteredIssuerNameRealm", "") + } + + # If SigningCertificateThumbprint was not set, it won't be present in the $PSBoundParameters + # Since it is set in the Get method, it must be added to be tested correctly by Test-SPDscParameterState + if ($PSBoundParameters.ContainsKey("SigningCertificateThumbprint") -eq $false) + { + $PSBoundParameters.Add("SigningCertificateThumbprint", "") + } + + # If SigningCertificateFilePath was not set, it won't be present in the $PSBoundParameters + # Since it is set in the Get method, it must be added to be tested correctly by Test-SPDscParameterState + if ($PSBoundParameters.ContainsKey("SigningCertificateFilePath") -eq $false) + { + $PSBoundParameters.Add("SigningCertificateFilePath", "") + } + + # If IsTrustBroker was not set, it won't be present in the $PSBoundParameters + # Since it is set in the Get method, it must be added to be tested correctly by Test-SPDscParameterState + if ($PSBoundParameters.ContainsKey("IsTrustBroker") -eq $false) + { + $PSBoundParameters.Add("IsTrustBroker", $false) + } + + # If MetadataEndPoint was not set, it won't be present in the $PSBoundParameters + # But it must be added to be actually tested by Test-SPDscParameterState + if ($PSBoundParameters.ContainsKey("MetadataEndPoint") -eq $false) + { + $PSBoundParameters.Add("MetadataEndPoint", "") + $valuesToCheck = @("Ensure", "Description", "RegisteredIssuerNameIdentifier", "RegisteredIssuerNameRealm", "SigningCertificateThumbprint", "IsTrustBroker") + } + else + { + # If MetadataEndPoint is set, the only property that really matters is MetadataEndPoint + $valuesToCheck = @("Ensure", "Description", "MetadataEndPoint", "IsTrustBroker") + } + + $CurrentValues = Get-TargetResource @PSBoundParameters + Write-Verbose -Message "Current Values: $(Convert-SPDscHashtableToString -Hashtable $CurrentValues)" + Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" + + return Test-SPDscParameterState -CurrentValues $CurrentValues ` + -DesiredValues $PSBoundParameters ` + -ValuesToCheck $valuesToCheck +} + +Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedSecurityTokenIssuer/MSFT_SPTrustedSecurityTokenIssuer.schema.mof b/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedSecurityTokenIssuer/MSFT_SPTrustedSecurityTokenIssuer.schema.mof new file mode 100644 index 000000000..d23a44096 --- /dev/null +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedSecurityTokenIssuer/MSFT_SPTrustedSecurityTokenIssuer.schema.mof @@ -0,0 +1,14 @@ +[ClassVersion("1.0.0.0"), FriendlyName("SPTrustedSecurityTokenIssuer")] +class MSFT_SPTrustedSecurityTokenIssuer : OMI_BaseResource +{ + [Key, Description("Name of the SPTrustedSecurityTokenIssuer")] String Name; + [Write, Description("Description of the SPTrustedSecurityTokenIssuer")] String Description; + [Write, Description("The security principal identifier of the security token issuer")] String RegisteredIssuerNameIdentifier; + [Write, Description("The realm of the security token issuer")] String RegisteredIssuerNameRealm; + [Write, Description("Specify the thumbprint of the signing certificate, which must be located in certificate store LocalMachine\\My")] String SigningCertificateThumbprint; + [Write, Description("Specify the file path to the signing certificate if it is not stored in the local certificate store already")] String SigningCertificateFilePath; + [Write, Description("URL that SharePoint will reach to download the JSON metadata file of the issuer")] String MetadataEndPoint; + [Write, Description("Specifies whether the trust is established with a self-issuer partner app")] Boolean IsTrustBroker; + [Write, Description("Present if the SPTrustedSecurityTokenIssuer should be created, or Absent if it should be removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; + [Write, EmbeddedInstance("MSFT_Credential"), Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5")] String InstallAccount; +}; diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedSecurityTokenIssuer/readme.md b/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedSecurityTokenIssuer/readme.md new file mode 100644 index 000000000..6f47fc7bd --- /dev/null +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPTrustedSecurityTokenIssuer/readme.md @@ -0,0 +1,25 @@ +# Description + +**Type:** Distributed +**Requires CredSSP:** No + +This resource is used to create or remove a SPTrustedSecurityTokenIssuer in +a SharePoint farm. + +It requires to specify either a MetadataEndPoint or a certificate. + +The certificate can be specified by setting either parameter +SigningCertificateThumbPrint or SigningCertificateFilePath, but not both. + +The SigningCertificateThumbPrint must be the thumbprint of the signing +certificate stored in the certificate store LocalMachine\My of the server + +The SigningCertificateFilePath must be the file path to the public key of +the signing certificate. + +Properties RegisteredIssuerNameIdentifier and RegisteredIssuerNameRealm +compose the RegisteredIssuerName. If RegisteredIssuerNameRealm is ommitted, +it will be set with the realm of the farm. + +The default value for the Ensure parameter is Present. When not specifying this +parameter, the token issuer is created. diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.psm1 index d7c256d12..ba3f9187b 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.psm1 @@ -9,7 +9,7 @@ function Get-TargetResource $Name, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -53,12 +53,12 @@ function Get-TargetResource Write-Verbose -Message "Getting usage application '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $nullReturn = @{ Name = $params.Name Ensure = "Absent" @@ -117,7 +117,7 @@ function Set-TargetResource $Name, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -165,11 +165,11 @@ function Set-TargetResource if ($CurrentState.Ensure -eq "Absent" -and $Ensure -eq "Present") { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] - $newParams = @{} + $newParams = @{ } $newParams.Add("Name", $params.Name) if ($params.ContainsKey("DatabaseName")) { @@ -197,8 +197,8 @@ function Set-TargetResource { Write-Verbose -Message "Configuring usage application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $spUsageApplicationProxy = Get-SPServiceApplicationProxy | Where-Object -FilterScript { @@ -210,7 +210,7 @@ function Set-TargetResource $spUsageApplicationProxy.Provision() } - $setParams = @{} + $setParams = @{ } $setParams.Add("LoggingEnabled", $true) if ($params.ContainsKey("UsageLogCutTime")) { @@ -236,14 +236,14 @@ function Set-TargetResource { Write-Verbose -Message "Removing usage application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $service = Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.SharePoint.Administration.SPUsageApplication" - } + | Where-Object -FilterScript { + $_.GetType().FullName -eq "Microsoft.SharePoint.Administration.SPUsageApplication" + } Remove-SPServiceApplication $service -Confirm:$false } } @@ -260,7 +260,7 @@ function Test-TargetResource $Name, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -313,18 +313,18 @@ function Test-TargetResource if ($Ensure -eq "Present") { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("UsageLogCutTime", - "UsageLogLocation", - "UsageLogMaxFileSizeKB", - "UsageLogMaxSpaceGB", - "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("UsageLogCutTime", + "UsageLogLocation", + "UsageLogMaxFileSizeKB", + "UsageLogMaxSpaceGB", + "Ensure") } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.psm1 index c31cbbec2..77b3e6264 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.psm1 @@ -1,7 +1,7 @@ function Get-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Collections.Hashtable])] param ( @@ -187,7 +187,7 @@ function Get-TargetResource $currentMapping = $syncConnection.PropertyMapping.Item($params.Name) if ($null -ne $currentMapping) { - $mapping = @{} + $mapping = @{ } $mapping.Direction = "Import" $mapping.ConnectionName = $params.MappingConnectionName if ($currentMapping.IsExport) @@ -291,7 +291,7 @@ function Get-TargetResource function Set-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] param ( [Parameter(Mandatory = $true)] @@ -679,7 +679,7 @@ function Set-TargetResource function Test-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Boolean])] param ( diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.psm1 index c45e5751f..48a3b350a 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.psm1 @@ -9,7 +9,7 @@ function Get-TargetResource $Name, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -33,12 +33,12 @@ function Get-TargetResource Write-Verbose -Message "Getting user profile section $Name" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $upsa = Get-SPServiceApplication -Name $params.UserProfileService ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $nullReturn = @{ Name = $params.Name Ensure = "Absent" @@ -51,11 +51,11 @@ function Get-TargetResource } $caURL = (Get-SpWebApplication -IncludeCentralAdministration | Where-Object -FilterScript { - $_.IsAdministrationWebApplication -eq $true - }).Url + $_.IsAdministrationWebApplication -eq $true + }).Url $context = Get-SPServiceContext -Site $caURL - $userProfileConfigManager = New-Object -TypeName "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" ` - -ArgumentList $context + $userProfileConfigManager = New-Object -TypeName "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" ` + -ArgumentList $context $properties = $userProfileConfigManager.GetPropertiesWithSection() $userProfileProperty = $properties.GetSectionByName($params.Name) @@ -86,7 +86,7 @@ function Set-TargetResource $Name, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -114,12 +114,12 @@ function Set-TargetResource $PSBoundParameters.Ensure = $Ensure Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $ups = Get-SPServiceApplication -Name $params.UserProfileService ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $ups) { @@ -127,12 +127,12 @@ function Set-TargetResource } $caURL = (Get-SpWebApplication -IncludeCentralAdministration | Where-Object -FilterScript { - $_.IsAdministrationWebApplication -eq $true - }).Url + $_.IsAdministrationWebApplication -eq $true + }).Url $context = Get-SPServiceContext $caURL - $userProfileConfigManager = New-Object -TypeName "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" ` - -ArgumentList $context + $userProfileConfigManager = New-Object -TypeName "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" ` + -ArgumentList $context if ($null -eq $userProfileConfigManager) { @@ -160,9 +160,9 @@ function Set-TargetResource else { Set-SPDscObjectPropertyIfValuePresent -ObjectToSet $userProfileProperty ` - -PropertyToSet "DisplayName" ` - -ParamsValue $params ` - -ParamKey "DisplayName" + -PropertyToSet "DisplayName" ` + -ParamsValue $params ` + -ParamKey "DisplayName" $userProfileProperty.Commit() } @@ -170,7 +170,7 @@ function Set-TargetResource if ($params.ContainsKey("DisplayOrder")) { $properties = $userProfileConfigManager.GetPropertiesWithSection() - $properties.SetDisplayOrderBySectionName($params.Name,$params.DisplayOrder) + $properties.SetDisplayOrderBySectionName($params.Name, $params.DisplayOrder) $properties.CommitDisplayOrder() } @@ -188,7 +188,7 @@ function Test-TargetResource $Name, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -222,17 +222,17 @@ function Test-TargetResource if ($Ensure -eq "Present") { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name", - "DisplayName", - "DisplayOrder", - "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Name", + "DisplayName", + "DisplayOrder", + "Ensure") } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 index 7bdf5fe40..7c2f88102 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 @@ -57,12 +57,12 @@ function Get-TargetResource $NoILMUsed = $false, [Parameter()] - [ValidateSet("Username_CollisionError","Username_CollisionDomain","Domain_Username")] + [ValidateSet("Username_CollisionError", "Username_CollisionDomain", "Domain_Username")] [System.String] $SiteNamingConflictResolution, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -76,12 +76,12 @@ function Get-TargetResource if ($PSBoundParameters.ContainsKey("MySiteHostLocation") -eq $false) { Write-Verbose -Message ("You should also specify the MySiteHostLocation parameter. " + ` - "This will be required as of SharePointDsc v4.0") + "This will be required as of SharePointDsc v4.0") } $farmAccount = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { return Get-SPDscFarmAccount } @@ -93,8 +93,8 @@ function Get-TargetResource if ($InstallAccount.UserName -eq $farmAccount.UserName) { throw ("Specified InstallAccount ($($InstallAccount.UserName)) is the Farm " + ` - "Account. Make sure the specified InstallAccount isn't the Farm Account " + ` - "and try again") + "Account. Make sure the specified InstallAccount isn't the Farm Account " + ` + "and try again") } } else @@ -107,7 +107,7 @@ function Get-TargetResource if ($localaccount -eq $farmAccount.UserName) { Write-Verbose -Message ("The current user ($localaccount) is the Farm " + ` - "Account. Please note that this will cause issues when applying the configuration.") + "Account. Please note that this will cause issues when applying the configuration.") } } } @@ -118,14 +118,14 @@ function Get-TargetResource } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue $nullReturn = @{ - Name = $params.Name - Ensure = "Absent" + Name = $params.Name + Ensure = "Absent" ApplicationPool = $params.ApplicationPool } if ($null -eq $serviceApps) @@ -142,9 +142,9 @@ function Get-TargetResource } else { - $databases = @{} + $databases = @{ } $propertyFlags = [System.Reflection.BindingFlags]::Instance -bor ` - [System.Reflection.BindingFlags]::NonPublic + [System.Reflection.BindingFlags]::NonPublic $propData = $serviceApp.GetType().GetProperties($propertyFlags) @@ -179,7 +179,7 @@ function Get-TargetResource $upSiteConflictNaming = $null try { - $ca = Get-SPWebApplication -IncludeCentralAdministration | Where-Object -FilterScript {$_.IsAdministrationWebApplication} + $ca = Get-SPWebApplication -IncludeCentralAdministration | Where-Object -FilterScript { $_.IsAdministrationWebApplication } $caSite = $ca.Sites[0] $serviceContext = Get-SPServiceContext($caSite) $userProfileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext) @@ -273,12 +273,12 @@ function Set-TargetResource $NoILMUsed = $false, [Parameter()] - [ValidateSet("Username_CollisionError","Username_CollisionDomain","Domain_Username")] + [ValidateSet("Username_CollisionError", "Username_CollisionDomain", "Domain_Username")] [System.String] $SiteNamingConflictResolution, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -292,14 +292,14 @@ function Set-TargetResource if ($PSBoundParameters.ContainsKey("MySiteHostLocation") -eq $false) { Write-Verbose -Message ("You should also specify the MySiteHostLocation parameter. " + ` - "This will be required as of SharePointDsc v4.0") + "This will be required as of SharePointDsc v4.0") } if ($Ensure -eq "Present") { $farmAccount = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { return Get-SPDscFarmAccount } @@ -311,8 +311,8 @@ function Set-TargetResource if ($InstallAccount.UserName -eq $farmAccount.UserName) { throw ("Specified InstallAccount ($($InstallAccount.UserName)) is the Farm " + ` - "Account. Make sure the specified InstallAccount isn't the Farm Account " + ` - "and try again") + "Account. Make sure the specified InstallAccount isn't the Farm Account " + ` + "and try again") } $setupAccount = $InstallAccount.UserName } @@ -326,8 +326,8 @@ function Set-TargetResource if ($localaccount -eq $farmAccount.UserName) { throw ("Specified PSDSCRunAsCredential ($localaccount) is the Farm " + ` - "Account. Make sure the specified PSDSCRunAsCredential isn't the " + ` - "Farm Account and try again") + "Account. Make sure the specified PSDSCRunAsCredential isn't the " + ` + "Farm Account and try again") } $setupAccount = $localaccount } @@ -356,8 +356,8 @@ function Set-TargetResource } $null = Invoke-SPDscCommand -Credential $FarmAccount ` - -Arguments @($PSBoundParameters, $setupAccount) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $setupAccount) ` + -ScriptBlock { $params = $args[0] $setupAccount = $args[1] @@ -395,12 +395,12 @@ function Set-TargetResource } $params = Rename-SPDscParamValue -params $params ` - -oldName "SyncDBName" ` - -newName "ProfileSyncDBName" + -oldName "SyncDBName" ` + -newName "ProfileSyncDBName" $params = Rename-SPDscParamValue -params $params ` - -oldName "SyncDBServer" ` - -newName "ProfileSyncDBServer" + -oldName "SyncDBServer" ` + -newName "ProfileSyncDBServer" $pName = "$($params.Name) Proxy" @@ -411,7 +411,7 @@ function Set-TargetResource } $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $app = $serviceApps | Select-Object -First 1 if ($null -eq $serviceApps) { @@ -419,25 +419,25 @@ function Set-TargetResource if ($null -eq $app) { throw ("An error occurred during creation of the service application: " + ` - $_.Exception.Message) + $_.Exception.Message) } New-SPProfileServiceApplicationProxy -Name $pName ` - -ServiceApplication $app ` - -DefaultProxyGroup + -ServiceApplication $app ` + -DefaultProxyGroup $claimsPrincipal = New-SPClaimsPrincipal -Identity $setupAccount ` - -IdentityType WindowsSamAccountName + -IdentityType WindowsSamAccountName $serviceAppSecurity = Get-SPServiceApplicationSecurity $app $acl = [Microsoft.SharePoint.Administration.AccessControl.SPNamedIisWebServiceApplicationRights]::FullControl.Name Grant-SPObjectSecurity -Identity $serviceAppSecurity ` - -Principal $claimsPrincipal ` - -Rights $acl + -Principal $claimsPrincipal ` + -Rights $acl Set-SPServiceApplicationSecurity -Identity $app ` - -ObjectSecurity $serviceAppSecurity + -ObjectSecurity $serviceAppSecurity $app = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue } if (($updateEnableNetBIOS -eq $true) -or ($updateNoILMUsed -eq $true)) @@ -458,7 +458,7 @@ function Set-TargetResource if ($updateSiteNamingConflict -eq $true) { - $ca = Get-SPWebApplication -IncludeCentralAdministration | Where-Object -FilterScript {$_.IsAdministrationWebApplication} + $ca = Get-SPWebApplication -IncludeCentralAdministration | Where-Object -FilterScript { $_.IsAdministrationWebApplication } $caSite = $ca.Sites[0] $serviceContext = Get-SPServiceContext($caSite) $userProfileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext) @@ -484,15 +484,15 @@ function Set-TargetResource { Write-Verbose -Message "Removing user profile service application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $app = Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Server.Administration.UserProfileApplication" - } + | Where-Object -FilterScript { + $_.GetType().FullName -eq "Microsoft.Office.Server.Administration.UserProfileApplication" + } $proxies = Get-SPServiceApplicationProxy foreach ($proxyInstance in $proxies) @@ -567,12 +567,12 @@ function Test-TargetResource $NoILMUsed = $false, [Parameter()] - [ValidateSet("Username_CollisionError","Username_CollisionDomain","Domain_Username")] + [ValidateSet("Username_CollisionError", "Username_CollisionDomain", "Domain_Username")] [System.String] $SiteNamingConflictResolution, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -586,7 +586,7 @@ function Test-TargetResource if ($PSBoundParameters.ContainsKey("MySiteHostLocation") -eq $false) { Write-Verbose -Message ("You should also specify the MySiteHostLocation parameter. " + ` - "This will be required as of SharePointDsc v4.0") + "This will be required as of SharePointDsc v4.0") } $PSBoundParameters.Ensure = $Ensure @@ -599,18 +599,18 @@ function Test-TargetResource if ($Ensure -eq "Present") { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name", - "EnableNetBIOS", - "NoILMUsed", - "SiteNamingConflictResolution", - "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Name", + "EnableNetBIOS", + "NoILMUsed", + "SiteNamingConflictResolution", + "Ensure") } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Name", "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Name", "Ensure") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.psm1 index c84bbec1d..2874582e7 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.psm1 @@ -80,7 +80,7 @@ function Get-TargetResource $useTagsAndNotes += $user } if (($securityEntry.AllowedRights.ToString() -like "*CreatePersonalSite*") ` - -and ($securityEntry.AllowedRights.ToString() -like "*UseMicrobloggingAndFollowing*")) + -and ($securityEntry.AllowedRights.ToString() -like "*UseMicrobloggingAndFollowing*")) { $createPersonalSite += $user } @@ -143,12 +143,12 @@ function Set-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters if ($CurrentValues.CreatePersonalSite -contains "NT AUTHORITY\Authenticated Users" ` - -or $CurrentValues.FollowAndEditProfile -contains "NT AUTHORITY\Authenticated Users" ` - -or $CurrentValues.UseTagsAndNotes -contains "NT AUTHORITY\Authenticated Users") + -or $CurrentValues.FollowAndEditProfile -contains "NT AUTHORITY\Authenticated Users" ` + -or $CurrentValues.UseTagsAndNotes -contains "NT AUTHORITY\Authenticated Users") { Write-Warning -Message ("Permissions were found for the non-claims identity " + ` - "'NT AUTHORITY\Authenticated Users'. This will be removed as " + ` - "identies on service app proxy permissions should be claims based.") + "'NT AUTHORITY\Authenticated Users'. This will be removed as " + ` + "identies on service app proxy permissions should be claims based.") Invoke-SPDscCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] @@ -187,7 +187,7 @@ function Set-TargetResource foreach ($permission in $permissionsToUpdate.Keys) { $permissionsDiff = Compare-Object -ReferenceObject $CurrentValues.$permission ` - -DifferenceObject $params.$permission + -DifferenceObject $params.$permission $everyoneDiff = $permissionsDiff | Where-Object -FilterScript { $_.InputObject -eq "Everyone" } $noneDiff = $permissionsDiff | Where-Object -FilterScript { $_.InputObject -eq "None" } @@ -203,25 +203,25 @@ function Set-TargetResource if ($isUser -eq $true) { $claim = New-SPClaimsPrincipal -Identity $user ` - -IdentityType WindowsSamAccountName + -IdentityType WindowsSamAccountName } else { $claim = New-SPClaimsPrincipal -Identity $user ` - -IdentityType WindowsSecurityGroupName + -IdentityType WindowsSecurityGroupName } Revoke-SPObjectSecurity -Identity $security ` - -Principal $claim ` - -Rights $permissionsToUpdate.$permission + -Principal $claim ` + -Rights $permissionsToUpdate.$permission } elseif ($user -eq "Everyone") { # Revoke the all user permissions $allClaimsUsersClaim = New-SPClaimsPrincipal -Identity "c:0(.s|true" ` - -IdentityType EncodedClaim + -IdentityType EncodedClaim Revoke-SPObjectSecurity -Identity $security ` - -Principal $allClaimsUsersClaim ` - -Rights $permissionsToUpdate.$permission + -Principal $allClaimsUsersClaim ` + -Rights $permissionsToUpdate.$permission } } } @@ -237,24 +237,24 @@ function Set-TargetResource if ($isUser -eq $true) { $claim = New-SPClaimsPrincipal -Identity $user ` - -IdentityType WindowsSamAccountName + -IdentityType WindowsSamAccountName } else { $claim = New-SPClaimsPrincipal -Identity $user ` - -IdentityType WindowsSecurityGroupName + -IdentityType WindowsSecurityGroupName } Revoke-SPObjectSecurity -Identity $security ` - -Principal $claim ` - -Rights $permissionsToUpdate.$permission + -Principal $claim ` + -Rights $permissionsToUpdate.$permission } } $allClaimsUsersClaim = New-SPClaimsPrincipal -Identity "c:0(.s|true" ` - -IdentityType EncodedClaim + -IdentityType EncodedClaim Grant-SPObjectSecurity -Identity $security ` - -Principal $allClaimsUsersClaim ` - -Rights $permissionsToUpdate.$permission + -Principal $allClaimsUsersClaim ` + -Rights $permissionsToUpdate.$permission } else { @@ -262,32 +262,32 @@ function Set-TargetResource foreach ($permissionChange in $permissionsDiff) { if ($permissionChange.InputObject -ne "Everyone" -and ` - $permissionChange.InputObject -ne "None") + $permissionChange.InputObject -ne "None") { $isUser = Test-SPDscIsADUser -IdentityName $permissionChange.InputObject if ($isUser -eq $true) { $claim = New-SPClaimsPrincipal -Identity $permissionChange.InputObject ` - -IdentityType WindowsSamAccountName + -IdentityType WindowsSamAccountName } else { $claim = New-SPClaimsPrincipal -Identity $permissionChange.InputObject ` - -IdentityType WindowsSecurityGroupName + -IdentityType WindowsSecurityGroupName } if ($permissionChange.SideIndicator -eq "=>") { # Grant permission to the identity Grant-SPObjectSecurity -Identity $security ` - -Principal $claim ` - -Rights $permissionsToUpdate.$permission + -Principal $claim ` + -Rights $permissionsToUpdate.$permission } if ($permissionChange.SideIndicator -eq "<=") { # Revoke permission for the identity Revoke-SPObjectSecurity -Identity $security ` - -Principal $claim ` - -Rights $permissionsToUpdate.$permission + -Principal $claim ` + -Rights $permissionsToUpdate.$permission } } } @@ -295,8 +295,8 @@ function Set-TargetResource } Set-SPProfileServiceApplicationSecurity -Identity $security ` - -ProfileServiceApplicationProxy $proxy ` - -Confirm:$false + -ProfileServiceApplicationProxy $proxy ` + -Confirm:$false } } @@ -337,10 +337,10 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("CreatePersonalSite", ` - "FollowAndEditProfile", ` - "UseTagsAndNotes") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("CreatePersonalSite", ` + "FollowAndEditProfile", ` + "UseTagsAndNotes") } function Confirm-SPDscUpaPermissionsConfig() @@ -361,7 +361,7 @@ function Confirm-SPDscUpaPermissionsConfig() if (($Parameters.$_ -contains "Everyone") -and ($Parameters.$_ -contains "None")) { throw ("You can not specify 'Everyone' and 'None' in the same property. " + ` - "Check the value for the '$_' property on this resource.") + "Check the value for the '$_' property on this resource.") } } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.psm1 index f9dafe62f..9b61f5040 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.psm1 @@ -49,12 +49,12 @@ function Get-TargetResource $UseDisabledFilter, [Parameter()] - [ValidateSet("ActiveDirectory","BusinessDataCatalog")] + [ValidateSet("ActiveDirectory", "BusinessDataCatalog")] [System.String] $ConnectionType, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -66,12 +66,12 @@ function Get-TargetResource Write-Verbose -Message "Getting user profile service sync connection $Name" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $ups = Get-SPServiceApplication -Name $params.UserProfileService ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $nullReturn = @{ Name = $params.Name @@ -97,7 +97,7 @@ function Get-TargetResource { $context = Get-SPDscServiceContext -ProxyGroup $ups.ServiceApplicationProxyGroup $upcm = New-Object -TypeName "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" ` - -ArgumentList $context + -ArgumentList $context $Name = $params.Name $connection = $upcm.ConnectionManager | Where-Object -FilterScript { @@ -169,7 +169,7 @@ function Get-TargetResource Port = $params.Port UseSSL = $useSSL UseDisabledFilter = $useDisabledFilter - ConnectionType = $connection.Type -replace "Import","" + ConnectionType = $connection.Type -replace "Import", "" Force = $params.Force Ensure = "Present" } @@ -266,19 +266,19 @@ function Set-TargetResource $UseDisabledFilter, [Parameter()] - [ValidateSet("ActiveDirectory","BusinessDataCatalog")] + [ValidateSet("ActiveDirectory", "BusinessDataCatalog")] [System.String] $ConnectionType, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", [Parameter()] [System.Management.Automation.PSCredential] $InstallAccount - ) + ) Write-Verbose -Message "Setting user profile service sync connection $Name" @@ -294,7 +294,7 @@ function Set-TargetResource if ($UseSSL -eq $true -and $PSBoundParameters.ContainsKey("Port") -eq $false) { Write-Verbose -Message ("UseSSL is set to True, but no port is specified. Assuming " + ` - "that port 636 (default LDAPS port) is to be used.") + "that port 636 (default LDAPS port) is to be used.") $PSBoundParameters.Port = 636 } } @@ -316,7 +316,7 @@ function Set-TargetResource if ($PSBoundParameters.ContainsKey("UseDisabledFilter") -eq $false) { Write-Verbose -Message ("UseDisabledFilter is not specified. Assuming that disabled " + ` - "accounts should not be filtered.") + "accounts should not be filtered.") $PSBoundParameters.UseDisabledFilter = $false } else @@ -328,8 +328,8 @@ function Set-TargetResource } Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -350,7 +350,7 @@ function Set-TargetResource Write-Verbose -Message "retrieving UserProfileConfigManager " $upcm = New-Object -TypeName "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" ` - -ArgumentList @($context) + -ArgumentList @($context) if ($upcm.IsSynchronizationRunning()) { @@ -374,10 +374,10 @@ function Set-TargetResource if ($params.Ensure -eq "Present") { - if ($null -ne $connection -and $params.Forest -ieq $connection.Server) + if ($null -ne $connection -and $params.Forest -ieq $connection.Server) { $domain = $params.ConnectionCredentials.UserName.Split("\")[0] - $userName= $params.ConnectionCredentials.UserName.Split("\")[1] + $userName = $params.ConnectionCredentials.UserName.Split("\")[1] $connection.SetCredentials($domain, $userName, $params.ConnectionCredentials.Password) $connection.NamingContexts | ForEach-Object -Process { @@ -385,14 +385,14 @@ function Set-TargetResource if ($params.ContainsKey("IncludedOUs")) { $namingContext.ContainersIncluded.Clear() - $params.IncludedOUs| ForEach-Object -Process { + $params.IncludedOUs | ForEach-Object -Process { $namingContext.ContainersIncluded.Add($_) } } $namingContext.ContainersExcluded.Clear() if ($params.ContainsKey("ExcludedOUs")) { - $params.IncludedOUs| ForEach-Object -Process { + $params.IncludedOUs | ForEach-Object -Process { $namingContext.ContainersExcluded.Add($_) } } @@ -407,15 +407,15 @@ function Set-TargetResource Write-Verbose -Message "Creating a new connection " $userDomain = $params.ConnectionCredentials.UserName.Split("\")[0] - $userName= $params.ConnectionCredentials.UserName.Split("\")[1] + $userName = $params.ConnectionCredentials.UserName.Split("\")[1] $installedVersion = Get-SPDscInstalledProductVersion - switch($installedVersion.FileMajorPart) + switch ($installedVersion.FileMajorPart) { 15 { - if ($null -ne $connection -and $params.Forest -ine $connection.Server) + if ($null -ne $connection -and $params.Forest -ine $connection.Server) { if ($params.ContainsKey("Force") -and $params.Force -eq $true) { @@ -448,42 +448,42 @@ function Set-TargetResource $list = New-Object -TypeName System.Collections.Generic.List[[Microsoft.Office.Server.UserProfiles.DirectoryServiceNamingContext]] - $partition = Get-SPDscADSIObject -LdapPath ("LDAP://" +("DC=" + $params.Forest.Replace(".", ",DC="))) + $partition = Get-SPDscADSIObject -LdapPath ("LDAP://" + ("DC=" + $params.Forest.Replace(".", ",DC="))) $list.Add((New-Object -TypeName "Microsoft.Office.Server.UserProfiles.DirectoryServiceNamingContext" ` - -ArgumentList @( - $partition.distinguishedName, - $params.Forest, - $false, - (New-Object -TypeName "System.Guid" ` - -ArgumentList $partition.objectGUID), - $listIncludedOUs, - $listExcludedOUs, - $null , - $false))) + -ArgumentList @( + $partition.distinguishedName, + $params.Forest, + $false, + (New-Object -TypeName "System.Guid" ` + -ArgumentList $partition.objectGUID), + $listIncludedOUs, + $listExcludedOUs, + $null , + $false))) $partition = Get-SPDscADSIObject -LdapPath ("LDAP://CN=Configuration," + ("DC=" + $params.Forest.Replace(".", ",DC="))) $list.Add((New-Object -TypeName "Microsoft.Office.Server.UserProfiles.DirectoryServiceNamingContext" ` - -ArgumentList @( - $partition.distinguishedName, - $params.Forest, - $true, - (New-Object -TypeName "System.Guid" ` - -ArgumentList $partition.objectGUID), - $listIncludedOUs , - $listExcludedOUs , - $null , - $false))) + -ArgumentList @( + $partition.distinguishedName, + $params.Forest, + $true, + (New-Object -TypeName "System.Guid" ` + -ArgumentList $partition.objectGUID), + $listIncludedOUs , + $listExcludedOUs , + $null , + $false))) Write-Verbose -Message "Creating the new connection via object model (SP2013)" - $upcm.ConnectionManager.AddActiveDirectoryConnection( [Microsoft.Office.Server.UserProfiles.ConnectionType]::ActiveDirectory, ` - $params.Name, ` - $params.Forest, ` - $params.UseSSL, ` - $userDomain, ` - $userName, ` - $params.ConnectionCredentials.Password, ` - $list, ` - $null,` - $null) | Out-Null + $upcm.ConnectionManager.AddActiveDirectoryConnection( [Microsoft.Office.Server.UserProfiles.ConnectionType]::ActiveDirectory, ` + $params.Name, ` + $params.Forest, ` + $params.UseSSL, ` + $userDomain, ` + $userName, ` + $params.ConnectionCredentials.Password, ` + $list, ` + $null, ` + $null) | Out-Null } 16 { @@ -492,25 +492,25 @@ function Set-TargetResource foreach ($ou in $params.IncludedOUs) { Add-SPProfileSyncConnection -ProfileServiceApplication $ups ` - -ConnectionForestName $params.Forest ` - -ConnectionDomain $userDomain ` - -ConnectionUserName $userName ` - -ConnectionPassword $params.ConnectionCredentials.Password ` - -ConnectionUseSSL $params.UseSSL ` - -ConnectionSynchronizationOU $ou ` - -ConnectionPort $params.Port ` - -ConnectionUseDisabledFilter $params.UseDisabledFilter + -ConnectionForestName $params.Forest ` + -ConnectionDomain $userDomain ` + -ConnectionUserName $userName ` + -ConnectionPassword $params.ConnectionCredentials.Password ` + -ConnectionUseSSL $params.UseSSL ` + -ConnectionSynchronizationOU $ou ` + -ConnectionPort $params.Port ` + -ConnectionUseDisabledFilter $params.UseDisabledFilter } Write-Verbose -Message "Removing ExcludedOUs from the connection" foreach ($ou in $params.ExcludedOUs) { Remove-SPProfilesyncConnection -ProfileServiceApplication $ups ` - -ConnectionForestName $params.Forest ` - -ConnectionDomain $userDomain ` - -ConnectionUserName $userName ` - -ConnectionPassword $params.ConnectionCredentials.Password ` - -ConnectionSynchronizationOU $ou + -ConnectionForestName $params.Forest ` + -ConnectionDomain $userDomain ` + -ConnectionUserName $userName ` + -ConnectionPassword $params.ConnectionCredentials.Password ` + -ConnectionSynchronizationOU $ou } } } @@ -578,12 +578,12 @@ function Test-TargetResource $UseDisabledFilter, [Parameter()] - [ValidateSet("ActiveDirectory","BusinessDataCatalog")] + [ValidateSet("ActiveDirectory", "BusinessDataCatalog")] [System.String] $ConnectionType, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -603,10 +603,10 @@ function Test-TargetResource $installedVersion = Get-SPDscInstalledProductVersion $valuesToCheck = @("Forest", - "UserProfileService", - "UseSSL", - "IncludedOUs", - "Ensure") + "UserProfileService", + "UseSSL", + "IncludedOUs", + "Ensure") if ($installedVersion.FileMajorPart -eq 15) { @@ -620,8 +620,8 @@ function Test-TargetResource } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck $valuesToCheck + -DesiredValues $PSBoundParameters ` + -ValuesToCheck $valuesToCheck } <# diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.psm1 index cc8d11e24..42e90a25f 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.psm1 @@ -9,7 +9,7 @@ function Get-TargetResource $UserProfileServiceAppName, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", [Parameter()] @@ -30,12 +30,12 @@ function Get-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -ne 15) { throw [Exception] ("Only SharePoint 2013 is supported to deploy the user profile sync " + ` - "service via DSC, as 2016/2019 do not use the FIM based sync service.") + "service via DSC, as 2016/2019 do not use the FIM based sync service.") } $farmAccount = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { return Get-SPDscFarmAccount } @@ -47,11 +47,12 @@ function Get-TargetResource if ($InstallAccount.UserName -eq $farmAccount.UserName) { throw ("Specified InstallAccount ($($InstallAccount.UserName)) is the Farm " + ` - "Account. Make sure the specified InstallAccount isn't the Farm Account " + ` - "and try again") + "Account. Make sure the specified InstallAccount isn't the Farm Account " + ` + "and try again") } } - else { + else + { # PSDSCRunAsCredential or System if (-not $Env:USERNAME.Contains("$")) { @@ -60,8 +61,8 @@ function Get-TargetResource if ($localaccount -eq $farmAccount.UserName) { throw ("Specified PSDSCRunAsCredential ($localaccount) is the Farm " + ` - "Account. Make sure the specified PSDSCRunAsCredential isn't the " + ` - "Farm Account and try again") + "Account. Make sure the specified PSDSCRunAsCredential isn't the " + ` + "Farm Account and try again") } } } @@ -72,12 +73,12 @@ function Get-TargetResource } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $services = Get-SPServiceInstance -Server $env:COMPUTERNAME ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $services) { @@ -98,7 +99,7 @@ function Get-TargetResource $domain = (Get-CimInstance -ClassName Win32_ComputerSystem).Domain $currentServer = "$($env:COMPUTERNAME).$domain" $services = Get-SPServiceInstance -Server $currentServer ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $syncService = $services | Where-Object -FilterScript { $_.GetType().Name -eq "ProfileSynchronizationServiceInstance" } @@ -114,10 +115,10 @@ function Get-TargetResource } } if ($null -ne $syncService.UserProfileApplicationGuid -and ` - $syncService.UserProfileApplicationGuid -ne [Guid]::Empty) + $syncService.UserProfileApplicationGuid -ne [Guid]::Empty) { $upa = Get-SPServiceApplication -Identity $syncService.UserProfileApplicationGuid ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue } if ($syncService.Status -eq "Online") { @@ -150,7 +151,7 @@ function Set-TargetResource $UserProfileServiceAppName, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", [Parameter()] @@ -173,12 +174,12 @@ function Set-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -ne 15) { throw [Exception] ("Only SharePoint 2013 is supported to deploy the user profile sync " + ` - "service via DSC, as 2016/2019 do not use the FIM based sync service.") + "service via DSC, as 2016/2019 do not use the FIM based sync service.") } $farmAccount = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { return Get-SPDscFarmAccount } @@ -190,11 +191,12 @@ function Set-TargetResource if ($InstallAccount.UserName -eq $farmAccount.UserName) { throw ("Specified InstallAccount ($($InstallAccount.UserName)) is the Farm " + ` - "Account. Make sure the specified InstallAccount isn't the Farm Account " + ` - "and try again") + "Account. Make sure the specified InstallAccount isn't the Farm Account " + ` + "and try again") } } - else { + else + { # PSDSCRunAsCredential or System if (-not $Env:USERNAME.Contains("$")) { @@ -203,8 +205,8 @@ function Set-TargetResource if ($localaccount -eq $farmAccount.UserName) { throw ("Specified PSDSCRunAsCredential ($localaccount) is the Farm " + ` - "Account. Make sure the specified PSDSCRunAsCredential isn't the " + ` - "Farm Account and try again") + "Account. Make sure the specified PSDSCRunAsCredential isn't the " + ` + "Farm Account and try again") } } } @@ -217,13 +219,13 @@ function Set-TargetResource if ($PSBoundParameters.ContainsKey("RunOnlyWhenWriteable") -eq $true) { $databaseReadOnly = Test-SPDscUserProfileDBReadOnly ` - -UserProfileServiceAppName $UserProfileServiceAppName ` - -InstallAccount $InstallAccount + -UserProfileServiceAppName $UserProfileServiceAppName ` + -InstallAccount $InstallAccount if ($databaseReadOnly) { Write-Verbose -Message ("User profile database is read only, setting user profile " + ` - "sync service to not run on the local server") + "sync service to not run on the local server") $PSBoundParameters.Ensure = "Absent" } else @@ -251,15 +253,15 @@ function Set-TargetResource try { Invoke-SPDscCommand -Credential $FarmAccount ` - -Arguments ($PSBoundParameters,$farmAccount) ` - -ScriptBlock { + -Arguments ($PSBoundParameters, $farmAccount) ` + -ScriptBlock { $params = $args[0] $farmAccount = $args[1] $currentServer = $env:COMPUTERNAME $services = Get-SPServiceInstance -Server $currentServer ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $syncService = $services | Where-Object -FilterScript { $_.GetType().Name -eq "ProfileSynchronizationServiceInstance" } @@ -280,11 +282,11 @@ function Set-TargetResource if (($params.Ensure -eq "Present") -and ($syncService.Status -ne "Online")) { $ups = Get-SPServiceApplication -Name $params.UserProfileServiceAppName ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $ups) { throw [Exception] ("No User Profile Service Application was found " + ` - "named $($params.UserProfileServiceAppName)") + "named $($params.UserProfileServiceAppName)") } $userName = $farmAccount.UserName @@ -314,11 +316,11 @@ function Set-TargetResource # Get the current status of the Sync service Write-Verbose -Message ("$([DateTime]::Now.ToShortTimeString()) - Waiting for user " + ` - "profile sync service to become '$desiredState' (waited " + ` - "$count of $maxCount minutes)") + "profile sync service to become '$desiredState' (waited " + ` + "$count of $maxCount minutes)") $services = Get-SPServiceInstance -Server $currentServer ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $syncService = $services | Where-Object -FilterScript { $_.GetType().Name -eq "ProfileSynchronizationServiceInstance" } @@ -359,7 +361,7 @@ function Test-TargetResource $UserProfileServiceAppName, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", [Parameter()] @@ -382,7 +384,7 @@ function Test-TargetResource if ((Get-SPDscInstalledProductVersion).FileMajorPart -ne 15) { throw [Exception] ("Only SharePoint 2013 is supported to deploy the user profile sync " + ` - "service via DSC, as 2016/2019 do not use the FIM based sync service.") + "service via DSC, as 2016/2019 do not use the FIM based sync service.") } $CurrentValues = Get-TargetResource @PSBoundParameters @@ -393,13 +395,13 @@ function Test-TargetResource if ($PSBoundParameters.ContainsKey("RunOnlyWhenWriteable") -eq $true) { $databaseReadOnly = Test-SPDscUserProfileDBReadOnly ` - -UserProfileServiceAppName $UserProfileServiceAppName ` - -InstallAccount $InstallAccount + -UserProfileServiceAppName $UserProfileServiceAppName ` + -InstallAccount $InstallAccount if ($databaseReadOnly) { Write-Verbose -Message ("User profile database is read only, setting user profile " + ` - "sync service to not run on the local server") + "sync service to not run on the local server") $PSBoundParameters.Ensure = "Absent" } else @@ -409,8 +411,8 @@ function Test-TargetResource } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } function Test-SPDscUserProfileDBReadOnly() @@ -426,16 +428,16 @@ function Test-SPDscUserProfileDBReadOnly() ) $databaseReadOnly = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $UserProfileServiceAppName ` - -ScriptBlock { + -Arguments $UserProfileServiceAppName ` + -ScriptBlock { $UserProfileServiceAppName = $args[0] $serviceApps = Get-SPServiceApplication -Name $UserProfileServiceAppName ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $serviceApps) { throw [Exception] ("No user profile service was found " + ` - "named $UserProfileServiceAppName") + "named $UserProfileServiceAppName") } $ups = $serviceApps | Where-Object -FilterScript { $_.GetType().FullName -eq "Microsoft.Office.Server.Administration.UserProfileApplication" @@ -443,7 +445,7 @@ function Test-SPDscUserProfileDBReadOnly() $propType = $ups.GetType() $propData = $propType.GetProperties([System.Reflection.BindingFlags]::Instance -bor ` - [System.Reflection.BindingFlags]::NonPublic) + [System.Reflection.BindingFlags]::NonPublic) $profileProp = $propData | Where-Object -FilterScript { $_.Name -eq "ProfileDatabase" } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.psm1 index f9ebee29a..5219f5c09 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.psm1 @@ -17,7 +17,7 @@ function Get-TargetResource $ProxyName, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -29,12 +29,12 @@ function Get-TargetResource Write-Verbose -Message "Getting Visio Graphics service app '$Name'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $nullReturn = @{ Name = $params.Name ApplicationPool = $params.ApplicationPool @@ -96,7 +96,7 @@ function Set-TargetResource $ProxyName, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -113,12 +113,12 @@ function Set-TargetResource { Write-Verbose -Message "Creating Visio Graphics Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $visioApp = New-SPVisioServiceApplication -Name $params.Name ` - -ApplicationPool $params.ApplicationPool + -ApplicationPool $params.ApplicationPool if ($params.ContainsKey("ProxyName")) { @@ -133,7 +133,7 @@ function Set-TargetResource if ($null -ne $visioApp) { New-SPVisioServiceApplicationProxy -Name $pName ` - -ServiceApplication $visioApp.Name | Out-Null + -ServiceApplication $visioApp.Name | Out-Null } } } @@ -143,16 +143,16 @@ function Set-TargetResource { Write-Verbose -Message "Updating Visio Graphics Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Visio.Server.Administration.VisioGraphicsServiceApplication" - } | Set-SPVisioServiceApplication -ServiceApplicationPool $appPool + | Where-Object -FilterScript { + $_.GetType().FullName -eq "Microsoft.Office.Visio.Server.Administration.VisioGraphicsServiceApplication" + } | Set-SPVisioServiceApplication -ServiceApplicationPool $appPool } } } @@ -161,14 +161,14 @@ function Set-TargetResource { Write-Verbose -Message "Removing Visio service application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $app = Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Visio.Server.Administration.VisioGraphicsServiceApplication" - } + | Where-Object -FilterScript { + $_.GetType().FullName -eq "Microsoft.Office.Visio.Server.Administration.VisioGraphicsServiceApplication" + } $proxies = Get-SPServiceApplicationProxy foreach ($proxyInstance in $proxies) @@ -203,7 +203,7 @@ function Test-TargetResource $ProxyName, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -222,8 +222,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ApplicationPool", "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("ApplicationPool", "Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.psm1 index 85ae1c628..c894c58e6 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.psm1 @@ -174,12 +174,12 @@ function Set-TargetResource if ($null -eq $web) { @("InstallAccount", "Ensure", "RequestAccessEmail") | - ForEach-Object -Process { - if ($params.ContainsKey($_) -eq $true) - { - $params.Remove($_) | Out-Null - } + ForEach-Object -Process { + if ($params.ContainsKey($_) -eq $true) + { + $params.Remove($_) | Out-Null } + } New-SPWeb @params | Out-Null } @@ -332,8 +332,8 @@ function Test-TargetResource } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck $valuesToCheck + -DesiredValues $PSBoundParameters ` + -ValuesToCheck $valuesToCheck } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.schema.mof b/Modules/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.schema.mof index 5507ff080..a52286e4e 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.schema.mof +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.schema.mof @@ -10,7 +10,7 @@ class MSFT_SPWeb : OMI_BaseResource [Write, Description("True if the web should have unique permissions, otherwise false.")] Boolean UniquePermissions; [Write, Description("True if the web should use the parent nav bar, otherwise false.")] Boolean UseParentTopNav; [Write, Description("True if the web should be in the quick launch of the parent web, otherwise false.")] Boolean AddToQuickLaunch; - [Write, Description("True if the web should be added to the top nav bar of the parent web, otherwise false.")] Boolean AddToTopNav; + [Write, Description("True if the web should be added to the top nav bar of the parent web, otherwise false.")] Boolean AddToTopNav; [Write, Description("The e-mail address to which requests for access are sent. Set to emtpy string to disable access requests.")] string RequestAccessEmail; [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppAuthentication/MSFT_SPWebAppAuthentication.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppAuthentication/MSFT_SPWebAppAuthentication.psm1 index 23ca8cceb..564c64b01 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppAuthentication/MSFT_SPWebAppAuthentication.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppAuthentication/MSFT_SPWebAppAuthentication.psm1 @@ -1,7 +1,7 @@ function Get-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Collections.Hashtable])] param ( @@ -46,10 +46,10 @@ function Get-TargetResource } if ($PSBoundParameters.ContainsKey("Default") -eq $false -and ` - $PSBoundParameters.ContainsKey("Intranet") -eq $false -and ` - $PSBoundParameters.ContainsKey("Internet") -eq $false -and ` - $PSBoundParameters.ContainsKey("Extranet") -eq $false -and ` - $PSBoundParameters.ContainsKey("Custom") -eq $false) + $PSBoundParameters.ContainsKey("Intranet") -eq $false -and ` + $PSBoundParameters.ContainsKey("Internet") -eq $false -and ` + $PSBoundParameters.ContainsKey("Extranet") -eq $false -and ` + $PSBoundParameters.ContainsKey("Custom") -eq $false) { Write-Verbose -Message "You have to specify at least one zone." return $nullreturn @@ -101,8 +101,8 @@ function Get-TargetResource } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue @@ -130,10 +130,10 @@ function Get-TargetResource $authProviders = Get-SPAuthenticationProvider -WebApplication $params.WebAppUrl -Zone $zone if ($null -eq $authProviders) { - $localAuthMode = "Classic" + $localAuthMode = "Classic" $authenticationProvider = $null - $roleProvider = $null - $membershipProvider = $null + $roleProvider = $null + $membershipProvider = $null $provider = @{ AuthenticationMethod = $localAuthMode @@ -143,21 +143,31 @@ function Get-TargetResource } switch ($zone) { - "Default" { $default += $provider } - "Intranet" { $intranet += $provider } - "Internet" { $internet += $provider } - "Extranet" { $extranet += $provider } - "Custom" { $custom += $provider } + "Default" + { $default += $provider + } + "Intranet" + { $intranet += $provider + } + "Internet" + { $internet += $provider + } + "Extranet" + { $extranet += $provider + } + "Custom" + { $custom += $provider + } } } else { foreach ($authProvider in $authProviders) { - $localAuthMode = $null + $localAuthMode = $null $authenticationProvider = $null - $roleProvider = $null - $membershipProvider = $null + $roleProvider = $null + $membershipProvider = $null if ($authProvider.DisplayName -eq "Windows Authentication") { @@ -172,9 +182,9 @@ function Get-TargetResource } elseif ($authProvider.DisplayName -eq "Forms Authentication") { - $localAuthMode = "FBA" - $roleProvider = $authProvider.RoleProvider - $membershipProvider = $authProvider.MembershipProvider + $localAuthMode = "FBA" + $roleProvider = $authProvider.RoleProvider + $membershipProvider = $authProvider.MembershipProvider } else { @@ -190,11 +200,21 @@ function Get-TargetResource } switch ($zone) { - "Default" { $default += $provider } - "Intranet" { $intranet += $provider } - "Internet" { $internet += $provider } - "Extranet" { $extranet += $provider } - "Custom" { $custom += $provider } + "Default" + { $default += $provider + } + "Intranet" + { $intranet += $provider + } + "Internet" + { $internet += $provider + } + "Extranet" + { $extranet += $provider + } + "Custom" + { $custom += $provider + } } } } @@ -215,7 +235,7 @@ function Get-TargetResource function Set-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] param ( [Parameter(Mandatory = $true)] @@ -251,10 +271,10 @@ function Set-TargetResource # Test is at least one zone is specified if ($PSBoundParameters.ContainsKey("Default") -eq $false -and ` - $PSBoundParameters.ContainsKey("Intranet") -eq $false -and ` - $PSBoundParameters.ContainsKey("Internet") -eq $false -and ` - $PSBoundParameters.ContainsKey("Extranet") -eq $false -and ` - $PSBoundParameters.ContainsKey("Custom") -eq $false) + $PSBoundParameters.ContainsKey("Intranet") -eq $false -and ` + $PSBoundParameters.ContainsKey("Internet") -eq $false -and ` + $PSBoundParameters.ContainsKey("Extranet") -eq $false -and ` + $PSBoundParameters.ContainsKey("Custom") -eq $false) { throw "You have to specify at least one zone." } @@ -287,8 +307,8 @@ function Set-TargetResource # Get current authentication method $authMethod = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue @@ -344,7 +364,7 @@ function Set-TargetResource { # Test is current config matches desired config $result = Test-ZoneConfiguration -DesiredConfig $Default ` - -CurrentConfig $CurrentValues.Default + -CurrentConfig $CurrentValues.Default # If that is the case, set desired config. if ($result -eq $false) @@ -363,7 +383,7 @@ function Set-TargetResource # Test is current config matches desired config $result = Test-ZoneConfiguration -DesiredConfig $Intranet ` - -CurrentConfig $CurrentValues.Intranet + -CurrentConfig $CurrentValues.Intranet # If that is the case, set desired config. if ($result -eq $false) @@ -382,7 +402,7 @@ function Set-TargetResource # Test is current config matches desired config $result = Test-ZoneConfiguration -DesiredConfig $Internet ` - -CurrentConfig $CurrentValues.Internet + -CurrentConfig $CurrentValues.Internet # If that is the case, set desired config. if ($result -eq $false) @@ -401,7 +421,7 @@ function Set-TargetResource # Test is current config matches desired config $result = Test-ZoneConfiguration -DesiredConfig $Extranet ` - -CurrentConfig $CurrentValues.Extranet + -CurrentConfig $CurrentValues.Extranet # If that is the case, set desired config. if ($result -eq $false) @@ -420,7 +440,7 @@ function Set-TargetResource # Test is current config matches desired config $result = Test-ZoneConfiguration -DesiredConfig $Custom ` - -CurrentConfig $CurrentValues.Custom + -CurrentConfig $CurrentValues.Custom # If that is the case, set desired config. if ($result -eq $false) @@ -433,7 +453,7 @@ function Set-TargetResource function Test-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Boolean])] param ( @@ -474,10 +494,10 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" if ($null -eq $CurrentValues.Default -and ` - $null -eq $CurrentValues.Intranet -and ` - $null -eq $CurrentValues.Internet -and ` - $null -eq $CurrentValues.Extranet -and ` - $null -eq $CurrentValues.Custom) + $null -eq $CurrentValues.Intranet -and ` + $null -eq $CurrentValues.Internet -and ` + $null -eq $CurrentValues.Extranet -and ` + $null -eq $CurrentValues.Custom) { return $false } @@ -485,7 +505,7 @@ function Test-TargetResource if ($PSBoundParameters.ContainsKey("Default")) { $result = Test-ZoneConfiguration -DesiredConfig $Default ` - -CurrentConfig $CurrentValues.Default + -CurrentConfig $CurrentValues.Default if ($result -eq $false) { @@ -501,7 +521,7 @@ function Test-TargetResource } $result = Test-ZoneConfiguration -DesiredConfig $Intranet ` - -CurrentConfig $CurrentValues.Intranet + -CurrentConfig $CurrentValues.Intranet if ($result -eq $false) { @@ -517,7 +537,7 @@ function Test-TargetResource } $result = Test-ZoneConfiguration -DesiredConfig $Internet ` - -CurrentConfig $CurrentValues.Internet + -CurrentConfig $CurrentValues.Internet if ($result -eq $false) { @@ -533,7 +553,7 @@ function Test-TargetResource } $result = Test-ZoneConfiguration -DesiredConfig $Extranet ` - -CurrentConfig $CurrentValues.Extranet + -CurrentConfig $CurrentValues.Extranet if ($result -eq $false) { @@ -549,7 +569,7 @@ function Test-TargetResource } $result = Test-ZoneConfiguration -DesiredConfig $Custom ` - -CurrentConfig $CurrentValues.Custom + -CurrentConfig $CurrentValues.Custom if ($result -eq $false) { @@ -573,7 +593,7 @@ function Test-Parameter() $Exception ) - $ntlmUsed = $false + $ntlmUsed = $false $kerberosUsed = $false foreach ($zoneConfig in $Zone) { @@ -609,14 +629,15 @@ function Test-Parameter() switch ($zoneConfig.AuthenticationMethod) { - "NTLM" { + "NTLM" + { $ntlmUsed = $true if ($authProviderUsed -eq $true -or ` - $membProviderUsed -eq $true -or ` - $roleProviderUsed -eq $true) + $membProviderUsed -eq $true -or ` + $roleProviderUsed -eq $true) { $message = "You cannot use AuthenticationProvider, MembershipProvider " + ` - "or RoleProvider when using NTLM" + "or RoleProvider when using NTLM" if ($Exception) { throw $message @@ -628,14 +649,15 @@ function Test-Parameter() } } } - "Kerberos" { + "Kerberos" + { $kerberosUsed = $true if ($authProviderUsed -eq $true -or ` - $membProviderUsed -eq $true -or ` - $roleProviderUsed -eq $true) + $membProviderUsed -eq $true -or ` + $roleProviderUsed -eq $true) { $message = "You cannot use AuthenticationProvider, MembershipProvider " + ` - "or RoleProvider when using Kerberos" + "or RoleProvider when using Kerberos" if ($Exception) { throw $message @@ -647,12 +669,13 @@ function Test-Parameter() } } } - "FBA" { + "FBA" + { if ($membProviderUsed -eq $false -or ` - $roleProviderUsed -eq $false) + $roleProviderUsed -eq $false) { $message = "You have to specify MembershipProvider and " + ` - "RoleProvider when using FBA" + "RoleProvider when using FBA" if ($Exception) { throw $message @@ -667,7 +690,7 @@ function Test-Parameter() if ($authProviderUsed -eq $true) { $message = "You cannot use AuthenticationProvider when " + ` - "using FBA" + "using FBA" if ($Exception) { throw $message @@ -679,12 +702,13 @@ function Test-Parameter() } } } - "Federated" { + "Federated" + { if ($membProviderUsed -eq $true -or ` - $roleProviderUsed -eq $true) + $roleProviderUsed -eq $true) { $message = "You cannot use MembershipProvider or " + ` - "RoleProvider when using Federated" + "RoleProvider when using Federated" if ($Exception) { throw $message @@ -699,7 +723,7 @@ function Test-Parameter() if ($authProviderUsed -eq $false) { $message = "You have to specify AuthenticationProvider when " + ` - "using Federated" + "using Federated" if ($Exception) { throw $message @@ -746,8 +770,8 @@ function Test-ZoneIsNotClassic() if ($desiredAuth.AuthenticationMethod -ne "Classic") { throw ("Specified Web Application is using Classic Authentication and " + ` - "Claims Authentication is specified. Please use " + ` - "Convert-SPWebApplication first!") + "Claims Authentication is specified. Please use " + ` + "Convert-SPWebApplication first!") } } } @@ -760,7 +784,7 @@ function Set-ZoneConfiguration() $WebAppUrl, [Parameter(Mandatory = $true)] - [ValidateSet("Default","Intranet","Internet","Extranet","Custom")] + [ValidateSet("Default", "Intranet", "Internet", "Extranet", "Custom")] [System.String] $Zone, @@ -770,8 +794,8 @@ function Set-ZoneConfiguration() ) Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $ap = @() @@ -780,24 +804,28 @@ function Set-ZoneConfiguration() { switch ($zoneConfig.AuthenticationMethod) { - "NTLM" { + "NTLM" + { $newap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication } - "Kerberos" { + "Kerberos" + { $newap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication ` - -DisableKerberos:$false + -DisableKerberos:$false } - "FBA" { + "FBA" + { $newap = New-SPAuthenticationProvider -ASPNETMembershipProvider $zoneConfig.MembershipProvider ` - -ASPNETRoleProviderName $zoneConfig.RoleProvider + -ASPNETRoleProviderName $zoneConfig.RoleProvider } - "Federated" { + "Federated" + { $tokenIssuer = Get-SPTrustedIdentityTokenIssuer -Identity $zoneConfig.AuthenticationProvider ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $tokenIssuer) { throw ("Specified AuthenticationProvider $($zoneConfig.AuthenticationProvider) " + ` - "does not exist") + "does not exist") } $newap = New-SPAuthenticationProvider -TrustedIdentityTokenIssuer $tokenIssuer } @@ -826,26 +854,29 @@ function Test-ZoneConfiguration() { switch ($zoneConfig.AuthenticationMethod) { - { $_ -in @("NTLM","Kerberos","Classic") } { + { $_ -in @("NTLM", "Kerberos", "Classic") } + { $configuredMethod = $CurrentConfig | ` - Where-Object -FilterScript { - $_.AuthenticationMethod -eq $zoneConfig.AuthenticationMethod - } + Where-Object -FilterScript { + $_.AuthenticationMethod -eq $zoneConfig.AuthenticationMethod + } } - "FBA" { + "FBA" + { $configuredMethod = $CurrentConfig | ` - Where-Object -FilterScript { - $_.AuthenticationMethod -eq $zoneConfig.AuthenticationMethod -and ` - $_.MembershipProvider -eq $zoneConfig.MembershipProvider -and ` - $_.RoleProvider -eq $zoneConfig.RoleProvider - } + Where-Object -FilterScript { + $_.AuthenticationMethod -eq $zoneConfig.AuthenticationMethod -and ` + $_.MembershipProvider -eq $zoneConfig.MembershipProvider -and ` + $_.RoleProvider -eq $zoneConfig.RoleProvider + } } - "Federated" { + "Federated" + { $configuredMethod = $CurrentConfig | ` - Where-Object -FilterScript { - $_.AuthenticationMethod -eq $zoneConfig.AuthenticationMethod -and ` - $_.AuthenticationProvider -eq $zoneConfig.AuthenticationProvider - } + Where-Object -FilterScript { + $_.AuthenticationMethod -eq $zoneConfig.AuthenticationMethod -and ` + $_.AuthenticationProvider -eq $zoneConfig.AuthenticationProvider + } } } @@ -860,26 +891,29 @@ function Test-ZoneConfiguration() { switch ($zoneConfig.AuthenticationMethod) { - { $_ -in @("NTLM","Kerberos","Classic") } { + { $_ -in @("NTLM", "Kerberos", "Classic") } + { $specifiedMethod = $DesiredConfig | ` - Where-Object -FilterScript { - $_.AuthenticationMethod -eq $zoneConfig.AuthenticationMethod - } + Where-Object -FilterScript { + $_.AuthenticationMethod -eq $zoneConfig.AuthenticationMethod + } } - "FBA" { + "FBA" + { $specifiedMethod = $DesiredConfig | ` - Where-Object -FilterScript { - $_.AuthenticationMethod -eq $zoneConfig.AuthenticationMethod -and ` - $_.MembershipProvider -eq $zoneConfig.MembershipProvider -and ` - $_.RoleProvider -eq $zoneConfig.RoleProvider - } + Where-Object -FilterScript { + $_.AuthenticationMethod -eq $zoneConfig.AuthenticationMethod -and ` + $_.MembershipProvider -eq $zoneConfig.MembershipProvider -and ` + $_.RoleProvider -eq $zoneConfig.RoleProvider + } } - "Federated" { + "Federated" + { $specifiedMethod = $DesiredConfig | ` - Where-Object -FilterScript { - $_.AuthenticationMethod -eq $zoneConfig.AuthenticationMethod -and ` - $_.AuthenticationProvider -eq $zoneConfig.AuthenticationProvider - } + Where-Object -FilterScript { + $_.AuthenticationMethod -eq $zoneConfig.AuthenticationMethod -and ` + $_.AuthenticationProvider -eq $zoneConfig.AuthenticationProvider + } } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.psm1 index 28fe11a16..81c2342d1 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.psm1 @@ -28,8 +28,8 @@ function Get-TargetResource Write-Verbose -Message "Getting web application '$WebAppUrl' blocked file types" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters,$PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $ScriptRoot = $args[1] @@ -85,8 +85,8 @@ function Set-TargetResource Write-Verbose -Message "Setting web application '$WebAppUrl' blocked file types" $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters,$PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $ScriptRoot = $args[1] @@ -143,7 +143,7 @@ function Test-TargetResource Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath $modulePath -Resolve) return Test-SPDscWebApplicationBlockedFileTypeConfig -CurrentSettings $CurrentValues ` - -DesiredSettings $PSBoundParameters + -DesiredSettings $PSBoundParameters } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppClientCallableSettings/MSFT_SPWebAppClientCallableSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppClientCallableSettings/MSFT_SPWebAppClientCallableSettings.psm1 index 80bc845e7..d09f79370 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppClientCallableSettings/MSFT_SPWebAppClientCallableSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppClientCallableSettings/MSFT_SPWebAppClientCallableSettings.psm1 @@ -1,7 +1,7 @@ function Get-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Collections.Hashtable])] param ( @@ -67,12 +67,12 @@ function Get-TargetResource if ($ProxyLibraries -and (($ProxyLibrariesToInclude) -or ($ProxyLibrariesToExclude))) { throw ("Cannot use the ProxyLibraries parameter together with the ProxyLibrariesToInclude or " + ` - "ProxyLibrariesToExclude parameters") + "ProxyLibrariesToExclude parameters") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters) ` - -ScriptBlock { + -Arguments @($PSBoundParameters) ` + -ScriptBlock { $params = $args[0] $webApplication = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue @@ -144,7 +144,7 @@ function Get-TargetResource function Set-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] param ( [Parameter(Mandatory = $true)] @@ -209,12 +209,12 @@ function Set-TargetResource if ($ProxyLibraries -and (($ProxyLibrariesToInclude) -or ($ProxyLibrariesToExclude))) { throw ("Cannot use the ProxyLibraries parameter together with the ProxyLibrariesToInclude or " + ` - "ProxyLibrariesToExclude parameters") + "ProxyLibrariesToExclude parameters") } Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters) ` - -ScriptBlock { + -Arguments @($PSBoundParameters) ` + -ScriptBlock { $params = $args[0] $webApplication = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue @@ -252,7 +252,7 @@ function Set-TargetResource } } - [System.Collections.ObjectModel.Collection[System.Object]]$proxyLibrariesToRemove = @{} + [System.Collections.ObjectModel.Collection[System.Object]]$proxyLibrariesToRemove = @{ } foreach ($currentProxyLibrary in $clientCallableSettings.ProxyLibraries) { if ($params.ProxyLibraries.Count -eq 0 -or (-not ($params.ProxyLibraries.AssemblyName -contains $currentProxyLibrary.AssemblyName))) @@ -263,8 +263,8 @@ function Set-TargetResource foreach ($proxyLibraryToRemove in $proxyLibrariesToRemove) { - $clientCallableSettings.ProxyLibraries.Remove($proxyLibraryToRemove) - $webApplicationNeedsUpdate = $true + $clientCallableSettings.ProxyLibraries.Remove($proxyLibraryToRemove) + $webApplicationNeedsUpdate = $true } } @@ -403,7 +403,7 @@ function Set-TargetResource function Test-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Boolean])] param ( @@ -498,7 +498,7 @@ function Test-TargetResource } $differences = Compare-Object -ReferenceObject $CurrentValues.ProxyLibraries.AssemblyName ` - -DifferenceObject $ProxyLibraries.AssemblyName + -DifferenceObject $ProxyLibraries.AssemblyName if ($null -eq $differences) { @@ -506,8 +506,8 @@ function Test-TargetResource foreach ($currentProxyLibrary in $CurrentValues.ProxyLibraries) { if ($currentProxyLibrary.SupportAppAuthentication -ne ($ProxyLibraries | Where-Object -FilterScript { - $_.AssemblyName -eq $currentProxyLibrary.AssemblyName - } | Select-Object -First 1).SupportAppAuthentication) + $_.AssemblyName -eq $currentProxyLibrary.AssemblyName + } | Select-Object -First 1).SupportAppAuthentication) { Write-Verbose -Message "$($currentProxyLibrary.AssemblyName) has incorrect SupportAppAuthentication. Test failed." return $false @@ -547,8 +547,8 @@ function Test-TargetResource { Write-Verbose -Message "$($proxyLibrary.AssemblyName) is already registered as a proxy library. Checking SupportAppAuthentication..." if ($proxyLibrary.SupportAppAuthentication -ne ($CurrentValues.ProxyLibraries | Where-Object -FilterScript { - $_.AssemblyName -eq $proxyLibrary.AssemblyName - } | Select-Object -First 1).SupportAppAuthentication) + $_.AssemblyName -eq $proxyLibrary.AssemblyName + } | Select-Object -First 1).SupportAppAuthentication) { Write-Verbose -Message "$($proxyLibrary.AssemblyName) has incorrect SupportAppAuthentication. Test failed." return $false @@ -579,17 +579,17 @@ function Test-TargetResource } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("WebAppUrl", - "MaxResourcesPerRequest", - "MaxObjectPaths", - "ExecutionTimeout", - "RequestXmlMaxDepth", - "EnableXsdValidation", - "EnableStackTrace", - "RequestUsageExecutionTimeThreshold", - "LogActionsIfHasRequestException", - "EnableRequestUsage") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("WebAppUrl", + "MaxResourcesPerRequest", + "MaxObjectPaths", + "ExecutionTimeout", + "RequestXmlMaxDepth", + "EnableXsdValidation", + "EnableStackTrace", + "RequestUsageExecutionTimeThreshold", + "LogActionsIfHasRequestException", + "EnableRequestUsage") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.psm1 index 60fcbca30..08ddf742e 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.psm1 @@ -33,7 +33,7 @@ function Get-TargetResource $BlogAPIAuthenticated, [Parameter()] - [ValidateSet("Strict","Permissive")] + [ValidateSet("Strict", "Permissive")] [System.String] $BrowserFileHandling, @@ -97,8 +97,8 @@ function Get-TargetResource Write-Verbose -Message "Getting web application '$WebAppUrl' general settings" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters,$PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $ScriptRoot = $args[1] @@ -145,7 +145,7 @@ function Set-TargetResource { [CmdletBinding()] param - ( + ( [Parameter(Mandatory = $true)] [System.String] $WebAppUrl, @@ -175,7 +175,7 @@ function Set-TargetResource $BlogAPIAuthenticated, [Parameter()] - [ValidateSet("Strict","Permissive")] + [ValidateSet("Strict", "Permissive")] [System.String] $BrowserFileHandling, @@ -239,8 +239,8 @@ function Set-TargetResource Write-Verbose -Message "Setting web application '$WebAppUrl' general settings" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters,$PSScriptRoot) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { $params = $args[0] $ScriptRoot = $args[1] @@ -274,7 +274,7 @@ function Test-TargetResource [CmdletBinding()] [OutputType([System.Boolean])] param - ( + ( [Parameter(Mandatory = $true)] [System.String] $WebAppUrl, @@ -304,7 +304,7 @@ function Test-TargetResource $BlogAPIAuthenticated, [Parameter()] - [ValidateSet("Strict","Permissive")] + [ValidateSet("Strict", "Permissive")] [System.String] $BrowserFileHandling, diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPeoplePickerSettings/MSFT_SPWebAppPeoplePickerSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPeoplePickerSettings/MSFT_SPWebAppPeoplePickerSettings.psm1 index 1b1565a0b..96085314a 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPeoplePickerSettings/MSFT_SPWebAppPeoplePickerSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPeoplePickerSettings/MSFT_SPWebAppPeoplePickerSettings.psm1 @@ -1,7 +1,7 @@ function Get-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Collections.Hashtable])] param ( @@ -37,12 +37,12 @@ function Get-TargetResource Write-Verbose -Message "Getting People Picker Settings for $WebAppUrl" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $wa = Get-SPWebApplication -Identity $params.WebAppUrl ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $wa) { @@ -59,20 +59,20 @@ function Get-TargetResource $searchADDomains = @() foreach ($searchDomain in $wa.PeoplePickerSettings.SearchActiveDirectoryDomains) { - $searchADDomain = @{} + $searchADDomain = @{ } $searchADDomain.FQDN = $searchDomain.DomainName $searchADDomain.IsForest = $searchDomain.IsForest - $searchADDomain.AccessAccount = $searchDomain.LoginName + $searchADDomain.AccessAccount = $searchDomain.LoginName $searchADDomains += $searchADDomain } return @{ - WebAppUrl = $params.WebAppUrl - ActiveDirectoryCustomFilter = $wa.PeoplePickerSettings.ActiveDirectoryCustomFilter - ActiveDirectoryCustomQuery = $wa.PeoplePickerSettings.ActiveDirectoryCustomQuery - ActiveDirectorySearchTimeout = $wa.PeoplePickerSettings.ActiveDirectorySearchTimeout.TotalSeconds - OnlySearchWithinSiteCollection = $wa.PeoplePickerSettings.OnlySearchWithinSiteCollection - SearchActiveDirectoryDomains = $searchADDomains + WebAppUrl = $params.WebAppUrl + ActiveDirectoryCustomFilter = $wa.PeoplePickerSettings.ActiveDirectoryCustomFilter + ActiveDirectoryCustomQuery = $wa.PeoplePickerSettings.ActiveDirectoryCustomQuery + ActiveDirectorySearchTimeout = $wa.PeoplePickerSettings.ActiveDirectorySearchTimeout.TotalSeconds + OnlySearchWithinSiteCollection = $wa.PeoplePickerSettings.OnlySearchWithinSiteCollection + SearchActiveDirectoryDomains = $searchADDomains } } return $result @@ -81,8 +81,8 @@ function Get-TargetResource function Set-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "", Justification = "Ignoring this because the used AccessAccount does not use SecureString to handle the password")] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "", Justification = "Ignoring this because the used AccessAccount does not use SecureString to handle the password")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] param ( [Parameter(Mandatory = $true)] @@ -118,9 +118,9 @@ function Set-TargetResource ## Perform changes Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] + -Arguments $PSBoundParameters ` + -ScriptBlock { + $params = $args[0] $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue @@ -166,10 +166,10 @@ function Set-TargetResource foreach ($searchADDomain in $params.SearchActiveDirectoryDomains) { $configuredDomain = $wa.PeoplePickerSettings.SearchActiveDirectoryDomains | ` - Where-Object -FilterScript { - $_.DomainName -eq $searchADDomain.FQDN -and ` - $_.IsForest -eq $searchADDomain.IsForest - } + Where-Object -FilterScript { + $_.DomainName -eq $searchADDomain.FQDN -and ` + $_.IsForest -eq $searchADDomain.IsForest + } if ($null -eq $configuredDomain) { # Add domain @@ -211,7 +211,7 @@ function Set-TargetResource { $specifiedDomain = $params.SearchActiveDirectoryDomains | Where-Object -FilterScript { $_.FQDN -eq $waSearchADDomain.DomainName -and ` - $_.IsForest -eq $waSearchADDomain.IsForest + $_.IsForest -eq $waSearchADDomain.IsForest } if ($null -eq $specifiedDomain) @@ -233,7 +233,7 @@ function Set-TargetResource function Test-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Boolean])] param ( @@ -277,10 +277,10 @@ function Test-TargetResource foreach ($searchADDomain in $SearchActiveDirectoryDomains) { $configuredDomain = $CurrentValues.SearchActiveDirectoryDomains | ` - Where-Object -FilterScript { - $_.FQDN -eq $searchADDomain.FQDN -and ` - $_.IsForest -eq $searchADDomain.IsForest - } + Where-Object -FilterScript { + $_.FQDN -eq $searchADDomain.FQDN -and ` + $_.IsForest -eq $searchADDomain.IsForest + } if ($null -eq $configuredDomain) { return $false @@ -292,7 +292,7 @@ function Test-TargetResource { $specifiedDomain = $SearchActiveDirectoryDomains | Where-Object -FilterScript { $_.FQDN -eq $searchADDomain.FQDN -and ` - $_.IsForest -eq $searchADDomain.IsForest + $_.IsForest -eq $searchADDomain.IsForest } if ($null -eq $specifiedDomain) @@ -302,11 +302,11 @@ function Test-TargetResource } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ActiveDirectoryCustomFilter", ` - "ActiveDirectoryCustomQuery", ` - "ActiveDirectorySearchTimeout", ` - "OnlySearchWithinSiteCollection") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("ActiveDirectoryCustomFilter", ` + "ActiveDirectoryCustomQuery", ` + "ActiveDirectorySearchTimeout", ` + "OnlySearchWithinSiteCollection") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.psm1 index 3e961d850..c341f63d2 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.psm1 @@ -10,25 +10,25 @@ function Get-TargetResource [Parameter()] [ValidateSet("Manage Lists", "Override List Behaviors", "Add Items", "Edit Items", - "Delete Items", "View Items", "Approve Items", "Open Items", - "View Versions", "Delete Versions", "Create Alerts", - "View Application Pages")] + "Delete Items", "View Items", "Approve Items", "Open Items", + "View Versions", "Delete Versions", "Create Alerts", + "View Application Pages")] [System.String[]] $ListPermissions, [Parameter()] [ValidateSet("Manage Permissions", "View Web Analytics Data", "Create Subsites", - "Manage Web Site", "Add and Customize Pages", "Apply Themes and Borders", - "Apply Style Sheets", "Create Groups", "Browse Directories", - "Use Self-Service Site Creation", "View Pages", "Enumerate Permissions", - "Browse User Information", "Manage Alerts", "Use Remote Interfaces", - "Use Client Integration Features", "Open", "Edit Personal User Information")] + "Manage Web Site", "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", "Enumerate Permissions", + "Browse User Information", "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", "Open", "Edit Personal User Information")] [System.String[]] $SitePermissions, [Parameter()] [ValidateSet("Manage Personal Views", "Add/Remove Personal Web Parts", - "Update Personal Web Parts")] + "Update Personal Web Parts")] [System.String[]] $PersonalPermissions, @@ -46,8 +46,8 @@ function Get-TargetResource Test-SPDscInput @PSBoundParameters $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue @@ -60,14 +60,14 @@ function Get-TargetResource if ($wa.RightsMask -eq [Microsoft.SharePoint.SPBasePermissions]::FullMask) { $returnval = @{ - WebAppUrl = $params.WebAppUrl + WebAppUrl = $params.WebAppUrl AllPermissions = $true } } else { - $ListPermissions = @() - $SitePermissions = @() + $ListPermissions = @() + $SitePermissions = @() $PersonalPermissions = @() $rightsmask = ($wa.RightsMask -split ",").trim() @@ -75,105 +75,138 @@ function Get-TargetResource { switch ($rightmask) { - "ManageLists" { + "ManageLists" + { $ListPermissions += "Manage Lists" } - "CancelCheckout" { + "CancelCheckout" + { $ListPermissions += "Override List Behaviors" } - "AddListItems" { + "AddListItems" + { $ListPermissions += "Add Items" } - "EditListItems" { + "EditListItems" + { $ListPermissions += "Edit Items" } - "DeleteListItems" { + "DeleteListItems" + { $ListPermissions += "Delete Items" } - "ViewListItems" { + "ViewListItems" + { $ListPermissions += "View Items" } - "ApproveItems" { + "ApproveItems" + { $ListPermissions += "Approve Items" } - "OpenItems" { + "OpenItems" + { $ListPermissions += "Open Items" } - "ViewVersions" { + "ViewVersions" + { $ListPermissions += "View Versions" } - "DeleteVersions" { + "DeleteVersions" + { $ListPermissions += "Delete Versions" } - "CreateAlerts" { - $ListPermissions += "Create Alerts" - } - "ViewFormPages" { + "CreateAlerts" + { + $ListPermissions += "Create Alerts" + } + "ViewFormPages" + { $ListPermissions += "View Application Pages" } - "ManagePermissions" { + "ManagePermissions" + { $SitePermissions += "Manage Permissions" } - "ViewUsageData" { + "ViewUsageData" + { $SitePermissions += "View Web Analytics Data" } - "ManageSubwebs" { + "ManageSubwebs" + { $SitePermissions += "Create Subsites" } - "ManageWeb" { + "ManageWeb" + { $SitePermissions += "Manage Web Site" } - "AddAndCustomizePages" { + "AddAndCustomizePages" + { $SitePermissions += "Add and Customize Pages" } - "ApplyThemeAndBorder" { + "ApplyThemeAndBorder" + { $SitePermissions += "Apply Themes and Borders" } - "ApplyStyleSheets" { + "ApplyStyleSheets" + { $SitePermissions += "Apply Style Sheets" } - "CreateGroups" { + "CreateGroups" + { $SitePermissions += "Create Groups" } - "BrowseDirectories" { + "BrowseDirectories" + { $SitePermissions += "Browse Directories" - } - "CreateSSCSite" { + } + "CreateSSCSite" + { $SitePermissions += "Use Self-Service Site Creation" } - "ViewPages" { + "ViewPages" + { $SitePermissions += "View Pages" } - "EnumeratePermissions" { + "EnumeratePermissions" + { $SitePermissions += "Enumerate Permissions" } - "BrowseUserInfo" { + "BrowseUserInfo" + { $SitePermissions += "Browse User Information" } - "ManageAlerts" { + "ManageAlerts" + { $SitePermissions += "Manage Alerts" } - "UseRemoteAPIs" { + "UseRemoteAPIs" + { $SitePermissions += "Use Remote Interfaces" } - "UseClientIntegration" { + "UseClientIntegration" + { $SitePermissions += "Use Client Integration Features" } - "Open" { + "Open" + { $SitePermissions += "Open" } - "EditMyUserInfo" { + "EditMyUserInfo" + { $SitePermissions += "Edit Personal User Information" } - "ManagePersonalViews" { + "ManagePersonalViews" + { $PersonalPermissions += "Manage Personal Views" } - "AddDelPrivateWebParts" { + "AddDelPrivateWebParts" + { $PersonalPermissions += "Add/Remove Personal Web Parts" } - "UpdatePersonalWebParts" { + "UpdatePersonalWebParts" + { $PersonalPermissions += "Update Personal Web Parts" } } @@ -202,25 +235,25 @@ function Set-TargetResource [Parameter()] [ValidateSet("Manage Lists", "Override List Behaviors", "Add Items", "Edit Items", - "Delete Items", "View Items", "Approve Items", "Open Items", - "View Versions", "Delete Versions", "Create Alerts", - "View Application Pages")] + "Delete Items", "View Items", "Approve Items", "Open Items", + "View Versions", "Delete Versions", "Create Alerts", + "View Application Pages")] [System.String[]] $ListPermissions, [Parameter()] [ValidateSet("Manage Permissions", "View Web Analytics Data", "Create Subsites", - "Manage Web Site", "Add and Customize Pages", "Apply Themes and Borders", - "Apply Style Sheets", "Create Groups", "Browse Directories", - "Use Self-Service Site Creation", "View Pages", "Enumerate Permissions", - "Browse User Information", "Manage Alerts", "Use Remote Interfaces", - "Use Client Integration Features", "Open", "Edit Personal User Information")] + "Manage Web Site", "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", "Enumerate Permissions", + "Browse User Information", "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", "Open", "Edit Personal User Information")] [System.String[]] $SitePermissions, [Parameter()] [ValidateSet("Manage Personal Views", "Add/Remove Personal Web Parts", - "Update Personal Web Parts")] + "Update Personal Web Parts")] [System.String[]] $PersonalPermissions, @@ -242,12 +275,12 @@ function Set-TargetResource if ($AllPermissions) { $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $wa = Get-SPWebApplication -Identity $params.WebAppUrl ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $wa) { @@ -261,12 +294,12 @@ function Set-TargetResource else { $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $wa = Get-SPWebApplication -Identity $params.WebAppUrl ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $wa) { @@ -278,40 +311,52 @@ function Set-TargetResource { switch ($lp) { - "Manage Lists" { + "Manage Lists" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ManageLists } - "Override List Behaviors" { + "Override List Behaviors" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::CancelCheckout } - "Add Items" { + "Add Items" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::AddListItems } - "Edit Items" { + "Edit Items" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::EditListItems } - "Delete Items" { + "Delete Items" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::DeleteListItems } - "View Items" { + "View Items" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ViewListItems } - "Approve Items" { + "Approve Items" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ApproveItems } - "Open Items" { + "Open Items" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::OpenItems } - "View Versions" { + "View Versions" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ViewVersions } - "Delete Versions" { + "Delete Versions" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::DeleteVersions } - "Create Alerts" { + "Create Alerts" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::CreateAlerts } - "View Application Pages" { + "View Application Pages" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ViewFormPages } } @@ -321,58 +366,76 @@ function Set-TargetResource { switch ($sp) { - "Manage Permissions" { + "Manage Permissions" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ManagePermissions } - "View Web Analytics Data" { + "View Web Analytics Data" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ViewUsageData } - "Create Subsites" { + "Create Subsites" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ManageSubwebs } - "Manage Web Site" { + "Manage Web Site" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ManageWeb } - "Add and Customize Pages" { + "Add and Customize Pages" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::AddAndCustomizePages } - "Apply Themes and Borders" { + "Apply Themes and Borders" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ApplyThemeAndBorder } - "Apply Style Sheets" { + "Apply Style Sheets" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ApplyStyleSheets } - "Create Groups" { + "Create Groups" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::CreateGroups } - "Browse Directories" { + "Browse Directories" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::BrowseDirectories } - "Use Self-Service Site Creation" { + "Use Self-Service Site Creation" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::CreateSSCSite } - "View Pages" { + "View Pages" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ViewPages } - "Enumerate Permissions" { + "Enumerate Permissions" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::EnumeratePermissions } - "Browse User Information" { + "Browse User Information" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::BrowseUserInfo } - "Manage Alerts" { + "Manage Alerts" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ManageAlerts } - "Use Remote Interfaces" { + "Use Remote Interfaces" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::UseRemoteAPIs } - "Use Client Integration Features" { + "Use Client Integration Features" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::UseClientIntegration } - "Open" { + "Open" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::Open } - "Edit Personal User Information" { + "Edit Personal User Information" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::EditMyUserInfo } } @@ -382,13 +445,16 @@ function Set-TargetResource { switch ($pp) { - "Manage Personal Views" { + "Manage Personal Views" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::ManagePersonalViews } - "Add/Remove Personal Web Parts" { + "Add/Remove Personal Web Parts" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::AddDelPrivateWebParts } - "Update Personal Web Parts" { + "Update Personal Web Parts" + { $newMask = $newMask -bor [Microsoft.SharePoint.SPBasePermissions]::UpdatePersonalWebParts } } @@ -411,25 +477,25 @@ function Test-TargetResource [Parameter()] [ValidateSet("Manage Lists", "Override List Behaviors", "Add Items", "Edit Items", - "Delete Items", "View Items", "Approve Items", "Open Items", - "View Versions", "Delete Versions", "Create Alerts", - "View Application Pages")] + "Delete Items", "View Items", "Approve Items", "Open Items", + "View Versions", "Delete Versions", "Create Alerts", + "View Application Pages")] [System.String[]] $ListPermissions, [Parameter()] [ValidateSet("Manage Permissions", "View Web Analytics Data", "Create Subsites", - "Manage Web Site", "Add and Customize Pages", "Apply Themes and Borders", - "Apply Style Sheets", "Create Groups", "Browse Directories", - "Use Self-Service Site Creation", "View Pages", "Enumerate Permissions", - "Browse User Information", "Manage Alerts", "Use Remote Interfaces", - "Use Client Integration Features", "Open", "Edit Personal User Information")] + "Manage Web Site", "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", "Enumerate Permissions", + "Browse User Information", "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", "Open", "Edit Personal User Information")] [System.String[]] $SitePermissions, [Parameter()] [ValidateSet("Manage Personal Views", "Add/Remove Personal Web Parts", - "Update Personal Web Parts")] + "Update Personal Web Parts")] [System.String[]] $PersonalPermissions, @@ -456,8 +522,8 @@ function Test-TargetResource if ($CurrentValues.ContainsKey("AllPermissions")) { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("AllPermissions") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("AllPermissions") } else { @@ -473,17 +539,17 @@ function Test-TargetResource else { if ($null -ne (Compare-Object -ReferenceObject $ListPermissions ` - -DifferenceObject $CurrentValues.ListPermissions)) + -DifferenceObject $CurrentValues.ListPermissions)) { return $false } if ($null -ne (Compare-Object -ReferenceObject $SitePermissions ` - -DifferenceObject $CurrentValues.SitePermissions)) + -DifferenceObject $CurrentValues.SitePermissions)) { return $false } if ($null -ne (Compare-Object -ReferenceObject $PersonalPermissions ` - -DifferenceObject $CurrentValues.PersonalPermissions)) + -DifferenceObject $CurrentValues.PersonalPermissions)) { return $false } @@ -504,25 +570,25 @@ function Test-SPDscInput() [Parameter()] [ValidateSet("Manage Lists", "Override List Behaviors", "Add Items", "Edit Items", - "Delete Items", "View Items", "Approve Items", "Open Items", - "View Versions", "Delete Versions", "Create Alerts", - "View Application Pages")] + "Delete Items", "View Items", "Approve Items", "Open Items", + "View Versions", "Delete Versions", "Create Alerts", + "View Application Pages")] [System.String[]] $ListPermissions, [Parameter()] [ValidateSet("Manage Permissions", "View Web Analytics Data", "Create Subsites", - "Manage Web Site", "Add and Customize Pages", "Apply Themes and Borders", - "Apply Style Sheets", "Create Groups", "Browse Directories", - "Use Self-Service Site Creation", "View Pages", "Enumerate Permissions", - "Browse User Information", "Manage Alerts", "Use Remote Interfaces", - "Use Client Integration Features", "Open", "Edit Personal User Information")] + "Manage Web Site", "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", "Enumerate Permissions", + "Browse User Information", "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", "Open", "Edit Personal User Information")] [System.String[]] $SitePermissions, [Parameter()] [ValidateSet("Manage Personal Views", "Add/Remove Personal Web Parts", - "Update Personal Web Parts")] + "Update Personal Web Parts")] [System.String[]] $PersonalPermissions, @@ -541,7 +607,7 @@ function Test-SPDscInput() if ($ListPermissions -or $SitePermissions -or $PersonalPermissions) { throw ("Do not specify parameters ListPermissions, SitePermissions " + ` - "or PersonalPermissions when specifying parameter AllPermissions") + "or PersonalPermissions when specifying parameter AllPermissions") } } else @@ -550,7 +616,7 @@ function Test-SPDscInput() if (-not ($ListPermissions -and $SitePermissions -and $PersonalPermissions)) { throw ("One of the parameters ListPermissions, SitePermissions or " + ` - "PersonalPermissions is missing") + "PersonalPermissions is missing") } } @@ -561,173 +627,173 @@ function Test-SPDscInput() } if (($ListPermissions -contains "Manage Lists" ` - -or $ListPermissions -contains "Override List Behaviors" ` - -or $ListPermissions -contains "Add Items" ` - -or $ListPermissions -contains "Edit Items" ` - -or $ListPermissions -contains "Delete Items" ` - -or $ListPermissions -contains "Approve Items" ` - -or $ListPermissions -contains "Open Items" ` - -or $ListPermissions -contains "View Versions" ` - -or $ListPermissions -contains "Delete Versions" ` - -or $ListPermissions -contains "Create Alerts" ` - -or $SitePermissions -contains "Manage Permissions" ` - -or $SitePermissions -contains "Manage Web Site" ` - -or $SitePermissions -contains "Add and Customize Pages" ` - -or $SitePermissions -contains "Manage Alerts" ` - -or $SitePermissions -contains "Use Client Integration Features" ` - -or $PersonalPermissions -contains "Manage Personal Views" ` - -or $PersonalPermissions -contains "Add/Remove Personal Web Parts" ` - -or $PersonalPermissions -contains "Update Personal Web Parts") ` - -and -not ($ListPermissions -contains "View Items")) + -or $ListPermissions -contains "Override List Behaviors" ` + -or $ListPermissions -contains "Add Items" ` + -or $ListPermissions -contains "Edit Items" ` + -or $ListPermissions -contains "Delete Items" ` + -or $ListPermissions -contains "Approve Items" ` + -or $ListPermissions -contains "Open Items" ` + -or $ListPermissions -contains "View Versions" ` + -or $ListPermissions -contains "Delete Versions" ` + -or $ListPermissions -contains "Create Alerts" ` + -or $SitePermissions -contains "Manage Permissions" ` + -or $SitePermissions -contains "Manage Web Site" ` + -or $SitePermissions -contains "Add and Customize Pages" ` + -or $SitePermissions -contains "Manage Alerts" ` + -or $SitePermissions -contains "Use Client Integration Features" ` + -or $PersonalPermissions -contains "Manage Personal Views" ` + -or $PersonalPermissions -contains "Add/Remove Personal Web Parts" ` + -or $PersonalPermissions -contains "Update Personal Web Parts") ` + -and -not ($ListPermissions -contains "View Items")) { throw ("View Items is required when specifying Manage Lists, Override List Behaviors, " + ` - "Add Items, Edit Items, Delete Items, Approve Items, Open Items, View " + ` - "Versions, Delete Versions, Create Alerts, Manage Permissions, Manage Web Site, " + ` - "Add and Customize Pages, Manage Alerts, Use Client Integration Features, " + ` - "Manage Personal Views, Add/Remove Personal Web Parts or Update Personal Web Parts") + "Add Items, Edit Items, Delete Items, Approve Items, Open Items, View " + ` + "Versions, Delete Versions, Create Alerts, Manage Permissions, Manage Web Site, " + ` + "Add and Customize Pages, Manage Alerts, Use Client Integration Features, " + ` + "Manage Personal Views, Add/Remove Personal Web Parts or Update Personal Web Parts") } if (($ListPermissions -contains "View Versions" ` - -or $SitePermissions -contains "Manage Permissions") ` - -and -not ($ListPermissions -contains "Open Items")) + -or $SitePermissions -contains "Manage Permissions") ` + -and -not ($ListPermissions -contains "Open Items")) { throw "Open Items is required when specifying View Versions or Manage Permissions" } if (($ListPermissions -contains "Delete Versions" ` - -or $SitePermissions -contains "Manage Permissions") ` - -and -not ($ListPermissions -contains "View Versions")) + -or $SitePermissions -contains "Manage Permissions") ` + -and -not ($ListPermissions -contains "View Versions")) { throw "View Versions is required when specifying Delete Versions or Manage Permissions" } if ($SitePermissions -contains "Manage Alerts" ` - -and -not ($ListPermissions -contains "Create Alerts")) + -and -not ($ListPermissions -contains "Create Alerts")) { throw "Create Alerts is required when specifying Manage Alerts" } if ($SitePermissions -contains "Manage Web Site" ` - -and -not ($SitePermissions -contains "Add and Customize Pages")) + -and -not ($SitePermissions -contains "Add and Customize Pages")) { throw "Add and Customize Pages is required when specifying Manage Web Site" } if (($SitePermissions -contains "Manage Permissions" ` - -or $SitePermissions -contains "Manage Web Site" ` - -or $SitePermissions -contains "Add and Customize Pages" ` - -or $SitePermissions -contains "Enumerate Permissions") ` - -and -not ($SitePermissions -contains "Browse Directories")) + -or $SitePermissions -contains "Manage Web Site" ` + -or $SitePermissions -contains "Add and Customize Pages" ` + -or $SitePermissions -contains "Enumerate Permissions") ` + -and -not ($SitePermissions -contains "Browse Directories")) { throw ("Browse Directories is required when specifying Manage Permissions, Manage Web " + ` - "Site, Add and Customize Pages or Enumerate Permissions") + "Site, Add and Customize Pages or Enumerate Permissions") } if (($ListPermissions -contains "Manage Lists" ` - -or $ListPermissions -contains "Override List Behaviors" ` - -or $ListPermissions -contains "Add Items" ` - -or $ListPermissions -contains "Edit Items" ` - -or $ListPermissions -contains "Delete Items" ` - -or $ListPermissions -contains "View Items" ` - -or $ListPermissions -contains "Approve Items" ` - -or $ListPermissions -contains "Open Items" ` - -or $ListPermissions -contains "View Versions" ` - -or $ListPermissions -contains "Delete Versions" ` - -or $ListPermissions -contains "Create Alerts" ` - -or $SitePermissions -contains "Manage Permissions" ` - -or $SitePermissions -contains "View Web Analytics Data" ` - -or $SitePermissions -contains "Create Subsites" ` - -or $SitePermissions -contains "Manage Web Site" ` - -or $SitePermissions -contains "Add and Customize Pages" ` - -or $SitePermissions -contains "Apply Themes and Borders" ` - -or $SitePermissions -contains "Apply Style Sheets" ` - -or $SitePermissions -contains "Create Groups" ` - -or $SitePermissions -contains "Browse Directories" ` - -or $SitePermissions -contains "Use Self-Service Site Creation" ` - -or $SitePermissions -contains "Enumerate Permissions" ` - -or $SitePermissions -contains "Manage Alerts" ` - -or $PersonalPermissions -contains "Manage Personal Views" ` - -or $PersonalPermissions -contains "Add/Remove Personal Web Parts" ` - -or $PersonalPermissions -contains "Update Personal Web Parts") ` - -and -not ($SitePermissions -contains "View Pages")) + -or $ListPermissions -contains "Override List Behaviors" ` + -or $ListPermissions -contains "Add Items" ` + -or $ListPermissions -contains "Edit Items" ` + -or $ListPermissions -contains "Delete Items" ` + -or $ListPermissions -contains "View Items" ` + -or $ListPermissions -contains "Approve Items" ` + -or $ListPermissions -contains "Open Items" ` + -or $ListPermissions -contains "View Versions" ` + -or $ListPermissions -contains "Delete Versions" ` + -or $ListPermissions -contains "Create Alerts" ` + -or $SitePermissions -contains "Manage Permissions" ` + -or $SitePermissions -contains "View Web Analytics Data" ` + -or $SitePermissions -contains "Create Subsites" ` + -or $SitePermissions -contains "Manage Web Site" ` + -or $SitePermissions -contains "Add and Customize Pages" ` + -or $SitePermissions -contains "Apply Themes and Borders" ` + -or $SitePermissions -contains "Apply Style Sheets" ` + -or $SitePermissions -contains "Create Groups" ` + -or $SitePermissions -contains "Browse Directories" ` + -or $SitePermissions -contains "Use Self-Service Site Creation" ` + -or $SitePermissions -contains "Enumerate Permissions" ` + -or $SitePermissions -contains "Manage Alerts" ` + -or $PersonalPermissions -contains "Manage Personal Views" ` + -or $PersonalPermissions -contains "Add/Remove Personal Web Parts" ` + -or $PersonalPermissions -contains "Update Personal Web Parts") ` + -and -not ($SitePermissions -contains "View Pages")) { throw ("View Pages is required when specifying Manage Lists, Override List Behaviors, " + ` - "Add Items, Edit Items, Delete Items, View Items, Approve Items, Open Items, " + ` - "View Versions, Delete Versions, Create Alerts, Manage Permissions, View Web " + ` - "Analytics Data, Create Subsites, Manage Web Site, Add and Customize Pages, " + ` - "Apply Themes and Borders, Apply Style Sheets, Create Groups, Browse " + ` - "Directories, Use Self-Service Site Creation, Enumerate Permissions, Manage " + ` - "Alerts, Manage Personal Views, Add/Remove Personal Web Parts or Update " + ` - "Personal Web Parts") + "Add Items, Edit Items, Delete Items, View Items, Approve Items, Open Items, " + ` + "View Versions, Delete Versions, Create Alerts, Manage Permissions, View Web " + ` + "Analytics Data, Create Subsites, Manage Web Site, Add and Customize Pages, " + ` + "Apply Themes and Borders, Apply Style Sheets, Create Groups, Browse " + ` + "Directories, Use Self-Service Site Creation, Enumerate Permissions, Manage " + ` + "Alerts, Manage Personal Views, Add/Remove Personal Web Parts or Update " + ` + "Personal Web Parts") } if (($SitePermissions -contains "Manage Permissions" ` - -or $SitePermissions -contains "Manage Web Site") ` - -and -not ($SitePermissions -contains "Enumerate Permissions")) + -or $SitePermissions -contains "Manage Web Site") ` + -and -not ($SitePermissions -contains "Enumerate Permissions")) { throw ("Enumerate Permissions is required when specifying Manage Permissions or " + ` - "Manage Web Site") + "Manage Web Site") } if (($SitePermissions -contains "Manage Permissions" ` - -or $SitePermissions -contains "Create Subsites" ` - -or $SitePermissions -contains "Manage Web Site" ` - -or $SitePermissions -contains "Create Groups" ` - -or $SitePermissions -contains "Use Self-Service Site Creation" ` - -or $SitePermissions -contains "Enumerate Permissions" ` - -or $SitePermissions -contains "Edit Personal User Information") ` - -and -not ($SitePermissions -contains "Browse User Information")) + -or $SitePermissions -contains "Create Subsites" ` + -or $SitePermissions -contains "Manage Web Site" ` + -or $SitePermissions -contains "Create Groups" ` + -or $SitePermissions -contains "Use Self-Service Site Creation" ` + -or $SitePermissions -contains "Enumerate Permissions" ` + -or $SitePermissions -contains "Edit Personal User Information") ` + -and -not ($SitePermissions -contains "Browse User Information")) { throw ("Browse User Information is required when specifying Manage Permissions, " + ` - "Create Subsites, Manage Web Site, Create Groups, Use Self-Service Site " + ` - "Creation, Enumerate Permissions or Edit Personal User Information") + "Create Subsites, Manage Web Site, Create Groups, Use Self-Service Site " + ` + "Creation, Enumerate Permissions or Edit Personal User Information") } if ($SitePermissions -contains "Use Client Integration Features" ` - -and -not ($SitePermissions -contains "Use Remote Interfaces")) + -and -not ($SitePermissions -contains "Use Remote Interfaces")) { throw "Use Remote Interfaces is required when specifying Use Client Integration Features" } if (($ListPermissions -contains "Manage Lists" ` - -or $ListPermissions -contains "Override List Behaviors" ` - -or $ListPermissions -contains "Add Items" ` - -or $ListPermissions -contains "Edit Items" ` - -or $ListPermissions -contains "Delete Items" ` - -or $ListPermissions -contains "View Items" ` - -or $ListPermissions -contains "Approve Items" ` - -or $ListPermissions -contains "Open Items" ` - -or $ListPermissions -contains "View Versions" ` - -or $ListPermissions -contains "Delete Versions" ` - -or $ListPermissions -contains "Create Alerts" ` - -or $ListPermissions -contains "View Application Pages" ` - -or $SitePermissions -contains "Manage Permissions" ` - -or $SitePermissions -contains "View Web Analytics Data" ` - -or $SitePermissions -contains "Create Subsites" ` - -or $SitePermissions -contains "Manage Web Site" ` - -or $SitePermissions -contains "Add and Customize Pages" ` - -or $SitePermissions -contains "Apply Themes and Borders" ` - -or $SitePermissions -contains "Apply Style Sheets" ` - -or $SitePermissions -contains "Create Groups" ` - -or $SitePermissions -contains "Browse Directories" ` - -or $SitePermissions -contains "Use Self-Service Site Creation" ` - -or $SitePermissions -contains "View Pages" ` - -or $SitePermissions -contains "Enumerate Permissions" ` - -or $SitePermissions -contains "Browse User Information" ` - -or $SitePermissions -contains "Manage Alerts" ` - -or $SitePermissions -contains "Use Remote Interfaces" ` - -or $SitePermissions -contains "Use Client Integration Features" ` - -or $SitePermissions -contains "Edit Personal User Information" ` - -or $PersonalPermissions -contains "Manage Personal Views" ` - -or $PersonalPermissions -contains "Add/Remove Personal Web Parts" ` - -or $PersonalPermissions -contains "Update Personal Web Parts") ` - -and -not ($SitePermissions -contains "Open")) + -or $ListPermissions -contains "Override List Behaviors" ` + -or $ListPermissions -contains "Add Items" ` + -or $ListPermissions -contains "Edit Items" ` + -or $ListPermissions -contains "Delete Items" ` + -or $ListPermissions -contains "View Items" ` + -or $ListPermissions -contains "Approve Items" ` + -or $ListPermissions -contains "Open Items" ` + -or $ListPermissions -contains "View Versions" ` + -or $ListPermissions -contains "Delete Versions" ` + -or $ListPermissions -contains "Create Alerts" ` + -or $ListPermissions -contains "View Application Pages" ` + -or $SitePermissions -contains "Manage Permissions" ` + -or $SitePermissions -contains "View Web Analytics Data" ` + -or $SitePermissions -contains "Create Subsites" ` + -or $SitePermissions -contains "Manage Web Site" ` + -or $SitePermissions -contains "Add and Customize Pages" ` + -or $SitePermissions -contains "Apply Themes and Borders" ` + -or $SitePermissions -contains "Apply Style Sheets" ` + -or $SitePermissions -contains "Create Groups" ` + -or $SitePermissions -contains "Browse Directories" ` + -or $SitePermissions -contains "Use Self-Service Site Creation" ` + -or $SitePermissions -contains "View Pages" ` + -or $SitePermissions -contains "Enumerate Permissions" ` + -or $SitePermissions -contains "Browse User Information" ` + -or $SitePermissions -contains "Manage Alerts" ` + -or $SitePermissions -contains "Use Remote Interfaces" ` + -or $SitePermissions -contains "Use Client Integration Features" ` + -or $SitePermissions -contains "Edit Personal User Information" ` + -or $PersonalPermissions -contains "Manage Personal Views" ` + -or $PersonalPermissions -contains "Add/Remove Personal Web Parts" ` + -or $PersonalPermissions -contains "Update Personal Web Parts") ` + -and -not ($SitePermissions -contains "Open")) { throw "Open is required when specifying any of the other permissions" } if ($PersonalPermissions -contains "Add/Remove Personal Web Parts" ` - -and -not ($PersonalPermissions -contains "Update Personal Web Parts")) + -and -not ($PersonalPermissions -contains "Update Personal Web Parts")) { throw "Update Personal Web Parts is required when specifying Add/Remove Personal Web Parts" } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.psm1 index 595cc3a89..105459fd7 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.psm1 @@ -1,7 +1,7 @@ function Get-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Collections.Hashtable])] param ( @@ -43,24 +43,24 @@ function Get-TargetResource if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) { Write-Verbose -Message ("Cannot use the Members parameter together with " + ` - "the MembersToInclude or MembersToExclude parameters") + "the MembersToInclude or MembersToExclude parameters") return $nullReturn } if (!$Members -and !$MembersToInclude -and !$MembersToExclude) { Write-Verbose -Message ("At least one of the following parameters must be specified: " + ` - "Members, MembersToInclude, MembersToExclude") + "Members, MembersToInclude, MembersToExclude") return $nullReturn } foreach ($member in $Members) { if (($member.ActAsSystemAccount -eq $true) ` - -and ($member.PermissionLevel -ne "Full Control")) + -and ($member.PermissionLevel -ne "Full Control")) { Write-Verbose -Message ("Members Parameter: You cannot specify ActAsSystemAccount " + ` - "with any other permission than Full Control") + "with any other permission than Full Control") return $nullReturn } } @@ -68,18 +68,18 @@ function Get-TargetResource foreach ($member in $MembersToInclude) { if (($member.ActAsSystemAccount -eq $true) ` - -and ($member.PermissionLevel -ne "Full Control")) + -and ($member.PermissionLevel -ne "Full Control")) { Write-Verbose -Message ("MembersToInclude Parameter: You cannot specify " + ` - "ActAsSystemAccount with any other permission than Full " + ` - "Control") + "ActAsSystemAccount with any other permission than Full " + ` + "Control") return $nullReturn } } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $nullReturn = @{ @@ -91,7 +91,7 @@ function Get-TargetResource } $wa = Get-SPWebApplication -Identity $params.WebAppUrl ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $wa) { @@ -135,15 +135,15 @@ function Get-TargetResource $members = @() foreach ($policy in $wa.Policies) { - $member = @{} + $member = @{ } $memberName = $policy.UserName $identityType = "Native" if ($memberName -like "i:*|*" -or $memberName -like "c:*|*") { $identityType = "Claims" $convertedClaim = New-SPClaimsPrincipal -Identity $memberName ` - -IdentityType EncodedClaim ` - -ErrorAction SilentlyContinue + -IdentityType EncodedClaim ` + -ErrorAction SilentlyContinue if ($null -ne $convertedClaim) { $memberName = $convertedClaim.Value @@ -183,12 +183,12 @@ function Get-TargetResource } $returnval = @{ - WebAppUrl = $params.WebAppUrl - Members = $members - MembersToInclude = $params.MembersToInclude - MembersToExclude = $params.MembersToExclude - SetCacheAccountsPolicy = $SetCacheAccountsPolicy - InstallAccount = $params.InstallAccount + WebAppUrl = $params.WebAppUrl + Members = $members + MembersToInclude = $params.MembersToInclude + MembersToExclude = $params.MembersToExclude + SetCacheAccountsPolicy = $SetCacheAccountsPolicy + InstallAccount = $params.InstallAccount } return $returnval @@ -199,7 +199,7 @@ function Get-TargetResource function Set-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] param ( [Parameter(Mandatory = $true)] @@ -232,13 +232,13 @@ function Set-TargetResource if ($Members -and (($MembersToInclude) -or ($MembersToExclude))) { throw ("Cannot use the Members parameter together with the " + ` - "MembersToInclude or MembersToExclude parameters") + "MembersToInclude or MembersToExclude parameters") } if (!$Members -and !$MembersToInclude -and !$MembersToExclude) { throw ("At least one of the following parameters must be specified: " + ` - "Members, MembersToInclude, MembersToExclude") + "Members, MembersToInclude, MembersToExclude") } foreach ($member in $Members) @@ -247,7 +247,7 @@ function Set-TargetResource ($member.PermissionLevel -ne "Full Control")) { throw ("Members Parameter: You cannot specify ActAsSystemAccount " + ` - "with any other permission than Full Control") + "with any other permission than Full Control") } } @@ -257,7 +257,7 @@ function Set-TargetResource ($member.PermissionLevel -ne "Full Control")) { throw ("MembersToInclude Parameter: You cannot specify ActAsSystemAccount " + ` - "with any other permission than Full Control") + "with any other permission than Full Control") } } @@ -279,14 +279,14 @@ function Set-TargetResource if ($cacheAccounts.SuperUserAccount -eq "" -or $cacheAccounts.SuperReaderAccount -eq "") { throw ("Cache accounts not configured properly. PortalSuperUserAccount or " + ` - "PortalSuperReaderAccount property is not configured.") + "PortalSuperReaderAccount property is not configured.") } } # Determine the default identity type to use for entries that do not have it specified $defaultIdentityType = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $wa = Get-SPWebApplication -Identity $params.WebAppUrl @@ -313,7 +313,7 @@ function Set-TargetResource if ($MembersToInclude) { Write-Verbose -Message ("MembersToInclude property is set - setting membership " + ` - "list to ensure specified members are included") + "list to ensure specified members are included") $membersToCheck = $MembersToInclude } foreach ($member in $membersToCheck) @@ -326,57 +326,60 @@ function Set-TargetResource { Write-Verbose -Message "SetCacheAccountsPolicy is True - Adding Cache Accounts to list" $psuAccount = @{ - UserName = $cacheAccounts.SuperUserAccount + UserName = $cacheAccounts.SuperUserAccount PermissionLevel = "Full Control" - IdentityMode = $cacheAccounts.IdentityMode + IdentityMode = $cacheAccounts.IdentityMode } $allMembers += $psuAccount $psrAccount = @{ - UserName = $cacheAccounts.SuperReaderAccount + UserName = $cacheAccounts.SuperReaderAccount PermissionLevel = "Full Read" - IdentityMode = $cacheAccounts.IdentityMode + IdentityMode = $cacheAccounts.IdentityMode } $allMembers += $psrAccount } # Get the list of differences from the current configuration $differences = Compare-SPDscWebAppPolicy -WAPolicies $CurrentValues.Members ` - -DSCSettings $allMembers ` - -DefaultIdentityType $defaultIdentityType + -DSCSettings $allMembers ` + -DefaultIdentityType $defaultIdentityType foreach ($difference in $differences) { switch ($difference.Status) { - Additional { + Additional + { # Only remove users if the "Members" property was set # instead of "MembersToInclude" if ($Members) { $user = @{ - Type = "Delete" - Username = $difference.Username + Type = "Delete" + Username = $difference.Username IdentityMode = $difference.IdentityType } } } - Different { + Different + { $user = @{ - Type = "Change" - Username = $difference.Username + Type = "Change" + Username = $difference.Username PermissionLevel = $difference.DesiredPermissionLevel ActAsSystemAccount = $difference.DesiredActAsSystemSetting - IdentityMode = $difference.IdentityType + IdentityMode = $difference.IdentityType } } - Missing { + Missing + { $user = @{ - Type = "Add" - Username = $difference.Username + Type = "Add" + Username = $difference.Username PermissionLevel = $difference.DesiredPermissionLevel ActAsSystemAccount = $difference.DesiredActAsSystemSetting - IdentityMode = $difference.IdentityType + IdentityMode = $difference.IdentityType } } } @@ -387,7 +390,7 @@ function Set-TargetResource if ($MembersToExclude) { Write-Verbose -Message ("MembersToExclude property is set - setting membership list " + ` - "to ensure specified members are not included") + "to ensure specified members are not included") foreach ($member in $MembersToExclude) { @@ -414,10 +417,10 @@ function Set-TargetResource ## Perform changes Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters,$PSScriptRoot,$changeUsers) ` - -ScriptBlock { - $params = $args[0] - $scriptRoot = $args[1] + -Arguments @($PSBoundParameters, $PSScriptRoot, $changeUsers) ` + -ScriptBlock { + $params = $args[0] + $scriptRoot = $args[1] $changeUsers = $args[2] $modulePath = "..\..\Modules\SharePointDsc.WebAppPolicy\SPWebAppPolicy.psm1" @@ -430,10 +433,10 @@ function Set-TargetResource throw "Specified web application could not be found." } - $denyAll = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::DenyAll) - $denyWrite = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::DenyWrite) + $denyAll = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::DenyAll) + $denyWrite = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::DenyWrite) $fullControl = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullControl) - $fullRead = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullRead) + $fullRead = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullRead) Write-Verbose -Message "Processing changes" @@ -441,7 +444,8 @@ function Set-TargetResource { switch ($user.Type) { - "Add" { + "Add" + { # User does not exist. Add user Write-Verbose -Message "Adding $($user.Username)" @@ -452,13 +456,13 @@ function Set-TargetResource if ($isUser -eq $true) { $principal = New-SPClaimsPrincipal -Identity $user.Username ` - -IdentityType WindowsSamAccountName + -IdentityType WindowsSamAccountName $userToAdd = $principal.ToEncodedString() } else { $principal = New-SPClaimsPrincipal -Identity $user.Username ` - -IdentityType WindowsSecurityGroupName + -IdentityType WindowsSecurityGroupName $userToAdd = $principal.ToEncodedString() } } @@ -467,16 +471,20 @@ function Set-TargetResource { switch ($permissionLevel) { - "Deny All" { + "Deny All" + { $newPolicy.PolicyRoleBindings.Add($denyAll) } - "Deny Write" { + "Deny Write" + { $newPolicy.PolicyRoleBindings.Add($denyWrite) } - "Full Control" { + "Full Control" + { $newPolicy.PolicyRoleBindings.Add($fullControl) } - "Full Read" { + "Full Read" + { $newPolicy.PolicyRoleBindings.Add($fullRead) } } @@ -486,7 +494,8 @@ function Set-TargetResource $newPolicy.IsSystemUser = $user.ActAsSystemAccount } } - "Change" { + "Change" + { # User exists. Check permissions $userToChange = $user.Username if ($user.IdentityMode -eq "Claims") @@ -495,13 +504,13 @@ function Set-TargetResource if ($isUser -eq $true) { $principal = New-SPClaimsPrincipal -Identity $user.Username ` - -IdentityType WindowsSamAccountName + -IdentityType WindowsSamAccountName $userToChange = $principal.ToEncodedString() } else { $principal = New-SPClaimsPrincipal -Identity $user.Username ` - -IdentityType WindowsSecurityGroupName + -IdentityType WindowsSecurityGroupName $userToChange = $principal.ToEncodedString() } } @@ -536,7 +545,7 @@ function Set-TargetResource } $polbinddiff = Compare-Object -ReferenceObject $userPermissionlevel ` - -DifferenceObject $user.PermissionLevel + -DifferenceObject $user.PermissionLevel if ($null -ne $polbinddiff) { $policy.PolicyRoleBindings.RemoveAll() @@ -544,16 +553,20 @@ function Set-TargetResource { switch ($permissionLevel) { - "Deny All" { + "Deny All" + { $policy.PolicyRoleBindings.Add($denyAll) } - "Deny Write" { + "Deny Write" + { $policy.PolicyRoleBindings.Add($denyWrite) } - "Full Control" { + "Full Control" + { $policy.PolicyRoleBindings.Add($fullControl) } - "Full Read" { + "Full Read" + { $policy.PolicyRoleBindings.Add($fullRead) } } @@ -570,19 +583,19 @@ function Set-TargetResource if ($isUser -eq $true) { $principal = New-SPClaimsPrincipal -Identity $user.Username ` - -IdentityType WindowsSamAccountName + -IdentityType WindowsSamAccountName $userToDrop = $principal.ToEncodedString() } else { $principal = New-SPClaimsPrincipal -Identity $user.Username ` - -IdentityType WindowsSecurityGroupName + -IdentityType WindowsSecurityGroupName $userToDrop = $principal.ToEncodedString() } } Remove-SPDscGenericObject -SourceCollection $wa.Policies ` - -Target $userToDrop ` - -ErrorAction SilentlyContinue + -Target $userToDrop ` + -ErrorAction SilentlyContinue } } } @@ -593,7 +606,7 @@ function Set-TargetResource function Test-TargetResource { [CmdletBinding()] - [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseIdenticalMandatoryParametersForDSC", "", Justification = "Temporary workaround for issue introduced in PSSA v1.18")] [OutputType([System.Boolean])] param ( @@ -644,14 +657,14 @@ function Test-TargetResource ($cacheAccounts.SuperReaderAccount -eq "")) { throw "Cache accounts not configured properly. PortalSuperUserAccount or " + ` - "PortalSuperReaderAccount property is not configured." + "PortalSuperReaderAccount property is not configured." } } # Determine the default identity type to use for entries that do not have it specified $defaultIdentityType = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $wa = Get-SPWebApplication -Identity $params.WebAppUrl @@ -678,7 +691,7 @@ function Test-TargetResource if ($MembersToInclude) { Write-Verbose -Message ("MembersToInclude property is set - testing membership " + ` - "list to ensure specified members are included") + "list to ensure specified members are included") $membersToCheck = $MembersToInclude } foreach ($member in $membersToCheck) @@ -691,24 +704,24 @@ function Test-TargetResource { Write-Verbose -Message "SetCacheAccountsPolicy is True - Adding Cache Accounts to list" $psuAccount = @{ - UserName = $cacheAccounts.SuperUserAccount + UserName = $cacheAccounts.SuperUserAccount PermissionLevel = "Full Control" - IdentityMode = $cacheAccounts.IdentityMode + IdentityMode = $cacheAccounts.IdentityMode } $allMembers += $psuAccount $psrAccount = @{ - UserName = $cacheAccounts.SuperReaderAccount + UserName = $cacheAccounts.SuperReaderAccount PermissionLevel = "Full Read" - IdentityMode = $cacheAccounts.IdentityMode + IdentityMode = $cacheAccounts.IdentityMode } $allMembers += $psrAccount } # Get the list of differences from the current configuration $differences = Compare-SPDscWebAppPolicy -WAPolicies $CurrentValues.Members ` - -DSCSettings $allMembers ` - -DefaultIdentityType $defaultIdentityType + -DSCSettings $allMembers ` + -DefaultIdentityType $defaultIdentityType # If checking members, any difference counts as a fail if ($Members) @@ -728,8 +741,8 @@ function Test-TargetResource if ($MembersToInclude) { if (($differences | Where-Object -FilterScript { - $_.Status -eq "Different" -or $_.Status -eq "Missing" - }).Count -eq 0) + $_.Status -eq "Different" -or $_.Status -eq "Missing" + }).Count -eq 0) { return $true } @@ -746,7 +759,7 @@ function Test-TargetResource if ($MembersToExclude) { Write-Verbose -Message ("MembersToExclude property is set - checking for permissions " + ` - "that need to be removed") + "that need to be removed") foreach ($member in $MembersToExclude) { if (($cacheAccounts.SuperUserAccount -eq $member.Username) -or ` @@ -778,8 +791,8 @@ function Get-SPDscCacheAccountConfiguration() ) $cacheAccounts = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $InputParameters ` - -ScriptBlock { + -Arguments $InputParameters ` + -ScriptBlock { Write-Verbose -Message "Retrieving CacheAccounts" $params = $args[0] @@ -791,7 +804,7 @@ function Get-SPDscCacheAccountConfiguration() } $returnval = @{ - SuperUserAccount = "" + SuperUserAccount = "" SuperReaderAccount = "" } @@ -801,8 +814,8 @@ function Get-SPDscCacheAccountConfiguration() if ($wa.UseClaimsAuthentication -eq $true) { $convertedClaim = New-SPClaimsPrincipal -Identity $memberName ` - -IdentityType EncodedClaim ` - -ErrorAction SilentlyContinue + -IdentityType EncodedClaim ` + -ErrorAction SilentlyContinue if ($null -ne $convertedClaim) { $memberName = $convertedClaim.Value @@ -816,8 +829,8 @@ function Get-SPDscCacheAccountConfiguration() if ($wa.UseClaimsAuthentication -eq $true) { $convertedClaim = New-SPClaimsPrincipal -Identity $memberName ` - -IdentityType EncodedClaim ` - -ErrorAction SilentlyContinue + -IdentityType EncodedClaim ` + -ErrorAction SilentlyContinue if ($null -ne $convertedClaim) { $memberName = $convertedClaim.Value diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.schema.mof b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.schema.mof index c1ddce796..0f10cf83d 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.schema.mof +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.schema.mof @@ -13,6 +13,6 @@ class MSFT_SPWebAppPolicy : OMI_BaseResource [Write, Description("Exact list of accounts that will have to get Web Policy permissions"), EmbeddedInstance("MSFT_SPWebPolicyPermissions")] String Members[]; [Write, Description("List of all accounts that must be in the Web Policy group"), EmbeddedInstance("MSFT_SPWebPolicyPermissions")] String MembersToInclude[]; [Write, Description("List of all accounts that are not allowed to have any Web Policy permissions"), EmbeddedInstance("MSFT_SPWebPolicyPermissions")] String MembersToExclude[]; - [Write, Description("Include the Cache Accounts in the policy or not")] Boolean SetCacheAccountsPolicy; + [Write, Description("Include the Cache Accounts in the policy or not")] Boolean SetCacheAccountsPolicy; [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPropertyBag/MSFT_SPWebAppPropertyBag.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPropertyBag/MSFT_SPWebAppPropertyBag.psm1 index e5921e872..fcc9fcfc8 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPropertyBag/MSFT_SPWebAppPropertyBag.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppPropertyBag/MSFT_SPWebAppPropertyBag.psm1 @@ -17,7 +17,7 @@ function Get-TargetResource() $Value, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = 'Present', @@ -29,8 +29,8 @@ function Get-TargetResource() Write-Verbose -Message "Looking for SPWebApplication property '$Key'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $spWebApp = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue @@ -85,7 +85,7 @@ function Set-TargetResource() $Value, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = 'Present', @@ -97,8 +97,8 @@ function Set-TargetResource() Write-Verbose -Message "Setting SPWebApplication property '$Key'" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $spWebApp = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue @@ -137,7 +137,7 @@ function Test-TargetResource() $Value, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = 'Present', @@ -156,14 +156,14 @@ function Test-TargetResource() if ($Ensure -eq 'Present') { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @('Ensure','Key', 'Value') + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @('Ensure', 'Key', 'Value') } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @('Ensure','Key') + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @('Ensure', 'Key') } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.psm1 index 0791e0e62..a06b4d34a 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.psm1 @@ -20,34 +20,34 @@ function Get-TargetResource Write-Verbose -Message "Getting $WebAppUrl Service Proxy Group Association" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $WebApp = get-spwebapplication $params.WebAppUrl if (!$WebApp) { - return @{ + return @{ WebAppUrl = $null ServiceAppProxyGroup = $null InstallAccount = $InstallAccount - } + } } - if ($WebApp.ServiceApplicationProxyGroup.friendlyname -eq "[default]") - { - $ServiceAppProxyGroup = "Default" - } - else - { - $ServiceAppProxyGroup = $WebApp.ServiceApplicationProxyGroup.name - } - - return @{ - WebAppUrl = $params.WebAppUrl - ServiceAppProxyGroup = $ServiceAppProxyGroup - InstallAccount = $InstallAccount - } + if ($WebApp.ServiceApplicationProxyGroup.friendlyname -eq "[default]") + { + $ServiceAppProxyGroup = "Default" + } + else + { + $ServiceAppProxyGroup = $WebApp.ServiceApplicationProxyGroup.name + } + + return @{ + WebAppUrl = $params.WebAppUrl + ServiceAppProxyGroup = $ServiceAppProxyGroup + InstallAccount = $InstallAccount + } } return $result @@ -74,17 +74,17 @@ function Set-TargetResource Write-Verbose -Message "Setting $WebAppUrl Service Proxy Group Association" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] if ($params.ServiceAppProxyGroup -eq "Default") { - $params.ServiceAppProxyGroup = "[default]" + $params.ServiceAppProxyGroup = "[default]" } Set-SPWebApplication -Identity $params.WebAppUrl ` - -ServiceApplicationProxyGroup $params.ServiceAppProxyGroup + -ServiceApplicationProxyGroup $params.ServiceAppProxyGroup } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.schema.mof b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.schema.mof index e57811698..b0b39e756 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.schema.mof +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.schema.mof @@ -2,6 +2,6 @@ class MSFT_SPWebAppProxyGroup : OMI_BaseResource { [Key, Description("URL of the web application")] String WebAppUrl; - [Required, Description("Name of the Service Application Proxy Group")] string ServiceAppProxyGroup; + [Required, Description("Name of the Service Application Proxy Group")] string ServiceAppProxyGroup; [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.psm1 index 487a3378f..605ab1248 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.psm1 @@ -21,7 +21,7 @@ function Get-TargetResource $AutomaticallyDeleteUnusedSiteCollections, [Parameter()] - [ValidateRange(2,168)] + [ValidateRange(2, 168)] [System.UInt32] $UnusedSiteNotificationsBeforeDeletion, @@ -33,8 +33,8 @@ function Get-TargetResource Write-Verbose -Message "Getting web application '$WebAppUrl' site use and deletion settings" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $nullReturn = @{ @@ -53,12 +53,12 @@ function Get-TargetResource catch { Write-Verbose -Message ("No local SharePoint farm was detected. Site Use and " + ` - "Deletion settings will not be applied") + "Deletion settings will not be applied") return $nullReturn } $wa = Get-SPWebApplication -Identity $params.WebAppUrl ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue if ($null -eq $wa) { return $nullReturn @@ -100,7 +100,7 @@ function Set-TargetResource $AutomaticallyDeleteUnusedSiteCollections, [Parameter()] - [ValidateRange(2,168)] + [ValidateRange(2, 168)] [System.UInt32] $UnusedSiteNotificationsBeforeDeletion, @@ -112,8 +112,8 @@ function Set-TargetResource Write-Verbose -Message "Setting web application '$WebAppUrl' Site Use and Deletion settings" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] try @@ -123,7 +123,7 @@ function Set-TargetResource catch { throw ("No local SharePoint farm was detected. Site Use and Deletion settings " + ` - "will not be applied") + "will not be applied") } $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue @@ -143,28 +143,31 @@ function Set-TargetResource # Check schedule value switch ($job.Schedule.Description) { - "Daily" { + "Daily" + { if (($params.UnusedSiteNotificationsBeforeDeletion -lt 28) -or ($params.UnusedSiteNotificationsBeforeDeletion -gt 168)) { throw ("Value of UnusedSiteNotificationsBeforeDeletion has to be >28 and " + ` - "<168 when the schedule is set to daily") + "<168 when the schedule is set to daily") } } - "Weekly" { + "Weekly" + { if (($params.UnusedSiteNotificationsBeforeDeletion -lt 4) -or ($params.UnusedSiteNotificationsBeforeDeletion -gt 24)) { throw ("Value of UnusedSiteNotificationsBeforeDeletion has to be >4 and " + ` - "<24 when the schedule is set to weekly") + "<24 when the schedule is set to weekly") } } - "Monthly" { + "Monthly" + { if (($params.UnusedSiteNotificationsBeforeDeletion -lt 2) -or ($params.UnusedSiteNotificationsBeforeDeletion -gt 6)) { throw ("Value of UnusedSiteNotificationsBeforeDeletion has to be >2 and " + ` - "<6 when the schedule is set to monthly") + "<6 when the schedule is set to monthly") } } } @@ -220,7 +223,7 @@ function Test-TargetResource $AutomaticallyDeleteUnusedSiteCollections, [Parameter()] - [ValidateRange(2,168)] + [ValidateRange(2, 168)] [System.UInt32] $UnusedSiteNotificationsBeforeDeletion, @@ -237,7 +240,7 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters + -DesiredValues $PSBoundParameters } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppSuiteBar/MSFT_SPWebAppSuiteBar.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppSuiteBar/MSFT_SPWebAppSuiteBar.psm1 index 45c37039e..1ad626122 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppSuiteBar/MSFT_SPWebAppSuiteBar.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppSuiteBar/MSFT_SPWebAppSuiteBar.psm1 @@ -36,12 +36,12 @@ function Get-TargetResource Write-Verbose -Message "Getting web app suite bar properties for $WebAppUrl" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $wa = Get-SPWebApplication -Identity $params.WebAppUrl ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $returnval = @{ WebAppUrl = $null @@ -69,9 +69,9 @@ function Get-TargetResource if ($installedVersion.FileMajorPart -ge 16) { $returnval.SuiteNavBrandingLogoNavigationUrl = $wa.SuiteNavBrandingLogoNavigationUrl - $returnval.SuiteNavBrandingLogoTitle = $wa.SuiteNavBrandingLogoTitle - $returnval.SuiteNavBrandingLogoUrl = $wa.SuiteNavBrandingLogoUrl - $returnval.SuiteNavBrandingText = $wa.SuiteNavBrandingText + $returnval.SuiteNavBrandingLogoTitle = $wa.SuiteNavBrandingLogoTitle + $returnval.SuiteNavBrandingLogoUrl = $wa.SuiteNavBrandingLogoUrl + $returnval.SuiteNavBrandingText = $wa.SuiteNavBrandingText } return $returnval @@ -118,26 +118,26 @@ function Set-TargetResource $installedVersion = Get-SPDscInstalledProductVersion <# Handle SP2013 #> - switch($installedVersion.FileMajorPart) + switch ($installedVersion.FileMajorPart) { 15 { <# Exception: One of the SP2016/SP2019 specific parameter was passed with SP2013 #> if ($PSBoundParameters.ContainsKey("SuiteNavBrandingLogoNavigationUrl") ` - -or $PSBoundParameters.ContainsKey("SuiteNavBrandingLogoTitle") ` - -or $PSBoundParameters.ContainsKey("SuiteNavBrandingLogoUrl") ` - -or $PSBoundParameters.ContainsKey("SuiteNavBrandingText")) + -or $PSBoundParameters.ContainsKey("SuiteNavBrandingLogoTitle") ` + -or $PSBoundParameters.ContainsKey("SuiteNavBrandingLogoUrl") ` + -or $PSBoundParameters.ContainsKey("SuiteNavBrandingText")) { throw ("Cannot specify SuiteNavBrandingLogoNavigationUrl, SuiteNavBrandingLogoTitle, " + ` - "SuiteNavBrandingLogoUrl or SuiteNavBrandingText with SharePoint 2013. Instead," + ` - " only specify the SuiteBarBrandingElementHtml parameter") + "SuiteNavBrandingLogoUrl or SuiteNavBrandingText with SharePoint 2013. Instead," + ` + " only specify the SuiteBarBrandingElementHtml parameter") } <# Exception: The SP2013 optional parameter is null. #> if (!$PSBoundParameters.ContainsKey("SuiteBarBrandingElementHtml")) { throw ("You need to specify a value for the SuiteBarBrandingElementHtml parameter with" + ` - " SharePoint 2013") + " SharePoint 2013") } } 16 @@ -145,19 +145,19 @@ function Set-TargetResource if ($PSBoundParameters.ContainsKey("SuiteBarBrandingElementHtml")) { Write-Verbose ("SuiteBarBrandingElementHtml with SharePoint 2016 and 2019 only works " + ` - "if using a SharePoint 2013 masterpage") + "if using a SharePoint 2013 masterpage") } <# Exception: All the optional parameters are null for SP2016/SP2019. #> if (!$PSBoundParameters.ContainsKey("SuiteNavBrandingLogoNavigationUrl") ` - -and !$PSBoundParameters.ContainsKey("SuiteNavBrandingLogoTitle") ` - -and !$PSBoundParameters.ContainsKey("SuiteNavBrandingLogoUrl") ` - -and !$PSBoundParameters.ContainsKey("SuiteNavBrandingText") ` - -and !$PSBoundParameters.ContainsKey("SuiteBarBrandingElementHtml")) + -and !$PSBoundParameters.ContainsKey("SuiteNavBrandingLogoTitle") ` + -and !$PSBoundParameters.ContainsKey("SuiteNavBrandingLogoUrl") ` + -and !$PSBoundParameters.ContainsKey("SuiteNavBrandingText") ` + -and !$PSBoundParameters.ContainsKey("SuiteBarBrandingElementHtml")) { throw ("You need to specify a value for either SuiteNavBrandingLogoNavigationUrl, " + ` - "SuiteNavBrandingLogoTitle, SuiteNavBrandingLogoUrl, SuiteNavBrandingText " + ` - "or SuiteBarBrandingElementHtml with SharePoint 2016 or 2019") + "SuiteNavBrandingLogoTitle, SuiteNavBrandingLogoUrl, SuiteNavBrandingText " + ` + "or SuiteBarBrandingElementHtml with SharePoint 2016 or 2019") } } } @@ -171,8 +171,8 @@ function Set-TargetResource ## Perform changes Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters) ` - -ScriptBlock { + -Arguments @($PSBoundParameters) ` + -ScriptBlock { $params = $args[0] $installedVersion = Get-SPDscInstalledProductVersion @@ -254,18 +254,18 @@ function Test-TargetResource if ($installedVersion.FileMajorPart -eq 15) { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("SuiteBarBrandingElementHtml"); + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("SuiteBarBrandingElementHtml"); } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("SuiteBarBrandingElementHtml", - "SuiteNavBrandingLogoNavigationUrl", - "SuiteNavBrandingLogoTitle", - "SuiteNavBrandingLogoUrl", - "SuiteNavBrandingText") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("SuiteBarBrandingElementHtml", + "SuiteNavBrandingLogoNavigationUrl", + "SuiteNavBrandingLogoTitle", + "SuiteNavBrandingLogoUrl", + "SuiteNavBrandingText") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.psm1 index 71a784dfa..3c2f499a4 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.psm1 @@ -59,7 +59,7 @@ function Get-TargetResource Write-Verbose -Message "Getting web application '$WebAppUrl' throttling settings" - $paramArgs = @($PSBoundParameters,$PSScriptRoot) + $paramArgs = @($PSBoundParameters, $PSScriptRoot) $result = Invoke-SPDscCommand -Credential $InstallAccount -Arguments $paramArgs -ScriptBlock { $params = $args[0] $ScriptRoot = $args[1] @@ -154,7 +154,7 @@ function Set-TargetResource Write-Verbose -Message "Setting web application '$WebAppUrl' throttling settings" - $paramArgs = @($PSBoundParameters,$PSScriptRoot) + $paramArgs = @($PSBoundParameters, $PSScriptRoot) $null = Invoke-SPDscCommand -Credential $InstallAccount -Arguments $paramArgs -ScriptBlock { $params = $args[0] @@ -252,7 +252,7 @@ function Test-TargetResource $relPath = "..\..\Modules\SharePointDsc.WebApplication\SPWebApplication.Throttling.psm1" Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath $relPath -Resolve) return Test-SPDscWebApplicationThrottlingConfig -CurrentSettings $CurrentValues ` - -DesiredSettings $PSBoundParameters + -DesiredSettings $PSBoundParameters } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.psm1 index 75cd8b158..35a282e33 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.psm1 @@ -27,10 +27,10 @@ function Get-TargetResource Write-Verbose -Message "Getting web application '$WebAppUrl' workflow settings" - $paramArgs = @($PSBoundParameters,$PSScriptRoot) + $paramArgs = @($PSBoundParameters, $PSScriptRoot) $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $paramArgs ` - -ScriptBlock { + -Arguments $paramArgs ` + -ScriptBlock { $params = $args[0] $ScriptRoot = $args[1] @@ -85,10 +85,10 @@ function Set-TargetResource Write-Verbose -Message "Setting web application '$WebAppUrl' workflow settings" - $paramArgs = @($PSBoundParameters,$PSScriptRoot) + $paramArgs = @($PSBoundParameters, $PSScriptRoot) $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $paramArgs ` - -ScriptBlock { + -Arguments $paramArgs ` + -ScriptBlock { $params = $args[0] $ScriptRoot = $args[1] @@ -140,9 +140,9 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" $relPath = "..\..\Modules\SharePointDsc.WebApplication\SPWebApplication.Workflow.psm1" - Import-Module (Join-Path $PSScriptRoot $relPath -Resolve) + Import-Module (Join-Path $PSScriptRoot $relPath -Resolve) return Test-SPDscWebApplicationWorkflowConfig -CurrentSettings $CurrentValues ` - -DesiredSettings $PSBoundParameters + -DesiredSettings $PSBoundParameters } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.psm1 index 274e813f9..4169115dd 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.psm1 @@ -49,7 +49,7 @@ function Get-TargetResource $UseClassic = $false, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -61,8 +61,8 @@ function Get-TargetResource Write-Verbose -Message "Getting web application '$Name' config" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $wa = Get-SPWebApplication -Identity $params.Name -ErrorAction SilentlyContinue @@ -155,7 +155,7 @@ function Set-TargetResource $UseClassic = $false, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -171,17 +171,17 @@ function Set-TargetResource if ($Ensure -eq "Present") { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $wa = Get-SPWebApplication -Identity $params.Name -ErrorAction SilentlyContinue if ($null -eq $wa) { $newWebAppParams = @{ - Name = $params.Name + Name = $params.Name ApplicationPool = $params.ApplicationPool - Url = $params.WebAppUrl + Url = $params.WebAppUrl } # Get a reference to the Administration WebService @@ -204,13 +204,13 @@ function Set-TargetResource if ($_.Exception.Message -like "*No matching accounts were found*") { throw ("The specified managed account was not found. Please make " + ` - "sure the managed account exists before continuing.") + "sure the managed account exists before continuing.") return } else { throw ("Error occurred. Web application was not created. Error " + ` - "details: $($_.Exception.Message)") + "details: $($_.Exception.Message)") return } } @@ -259,8 +259,8 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $wa = Get-SPWebApplication -Identity $params.Name -ErrorAction SilentlyContinue @@ -323,7 +323,7 @@ function Test-TargetResource $UseClassic = $false, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -342,8 +342,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" $testReturn = Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") return $testReturn } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.psm1 index abc8989ca..728807d97 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.psm1 @@ -14,7 +14,7 @@ function Get-TargetResource [Parameter(Mandatory = $true)] [System.String] - [ValidateSet("Default","Internet","Intranet","Extranet","Custom")] + [ValidateSet("Default", "Internet", "Intranet", "Extranet", "Custom")] $Zone, [Parameter()] @@ -33,11 +33,11 @@ function Get-TargetResource Write-Verbose -Message "Getting app domain settings for '$AppDomain'" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $webAppAppDomain = Get-SPWebApplicationAppDomain -WebApplication $params.WebAppUrl ` - -Zone $params.Zone + -Zone $params.Zone if ($null -eq $webAppAppDomain) { @@ -79,7 +79,7 @@ function Set-TargetResource [Parameter(Mandatory = $true)] [System.String] - [ValidateSet("Default","Internet","Intranet","Extranet","Custom")] + [ValidateSet("Default", "Internet", "Intranet", "Extranet", "Custom")] $Zone, [Parameter()] @@ -100,15 +100,15 @@ function Set-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $CurrentValues) ` - -ScriptBlock { + -Arguments @($PSBoundParameters, $CurrentValues) ` + -ScriptBlock { $params = $args[0] $CurrentValues = $args[1] if ($null -ne $CurrentValues.AppDomain) { Get-SPWebApplicationAppDomain -WebApplication $params.WebAppUrl ` - -Zone $params.Zone | Remove-SPWebApplicationAppDomain + -Zone $params.Zone | Remove-SPWebApplicationAppDomain Start-Sleep -Seconds 5 } @@ -146,7 +146,7 @@ function Test-TargetResource [Parameter(Mandatory = $true)] [System.String] - [ValidateSet("Default","Internet","Intranet","Extranet","Custom")] + [ValidateSet("Default", "Internet", "Intranet", "Extranet", "Custom")] $Zone, [Parameter()] @@ -170,8 +170,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("AppDomain", "Port", "SSL") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("AppDomain", "Port", "SSL") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.psm1 index 25d8001ef..a71616857 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.psm1 @@ -17,7 +17,7 @@ function Get-TargetResource $Url, [Parameter(Mandatory = $true)] - [ValidateSet("Default","Intranet","Internet","Extranet","Custom")] + [ValidateSet("Default", "Intranet", "Internet", "Extranet", "Custom")] [System.String] $Zone, @@ -42,7 +42,7 @@ function Get-TargetResource $UseSSL, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -54,8 +54,8 @@ function Get-TargetResource Write-Verbose -Message "Getting web application extension '$Name' config" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue @@ -103,7 +103,7 @@ function Get-TargetResource $UseSSL = $false } - return @{ + return @{ WebAppUrl = $params.WebAppUrl Name = $waExt.ServerComment Url = $PublicURL @@ -125,7 +125,7 @@ function Set-TargetResource { [CmdletBinding()] param - ( + ( [Parameter(Mandatory = $true)] [System.String] $WebAppUrl, @@ -139,7 +139,7 @@ function Set-TargetResource $Url, [Parameter(Mandatory = $true)] - [ValidateSet("Default","Intranet","Internet","Extranet","Custom")] + [ValidateSet("Default", "Intranet", "Internet", "Extranet", "Custom")] [System.String] $Zone, @@ -164,7 +164,7 @@ function Set-TargetResource $UseSSL, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -178,8 +178,8 @@ function Set-TargetResource if ($Ensure -eq "Present") { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue @@ -196,7 +196,7 @@ function Set-TargetResource { $newWebAppExtParams = @{ Name = $params.Name - Url = $params.Url + Url = $params.Url Zone = $params.zone } @@ -237,8 +237,8 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue @@ -260,7 +260,7 @@ function Test-TargetResource [CmdletBinding()] [OutputType([System.Boolean])] param - ( + ( [Parameter(Mandatory = $true)] [System.String] $WebAppUrl, @@ -274,7 +274,7 @@ function Test-TargetResource $Url, [Parameter(Mandatory = $true)] - [ValidateSet("Default","Intranet","Internet","Extranet","Custom")] + [ValidateSet("Default", "Intranet", "Internet", "Extranet", "Custom")] [System.String] $Zone, @@ -299,7 +299,7 @@ function Test-TargetResource $UseSSL, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -318,8 +318,8 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" $testReturn = Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure","AllowAnonymous") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure", "AllowAnonymous") return $testReturn } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.schema.mof b/Modules/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.schema.mof index a407932b7..f777fd794 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.schema.mof +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.schema.mof @@ -4,7 +4,7 @@ class MSFT_SPWebApplicationExtension : OMI_BaseResource [Key, Description("The URL of the parent web application")] string WebAppUrl; [Required, Description("The name of the web application extension")] string Name; [Required, Description("The URL of the web application extension")] string Url; - [Key, Description("Specifies one of the five zones with which the internal URL of this new extension is to be associated."),ValueMap{"Default","Intranet","Internet","Extranet","Custom"}, Values{"Default","Intranet","Internet","Extranet","Custom"}] string Zone; + [Key, Description("Specifies one of the five zones with which the internal URL of this new extension is to be associated."),ValueMap{"Default","Intranet","Internet","Extranet","Custom"}, Values{"Default","Intranet","Internet","Extranet","Custom"}] string Zone; [Write, Description("Should anonymous access be enabled for this web app extension")] boolean AllowAnonymous; [Write, Description("The host header to use for the web app extension")] string HostHeader; [Write, Description("The path on the local servers to host the IIS web site from")] string Path; diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.psm1 index 07cf58240..6cdd03bea 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.psm1 @@ -9,7 +9,7 @@ function Get-TargetResource $Name, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -26,7 +26,7 @@ function Get-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("docx","doc","mht","rtf","xml")] + [ValidateSet("docx", "doc", "mht", "rtf", "xml")] [System.String[]] $SupportedFileFormats, @@ -35,12 +35,12 @@ function Get-TargetResource $DisableEmbeddedFonts, [Parameter()] - [ValidateRange(10,100)] + [ValidateRange(10, 100)] [System.UInt32] $MaximumMemoryUsage, [Parameter()] - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [System.UInt32] $RecycleThreshold, @@ -49,12 +49,12 @@ function Get-TargetResource $DisableBinaryFileScan, [Parameter()] - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [System.UInt32] $ConversionProcesses, [Parameter()] - [ValidateRange(1,59)] + [ValidateRange(1, 59)] [System.UInt32] $JobConversionFrequency, @@ -63,27 +63,27 @@ function Get-TargetResource $NumberOfConversionsPerProcess, [Parameter()] - [ValidateRange(1,60)] + [ValidateRange(1, 60)] [System.UInt32] $TimeBeforeConversionIsMonitored, [Parameter()] - [ValidateRange(1,10)] + [ValidateRange(1, 10)] [System.UInt32] $MaximumConversionAttempts, [Parameter()] - [ValidateRange(1,60)] + [ValidateRange(1, 60)] [System.UInt32] $MaximumSyncConversionRequests, [Parameter()] - [ValidateRange(10,60)] + [ValidateRange(10, 60)] [System.UInt32] $KeepAliveTimeout, [Parameter()] - [ValidateRange(60,3600)] + [ValidateRange(60, 3600)] [System.UInt32] $MaximumConversionTime, @@ -97,21 +97,21 @@ function Get-TargetResource $PSBoundParameters.Ensure = $Ensure if (($ApplicationPool -or ` - $DatabaseName -or ` - $DatabaseServer -or ` - $SupportedFileFormats -or ` - $DisableEmbeddedFonts -or ` - $MaximumMemoryUsage -or ` - $RecycleThreshold -or ` - $DisableBinaryFileScan -or ` - $ConversionProcesses -or ` - $JobConversionFrequency -or ` - $NumberOfConversionsPerProcess -or ` - $TimeBeforeConversionIsMonitored -or ` - $MaximumConversionAttempts -or ` - $MaximumSyncConversionRequests -or ` - $KeepAliveTimeout -or ` - $MaximumConversionTime) -and ` + $DatabaseName -or ` + $DatabaseServer -or ` + $SupportedFileFormats -or ` + $DisableEmbeddedFonts -or ` + $MaximumMemoryUsage -or ` + $RecycleThreshold -or ` + $DisableBinaryFileScan -or ` + $ConversionProcesses -or ` + $JobConversionFrequency -or ` + $NumberOfConversionsPerProcess -or ` + $TimeBeforeConversionIsMonitored -or ` + $MaximumConversionAttempts -or ` + $MaximumSyncConversionRequests -or ` + $KeepAliveTimeout -or ` + $MaximumConversionTime) -and ` ($Ensure -eq "Absent")) { throw "You cannot use any of the parameters when Ensure is specified as Absent" @@ -120,16 +120,16 @@ function Get-TargetResource if (($Ensure -eq "Present") -and -not ($ApplicationPool -and $DatabaseName)) { throw ("An Application Pool and Database Name are required to configure the Word " + ` - "Automation Service Application") + "Automation Service Application") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue + -ErrorAction SilentlyContinue $nullReturn = @{ Name = $params.Name Ensure = "Absent" @@ -172,7 +172,7 @@ function Get-TargetResource $supportedFileFormats += "xml" } - $returnVal = @{ + $returnVal = @{ Name = $serviceApp.DisplayName Ensure = "Present" ApplicationPool = $serviceApp.ApplicationPool.Name @@ -209,7 +209,7 @@ function Set-TargetResource $Name, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -226,7 +226,7 @@ function Set-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("docx","doc","mht","rtf","xml")] + [ValidateSet("docx", "doc", "mht", "rtf", "xml")] [System.String[]] $SupportedFileFormats, @@ -235,12 +235,12 @@ function Set-TargetResource $DisableEmbeddedFonts, [Parameter()] - [ValidateRange(10,100)] + [ValidateRange(10, 100)] [System.UInt32] $MaximumMemoryUsage, [Parameter()] - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [System.UInt32] $RecycleThreshold, @@ -249,12 +249,12 @@ function Set-TargetResource $DisableBinaryFileScan, [Parameter()] - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [System.UInt32] $ConversionProcesses, [Parameter()] - [ValidateRange(1,59)] + [ValidateRange(1, 59)] [System.UInt32] $JobConversionFrequency, @@ -263,27 +263,27 @@ function Set-TargetResource $NumberOfConversionsPerProcess, [Parameter()] - [ValidateRange(1,60)] + [ValidateRange(1, 60)] [System.UInt32] $TimeBeforeConversionIsMonitored, [Parameter()] - [ValidateRange(1,10)] + [ValidateRange(1, 10)] [System.UInt32] $MaximumConversionAttempts, [Parameter()] - [ValidateRange(1,60)] + [ValidateRange(1, 60)] [System.UInt32] $MaximumSyncConversionRequests, [Parameter()] - [ValidateRange(10,60)] + [ValidateRange(10, 60)] [System.UInt32] $KeepAliveTimeout, [Parameter()] - [ValidateRange(60,3600)] + [ValidateRange(60, 3600)] [System.UInt32] $MaximumConversionTime, @@ -295,21 +295,21 @@ function Set-TargetResource Write-Verbose -Message "Setting Word Automation service app '$Name'" if (($ApplicationPool -or ` - $DatabaseName -or ` - $DatabaseServer -or ` - $SupportedFileFormats -or ` - $DisableEmbeddedFonts -or ` - $MaximumMemoryUsage -or ` - $RecycleThreshold -or ` - $DisableBinaryFileScan -or ` - $ConversionProcesses -or ` - $JobConversionFrequency -or ` - $NumberOfConversionsPerProcess -or ` - $TimeBeforeConversionIsMonitored -or ` - $MaximumConversionAttempts -or ` - $MaximumSyncConversionRequests -or ` - $KeepAliveTimeout -or ` - $MaximumConversionTime) -and ` + $DatabaseName -or ` + $DatabaseServer -or ` + $SupportedFileFormats -or ` + $DisableEmbeddedFonts -or ` + $MaximumMemoryUsage -or ` + $RecycleThreshold -or ` + $DisableBinaryFileScan -or ` + $ConversionProcesses -or ` + $JobConversionFrequency -or ` + $NumberOfConversionsPerProcess -or ` + $TimeBeforeConversionIsMonitored -or ` + $MaximumConversionAttempts -or ` + $MaximumSyncConversionRequests -or ` + $KeepAliveTimeout -or ` + $MaximumConversionTime) -and ` ($Ensure -eq "Absent")) { throw "You cannot use any of the parameters when Ensure is specified as Absent" @@ -320,7 +320,7 @@ function Set-TargetResource if (($Ensure -eq "Present") -and -not ($ApplicationPool -and $DatabaseName)) { throw ("An Application Pool and Database Name are required to configure the Word " + ` - "Automation Service Application") + "Automation Service Application") } $result = Get-TargetResource @PSBoundParameters @@ -328,14 +328,14 @@ function Set-TargetResource { Write-Verbose -Message "Creating Word Automation Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool if ($appPool) { - $cmdletparams = @{} + $cmdletparams = @{ } $cmdletparams.Name = $params.Name if ($params.Name) { @@ -363,18 +363,18 @@ function Set-TargetResource { Write-Verbose -Message "Updating Word Automation Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApp = Get-SPServiceApplication -Name $params.Name ` - | Where-Object -FilterScript { - $_.GetType().FullName -eq "Microsoft.Office.Word.Server.Service.WordServiceApplication" + | Where-Object -FilterScript { + $_.GetType().FullName -eq "Microsoft.Office.Word.Server.Service.WordServiceApplication" } # Check if the specified Application Pool is different and change if so if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false ` - -and $ApplicationPool -ne $result.ApplicationPool) + -and $ApplicationPool -ne $result.ApplicationPool) { $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool Set-SPWordConversionServiceApplication -Identity $serviceApp -ApplicationPool $appPool @@ -387,8 +387,8 @@ function Set-TargetResource if ($serviceApp.Database.NormalizedDataSource -ne $params.DatabaseServer) { Set-SPWordConversionServiceApplication -Identity $serviceApp ` - -DatabaseServer $params.DatabaseServer ` - -DatabaseName $params.DatabaseName + -DatabaseServer $params.DatabaseServer ` + -DatabaseName $params.DatabaseName } } else @@ -396,54 +396,54 @@ function Set-TargetResource if ($serviceApp.Database.Name -ne $params.DatabaseName) { Set-SPWordConversionServiceApplication -Identity $serviceApp ` - -DatabaseName $params.DatabaseName + -DatabaseName $params.DatabaseName } } } if ($params.SupportedFileFormats) { - if ($params.SupportedFileFormats.Contains("docx")) - { - $serviceApp.WordServiceFormats.OpenXmlDocument = $true - } - else - { - $serviceApp.WordServiceFormats.OpenXmlDocument = $false - } - if ($params.SupportedFileFormats.Contains("doc")) - { - $serviceApp.WordServiceFormats.Word972003Document = $true - } - else - { - $serviceApp.WordServiceFormats.Word972003Document = $false - } - if ($params.SupportedFileFormats.Contains("rtf")) - { - $serviceApp.WordServiceFormats.RichTextFormat = $true - } - else - { - $serviceApp.WordServiceFormats.RichTextFormat = $false - } - if ($params.SupportedFileFormats.Contains("mht")) - { - $serviceApp.WordServiceFormats.WebPage = $true - } - else - { - $serviceApp.WordServiceFormats.WebPage = $false - } - if ($params.SupportedFileFormats.Contains("xml")) - { - $serviceApp.WordServiceFormats.Word2003Xml = $true - } - else - { - $serviceApp.WordServiceFormats.Word2003Xml = $false - } + if ($params.SupportedFileFormats.Contains("docx")) + { + $serviceApp.WordServiceFormats.OpenXmlDocument = $true + } + else + { + $serviceApp.WordServiceFormats.OpenXmlDocument = $false } + if ($params.SupportedFileFormats.Contains("doc")) + { + $serviceApp.WordServiceFormats.Word972003Document = $true + } + else + { + $serviceApp.WordServiceFormats.Word972003Document = $false + } + if ($params.SupportedFileFormats.Contains("rtf")) + { + $serviceApp.WordServiceFormats.RichTextFormat = $true + } + else + { + $serviceApp.WordServiceFormats.RichTextFormat = $false + } + if ($params.SupportedFileFormats.Contains("mht")) + { + $serviceApp.WordServiceFormats.WebPage = $true + } + else + { + $serviceApp.WordServiceFormats.WebPage = $false + } + if ($params.SupportedFileFormats.Contains("xml")) + { + $serviceApp.WordServiceFormats.Word2003Xml = $true + } + else + { + $serviceApp.WordServiceFormats.Word2003Xml = $false + } + } if ($params.DisableEmbeddedFonts) { @@ -467,18 +467,18 @@ function Set-TargetResource } if ($params.JobConversionFrequency) { - # Check for TimerJob and change schedule - $wordAutomationTimerjob = Get-SPTimerJob $params.Name - if ($wordAutomationTimerjob.Count -eq 1) - { - $schedule = "every $($params.JobConversionFrequency) minutes between 0 and 0" - Set-SPTimerJob $wordAutomationTimerjob -Schedule $schedule - } - else - { - throw "Timerjob could not be found" - } + # Check for TimerJob and change schedule + $wordAutomationTimerjob = Get-SPTimerJob $params.Name + if ($wordAutomationTimerjob.Count -eq 1) + { + $schedule = "every $($params.JobConversionFrequency) minutes between 0 and 0" + Set-SPTimerJob $wordAutomationTimerjob -Schedule $schedule + } + else + { + throw "Timerjob could not be found" } + } if ($params.NumberOfConversionsPerProcess) { $serviceApp.ConversionsPerInstance = $params.NumberOfConversionsPerProcess @@ -549,7 +549,7 @@ function Test-TargetResource $Name, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -566,7 +566,7 @@ function Test-TargetResource $DatabaseServer, [Parameter()] - [ValidateSet("docx","doc","mht","rtf","xml")] + [ValidateSet("docx", "doc", "mht", "rtf", "xml")] [System.String[]] $SupportedFileFormats, @@ -575,12 +575,12 @@ function Test-TargetResource $DisableEmbeddedFonts, [Parameter()] - [ValidateRange(10,100)] + [ValidateRange(10, 100)] [System.UInt32] $MaximumMemoryUsage, [Parameter()] - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [System.UInt32] $RecycleThreshold, @@ -589,12 +589,12 @@ function Test-TargetResource $DisableBinaryFileScan, [Parameter()] - [ValidateRange(1,1000)] + [ValidateRange(1, 1000)] [System.UInt32] $ConversionProcesses, [Parameter()] - [ValidateRange(1,59)] + [ValidateRange(1, 59)] [System.UInt32] $JobConversionFrequency, @@ -603,27 +603,27 @@ function Test-TargetResource $NumberOfConversionsPerProcess, [Parameter()] - [ValidateRange(1,60)] + [ValidateRange(1, 60)] [System.UInt32] $TimeBeforeConversionIsMonitored, [Parameter()] - [ValidateRange(1,10)] + [ValidateRange(1, 10)] [System.UInt32] $MaximumConversionAttempts, [Parameter()] - [ValidateRange(1,60)] + [ValidateRange(1, 60)] [System.UInt32] $MaximumSyncConversionRequests, [Parameter()] - [ValidateRange(10,60)] + [ValidateRange(10, 60)] [System.UInt32] $KeepAliveTimeout, [Parameter()] - [ValidateRange(60,3600)] + [ValidateRange(60, 3600)] [System.UInt32] $MaximumConversionTime, @@ -637,21 +637,21 @@ function Test-TargetResource $PSBoundParameters.Ensure = $Ensure if (($ApplicationPool -or ` - $DatabaseName -or ` - $DatabaseServer -or ` - $SupportedFileFormats -or ` - $DisableEmbeddedFonts -or ` - $MaximumMemoryUsage -or ` - $RecycleThreshold -or ` - $DisableBinaryFileScan -or ` - $ConversionProcesses -or ` - $JobConversionFrequency -or ` - $NumberOfConversionsPerProcess -or ` - $TimeBeforeConversionIsMonitored -or ` - $MaximumConversionAttempts -or ` - $MaximumSyncConversionRequests -or ` - $KeepAliveTimeout -or ` - $MaximumConversionTime) -and ` + $DatabaseName -or ` + $DatabaseServer -or ` + $SupportedFileFormats -or ` + $DisableEmbeddedFonts -or ` + $MaximumMemoryUsage -or ` + $RecycleThreshold -or ` + $DisableBinaryFileScan -or ` + $ConversionProcesses -or ` + $JobConversionFrequency -or ` + $NumberOfConversionsPerProcess -or ` + $TimeBeforeConversionIsMonitored -or ` + $MaximumConversionAttempts -or ` + $MaximumSyncConversionRequests -or ` + $KeepAliveTimeout -or ` + $MaximumConversionTime) -and ` ($Ensure -eq "Absent")) { throw "You cannot use any of the parameters when Ensure is specified as Absent" @@ -660,7 +660,7 @@ function Test-TargetResource if (($Ensure -eq "Present") -and -not ($ApplicationPool -and $DatabaseName)) { throw ("An Application Pool and Database Name are required to configure the Word " + ` - "Automation Service Application") + "Automation Service Application") } $CurrentValues = Get-TargetResource @PSBoundParameters @@ -669,7 +669,7 @@ function Test-TargetResource Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters + -DesiredValues $PSBoundParameters } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.schema.mof b/Modules/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.schema.mof index a3b8b25f8..182b9ca72 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.schema.mof +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.schema.mof @@ -1,23 +1,23 @@ -[ClassVersion("1.0.0.0"), FriendlyName("SPWordAutomationServiceApp")] -class MSFT_SPWordAutomationServiceApp : OMI_BaseResource +[ClassVersion("1.0.0.0"), FriendlyName("SPWordAutomationServiceApp")] +class MSFT_SPWordAutomationServiceApp : OMI_BaseResource { - [Key, Description("THe name of the service application")] string Name; + [Key, Description("THe name of the service application")] string Name; [Write, Description("Present to ensure the app exists, absent to ensure that it does not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("The name of the application pool to run the service app in")] string ApplicationPool; - [Write, Description("The name of the database for the service app")] string DatabaseName; - [Write, Description("The name of the server that will host the database")] string DatabaseServer; + [Write, Description("The name of the application pool to run the service app in")] string ApplicationPool; + [Write, Description("The name of the database for the service app")] string DatabaseName; + [Write, Description("The name of the server that will host the database")] string DatabaseServer; [Write, Description("The list of supported file types"), ValueMap{"docx","doc","mht","rtf","xml"}, Values{"docx","doc","mht","rtf","xml"}] string SupportedFileFormats[]; [Write, Description("Should embedded fonts be disabled")] boolean DisableEmbeddedFonts; - [Write, Description("What is the maximum amount of memory the service app should use (in MB)")] uint32 MaximumMemoryUsage; - [Write, Description("What is the recycle threshold for this service app")] uint32 RecycleThreshold; + [Write, Description("What is the maximum amount of memory the service app should use (in MB)")] uint32 MaximumMemoryUsage; + [Write, Description("What is the recycle threshold for this service app")] uint32 RecycleThreshold; [Write, Description("Should binary file scans be disabled")] boolean DisableBinaryFileScan; - [Write, Description("How many conversion processes can be run at once")] uint32 ConversionProcesses; - [Write, Description("How frequently should new jobs be started from the queue (in minutes)")] uint32 JobConversionFrequency; - [Write, Description("How many document conversions should be included in a single process")] uint32 NumberOfConversionsPerProcess; - [Write, Description("How long can a conversion be run before it becomes monitored")] uint32 TimeBeforeConversionIsMonitored; - [Write, Description("What is the maximum number of attempts to convert a document")] uint32 MaximumConversionAttempts; - [Write, Description("What is the maximum number of sync conversion requests for the service app")] uint32 MaximumSyncConversionRequests; - [Write, Description("How long is the keep alive timeout set to for the service app")] uint32 KeepAliveTimeout; - [Write, Description("What is the maximum time in seconds for a document conversion to be allowed to run")] uint32 MaximumConversionTime; + [Write, Description("How many conversion processes can be run at once")] uint32 ConversionProcesses; + [Write, Description("How frequently should new jobs be started from the queue (in minutes)")] uint32 JobConversionFrequency; + [Write, Description("How many document conversions should be included in a single process")] uint32 NumberOfConversionsPerProcess; + [Write, Description("How long can a conversion be run before it becomes monitored")] uint32 TimeBeforeConversionIsMonitored; + [Write, Description("What is the maximum number of attempts to convert a document")] uint32 MaximumConversionAttempts; + [Write, Description("What is the maximum number of sync conversion requests for the service app")] uint32 MaximumSyncConversionRequests; + [Write, Description("How long is the keep alive timeout set to for the service app")] uint32 KeepAliveTimeout; + [Write, Description("What is the maximum time in seconds for a document conversion to be allowed to run")] uint32 MaximumConversionTime; [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; -}; +}; diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.psm1 index bdf6bd5a3..51602f945 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.psm1 @@ -41,7 +41,7 @@ function Get-TargetResource $NumberOfUsersPerEwsSyncBatch, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -56,13 +56,13 @@ function Get-TargetResource if ($installedVersion.FileMajorPart -eq 16) { throw [Exception] ("Work Management Service Application is no longer available " + ` - "in SharePoint 2016/2019: " + ` - "https://technet.microsoft.com/en-us/library/mt346112(v=office.16).aspx") + "in SharePoint 2016/2019: " + ` + "https://technet.microsoft.com/en-us/library/mt346112(v=office.16).aspx") } $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue @@ -158,7 +158,7 @@ function Set-TargetResource $NumberOfUsersPerEwsSyncBatch, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -174,8 +174,8 @@ function Set-TargetResource if ($installedVersion.FileMajorPart -eq 16) { throw [Exception] ("Work Management Service Application is no longer available " + ` - "in SharePoint 2016/2019: " + ` - "https://technet.microsoft.com/en-us/library/mt346112(v=office.16).aspx") + "in SharePoint 2016/2019: " + ` + "https://technet.microsoft.com/en-us/library/mt346112(v=office.16).aspx") } if ($Ensure -ne "Absent" -and $PSBoundParameters.ContainsKey("ApplicationPool") -eq $false) @@ -189,8 +189,8 @@ function Set-TargetResource { Write-Verbose -Message "Creating work management Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] if ($params.ContainsKey("Ensure")) { @@ -213,8 +213,8 @@ function Set-TargetResource if ($null -ne $app) { New-SPWorkManagementServiceApplicationProxy -Name $pName ` - -ServiceApplication $app ` - -DefaultProxyGroup + -ServiceApplication $app ` + -DefaultProxyGroup Start-Sleep -Milliseconds 200 } } @@ -223,12 +223,12 @@ function Set-TargetResource if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") { if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false ` - -and $ApplicationPool -ne $result.ApplicationPool) + -and $ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating Application Pool of Work Management Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { @@ -240,41 +240,41 @@ function Set-TargetResource } Write-Verbose -Message "Updating Application Pool of Work Management Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + Invoke-SPDscCommand -Credential $InstallAccount ` + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] - $setParams = @{} + $setParams = @{ } if ($params.ContainsKey("MinimumTimeBetweenEwsSyncSubscriptionSearches")) { $setParams.Add("MinimumTimeBetweenEwsSyncSubscriptionSearches", - $params.MinimumTimeBetweenEwsSyncSubscriptionSearches) + $params.MinimumTimeBetweenEwsSyncSubscriptionSearches) } if ($params.ContainsKey("MinimumTimeBetweenProviderRefreshes")) { $setParams.Add("MinimumTimeBetweenProviderRefreshes", - $params.MinimumTimeBetweenProviderRefreshes) + $params.MinimumTimeBetweenProviderRefreshes) } if ($params.ContainsKey("MinimumTimeBetweenSearchQueries")) { $setParams.Add("MinimumTimeBetweenSearchQueries", - $params.MinimumTimeBetweenSearchQueries) + $params.MinimumTimeBetweenSearchQueries) } if ($params.ContainsKey("NumberOfSubscriptionSyncsPerEwsSyncRun")) { $setParams.Add("NumberOfSubscriptionSyncsPerEwsSyncRun", - $params.NumberOfSubscriptionSyncsPerEwsSyncRun) + $params.NumberOfSubscriptionSyncsPerEwsSyncRun) } if ($params.ContainsKey("NumberOfUsersEwsSyncWillProcessAtOnce")) { $setParams.Add("NumberOfUsersEwsSyncWillProcessAtOnce", - $params.NumberOfUsersEwsSyncWillProcessAtOnce) + $params.NumberOfUsersEwsSyncWillProcessAtOnce) } if ($params.ContainsKey("NumberOfUsersPerEwsSyncBatch")) { $setParams.Add("NumberOfUsersPerEwsSyncBatch", - $params.NumberOfUsersPerEwsSyncBatch) + $params.NumberOfUsersPerEwsSyncBatch) } $setParams.Add("Name", $params.Name) @@ -293,7 +293,7 @@ function Set-TargetResource $setParams.MinimumTimeBetweenSearchQueries = New-TimeSpan -Days $setParams.MinimumTimeBetweenSearchQueries } $setParams.Add("Confirm", $false) - $appService = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { + $appService = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { $_.GetType().FullName -eq "Microsoft.Office.Server.WorkManagement.WorkManagementServiceApplication" } @@ -306,8 +306,8 @@ function Set-TargetResource # The service app should not exit Write-Verbose -Message "Removing Work Management Service Application $Name" Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object -FilterScript { @@ -371,7 +371,7 @@ function Test-TargetResource $NumberOfUsersPerEwsSyncBatch, [Parameter()] - [ValidateSet("Present","Absent")] + [ValidateSet("Present", "Absent")] [System.String] $Ensure = "Present", @@ -386,8 +386,8 @@ function Test-TargetResource if ($installedVersion.FileMajorPart -eq 16) { throw [Exception] ("Work Management Service Application is no longer available " + ` - "in SharePoint 2016/2019: " + ` - "https://technet.microsoft.com/en-us/library/mt346112(v=office.16).aspx") + "in SharePoint 2016/2019: " + ` + "https://technet.microsoft.com/en-us/library/mt346112(v=office.16).aspx") } $PSBoundParameters.Ensure = $Ensure @@ -400,22 +400,22 @@ function Test-TargetResource if ($Ensure -eq "Present") { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ApplicationPool", - "MinimumTimeBetweenEwsSyncSubscriptionSearches", - "MinimumTimeBetweenProviderRefreshes", - "MinimumTimeBetweenSearchQueries", - "Name", - "NumberOfSubscriptionSyncsPerEwsSyncRun", - "NumberOfUsersEwsSyncWillProcessAtOnce", - "NumberOfUsersPerEwsSyncBatch", - "Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("ApplicationPool", + "MinimumTimeBetweenEwsSyncSubscriptionSearches", + "MinimumTimeBetweenProviderRefreshes", + "MinimumTimeBetweenSearchQueries", + "Name", + "NumberOfSubscriptionSyncsPerEwsSyncRun", + "NumberOfUsersEwsSyncWillProcessAtOnce", + "NumberOfUsersPerEwsSyncBatch", + "Ensure") } else { return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure") + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Ensure") } } diff --git a/Modules/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.psm1 b/Modules/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.psm1 index b8c37b576..767eb1e13 100644 --- a/Modules/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.psm1 +++ b/Modules/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.psm1 @@ -28,8 +28,8 @@ function Get-TargetResource Write-Verbose -Message "Getting the current Workflow Service Configuration(s)" $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { + -Arguments $PSBoundParameters ` + -ScriptBlock { $params = $args[0] $returnval = @{ @@ -95,8 +95,8 @@ function Set-TargetResource ## Perform changes Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters) ` - -ScriptBlock { + -Arguments @($PSBoundParameters) ` + -ScriptBlock { $params = $args[0] $site = Get-SPSite $params.SPSiteUrl @@ -171,8 +171,8 @@ function Test-TargetResource } return Test-SPDscParameterState -CurrentValues $CurrentValues ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck $valuesToCheck + -DesiredValues $PSBoundParameters ` + -ValuesToCheck $valuesToCheck } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/1-CreateUsingCertificateFilePath.ps1 b/Modules/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/1-CreateUsingCertificateFilePath.ps1 new file mode 100644 index 000000000..a677767da --- /dev/null +++ b/Modules/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/1-CreateUsingCertificateFilePath.ps1 @@ -0,0 +1,27 @@ +<# +.EXAMPLE + This example creates a trusted security token issuer using a signing certificate in a file path, and the SPAuthenticationRealm of the SharePoint farm. +#> + +Configuration Example +{ + param( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + Import-DscResource -ModuleName SharePointDsc + + node localhost { + SPTrustedSecurityTokenIssuer HighTrustAddinsTrust + { + Name = "HighTrustAddins" + Description = "Trust for Provider-hosted high-trust add-ins" + RegisteredIssuerNameIdentifier = "22222222-2222-2222-2222-222222222222" + IsTrustBroker = $true + SigningCertificateFilePath = "F:\Data\DSC\FakeSigning.cer" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount + } + } +} diff --git a/Modules/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/2-CreateUsingCertificateThumbprint.ps1 b/Modules/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/2-CreateUsingCertificateThumbprint.ps1 new file mode 100644 index 000000000..9b4cc0288 --- /dev/null +++ b/Modules/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/2-CreateUsingCertificateThumbprint.ps1 @@ -0,0 +1,27 @@ +<# +.EXAMPLE + This example creates a trusted security token issuer using a signing certificate retrieved from its thumbprint, and the SPAuthenticationRealm of the SharePoint farm. +#> + +Configuration Example +{ + param( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + Import-DscResource -ModuleName SharePointDsc + + node localhost { + SPTrustedSecurityTokenIssuer HighTrustAddinsTrust + { + Name = "HighTrustAddins" + Description = "Trust for Provider-hosted high-trust add-ins" + RegisteredIssuerNameIdentifier = "22222222-2222-2222-2222-222222222222" + IsTrustBroker = $true + SigningCertificateThumbprint = "123ABCFACE123ABCFACE123ABCFACE123ABCFACE" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount + } + } +} diff --git a/Modules/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/3-CreateUsingMetadata.ps1 b/Modules/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/3-CreateUsingMetadata.ps1 new file mode 100644 index 000000000..546a29ba7 --- /dev/null +++ b/Modules/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/3-CreateUsingMetadata.ps1 @@ -0,0 +1,26 @@ +<# +.EXAMPLE + This example creates a trusted security token issuer that will be configured using the metadata file of the ACS tenant. +#> + +Configuration Example +{ + param( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + Import-DscResource -ModuleName SharePointDsc + + node localhost { + SPTrustedSecurityTokenIssuer HighTrustAddinsTrust + { + Name = "ACS Trust" + Description = "Trust with ACS tenant TENANT.onmicrosoft.com" + MetadataEndPoint = "https://accounts.accesscontrol.windows.net/TENANT.onmicrosoft.com/metadata/json/1" + IsTrustBroker = $true + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount + } + } +} diff --git a/Modules/SharePointDsc/SharePointDsc.psd1 b/Modules/SharePointDsc/SharePointDsc.psd1 index dd00eb496..ff86cd87a 100644 --- a/Modules/SharePointDsc/SharePointDsc.psd1 +++ b/Modules/SharePointDsc/SharePointDsc.psd1 @@ -12,7 +12,7 @@ # RootModule = '' # Version number of this module. - ModuleVersion = '3.5.0.0' + ModuleVersion = '3.6.0.0' # ID used to uniquely identify this module GUID = '6c1176a0-4fac-4134-8ca2-3fa8a21a7b90' @@ -115,7 +115,7 @@ PSData = @{ # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource', 'preview') + Tags = @('DesiredStateConfiguration', 'DSC', 'DSCResourceKit', 'DSCResource') # A URL to the license for this module. LicenseUri = 'https://github.com/PowerShell/SharePointDsc/blob/master/LICENSE' @@ -128,44 +128,21 @@ # ReleaseNotes of this module ReleaseNotes = " - * SharePointDsc generic - * Improved logging in all resource. They are now outputting - the current and targeted values in the Test method. - * Updated various resources to comply with coding style guidelines. - * Updated the following resources to not return Null from the Get - method anymore, but an hashtable which contains null values: - SPDesignerSettings, SPDiagnosticLoggingSettings, SPFarmAdministrators, - SPHealthAnalyzerRuleState, SPIrmSettings, SPOutgoingEmailSettings, - SPPasswordChangeSettings, SPSearchTopology, SPServiceAppProxyGroup, - SPTimerJobState, SPUserProfileSection, SPUserProfileSyncConnection, - SPWebAppBlockedFileTypes, SPWebApplicationAppDomain, SPWebAppPolicy, - SPWebAppSiteUseAndDeletion, SPWebAppThrottlingSettings, - SPWordAutomationServiceApp. - * SPConfigWizard - * Added check to make sure the Config Wizard is only executed when all - servers have the binaries installed. - * SPDistributedCacheService - * Added ability to check for incorrect service account. - * SPExcelServiceApp - * Fixes issue where Get method throws an error when the value of - PrivateBytesMax and UnusedObjectAgeMax are negative values. - * SPFarm - * Throw error in Get method if CentralAdministrationUrl is HTTP. - * SPInstallPrereqs - * Fixed bug in version check, where lower versions would be - detected as higher versions. - * SPProductUpdate - * Updated Readme to reflect the new patching possibilities added in v3.3. - * SPSecureStore - * Fixed issue where the test issue returned false is the service - application didn't exist, but the database name/server parameter - was specified. - * SPUserProfileSyncConnection - * Fixed issue where the parameter Server was checked in SP2016 - but isn't used there and therefore always fails. - * SPWebAppAuthentication - * Updated the documentation to better explain the use of this resource - when using Classic authentication. + * SharePointDsc generic + * Added new launch actions to vscode to allow code coverage reports for + the current unit test file. + * SPFarm + * Moved check for CentralAdministrationUrl is HTTP to Set method, + to prevent issues with ReverseDsc. + * SPInstall + * Updated error code checks to force reboot. + * SPProductUpdate + * Fixes an issue using ShutdownServices when no Farm is available. + * SPTrustedRootAuthority + * Fixes issue where Set method throws an error because the + parameter CertificateFilePath is not read correctly. + * SPTrustedSecurityTokenIssuer + * New resource for configuring OAuth trusts " } # End of PSData hashtable diff --git a/Modules/SharePointDsc/en-US/about_SPAccessServiceApp.help.txt b/Modules/SharePointDsc/en-US/about_SPAccessServiceApp.help.txt index daedfdc63..b308b696d 100644 --- a/Modules/SharePointDsc/en-US/about_SPAccessServiceApp.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPAccessServiceApp.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPAccessServiceApp # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. - + .PARAMETER Name Key - string The name of the service application @@ -34,10 +34,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to deploy Access Services 2013 to the local SharePoint farm. - +This example shows how to deploy Access Services 2013 to the local SharePoint farm. Configuration Example { @@ -59,14 +58,13 @@ } } +.EXAMPLE 2 -.EXAMPLE - - This example shows how to remove a specific Access Services 2013 from the local - SharePoint farm. Because Application pool and database server are both required - parameters, but are not acutally needed to remove the app, any text value can - be supplied for these as they will be ignored. +This example shows how to remove a specific Access Services 2013 from the local +SharePoint farm. Because Application pool and database server are both required +parameters, but are not acutally needed to remove the app, any text value can +be supplied for these as they will be ignored. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPAccessServices2010.help.txt b/Modules/SharePointDsc/en-US/about_SPAccessServices2010.help.txt index 7306ce274..ae020adbd 100644 --- a/Modules/SharePointDsc/en-US/about_SPAccessServices2010.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPAccessServices2010.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPAccessServices2010 # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. - + .PARAMETER Name Key - String The name of the service application diff --git a/Modules/SharePointDsc/en-US/about_SPAlternateUrl.help.txt b/Modules/SharePointDsc/en-US/about_SPAlternateUrl.help.txt index b61e08714..c197cc5b7 100644 --- a/Modules/SharePointDsc/en-US/about_SPAlternateUrl.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPAlternateUrl.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPAlternateUrl # Description @@ -33,7 +33,7 @@ in the registry. It will not, however, update bindings in IIS. It is recommended to use the xWebsite resource from the xWebAdministration module to configure the appropriate bindings in IIS. - + .PARAMETER WebAppName Key - String The name of the web application to apply the alternate URL to @@ -60,10 +60,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to add a new alternate URL to a specific web application - +This example shows how to add a new alternate URL to a specific web application Configuration Example { @@ -87,11 +86,10 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to remove an alternate URL from a specified zone for a specific - web application. - +This example shows how to remove an alternate URL from a specified zone for a specific +web application. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPAntivirusSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPAntivirusSettings.help.txt index 1a51b0d64..aaebf2084 100644 --- a/Modules/SharePointDsc/en-US/about_SPAntivirusSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPAntivirusSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPAntivirusSettings # Description @@ -11,7 +11,7 @@ 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. - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -45,10 +45,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to apply specific anti-virus configuration to the farm - +This example shows how to apply specific anti-virus configuration to the farm Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPAppCatalog.help.txt b/Modules/SharePointDsc/en-US/about_SPAppCatalog.help.txt index de083e063..313aaedc5 100644 --- a/Modules/SharePointDsc/en-US/about_SPAppCatalog.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPAppCatalog.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPAppCatalog # Description @@ -13,7 +13,7 @@ This resource should NOT be run using the farm account. The resource will retrieve the farm credentials from SharePoint and use that to update the AppCatalog. This does mean it requires CredSSP to be setup! - + .PARAMETER SiteUrl Key - string The URL of the site collection that will be the app catalog for the web app that it is in @@ -22,10 +22,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to configure the AppCatalog in the farm - +This example shows how to configure the AppCatalog in the farm Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPAppDomain.help.txt b/Modules/SharePointDsc/en-US/about_SPAppDomain.help.txt index 6acffc7e5..4555d3a78 100644 --- a/Modules/SharePointDsc/en-US/about_SPAppDomain.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPAppDomain.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPAppDomain # Description @@ -8,7 +8,7 @@ This resource will set the value for the app domain settings at the farm level. You can set the domain name and the prefix that is to be used for app URLs. - + .PARAMETER AppDomain Key - string The domain name for apps to use in this farm @@ -21,10 +21,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to apply app URLs to the current farm. - +This example shows how to apply app URLs to the current farm. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPAppManagementServiceApp.help.txt b/Modules/SharePointDsc/en-US/about_SPAppManagementServiceApp.help.txt index 6e88b4c7e..1780741e0 100644 --- a/Modules/SharePointDsc/en-US/about_SPAppManagementServiceApp.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPAppManagementServiceApp.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPAppManagementServiceApp # Description @@ -17,7 +17,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. - + .PARAMETER Name Key - string The name of the app management service application @@ -47,11 +47,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to create a new app management service application in the - local SharePoint farm. - +This example shows how to create a new app management service application in the +local SharePoint farm. Configuration Example { @@ -74,12 +73,11 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to remove a specific app management service application in the - local SharePoint farm. The application pool property is still mandatory but it is not - used so therefore the value is not important. - +This example shows how to remove a specific app management service application in the +local SharePoint farm. The application pool property is still mandatory but it is not +used so therefore the value is not important. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPAppStoreSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPAppStoreSettings.help.txt index 07ae80b41..6421d912b 100644 --- a/Modules/SharePointDsc/en-US/about_SPAppStoreSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPAppStoreSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPAppStoreSettings # Description @@ -8,7 +8,7 @@ This resource will configure the ability to purchase apps for both SharePoint and Office apps. - + .PARAMETER WebAppUrl Key - string The URL of the web application @@ -25,10 +25,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to configure the AppCatalog in the farm - +This example shows how to configure the AppCatalog in the farm Configuration Example { @@ -49,10 +48,9 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to configure the AppCatalog in the farm - +This example shows how to configure the AppCatalog in the farm Configuration Example { @@ -74,10 +72,9 @@ } } +.EXAMPLE 3 -.EXAMPLE - This example shows how to configure the AppCatalog in the farm - +This example shows how to configure the AppCatalog in the farm Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPAuthenticationRealm.help.txt b/Modules/SharePointDsc/en-US/about_SPAuthenticationRealm.help.txt index 4098b0467..62d421a8e 100644 --- a/Modules/SharePointDsc/en-US/about_SPAuthenticationRealm.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPAuthenticationRealm.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPAuthenticationRealm # Description @@ -15,7 +15,7 @@ SharePoint automatically converts the realm to lower case ASCII printable characters. The specified authentication realm must therefore conform to this for the test method to be able to detect a correct configuration. - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -29,10 +29,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example sets the farm atuhentication realm. - +This example sets the farm atuhentication realm. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPBCSServiceApp.help.txt b/Modules/SharePointDsc/en-US/about_SPBCSServiceApp.help.txt index 15c05165d..c4bd2d738 100644 --- a/Modules/SharePointDsc/en-US/about_SPBCSServiceApp.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPBCSServiceApp.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPBCSServiceApp # Description @@ -17,7 +17,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. - + .PARAMETER Name Key - string The name of the BCS service app @@ -47,11 +47,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to deploy a Business Connectivity Services application to the - local SharePoint farm. - +This example shows how to deploy a Business Connectivity Services application to the +local SharePoint farm. Configuration Example { @@ -74,12 +73,11 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to deploy a Business Connectivity Services application to the - local SharePoint farm. The application pool account is mandatory but the value is - ignored when removing a service app, so the value entered here does not matter. - +This example shows how to deploy a Business Connectivity Services application to the +local SharePoint farm. The application pool account is mandatory but the value is +ignored when removing a service app, so the value entered here does not matter. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPBlobCacheSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPBlobCacheSettings.help.txt index 60c7bfe86..216dc725d 100644 --- a/Modules/SharePointDsc/en-US/about_SPBlobCacheSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPBlobCacheSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPBlobCacheSettings # Description @@ -23,7 +23,7 @@ Best practice: Specify a directory that is not on the same drive as where either the server operating system swap files or server log files are stored. - + .PARAMETER WebAppUrl Key - string The URL of the web application @@ -57,11 +57,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to configure the blob cache settings on the local server for the - specified web application and zone - +This example shows how to configure the blob cache settings on the local server for the +specified web application and zone Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPCacheAccounts.help.txt b/Modules/SharePointDsc/en-US/about_SPCacheAccounts.help.txt index 13d3df0a2..905380085 100644 --- a/Modules/SharePointDsc/en-US/about_SPCacheAccounts.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPCacheAccounts.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPCacheAccounts # Description @@ -9,7 +9,7 @@ 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)). - + .PARAMETER WebAppUrl Key - string The URL of the web application to set the accounts for @@ -30,11 +30,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example sets the super use and reader accounts for the specified web app. It will - also set the appropriate web app policies by default for these accounts. - +This example sets the super use and reader accounts for the specified web app. It will +also set the appropriate web app policies by default for these accounts. Configuration Example { @@ -56,12 +55,11 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example sets the super use and reader accounts for the specified web app. It will - not set the web app policies for these accounts though, allowing them to be controlled - elsewhere (either manually or with SPWebAppPolicy) - +This example sets the super use and reader accounts for the specified web app. It will +not set the web app policies for these accounts though, allowing them to be controlled +elsewhere (either manually or with SPWebAppPolicy) Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPConfigWizard.help.txt b/Modules/SharePointDsc/en-US/about_SPConfigWizard.help.txt index 83197c294..8fb14b49a 100644 --- a/Modules/SharePointDsc/en-US/about_SPConfigWizard.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPConfigWizard.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPConfigWizard # Description @@ -11,7 +11,7 @@ DatabaseUpgradeDays and DatabaseUpgradeTime parameters specify a window in which the update can be installed. This module has to be used to complete the update installation step, performed by SPProductUpdate. - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -35,10 +35,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example runs the Configuration Wizard as soon as it is applied. - +This example runs the Configuration Wizard as soon as it is applied. Configuration Example { @@ -58,11 +57,10 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example only runs the Configuration Wizard in the specified window: - - Saturday and Sunday night between 3am and 5am. - +This example only runs the Configuration Wizard in the specified window: +- Saturday and Sunday night between 3am and 5am. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPContentDatabase.help.txt b/Modules/SharePointDsc/en-US/about_SPContentDatabase.help.txt index 820a6cdd1..b686fd9c2 100644 --- a/Modules/SharePointDsc/en-US/about_SPContentDatabase.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPContentDatabase.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPContentDatabase # Description @@ -16,7 +16,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the content database is provisioned. - + .PARAMETER Name Key - String Specifies the name of the content database @@ -50,10 +50,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example creates a new content database for the specified web application. - +This example creates a new content database for the specified web application. Configuration Example { @@ -78,12 +77,11 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example dismounts a content database from the specified web application. This - will not remove the database from SQL server however, only taking it out of the - web applications configuration. - +This example dismounts a content database from the specified web application. This +will not remove the database from SQL server however, only taking it out of the +web applications configuration. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPDatabaseAAG.help.txt b/Modules/SharePointDsc/en-US/about_SPDatabaseAAG.help.txt index d722e76bd..c2f780e52 100644 --- a/Modules/SharePointDsc/en-US/about_SPDatabaseAAG.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPDatabaseAAG.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPDatabaseAAG # Description @@ -27,7 +27,7 @@ connection string to the specified availability group. If this is NOT what you want (for example: You are using SQL aliasses which point to the AG listener), you should NOT use this resource. - + .PARAMETER DatabaseName Key - string The name of the database to put in the AlwaysOn group @@ -49,11 +49,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example takes an existing SharePoint database and puts it in to the specified - AlwaysOn Availability Group (AAG). - +This example takes an existing SharePoint database and puts it in to the specified +AlwaysOn Availability Group (AAG). Configuration Example { @@ -75,11 +74,10 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example takes existing SharePoint databases, based on the database name pattern, and puts - them in to the specified AlwaysOn Availability Group (AAG). - +This example takes existing SharePoint databases, based on the database name pattern, and puts +them in to the specified AlwaysOn Availability Group (AAG). Configuration Example { @@ -101,10 +99,9 @@ } } +.EXAMPLE 3 -.EXAMPLE - This example removes a database from the specified AlwaysOn Availability Group (AAG) - +This example removes a database from the specified AlwaysOn Availability Group (AAG) Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPDesignerSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPDesignerSettings.help.txt index 76b780aa1..233fdb659 100644 --- a/Modules/SharePointDsc/en-US/about_SPDesignerSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPDesignerSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPDesignerSettings # Description @@ -22,7 +22,7 @@ "SiteCollection". Due to an issue with Remote PowerShell and SharePoint, changing the Site Collection settings results in an Access Denied error. Consider implementing PowerShell v5 and switching to the PsDscRunAsCredential - + .PARAMETER WebAppUrl Key - string The URL of the web application or site collection to configure @@ -64,11 +64,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example applies settings to disable SharePoint Designer access to the - specified web application. - +This example applies settings to disable SharePoint Designer access to the +specified web application. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPDiagnosticLoggingSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPDiagnosticLoggingSettings.help.txt index 08fb18203..3e321a0e1 100644 --- a/Modules/SharePointDsc/en-US/about_SPDiagnosticLoggingSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPDiagnosticLoggingSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPDiagnosticLoggingSettings # Description @@ -10,7 +10,7 @@ (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 - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -92,12 +92,11 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example applies the specified diagnostic logging settings to the local - SharPoint farm. Any setting not defined will be left as it default, or to - whatever value has been manually configured outside of DSC. - +This example applies the specified diagnostic logging settings to the local +SharPoint farm. Any setting not defined will be left as it default, or to +whatever value has been manually configured outside of DSC. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPDiagnosticsProvider.help.txt b/Modules/SharePointDsc/en-US/about_SPDiagnosticsProvider.help.txt index bfc898057..dead7ad6b 100644 --- a/Modules/SharePointDsc/en-US/about_SPDiagnosticsProvider.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPDiagnosticsProvider.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPDiagnosticsProvider # Description @@ -9,7 +9,7 @@ This resource is responsible for configuring the Diagnostics Provider within the local SharePoint farm. Using Ensure equals to Absent is not supported. This resource can only apply configuration, not ensure they don't exist. - + .PARAMETER Name Key - string Name of the Diagnostics Provider to configure @@ -35,10 +35,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to configure the retention period for a Diagnostics Provider. - +This example shows how to configure the retention period for a Diagnostics Provider. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPDistributedCacheClientSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPDistributedCacheClientSettings.help.txt index 267a33eb0..9b0bb06cb 100644 --- a/Modules/SharePointDsc/en-US/about_SPDistributedCacheClientSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPDistributedCacheClientSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPDistributedCacheClientSettings # Description @@ -13,7 +13,7 @@ DistributedActivityFeedCache, DistributedActivityFeedLMTCache, DistributedBouncerCache, DistributedDefaultCache, DistributedSearchCache, DistributedSecurityTrimmingCache, and DistributedServerToAppServerAccessTokenCache. - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -203,10 +203,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example configures the distributed cache client settings. - +This example configures the distributed cache client settings. Configuration Example { @@ -256,11 +255,10 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example configures the distributed cache client settings - in SharePoint 2016. - +This example configures the distributed cache client settings +in SharePoint 2016. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPDistributedCacheService.help.txt b/Modules/SharePointDsc/en-US/about_SPDistributedCacheService.help.txt index aa26c70a7..905d6315e 100644 --- a/Modules/SharePointDsc/en-US/about_SPDistributedCacheService.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPDistributedCacheService.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPDistributedCacheService # Description @@ -28,7 +28,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the distributed cache is provisioned. - + .PARAMETER Name Key - String A name to assign to this resource - not really used. For example - AppFabricCachingService @@ -58,12 +58,11 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example applies the distributed cache service to the current server, - also setting the rules in Windows firewall to allow communication with - other cache hosts. - +This example applies the distributed cache service to the current server, +also setting the rules in Windows firewall to allow communication with +other cache hosts. Configuration Example { @@ -86,13 +85,12 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example applies the distributed cache service to the current server, - but will not apply the rules to allow it to communicate with other cache - hosts to the Windows Firewall. Use this approach if you have an alternate - firewall solution. - +This example applies the distributed cache service to the current server, +but will not apply the rules to allow it to communicate with other cache +hosts to the Windows Firewall. Use this approach if you have an alternate +firewall solution. Configuration Example { @@ -115,15 +113,14 @@ } } +.EXAMPLE 3 -.EXAMPLE - This example applies the distributed cache service to both "server1" and - "server2". The ServerProvisionOrder will ensure that it applies it to - server1 first and then server2, making sure they don't both attempt to - create the cache at the same time, resuling in errors. - - Note: Do not allow plain text passwords in production environments. +This example applies the distributed cache service to both "server1" and +"server2". The ServerProvisionOrder will ensure that it applies it to +server1 first and then server2, making sure they don't both attempt to +create the cache at the same time, resuling in errors. +Note: Do not allow plain text passwords in production environments. $ConfigurationData = @{ AllNodes = @( diff --git a/Modules/SharePointDsc/en-US/about_SPExcelServiceApp.help.txt b/Modules/SharePointDsc/en-US/about_SPExcelServiceApp.help.txt index c31ff6438..d87932730 100644 --- a/Modules/SharePointDsc/en-US/about_SPExcelServiceApp.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPExcelServiceApp.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPExcelServiceApp # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. - + .PARAMETER Name Key - string The name of the service application @@ -74,7 +74,7 @@ .PARAMETER ThrottleAccessViolationsPerSiteCollection Write - Uint32 - Specifies that if a workbook causes an access violation error on Excel Services Application, all files originating from that workbook’s site collection are blocked from loading for the specified period (in seconds). + Specifies that if a workbook causes an access violation error on Excel Services Application, all files originating from that workbook???s site collection are blocked from loading for the specified period (in seconds). .PARAMETER UnattendedAccountApplicationId Write - String @@ -101,10 +101,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to deploy Excel Services to the local SharePoint farm. - +This example shows how to deploy Excel Services to the local SharePoint farm. Configuration Example { @@ -125,12 +124,11 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to remove Excel Services from the local SharePoint farm. - Here application pool is a required parameter, but it is not actually used when - removing a service app and as such can be ignored and set to any value. - +This example shows how to remove Excel Services from the local SharePoint farm. +Here application pool is a required parameter, but it is not actually used when +removing a service app and as such can be ignored and set to any value. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPFarm.help.txt b/Modules/SharePointDsc/en-US/about_SPFarm.help.txt index 887937e52..97c7cc460 100644 --- a/Modules/SharePointDsc/en-US/about_SPFarm.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPFarm.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPFarm # Description @@ -52,7 +52,7 @@ When using SharePoint 2016 and later and enabling the Developer Dashboard, please make sure you also provision the Usage and Health service application to make sure the Developer Dashboard works properly. - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -114,13 +114,12 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how a basic SharePoint farm can be created. The database server and names - are specified, and the accounts to run the setup as, the farm account and the passphrase are - all passed in to the configuration to be applied. By default the central admin site in this - example is provisioned to port 9999 using NTLM authentication. - +This example shows how a basic SharePoint farm can be created. The database server and names +are specified, and the accounts to run the setup as, the farm account and the passphrase are +all passed in to the configuration to be applied. By default the central admin site in this +example is provisioned to port 9999 using NTLM authentication. Configuration Example { @@ -154,13 +153,12 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how a basic SharePoint farm can be created. The database server and names - are specified, and the accounts to run the setup as, the farm account and the passphrase are - all passed in to the configuration to be applied. Here the port for the central admin site to - run on, as well as the authentication mode for the site are also specified. - +This example shows how a basic SharePoint farm can be created. The database server and names +are specified, and the accounts to run the setup as, the farm account and the passphrase are +all passed in to the configuration to be applied. Here the port for the central admin site to +run on, as well as the authentication mode for the site are also specified. Configuration Example { @@ -196,16 +194,15 @@ } } +.EXAMPLE 3 -.EXAMPLE - This example shows how a basic SharePoint farm can be created. The database server and names - are specified, and the accounts to run the setup as, the farm account and the passphrase are - all passed in to the configuration to be applied. By default the central admin site in this - example is provisioned to port 9999 using NTLM authentication. In this example we also see - the server role defined as "Application" which tells SharePoint 2016/2019 the role to apply to - this server as soon as the farm is created. This property is not supported for SharePoint 2013 - and so this specific example would fail if used against that verison. - +This example shows how a basic SharePoint farm can be created. The database server and names +are specified, and the accounts to run the setup as, the farm account and the passphrase are +all passed in to the configuration to be applied. By default the central admin site in this +example is provisioned to port 9999 using NTLM authentication. In this example we also see +the server role defined as "Application" which tells SharePoint 2016/2019 the role to apply to +this server as soon as the farm is created. This property is not supported for SharePoint 2013 +and so this specific example would fail if used against that verison. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPFarmAdministrators.help.txt b/Modules/SharePointDsc/en-US/about_SPFarmAdministrators.help.txt index a7b8c17f4..33b01b7b7 100644 --- a/Modules/SharePointDsc/en-US/about_SPFarmAdministrators.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPFarmAdministrators.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPFarmAdministrators # Description @@ -15,7 +15,7 @@ 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. - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -37,11 +37,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to set a specific list of members for the farm admins group. - Any members not in this list will be removed. - +This example shows how to set a specific list of members for the farm admins group. +Any members not in this list will be removed. Configuration Example { @@ -62,13 +61,12 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how certain changes are made to the farm admins groups. Here any - members in the MembersToInclude property are added, and members in the MembersToExclude - property are removed. Any members that exist in the farm admins group that aren't listed - in either of these properties are left alone. - +This example shows how certain changes are made to the farm admins groups. Here any +members in the MembersToInclude property are added, and members in the MembersToExclude +property are removed. Any members that exist in the farm admins group that aren't listed +in either of these properties are left alone. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPFarmPropertyBag.help.txt b/Modules/SharePointDsc/en-US/about_SPFarmPropertyBag.help.txt index 318f1fa0b..a269f26a5 100644 --- a/Modules/SharePointDsc/en-US/about_SPFarmPropertyBag.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPFarmPropertyBag.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPFarmPropertyBag # Description @@ -11,7 +11,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the property bag is configured. - + .PARAMETER Key Key - string The key of the SPFarm property bag @@ -29,10 +29,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how add property bag in the current farm. - +This example shows how add property bag in the current farm. Configuration Example { @@ -57,10 +56,9 @@ Configuration Example } } +.EXAMPLE 2 -.EXAMPLE - This example shows how remove property bag in the current farm. - +This example shows how remove property bag in the current farm. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPFarmSolution.help.txt b/Modules/SharePointDsc/en-US/about_SPFarmSolution.help.txt index b0aca92a2..91de73062 100644 --- a/Modules/SharePointDsc/en-US/about_SPFarmSolution.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPFarmSolution.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPFarmSolution # Description @@ -15,7 +15,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the solution is deployed. - + .PARAMETER Name Key - string The filename of the WSP package @@ -50,10 +50,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to deploy a WSP to specific web applications. - +This example shows how to deploy a WSP to specific web applications. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPFeature.help.txt b/Modules/SharePointDsc/en-US/about_SPFeature.help.txt index 425e7f266..fe3ac3641 100644 --- a/Modules/SharePointDsc/en-US/about_SPFeature.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPFeature.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPFeature # Description @@ -13,7 +13,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the feature is enabled. - + .PARAMETER Name Key - string The name of the feature @@ -40,10 +40,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to enable a site collection scoped feature - +This example shows how to enable a site collection scoped feature Configuration Example { @@ -66,10 +65,9 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to disable a site collection scoped feature - +This example shows how to disable a site collection scoped feature Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPHealthAnalyzerRuleState.help.txt b/Modules/SharePointDsc/en-US/about_SPHealthAnalyzerRuleState.help.txt index a3e5ecb59..9a66d5921 100644 --- a/Modules/SharePointDsc/en-US/about_SPHealthAnalyzerRuleState.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPHealthAnalyzerRuleState.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPHealthAnalyzerRuleState # Description @@ -8,7 +8,7 @@ This resource is used to configure Health Analyzer rules for the local farm. The resource is able to enable/disable and configure the specified rule. - + .PARAMETER Name Key - String The name of the rule exactly as it appears in central admin @@ -35,10 +35,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to disable a health analyzer rule - +This example shows how to disable a health analyzer rule Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPIncomingEmailSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPIncomingEmailSettings.help.txt index dd70dbad7..8b18c39e8 100644 --- a/Modules/SharePointDsc/en-US/about_SPIncomingEmailSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPIncomingEmailSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPIncomingEmailSettings # Description @@ -14,7 +14,7 @@ This resource does not currently support setting the Active Directory OU where SharePoint can create mail contacts and distribution groups. - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -62,10 +62,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to configure SharePoint Incoming Email in Automatic Mode - +This example shows how to configure SharePoint Incoming Email in Automatic Mode Configuration Example { @@ -89,10 +88,9 @@ Configuration Example } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to configure SharePoint Incoming Email in Advanced Mode - +This example shows how to configure SharePoint Incoming Email in Advanced Mode Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPInfoPathFormsServiceConfig.help.txt b/Modules/SharePointDsc/en-US/about_SPInfoPathFormsServiceConfig.help.txt index 649af4074..9692a6ce0 100644 --- a/Modules/SharePointDsc/en-US/about_SPInfoPathFormsServiceConfig.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPInfoPathFormsServiceConfig.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPInfoPathFormsServiceConfig # Description @@ -9,7 +9,7 @@ This resource is responsible for configuring the InfoPath Forms service within the local SharePoint farm. Using Ensure equals to Absent is not supported. This resource can only apply configuration, not ensure they don't exist. - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -80,11 +80,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to configure the InfoPath Forms Service - in the local SharePoint farm. - +This example shows how to configure the InfoPath Forms Service +in the local SharePoint farm. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPInstall.help.txt b/Modules/SharePointDsc/en-US/about_SPInstall.help.txt index 9ab537fc8..e0c034d86 100644 --- a/Modules/SharePointDsc/en-US/about_SPInstall.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPInstall.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPInstall # Description @@ -29,7 +29,7 @@ they should support working with multiple language packs for multilingual deployments. However due to constraints in how we set up and install the product, only English ISOs are supported for installing SharePoint. - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -56,12 +56,11 @@ Allowed values: Present, Absent Present to install SharePoint. Absent is currently not supported +.EXAMPLE 1 -.EXAMPLE - This module will install SharePoint to the default locations. The binaries for - SharePoint in this scenario are stored at C:\SPInstall (so it will look to run - C:\SPInstall\Setup.exe) - +This module will install SharePoint to the default locations. The binaries for +SharePoint in this scenario are stored at C:\SPInstall (so it will look to run +C:\SPInstall\Setup.exe) Configuration Example { @@ -82,11 +81,10 @@ } } +.EXAMPLE 2 -.EXAMPLE - This module will install SharePoint to the specific locations set for the - InstallPath and DataPath directories. - +This module will install SharePoint to the specific locations set for the +InstallPath and DataPath directories. Configuration Example { @@ -109,10 +107,9 @@ } } +.EXAMPLE 3 -.EXAMPLE - This module will install SharePoint Foundation 2013 to the local server - +This module will install SharePoint Foundation 2013 to the local server Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPInstallLanguagePack.help.txt b/Modules/SharePointDsc/en-US/about_SPInstallLanguagePack.help.txt index 6bc3c2bbe..618891036 100644 --- a/Modules/SharePointDsc/en-US/about_SPInstallLanguagePack.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPInstallLanguagePack.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPInstallLanguagePack # Description @@ -22,7 +22,7 @@ stream is added to indicate that the file is potentially from an unsafe source. To use these files, make sure you first unblock them using Unblock-File. SPInstallLanguagePack will throw an error when it detects the file is blocked. - + .PARAMETER BinaryDir Key - String The directory that contains all of the SharePoint binaries @@ -45,12 +45,11 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This module will install the SharePoint Language Pack. The binaries for - SharePoint in this scenario are stored at C:\SPInstall (so it will look to run - C:\SPInstall\Setup.exe) - +This module will install the SharePoint Language Pack. The binaries for +SharePoint in this scenario are stored at C:\SPInstall (so it will look to run +C:\SPInstall\Setup.exe) Configuration Example { @@ -70,12 +69,11 @@ } } +.EXAMPLE 2 -.EXAMPLE - This module will install the SharePoint Language Pack in the specified timeframe. - The binaries for SharePoint in this scenario are stored at C:\SPInstall (so it - will look to run C:\SPInstall\Setup.exe) - +This module will install the SharePoint Language Pack in the specified timeframe. +The binaries for SharePoint in this scenario are stored at C:\SPInstall (so it +will look to run C:\SPInstall\Setup.exe) Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPInstallPrereqs.help.txt b/Modules/SharePointDsc/en-US/about_SPInstallPrereqs.help.txt index 8f8278fd9..0adbc493f 100644 --- a/Modules/SharePointDsc/en-US/about_SPInstallPrereqs.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPInstallPrereqs.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPInstallPrereqs # Description @@ -52,7 +52,7 @@ SharePoint 2019: https://docs.microsoft.com/en-us/sharepoint/install/hardware-and-software-requirements-2019#links-to-applicable-software - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -147,11 +147,10 @@ Allowed values: Present, Absent Present to install the prerequisites. Absent is currently not supported +.EXAMPLE 1 -.EXAMPLE - This module will install the prerequisites for SharePoint. This resource will run in - online mode, looking to download all prerequisites from the internet. - +This module will install the prerequisites for SharePoint. This resource will run in +online mode, looking to download all prerequisites from the internet. Configuration Example { @@ -172,11 +171,10 @@ } } +.EXAMPLE 2 -.EXAMPLE - This module will install the prerequisites for SharePoint 2013. This resource will run in - offline mode, running all prerequisite installations from the specified paths. - +This module will install the prerequisites for SharePoint 2013. This resource will run in +offline mode, running all prerequisite installations from the specified paths. Configuration Example { @@ -209,11 +207,10 @@ } } +.EXAMPLE 3 -.EXAMPLE - This module will install the prerequisites for SharePoint 2016/2019. This resource will run in - offline mode, running all prerequisite installations from the specified paths. - +This module will install the prerequisites for SharePoint 2016/2019. This resource will run in +offline mode, running all prerequisite installations from the specified paths. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPIrmSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPIrmSettings.help.txt index 5440b52f4..fb353fadd 100644 --- a/Modules/SharePointDsc/en-US/about_SPIrmSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPIrmSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPIrmSettings # Description @@ -11,7 +11,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, IRM is configured. - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -34,11 +34,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to apply the RMS settings to a local farm, pointing to - a specific RMS server - +This example shows how to apply the RMS settings to a local farm, pointing to +a specific RMS server Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPLogLevel.help.txt b/Modules/SharePointDsc/en-US/about_SPLogLevel.help.txt index d3edae9ef..97914102e 100644 --- a/Modules/SharePointDsc/en-US/about_SPLogLevel.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPLogLevel.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPLogLevel # Description @@ -13,7 +13,7 @@ within an area. Settings can be changed to desired valid values, or set to the default by using the keyword 'Default' as the trace level and event level. You must specify a unique name for each instance of this resource in a configuration. - + .PARAMETER Name Key - String Friendly Name used to reference this collection of log level settings @@ -26,9 +26,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example sets an Area / Category item to a custom value. +This example sets an Area / Category item to a custom value. Configuration Example { @@ -56,9 +56,9 @@ Configuration Example } } +.EXAMPLE 2 -.EXAMPLE - This example sets an entire Area to the default values +This example sets an entire Area to the default values Configuration Example { @@ -86,9 +86,9 @@ Configuration Example } } +.EXAMPLE 3 -.EXAMPLE - This example sets multiple items to custom values +This example sets multiple items to custom values Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPMachineTranslationServiceApp.help.txt b/Modules/SharePointDsc/en-US/about_SPMachineTranslationServiceApp.help.txt index 01d77d580..137c4c2a1 100644 --- a/Modules/SharePointDsc/en-US/about_SPMachineTranslationServiceApp.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPMachineTranslationServiceApp.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPMachineTranslationServiceApp # Description @@ -14,7 +14,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. - + .PARAMETER Name Key - String Specifies the name of the service application. @@ -44,10 +44,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to deploy the SP Machine Translation Service App to the local SharePoint farm. - +This example shows how to deploy the SP Machine Translation Service App to the local SharePoint farm. Configuration Example { @@ -71,10 +70,9 @@ Configuration Example } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to remove the SP Machine Translation Service App to the local SharePoint farm. - +This example shows how to remove the SP Machine Translation Service App to the local SharePoint farm. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPManagedAccount.help.txt b/Modules/SharePointDsc/en-US/about_SPManagedAccount.help.txt index b646af763..e5eea0469 100644 --- a/Modules/SharePointDsc/en-US/about_SPManagedAccount.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPManagedAccount.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPManagedAccount # Description @@ -15,7 +15,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the managed account is created. - + .PARAMETER AccountName Key - string The username of the account @@ -45,10 +45,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to create a new managed account in a local farm. - +This example shows how to create a new managed account in a local farm. Configuration Example { @@ -74,11 +73,10 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to create a new managed account in a local farm, using - the automatic password change schedule - +This example shows how to create a new managed account in a local farm, using +the automatic password change schedule Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPManagedMetaDataServiceApp.help.txt b/Modules/SharePointDsc/en-US/about_SPManagedMetaDataServiceApp.help.txt index 60ae1d5ef..db750b374 100644 --- a/Modules/SharePointDsc/en-US/about_SPManagedMetaDataServiceApp.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPManagedMetaDataServiceApp.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPManagedMetaDataServiceApp # Description @@ -23,7 +23,7 @@ ContentTypePushdownEnabled and ContentTypeSyndicationEnabled will only be altered if they are part of the bound parameters. - + .PARAMETER Name Key - string The name of the managed metadata service application @@ -77,10 +77,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to deploy the Managed Metadata service app to the local SharePoint farm. - +This example shows how to deploy the Managed Metadata service app to the local SharePoint farm. Configuration Example { @@ -103,14 +102,13 @@ } } +.EXAMPLE 2 -.EXAMPLE - - This example shows how to remove a specific managed metadata service app from the - local SharePoint farm. Because Application pool parameter is required - but is not acutally needed to remove the app, any text value can - be supplied for these as it will be ignored. +This example shows how to remove a specific managed metadata service app from the +local SharePoint farm. Because Application pool parameter is required +but is not acutally needed to remove the app, any text value can +be supplied for these as it will be ignored. Configuration Example { @@ -132,11 +130,10 @@ } } +.EXAMPLE 3 -.EXAMPLE - This example shows how to deploy the Managed Metadata service app to the local SharePoint farm - and also include a specific list of users to be the term store administrators. - +This example shows how to deploy the Managed Metadata service app to the local SharePoint farm +and also include a specific list of users to be the term store administrators. Configuration Example { @@ -163,11 +160,10 @@ } } +.EXAMPLE 4 -.EXAMPLE - This example shows how to deploy the Managed Metadata service app to the local SharePoint farm - and also include a specific list of users to be the term store administrators. - +This example shows how to deploy the Managed Metadata service app to the local SharePoint farm +and also include a specific list of users to be the term store administrators. Configuration Example { @@ -196,11 +192,10 @@ } } +.EXAMPLE 5 -.EXAMPLE - This example shows how to deploy the Managed Metadata service app to the local SharePoint farm - and also include a specific list of users to be the term store administrators. - +This example shows how to deploy the Managed Metadata service app to the local SharePoint farm +and also include a specific list of users to be the term store administrators. Configuration Example { @@ -224,11 +219,10 @@ Configuration Example } } +.EXAMPLE 6 -.EXAMPLE - This example shows how to deploy the Managed Metadata service app to the local SharePoint farm - and also include a specific list of users to be the term store administrators. - +This example shows how to deploy the Managed Metadata service app to the local SharePoint farm +and also include a specific list of users to be the term store administrators. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPManagedMetaDataServiceAppDefault.help.txt b/Modules/SharePointDsc/en-US/about_SPManagedMetaDataServiceAppDefault.help.txt index 5646b491e..d2c776f5d 100644 --- a/Modules/SharePointDsc/en-US/about_SPManagedMetaDataServiceAppDefault.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPManagedMetaDataServiceAppDefault.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPManagedMetaDataServiceAppDefault # Description @@ -13,7 +13,7 @@ This setting has to be configured in conjunction with the SPManagedMetadataServiceApp resource. This resource allows to specify which managed metadata service application proxy should be used as default for these two settings. - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -31,10 +31,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to deploy the Managed Metadata service app to the local SharePoint farm. - +This example shows how to deploy the Managed Metadata service app to the local SharePoint farm. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPManagedPath.help.txt b/Modules/SharePointDsc/en-US/about_SPManagedPath.help.txt index fd77db72e..8e4313a26 100644 --- a/Modules/SharePointDsc/en-US/about_SPManagedPath.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPManagedPath.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPManagedPath # Description @@ -16,7 +16,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the managed path is created. - + .PARAMETER WebAppUrl Key - string The URL of the web application to apply the managed path to - this is ignored for host header web applications @@ -42,10 +42,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to deploy an explicit managed path to a specifici web application - +This example shows how to deploy an explicit managed path to a specifici web application Configuration Example { @@ -68,10 +67,9 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to add a wildcard managed path to a specific web application - +This example shows how to add a wildcard managed path to a specific web application Configuration Example { @@ -94,10 +92,9 @@ } } +.EXAMPLE 3 -.EXAMPLE - This example shows how to remove a wildcard managed path from a specific web application - +This example shows how to remove a wildcard managed path from a specific web application Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPMinRoleCompliance.help.txt b/Modules/SharePointDsc/en-US/about_SPMinRoleCompliance.help.txt index 294d794cd..33fce5da2 100644 --- a/Modules/SharePointDsc/en-US/about_SPMinRoleCompliance.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPMinRoleCompliance.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPMinRoleCompliance # Description @@ -11,7 +11,7 @@ based on the role of servers anywhere in the farm, and if they are not in a compliant state it will tell SharePoint to create timer jobs to make the necesssary modifications to make the farm compliant again. - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -26,10 +26,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to ensure the farm is always compliant with MinRole settings - +This example shows how to ensure the farm is always compliant with MinRole settings Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPOfficeOnlineServerBinding.help.txt b/Modules/SharePointDsc/en-US/about_SPOfficeOnlineServerBinding.help.txt index 0cf347584..d965cc26a 100644 --- a/Modules/SharePointDsc/en-US/about_SPOfficeOnlineServerBinding.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPOfficeOnlineServerBinding.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPOfficeOnlineServerBinding # Description @@ -18,7 +18,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the zone is configured. - + .PARAMETER Zone Key - string Allowed values: Internal-HTTP, Internal-HTTPS, External-HTTP, External-HTTPS @@ -37,11 +37,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to create bindings to the internal-https zone for the - local SharePoint farm. - +This example shows how to create bindings to the internal-https zone for the +local SharePoint farm. Configuration Example { @@ -62,11 +61,10 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to remove bindings from the internal-http zone for the - local SharePoint farm. - +This example shows how to remove bindings from the internal-http zone for the +local SharePoint farm. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPOutgoingEmailSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPOutgoingEmailSettings.help.txt index c61283630..2a3c208dc 100644 --- a/Modules/SharePointDsc/en-US/about_SPOutgoingEmailSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPOutgoingEmailSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPOutgoingEmailSettings # Description @@ -12,7 +12,7 @@ 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. - + .PARAMETER WebAppUrl key - string The URL of the web application. If you want to set the global settings use the Central Admin URL @@ -45,11 +45,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows to set outgoing email settings for the entire farm. Use the URL - of the central admin site for the web app URL to apply for the entire farm. - +This example shows to set outgoing email settings for the entire farm. Use the URL +of the central admin site for the web app URL to apply for the entire farm. Configuration Example { @@ -73,10 +72,9 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows to set outgoing email settings for a specific web app - +This example shows to set outgoing email settings for a specific web app Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPPasswordChangeSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPPasswordChangeSettings.help.txt index 534d81e89..eaafa4b41 100644 --- a/Modules/SharePointDsc/en-US/about_SPPasswordChangeSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPPasswordChangeSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPPasswordChangeSettings # Description @@ -11,7 +11,7 @@ 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 - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -37,10 +37,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example sets the password change settings for managed accounts in the local farm - +This example sets the password change settings for managed accounts in the local farm Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPPerformancePointServiceApp.help.txt b/Modules/SharePointDsc/en-US/about_SPPerformancePointServiceApp.help.txt index 7abb8a8e5..a024a8b29 100644 --- a/Modules/SharePointDsc/en-US/about_SPPerformancePointServiceApp.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPPerformancePointServiceApp.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPPerformancePointServiceApp # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. - + .PARAMETER Name Key - string The name of the service application @@ -42,10 +42,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example creates a new performance point service app in the local farm. - +This example creates a new performance point service app in the local farm. Configuration Example { @@ -66,12 +65,11 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example removes the specific performance point service app from the local - farm. The ApplicationPool parameter is still mandatory but it is not used, so - the value can be anything. - +This example removes the specific performance point service app from the local +farm. The ApplicationPool parameter is still mandatory but it is not used, so +the value can be anything. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPPowerPointAutomationServiceApp.help.txt b/Modules/SharePointDsc/en-US/about_SPPowerPointAutomationServiceApp.help.txt index a3531185a..a2e74ebd7 100644 --- a/Modules/SharePointDsc/en-US/about_SPPowerPointAutomationServiceApp.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPPowerPointAutomationServiceApp.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPPowerPointAutomationServiceApp # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. - + .PARAMETER Name Key - String The name of the service application @@ -54,10 +54,9 @@ Write - String POWERSHELL 4 ONLY: The account to run thsi resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example makes sure the service application exists and has a specific configuration - +This example makes sure the service application exists and has a specific configuration Configuration Example { @@ -85,10 +84,9 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example removes a word automation service app - +This example removes a word automation service app Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPProductUpdate.help.txt b/Modules/SharePointDsc/en-US/about_SPProductUpdate.help.txt index a40d454d9..6c03c26b3 100644 --- a/Modules/SharePointDsc/en-US/about_SPProductUpdate.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPProductUpdate.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPProductUpdate # Description @@ -32,7 +32,7 @@ (SPInstallLanguagePack) 3. Install Cumulative Updates (SPProductUpdate) 4. Create SPFarm (SPFarm) - + .PARAMETER SetupFile Key - String The name of the update setup file @@ -59,11 +59,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example installs the Cumulative Update only in the specified window. - It also shuts down services to speed up the installation process. - +This example installs the Cumulative Update only in the specified window. +It also shuts down services to speed up the installation process. Configuration Example { @@ -87,11 +86,10 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example installs the SharePoint 2013 Service Pack only in the specified window. - It also shuts down services to speed up the installation process. - +This example installs the SharePoint 2013 Service Pack only in the specified window. +It also shuts down services to speed up the installation process. Configuration Example { @@ -115,11 +113,10 @@ } } +.EXAMPLE 3 -.EXAMPLE - This example installs the SharePoint 2013 Dutch Language Pack Service Pack only in the specified window. - It also shuts down services to speed up the installation process. - +This example installs the SharePoint 2013 Dutch Language Pack Service Pack only in the specified window. +It also shuts down services to speed up the installation process. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPProjectServerADResourcePoolSync.help.txt b/Modules/SharePointDsc/en-US/about_SPProjectServerADResourcePoolSync.help.txt index 5cb4d1094..781360d2c 100644 --- a/Modules/SharePointDsc/en-US/about_SPProjectServerADResourcePoolSync.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPProjectServerADResourcePoolSync.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPProjectServerADResourcePoolSync # Description @@ -26,7 +26,7 @@ Schedule = "daily between 03:00:00 and 03:00:00" PsDscRunAsCredential = $SetupAccount } - + .PARAMETER Url Key - string The default zone URL of the Project site to set permissions for @@ -48,10 +48,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example enables Project Server AD resource pool sync - +This example enables Project Server AD resource pool sync Configuration Example { @@ -73,10 +72,9 @@ Configuration Example } } +.EXAMPLE 2 -.EXAMPLE - This example disables Project Server AD resource pool sync - +This example disables Project Server AD resource pool sync Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPProjectServerAdditionalSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPProjectServerAdditionalSettings.help.txt index 0683e92bf..4c37e395a 100644 --- a/Modules/SharePointDsc/en-US/about_SPProjectServerAdditionalSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPProjectServerAdditionalSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPProjectServerAdditionalSettings # Description @@ -8,7 +8,7 @@ This resource is used to manage the "additional settings" for a PWA instance (based on what is in the 'additional settings' page of the web interface). - + .PARAMETER Url Key - string The default zone URL of the Project site to manage settings at @@ -29,10 +29,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to apply additional settings to the PWA site - +This example shows how to apply additional settings to the PWA site Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPProjectServerGlobalPermissions.help.txt b/Modules/SharePointDsc/en-US/about_SPProjectServerGlobalPermissions.help.txt index f20c5a217..98267b251 100644 --- a/Modules/SharePointDsc/en-US/about_SPProjectServerGlobalPermissions.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPProjectServerGlobalPermissions.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPProjectServerGlobalPermissions # Description @@ -8,7 +8,7 @@ This resource allows you to enforce global permissions in a PWA site for a specific project server group or an individual resource. - + .PARAMETER Url Key - string The default zone URL of the Project site to manage the group at @@ -34,10 +34,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to set permissions for a specific resource in a PWA site - +This example shows how to set permissions for a specific resource in a PWA site Configuration Example { @@ -94,10 +93,9 @@ Configuration Example } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to set permissions for a specific group that exists in a PWA site - +This example shows how to set permissions for a specific group that exists in a PWA site Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPProjectServerGroup.help.txt b/Modules/SharePointDsc/en-US/about_SPProjectServerGroup.help.txt index ab2cae30f..ea086e55b 100644 --- a/Modules/SharePointDsc/en-US/about_SPProjectServerGroup.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPProjectServerGroup.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPProjectServerGroup # Description @@ -9,7 +9,7 @@ This resource is used to configure a group within Project Server. This is only available for use when the site is configured to use Project Server permissions mode and for Project Server 2016 only. - + .PARAMETER Url Key - string The default zone URL of the Project site to manage the group at @@ -47,10 +47,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to create a group with a specific list of members in a PWA site - +This example shows how to create a group with a specific list of members in a PWA site Configuration Example { @@ -76,10 +75,9 @@ Configuration Example } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to create a PWA group mapped to a group in AD - +This example shows how to create a PWA group mapped to a group in AD Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPProjectServerLicense.help.txt b/Modules/SharePointDsc/en-US/about_SPProjectServerLicense.help.txt index 9d6b9229e..3f0c1ed27 100644 --- a/Modules/SharePointDsc/en-US/about_SPProjectServerLicense.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPProjectServerLicense.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPProjectServerLicense # Description @@ -8,7 +8,7 @@ This resource is used to enable a Project Server license in to a SharePoint 2016 or 2019 farm. - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -27,10 +27,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example enables Project Server in the current environment - +This example enables Project Server in the current environment Configuration Example { @@ -51,10 +50,9 @@ Configuration Example } } +.EXAMPLE 2 -.EXAMPLE - This example disables Project Server in the current environment - +This example disables Project Server in the current environment Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPProjectServerPermissionMode.help.txt b/Modules/SharePointDsc/en-US/about_SPProjectServerPermissionMode.help.txt index b6984f2bb..4e08cce0d 100644 --- a/Modules/SharePointDsc/en-US/about_SPProjectServerPermissionMode.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPProjectServerPermissionMode.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPProjectServerPermissionMode # Description @@ -8,7 +8,7 @@ This resource allows you to set the permissions mode (either SharePoint or ProjectServer) for a specific project server site. - + .PARAMETER Url Key - string The default zone URL of the Project site to set permissions for @@ -22,10 +22,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to a specific PWA site to use SharePoint permission mode. - +This example shows how to a specific PWA site to use SharePoint permission mode. Configuration Example { @@ -46,11 +45,10 @@ Configuration Example } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to a specific PWA site to use Project server - permission mode. - +This example shows how to a specific PWA site to use Project server +permission mode. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPProjectServerServiceApp.help.txt b/Modules/SharePointDsc/en-US/about_SPProjectServerServiceApp.help.txt index 3b09af3d0..f2dd28388 100644 --- a/Modules/SharePointDsc/en-US/about_SPProjectServerServiceApp.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPProjectServerServiceApp.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPProjectServerServiceApp # Description @@ -30,7 +30,7 @@ PsDscRunAsCredential = $SetupAccount DependsOn = "[SPSite]PWASite" } - + .PARAMETER Name Key - string The name of the service application @@ -52,11 +52,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to create a new project server services service app - in the local farm - +This example shows how to create a new project server services service app +in the local farm Configuration Example { @@ -77,12 +76,11 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to remove a project server service app in the local farm. - The ApplicationPool property is still required but is not used when removing, so - the value used here doesn't matter. - +This example shows how to remove a project server service app in the local farm. +The ApplicationPool property is still required but is not used when removing, so +the value used here doesn't matter. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPProjectServerTimeSheetSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPProjectServerTimeSheetSettings.help.txt index 77c0bd2be..6d0582ac9 100644 --- a/Modules/SharePointDsc/en-US/about_SPProjectServerTimeSheetSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPProjectServerTimeSheetSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPProjectServerTimeSheetSettings # Description @@ -8,7 +8,7 @@ Allows you to configure the default timesheet settings for a specific PWA instance. - + .PARAMETER Url Key - string The default zone URL of the Project site to set timesheet settings for @@ -97,11 +97,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example demonstrates how to apply timesheet settings to a specific - PWA instance - +This example demonstrates how to apply timesheet settings to a specific +PWA instance Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPProjectServerUserSyncSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPProjectServerUserSyncSettings.help.txt index a22ad256e..72360dab9 100644 --- a/Modules/SharePointDsc/en-US/about_SPProjectServerUserSyncSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPProjectServerUserSyncSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPProjectServerUserSyncSettings # Description @@ -8,7 +8,7 @@ This resource is responsible for configuration of the user sync settings between projects and project sites. - + .PARAMETER Url Key - string The default zone URL of the Project site to set user sync settings for @@ -29,10 +29,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example demonstrates how to set user sync settings for a PWA site - +This example demonstrates how to set user sync settings for a PWA site Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPProjectServerWssSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPProjectServerWssSettings.help.txt index e4f8913c3..852933d6e 100644 --- a/Modules/SharePointDsc/en-US/about_SPProjectServerWssSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPProjectServerWssSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPProjectServerWssSettings # Description @@ -14,7 +14,7 @@ or PsDscRunAsCredential properties) needs to have elevated rights to execute this resource. It is recommended to use the SharePoint Farm Account for this purpose to avoid receiving a "GeneralSecurityAccessDenied" error. - + .PARAMETER Url Key - string The default zone URL of the Project site to set WSS settings for @@ -28,10 +28,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example demonstrates how to set WSS settings for a PWA site - +This example demonstrates how to set WSS settings for a PWA site Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPPublishServiceApplication.help.txt b/Modules/SharePointDsc/en-US/about_SPPublishServiceApplication.help.txt index fc39354f8..eb0674043 100644 --- a/Modules/SharePointDsc/en-US/about_SPPublishServiceApplication.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPPublishServiceApplication.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPPublishServiceApplication # Description @@ -23,7 +23,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. - + .PARAMETER Name Key - string The name of the service application to publish @@ -37,11 +37,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to ensure that the managed metadata service is published - within the farm. - +This example shows how to ensure that the managed metadata service is published +within the farm. Configuration Example { @@ -62,11 +61,10 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to ensure that the Secure Store Service is not - published within the farm. - +This example shows how to ensure that the Secure Store Service is not +published within the farm. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPQuotaTemplate.help.txt b/Modules/SharePointDsc/en-US/about_SPQuotaTemplate.help.txt index 8adb95d9f..92be645e7 100644 --- a/Modules/SharePointDsc/en-US/about_SPQuotaTemplate.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPQuotaTemplate.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPQuotaTemplate # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the quota template is created. - + .PARAMETER Name Key - string The name of the quota template @@ -42,10 +42,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example creates a specific quota template in the local farm. - +This example creates a specific quota template in the local farm. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPRemoteFarmTrust.help.txt b/Modules/SharePointDsc/en-US/about_SPRemoteFarmTrust.help.txt index 3dbff7ac5..ecbe932ae 100644 --- a/Modules/SharePointDsc/en-US/about_SPRemoteFarmTrust.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPRemoteFarmTrust.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPRemoteFarmTrust # Description @@ -13,7 +13,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the remote farm trust is created. - + .PARAMETER Name Key - string A name of the remote farm, used to create token issuer and root authority @@ -35,11 +35,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example creates a remote farm trust so that the local web app trusts calls - that will come from the remote web app. - +This example creates a remote farm trust so that the local web app trusts calls +that will come from the remote web app. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSearchAuthoritativePage.help.txt b/Modules/SharePointDsc/en-US/about_SPSearchAuthoritativePage.help.txt index 3331d2679..efc8b0a33 100644 --- a/Modules/SharePointDsc/en-US/about_SPSearchAuthoritativePage.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSearchAuthoritativePage.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSearchAuthoritativePage # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When you omit this parameter the crawl rule is created. - + .PARAMETER ServiceAppName Key - String Search Service Application Name @@ -39,10 +39,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to create a Search Authoritative Page - +This example shows how to create a Search Authoritative Page Configuration Example { @@ -66,10 +65,9 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to create a Search Demoted Page - +This example shows how to create a Search Demoted Page Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSearchContentSource.help.txt b/Modules/SharePointDsc/en-US/about_SPSearchContentSource.help.txt index 17581f6c9..0fd2490f4 100644 --- a/Modules/SharePointDsc/en-US/about_SPSearchContentSource.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSearchContentSource.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSearchContentSource # Description @@ -11,7 +11,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the content source is created. - + .PARAMETER Name Key - String The name of the content source @@ -76,10 +76,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to create a SharePoint sites content source - +This example shows how to create a SharePoint sites content source Configuration Example { @@ -107,10 +106,9 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to create a website content source - +This example shows how to create a website content source Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSearchCrawlMapping.help.txt b/Modules/SharePointDsc/en-US/about_SPSearchCrawlMapping.help.txt index 4029ebce5..3ec9bfee3 100644 --- a/Modules/SharePointDsc/en-US/about_SPSearchCrawlMapping.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSearchCrawlMapping.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSearchCrawlMapping # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When you omit this parameter the crawl rule is created. - + .PARAMETER ServiceAppName Key - String Search Service Application Name @@ -34,10 +34,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to apply a Search Crawl Mapping rule to a search application. - +This example shows how to apply a Search Crawl Mapping rule to a search application. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSearchCrawlRule.help.txt b/Modules/SharePointDsc/en-US/about_SPSearchCrawlRule.help.txt index f01096fb1..624fcd42a 100644 --- a/Modules/SharePointDsc/en-US/about_SPSearchCrawlRule.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSearchCrawlRule.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSearchCrawlRule # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the crawl rule is created. - + .PARAMETER Path Key - string The name of the search service application @@ -53,10 +53,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to apply settings to a sepcific URL in search - +This example shows how to apply settings to a sepcific URL in search Configuration Example { @@ -81,10 +80,9 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to set a certificate for authentication to a content source - +This example shows how to set a certificate for authentication to a content source Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSearchCrawlerImpactRule.help.txt b/Modules/SharePointDsc/en-US/about_SPSearchCrawlerImpactRule.help.txt index 1b6c64173..5627a821f 100644 --- a/Modules/SharePointDsc/en-US/about_SPSearchCrawlerImpactRule.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSearchCrawlerImpactRule.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSearchCrawlerImpactRule # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When you omit this parameter the crawl rule is created. - + .PARAMETER ServiceAppName Key - String Search Service Application Name diff --git a/Modules/SharePointDsc/en-US/about_SPSearchFileType.help.txt b/Modules/SharePointDsc/en-US/about_SPSearchFileType.help.txt index a987ee9a9..e93a6c003 100644 --- a/Modules/SharePointDsc/en-US/about_SPSearchFileType.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSearchFileType.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSearchFileType # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the file type is added. - + .PARAMETER FileType Key - string The name of the file type @@ -42,10 +42,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to apply settings to a specific file type in search, using the required parameters - +This example shows how to apply settings to a specific file type in search, using the required parameters Configuration Example { @@ -69,10 +68,9 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to disable a specific file type in search - +This example shows how to disable a specific file type in search Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSearchIndexPartition.help.txt b/Modules/SharePointDsc/en-US/about_SPSearchIndexPartition.help.txt index 11a4dc11a..29320d77b 100644 --- a/Modules/SharePointDsc/en-US/about_SPSearchIndexPartition.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSearchIndexPartition.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSearchIndexPartition # Description @@ -21,7 +21,7 @@ ensure that it was able to create the index path at I:\. If no disk labeled I: was available on server1, this would fail, even though it will not hold an actual index component. - + .PARAMETER Index Key - Uint32 The number of the partition in this farm @@ -42,10 +42,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example adds an extra search partition to the local farms topology - +This example adds an extra search partition to the local farms topology Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSearchManagedProperty.help.txt b/Modules/SharePointDsc/en-US/about_SPSearchManagedProperty.help.txt index bcade07fd..18b7c2afc 100644 --- a/Modules/SharePointDsc/en-US/about_SPSearchManagedProperty.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSearchManagedProperty.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSearchManagedProperty # Description @@ -11,7 +11,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the managed property is created. - + .PARAMETER Name Key - String The name of the managed property @@ -82,10 +82,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how create a new Managed Property, using the required parameters - +This example shows how create a new Managed Property, using the required parameters Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSearchMetadataCategory.help.txt b/Modules/SharePointDsc/en-US/about_SPSearchMetadataCategory.help.txt index 6db4cd921..26fba2f86 100644 --- a/Modules/SharePointDsc/en-US/about_SPSearchMetadataCategory.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSearchMetadataCategory.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSearchMetadataCategory # Description @@ -11,7 +11,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the Metadata Category is created. - + .PARAMETER Name Key - String The name of the Metadata Category @@ -41,10 +41,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to create a new Search Metadata Category, using the required parameters - +This example shows how to create a new Search Metadata Category, using the required parameters Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSearchResultSource.help.txt b/Modules/SharePointDsc/en-US/about_SPSearchResultSource.help.txt index 56f434a35..44a105c56 100644 --- a/Modules/SharePointDsc/en-US/about_SPSearchResultSource.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSearchResultSource.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSearchResultSource # Description @@ -37,7 +37,7 @@ $providers = $fedManager.ListProviders() $providers.Keys ``` - + .PARAMETER Name Key - String The name of the result source @@ -76,10 +76,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to create a remote sharepoint search result source - +This example shows how to create a remote sharepoint search result source Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSearchServiceApp.help.txt b/Modules/SharePointDsc/en-US/about_SPSearchServiceApp.help.txt index 760142417..cd133880e 100644 --- a/Modules/SharePointDsc/en-US/about_SPSearchServiceApp.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSearchServiceApp.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSearchServiceApp # Description @@ -20,7 +20,7 @@ NOTE: The WindowsServiceAccount parameter is deprecated and no longer does anything. The functionality for changing this account has been moved to SPSearchServiceSettings. - + .PARAMETER Name Key - string The name of the search service application @@ -70,10 +70,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example creates a new search service app in the local farm - +This example creates a new search service app in the local farm Configuration Example { @@ -95,11 +94,10 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example removes a search service app in the local farm. The ApplicationPool - parameter is still required but is not actually used, so its value does not matter. - +This example removes a search service app in the local farm. The ApplicationPool +parameter is still required but is not actually used, so its value does not matter. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSearchServiceSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPSearchServiceSettings.help.txt index 1ae6932f5..4fc21389d 100644 --- a/Modules/SharePointDsc/en-US/about_SPSearchServiceSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSearchServiceSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSearchServiceSettings # Description @@ -10,7 +10,7 @@ service, like the crawler performance level. All settings are farm wide settings, which is why this resource should only be used once in each configuration. - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -33,10 +33,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example creates a new search service app in the local farm - +This example creates a new search service app in the local farm Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSearchTopology.help.txt b/Modules/SharePointDsc/en-US/about_SPSearchTopology.help.txt index 93e38a46d..47f2a53a8 100644 --- a/Modules/SharePointDsc/en-US/about_SPSearchTopology.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSearchTopology.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSearchTopology # Description @@ -26,7 +26,7 @@ also need to ensure that it was able to create the index path at I:\. If no disk labeled I: was available on server1, this would fail, even though it will not hold an actual index component. - + .PARAMETER ServiceAppName Key - String The name of the search service application for this topology @@ -63,10 +63,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to apply a specific topology to the search service app - +This example shows how to apply a specific topology to the search service app Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSecureStoreServiceApp.help.txt b/Modules/SharePointDsc/en-US/about_SPSecureStoreServiceApp.help.txt index 05a8c583c..36e6558b1 100644 --- a/Modules/SharePointDsc/en-US/about_SPSecureStoreServiceApp.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSecureStoreServiceApp.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSecureStoreServiceApp # Description @@ -13,7 +13,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. - + .PARAMETER Name Key - string The name of the secure store service app @@ -72,10 +72,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example creates a new secure store service app. - +This example creates a new secure store service app. Configuration Example { @@ -99,12 +98,11 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example removes a secure store service app. The ApplicationPool and - AuditingEnabled parameters are required, but are not used so their values - are able to be set to anything. - +This example removes a secure store service app. The ApplicationPool and +AuditingEnabled parameters are required, but are not used so their values +are able to be set to anything. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSecurityTokenServiceConfig.help.txt b/Modules/SharePointDsc/en-US/about_SPSecurityTokenServiceConfig.help.txt index c25220d64..6501b458f 100644 --- a/Modules/SharePointDsc/en-US/about_SPSecurityTokenServiceConfig.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSecurityTokenServiceConfig.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSecurityTokenServiceConfig # Description @@ -9,7 +9,7 @@ This resource is responsible for configuring the Security Token Service within the local SharePoint farm. Using Ensure equals to Absent is not supported. This resource can only apply configuration, not ensure they don't exist. - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -44,10 +44,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example configures the Security Token Service - +This example configures the Security Token Service Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSelfServiceSiteCreation.help.txt b/Modules/SharePointDsc/en-US/about_SPSelfServiceSiteCreation.help.txt index 9b3992c5b..43f021c54 100644 --- a/Modules/SharePointDsc/en-US/about_SPSelfServiceSiteCreation.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSelfServiceSiteCreation.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSelfServiceSiteCreation # Description @@ -26,7 +26,7 @@ It is possible to configure self-service site creation to create sites in SharePoint Online. This requires that [hybrid self-service site creation](https://docs.microsoft.com/en-us/sharepoint/hybrid/hybrid-self-service-site-creation) is configured using the Hybrid Picker. - + .PARAMETER WebAppUrl Key - string The url of the web application @@ -85,10 +85,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to configure self-service site creation for a web application - +This example shows how to configure self-service site creation for a web application Configuration Example { @@ -115,10 +114,9 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to configure self-service site creation with a custom form for a web application - +This example shows how to configure self-service site creation with a custom form for a web application Configuration Example { @@ -141,10 +139,9 @@ } } +.EXAMPLE 3 -.EXAMPLE - This example shows how to disable self-service site creation for a web application - +This example shows how to disable self-service site creation for a web application Configuration Example { @@ -165,10 +162,9 @@ } } +.EXAMPLE 4 -.EXAMPLE - This example shows how to configure self-service site creation with a custom form for a web application - +This example shows how to configure self-service site creation with a custom form for a web application Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPServiceAppPool.help.txt b/Modules/SharePointDsc/en-US/about_SPServiceAppPool.help.txt index 313972269..b59b134b0 100644 --- a/Modules/SharePointDsc/en-US/about_SPServiceAppPool.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPServiceAppPool.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPServiceAppPool # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the service application pool is provisioned. - + .PARAMETER Name Key - string The name of application pool @@ -30,10 +30,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example creates a service application pool for service apps to run in. - +This example creates a service application pool for service apps to run in. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPServiceAppProxyGroup.help.txt b/Modules/SharePointDsc/en-US/about_SPServiceAppProxyGroup.help.txt index 8f2391453..4ea1ded00 100644 --- a/Modules/SharePointDsc/en-US/about_SPServiceAppProxyGroup.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPServiceAppProxyGroup.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPServiceAppProxyGroup # Description @@ -25,7 +25,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the proxy group is created. - + .PARAMETER Name Key - String Name of the Proxy Group to create @@ -51,11 +51,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example creates two seperate proxy groups of service apps that can be - assigned to web apps in the farm - +This example creates two seperate proxy groups of service apps that can be +assigned to web apps in the farm Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPServiceAppSecurity.help.txt b/Modules/SharePointDsc/en-US/about_SPServiceAppSecurity.help.txt index 8768e73e9..56415dedc 100644 --- a/Modules/SharePointDsc/en-US/about_SPServiceAppSecurity.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPServiceAppSecurity.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPServiceAppSecurity # Description @@ -82,7 +82,7 @@ $perms = Get-SPServiceApplicationSecurity -Identity $serviceApp -Admin $perms.NamedAccessRights.Name ``` - + .PARAMETER ServiceAppName Key - String The name of the service application you wish to apply security settings to @@ -108,13 +108,12 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how full control permission can be given to the farm - account and service app pool account to the user profile service app's - sharing permission. - It also shows granting access to specific areas to a user. - +This example shows how full control permission can be given to the farm +account and service app pool account to the user profile service app's +sharing permission. +It also shows granting access to specific areas to a user. Configuration Example { @@ -150,12 +149,11 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to use the local farm token to grant - full control permission to the local farm to the - user profile service app's sharing permission. - +This example shows how to use the local farm token to grant +full control permission to the local farm to the +user profile service app's sharing permission. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPServiceIdentity.help.txt b/Modules/SharePointDsc/en-US/about_SPServiceIdentity.help.txt index 079c2d27c..f115f1eb4 100644 --- a/Modules/SharePointDsc/en-US/about_SPServiceIdentity.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPServiceIdentity.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPServiceIdentity # Description @@ -11,7 +11,7 @@ The name is the typename of the service as shown in the Central Admin website. This resource only needs to be run on one server in the farm, as the process identity update method will apply the settings to all instances of the service. - + .PARAMETER Name Key - string The name of the service instance to manage @@ -24,11 +24,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to set the SandBox Code Service to run under a specifed service account. - The account must already be registered as a managed account. - +This example shows how to set the SandBox Code Service to run under a specifed service account. +The account must already be registered as a managed account. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPServiceInstance.help.txt b/Modules/SharePointDsc/en-US/about_SPServiceInstance.help.txt index 234778b9b..a46c6e9ed 100644 --- a/Modules/SharePointDsc/en-US/about_SPServiceInstance.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPServiceInstance.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPServiceInstance # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the service instance is started. - + .PARAMETER Name Key - string The name of the service instance to manage @@ -26,11 +26,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to ensure that the managed metadata service is running - on the local server. - +This example shows how to ensure that the managed metadata service is running +on the local server. Configuration Example { @@ -51,11 +50,10 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to ensure that the Business Data Connectivity Service - is not running on the local server. - +This example shows how to ensure that the Business Data Connectivity Service +is not running on the local server. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSessionStateService.help.txt b/Modules/SharePointDsc/en-US/about_SPSessionStateService.help.txt index bd2261a38..a7ac9c9ad 100644 --- a/Modules/SharePointDsc/en-US/about_SPSessionStateService.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSessionStateService.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSessionStateService # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. - + .PARAMETER DatabaseName Key - string The name of the database for the service @@ -34,10 +34,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example creates a new session state service on the local farm. - +This example creates a new session state service on the local farm. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPShellAdmins.help.txt b/Modules/SharePointDsc/en-US/about_SPShellAdmins.help.txt index bda7639b0..013762e18 100644 --- a/Modules/SharePointDsc/en-US/about_SPShellAdmins.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPShellAdmins.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPShellAdmins # Description @@ -42,7 +42,7 @@ is the owner of that content database in SQL Server. When this is true, you cannot add it to the Shell Admins (common for AllContentDatabases parameter) and the resource will throw an error. Workaround: Change database owner in SQL - + .PARAMETER IsSingleInstance Key - String Allowed values: Yes @@ -76,11 +76,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example gives admin access to the specified users for the local farm as well as - all content databases in the local farm. - +This example gives admin access to the specified users for the local farm as well as +all content databases in the local farm. Configuration Example { @@ -101,11 +100,10 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example gives admin access to the specified users for the local farm as well as - all content databases in the local farm. - +This example gives admin access to the specified users for the local farm as well as +all content databases in the local farm. Configuration Example { @@ -135,12 +133,11 @@ } } +.EXAMPLE 3 -.EXAMPLE - This example gives admin access to the specified users for the local farm as - well as all content databases in the local farm, with the exception of database - WSS_Content_Portal. - +This example gives admin access to the specified users for the local farm as +well as all content databases in the local farm, with the exception of database +WSS_Content_Portal. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSite.help.txt b/Modules/SharePointDsc/en-US/about_SPSite.help.txt index 8fd06e444..08603a37d 100644 --- a/Modules/SharePointDsc/en-US/about_SPSite.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSite.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSite # Description @@ -30,7 +30,7 @@ AdministrationSiteType is used in combination with the resource SPWebAppClientCallableSettings. The required proxy library must be configured before the administration site type has any effect. - + .PARAMETER Url Key - string The URL of the site collection @@ -96,10 +96,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example creates a site collection with the provided details - +This example creates a site collection with the provided details Configuration Example { @@ -123,10 +122,9 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example creates a site collection with the provided details - +This example creates a site collection with the provided details Configuration Example { @@ -151,10 +149,9 @@ } } +.EXAMPLE 3 -.EXAMPLE - This example creates a site collection with the provided details - +This example creates a site collection with the provided details Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSitePropertyBag.help.txt b/Modules/SharePointDsc/en-US/about_SPSitePropertyBag.help.txt index aa7b2a608..d6a0931ac 100644 --- a/Modules/SharePointDsc/en-US/about_SPSitePropertyBag.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSitePropertyBag.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSitePropertyBag # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the property bag is configured. - + .PARAMETER Url Key - string The URL of the site collection @@ -34,10 +34,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how add property bag value in a site collection. - +This example shows how add property bag value in a site collection. Configuration Example { @@ -63,10 +62,9 @@ Configuration Example } } +.EXAMPLE 2 -.EXAMPLE - This example shows how remove a property bag value in a site collection. - +This example shows how remove a property bag value in a site collection. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSiteUrl.help.txt b/Modules/SharePointDsc/en-US/about_SPSiteUrl.help.txt index 476a3c355..368b19988 100644 --- a/Modules/SharePointDsc/en-US/about_SPSiteUrl.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSiteUrl.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSiteUrl # Description @@ -17,7 +17,7 @@ $new = "http://new.contoso.com" $site.Rename($new) ((Get-SPSite $new).contentdatabase).RefreshSitesInConfigurationDatabase - + .PARAMETER Url Key - string The URL of the site collection @@ -42,11 +42,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example configures the site collection urls for the specified - Host Named Site Collection - +This example configures the site collection urls for the specified +Host Named Site Collection Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPStateServiceApp.help.txt b/Modules/SharePointDsc/en-US/about_SPStateServiceApp.help.txt index b9c70d895..8a6d7759a 100644 --- a/Modules/SharePointDsc/en-US/about_SPStateServiceApp.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPStateServiceApp.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPStateServiceApp # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. - + .PARAMETER Name Key - string The name of the state service app @@ -42,10 +42,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example creates a state service application in the local farm - +This example creates a state service application in the local farm Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPSubscriptionSettingsServiceApp.help.txt b/Modules/SharePointDsc/en-US/about_SPSubscriptionSettingsServiceApp.help.txt index 9a9dcd244..d11dff6e7 100644 --- a/Modules/SharePointDsc/en-US/about_SPSubscriptionSettingsServiceApp.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPSubscriptionSettingsServiceApp.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPSubscriptionSettingsServiceApp # Description @@ -17,7 +17,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. - + .PARAMETER Name Key - string The name of the subscription settings service app @@ -43,10 +43,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example creates a new subscription settings service app in the local farm. - +This example creates a new subscription settings service app in the local farm. Configuration Example { @@ -69,12 +68,11 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example removes a subscription settings service app in the local farm. - The ApplicationPool property is required, but is ignored when removing a - service app. - +This example removes a subscription settings service app in the local farm. +The ApplicationPool property is required, but is ignored when removing a +service app. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPTimerJobState.help.txt b/Modules/SharePointDsc/en-US/about_SPTimerJobState.help.txt index 126b5fc78..e30669863 100644 --- a/Modules/SharePointDsc/en-US/about_SPTimerJobState.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPTimerJobState.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPTimerJobState # Description @@ -29,7 +29,7 @@ NOTE2: You cannot use SPTimerJobState to change the Health Analyzer jobs, because these are configured to specific times by default. - + .PARAMETER TypeName Key - String The type name of the timer job (not the display name) @@ -50,10 +50,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example show how to disable the dead site delete job in the local farm. - +This example show how to disable the dead site delete job in the local farm. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPTrustedIdentityTokenIssuer.help.txt b/Modules/SharePointDsc/en-US/about_SPTrustedIdentityTokenIssuer.help.txt index 9ffd968f2..f6e52a13d 100644 --- a/Modules/SharePointDsc/en-US/about_SPTrustedIdentityTokenIssuer.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPTrustedIdentityTokenIssuer.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPTrustedIdentityTokenIssuer # Description @@ -34,7 +34,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the token issuer is created. - + .PARAMETER Name Key - String Name of the SPTrustedIdentityTokenIssuer @@ -88,10 +88,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example deploys a trusted token issuer to the local farm. - +This example deploys a trusted token issuer to the local farm. Configuration Example { @@ -130,10 +129,9 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example deploys a trusted token issuer to the local farm. - +This example deploys a trusted token issuer to the local farm. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPTrustedIdentityTokenIssuerProviderRealms.help.txt b/Modules/SharePointDsc/en-US/about_SPTrustedIdentityTokenIssuerProviderRealms.help.txt index 2b2005933..0c269894d 100644 --- a/Modules/SharePointDsc/en-US/about_SPTrustedIdentityTokenIssuerProviderRealms.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPTrustedIdentityTokenIssuerProviderRealms.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPTrustedIdentityTokenIssuerProviderRealms # Description @@ -16,7 +16,7 @@ without changing any other realms that are set already. Include and Exclude can be combined together. RealmUrl is the key and should be unique, otherwise existing RealmUrn value will be updated/replaced. - + .PARAMETER IssuerName Key - String Name of the SPTrustedIdentityTokenIssuer @@ -42,11 +42,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example adds provider realms to existing trusted token issuer. - Existing will be removed. - +This example adds provider realms to existing trusted token issuer. +Existing will be removed. Configuration Example { @@ -79,11 +78,10 @@ Configuration Example } } +.EXAMPLE 2 -.EXAMPLE - This example adds provider realms to existing trusted token issuer. - Existing are left and not removed. - +This example adds provider realms to existing trusted token issuer. +Existing are left and not removed. Configuration Example { @@ -117,12 +115,11 @@ Configuration Example } } +.EXAMPLE 3 -.EXAMPLE - This example excludes provider realms from - existing trusted token issuer. - Existing and not excluded are left and not removed. - +This example excludes provider realms from +existing trusted token issuer. +Existing and not excluded are left and not removed. Configuration Example { @@ -155,12 +152,11 @@ Configuration Example } } +.EXAMPLE 4 -.EXAMPLE - This example includes and excludes provider realms - from existing trusted token issuer. - Existing and not excluded are left and not removed. - +This example includes and excludes provider realms +from existing trusted token issuer. +Existing and not excluded are left and not removed. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPTrustedRootAuthority.help.txt b/Modules/SharePointDsc/en-US/about_SPTrustedRootAuthority.help.txt index a2813d345..277b41016 100644 --- a/Modules/SharePointDsc/en-US/about_SPTrustedRootAuthority.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPTrustedRootAuthority.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPTrustedRootAuthority # Description @@ -10,7 +10,7 @@ SharePoint farm. It imports the certificate into SharePoint in order for high trust apps or consuming service applications from other farms will work. - + .PARAMETER Name Key - String Specifies the name of the trusted root authority to create. @@ -32,10 +32,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example deploys a SP Trusted Root Authority to the local farm. - +This example deploys a SP Trusted Root Authority to the local farm. Configuration Example { @@ -57,10 +56,9 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example deploys a SP Trusted Root Authority to the local farm. - +This example deploys a SP Trusted Root Authority to the local farm. Configuration Example { @@ -82,10 +80,9 @@ } } +.EXAMPLE 3 -.EXAMPLE - This example removes a SP Trusted Root Authority from the local farm. - +This example removes a SP Trusted Root Authority from the local farm. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPTrustedSecurityTokenIssuer.help.txt b/Modules/SharePointDsc/en-US/about_SPTrustedSecurityTokenIssuer.help.txt new file mode 100644 index 000000000..85b7e7aba --- /dev/null +++ b/Modules/SharePointDsc/en-US/about_SPTrustedSecurityTokenIssuer.help.txt @@ -0,0 +1,151 @@ +.NAME + SPTrustedSecurityTokenIssuer + +# Description + + **Type:** Distributed + **Requires CredSSP:** No + + This resource is used to create or remove a SPTrustedSecurityTokenIssuer in + a SharePoint farm. + + It requires to specify either a MetadataEndPoint or a certificate. + + The certificate can be specified by setting either parameter + SigningCertificateThumbPrint or SigningCertificateFilePath, but not both. + + The SigningCertificateThumbPrint must be the thumbprint of the signing + certificate stored in the certificate store LocalMachine\My of the server + + The SigningCertificateFilePath must be the file path to the public key of + the signing certificate. + + Properties RegisteredIssuerNameIdentifier and RegisteredIssuerNameRealm + compose the RegisteredIssuerName. If RegisteredIssuerNameRealm is ommitted, + it will be set with the realm of the farm. + + The default value for the Ensure parameter is Present. When not specifying this + parameter, the token issuer is created. + +.PARAMETER Name + Key - String + Name of the SPTrustedSecurityTokenIssuer + +.PARAMETER Description + Write - String + Description of the SPTrustedSecurityTokenIssuer + +.PARAMETER RegisteredIssuerNameIdentifier + Write - String + The security principal identifier of the security token issuer + +.PARAMETER RegisteredIssuerNameRealm + Write - String + The realm of the security token issuer + +.PARAMETER SigningCertificateThumbprint + Write - String + Specify the thumbprint of the signing certificate, which must be located in certificate store LocalMachine\\My + +.PARAMETER SigningCertificateFilePath + Write - String + Specify the file path to the signing certificate if it is not stored in the local certificate store already + +.PARAMETER MetadataEndPoint + Write - String + URL that SharePoint will reach to download the JSON metadata file of the issuer + +.PARAMETER IsTrustBroker + Write - Boolean + Specifies whether the trust is established with a self-issuer partner app + +.PARAMETER Ensure + Write - String + Allowed values: Present, Absent + Present if the SPTrustedSecurityTokenIssuer should be created, or Absent if it should be removed + +.PARAMETER InstallAccount + Write - String + POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 + +.EXAMPLE 1 + +This example creates a trusted security token issuer using a signing certificate in a file path, and the SPAuthenticationRealm of the SharePoint farm. + +Configuration Example +{ + param( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + Import-DscResource -ModuleName SharePointDsc + + node localhost { + SPTrustedSecurityTokenIssuer HighTrustAddinsTrust + { + Name = "HighTrustAddins" + Description = "Trust for Provider-hosted high-trust add-ins" + RegisteredIssuerNameIdentifier = "22222222-2222-2222-2222-222222222222" + IsTrustBroker = $true + SigningCertificateFilePath = "F:\Data\DSC\FakeSigning.cer" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount + } + } +} + +.EXAMPLE 2 + +This example creates a trusted security token issuer using a signing certificate retrieved from its thumbprint, and the SPAuthenticationRealm of the SharePoint farm. + +Configuration Example +{ + param( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + Import-DscResource -ModuleName SharePointDsc + + node localhost { + SPTrustedSecurityTokenIssuer HighTrustAddinsTrust + { + Name = "HighTrustAddins" + Description = "Trust for Provider-hosted high-trust add-ins" + RegisteredIssuerNameIdentifier = "22222222-2222-2222-2222-222222222222" + IsTrustBroker = $true + SigningCertificateThumbprint = "123ABCFACE123ABCFACE123ABCFACE123ABCFACE" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount + } + } +} + +.EXAMPLE 3 + +This example creates a trusted security token issuer that will be configured using the metadata file of the ACS tenant. + +Configuration Example +{ + param( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + Import-DscResource -ModuleName SharePointDsc + + node localhost { + SPTrustedSecurityTokenIssuer HighTrustAddinsTrust + { + Name = "ACS Trust" + Description = "Trust with ACS tenant TENANT.onmicrosoft.com" + MetadataEndPoint = "https://accounts.accesscontrol.windows.net/TENANT.onmicrosoft.com/metadata/json/1" + IsTrustBroker = $true + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount + } + } +} + + diff --git a/Modules/SharePointDsc/en-US/about_SPUsageApplication.help.txt b/Modules/SharePointDsc/en-US/about_SPUsageApplication.help.txt index 7a78137dc..6f12f87a1 100644 --- a/Modules/SharePointDsc/en-US/about_SPUsageApplication.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPUsageApplication.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPUsageApplication # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. - + .PARAMETER Name Key - string The name of the service application @@ -58,10 +58,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example deploys a usage application to the local farm - +This example deploys a usage application to the local farm Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPUserProfileProperty.help.txt b/Modules/SharePointDsc/en-US/about_SPUserProfileProperty.help.txt index 77226fd26..694f5b1a6 100644 --- a/Modules/SharePointDsc/en-US/about_SPUserProfileProperty.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPUserProfileProperty.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPUserProfileProperty # Description @@ -19,7 +19,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the user profile property is created. - + .PARAMETER Name Key - string The internal name of the user profile property @@ -112,11 +112,10 @@ Write - string POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example deploys/updates the WorkEmail2 property in the user profile service - app - +This example deploys/updates the WorkEmail2 property in the user profile service +app Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPUserProfileSection.help.txt b/Modules/SharePointDsc/en-US/about_SPUserProfileSection.help.txt index 11a9f7ea0..75ea25cbf 100644 --- a/Modules/SharePointDsc/en-US/about_SPUserProfileSection.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPUserProfileSection.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPUserProfileSection # Description @@ -14,7 +14,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the user profile section is created. - + .PARAMETER Name Key - string The internal name of the user profile section @@ -40,11 +40,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example adds a new section for profile properties to the specified - user profile service app - +This example adds a new section for profile properties to the specified +user profile service app Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPUserProfileServiceApp.help.txt b/Modules/SharePointDsc/en-US/about_SPUserProfileServiceApp.help.txt index 40cf7d83e..96c4b717b 100644 --- a/Modules/SharePointDsc/en-US/about_SPUserProfileServiceApp.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPUserProfileServiceApp.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPUserProfileServiceApp # Description @@ -38,7 +38,7 @@ NOTE2: You should always specify the MySiteHostLocation parameter. Currently this is not a required parameter, but will be as of SharePointDsc v4.0. - + .PARAMETER Name Key - string The name of the user profile service @@ -105,10 +105,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example adds a new user profile service application to the local farm - +This example adds a new user profile service application to the local farm Configuration Example { @@ -138,10 +137,9 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example adds a new user profile service application to the local farm - +This example adds a new user profile service application to the local farm Configuration Example { @@ -176,10 +174,9 @@ } } +.EXAMPLE 3 -.EXAMPLE - This example adds a new user profile service application to the local farm - +This example adds a new user profile service application to the local farm Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPUserProfileServiceAppPermissions.help.txt b/Modules/SharePointDsc/en-US/about_SPUserProfileServiceAppPermissions.help.txt index 2b250c58e..f96181576 100644 --- a/Modules/SharePointDsc/en-US/about_SPUserProfileServiceAppPermissions.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPUserProfileServiceAppPermissions.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPUserProfileServiceAppPermissions # Description @@ -11,7 +11,7 @@ tagging. If you want to allow all users the ability to use a specific permisisons include "Everyone" as a user in the corresponding property. To specify that there should be no permissions on a type, use "none" - + .PARAMETER ProxyName Key - string The name of the proxy that is attached to the user profile service you wish to set permissions for @@ -32,11 +32,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example applies permissions for the user profile service application to limit - access to specific features. - +This example applies permissions for the user profile service application to limit +access to specific features. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPUserProfileSyncConnection.help.txt b/Modules/SharePointDsc/en-US/about_SPUserProfileSyncConnection.help.txt index 9f39949a0..1fcc2c126 100644 --- a/Modules/SharePointDsc/en-US/about_SPUserProfileSyncConnection.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPUserProfileSyncConnection.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPUserProfileSyncConnection # Description @@ -17,7 +17,7 @@ to know which OUs to remove. If any extra OUs exists after the configuration has run the test method will report the resource not in desired state. - + .PARAMETER Name Key - string The name of the connection @@ -76,11 +76,10 @@ Write - string POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example adds a new user profile sync connection to the specified user - profile service app - +This example adds a new user profile sync connection to the specified user +profile service app Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPUserProfileSyncService.help.txt b/Modules/SharePointDsc/en-US/about_SPUserProfileSyncService.help.txt index d0814a799..17af6cb88 100644 --- a/Modules/SharePointDsc/en-US/about_SPUserProfileSyncService.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPUserProfileSyncService.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPUserProfileSyncService # Description @@ -29,7 +29,7 @@ This does however mean that CredSSP is required, which has some security implications. More information about these risks can be found at: http://www.powershellmagazine.com/2014/03/06/accidental-sabotage-beware-of-credssp/ - + .PARAMETER UserProfileServiceAppName Key - string The name of the user profile service for this sync instance @@ -51,10 +51,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example provisions the user profile sync service to the local server - +This example provisions the user profile sync service to the local server Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPVisioServiceApp.help.txt b/Modules/SharePointDsc/en-US/about_SPVisioServiceApp.help.txt index f2064e744..13a5204f8 100644 --- a/Modules/SharePointDsc/en-US/about_SPVisioServiceApp.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPVisioServiceApp.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPVisioServiceApp # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. - + .PARAMETER Name Key - string The name of the service application @@ -34,10 +34,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to create a new visio services service app in the local farm - +This example shows how to create a new visio services service app in the local farm Configuration Example { @@ -58,12 +57,11 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to remove a visio services service app in the local farm. - The ApplicationPool property is still requried but is not used when removing, so - the value used here doesn't matter. - +This example shows how to remove a visio services service app in the local farm. +The ApplicationPool property is still requried but is not used when removing, so +the value used here doesn't matter. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWeb.help.txt b/Modules/SharePointDsc/en-US/about_SPWeb.help.txt index 56dfc25df..f8ea96923 100644 --- a/Modules/SharePointDsc/en-US/about_SPWeb.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWeb.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWeb # Description @@ -11,7 +11,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the web is created. - + .PARAMETER Url Key - string The URL of the web @@ -61,10 +61,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example deploys a subsite in a specific location - +This example deploys a subsite in a specific location Configuration Example { @@ -90,11 +89,10 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example deploys a subsite in a specific location and enables - access requests for this web - +This example deploys a subsite in a specific location and enables +access requests for this web Configuration Example { @@ -122,11 +120,10 @@ } } +.EXAMPLE 3 -.EXAMPLE - This example deploys a subsite in a specific location and disables - access requests for this web - +This example deploys a subsite in a specific location and disables +access requests for this web Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWebAppAuthentication.help.txt b/Modules/SharePointDsc/en-US/about_SPWebAppAuthentication.help.txt index 1c90344ab..81e1ed971 100644 --- a/Modules/SharePointDsc/en-US/about_SPWebAppAuthentication.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWebAppAuthentication.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWebAppAuthentication # Description @@ -21,7 +21,7 @@ Updating the configuration can take a long time, up to five minutes. The Set-SPWebApplication cmdlet sometimes requires several minutes to complete its action. This is not a SharePointDsc issue. - + .PARAMETER WebAppUrl Key - string The URL of the web application @@ -50,13 +50,12 @@ Write - string POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to configure the authentication of a web application in the local farm using a custom - claim provider. A SPTrustedIdentityTokenIssuer is created named Contoso, then this SPTrustedIdentityTokenIssuer - is referenced by the SPWebAppAuthentication as the AuthenticationProvider and the AuthenticationMethod is set - to "Federated" value. - +This example shows how to configure the authentication of a web application in the local farm using a custom +claim provider. A SPTrustedIdentityTokenIssuer is created named Contoso, then this SPTrustedIdentityTokenIssuer +is referenced by the SPWebAppAuthentication as the AuthenticationProvider and the AuthenticationMethod is set +to "Federated" value. Configuration Example { @@ -91,13 +90,12 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to configure the authentication of a web application in the local farm using a custom - claim provider. A SPTrustedIdentityTokenIssuer is created named Contoso, then this SPTrustedIdentityTokenIssuer - is referenced by the SPWebAppAuthentication as the AuthenticationProvider and the AuthenticationMethod is set - to "Federated" value. - +This example shows how to configure the authentication of a web application in the local farm using a custom +claim provider. A SPTrustedIdentityTokenIssuer is created named Contoso, then this SPTrustedIdentityTokenIssuer +is referenced by the SPWebAppAuthentication as the AuthenticationProvider and the AuthenticationMethod is set +to "Federated" value. Configuration Example { @@ -156,11 +154,10 @@ } } +.EXAMPLE 3 -.EXAMPLE - This example shows how to configure the authentication of a web application in the - local farm using Classic authentication. - +This example shows how to configure the authentication of a web application in the +local farm using Classic authentication. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWebAppBlockedFileTypes.help.txt b/Modules/SharePointDsc/en-US/about_SPWebAppBlockedFileTypes.help.txt index 250c210c4..85f24405d 100644 --- a/Modules/SharePointDsc/en-US/about_SPWebAppBlockedFileTypes.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWebAppBlockedFileTypes.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWebAppBlockedFileTypes # Description @@ -17,7 +17,7 @@ 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 - + .PARAMETER WebAppUrl Key - string The URL of the web application to set blocked file types for @@ -38,12 +38,11 @@ Write - string POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to ensure that specific file types are always blocked while - others will always be allowed. Any file types not mentioned in this config will be - able to be managed manually. - +This example shows how to ensure that specific file types are always blocked while +others will always be allowed. Any file types not mentioned in this config will be +able to be managed manually. Configuration Example { @@ -65,11 +64,10 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to ensure that the blocked file type list always - specifically matches this list. - +This example shows how to ensure that the blocked file type list always +specifically matches this list. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWebAppClientCallableSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPWebAppClientCallableSettings.help.txt index c218791b1..de072c310 100644 --- a/Modules/SharePointDsc/en-US/about_SPWebAppClientCallableSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWebAppClientCallableSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWebAppClientCallableSettings # Description @@ -47,7 +47,7 @@ NOTE2: An IIS reset needs to be performed on all servers in the farm after modifying the registered proxy libraries. - + .PARAMETER WebAppUrl Key - string The URL of the web application to set blocked file types for @@ -104,10 +104,9 @@ Write - string POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to set the client callable settings for a web application - +This example shows how to set the client callable settings for a web application Configuration Example { @@ -136,10 +135,9 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to enable tenant administration for a web application in a SharePoint 2013 farm - +This example shows how to enable tenant administration for a web application in a SharePoint 2013 farm Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWebAppGeneralSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPWebAppGeneralSettings.help.txt index f39677ea4..986d3d44b 100644 --- a/Modules/SharePointDsc/en-US/about_SPWebAppGeneralSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWebAppGeneralSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWebAppGeneralSettings # Description @@ -11,7 +11,7 @@ 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). - + .PARAMETER WebAppUrl Key - string The URL of the web app to set the general settings for @@ -101,11 +101,10 @@ Write - string POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to apply some of the available general settings to the - specified web app - +This example shows how to apply some of the available general settings to the +specified web app Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWebAppPeoplePickerSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPWebAppPeoplePickerSettings.help.txt index b8f01206b..24c7631a1 100644 --- a/Modules/SharePointDsc/en-US/about_SPWebAppPeoplePickerSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWebAppPeoplePickerSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWebAppPeoplePickerSettings # Description @@ -18,7 +18,7 @@ The encryption key must be set on every front-end web server in the farm on which SharePoint is installed: https://technet.microsoft.com/en-us/library/gg602075(v=office.15).aspx#section3 - + .PARAMETER WebAppUrl Key - string The URL of the web application @@ -47,10 +47,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to configure the people picker settings on the specified web application - +This example shows how to configure the people picker settings on the specified web application Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWebAppPermissions.help.txt b/Modules/SharePointDsc/en-US/about_SPWebAppPermissions.help.txt index eeecb1ecb..c376947e0 100644 --- a/Modules/SharePointDsc/en-US/about_SPWebAppPermissions.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWebAppPermissions.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWebAppPermissions # Description @@ -11,7 +11,7 @@ individual permissions per category. More info about the permission levels: - + .PARAMETER WebAppUrl Key - string The url of the web application @@ -39,10 +39,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to limit the available permisions within a web app - +This example shows how to limit the available permisions within a web app Configuration Example { @@ -65,10 +64,9 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to ensure all permissions are available for a web app - +This example shows how to ensure all permissions are available for a web app Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWebAppPolicy.help.txt b/Modules/SharePointDsc/en-US/about_SPWebAppPolicy.help.txt index 93ac24f56..1f67a3477 100644 --- a/Modules/SharePointDsc/en-US/about_SPWebAppPolicy.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWebAppPolicy.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWebAppPolicy # Description @@ -22,7 +22,7 @@ needs to be specified. Do not combine the Members property with the MemberToInclude and MembersToExclude properties. Do not set the ActAsSystemAccount property to $true without setting the permission level to - + .PARAMETER WebAppUrl Key - string The URL of the web application @@ -47,11 +47,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example sets the specific web app policy for the specified web app to - match the provided list below. - +This example sets the specific web app policy for the specified web app to +match the provided list below. Configuration Example { @@ -83,11 +82,10 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example shows how to include specific members while excluding other members - from the policy of the web app. - +This example shows how to include specific members while excluding other members +from the policy of the web app. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWebAppPropertyBag.help.txt b/Modules/SharePointDsc/en-US/about_SPWebAppPropertyBag.help.txt index 9c1975845..1809fab24 100644 --- a/Modules/SharePointDsc/en-US/about_SPWebAppPropertyBag.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWebAppPropertyBag.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWebAppPropertyBag # Description @@ -12,7 +12,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the property bag is configured. - + .PARAMETER WebAppUrl Key - string The URL of the web application @@ -34,10 +34,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how add property bag value in a web application. - +This example shows how add property bag value in a web application. Configuration Example { @@ -63,10 +62,9 @@ Configuration Example } } +.EXAMPLE 2 -.EXAMPLE - This example shows how remove a property bag value in a web application. - +This example shows how remove a property bag value in a web application. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWebAppProxyGroup.help.txt b/Modules/SharePointDsc/en-US/about_SPWebAppProxyGroup.help.txt index 62800c8bb..833bd9712 100644 --- a/Modules/SharePointDsc/en-US/about_SPWebAppProxyGroup.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWebAppProxyGroup.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWebAppProxyGroup # Description @@ -15,7 +15,7 @@ This resource is used in conjunction with the SPServiceAppProxyGroup resource, which creates the proxy groups and associates the desired service application proxies with it. Within your configuration, that resource should be a - + .PARAMETER WebAppUrl Key - String URL of the web application @@ -28,10 +28,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to assign a specific proxy group to the specified web app - +This example shows how to assign a specific proxy group to the specified web app Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWebAppSiteUseAndDeletion.help.txt b/Modules/SharePointDsc/en-US/about_SPWebAppSiteUseAndDeletion.help.txt index 2bebd9a97..8f67a8ac2 100644 --- a/Modules/SharePointDsc/en-US/about_SPWebAppSiteUseAndDeletion.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWebAppSiteUseAndDeletion.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWebAppSiteUseAndDeletion # Description @@ -10,7 +10,7 @@ settings on a specific web application. You can enable or disable the Site Use and Deletion feature, specify the amount of days after which the alerts are being send, if sites have to be deleted automatically and if so after how many - + .PARAMETER WebAppUrl Key - string The URL of the web application @@ -35,10 +35,9 @@ Write - string POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to apply site use and deletion settings to the specified web application - +This example shows how to apply site use and deletion settings to the specified web application Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWebAppSuiteBar.help.txt b/Modules/SharePointDsc/en-US/about_SPWebAppSuiteBar.help.txt index 1f1da82f0..46c0ce04f 100644 --- a/Modules/SharePointDsc/en-US/about_SPWebAppSuiteBar.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWebAppSuiteBar.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWebAppSuiteBar # Description @@ -15,7 +15,7 @@ be specified, whereas for SharePoint 2016/2019, all properties are supported. Note that SuiteBarBrandingElementHtml has no effect unless using a SharePoint 2013 master page. - + .PARAMETER WebAppUrl Key - string The URL of the web application @@ -44,11 +44,10 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example sets the branding for the suite bar of a given - Web Application in SharePoint 2016/2019. - +This example sets the branding for the suite bar of a given +Web Application in SharePoint 2016/2019. Configuration Example { @@ -72,11 +71,10 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example sets the branding for the suite bar of a given - Web Application in SharePoint 2013. - +This example sets the branding for the suite bar of a given +Web Application in SharePoint 2013. Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWebAppThrottlingSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPWebAppThrottlingSettings.help.txt index f9cba718a..744383734 100644 --- a/Modules/SharePointDsc/en-US/about_SPWebAppThrottlingSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWebAppThrottlingSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWebAppThrottlingSettings # Description @@ -13,7 +13,7 @@ (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 - + .PARAMETER WebAppUrl Key - string The URL of the web application @@ -66,10 +66,9 @@ Write - string POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to apply throttling settings to a specific web app - +This example shows how to apply throttling settings to a specific web app Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWebAppWorkflowSettings.help.txt b/Modules/SharePointDsc/en-US/about_SPWebAppWorkflowSettings.help.txt index c6986127b..7749da370 100644 --- a/Modules/SharePointDsc/en-US/about_SPWebAppWorkflowSettings.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWebAppWorkflowSettings.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWebAppWorkflowSettings # Description @@ -11,7 +11,7 @@ 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). - + .PARAMETER WebAppUrl Key - string The URL of the web application @@ -32,10 +32,9 @@ Write - string POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to apply workflow settings to the specific web application - +This example shows how to apply workflow settings to the specific web application Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWebApplication.help.txt b/Modules/SharePointDsc/en-US/about_SPWebApplication.help.txt index c1cd03a9f..a2962c5e8 100644 --- a/Modules/SharePointDsc/en-US/about_SPWebApplication.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWebApplication.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWebApplication # Description @@ -21,7 +21,7 @@ Site Collection. If you want to change the IIS website binding settings, please use the xWebsite resource in the xWebAdministration module. - + .PARAMETER Name Key - string The name of the web application @@ -75,10 +75,9 @@ Write - string POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to create a new web application in the local farm - +This example shows how to create a new web application in the local farm Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWebApplicationAppDomain.help.txt b/Modules/SharePointDsc/en-US/about_SPWebApplicationAppDomain.help.txt index e27025010..49273bd8a 100644 --- a/Modules/SharePointDsc/en-US/about_SPWebApplicationAppDomain.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWebApplicationAppDomain.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWebApplicationAppDomain # Description @@ -11,7 +11,7 @@ application, allowing for the setting of unique app domains for each extension of a web application. The app prefix should still be set using the SPAppDomain resource before this is applied to customise a specific zone. - + .PARAMETER WebAppUrl Key - string The URL of the web application to set the app domain for @@ -37,10 +37,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to set the app domain for a specified web application - +This example shows how to set the app domain for a specified web application Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWebApplicationExtension.help.txt b/Modules/SharePointDsc/en-US/about_SPWebApplicationExtension.help.txt index 609149451..5cc41d01a 100644 --- a/Modules/SharePointDsc/en-US/about_SPWebApplicationExtension.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWebApplicationExtension.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWebApplicationExtension # Description @@ -12,7 +12,7 @@ AllowAnonymous and Authentication methods remain consistent. Please note that this currently does not support changing the claims provider on an existing claims enabled web application externsion. - + .PARAMETER WebAppUrl Key - string The URL of the parent web application @@ -59,10 +59,9 @@ Write - string POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example shows how to create a new web application extension in the local farm - +This example shows how to create a new web application extension in the local farm Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWordAutomationServiceApp.help.txt b/Modules/SharePointDsc/en-US/about_SPWordAutomationServiceApp.help.txt index d8aab140f..fad3d2f70 100644 --- a/Modules/SharePointDsc/en-US/about_SPWordAutomationServiceApp.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWordAutomationServiceApp.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWordAutomationServiceApp # Description @@ -18,7 +18,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. - + .PARAMETER Name Key - string THe name of the service application @@ -97,10 +97,9 @@ Write - string POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example makes sure the service application exists and has a specific configuration - +This example makes sure the service application exists and has a specific configuration Configuration Example { @@ -137,10 +136,9 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example removes a word automation service app - +This example removes a word automation service app Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWorkManagementServiceApp.help.txt b/Modules/SharePointDsc/en-US/about_SPWorkManagementServiceApp.help.txt index b8050ab56..70a218dce 100644 --- a/Modules/SharePointDsc/en-US/about_SPWorkManagementServiceApp.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWorkManagementServiceApp.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWorkManagementServiceApp # Description @@ -27,7 +27,7 @@ Management functionality has been removed in SharePoint 2016/2019. More information: https://technet.microsoft.com/en-us/library/mt346112(v=office.16).aspx - + .PARAMETER Name Key - string The name of the work management service application @@ -73,10 +73,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example creates a new work management service app in the local farm - +This example creates a new work management service app in the local farm Configuration Example { diff --git a/Modules/SharePointDsc/en-US/about_SPWorkflowService.help.txt b/Modules/SharePointDsc/en-US/about_SPWorkflowService.help.txt index 1de03496f..620733b6d 100644 --- a/Modules/SharePointDsc/en-US/about_SPWorkflowService.help.txt +++ b/Modules/SharePointDsc/en-US/about_SPWorkflowService.help.txt @@ -1,4 +1,4 @@ -.NAME +.NAME SPWorkflowService # Description @@ -20,7 +20,7 @@ Change or configuration drift for AllowOAuthHttp is not detected by this resource. - + .PARAMETER WorkflowHostUri Key - string The URL of the Workflow Service @@ -41,10 +41,9 @@ Write - String POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5 +.EXAMPLE 1 -.EXAMPLE - This example registers the workflow service over http. - +This example registers the workflow service over http. Configuration Example { @@ -66,10 +65,9 @@ } } +.EXAMPLE 2 -.EXAMPLE - This example registers the workflow service specifying a custom scope name. - +This example registers the workflow service specifying a custom scope name. Configuration Example { diff --git a/Tests/Unit/SharePointDsc/SharePointDSC.SPPowerPointAutomationServiceApp.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDSC.SPPowerPointAutomationServiceApp.Tests.ps1 index e91e27fca..5fdfbaacc 100644 --- a/Tests/Unit/SharePointDsc/SharePointDSC.SPPowerPointAutomationServiceApp.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDSC.SPPowerPointAutomationServiceApp.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPPowerPointAutomationServiceApp" + -DscResource "SPPowerPointAutomationServiceApp" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -33,15 +33,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Test contexts Context -Name "When Ensure is Absent and we specify additional paramters" -Fixture { $testParams = @{ - Name = "Power Point Automation Service Application" - ProxyName = "Power Point Automation Service Application Proxy" - ApplicationPool = "SharePoint Services App Pool" - CacheExpirationPeriodInSeconds = 600 - MaximumConversionsPerWorker = 5 + Name = "Power Point Automation Service Application" + ProxyName = "Power Point Automation Service Application Proxy" + ApplicationPool = "SharePoint Services App Pool" + CacheExpirationPeriodInSeconds = 600 + MaximumConversionsPerWorker = 5 WorkerKeepAliveTimeoutInSeconds = 120 - WorkerProcessCount = 3 - WorkerTimeoutInSeconds = 300 - Ensure = "Absent" + WorkerProcessCount = 3 + WorkerTimeoutInSeconds = 300 + Ensure = "Absent" } It "Should throw an exception as additional parameters are not allowed when Ensure = 'Absent'" { @@ -53,14 +53,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When Ensure is Present but we don't specify an ApplicationPool" -Fixture { $testParams = @{ - Name = "Power Point Automation Service Application" - ProxyName = "Power Point Automation Service Application Proxy" - CacheExpirationPeriodInSeconds = 600 - MaximumConversionsPerWorker = 5 + Name = "Power Point Automation Service Application" + ProxyName = "Power Point Automation Service Application Proxy" + CacheExpirationPeriodInSeconds = 600 + MaximumConversionsPerWorker = 5 WorkerKeepAliveTimeoutInSeconds = 120 - WorkerProcessCount = 3 - WorkerTimeoutInSeconds = 300 - Ensure = "Present" + WorkerProcessCount = 3 + WorkerTimeoutInSeconds = 300 + Ensure = "Present" } Mock -CommandName Get-SPServiceApplicationPool -MockWith { @@ -78,15 +78,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When no service applications exist in the current farm" -Fixture { $testParams = @{ - Name = "Power Point Automation Service Application" - ProxyName = "Power Point Automation Service Application Proxy" - ApplicationPool = "SharePoint Services App Pool" - CacheExpirationPeriodInSeconds = 600 - MaximumConversionsPerWorker = 5 + Name = "Power Point Automation Service Application" + ProxyName = "Power Point Automation Service Application Proxy" + ApplicationPool = "SharePoint Services App Pool" + CacheExpirationPeriodInSeconds = 600 + MaximumConversionsPerWorker = 5 WorkerKeepAliveTimeoutInSeconds = 120 - WorkerProcessCount = 3 - WorkerTimeoutInSeconds = 300 - Ensure = "Present" + WorkerProcessCount = 3 + WorkerTimeoutInSeconds = 300 + Ensure = "Present" } Mock -CommandName Get-SPServiceApplicationPool -MockWith { @@ -96,28 +96,28 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName New-SPPowerPointConversionServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - ApplicationPool = @{ Name = $testParams.ApplicationPool } - CacheExpirationPeriodInSeconds = 0 - MaximumConversionsPerWorker = 0 + $spServiceApp = [PSCustomObject]@{ + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } + CacheExpirationPeriodInSeconds = 0 + MaximumConversionsPerWorker = 0 WorkerKeepAliveTimeoutInSeconds = 0 - WorkerProcessCount = 0 - WorkerTimeoutInSeconds = 0 + WorkerProcessCount = 0 + WorkerTimeoutInSeconds = 0 } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value { - return @{ - DisplayName = $testParams.Name - ApplicationPool = @{ Name = $testParams.ApplicationPool } - CacheExpirationPeriodInSeconds = $testParams.CacheExpirationPeriodInSeconds - MaximumConversionsPerWorker = $testParams.MaximumConversionsPerWorker - WorkerKeepAliveTimeoutInSeconds = $testParams.WorkerKeepAliveTimeoutInSeconds - WorkerProcessCount = $testParams.WorkerProcessCount - WorkerTimeoutInSeconds = $testParams.WorkerTimeoutInSeconds - } - } -PassThru -Force + -Name Update ` + -Value { + return @{ + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } + CacheExpirationPeriodInSeconds = $testParams.CacheExpirationPeriodInSeconds + MaximumConversionsPerWorker = $testParams.MaximumConversionsPerWorker + WorkerKeepAliveTimeoutInSeconds = $testParams.WorkerKeepAliveTimeoutInSeconds + WorkerProcessCount = $testParams.WorkerProcessCount + WorkerTimeoutInSeconds = $testParams.WorkerTimeoutInSeconds + } + } -PassThru -Force return $($spServiceApp) } @@ -142,16 +142,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Context -Name "When service applications exist in the current farm but the specific PowerPoint Automation Services app does not" -Fixture { - $testParams = @{ - Name = "Power Point Automation Service Application" - ProxyName = "Power Point Automation Service Application Proxy" - ApplicationPool = "SharePoint Services App Pool" - CacheExpirationPeriodInSeconds = 600 - MaximumConversionsPerWorker = 5 + $testParams = @{ + Name = "Power Point Automation Service Application" + ProxyName = "Power Point Automation Service Application Proxy" + ApplicationPool = "SharePoint Services App Pool" + CacheExpirationPeriodInSeconds = 600 + MaximumConversionsPerWorker = 5 WorkerKeepAliveTimeoutInSeconds = 120 - WorkerProcessCount = 3 - WorkerTimeoutInSeconds = 300 - Ensure = "Present" + WorkerProcessCount = 3 + WorkerTimeoutInSeconds = 300 + Ensure = "Present" } @@ -162,28 +162,28 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName New-SPPowerPointConversionServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - ApplicationPool = @{ Name = $testParams.ApplicationPool } - CacheExpirationPeriodInSeconds = 0 - MaximumConversionsPerWorker = 0 + $spServiceApp = [PSCustomObject]@{ + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } + CacheExpirationPeriodInSeconds = 0 + MaximumConversionsPerWorker = 0 WorkerKeepAliveTimeoutInSeconds = 0 - WorkerProcessCount = 0 - WorkerTimeoutInSeconds = 0 + WorkerProcessCount = 0 + WorkerTimeoutInSeconds = 0 } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value { - return @{ - DisplayName = $testParams.Name - ApplicationPool = @{ Name = $testParams.ApplicationPool } - CacheExpirationPeriodInSeconds = $testParams.CacheExpirationPeriodInSeconds - MaximumConversionsPerWorker = $testParams.MaximumConversionsPerWorker - WorkerKeepAliveTimeoutInSeconds = $testParams.WorkerKeepAliveTimeoutInSeconds - WorkerProcessCount = $testParams.WorkerProcessCount - WorkerTimeoutInSeconds = $testParams.WorkerTimeoutInSeconds - } - } -PassThru -Force + -Name Update ` + -Value { + return @{ + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } + CacheExpirationPeriodInSeconds = $testParams.CacheExpirationPeriodInSeconds + MaximumConversionsPerWorker = $testParams.MaximumConversionsPerWorker + WorkerKeepAliveTimeoutInSeconds = $testParams.WorkerKeepAliveTimeoutInSeconds + WorkerProcessCount = $testParams.WorkerProcessCount + WorkerTimeoutInSeconds = $testParams.WorkerTimeoutInSeconds + } + } -PassThru -Force return $($spServiceApp) } @@ -192,16 +192,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - ApplicationPool = @{ Name = $testParams.ApplicationPool } - } + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } + } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "Microsoft.Office.UnKnownWebServiceApplication" - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + FullName = "Microsoft.Office.UnKnownWebServiceApplication" + } + } -PassThru -Force return $($spServiceApp) } @@ -220,29 +220,29 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Context -Name "When service applications should exist but the application pool doesn't exist" -Fixture { - $testParams = @{ - Name = "Power Point Automation Service Application" - ProxyName = "Power Point Automation Service Application Proxy" - ApplicationPool = "SharePoint Services App Pool" - CacheExpirationPeriodInSeconds = 600 - MaximumConversionsPerWorker = 5 + $testParams = @{ + Name = "Power Point Automation Service Application" + ProxyName = "Power Point Automation Service Application Proxy" + ApplicationPool = "SharePoint Services App Pool" + CacheExpirationPeriodInSeconds = 600 + MaximumConversionsPerWorker = 5 WorkerKeepAliveTimeoutInSeconds = 120 - WorkerProcessCount = 3 - WorkerTimeoutInSeconds = 300 - Ensure = "Present" + WorkerProcessCount = 3 + WorkerTimeoutInSeconds = 300 + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - } + DisplayName = $testParams.Name + } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "Microsoft.Office.UnKnownWebServiceApplication" - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + FullName = "Microsoft.Office.UnKnownWebServiceApplication" + } + } -PassThru -Force return $($spServiceApp) } @@ -257,46 +257,46 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Test-TargetResource @testParams | Should Be $false } It "Should create a new Power Point Automation Service Application from the Set method" { - { Set-TargetResource @testParams } | Should throw "Specified application pool does not exist" + { Set-TargetResource @testParams } | Should throw "Specified application pool does not exist" } } Context -Name "When a service application exists and is configured correctly" -Fixture { $testParams = @{ - Name = "Power Point Automation Service Application" - ProxyName = "Power Point Automation Service Application Proxy" - ApplicationPool = "SharePoint Services App Pool" - CacheExpirationPeriodInSeconds = 600 - MaximumConversionsPerWorker = 5 + Name = "Power Point Automation Service Application" + ProxyName = "Power Point Automation Service Application Proxy" + ApplicationPool = "SharePoint Services App Pool" + CacheExpirationPeriodInSeconds = 600 + MaximumConversionsPerWorker = 5 WorkerKeepAliveTimeoutInSeconds = 120 - WorkerProcessCount = 3 - WorkerTimeoutInSeconds = 300 - Ensure = "Present" + WorkerProcessCount = 3 + WorkerTimeoutInSeconds = 300 + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - ApplicationPool = @{ Name = $testParams.ApplicationPool } - CacheExpirationPeriodInSeconds = $testParams.CacheExpirationPeriodInSeconds - MaximumConversionsPerWorker = $testParams.MaximumConversionsPerWorker - WorkerKeepAliveTimeoutInSeconds = $testParams.WorkerKeepAliveTimeoutInSeconds - WorkerProcessCount = $testParams.WorkerProcessCount - WorkerTimeoutInSeconds = $testParams.WorkerTimeoutInSeconds + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } + CacheExpirationPeriodInSeconds = $testParams.CacheExpirationPeriodInSeconds + MaximumConversionsPerWorker = $testParams.MaximumConversionsPerWorker + WorkerKeepAliveTimeoutInSeconds = $testParams.WorkerKeepAliveTimeoutInSeconds + WorkerProcessCount = $testParams.WorkerProcessCount + WorkerTimeoutInSeconds = $testParams.WorkerTimeoutInSeconds } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = $getTypeFullName - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + FullName = $getTypeFullName + } + } -PassThru -Force $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name IsConnected ` - -Value { - return $true - } -PassThru -Force + -Name IsConnected ` + -Value { + return $true + } -PassThru -Force return $($spServiceApp) } @@ -318,58 +318,58 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists but has a new Proxy Assignment" -Fixture { $testParams = @{ - Name = "Power Point Automation Service Application" - ProxyName = "Power Point Automation Service Application Proxy" - ApplicationPool = "SharePoint Services App Pool" - CacheExpirationPeriodInSeconds = 600 - MaximumConversionsPerWorker = 5 + Name = "Power Point Automation Service Application" + ProxyName = "Power Point Automation Service Application Proxy" + ApplicationPool = "SharePoint Services App Pool" + CacheExpirationPeriodInSeconds = 600 + MaximumConversionsPerWorker = 5 WorkerKeepAliveTimeoutInSeconds = 120 - WorkerProcessCount = 3 - WorkerTimeoutInSeconds = 300 - Ensure = "Present" + WorkerProcessCount = 3 + WorkerTimeoutInSeconds = 300 + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - ApplicationPool = @{ Name = $testParams.ApplicationPool } - CacheExpirationPeriodInSeconds = $testParams.CacheExpirationPeriodInSeconds - MaximumConversionsPerWorker = $testParams.MaximumConversionsPerWorker + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } + CacheExpirationPeriodInSeconds = $testParams.CacheExpirationPeriodInSeconds + MaximumConversionsPerWorker = $testParams.MaximumConversionsPerWorker WorkerKeepAliveTimeoutInSeconds = $testParams.WorkerKeepAliveTimeoutInSeconds - WorkerProcessCount = $testParams.WorkerProcessCount - WorkerTimeoutInSeconds = $testParams.WorkerTimeoutInSeconds + WorkerProcessCount = $testParams.WorkerProcessCount + WorkerTimeoutInSeconds = $testParams.WorkerTimeoutInSeconds } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = $getTypeFullName - } - } -PassThru -Force - $spServiceApp = $spServiceApp | Add-Member -MemberType SCriptMethod ` - -Name IsConnected ` - -Value { - return $true - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + FullName = $getTypeFullName + } + } -PassThru -Force + $spServiceApp = $spServiceApp | Add-Member -MemberType SCriptMethod ` + -Name IsConnected ` + -Value { + return $true + } -PassThru -Force $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value { - return @{ - DisplayName = $testParams.Name - ApplicationPool = @{ Name = $testParams.ApplicationPool } - CacheExpirationPeriodInSeconds = $testParams.CacheExpirationPeriodInSeconds - MaximumConversionsPerWorker = $testParams.MaximumConversionsPerWorker - WorkerKeepAliveTimeoutInSeconds = $testParams.WorkerKeepAliveTimeoutInSeconds - WorkerProcessCount = $testParams.WorkerProcessCount - WorkerTimeoutInSeconds = $testParams.WorkerTimeoutInSeconds - } - } -PassThru -Force + -Name Update ` + -Value { + return @{ + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } + CacheExpirationPeriodInSeconds = $testParams.CacheExpirationPeriodInSeconds + MaximumConversionsPerWorker = $testParams.MaximumConversionsPerWorker + WorkerKeepAliveTimeoutInSeconds = $testParams.WorkerKeepAliveTimeoutInSeconds + WorkerProcessCount = $testParams.WorkerProcessCount + WorkerTimeoutInSeconds = $testParams.WorkerTimeoutInSeconds + } + } -PassThru -Force return $($spServiceApp) } - Mock -CommandName Get-SPServiceApplicationPool -MockWith { + Mock -CommandName Get-SPServiceApplicationPool -MockWith { return @{ Name = $testParams.ApplicationPool } @@ -381,11 +381,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $spServiceAppProxy = [PSCustomObject]@{ Name = "$($testParams.ProxyName) other" } - $spServiceAppProxy | Add-Member -MemberType SCriptMethod ` - -Name Delete ` - -Value { - return $null - } -PassThru -Force + $spServiceAppProxy | Add-Member -MemberType SCriptMethod ` + -Name Delete ` + -Value { + return $null + } -PassThru -Force return $spServiceAppProxy } @@ -405,29 +405,29 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists but has a new Application Pool Assignment" -Fixture { $testParams = @{ - Name = "Power Point Automation Service Application" - ProxyName = "Power Point Automation Service Application Proxy" - ApplicationPool = "SharePoint Services App Pool" - CacheExpirationPeriodInSeconds = 600 - MaximumConversionsPerWorker = 5 + Name = "Power Point Automation Service Application" + ProxyName = "Power Point Automation Service Application Proxy" + ApplicationPool = "SharePoint Services App Pool" + CacheExpirationPeriodInSeconds = 600 + MaximumConversionsPerWorker = 5 WorkerKeepAliveTimeoutInSeconds = 120 - WorkerProcessCount = 3 - WorkerTimeoutInSeconds = 300 - Ensure = "Present" + WorkerProcessCount = 3 + WorkerTimeoutInSeconds = 300 + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name + DisplayName = $testParams.Name ApplicationPool = @{ Name = "Other SharePoint Services App Pool" } } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = $getTypeFullName - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + FullName = $getTypeFullName + } + } -PassThru -Force return $spServiceApp } @@ -441,22 +441,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service application exists but it shouldn't" -Fixture { $testParams = @{ - Name = "Power Point Automation Service Application" + Name = "Power Point Automation Service Application" Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = $getTypeFullName - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + FullName = $getTypeFullName + } + } -PassThru -Force return $spServiceApp } @@ -476,7 +476,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service application doesn't exist and it shouldn't" -Fixture { $testParams = @{ - Name = "Power Point Automation Service Application" + Name = "Power Point Automation Service Application" Ensure = "Absent" } @@ -494,16 +494,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Context -Name "When a service application doesn't exists but it should" -Fixture { - $testParams = @{ - Name = "Power Point Automation Service Application" - ProxyName = "Power Point Automation Service Application Proxy" - ApplicationPool = "SharePoint Services App Pool" - CacheExpirationPeriodInSeconds = 600 - MaximumConversionsPerWorker = 5 + $testParams = @{ + Name = "Power Point Automation Service Application" + ProxyName = "Power Point Automation Service Application Proxy" + ApplicationPool = "SharePoint Services App Pool" + CacheExpirationPeriodInSeconds = 600 + MaximumConversionsPerWorker = 5 WorkerKeepAliveTimeoutInSeconds = 120 - WorkerProcessCount = 3 - WorkerTimeoutInSeconds = 300 - Ensure = "Present" + WorkerProcessCount = 3 + WorkerTimeoutInSeconds = 300 + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPAccessServiceApp.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPAccessServiceApp.Tests.ps1 index 486e44574..ef88a91a0 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPAccessServiceApp.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPAccessServiceApp.Tests.ps1 @@ -1,18 +1,18 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPAccessServiceApp" + -DscResource "SPAccessServiceApp" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -26,40 +26,40 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Set-SPAccessServicesApplication -MockWith { } Mock -CommandName Remove-SPServiceApplication -MockWith { } - try - { - [Microsoft.SharePoint.SPServiceContext] + try + { + [Microsoft.SharePoint.SPServiceContext] } - catch + catch { $CsharpCode2 = @" namespace Microsoft.SharePoint { - public enum SPSiteSubscriptionIdentifier { Default }; + public enum SPSiteSubscriptionIdentifier { Default }; public class SPServiceContext { public static string GetContext(System.Object[] serviceApplicationProxyGroup, SPSiteSubscriptionIdentifier siteSubscriptionId) { return ""; } } -} +} "@ Add-Type -TypeDefinition $CsharpCode2 } - # Test contexts + # Test contexts Context -Name "When no service applications exist in the current farm" -Fixture { $testParams = @{ - Name = "Test Access Services App" - DatabaseServer = "SQL.contoso.local" + Name = "Test Access Services App" + DatabaseServer = "SQL.contoso.local" ApplicationPool = "Test App Pool" } - Mock -CommandName Get-SPServiceApplication -MockWith { - return $null + Mock -CommandName Get-SPServiceApplication -MockWith { + return $null } - + It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return false when the Test method is called" { @@ -74,51 +74,51 @@ namespace Microsoft.SharePoint { Context -Name "When service applications exist in the current farm but the specific Access Services app does not" -Fixture { $testParams = @{ - Name = "Test Access Services App" - DatabaseServer = "SQL.contoso.local" + Name = "Test Access Services App" + DatabaseServer = "SQL.contoso.local" ApplicationPool = "Test App Pool" } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - } + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + DisplayName = $testParams.Name + } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "Microsoft.Office.UnKnownWebServiceApplication" - } - } -PassThru -Force - return $spServiceApp + -Name GetType ` + -Value { + return @{ + FullName = "Microsoft.Office.UnKnownWebServiceApplication" + } + } -PassThru -Force + return $spServiceApp } It "Should return null from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } } Context -Name "When a service application exists and is configured correctly" -Fixture { $testParams = @{ - Name = "Test Access Services App" - DatabaseServer = "SQL.contoso.local" + Name = "Test Access Services App" + DatabaseServer = "SQL.contoso.local" ApplicationPool = "Test App Pool" } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - TypeName = "Access Services Web Service Application" - DisplayName = $testParams.Name - DatabaseServer = $testParams.DatabaseServer + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + TypeName = "Access Services Web Service Application" + DisplayName = $testParams.Name + DatabaseServer = $testParams.DatabaseServer ApplicationPool = @{ Name = $testParams.ApplicationPool } } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = $getTypeFullName - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + FullName = $getTypeFullName + } + } -PassThru -Force return $spServiceApp } @@ -136,62 +136,62 @@ namespace Microsoft.SharePoint { Test-TargetResource @testParams | Should Be $true } } - + Context -Name "When the service application exists but it shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "-" - DatabaseServer = "-" - Ensure = "Absent" + DatabaseServer = "-" + Ensure = "Absent" } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - TypeName = "Access Services Web Service Application" - DisplayName = $testParams.Name - DatabaseServer = $testParams.DatabaseName + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + TypeName = "Access Services Web Service Application" + DisplayName = $testParams.Name + DatabaseServer = $testParams.DatabaseName ApplicationPool = @{ Name = $testParams.ApplicationPool } } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = $getTypeFullName - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + FullName = $getTypeFullName + } + } -PassThru -Force return $spServiceApp } - + It "Should return present from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Present" + (Get-TargetResource @testParams).Ensure | Should Be "Present" } - + It "Should return false when the Test method is called" { Test-TargetResource @testParams | Should Be $false } - + It "Should call the remove service application cmdlet in the set method" { Set-TargetResource @testParams Assert-MockCalled Remove-SPServiceApplication } } - + Context -Name "When the service application doesn't exist and it shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "-" - DatabaseServer = "-" - Ensure = "Absent" + DatabaseServer = "-" + Ensure = "Absent" } - Mock -CommandName Get-SPServiceApplication -MockWith { - return $null + Mock -CommandName Get-SPServiceApplication -MockWith { + return $null } - + It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - + It "Should return true when the Test method is called" { Test-TargetResource @testParams | Should Be $true } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPAccessServices2010.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPAccessServices2010.Tests.ps1 index 3f5931626..6b5615456 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPAccessServices2010.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPAccessServices2010.Tests.ps1 @@ -1,55 +1,55 @@ [CmdletBinding()] -param( +param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPAccessServices2010" + -DscResource "SPAccessServices2010" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - + # Initialize tests $getTypeFullName = "Microsoft.Office.Access.Server.MossHost.AccessServerWebServiceApplication" - + # Mocks for all contexts - Mock -CommandName Get-SPServiceApplication -MockWith {} - Mock -CommandName New-SPAccessServiceApplication -MockWith {} - Mock -CommandName Remove-SPServiceApplication -MockWith {} + Mock -CommandName Get-SPServiceApplication -MockWith { } + Mock -CommandName New-SPAccessServiceApplication -MockWith { } + Mock -CommandName Remove-SPServiceApplication -MockWith { } # Test contexts Context -Name "When Access 2010 Services doesn't exists and should exist" -Fixture { $testParams = @{ - Name = "Access 2010 Services Service Application" - ApplicationPool = "SharePoint Service Applications" - Ensure = "Present" + Name = "Access 2010 Services Service Application" + ApplicationPool = "SharePoint Service Applications" + Ensure = "Present" } - - Mock -CommandName Remove-SPServiceApplication -MockWith {} - Mock -CommandName New-SPAccessServiceApplication -MockWith {} + + Mock -CommandName Remove-SPServiceApplication -MockWith { } + Mock -CommandName New-SPAccessServiceApplication -MockWith { } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - } + DisplayName = $testParams.Name + } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "$($getTypeFullName).other" - } - } -PassThru -Force - return @($spServiceApp) - } - + -Name GetType ` + -Value { + return @{ + FullName = "$($getTypeFullName).other" + } + } -PassThru -Force + return @($spServiceApp) + } + It "Should return absent from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" } @@ -65,30 +65,30 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Context -Name "When Access 2010 Services exists and should exist" -Fixture { $testParams = @{ - Name = "Access 2010 Services Service Application" - ApplicationPool = "SharePoint Service Applications" - Ensure = "Present" + Name = "Access 2010 Services Service Application" + ApplicationPool = "SharePoint Service Applications" + Ensure = "Present" } - - Mock -CommandName Remove-SPServiceApplication -MockWith {} - Mock -CommandName New-SPAccessServiceApplication -MockWith {} + + Mock -CommandName Remove-SPServiceApplication -MockWith { } + Mock -CommandName New-SPAccessServiceApplication -MockWith { } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - ApplicationPool = [PSCustomObject]@{ - Name = $testParams.ApplicationPool - } - } + DisplayName = $testParams.Name + ApplicationPool = [PSCustomObject]@{ + Name = $testParams.ApplicationPool + } + } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "$($getTypeFullName)" - } - } -PassThru -Force - return @($spServiceApp) - } - + -Name GetType ` + -Value { + return @{ + FullName = "$($getTypeFullName)" + } + } -PassThru -Force + return @($spServiceApp) + } + It "Should return present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" } @@ -98,36 +98,36 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should call Remove - Get - New on Set-TargetResource" { Set-TargetResource @testParams Assert-MockCalled Get-SPServiceApplication - + } } Context -Name "When Access 2010 Services exists and shouldn't exist" -Fixture { $testParams = @{ - Name = "Access 2010 Services Service Application" - ApplicationPool = "SharePoint Service Applications" - Ensure = "Absent" + Name = "Access 2010 Services Service Application" + ApplicationPool = "SharePoint Service Applications" + Ensure = "Absent" } - - Mock -CommandName Remove-SPServiceApplication -MockWith {} - Mock -CommandName New-SPAccessServiceApplication -MockWith {} + + Mock -CommandName Remove-SPServiceApplication -MockWith { } + Mock -CommandName New-SPAccessServiceApplication -MockWith { } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - ApplicationPool = [PSCustomObject]@{ - Name = $testParams.ApplicationPool - } - } + DisplayName = $testParams.Name + ApplicationPool = [PSCustomObject]@{ + Name = $testParams.ApplicationPool + } + } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "$($getTypeFullName)" - } - } -PassThru -Force - return @($spServiceApp) - } - + -Name GetType ` + -Value { + return @{ + FullName = "$($getTypeFullName)" + } + } -PassThru -Force + return @($spServiceApp) + } + It "Should return present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" } @@ -143,17 +143,17 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When Access 2010 Services doesn't exists and should exist" -Fixture { $testParams = @{ - Name = "Access 2010 Services Service Application" - ApplicationPool = "SharePoint Service Applications" - Ensure = "Present" + Name = "Access 2010 Services Service Application" + ApplicationPool = "SharePoint Service Applications" + Ensure = "Present" } - - Mock -CommandName Remove-SPServiceApplication -MockWith {} - Mock -CommandName New-SPAccessServiceApplication -MockWith {} + + Mock -CommandName Remove-SPServiceApplication -MockWith { } + Mock -CommandName New-SPAccessServiceApplication -MockWith { } Mock -CommandName Get-SPServiceApplication -MockWith { return $null } - + It "Should return absent from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" } @@ -162,23 +162,23 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should call New on Set-TargetResource" { Set-TargetResource @testParams - Assert-MockCalled New-SPAccessServiceApplication + Assert-MockCalled New-SPAccessServiceApplication } } - + Context -Name "When Access 2010 Services doesn't exists and shouldn't exist" -Fixture { $testParams = @{ - Name = "Access 2010 Services Service Application" - ApplicationPool = "SharePoint Service Applications" - Ensure = "Absent" + Name = "Access 2010 Services Service Application" + ApplicationPool = "SharePoint Service Applications" + Ensure = "Absent" } - - Mock -CommandName Remove-SPServiceApplication -MockWith {} - Mock -CommandName New-SPAccessServiceApplication -MockWith {} + + Mock -CommandName Remove-SPServiceApplication -MockWith { } + Mock -CommandName New-SPAccessServiceApplication -MockWith { } Mock -CommandName Get-SPServiceApplication -MockWith { return $null } - + It "Should return absent from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" } @@ -187,11 +187,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should call New on Set-TargetResource" { Set-TargetResource @testParams - Assert-MockCalled Get-SPServiceApplication + Assert-MockCalled Get-SPServiceApplication } } - } + } } - - + + Invoke-Command -ScriptBlock $Global:SPDscHelper.CleanupScript -NoNewScope diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPAlternateUrl.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPAlternateUrl.Tests.ps1 index d11e4f166..ea16bd5aa 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPAlternateUrl.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPAlternateUrl.Tests.ps1 @@ -3,34 +3,34 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPAlternateUrl" + -DscResource "SPAlternateUrl" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope # Mocks for all contexts - Mock -CommandName New-SPAlternateURL {} - Mock -CommandName Set-SPAlternateURL {} - Mock -CommandName Remove-SPAlternateURL {} + Mock -CommandName New-SPAlternateURL { } + Mock -CommandName Set-SPAlternateURL { } + Mock -CommandName Remove-SPAlternateURL { } # Test contexts Context -Name "Specified web application does not exist" -Fixture { $testParams = @{ WebAppName = "SharePoint - www.domain.com80" - Zone = "Internet" - Url = "http://something.contoso.local" - Internal = $false - Ensure = "Present" + Zone = "Internet" + Url = "http://something.contoso.local" + Internal = $false + Ensure = "Present" } Mock -CommandName Get-SPAlternateUrl -MockWith { @@ -40,9 +40,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPAlternateUrl -MockWith { return @( @{ - PublicUrl = "http://www.contoso.local" + PublicUrl = "http://www.contoso.local" IncomingUrl = "http://www.contoso.local" - Zone = "Default" + Zone = "Default" } ) } -ParameterFilter { $WebApplication.DisplayName -eq $testParams.WebAppName } @@ -59,10 +59,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "No internal alternate URL exists for the specified zone and web app, and there should be" -Fixture { $testParams = @{ WebAppName = "SharePoint - www.domain.com80" - Zone = "Internet" - Url = "http://something.contoso.local" - Internal = $true - Ensure = "Present" + Zone = "Internet" + Url = "http://something.contoso.local" + Internal = $true + Ensure = "Present" } Mock -CommandName Get-SPAlternateUrl -MockWith { @@ -72,9 +72,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPAlternateUrl -MockWith { return @( @{ - PublicUrl = "http://www.domain.com" + PublicUrl = "http://www.domain.com" IncomingUrl = "http://www.domain.com" - Zone = "Default" + Zone = "Default" } ) } -ParameterFilter { $WebApplication.DisplayName -eq $testParams.WebAppName } @@ -102,10 +102,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "No internal alternate URL exists for the specified zone and web app, and there should be" -Fixture { $testParams = @{ WebAppName = "SharePoint - www.domain.com80" - Zone = "Internet" - Url = "http://something.contoso.local" - Internal = $true - Ensure = "Present" + Zone = "Internet" + Url = "http://something.contoso.local" + Internal = $true + Ensure = "Present" } Mock -CommandName Get-SPAlternateUrl -MockWith { @@ -139,18 +139,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The internal alternate URL exists for the specified zone and web app, and should be" -Fixture { $testParams = @{ WebAppName = "SharePoint - www.domain.com80" - Zone = "Internet" - Url = "http://something.contoso.local" - Internal = $true - Ensure = "Present" + Zone = "Internet" + Url = "http://something.contoso.local" + Internal = $true + Ensure = "Present" } Mock -CommandName Get-SPAlternateUrl -MockWith { return @( @{ - PublicUrl = "http://www.domain.com" + PublicUrl = "http://www.domain.com" IncomingUrl = "http://something.contoso.local" - Zone = "Internet" + Zone = "Internet" } ) } -ParameterFilter { $Identity -eq $testParams.Url } @@ -158,9 +158,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPAlternateUrl -MockWith { return @( @{ - PublicUrl = "http://www.domain.com" + PublicUrl = "http://www.domain.com" IncomingUrl = "http://something.contoso.local" - Zone = "Default" + Zone = "Default" } ) } -ParameterFilter { $WebApplication.DisplayName -eq $testParams.WebAppName } @@ -183,18 +183,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The internal alternate URL exists on another zone and web app (New zone)" -Fixture { $testParams = @{ WebAppName = "SharePoint - www.domain.com80" - Zone = "Internet" - Url = "http://something.contoso.local" - Internal = $true - Ensure = "Present" + Zone = "Internet" + Url = "http://something.contoso.local" + Internal = $true + Ensure = "Present" } Mock -CommandName Get-SPAlternateUrl -MockWith { return @( @{ - PublicUrl = "http://www.otherdomain.com" + PublicUrl = "http://www.otherdomain.com" IncomingUrl = "http://something.contoso.local" - Zone = "Default" + Zone = "Default" } ) } -ParameterFilter { $Identity -eq $testParams.Url } @@ -225,18 +225,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The internal alternate URL exists on another zone and web app (Existing zone)" -Fixture { $testParams = @{ WebAppName = "SharePoint - www.domain.com80" - Zone = "Internet" - Url = "http://something.contoso.local" - Internal = $true - Ensure = "Present" + Zone = "Internet" + Url = "http://something.contoso.local" + Internal = $true + Ensure = "Present" } Mock -CommandName Get-SPAlternateUrl -MockWith { return @( @{ - PublicUrl = "http://www.otherdomain.com" + PublicUrl = "http://www.otherdomain.com" IncomingUrl = "http://something.contoso.local" - Zone = "Default" + Zone = "Default" } ) } -ParameterFilter { $Identity -eq $testParams.Url } @@ -244,9 +244,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPAlternateUrl -MockWith { return @( @{ - PublicUrl = "http://www.domain.com" + PublicUrl = "http://www.domain.com" IncomingUrl = "http://www.domain.com" - Zone = "Internet" + Zone = "Internet" } ) } -ParameterFilter { $WebApplication.DisplayName -eq $testParams.WebAppName } @@ -273,18 +273,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "An internal URL exists for the specified zone and web app, and it should not" -Fixture { $testParams = @{ WebAppName = "SharePoint - www.domain.com80" - Zone = "Default" - Url = "http://something.contoso.local" - Internal = $true - Ensure = "Absent" + Zone = "Default" + Url = "http://something.contoso.local" + Internal = $true + Ensure = "Absent" } Mock -CommandName Get-SPAlternateUrl -MockWith { return @( @{ - PublicUrl = "http://www.domain.com" + PublicUrl = "http://www.domain.com" IncomingUrl = "http://something.contoso.local" - Zone = "Default" + Zone = "Default" } ) } -ParameterFilter { $Identity -eq $testParams.Url } @@ -292,14 +292,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPAlternateUrl -MockWith { return @( @{ - PublicUrl = "http://www.domain.com" + PublicUrl = "http://www.domain.com" IncomingUrl = "http://www.domain.com" - Zone = "Default" + Zone = "Default" }, @{ - PublicUrl = "http://www.domain.com" + PublicUrl = "http://www.domain.com" IncomingUrl = "http://something.contoso.local" - Zone = "Default" + Zone = "Default" } ) } -ParameterFilter { $WebApplication.DisplayName -eq $testParams.WebAppName } @@ -327,10 +327,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The URL for the specified zone and web app is incorrect, this must be changed" -Fixture { $testParams = @{ WebAppName = "SharePoint - www.domain.com80" - Zone = "Default" - Url = "http://www.newdomain.com" - Internal = $false - Ensure = "Present" + Zone = "Default" + Url = "http://www.newdomain.com" + Internal = $false + Ensure = "Present" } Mock -CommandName Get-SPAlternateUrl -MockWith { @@ -340,9 +340,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPAlternateUrl -MockWith { return @( @{ - PublicUrl = "http://www.domain.com" + PublicUrl = "http://www.domain.com" IncomingUrl = "http://www.domain.com" - Zone = "Default" + Zone = "Default" } ) } -ParameterFilter { $WebApplication.DisplayName -eq $testParams.WebAppName } @@ -370,18 +370,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The URL for the specified zone and web app exists as internal url, this must be changed" -Fixture { $testParams = @{ WebAppName = "SharePoint - www.domain.com80" - Zone = "Default" - Url = "http://www.newdomain.com" - Internal = $false - Ensure = "Present" + Zone = "Default" + Url = "http://www.newdomain.com" + Internal = $false + Ensure = "Present" } Mock -CommandName Get-SPAlternateUrl -MockWith { return @( @{ - PublicUrl = "http://www.domain.com" + PublicUrl = "http://www.domain.com" IncomingUrl = "http://www.newdomain.com" - Zone = "Default" + Zone = "Default" } ) } -ParameterFilter { $Identity -eq $testParams.Url } @@ -389,14 +389,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPAlternateUrl -MockWith { return @( @{ - PublicUrl = "http://www.domain.com" + PublicUrl = "http://www.domain.com" IncomingUrl = "http://www.domain.com" - Zone = "Default" + Zone = "Default" }, @{ - PublicUrl = "http://www.domain.com" + PublicUrl = "http://www.domain.com" IncomingUrl = "http://www.newdomain.com" - Zone = "Default" + Zone = "Default" } ) } -ParameterFilter { $WebApplication.DisplayName -eq $testParams.WebAppName } @@ -424,18 +424,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The URL for the specified zone and web app is correct, and should be" -Fixture { $testParams = @{ WebAppName = "SharePoint - www.domain.com80" - Zone = "Default" - Url = "http://www.domain.com" - Internal = $false - Ensure = "Present" + Zone = "Default" + Url = "http://www.domain.com" + Internal = $false + Ensure = "Present" } Mock -CommandName Get-SPAlternateUrl -MockWith { return @( @{ - PublicUrl = "http://www.domain.com" + PublicUrl = "http://www.domain.com" IncomingUrl = "http://www.domain.com" - Zone = "Default" + Zone = "Default" } ) } -ParameterFilter { $Identity -eq $testParams.Url } @@ -443,9 +443,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPAlternateUrl -MockWith { return @( @{ - PublicUrl = "http://www.domain.com" + PublicUrl = "http://www.domain.com" IncomingUrl = "http://www.domain.com" - Zone = "Default" + Zone = "Default" } ) } -ParameterFilter { $WebApplication.DisplayName -eq $testParams.WebAppName } @@ -468,18 +468,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A URL exists for the specified zone and web app, and it should not" -Fixture { $testParams = @{ WebAppName = "SharePoint - www.domain.com80" - Zone = "Internet" - Url = "http://www.domain.com" - Internal = $false - Ensure = "Absent" + Zone = "Internet" + Url = "http://www.domain.com" + Internal = $false + Ensure = "Absent" } Mock -CommandName Get-SPAlternateUrl -MockWith { return @( @{ - PublicUrl = "http://www.domain.com" + PublicUrl = "http://www.domain.com" IncomingUrl = "http://www.domain.com" - Zone = "Internet" + Zone = "Internet" } ) } -ParameterFilter { $Identity -eq $testParams.Url } @@ -487,9 +487,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPAlternateUrl -MockWith { return @( @{ - PublicUrl = "http://www.domain.com" + PublicUrl = "http://www.domain.com" IncomingUrl = "http://www.domain.com" - Zone = "Default" + Zone = "Default" } ) } -ParameterFilter { $WebApplication.DisplayName -eq $testParams.WebAppName } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPAntivirusSettings.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPAntivirusSettings.Tests.ps1 index c241c777d..a512c280d 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPAntivirusSettings.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPAntivirusSettings.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPAntivirusSettings" + -DscResource "SPAntivirusSettings" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -82,7 +82,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } -PassThru return $returnVal } - Mock -CommandName Get-SPFarm -MockWith { return @{} } + Mock -CommandName Get-SPFarm -MockWith { return @{ } } It "Should return values from the get method" { Get-TargetResource @testParams | Should Not BeNullOrEmpty @@ -125,7 +125,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } return $returnVal } - Mock -CommandName Get-SPFarm -MockWith { return @{} } + Mock -CommandName Get-SPFarm -MockWith { return @{ } } It "Should return values from the get method" { Get-TargetResource @testParams | Should Not BeNullOrEmpty diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPAppCatalog.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPAppCatalog.Tests.ps1 index 80f749b3c..5e77dbffc 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPAppCatalog.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPAppCatalog.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPAppCatalog" + -DscResource "SPAppCatalog" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -22,9 +22,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force $mockCredential = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList @("$($Env:USERDOMAIN)\$($Env:USERNAME)", $mockPassword) + -ArgumentList @("$($Env:USERDOMAIN)\$($Env:USERNAME)", $mockPassword) $mockFarmCredential = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList @("DOMAIN\sp_farm", $mockPassword) + -ArgumentList @("DOMAIN\sp_farm", $mockPassword) # Mocks for all contexts Mock -CommandName Get-SPDscFarmAccount -MockWith { @@ -33,7 +33,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Add-SPDscUserToLocalAdmin -MockWith { } Mock -CommandName Test-SPDscUserIsLocalAdmin -MockWith { return $false } Mock -CommandName Remove-SPDscUserToLocalAdmin -MockWith { } - Mock -CommandName Restart-Service {} + Mock -CommandName Restart-Service { } # Test contexts Context -Name "The PsDscRunAsCredential is the Farm account" -Fixture { @@ -41,17 +41,17 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SiteUrl = "https://content.sharepoint.contoso.com/sites/AppCatalog" } - Mock -CommandName Update-SPAppCatalogConfiguration -MockWith {} + Mock -CommandName Update-SPAppCatalogConfiguration -MockWith { } Mock -CommandName Get-SPSite -MockWith { return @{ WebApplication = @{ - Features = @( @{} ) | Add-Member -MemberType ScriptMethod ` - -Name "Item" ` - -Value { return $null } ` - -PassThru ` - -Force + Features = @( @{ } ) | Add-Member -MemberType ScriptMethod ` + -Name "Item" ` + -Value { return $null } ` + -PassThru ` + -Force } - ID = $mockSiteId + ID = $mockSiteId } } Mock -CommandName Get-SPDscFarmAccount -MockWith { @@ -72,13 +72,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPSite -MockWith { return @{ WebApplication = @{ - Features = @( @{} ) | Add-Member -MemberType ScriptMethod ` - -Name "Item" ` - -Value { return $null } ` - -PassThru ` - -Force + Features = @( @{ } ) | Add-Member -MemberType ScriptMethod ` + -Name "Item" ` + -Value { return $null } ` + -PassThru ` + -Force } - ID = $mockSiteId + ID = $mockSiteId } } @@ -104,13 +104,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPSite -MockWith { return @{ WebApplication = @{ - Features = @( @{} ) | Add-Member -MemberType ScriptMethod ` - -Name "Item" ` - -Value { return $null } ` - -PassThru ` - -Force + Features = @( @{ } ) | Add-Member -MemberType ScriptMethod ` + -Name "Item" ` + -Value { return $null } ` + -PassThru ` + -Force } - ID = $mockSiteId + ID = $mockSiteId } } @@ -137,21 +137,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPSite -MockWith { return @{ WebApplication = @{ - Features = @( @{} ) | Add-Member -MemberType ScriptMethod ` - -Name "Item" ` - -Value { - return @{ - ID = [guid]::NewGuid() - Properties = @{ - "__AppCatSiteId" = @{Value = $mockSiteId} - } - } - } ` - -PassThru ` - -Force + Features = @( @{ } ) | Add-Member -MemberType ScriptMethod ` + -Name "Item" ` + -Value { + return @{ + ID = [guid]::NewGuid() + Properties = @{ + "__AppCatSiteId" = @{Value = $mockSiteId } + } + } + } ` + -PassThru ` + -Force } - ID = $mockSiteId - Url = $testParams.SiteUrl + ID = $mockSiteId + Url = $testParams.SiteUrl } } @@ -176,13 +176,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPSite -MockWith { return @{ WebApplication = @{ - Features = @( @{} ) | Add-Member -MemberType ScriptMethod ` - -Name "Item" ` - -Value { return $null } ` - -PassThru ` - -Force + Features = @( @{ } ) | Add-Member -MemberType ScriptMethod ` + -Name "Item" ` + -Value { return $null } ` + -PassThru ` + -Force } - ID = $mockSiteId + ID = $mockSiteId } } @@ -196,9 +196,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should throw an exception in the set method" { { Set-TargetResource @testParams } | Should throw ` - ("This resource must be run as the farm account (not a setup account). " + ` - "Please ensure either the PsDscRunAsCredential or InstallAccount " + ` - "credentials are set to the farm account and run this resource again") + ("This resource must be run as the farm account (not a setup account). " + ` + "Please ensure either the PsDscRunAsCredential or InstallAccount " + ` + "credentials are set to the farm account and run this resource again") } } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPAppDomain.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPAppDomain.Tests.ps1 index 5eba23823..8fa97d400 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPAppDomain.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPAppDomain.Tests.ps1 @@ -1,36 +1,36 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPAppDomain" + -DscResource "SPAppDomain" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope # Mocks for all contexts - Mock -CommandName Set-SPAppDomain -MockWith {} - Mock -CommandName Set-SPAppSiteSubscriptionName -MockWith {} + Mock -CommandName Set-SPAppDomain -MockWith { } + Mock -CommandName Set-SPAppSiteSubscriptionName -MockWith { } - # Test contexts + # Test contexts Context -Name "No app URLs have been configured locally" -Fixture { $testParams = @{ AppDomain = "apps.contoso.com" - Prefix = "apps" + Prefix = "apps" } Mock -CommandName Get-SPAppDomain -MockWith { } - Mock -CommandName Get-SPAppSiteSubscriptionName -MockWith { } + Mock -CommandName Get-SPAppSiteSubscriptionName -MockWith { } It "Should return values from the get method" { Get-TargetResource @testParams | Should Not BeNullOrEmpty @@ -43,18 +43,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should save settings when the set method is run" { Set-TargetResource @testParams Assert-MockCalled Set-SPAppDomain - Assert-MockCalled Set-SPAppSiteSubscriptionName + Assert-MockCalled Set-SPAppSiteSubscriptionName } } Context -Name "Incorrect app URLs have been configured locally" -Fixture { $testParams = @{ AppDomain = "apps.contoso.com" - Prefix = "apps" + Prefix = "apps" } - + Mock -CommandName Get-SPAppDomain -MockWith { return "wrong.domain" } - Mock -CommandName Get-SPAppSiteSubscriptionName -MockWith { return "wrongprefix" } + Mock -CommandName Get-SPAppSiteSubscriptionName -MockWith { return "wrongprefix" } It "Should return values from the get method" { Get-TargetResource @testParams | Should Not BeNullOrEmpty @@ -67,18 +67,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should save settings when the set method is run" { Set-TargetResource @testParams Assert-MockCalled Set-SPAppDomain - Assert-MockCalled Set-SPAppSiteSubscriptionName + Assert-MockCalled Set-SPAppSiteSubscriptionName } } Context -Name "Correct app URLs have been configured locally" -Fixture { $testParams = @{ AppDomain = "apps.contoso.com" - Prefix = "apps" + Prefix = "apps" } - + Mock -CommandName Get-SPAppDomain -MockWith { return $testParams.AppDomain } - Mock -CommandName Get-SPAppSiteSubscriptionName -MockWith { $testParams.Prefix } + Mock -CommandName Get-SPAppSiteSubscriptionName -MockWith { $testParams.Prefix } It "Should return values from the get method" { Get-TargetResource @testParams | Should Not BeNullOrEmpty diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPAppManagementServiceApp.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPAppManagementServiceApp.Tests.ps1 index fa2be5146..f50db49cd 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPAppManagementServiceApp.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPAppManagementServiceApp.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPAppManagementServiceApp" + -DscResource "SPAppManagementServiceApp" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -22,20 +22,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $getTypeFullName = "Microsoft.SharePoint.AppManagement.AppManagementServiceApplication" # Mocks for all contexts - Mock -CommandName Remove-SPServiceApplication -MockWith {} + Mock -CommandName Remove-SPServiceApplication -MockWith { } # Test contexts Context -Name "When no service applications exist in the current farm but it should" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "Test App Pool" - DatabaseName = "Test_DB" - Ensure = "Present" - DatabaseServer = "TestServer\Instance" + DatabaseName = "Test_DB" + Ensure = "Present" + DatabaseServer = "TestServer\Instance" } Mock -CommandName Get-SPServiceApplication -MockWith { return $null } - Mock -CommandName New-SPAppManagementServiceApplication -MockWith { return @(@{})} + Mock -CommandName New-SPAppManagementServiceApplication -MockWith { return @(@{ }) } Mock -CommandName New-SPAppManagementServiceApplicationProxy -MockWith { return $null } It "Should return absent from the get method" { @@ -55,24 +55,24 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When service applications exist in the current farm with the same name but is the wrong type" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "Test App Pool" - DatabaseName = "Test_DB" - Ensure = "Present" - DatabaseServer = "TestServer\Instance" + DatabaseName = "Test_DB" + Ensure = "Present" + DatabaseServer = "TestServer\Instance" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - } + DisplayName = $testParams.Name + } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "Microsoft.Office.UnKnownWebServiceApplication" - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + FullName = "Microsoft.Office.UnKnownWebServiceApplication" + } + } -PassThru -Force return $spServiceApp } @@ -85,20 +85,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and it should, and is also configured correctly" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "Test App Pool" - DatabaseName = "Test_DB" - Ensure = "Present" - DatabaseServer = "TestServer\Instance" + DatabaseName = "Test_DB" + Ensure = "Present" + DatabaseServer = "TestServer\Instance" } Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - TypeName = "App Management Service Application" - DisplayName = $testParams.Name + $spServiceApp = [PSCustomObject]@{ + TypeName = "App Management Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -114,13 +114,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPServiceApplicationProxy -MockWith { $proxiesToReturn = @() $proxy = @{ - Name = "AppManagement Proxy" + Name = "AppManagement Proxy" DisplayName = "AppManagement Proxy" } $proxy = $proxy | Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value {} ` - -PassThru + -Name Delete ` + -Value { } ` + -PassThru $proxiesToReturn += $proxy return $proxiesToReturn @@ -138,20 +138,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and it should, but the app pool is not configured correctly" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "Test App Pool" - DatabaseName = "Test_DB" - Ensure = "Present" - DatabaseServer = "TestServer\Instance" + DatabaseName = "Test_DB" + Ensure = "Present" + DatabaseServer = "TestServer\Instance" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "App Management Service Application" - DisplayName = $testParams.Name + TypeName = "App Management Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = "Wrong app pool" } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -181,20 +181,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and it should, but no proxy exists" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "Test App Pool" - DatabaseName = "Test_DB" - Ensure = "Present" - DatabaseServer = "TestServer\Instance" + DatabaseName = "Test_DB" + Ensure = "Present" + DatabaseServer = "TestServer\Instance" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "App Management Service Application" - DisplayName = $testParams.Name + TypeName = "App Management Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -230,13 +230,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service app needs to be created and no database paramsters are provided" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "Test App Pool" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { return $null } - Mock -CommandName New-SPAppManagementServiceApplication -MockWith { return @(@{})} + Mock -CommandName New-SPAppManagementServiceApplication -MockWith { return @(@{ }) } Mock -CommandName New-SPAppManagementServiceApplicationProxy -MockWith { return $null } It "Should not throw an exception in the set method" { @@ -247,18 +247,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service application exists but it shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "-" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "App Management Service Application" - DisplayName = $testParams.Name + TypeName = "App Management Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -284,9 +284,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the serivce application doesn't exist and it shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "-" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication -MockWith { return $null } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPAppStoreSettings.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPAppStoreSettings.Tests.ps1 index e322feadc..0a3367479 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPAppStoreSettings.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPAppStoreSettings.Tests.ps1 @@ -1,28 +1,28 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPAppStoreSettings" + -DscResource "SPAppStoreSettings" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope # Initialize tests - - # Mocks for all contexts - Mock -CommandName Set-SPAppAcquisitionConfiguration -MockWith {} - Mock -CommandName Set-SPOfficeStoreAppsDefaultActivation -MockWith {} + + # Mocks for all contexts + Mock -CommandName Set-SPAppAcquisitionConfiguration -MockWith { } + Mock -CommandName Set-SPOfficeStoreAppsDefaultActivation -MockWith { } # Test contexts Context -Name "The specified web application does not exist" -Fixture { @@ -74,7 +74,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should return values from the get method" { - $result = Get-TargetResource @testParams + $result = Get-TargetResource @testParams $result.AllowAppPurchases | Should Be $false $result.AllowAppsForOffice | Should Be $false } @@ -89,7 +89,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Assert-MockCalled Set-SPOfficeStoreAppsDefaultActivation } } - + Context -Name "The specified settings match" -Fixture { $testParams = @{ WebAppUrl = "https://sharepoint.contoso.com" @@ -127,8 +127,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The specified setting does not match" -Fixture { $testParams = @{ - WebAppUrl = "https://sharepoint.contoso.com" - AllowAppPurchases = $true + WebAppUrl = "https://sharepoint.contoso.com" + AllowAppPurchases = $true } Mock -CommandName Get-SPAppAcquisitionConfiguration -MockWith { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPAuthenticationRealm.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPAuthenticationRealm.Tests.ps1 index a78c67301..c748f6296 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPAuthenticationRealm.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPAuthenticationRealm.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPAuthenticationRealm" + -DscResource "SPAuthenticationRealm" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -29,7 +29,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Authentication realm matches the farm's current atuhentication realm" -Fixture { $Global:SPAuthenticationRealm = "14757a87-4d74-4323-83b9-fb1e77e8f22f" $testParams = @{ - IsSingleInstance = "Yes" + IsSingleInstance = "Yes" AuthenticationRealm = $Global:SPAuthenticationRealm } @@ -42,7 +42,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $Global:SPAuthenticationRealm = "11111111-1111-1111-1111-111111111111" $testParams = @{ - IsSingleInstance = "Yes" + IsSingleInstance = "Yes" AuthenticationRealm = "14757a87-4d74-4323-83b9-fb1e77e8f22f" } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPBCSServiceApp.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPBCSServiceApp.Tests.ps1 index 1fc7dccd5..c89b4b023 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPBCSServiceApp.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPBCSServiceApp.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPBCSServiceApp" + -DscResource "SPBCSServiceApp" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -27,12 +27,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Test contexts Context -Name "When no service applications exist in the current farm and it should" -Fixture { $testParams = @{ - Name = "Test App" - ProxyName = "TestApp Proxy" + Name = "Test App" + ProxyName = "TestApp Proxy" ApplicationPool = "Test App Pool" - DatabaseName = "Test_DB" - DatabaseServer = "TestServer\Instance" - Ensure = "Present" + DatabaseName = "Test_DB" + DatabaseServer = "TestServer\Instance" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { return $null } @@ -41,9 +41,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Name = "ServiceApp" } $returnVal = $returnVal | Add-Member -MemberType ScriptMethod ` - -Name IsConnected -Value { - return $true - } -PassThru + -Name IsConnected -Value { + return $true + } -PassThru return $returnVal } @@ -51,13 +51,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPServiceApplicationProxy -MockWith { $proxiesToReturn = @() $proxy = @{ - Name = $testParams.ProxyName + Name = $testParams.ProxyName DisplayName = $testParams.ProxyName } $proxy = $proxy | Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value {} ` - -PassThru + -Name Delete ` + -Value { } ` + -PassThru $proxiesToReturn += $proxy return $proxiesToReturn @@ -80,9 +80,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When Ensure=Present but DatabaseName isn't specified" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "Test App Pool" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { return $null } @@ -95,24 +95,24 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When service applications exist in the current farm with the same name but is the wrong type" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "Test App Pool" - DatabaseName = "Test_DB" - DatabaseServer = "TestServer\Instance" - Ensure = "Present" + DatabaseName = "Test_DB" + DatabaseServer = "TestServer\Instance" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - } + DisplayName = $testParams.Name + } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "Microsoft.Office.UnKnownWebServiceApplication" - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + FullName = "Microsoft.Office.UnKnownWebServiceApplication" + } + } -PassThru -Force return $spServiceApp } @@ -124,21 +124,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and it should, and is also configured correctly" -Fixture { $testParams = @{ - Name = "Test App" - ProxyName = "TestApp Proxy" + Name = "Test App" + ProxyName = "TestApp Proxy" ApplicationPool = "Test App Pool" - DatabaseName = "Test_DB" - DatabaseServer = "TestServer\Instance" - Ensure = "Present" + DatabaseName = "Test_DB" + DatabaseServer = "TestServer\Instance" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Business Data Connectivity Service Application" - DisplayName = $testParams.Name + TypeName = "Business Data Connectivity Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -153,13 +153,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPServiceApplicationProxy -MockWith { $proxiesToReturn = @() $proxy = @{ - Name = $testParams.ProxyName + Name = $testParams.ProxyName DisplayName = $testParams.ProxyName } $proxy = $proxy | Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value {} ` - -PassThru + -Name Delete ` + -Value { } ` + -PassThru $proxiesToReturn += $proxy return $proxiesToReturn @@ -177,20 +177,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and it should, but the app pool is not configured correctly" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "Test App Pool" - DatabaseName = "Test_DB" - DatabaseServer = "TestServer\Instance" - Ensure = "Present" + DatabaseName = "Test_DB" + DatabaseServer = "TestServer\Instance" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Business Data Connectivity Service Application" - DisplayName = $testParams.Name + TypeName = "Business Data Connectivity Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = "Wrong App Pool Name" } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -216,18 +216,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service application exists but it shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "-" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Business Data Connectivity Service Application" - DisplayName = $testParams.Name + TypeName = "Business Data Connectivity Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -253,9 +253,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the serivce application doesn't exist and it shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "-" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication -MockWith { return $null } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPBlobCacheSettings.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPBlobCacheSettings.Tests.ps1 index 26b727ae0..c5287a54f 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPBlobCacheSettings.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPBlobCacheSettings.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPBlobCacheSettings" + -DscResource "SPBlobCacheSettings" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -41,34 +41,34 @@ namespace Microsoft.SharePoint.Administration { # Mocks for all contexts Mock -CommandName Get-SPWebApplication -MockWith { return @{ - IISSettings = @(@{ - Path = $Global:SPDscWebConfigRealPath - }) + IISSettings = @(@{ + Path = $Global:SPDscWebConfigRealPath + }) } } Mock -CommandName Get-SPServiceInstance -MockWith { return @( @{ - Name = "" + Name = "" TypeName = "Microsoft SharePoint Foundation Web Application" } | Add-Member -MemberType ScriptMethod ` -Name GetType ` -Value { - return @{ - Name = "SPWebServiceInstance" - } - } -PassThru -Force | Add-Member -Name Name ` - -MemberType ScriptProperty ` - -PassThru ` - { - # get - "" - }` - { - # set - param ( $arg ) - } + return @{ + Name = "SPWebServiceInstance" + } + } -PassThru -Force | Add-Member -Name Name ` + -MemberType ScriptProperty ` + -PassThru ` + { + # get + "" + }` + { + # set + param ( $arg ) + } ) } @@ -91,7 +91,7 @@ namespace Microsoft.SharePoint.Administration { Zone = "Default" EnableCache = $true Location = "c:\BlobCache" - MaxSizeInGB = 30 + MaxSizeInGB = 30 FileTypes = "\.(gif|jpg|jpeg)$" } @@ -130,14 +130,14 @@ namespace Microsoft.SharePoint.Administration { Mock -CommandName Test-Path -MockWith { return $true } - Mock -CommandName Copy-Item -MockWith {} + Mock -CommandName Copy-Item -MockWith { } It "Should return 0 from the get method" { (Get-TargetResource @testParams).MaxSizeInGB | Should Be 0 } It "Should return false from the test method" { - Test-TargetResource @testParams | Should Be $false + Test-TargetResource @testParams | Should Be $false } It "Should return MaxSize 30 in web.config from the set method" { @@ -153,7 +153,7 @@ namespace Microsoft.SharePoint.Administration { Zone = "Default" EnableCache = $true Location = "c:\BlobCache" - MaxSizeInGB = 30 + MaxSizeInGB = 30 FileTypes = "\.(gif|jpg|jpeg)$" } @@ -165,9 +165,9 @@ namespace Microsoft.SharePoint.Administration { ' Mock -CommandName Test-Path -MockWith { return $false } - Mock -CommandName New-Item -MockWith {} + Mock -CommandName New-Item -MockWith { } - Mock -CommandName Copy-Item -MockWith {} + Mock -CommandName Copy-Item -MockWith { } It "Should return values from the get method" { Get-TargetResource @testParams | Should Not BeNullOrEmpty @@ -203,7 +203,7 @@ namespace Microsoft.SharePoint.Administration { Mock -CommandName Test-Path -MockWith { return $true } - Mock -CommandName Copy-Item -MockWith {} + Mock -CommandName Copy-Item -MockWith { } It "Should return values from the get method" { Get-TargetResource @testParams | Should Not BeNullOrEmpty @@ -227,7 +227,7 @@ namespace Microsoft.SharePoint.Administration { Zone = "Default" EnableCache = $true Location = "c:\BlobCache" - MaxSizeInGB = 30 + MaxSizeInGB = 30 FileTypes = "\.(gif|jpg|jpeg)$" } @@ -242,7 +242,7 @@ namespace Microsoft.SharePoint.Administration { $IISSettings = @(@{ Path = $Global:SPDscWebConfigRealPath }) - $iisSettingsCol = {$IISSettings}.Invoke() + $iisSettingsCol = { $IISSettings }.Invoke() $webapp = @{ @@ -254,7 +254,7 @@ namespace Microsoft.SharePoint.Administration { Mock -CommandName Test-Path -MockWith { return $true } - Mock -CommandName Copy-Item -MockWith {} + Mock -CommandName Copy-Item -MockWith { } It "Should return values from the get method" { Get-TargetResource @testParams | Should Not BeNullOrEmpty @@ -277,7 +277,7 @@ namespace Microsoft.SharePoint.Administration { Zone = "Default" EnableCache = $true Location = "c:\BlobCache" - MaxSizeInGB = 30 + MaxSizeInGB = 30 FileTypes = "\.(gif|jpg|jpeg)$" } @@ -315,7 +315,7 @@ namespace Microsoft.SharePoint.Administration { Mock -CommandName Test-Path -MockWith { return $true } - Mock -CommandName Copy-Item -MockWith {} + Mock -CommandName Copy-Item -MockWith { } It "Should return values from the get method" { Get-TargetResource @testParams | Should Not BeNullOrEmpty @@ -338,7 +338,7 @@ namespace Microsoft.SharePoint.Administration { Zone = "Default" EnableCache = $true Location = "c:\BlobCache" - MaxSizeInGB = 30 + MaxSizeInGB = 30 FileTypes = "\.(gif|jpg|jpeg)$" } @@ -355,20 +355,20 @@ namespace Microsoft.SharePoint.Administration { $null | Add-Member -MemberType ScriptMethod ` -Name GetType ` -Value { - return @{ - Name = "SPWebServiceInstance" - } - } -PassThru -Force | Add-Member -Name Name ` - -MemberType ScriptProperty ` - -PassThru ` - { - # get - "" - }` - { - # set - param ( $arg ) - } + return @{ + Name = "SPWebServiceInstance" + } + } -PassThru -Force | Add-Member -Name Name ` + -MemberType ScriptProperty ` + -PassThru ` + { + # get + "" + }` + { + # set + param ( $arg ) + } ) } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPCacheAccounts.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPCacheAccounts.Tests.ps1 index dcbc69133..e2d0037af 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPCacheAccounts.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPCacheAccounts.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPCacheAccounts" + -DscResource "SPCacheAccounts" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -37,10 +37,10 @@ namespace Microsoft.SharePoint.Administration { $Global:SPDscClaimsPrincipalUser = $Identity return ( New-Object -TypeName Object | Add-Member -MemberType ScriptMethod ` - -Name "ToEncodedString" ` - -Value { - return "i:0#.w|$($Global:SPDscClaimsPrincipalUser)" - } -PassThru + -Name "ToEncodedString" ` + -Value { + return "i:0#.w|$($Global:SPDscClaimsPrincipalUser)" + } -PassThru ) } -ParameterFilter { $IdentityType -eq "WindowsSamAccountName" } @@ -53,8 +53,8 @@ namespace Microsoft.SharePoint.Administration { # Test contexts Context -Name "The web application specified does not exist" -Fixture { $testParams = @{ - WebAppUrl = "http://test.sharepoint.com" - SuperUserAlias = "DEMO\SuperUser" + WebAppUrl = "http://test.sharepoint.com" + SuperUserAlias = "DEMO\SuperUser" SuperReaderAlias = "DEMO\SuperReader" } @@ -77,58 +77,58 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The specified cache accounts have not been configured, Claims WebApp" -Fixture { $testParams = @{ - WebAppUrl = "http://test.sharepoint.com" - SuperUserAlias = "DEMO\SuperUser" + WebAppUrl = "http://test.sharepoint.com" + SuperUserAlias = "DEMO\SuperUser" SuperReaderAlias = "DEMO\SuperReader" } Mock -CommandName Get-SPWebApplication -MockWith { - $policiesObject = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name Add ` - -Value { - return New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name PolicyRoleBindings ` - -Value ( - New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name Add ` - -Value {} ` - -PassThru - ) -PassThru - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Remove ` - -Value {} ` - -PassThru + $policiesObject = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name Add ` + -Value { + return New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name PolicyRoleBindings ` + -Value ( + New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name Add ` + -Value { } ` + -PassThru + ) -PassThru + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Remove ` + -Value { } ` + -PassThru return New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Properties ` - -Value @{} ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name Policies ` - -Value $policiesObject ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name PolicyRoles ` - -Value ( - New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name GetSpecialRole ` - -Value { return @{} } ` - -PassThru - ) -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value {} ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name UseClaimsAuthentication ` - -Value $true ` - -PassThru + Add-Member -MemberType NoteProperty ` + -Name Properties ` + -Value @{ } ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name Policies ` + -Value $policiesObject ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name PolicyRoles ` + -Value ( + New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name GetSpecialRole ` + -Value { return @{ } } ` + -PassThru + ) -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { } ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name UseClaimsAuthentication ` + -Value $true ` + -PassThru } It "Should return empty strings from the Get method" { @@ -148,58 +148,58 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The specified cache accounts have not been configured, non-claims WebApp" -Fixture { $testParams = @{ - WebAppUrl = "http://test.sharepoint.com" - SuperUserAlias = "DEMO\SuperUser" + WebAppUrl = "http://test.sharepoint.com" + SuperUserAlias = "DEMO\SuperUser" SuperReaderAlias = "DEMO\SuperReader" } Mock -CommandName Get-SPWebApplication -MockWith { - $policiesObject = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name Add ` - -Value { - return New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name PolicyRoleBindings ` - -Value ( - New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name Add ` - -Value {} ` - -PassThru - ) -PassThru - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Remove ` - -Value {} ` - -PassThru + $policiesObject = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name Add ` + -Value { + return New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name PolicyRoleBindings ` + -Value ( + New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name Add ` + -Value { } ` + -PassThru + ) -PassThru + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Remove ` + -Value { } ` + -PassThru return New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Properties ` - -Value @{} ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name Policies ` - -Value $policiesObject ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name PolicyRoles ` - -Value ( - New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name GetSpecialRole ` - -Value { return @{} } ` - -PassThru - ) -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value {} ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name UseClaimsAuthentication ` - -Value $false ` - -PassThru + Add-Member -MemberType NoteProperty ` + -Name Properties ` + -Value @{ } ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name Policies ` + -Value $policiesObject ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name PolicyRoles ` + -Value ( + New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name GetSpecialRole ` + -Value { return @{ } } ` + -PassThru + ) -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { } ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name UseClaimsAuthentication ` + -Value $false ` + -PassThru } It "Should return empty strings from the Get method" { @@ -219,54 +219,54 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The cache accounts have been configured correctly, SetWebAppPolicy set to False" -Fixture { $testParams = @{ - WebAppUrl = "http://test.sharepoint.com" - SuperUserAlias = "DEMO\SuperUser" + WebAppUrl = "http://test.sharepoint.com" + SuperUserAlias = "DEMO\SuperUser" SuperReaderAlias = "DEMO\SuperReader" - SetWebAppPolicy = $false + SetWebAppPolicy = $false } Mock -CommandName Get-SPWebApplication -MockWith { return New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Properties ` - -Value @{ - portalsuperuseraccount = $testParams.SuperUserAlias - portalsuperreaderaccount = $testParams.SuperReaderAlias - } -PassThru | - Add-Member -MemberType NoteProperty ` - -Name Policies ` - -Value @( - @{ - UserName = $testParams.SuperUserAlias - }, - @{ - UserName = $testParams.SuperReaderAlias - }, - @{ - UserName = "i:0#.w|$($testParams.SuperUserAlias)" - }, - @{ - UserName = "i:0#.w|$($testParams.SuperReaderAlias)" - } - ) -PassThru | - Add-Member -MemberType NoteProperty ` - -Name PolicyRoles ` - -Value ( - New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name GetSpecialRole ` - -Value { - return @{} - } -PassThru - ) -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value {} ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name UseClaimsAuthentication ` - -Value $false ` - -PassThru + Add-Member -MemberType NoteProperty ` + -Name Properties ` + -Value @{ + portalsuperuseraccount = $testParams.SuperUserAlias + portalsuperreaderaccount = $testParams.SuperReaderAlias + } -PassThru | + Add-Member -MemberType NoteProperty ` + -Name Policies ` + -Value @( + @{ + UserName = $testParams.SuperUserAlias + }, + @{ + UserName = $testParams.SuperReaderAlias + }, + @{ + UserName = "i:0#.w|$($testParams.SuperUserAlias)" + }, + @{ + UserName = "i:0#.w|$($testParams.SuperReaderAlias)" + } + ) -PassThru | + Add-Member -MemberType NoteProperty ` + -Name PolicyRoles ` + -Value ( + New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name GetSpecialRole ` + -Value { + return @{ } + } -PassThru + ) -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { } ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name UseClaimsAuthentication ` + -Value $false ` + -PassThru } It "Should return the values from the get method" { @@ -282,53 +282,53 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The cache accounts have been configured correctly" -Fixture { $testParams = @{ - WebAppUrl = "http://test.sharepoint.com" - SuperUserAlias = "DEMO\SuperUser" + WebAppUrl = "http://test.sharepoint.com" + SuperUserAlias = "DEMO\SuperUser" SuperReaderAlias = "DEMO\SuperReader" } Mock -CommandName Get-SPWebApplication -MockWith { return New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Properties ` - -Value @{ - portalsuperuseraccount = $testParams.SuperUserAlias - portalsuperreaderaccount = $testParams.SuperReaderAlias - } -PassThru | - Add-Member -MemberType NoteProperty ` - -Name Policies ` - -Value @( - @{ - UserName = $testParams.SuperUserAlias - }, - @{ - UserName = $testParams.SuperReaderAlias - }, - @{ - UserName = "i:0#.w|$($testParams.SuperUserAlias)" - }, - @{ - UserName = "i:0#.w|$($testParams.SuperReaderAlias)" - } - ) -PassThru | - Add-Member -MemberType NoteProperty ` - -Name PolicyRoles ` - -Value ( - New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name GetSpecialRole ` - -Value { - return @{} - } -PassThru - ) -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value {} ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name UseClaimsAuthentication ` - -Value $false ` - -PassThru + Add-Member -MemberType NoteProperty ` + -Name Properties ` + -Value @{ + portalsuperuseraccount = $testParams.SuperUserAlias + portalsuperreaderaccount = $testParams.SuperReaderAlias + } -PassThru | + Add-Member -MemberType NoteProperty ` + -Name Policies ` + -Value @( + @{ + UserName = $testParams.SuperUserAlias + }, + @{ + UserName = $testParams.SuperReaderAlias + }, + @{ + UserName = "i:0#.w|$($testParams.SuperUserAlias)" + }, + @{ + UserName = "i:0#.w|$($testParams.SuperReaderAlias)" + } + ) -PassThru | + Add-Member -MemberType NoteProperty ` + -Name PolicyRoles ` + -Value ( + New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name GetSpecialRole ` + -Value { + return @{ } + } -PassThru + ) -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { } ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name UseClaimsAuthentication ` + -Value $false ` + -PassThru } It "Should return the values from the get method" { @@ -344,58 +344,58 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Cache accounts have been configured, but the reader account is wrong" -Fixture { $testParams = @{ - WebAppUrl = "http://test.sharepoint.com" - SuperUserAlias = "DEMO\SuperUser" + WebAppUrl = "http://test.sharepoint.com" + SuperUserAlias = "DEMO\SuperUser" SuperReaderAlias = "DEMO\SuperReader" } Mock -CommandName Get-SPWebApplication -MockWith { return New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty -Name Properties @{ - portalsuperuseraccount = $testParams.SuperUserAlias - portalsuperreaderaccount = "WRONG\AccountName" - } -PassThru | - Add-Member -MemberType NoteProperty ` - -Name Policies ` - -Value ( - New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name Add ` - -Value { - return New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name PolicyRoleBindings ` - -Value ( - New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name Add ` - -Value {} ` - -PassThru - ) -PassThru - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Remove ` - -Value {} ` - -PassThru - ) -PassThru | - Add-Member -MemberType NoteProperty ` - -Name PolicyRoles ` - -Value ( - New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name GetSpecialRole ` - -Value { - return @{} - } -PassThru - ) -PassThru | + Add-Member -MemberType NoteProperty -Name Properties @{ + portalsuperuseraccount = $testParams.SuperUserAlias + portalsuperreaderaccount = "WRONG\AccountName" + } -PassThru | + Add-Member -MemberType NoteProperty ` + -Name Policies ` + -Value ( + New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name Add ` + -Value { + return New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name PolicyRoleBindings ` + -Value ( + New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value {} ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name UseClaimsAuthentication ` - -Value $true ` - -PassThru + -Name Add ` + -Value { } ` + -PassThru + ) -PassThru + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Remove ` + -Value { } ` + -PassThru + ) -PassThru | + Add-Member -MemberType NoteProperty ` + -Name PolicyRoles ` + -Value ( + New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name GetSpecialRole ` + -Value { + return @{ } + } -PassThru + ) -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { } ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name UseClaimsAuthentication ` + -Value $true ` + -PassThru } It "Should return false from the test method" { @@ -409,56 +409,56 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Cache accounts have been configured, but the super account is wrong" -Fixture { $testParams = @{ - WebAppUrl = "http://test.sharepoint.com" - SuperUserAlias = "DEMO\SuperUser" + WebAppUrl = "http://test.sharepoint.com" + SuperUserAlias = "DEMO\SuperUser" SuperReaderAlias = "DEMO\SuperReader" } Mock -CommandName Get-SPWebApplication -MockWith { return New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty -Name Properties @{ - portalsuperuseraccount = "WRONG\AccountName" - portalsuperreaderaccount = $testParams.SuperReaderAlias - } -PassThru | - Add-Member -MemberType NoteProperty -Name Policies -Value ( - New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name Add ` - -Value { - return New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name PolicyRoleBindings ` - -Value ( - New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name Add ` - -Value {} ` - -PassThru - ) -PassThru - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Remove ` - -Value {} ` - -PassThru - ) -PassThru | - Add-Member -MemberType NoteProperty ` - -Name PolicyRoles ` - -Value ( - New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name GetSpecialRole ` - -Value { - return @{} - } -PassThru - ) -PassThru | + Add-Member -MemberType NoteProperty -Name Properties @{ + portalsuperuseraccount = "WRONG\AccountName" + portalsuperreaderaccount = $testParams.SuperReaderAlias + } -PassThru | + Add-Member -MemberType NoteProperty -Name Policies -Value ( + New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value {} ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name UseClaimsAuthentication ` - -Value $true ` + -Name Add ` + -Value { + return New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name PolicyRoleBindings ` + -Value ( + New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name Add ` + -Value { } ` -PassThru + ) -PassThru + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Remove ` + -Value { } ` + -PassThru + ) -PassThru | + Add-Member -MemberType NoteProperty ` + -Name PolicyRoles ` + -Value ( + New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name GetSpecialRole ` + -Value { + return @{ } + } -PassThru + ) -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { } ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name UseClaimsAuthentication ` + -Value $true ` + -PassThru } It "Should return false from the test method" { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPConfigWizard.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPConfigWizard.Tests.ps1 index b284e8674..8af41f208 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPConfigWizard.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPConfigWizard.Tests.ps1 @@ -3,23 +3,23 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPConfigWizard" + -DscResource "SPConfigWizard" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope # Mocks for all contexts - Mock -CommandName Remove-Item -MockWith {} + Mock -CommandName Remove-Item -MockWith { } Mock -CommandName Get-Content -MockWith { return "log info" } Mock -CommandName Get-SPDscServerPatchStatus -MockWith { return "NoActionRequired" } @@ -90,7 +90,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Config wizard should not be run, because not all servers have the binaries installed" -Fixture { $testParams = @{ - IsSingleInstance = "Yes" + IsSingleInstance = "Yes" } Mock -CommandName Get-SPDscRegistryKey -MockWith { @@ -102,7 +102,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscServerPatchStatus -MockWith { return "UpgradeBlocked" } - Mock -CommandName Start-Process -MockWith {} + Mock -CommandName Start-Process -MockWith { } It "Should run Start-Process in the set method" { Set-TargetResource @testParams @@ -125,7 +125,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $testDate = Get-Date -Day 17 -Month 7 -Year 2016 -Hour 12 -Minute 00 -Second 00 Mock -CommandName Get-Date -MockWith { - return $testDate + return $testDate } It "Should return Ensure=Absent from the get method" { @@ -157,7 +157,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $testDate = Get-Date -Day 17 -Month 7 -Year 2016 -Hour 12 -Minute 00 -Second 00 Mock -CommandName Get-Date -MockWith { - return $testDate + return $testDate } It "Should return null from the set method" { @@ -181,7 +181,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $testDate = Get-Date -Day 17 -Month 7 -Year 2016 -Hour 12 -Minute 00 -Second 00 Mock -CommandName Get-Date -MockWith { - return $testDate + return $testDate } It "Should return exception from the set method" { @@ -205,7 +205,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $testDate = Get-Date -Day 17 -Month 7 -Year 2016 -Hour 12 -Minute 00 -Second 00 Mock -CommandName Get-Date -MockWith { - return $testDate + return $testDate } It "Should return exception from the set method" { @@ -229,7 +229,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $testDate = Get-Date -Day 17 -Month 7 -Year 2016 -Hour 12 -Minute 00 -Second 00 Mock -CommandName Get-Date -MockWith { - return $testDate + return $testDate } It "Should return exception from the set method" { @@ -253,7 +253,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $testDate = Get-Date -Day 17 -Month 7 -Year 2016 -Hour 12 -Minute 00 -Second 00 Mock -CommandName Get-Date -MockWith { - return $testDate + return $testDate } It "Should return exception from the set method" { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPContentDatabase.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPContentDatabase.Tests.ps1 index f366bf760..c298164e8 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPContentDatabase.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPContentDatabase.Tests.ps1 @@ -1,80 +1,80 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPContentDatabase" + -DscResource "SPContentDatabase" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope # Initialize tests - try - { - [Microsoft.SharePoint.Administration.SPObjectStatus] + try + { + [Microsoft.SharePoint.Administration.SPObjectStatus] } - catch + catch { Add-Type -TypeDefinition @" namespace Microsoft.SharePoint.Administration { public enum SPObjectStatus { Online, Disabled }; -} +} "@ } # Mocks for all contexts Mock -CommandName Dismount-SPContentDatabase -MockWith { } - Mock -CommandName Get-SPWebApplication -MockWith { - return @{ - Url="http://sharepoint.contoso.com/" - } + Mock -CommandName Get-SPWebApplication -MockWith { + return @{ + Url = "http://sharepoint.contoso.com/" + } } # Test contexts Context -Name "DatabaseServer parameter does not match actual setting" -Fixture { $testParams = @{ - Name = "SharePoint_Content_01" - DatabaseServer = "SQLSrv" - WebAppUrl = "http://sharepoint.contoso.com" - Enabled = $true + Name = "SharePoint_Content_01" + DatabaseServer = "SQLSrv" + WebAppUrl = "http://sharepoint.contoso.com" + Enabled = $true WarningSiteCount = 2000 MaximumSiteCount = 5000 - Ensure = "Present" + Ensure = "Present" } - - Mock -CommandName Get-SPDatabase -MockWith { + + Mock -CommandName Get-SPDatabase -MockWith { $returnval = @{ - Name = "SharePoint_Content_01" - Type = "Content Database" - Server = "WrongSQLSrv" - WebApplication = @{ - Url = "http://sharepoint.contoso.com/" + Name = "SharePoint_Content_01" + Type = "Content Database" + Server = "WrongSQLSrv" + WebApplication = @{ + Url = "http://sharepoint.contoso.com/" } - Status = "Online" + Status = "Online" WarningSiteCount = 2000 MaximumSiteCount = 5000 } - $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name GetType -Value { + $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name GetType -Value { return @{ FullName = "Microsoft.SharePoint.Administration.SPContentDatabase" } } -PassThru -Force return $returnval } - Mock -CommandName Get-SPWebApplication -MockWith { - return @{ - Url="http://sharepoint.contoso.com/" - } + Mock -CommandName Get-SPWebApplication -MockWith { + return @{ + Url = "http://sharepoint.contoso.com/" + } } It "Should return Ensure=Present from the get method" { @@ -89,39 +89,39 @@ namespace Microsoft.SharePoint.Administration { { Set-TargetResource @testParams } | Should throw "Specified database server does not match the actual database server. This resource cannot move the database to a different SQL instance." } } - + Context -Name "Specified Web application does not exist" -Fixture { $testParams = @{ - Name = "SharePoint_Content_01" - DatabaseServer = "SQLSrv" - WebAppUrl = "http://sharepoint.contoso.com" - Enabled = $true + Name = "SharePoint_Content_01" + DatabaseServer = "SQLSrv" + WebAppUrl = "http://sharepoint.contoso.com" + Enabled = $true WarningSiteCount = 2000 MaximumSiteCount = 5000 - Ensure = "Present" + Ensure = "Present" } - Mock -CommandName Get-SPDatabase -MockWith { + Mock -CommandName Get-SPDatabase -MockWith { $returnval = @{ - Name = "SharePoint_Content_01" - Type = "Content Database" - Server = "SQLSrv" - WebApplication = @{ - Url = "http://sharepoint2.contoso.com/" + Name = "SharePoint_Content_01" + Type = "Content Database" + Server = "SQLSrv" + WebApplication = @{ + Url = "http://sharepoint2.contoso.com/" } - Status = "Online" + Status = "Online" WarningSiteCount = 2000 MaximumSiteCount = 5000 } - $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name GetType -Value { + $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name GetType -Value { return @{ FullName = "Microsoft.SharePoint.Administration.SPContentDatabase" } } -PassThru -Force return $returnval } - Mock -CommandName Get-SPWebApplication -MockWith { - return @() + Mock -CommandName Get-SPWebApplication -MockWith { + return @() } It "Should return Ensure=Present from the get method" { @@ -139,24 +139,24 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Mount database throws an error" -Fixture { $testParams = @{ - Name = "SharePoint_Content_01" - DatabaseServer = "SQLSrv" - WebAppUrl = "http://sharepoint.contoso.com" - Enabled = $true + Name = "SharePoint_Content_01" + DatabaseServer = "SQLSrv" + WebAppUrl = "http://sharepoint.contoso.com" + Enabled = $true WarningSiteCount = 2000 MaximumSiteCount = 5000 - Ensure = "Present" + Ensure = "Present" } - - Mock -CommandName Get-SPDatabase -MockWith { - $returnVal = @{} - $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name Update -Value { - $Global:SPDscContentDatabaseUpdated = $true + + Mock -CommandName Get-SPDatabase -MockWith { + $returnVal = @{ } + $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name Update -Value { + $Global:SPDscContentDatabaseUpdated = $true } -PassThru return $returnVal } - - Mock -CommandName Mount-SPContentDatabase -MockWith { + + Mock -CommandName Mount-SPContentDatabase -MockWith { throw "MOUNT ERROR" } @@ -167,35 +167,35 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Content database does not exist, but has to be" -Fixture { $testParams = @{ - Name = "SharePoint_Content_01" - DatabaseServer = "SQLSrv" - WebAppUrl = "http://sharepoint.contoso.com" - Enabled = $true + Name = "SharePoint_Content_01" + DatabaseServer = "SQLSrv" + WebAppUrl = "http://sharepoint.contoso.com" + Enabled = $true WarningSiteCount = 2000 MaximumSiteCount = 5000 - Ensure = "Present" + Ensure = "Present" } - - Mock -CommandName Get-SPDatabase -MockWith { - $returnVal = @{} - $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name Update -Value { - $Global:SPDscContentDatabaseUpdated = $true + + Mock -CommandName Get-SPDatabase -MockWith { + $returnVal = @{ } + $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name Update -Value { + $Global:SPDscContentDatabaseUpdated = $true } -PassThru return $returnVal } - Mock -CommandName Get-SPWebApplication { return @{ Url="http://sharepoint.contoso.com/" } } - Mock Mount-SPContentDatabase { + Mock -CommandName Get-SPWebApplication { return @{ Url = "http://sharepoint.contoso.com/" } } + Mock Mount-SPContentDatabase { $returnval = @{ - Name = "SharePoint_Content_01" - Server = "SQLSrv" - WebApplication = @{ Url = "http://sharepoint.contoso.com/" } - Status = "Online" + Name = "SharePoint_Content_01" + Server = "SQLSrv" + WebApplication = @{ Url = "http://sharepoint.contoso.com/" } + Status = "Online" WarningSiteCount = 2000 MaximumSiteCount = 5000 } - $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name Update -Value { - $Global:SPDscContentDatabaseUpdated = $true + $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name Update -Value { + $Global:SPDscContentDatabaseUpdated = $true } -PassThru return $returnVal } @@ -217,34 +217,34 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Content database exists, but has incorrect settings" -Fixture { $testParams = @{ - Name = "SharePoint_Content_01" - DatabaseServer = "SQLSrv" - WebAppUrl = "http://sharepoint.contoso.com" - Enabled = $true + Name = "SharePoint_Content_01" + DatabaseServer = "SQLSrv" + WebAppUrl = "http://sharepoint.contoso.com" + Enabled = $true WarningSiteCount = 2000 MaximumSiteCount = 5000 - Ensure = "Present" + Ensure = "Present" } - - Mock -CommandName Get-SPDatabase -MockWith { + + Mock -CommandName Get-SPDatabase -MockWith { $returnVal = @{ - Name = "SharePoint_Content_01" - Type = "Content Database" - Server = "SQLSrv" - WebApplication = @{ Url = "http://sharepoint.contoso.com/" } - Status = "Disabled" + Name = "SharePoint_Content_01" + Type = "Content Database" + Server = "SQLSrv" + WebApplication = @{ Url = "http://sharepoint.contoso.com/" } + Status = "Disabled" WarningSiteCount = 1000 MaximumSiteCount = 2000 } - $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name Update -Value { - $Global:SPDscContentDatabaseUpdated = $true + $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name Update -Value { + $Global:SPDscContentDatabaseUpdated = $true } -PassThru - $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name GetType -Value { + $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name GetType -Value { return @{ FullName = "Microsoft.SharePoint.Administration.SPContentDatabase" } } -PassThru -Force - + return $returnVal } @@ -262,39 +262,39 @@ namespace Microsoft.SharePoint.Administration { $Global:SPDscContentDatabaseUpdated | Should Be $true } } - + Context -Name "Content database exists, but Ensure is set to Absent" -Fixture { $testParams = @{ - Name = "SharePoint_Content_01" - DatabaseServer = "SQLSrv" - WebAppUrl = "http://sharepoint.contoso.com" - Enabled = $true + Name = "SharePoint_Content_01" + DatabaseServer = "SQLSrv" + WebAppUrl = "http://sharepoint.contoso.com" + Enabled = $true WarningSiteCount = 2000 MaximumSiteCount = 5000 - Ensure = "Absent" + Ensure = "Absent" } - - Mock -CommandName Get-SPDatabase -MockWith { + + Mock -CommandName Get-SPDatabase -MockWith { $returnVal = @{ - Name = "SharePoint_Content_01" - Type = "Content Database" - Server = "SQLSrv" - WebApplication = @{ Url = "http://sharepoint.contoso.com/" } - Status = "Disabled" + Name = "SharePoint_Content_01" + Type = "Content Database" + Server = "SQLSrv" + WebApplication = @{ Url = "http://sharepoint.contoso.com/" } + Status = "Disabled" WarningSiteCount = 1000 MaximumSiteCount = 2000 } - $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name Update -Value { - $Global:SPDscContentDatabaseUpdated = $true + $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name Update -Value { + $Global:SPDscContentDatabaseUpdated = $true } -PassThru - $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name GetType -Value { + $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name GetType -Value { return @{ FullName = "Microsoft.SharePoint.Administration.SPContentDatabase" } } -PassThru -Force return $returnVal } - + It "Should return Ensure=Present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" } @@ -311,26 +311,26 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Content database is mounted to the incorrect web application" -Fixture { $testParams = @{ - Name = "SharePoint_Content_01" - DatabaseServer = "SQLSrv" - WebAppUrl = "http://sharepoint.contoso.com" - Enabled = $true + Name = "SharePoint_Content_01" + DatabaseServer = "SQLSrv" + WebAppUrl = "http://sharepoint.contoso.com" + Enabled = $true WarningSiteCount = 2000 MaximumSiteCount = 5000 - Ensure = "Present" + Ensure = "Present" } - - Mock -CommandName Get-SPDatabase -MockWith { + + Mock -CommandName Get-SPDatabase -MockWith { $returnVal = @{ - Name = "SharePoint_Content_01" - Type = "Content Database" - Server = "SQLSrv" - WebApplication = @{ Url = "http://sharepoint2.contoso.com/" } - Status = "Online" + Name = "SharePoint_Content_01" + Type = "Content Database" + Server = "SQLSrv" + WebApplication = @{ Url = "http://sharepoint2.contoso.com/" } + Status = "Online" WarningSiteCount = 2000 MaximumSiteCount = 5000 } - $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name GetType -Value { + $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name GetType -Value { return @{ FullName = "Microsoft.SharePoint.Administration.SPContentDatabase" } @@ -338,23 +338,23 @@ namespace Microsoft.SharePoint.Administration { return $returnVal } - Mock -CommandName Get-SPWebApplication { return @{ Url="http://sharepoint.contoso.com/" } } + Mock -CommandName Get-SPWebApplication { return @{ Url = "http://sharepoint.contoso.com/" } } Mock Dismount-SPContentDatabase { } - Mock Mount-SPContentDatabase { + Mock Mount-SPContentDatabase { $returnVal = @{ - Name = "SharePoint_Content_01" - Server = "SQLSrv" - WebApplication = @{ Url = "http://sharepoint.contoso.com/" } - Status = "Online" + Name = "SharePoint_Content_01" + Server = "SQLSrv" + WebApplication = @{ Url = "http://sharepoint.contoso.com/" } + Status = "Online" WarningSiteCount = 2000 MaximumSiteCount = 5000 } - $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name Update -Value { - $Global:SPDscContentDatabaseUpdated = $true + $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name Update -Value { + $Global:SPDscContentDatabaseUpdated = $true } -PassThru return $returnVal } - + It "Should return Ensure=Present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" } @@ -372,33 +372,33 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Content database is present with correct settings and Ensure is Present" -Fixture { $testParams = @{ - Name = "SharePoint_Content_01" - DatabaseServer = "SQLSrv" - WebAppUrl = "http://sharepoint.contoso.com" - Enabled = $true + Name = "SharePoint_Content_01" + DatabaseServer = "SQLSrv" + WebAppUrl = "http://sharepoint.contoso.com" + Enabled = $true WarningSiteCount = 2000 MaximumSiteCount = 5000 - Ensure = "Present" + Ensure = "Present" } - - Mock -CommandName Get-SPDatabase -MockWith { + + Mock -CommandName Get-SPDatabase -MockWith { $returnVal = @{ - Name = "SharePoint_Content_01" - Type = "Content Database" - Server = "SQLSrv" - WebApplication = @{ Url = "http://sharepoint.contoso.com/" } - Status = "Online" + Name = "SharePoint_Content_01" + Type = "Content Database" + Server = "SQLSrv" + WebApplication = @{ Url = "http://sharepoint.contoso.com/" } + Status = "Online" WarningSiteCount = 2000 MaximumSiteCount = 5000 } - $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name GetType -Value { + $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name GetType -Value { return @{ FullName = "Microsoft.SharePoint.Administration.SPContentDatabase" } } -PassThru -Force return $returnVal } - + It "Should return Ensure=Present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" } @@ -410,20 +410,20 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Content database is absent and Ensure is Absent" -Fixture { $testParams = @{ - Name = "SharePoint_Content_01" - DatabaseServer = "SQLSrv" - WebAppUrl = "http://sharepoint.contoso.com" - Enabled = $true + Name = "SharePoint_Content_01" + DatabaseServer = "SQLSrv" + WebAppUrl = "http://sharepoint.contoso.com" + Enabled = $true WarningSiteCount = 2000 MaximumSiteCount = 5000 - Ensure = "Absent" + Ensure = "Absent" } - - Mock -CommandName Get-SPDatabase -MockWith { + + Mock -CommandName Get-SPDatabase -MockWith { $returnVal = @{ } return $returnVal } - + It "Should return Ensure=Absent from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPDatabaseAAG.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPDatabaseAAG.Tests.ps1 index a1c28dc20..d8a11d4df 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPDatabaseAAG.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPDatabaseAAG.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPDatabaseAAG" + -DscResource "SPDatabaseAAG" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPDesignerSettings.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPDesignerSettings.Tests.ps1 index 527f29ad0..3b4df4aa4 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPDesignerSettings.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPDesignerSettings.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPDesignerSettings" + -DscResource "SPDesignerSettings" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -20,7 +20,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Mocks for all contexts Mock -CommandName Get-SPFarm -MockWith { - return @{} + return @{ } } # Test contexts @@ -79,9 +79,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-SPWebapplication -MockWith { - $result = @{} + $result = @{ } $result.DisplayName = "Test" - $result.Url = "https://intranet.sharepoint.contoso.com" + $result.Url = "https://intranet.sharepoint.contoso.com" $result = $result | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscDesignerUpdated = $true @@ -120,14 +120,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPSite -MockWith { return @{ - Url = "https://intranet.sharepoint.contoso.com" - AllowDesigner = $true - AllowRevertFromTemplate = $true - AllowMasterPageEditing = $true - ShowURLStructure = $true - AllowCreateDeclarativeWorkflow = $true - AllowSavePublishDeclarativeWorkflow = $true - AllowSaveDeclarativeWorkflowAsTemplate = $true + Url = "https://intranet.sharepoint.contoso.com" + AllowDesigner = $true + AllowRevertFromTemplate = $true + AllowMasterPageEditing = $true + ShowURLStructure = $true + AllowCreateDeclarativeWorkflow = $true + AllowSavePublishDeclarativeWorkflow = $true + AllowSaveDeclarativeWorkflowAsTemplate = $true } } @@ -160,14 +160,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-SPSite -MockWith { return @{ - Url = "https://intranet.sharepoint.contoso.com" - AllowDesigner = $true - AllowRevertFromTemplate = $true - AllowMasterPageEditing = $true - ShowURLStructure = $true - AllowCreateDeclarativeWorkflow = $true - AllowSavePublishDeclarativeWorkflow = $true - AllowSaveDeclarativeWorkflowAsTemplate = $true + Url = "https://intranet.sharepoint.contoso.com" + AllowDesigner = $true + AllowRevertFromTemplate = $true + AllowMasterPageEditing = $true + ShowURLStructure = $true + AllowCreateDeclarativeWorkflow = $true + AllowSavePublishDeclarativeWorkflow = $true + AllowSaveDeclarativeWorkflowAsTemplate = $true } } Mock -CommandName Test-SPDscRunAsCredential { return $false } @@ -218,7 +218,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Test-SPDscRunAsCredential { return $true } Mock -CommandName Get-SPWebApplication -MockWith { - $result = @{} + $result = @{ } $result.DisplayName = "Test" $result.Url = "https://intranet.sharepoint.contoso.com" @@ -249,14 +249,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPSite -MockWith { $returnVal = @{ - Url = "https://intranet.sharepoint.contoso.com" - AllowDesigner = $false - AllowRevertFromTemplate = $false - AllowMasterPageEditing = $false - ShowURLStructure = $false - AllowCreateDeclarativeWorkflow = $false - AllowSavePublishDeclarativeWorkflow = $false - AllowSaveDeclarativeWorkflowAsTemplate = $false + Url = "https://intranet.sharepoint.contoso.com" + AllowDesigner = $false + AllowRevertFromTemplate = $false + AllowMasterPageEditing = $false + ShowURLStructure = $false + AllowCreateDeclarativeWorkflow = $false + AllowSavePublishDeclarativeWorkflow = $false + AllowSaveDeclarativeWorkflowAsTemplate = $false } $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscDesignerUpdated = $true diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPDiagnosticLoggingSettings.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPDiagnosticLoggingSettings.Tests.ps1 index a8d1465c5..f3b4859b8 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPDiagnosticLoggingSettings.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPDiagnosticLoggingSettings.Tests.ps1 @@ -4,23 +4,23 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPDiagnosticLoggingSettings" + -DscResource "SPDiagnosticLoggingSettings" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope # Mocks for all contexts - Mock -CommandName Set-SPDiagnosticConfig -MockWith {} + Mock -CommandName Set-SPDiagnosticConfig -MockWith { } # Test contexts Context -Name "Diagnostic configuration can not be loaded" { @@ -224,7 +224,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Diagnostic configuration needs updating and the InstallAccount option is used" { $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force $mockAccount = New-Object -TypeName "System.Management.Automation.PSCredential" ` - -ArgumentList @("username", $mockPassword) + -ArgumentList @("username", $mockPassword) $testParams = @{ IsSingleInstance = "Yes" LogPath = "L:\ULSLogs" diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPDiagnosticsProvider.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPDiagnosticsProvider.Tests.ps1 index 3aeda64bd..6c1178b31 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPDiagnosticsProvider.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPDiagnosticsProvider.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPDiagnosticsProvider" + -DscResource "SPDiagnosticsProvider" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -20,24 +20,24 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDiagnosticsProvider -MockWith { return @{ - Name = "job-diagnostics-blocking-query-provider" + Name = "job-diagnostics-blocking-query-provider" MaxTotalSizeInBytes = 100000 - Retention = 14 - Enabled = $true - }| Add-Member ScriptMethod Update { + Retention = 14 + Enabled = $true + } | Add-Member ScriptMethod Update { } -PassThru } - Mock -CommandName Set-SPDiagnosticsProvider -MockWith {} + Mock -CommandName Set-SPDiagnosticsProvider -MockWith { } Context -Name "When the Diagnostics Provider passed doesn't exist" -Fixture { $testParams = @{ - Name = "MyFakeProvider" - Retention = 13 + Name = "MyFakeProvider" + Retention = 13 MaxTotalSizeInBytes = 10000 - Enabled = $true - Ensure = "Present" + Enabled = $true + Ensure = "Present" } It "Should return false when the Test method is called" { @@ -56,11 +56,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the Diagnostics Provider exists" -Fixture { $testParams = @{ - Name = "job-diagnostics-blocking-query-provider" - Retention = 13 + Name = "job-diagnostics-blocking-query-provider" + Retention = 13 MaxTotalSizeInBytes = 10000 - Enabled = $true - Ensure = "Present" + Enabled = $true + Ensure = "Present" } It "Should return false when the Test method is called" { @@ -80,11 +80,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When using Ensure is Absent" -Fixture { $testParams = @{ - Name = "job-diagnostics-blocking-query-provider" - Retention = 13 + Name = "job-diagnostics-blocking-query-provider" + Retention = 13 MaxTotalSizeInBytes = 10000 - Enabled = $true - Ensure = "Absent" + Enabled = $true + Ensure = "Absent" } It "Should properly configure the provider" { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheClientSettings.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheClientSettings.Tests.ps1 index d82bca720..81314ee1f 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheClientSettings.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheClientSettings.Tests.ps1 @@ -3,17 +3,17 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPDistributedCacheClientSettings" ` - -IncludeDistributedCacheStubs + -DscResource "SPDistributedCacheClientSettings" ` + -IncludeDistributedCacheStubs Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -21,48 +21,48 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Mocks for all contexts - Mock -CommandName Set-SPDistributedCacheClientSetting{} + Mock -CommandName Set-SPDistributedCacheClientSetting { } # Test contexts Context -Name "Some Distributed Cache Client Settings are Not Properly Configured" -Fixture { Mock -CommandName Get-SPDistributedCacheClientSetting -MockWith { return @{ MaxConnectionsToServer = 5 - RequestTimeout = 2000 - ChannelOpenTimeOut = 2000 - } } + RequestTimeout = 2000 + ChannelOpenTimeOut = 2000 + } } $testParams = @{ - IsSingleInstance = "Yes" - DLTCMaxConnectionsToServer = 3 - DLTCRequestTimeout = 1000 - DLTCChannelOpenTimeOut = 1000 - DVSCMaxConnectionsToServer = 3 - DVSCRequestTimeout = 1000 - DVSCChannelOpenTimeOut = 1000 - DACMaxConnectionsToServer = 3 - DACRequestTimeout = 1000 - DACChannelOpenTimeOut = 1000 - DAFMaxConnectionsToServer = 3 - DAFRequestTimeout = 1000 - DAFChannelOpenTimeOut = 1000 - DAFCMaxConnectionsToServer = 3 - DAFCRequestTimeout = 1000 - DAFCChannelOpenTimeOut = 1000 - DBCMaxConnectionsToServer = 3 - DBCRequestTimeout = 1000 - DBCChannelOpenTimeOut = 1000 - DDCMaxConnectionsToServer = 3 - DDCRequestTimeout = 1000 - DDCChannelOpenTimeOut = 1000 - DSCMaxConnectionsToServer = 3 - DSCRequestTimeout = 1000 - DSCChannelOpenTimeOut = 1000 - DTCMaxConnectionsToServer = 3 - DTCRequestTimeout = 1000 - DTCChannelOpenTimeOut = 1000 + IsSingleInstance = "Yes" + DLTCMaxConnectionsToServer = 3 + DLTCRequestTimeout = 1000 + DLTCChannelOpenTimeOut = 1000 + DVSCMaxConnectionsToServer = 3 + DVSCRequestTimeout = 1000 + DVSCChannelOpenTimeOut = 1000 + DACMaxConnectionsToServer = 3 + DACRequestTimeout = 1000 + DACChannelOpenTimeOut = 1000 + DAFMaxConnectionsToServer = 3 + DAFRequestTimeout = 1000 + DAFChannelOpenTimeOut = 1000 + DAFCMaxConnectionsToServer = 3 + DAFCRequestTimeout = 1000 + DAFCChannelOpenTimeOut = 1000 + DBCMaxConnectionsToServer = 3 + DBCRequestTimeout = 1000 + DBCChannelOpenTimeOut = 1000 + DDCMaxConnectionsToServer = 3 + DDCRequestTimeout = 1000 + DDCChannelOpenTimeOut = 1000 + DSCMaxConnectionsToServer = 3 + DSCRequestTimeout = 1000 + DSCChannelOpenTimeOut = 1000 + DTCMaxConnectionsToServer = 3 + DTCRequestTimeout = 1000 + DTCChannelOpenTimeOut = 1000 DSTACMaxConnectionsToServer = 3 - DSTACRequestTimeout = 1000 - DSTACChannelOpenTimeOut = 1000 + DSTACRequestTimeout = 1000 + DSTACChannelOpenTimeOut = 1000 } if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -ne 15) @@ -102,42 +102,42 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDistributedCacheClientSetting -MockWith { return @{ MaxConnectionsToServer = 1 - RequestTimeout = 3000 - ChannelOpenTimeOut = 3000 - } } + RequestTimeout = 3000 + ChannelOpenTimeOut = 3000 + } } $testParams = @{ - IsSingleInstance = "Yes" - DLTCMaxConnectionsToServer = 1 - DLTCRequestTimeout = 3000 - DLTCChannelOpenTimeOut = 3000 - DVSCMaxConnectionsToServer = 1 - DVSCRequestTimeout = 3000 - DVSCChannelOpenTimeOut = 3000 - DACMaxConnectionsToServer = 1 - DACRequestTimeout = 3000 - DACChannelOpenTimeOut = 3000 - DAFMaxConnectionsToServer = 1 - DAFRequestTimeout = 3000 - DAFChannelOpenTimeOut = 3000 - DAFCMaxConnectionsToServer = 1 - DAFCRequestTimeout = 3000 - DAFCChannelOpenTimeOut = 3000 - DBCMaxConnectionsToServer = 1 - DBCRequestTimeout = 3000 - DBCChannelOpenTimeOut = 3000 - DDCMaxConnectionsToServer = 1 - DDCRequestTimeout = 3000 - DDCChannelOpenTimeOut = 3000 - DSCMaxConnectionsToServer = 1 - DSCRequestTimeout = 3000 - DSCChannelOpenTimeOut = 3000 - DTCMaxConnectionsToServer = 1 - DTCRequestTimeout = 3000 - DTCChannelOpenTimeOut = 3000 + IsSingleInstance = "Yes" + DLTCMaxConnectionsToServer = 1 + DLTCRequestTimeout = 3000 + DLTCChannelOpenTimeOut = 3000 + DVSCMaxConnectionsToServer = 1 + DVSCRequestTimeout = 3000 + DVSCChannelOpenTimeOut = 3000 + DACMaxConnectionsToServer = 1 + DACRequestTimeout = 3000 + DACChannelOpenTimeOut = 3000 + DAFMaxConnectionsToServer = 1 + DAFRequestTimeout = 3000 + DAFChannelOpenTimeOut = 3000 + DAFCMaxConnectionsToServer = 1 + DAFCRequestTimeout = 3000 + DAFCChannelOpenTimeOut = 3000 + DBCMaxConnectionsToServer = 1 + DBCRequestTimeout = 3000 + DBCChannelOpenTimeOut = 3000 + DDCMaxConnectionsToServer = 1 + DDCRequestTimeout = 3000 + DDCChannelOpenTimeOut = 3000 + DSCMaxConnectionsToServer = 1 + DSCRequestTimeout = 3000 + DSCChannelOpenTimeOut = 3000 + DTCMaxConnectionsToServer = 1 + DTCRequestTimeout = 3000 + DTCChannelOpenTimeOut = 3000 DSTACMaxConnectionsToServer = 1 - DSTACRequestTimeout = 3000 - DSTACChannelOpenTimeOut = 3000 + DSTACRequestTimeout = 3000 + DSTACChannelOpenTimeOut = 3000 } if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -ne 15) @@ -174,21 +174,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDistributedCacheClientSetting -MockWith { return @{ MaxConnectionsToServer = 1 - RequestTimeout = 3000 - ChannelOpenTimeOut = 3000 - } } + RequestTimeout = 3000 + ChannelOpenTimeOut = 3000 + } } $testParams = @{ - IsSingleInstance = "Yes" - DLTCMaxConnectionsToServer = 1 - DLTCRequestTimeout = 3000 - DLTCChannelOpenTimeOut = 3000 + IsSingleInstance = "Yes" + DLTCMaxConnectionsToServer = 1 + DLTCRequestTimeout = 3000 + DLTCChannelOpenTimeOut = 3000 DFLTCMaxConnectionsToServer = 1 - DFLTCRequestTimeout = 3000 - DFLTCChannelOpenTimeOut = 3000 + DFLTCRequestTimeout = 3000 + DFLTCChannelOpenTimeOut = 3000 } It "Should throw exception in the Get method" { - { Get-TargetResource @testParams } | Should Throw "The following parameters are only supported in SharePoint 2016 and above" + { Get-TargetResource @testParams } | Should Throw "The following parameters are only supported in SharePoint 2016 and above" } It "Should throw exception in the Set method" { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheService.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheService.Tests.ps1 index e2e24b47f..5785822fc 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheService.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheService.Tests.ps1 @@ -3,17 +3,17 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPDistributedCacheService" ` - -IncludeDistributedCacheStubs + -DscResource "SPDistributedCacheService" ` + -IncludeDistributedCacheStubs Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -27,10 +27,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } Mock -CommandName Get-NetFirewallRule -MockWith { - return @{} + return @{ } } Mock -CommandName Get-NetFirewallRule -MockWith { - return @{} + return @{ } } Mock -CommandName Enable-NetFirewallRule -MockWith { } Mock -CommandName New-NetFirewallRule -MockWith { } @@ -38,7 +38,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Add-SPDistributedCacheServiceInstance -MockWith { } Mock -CommandName Update-SPDistributedCacheSize -MockWith { } Mock -CommandName Get-SPManagedAccount -MockWith { - return @{} + return @{ } } Mock -CommandName Add-SPDscUserToLocalAdmin -MockWith { } Mock -CommandName Test-SPDscUserIsLocalAdmin -MockWith { @@ -49,26 +49,26 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPFarm -MockWith { return @{ Services = @(@{ - Name = "AppFabricCachingService" - ProcessIdentity = New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name ManagedAccount ` - -Value $null ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name CurrentIdentityType ` - -Value $null ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value { $global:SPDscUpdatedProcessID = $true } ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Deploy ` - -Value {} ` - -PassThru - }) - } } + Name = "AppFabricCachingService" + ProcessIdentity = New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name ManagedAccount ` + -Value $null ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name CurrentIdentityType ` + -Value $null ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { $global:SPDscUpdatedProcessID = $true } ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Deploy ` + -Value { } ` + -PassThru + }) + } } Mock -CommandName Stop-SPServiceInstance -MockWith { $Global:SPDscDCacheOnline = $false } @@ -80,62 +80,62 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { if ($Global:SPDscDCacheOnline -eq $false) { return @(New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Status ` - -Value "Disabled" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name Service ` - -Value "SPDistributedCacheService Name=AppFabricCachingService" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name Server ` - -Value @{ - Name = $env:COMPUTERNAME - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value {} ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SPDistributedCacheServiceInstance" ` - -PassThru - } -PassThru -Force) + Add-Member -MemberType NoteProperty ` + -Name Status ` + -Value "Disabled" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name Service ` + -Value "SPDistributedCacheService Name=AppFabricCachingService" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name Server ` + -Value @{ + Name = $env:COMPUTERNAME + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Delete ` + -Value { } ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SPDistributedCacheServiceInstance" ` + -PassThru + } -PassThru -Force) } else { return @(New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Status ` - -Value "Online" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name Service ` - -Value "SPDistributedCacheService Name=AppFabricCachingService" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name Server ` - -Value @{ - Name = $env:COMPUTERNAME - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value {} ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SPDistributedCacheServiceInstance" ` - -PassThru - } -PassThru -Force) + Add-Member -MemberType NoteProperty ` + -Name Status ` + -Value "Online" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name Service ` + -Value "SPDistributedCacheService Name=AppFabricCachingService" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name Server ` + -Value @{ + Name = $env:COMPUTERNAME + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Delete ` + -Value { } ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SPDistributedCacheServiceInstance" ` + -PassThru + } -PassThru -Force) } } @@ -177,79 +177,79 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { CreateFirewallRules = $true } - Mock -CommandName Start-Sleep -MockWith {} + Mock -CommandName Start-Sleep -MockWith { } Mock -CommandName Use-CacheCluster -MockWith { throw [Exception] "ERRPS001 Error in reading provider and connection string values." } - Mock -CommandName Stop-SPServiceInstance -MockWith {} - Mock -CommandName Start-SPServiceInstance -MockWith {} + Mock -CommandName Stop-SPServiceInstance -MockWith { } + Mock -CommandName Start-SPServiceInstance -MockWith { } Mock -CommandName Get-SPServiceInstance -MockWith { switch ($Global:SPDscRunCount) { - { 0,3,4,5 -contains $_ } - { - $Global:SPDscRunCount++ - return @(New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Status ` - -Value "Disabled" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name Service ` - -Value "SPDistributedCacheService Name=AppFabricCachingService" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name Server ` - -Value @{ - Name = $env:COMPUTERNAME - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value {} ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SPDistributedCacheServiceInstance" ` - -PassThru - } -PassThru -Force) - } - { 1,2,6,7 -contains $_ } - { - $Global:SPDscRunCount = $Global:SPDscRunCount + 1 - return @(New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Status ` - -Value "Online" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name Service ` - -Value "SPDistributedCacheService Name=AppFabricCachingService" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name Server ` - -Value @{ - Name = $env:COMPUTERNAME - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value {} ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SPDistributedCacheServiceInstance" ` - -PassThru - } -PassThru -Force) - } + { 0, 3, 4, 5 -contains $_ } + { + $Global:SPDscRunCount++ + return @(New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Status ` + -Value "Disabled" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name Service ` + -Value "SPDistributedCacheService Name=AppFabricCachingService" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name Server ` + -Value @{ + Name = $env:COMPUTERNAME + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Delete ` + -Value { } ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SPDistributedCacheServiceInstance" ` + -PassThru + } -PassThru -Force) + } + { 1, 2, 6, 7 -contains $_ } + { + $Global:SPDscRunCount = $Global:SPDscRunCount + 1 + return @(New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Status ` + -Value "Online" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name Service ` + -Value "SPDistributedCacheService Name=AppFabricCachingService" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name Server ` + -Value @{ + Name = $env:COMPUTERNAME + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Delete ` + -Value { } ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SPDistributedCacheServiceInstance" ` + -PassThru + } -PassThru -Force) + } } } @@ -270,11 +270,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { CreateFirewallRules = $true } - Mock -CommandName Start-Sleep -MockWith {} + Mock -CommandName Start-Sleep -MockWith { } Mock -CommandName Get-CimInstance -MockWith { return @{ - Domain = "contoso.com" + Domain = "contoso.com" } } Mock -CommandName Use-CacheCluster -MockWith { @@ -318,7 +318,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { CreateFirewallRules = $true } - Mock -CommandName Start-Sleep -MockWith {} + Mock -CommandName Start-Sleep -MockWith { } Mock -CommandName Get-CimInstance -MockWith { return @{ @@ -444,73 +444,73 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { PortNo = 22233 } } - Mock -CommandName Start-Sleep -MockWith {} + Mock -CommandName Start-Sleep -MockWith { } Mock -CommandName Get-SPServiceInstance -MockWith { switch ($Global:SPDscRunCount) { - { 0,3,4,5 -contains $_ } - { - $Global:SPDscRunCount++ - return @(New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Status ` - -Value "Disabled" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name Service ` - -Value "SPDistributedCacheService Name=AppFabricCachingService" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name Server ` - -Value @{ - Name = $env:COMPUTERNAME - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value {} ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SPDistributedCacheServiceInstance" ` - -PassThru - } -PassThru -Force) - } - { 1,2,6,7 -contains $_ } - { - $Global:SPDscRunCount = $Global:SPDscRunCount + 1 - return @(New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Status ` - -Value "Online" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name Service ` - -Value "SPDistributedCacheService Name=AppFabricCachingService" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name Server ` - -Value @{ - Name = $env:COMPUTERNAME - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value {} ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SPDistributedCacheServiceInstance" ` - -PassThru - } -PassThru -Force) - } + { 0, 3, 4, 5 -contains $_ } + { + $Global:SPDscRunCount++ + return @(New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Status ` + -Value "Disabled" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name Service ` + -Value "SPDistributedCacheService Name=AppFabricCachingService" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name Server ` + -Value @{ + Name = $env:COMPUTERNAME + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Delete ` + -Value { } ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SPDistributedCacheServiceInstance" ` + -PassThru + } -PassThru -Force) + } + { 1, 2, 6, 7 -contains $_ } + { + $Global:SPDscRunCount = $Global:SPDscRunCount + 1 + return @(New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Status ` + -Value "Online" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name Service ` + -Value "SPDistributedCacheService Name=AppFabricCachingService" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name Server ` + -Value @{ + Name = $env:COMPUTERNAME + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Delete ` + -Value { } ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SPDistributedCacheServiceInstance" ` + -PassThru + } -PassThru -Force) + } } } @@ -576,7 +576,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } Mock -CommandName Get-NetFirewallRule -MockWith { - return @{} + return @{ } } Mock -CommandName Remove-SPDistributedCacheServiceInstance -MockWith { } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPExcelServiceApp.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPExcelServiceApp.Tests.ps1 index 3f4b2c13f..70f0ac480 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPExcelServiceApp.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPExcelServiceApp.Tests.ps1 @@ -1,31 +1,32 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPExcelServiceApp" + -DscResource "SPExcelServiceApp" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope # Initialize tests - $getTypeFullName = "Microsoft.Office.Excel.Server.MossHost.ExcelServerWebServiceApplication" + $getTypeFullName = "Microsoft.Office.Excel.Server.MossHost.ExcelServerWebServiceApplication" # Test contexts - switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) + switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { - # Mocks for all contexts + 15 + { + # Mocks for all contexts Mock -CommandName Remove-SPServiceApplication -MockWith { } Mock -CommandName New-SPExcelServiceApplication -MockWith { } Mock -CommandName Get-SPExcelFileLocation -MockWith { } @@ -36,12 +37,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When no service applications exist in the current farm" -Fixture { $testParams = @{ - Name = "Test Excel Services App" + Name = "Test Excel Services App" ApplicationPool = "Test App Pool" } - Mock -CommandName Get-SPServiceApplication -MockWith { - return $null + Mock -CommandName Get-SPServiceApplication -MockWith { + return $null } It "Should return absent from the Get method" { @@ -54,113 +55,113 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should create a new service application in the set method" { Set-TargetResource @testParams - Assert-MockCalled New-SPExcelServiceApplication + Assert-MockCalled New-SPExcelServiceApplication } } Context -Name "When service applications exist in the current farm but the specific Excel Services app does not" -Fixture { $testParams = @{ - Name = "Test Excel Services App" + Name = "Test Excel Services App" ApplicationPool = "Test App Pool" } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - } + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + DisplayName = $testParams.Name + } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "Microsoft.Office.UnKnownWebServiceApplication" - } - } -PassThru -Force - return $spServiceApp + -Name GetType ` + -Value { + return @{ + FullName = "Microsoft.Office.UnKnownWebServiceApplication" + } + } -PassThru -Force + return $spServiceApp } Mock -CommandName Get-SPServiceApplication -MockWith { return @(@{ - TypeName = "Some other service app type" - }) } + TypeName = "Some other service app type" + }) } It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } } Context -Name "When a service application exists and is configured correctly" -Fixture { $testParams = @{ - Name = "Test Excel Services App" + Name = "Test Excel Services App" ApplicationPool = "Test App Pool" } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - TypeName = "Excel Services Application Web Service Application" - DisplayName = $testParams.Name + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + TypeName = "Excel Services Application Web Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } It "Should return values from the get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Present" + (Get-TargetResource @testParams).Ensure | Should Be "Present" } It "Should return true when the Test method is called" { Test-TargetResource @testParams | Should Be $true } } - + Context -Name "When the service application exists but it shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "-" - Ensure = "Absent" + Ensure = "Absent" } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - TypeName = "Excel Services Application Web Service Application" - DisplayName = $testParams.Name + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + TypeName = "Excel Services Application Web Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } - + It "Should return present from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Present" + (Get-TargetResource @testParams).Ensure | Should Be "Present" } - + It "Should return false when the Test method is called" { Test-TargetResource @testParams | Should Be $false } - + It "Should call the remove service application cmdlet in the set method" { Set-TargetResource @testParams Assert-MockCalled Remove-SPServiceApplication } } - + Context -Name "When the service application doesn't exist and it shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "-" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication -MockWith { return $null } - + It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - + It "Should return true when the Test method is called" { Test-TargetResource @testParams | Should Be $true } @@ -168,30 +169,30 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service app should have trusted locations, but doesn't" -Fixture { $testParams = @{ - Name = "Test Excel Services App" - ApplicationPool = "Test App Pool" + Name = "Test Excel Services App" + ApplicationPool = "Test App Pool" TrustedFileLocations = @( (New-CimInstance -ClassName MSFT_SPExcelFileLocation -ClientOnly -Property @{ - Address = "http://" - LocationType = "SharePoint" - WorkbookSizeMax = 10 - }) + Address = "http://" + LocationType = "SharePoint" + WorkbookSizeMax = 10 + }) ) } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - TypeName = "Excel Services Application Web Service Application" - DisplayName = $testParams.Name + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + TypeName = "Excel Services Application Web Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } - Mock -CommandName Get-SPExcelFileLocation -MockWith { + Mock -CommandName Get-SPExcelFileLocation -MockWith { return @() } @@ -211,35 +212,35 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service app should have trusted locations, but the settings don't match" -Fixture { $testParams = @{ - Name = "Test Excel Services App" - ApplicationPool = "Test App Pool" + Name = "Test Excel Services App" + ApplicationPool = "Test App Pool" TrustedFileLocations = @( (New-CimInstance -ClassName MSFT_SPExcelFileLocation -ClientOnly -Property @{ - Address = "http://" - LocationType = "SharePoint" - WorkbookSizeMax = 10 - }) + Address = "http://" + LocationType = "SharePoint" + WorkbookSizeMax = 10 + }) ) } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - TypeName = "Excel Services Application Web Service Application" - DisplayName = $testParams.Name + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + TypeName = "Excel Services Application Web Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } - Mock -CommandName Get-SPExcelFileLocation -MockWith { + Mock -CommandName Get-SPExcelFileLocation -MockWith { return @(@{ - Address = "http://" - LocationType = "SharePoint" - WorkbookSizeMax = 2 - }) + Address = "http://" + LocationType = "SharePoint" + WorkbookSizeMax = 2 + }) } It "Should return trusted location results from the get method" { @@ -258,35 +259,35 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service app should have trusted locations, and does" -Fixture { $testParams = @{ - Name = "Test Excel Services App" - ApplicationPool = "Test App Pool" + Name = "Test Excel Services App" + ApplicationPool = "Test App Pool" TrustedFileLocations = @( (New-CimInstance -ClassName MSFT_SPExcelFileLocation -ClientOnly -Property @{ - Address = "http://" - LocationType = "SharePoint" - WorkbookSizeMax = 10 - }) + Address = "http://" + LocationType = "SharePoint" + WorkbookSizeMax = 10 + }) ) } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - TypeName = "Excel Services Application Web Service Application" - DisplayName = $testParams.Name + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + TypeName = "Excel Services Application Web Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } - Mock -CommandName Get-SPExcelFileLocation -MockWith { + Mock -CommandName Get-SPExcelFileLocation -MockWith { return @(@{ - Address = "http://" - LocationType = "SharePoint" - WorkbookSizeMax = 10 - }) + Address = "http://" + LocationType = "SharePoint" + WorkbookSizeMax = 10 + }) } It "Should return trusted location results from the get method" { @@ -300,40 +301,40 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service app should have trusted locations, and does but also has an extra one that should be removed" -Fixture { $testParams = @{ - Name = "Test Excel Services App" - ApplicationPool = "Test App Pool" + Name = "Test Excel Services App" + ApplicationPool = "Test App Pool" TrustedFileLocations = @( (New-CimInstance -ClassName MSFT_SPExcelFileLocation -ClientOnly -Property @{ - Address = "http://" - LocationType = "SharePoint" - WorkbookSizeMax = 10 - }) + Address = "http://" + LocationType = "SharePoint" + WorkbookSizeMax = 10 + }) ) } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - TypeName = "Excel Services Application Web Service Application" - DisplayName = $testParams.Name + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + TypeName = "Excel Services Application Web Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } - Mock -CommandName Get-SPExcelFileLocation -MockWith { + Mock -CommandName Get-SPExcelFileLocation -MockWith { return @(@{ - Address = "http://" - LocationType = "SharePoint" - WorkbookSizeMax = 10 - }, - @{ - Address = "https://" - LocationType = "SharePoint" - WorkbookSizeMax = 10 - }) + Address = "http://" + LocationType = "SharePoint" + WorkbookSizeMax = 10 + }, + @{ + Address = "https://" + LocationType = "SharePoint" + WorkbookSizeMax = 10 + }) } It "Should return trusted location results from the get method" { @@ -350,7 +351,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - 16 { + 16 + { Context -Name "All methods throw exceptions as Excel Services doesn't exist in 2016/2019" -Fixture { It "Should throw on the get method" { { Get-TargetResource @testParams } | Should Throw @@ -365,7 +367,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPFarm.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPFarm.Tests.ps1 index f6a05fd84..2395f3221 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPFarm.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPFarm.Tests.ps1 @@ -3,27 +3,27 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPFarm" + -DscResource "SPFarm" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope -# Initialize tests + # Initialize tests $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force $mockFarmAccount = New-Object -TypeName "System.Management.Automation.PSCredential" ` - -ArgumentList @("username", $mockPassword) + -ArgumentList @("username", $mockPassword) $mockPassphrase = New-Object -TypeName "System.Management.Automation.PSCredential" ` - -ArgumentList @("PASSPHRASEUSER", $mockPassword) + -ArgumentList @("PASSPHRASEUSER", $mockPassword) $modulePath = "Modules\SharePointDsc\Modules\SharePointDsc.Farm\SPFarm.psm1" Import-Module -Name (Join-Path -Path $Global:SPDscHelper.RepoRoot -ChildPath $modulePath -Resolve) @@ -120,14 +120,6 @@ namespace Microsoft.SharePoint.Administration { RunCentralAdmin = $true } - It "Should throw exception in the get method" { - { Get-TargetResource @testParams } | Should Throw "CentralAdministrationUrl is not a valid URI. It should include the scheme (http/https) and address." - } - - It "Should throw exception in the test method" { - { Test-TargetResource @testParams } | Should Throw "CentralAdministrationUrl is not a valid URI. It should include the scheme (http/https) and address." - } - It "Should throw exception in the set method" { { Set-TargetResource @testParams } | Should Throw "CentralAdministrationUrl is not a valid URI. It should include the scheme (http/https) and address." } @@ -147,21 +139,13 @@ namespace Microsoft.SharePoint.Administration { RunCentralAdmin = $true } - It "Should throw exception in the get method" { - { Get-TargetResource @testParams } | Should Throw "CentralAdministrationUrl should not specify port. Use CentralAdministrationPort instead." - } - - It "Should throw exception in the test method" { - { Test-TargetResource @testParams } | Should Throw "CentralAdministrationUrl should not specify port. Use CentralAdministrationPort instead." - } - It "Should throw exception in the set method" { { Set-TargetResource @testParams } | Should Throw "CentralAdministrationUrl should not specify port. Use CentralAdministrationPort instead." } } Context -Name "Invalid CA URL has been passed in (HTTP currently not supported)" -Fixture { - $testParams = @{ + $testParams = @{ IsSingleInstance = "Yes" Ensure = "Present" FarmConfigDatabaseName = "SP_Config" @@ -174,14 +158,6 @@ namespace Microsoft.SharePoint.Administration { RunCentralAdmin = $true } - It "Should throw exception in the get method" { - { Get-TargetResource @testParams } | Should Throw "CentralAdministrationUrl parameter can only be used with HTTPS" - } - - It "Should throw exception in the test method" { - { Test-TargetResource @testParams } | Should Throw "CentralAdministrationUrl parameter can only be used with HTTPS" - } - It "Should throw exception in the set method" { { Set-TargetResource @testParams } | Should Throw "CentralAdministrationUrl parameter can only be used with HTTPS" } @@ -298,9 +274,9 @@ namespace Microsoft.SharePoint.Administration { Mock -CommandName "Get-SPFarm" -MockWith { return $null } Mock -CommandName "Get-SPDscConfigDBStatus" -MockWith { return @{ - Locked = $false + Locked = $false ValidPermissions = $true - DatabaseExists = $true + DatabaseExists = $true } } Mock -CommandName "Get-SPDscSQLInstanceStatus" -MockWith { @@ -326,20 +302,20 @@ namespace Microsoft.SharePoint.Administration { $null | Add-Member -MemberType ScriptMethod ` -Name GetType ` -Value { - return @{ - Name = "SPWebServiceInstance" - } - } -PassThru -Force | Add-Member -Name Name ` - -MemberType ScriptProperty ` - -PassThru ` - { - # get - "" - }` - { - # set - param ( $arg ) - } + return @{ + Name = "SPWebServiceInstance" + } + } -PassThru -Force | Add-Member -Name Name ` + -MemberType ScriptProperty ` + -PassThru ` + { + # get + "" + }` + { + # set + param ( $arg ) + } ) } else @@ -353,8 +329,8 @@ namespace Microsoft.SharePoint.Administration { return @{ IsAdministrationWebApplication = $true ContentDatabases = @(@{ - Name = $testParams.AdminContentDatabaseName - }) + Name = $testParams.AdminContentDatabaseName + }) Url = "http://localhost:9999" } } @@ -410,10 +386,10 @@ namespace Microsoft.SharePoint.Administration { Mock -CommandName "Get-SPWebApplication" -MockWith { return @{ IsAdministrationWebApplication = $true - ContentDatabases = @(@{ - Name = $testParams.AdminContentDatabaseName - }) - Url = "http://localhost:9999" + ContentDatabases = @(@{ + Name = $testParams.AdminContentDatabaseName + }) + Url = "http://localhost:9999" } } Mock -CommandName "Get-SPServiceInstance" -MockWith { @@ -423,12 +399,12 @@ namespace Microsoft.SharePoint.Administration { @{ Name = "WSS_Administration" } | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - Name = "SPWebServiceInstance" - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + Name = "SPWebServiceInstance" + } + } -PassThru -Force ) } else @@ -556,20 +532,20 @@ namespace Microsoft.SharePoint.Administration { } Mock -CommandName Get-SPDatabase -MockWith { return @(@{ - Name = $testParams.FarmConfigDatabaseName - Type = "Configuration Database" - NormalizedDataSource = $testParams.DatabaseServer - }) + Name = $testParams.FarmConfigDatabaseName + Type = "Configuration Database" + NormalizedDataSource = $testParams.DatabaseServer + }) } Mock -CommandName Get-SPWebApplication -MockWith { return @{ IsAdministrationWebApplication = $true ContentDatabases = @(@{ - Name = $testParams.AdminContentDatabaseName - }) + Name = $testParams.AdminContentDatabaseName + }) IISSettings = @(@{ - DisableKerberos = $true - }) + DisableKerberos = $true + }) Url = "http://localhost:9999" } } @@ -583,26 +559,26 @@ namespace Microsoft.SharePoint.Administration { switch ($global:SPDscSIRunCount) { { 2 -contains $_ } - { - $global:SPDscSIRunCount++ - return @( - @{ - Name = "WSS_Administration" - Status = "Online" - } | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - Name = "SPWebServiceInstance" - } - } -PassThru -Force - ) - } - { 0,1 -contains $_ } - { - $global:SPDscSIRunCount++ - return $null - } + { + $global:SPDscSIRunCount++ + return @( + @{ + Name = "WSS_Administration" + Status = "Online" + } | Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + return @{ + Name = "SPWebServiceInstance" + } + } -PassThru -Force + ) + } + { 0, 1 -contains $_ } + { + $global:SPDscSIRunCount++ + return $null + } } } @@ -658,20 +634,20 @@ namespace Microsoft.SharePoint.Administration { } Mock -CommandName Get-SPDatabase -MockWith { return @(@{ - Name = $testParams.FarmConfigDatabaseName - Type = "Configuration Database" - NormalizedDataSource = $testParams.DatabaseServer - }) + Name = $testParams.FarmConfigDatabaseName + Type = "Configuration Database" + NormalizedDataSource = $testParams.DatabaseServer + }) } Mock -CommandName Get-SPWebApplication -MockWith { return @{ IsAdministrationWebApplication = $true ContentDatabases = @(@{ - Name = $testParams.AdminContentDatabaseName - }) + Name = $testParams.AdminContentDatabaseName + }) IISSettings = @(@{ - DisableKerberos = $true - }) + DisableKerberos = $true + }) Url = "http://localhost:9999" } } @@ -687,16 +663,16 @@ namespace Microsoft.SharePoint.Administration { Name = "WSS_Administration" Status = "Online" } | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - Name = "SPWebServiceInstance" - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + Name = "SPWebServiceInstance" + } + } -PassThru -Force ) } - Mock -CommandName Set-SPCentralAdministration -MockWith {} + Mock -CommandName Set-SPCentralAdministration -MockWith { } It "Should return 9999 as CA Port from the get method" { (Get-TargetResource @testParams).CentralAdministrationPort | Should Be 9999 @@ -753,10 +729,10 @@ namespace Microsoft.SharePoint.Administration { } Mock -CommandName Get-SPDatabase -MockWith { return @(@{ - Name = $testParams.FarmConfigDatabaseName - Type = "Configuration Database" - NormalizedDataSource = $testParams.DatabaseServer - }) + Name = $testParams.FarmConfigDatabaseName + Type = "Configuration Database" + NormalizedDataSource = $testParams.DatabaseServer + }) } Mock -CommandName Get-SPWebApplication -MockWith { $webapp = @{ @@ -773,7 +749,7 @@ namespace Microsoft.SharePoint.Administration { SecureBindings = @( @{ HostHeader = "different.contoso.com" - Port = "443" + Port = "443" } ) } @@ -804,26 +780,26 @@ namespace Microsoft.SharePoint.Administration { switch ($global:SPDscSIRunCount) { { 2 -contains $_ } - { - $global:SPDscSIRunCount++ - return @( - @{ - Name = "WSS_Administration" - Status = "Online" - } | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - Name = "SPWebServiceInstance" - } - } -PassThru -Force - ) - } - { 0,1 -contains $_ } - { - $global:SPDscSIRunCount++ - return $null - } + { + $global:SPDscSIRunCount++ + return @( + @{ + Name = "WSS_Administration" + Status = "Online" + } | Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + return @{ + Name = "SPWebServiceInstance" + } + } -PassThru -Force + ) + } + { 0, 1 -contains $_ } + { + $global:SPDscSIRunCount++ + return $null + } } } @@ -879,8 +855,8 @@ namespace Microsoft.SharePoint.Administration { return @{ IsAdministrationWebApplication = $true ContentDatabases = @(@{ - Name = $testParams.AdminContentDatabaseName - }) + Name = $testParams.AdminContentDatabaseName + }) Url = "http://localhost:9999" } } @@ -891,12 +867,12 @@ namespace Microsoft.SharePoint.Administration { @{ Name = "WSS_Administration" } | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - Name = "SPWebServiceInstance" - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + Name = "SPWebServiceInstance" + } + } -PassThru -Force ) } else @@ -964,10 +940,10 @@ namespace Microsoft.SharePoint.Administration { } Mock -CommandName Get-SPDatabase -MockWith { return @(@{ - Name = $testParams.FarmConfigDatabaseName - Type = "Configuration Database" - NormalizedDataSource = $testParams.DatabaseServer - }) + Name = $testParams.FarmConfigDatabaseName + Type = "Configuration Database" + NormalizedDataSource = $testParams.DatabaseServer + }) } Mock -CommandName Get-SPWebApplication -MockWith { $webapp = @{ @@ -1014,26 +990,26 @@ namespace Microsoft.SharePoint.Administration { switch ($global:SPDscSIRunCount) { { 2 -contains $_ } - { - $global:SPDscSIRunCount++ - return @( - @{ - Name = "WSS_Administration" - Status = "Online" - } | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - Name = "SPWebServiceInstance" - } - } -PassThru -Force - ) - } - { 0,1 -contains $_ } - { - $global:SPDscSIRunCount++ - return $null - } + { + $global:SPDscSIRunCount++ + return @( + @{ + Name = "WSS_Administration" + Status = "Online" + } | Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + return @{ + Name = "SPWebServiceInstance" + } + } -PassThru -Force + ) + } + { 0, 1 -contains $_ } + { + $global:SPDscSIRunCount++ + return $null + } } } @@ -1096,51 +1072,51 @@ namespace Microsoft.SharePoint.Administration { } Mock -CommandName "Get-SPDatabase" -MockWith { return @(@{ - Name = $testParams.FarmConfigDatabaseName - Type = "Configuration Database" - NormalizedDataSource = $testParams.DatabaseServer - }) + Name = $testParams.FarmConfigDatabaseName + Type = "Configuration Database" + NormalizedDataSource = $testParams.DatabaseServer + }) } Mock -CommandName "Get-SPWebApplication" -MockWith { return @{ IsAdministrationWebApplication = $true ContentDatabases = @(@{ - Name = $testParams.AdminContentDatabaseName - }) + Name = $testParams.AdminContentDatabaseName + }) IISSettings = @(@{ - DisableKerberos = $true - }) + DisableKerberos = $true + }) Url = "http://localhost:9999" } } - Mock -CommandName Start-Sleep -MockWith {} + Mock -CommandName Start-Sleep -MockWith { } Mock -CommandName Get-SPServiceInstance -MockWith { switch ($global:SPDscSIRunCount) { - { 0,2 -contains $_ } - { - $global:SPDscSIRunCount++ - return @( - @{ - Name = "WSS_Administration" - Status = "Online" - } | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - Name = "SPWebServiceInstance" - } - } -PassThru -Force - ) - } + { 0, 2 -contains $_ } + { + $global:SPDscSIRunCount++ + return @( + @{ + Name = "WSS_Administration" + Status = "Online" + } | Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + return @{ + Name = "SPWebServiceInstance" + } + } -PassThru -Force + ) + } { 1 -contains $_ } - { - $global:SPDscSIRunCount++ - return $null - } + { + $global:SPDscSIRunCount++ + return $null + } } } - Mock -CommandName "Stop-SPServiceInstance" -MockWith {} + Mock -CommandName "Stop-SPServiceInstance" -MockWith { } $global:SPDscSIRunCount = 0 It "Should return present from the get method" { @@ -1201,20 +1177,20 @@ namespace Microsoft.SharePoint.Administration { } Mock -CommandName "Get-SPDatabase" -MockWith { return @(@{ - Name = $testParams.FarmConfigDatabaseName - Type = "Configuration Database" - NormalizedDataSource = $testParams.DatabaseServer - }) + Name = $testParams.FarmConfigDatabaseName + Type = "Configuration Database" + NormalizedDataSource = $testParams.DatabaseServer + }) } Mock -CommandName "Get-SPWebApplication" -MockWith { return @{ IsAdministrationWebApplication = $true ContentDatabases = @(@{ - Name = $testParams.AdminContentDatabaseName - }) + Name = $testParams.AdminContentDatabaseName + }) IISSettings = @(@{ - DisableKerberos = $true - }) + DisableKerberos = $true + }) Url = "http://localhost:9999" } } @@ -1226,12 +1202,12 @@ namespace Microsoft.SharePoint.Administration { Name = "WSS_Administration" Status = "Online" } | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - Name = "SPWebServiceInstance" - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + Name = "SPWebServiceInstance" + } + } -PassThru -Force ) } else @@ -1295,20 +1271,20 @@ namespace Microsoft.SharePoint.Administration { } Mock -CommandName "Get-SPDatabase" -MockWith { return @(@{ - Name = $testParams.FarmConfigDatabaseName - Type = "Configuration Database" - NormalizedDataSource = $testParams.DatabaseServer - }) + Name = $testParams.FarmConfigDatabaseName + Type = "Configuration Database" + NormalizedDataSource = $testParams.DatabaseServer + }) } Mock -CommandName "Get-SPWebApplication" -MockWith { return @{ IsAdministrationWebApplication = $true ContentDatabases = @(@{ - Name = $testParams.AdminContentDatabaseName - }) + Name = $testParams.AdminContentDatabaseName + }) IISSettings = @(@{ - DisableKerberos = $true - }) + DisableKerberos = $true + }) Url = "http://localhost:9999" } } @@ -1320,12 +1296,12 @@ namespace Microsoft.SharePoint.Administration { Name = "WSS_Administration" Status = "Online" } | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - Name = "SPWebServiceInstance" - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + Name = "SPWebServiceInstance" + } + } -PassThru -Force ) } else @@ -1378,7 +1354,7 @@ namespace Microsoft.SharePoint.Administration { FarmConfigDatabaseName = "SP_Config" DatabaseServer = "DatabaseServer\Instance" FarmAccount = $mockFarmAccount - Passphrase = $mockPassphrase + Passphrase = $mockPassphrase AdminContentDatabaseName = "Admin_Content" CentralAdministrationAuth = "Kerberos" CentralAdministrationPort = 1234 @@ -1438,27 +1414,27 @@ namespace Microsoft.SharePoint.Administration { } Mock -CommandName "Get-SPDatabase" -MockWith { return @(@{ - Name = $testParams.FarmConfigDatabaseName - Type = "Configuration Database" - Server = @{ - Name = $testParams.DatabaseServer - } - }) + Name = $testParams.FarmConfigDatabaseName + Type = "Configuration Database" + Server = @{ + Name = $testParams.DatabaseServer + } + }) } Mock -CommandName "Get-SPWebApplication" -MockWith { return @{ IsAdministrationWebApplication = $true ContentDatabases = @(@{ - Name = $testParams.AdminContentDatabaseName - }) + Name = $testParams.AdminContentDatabaseName + }) IISSettings = @(@{ - DisableKerberos = $true - }) + DisableKerberos = $true + }) Url = "http://localhost:9999" } } - Mock -CommandName Get-SPServer -MockWith{ + Mock -CommandName Get-SPServer -MockWith { return @{ Name = "spwfe" Role = "WebFrontEnd" @@ -1467,7 +1443,7 @@ namespace Microsoft.SharePoint.Administration { Mock -CommandName Get-SPDscInstalledProductVersion -MockWith { return @{ FileMajorPart = 15 } } - It "Should return WebFrontEnd from the get method"{ + It "Should return WebFrontEnd from the get method" { (Get-TargetResource @testParams).ServerRole | Should Be $null } } @@ -1482,7 +1458,7 @@ namespace Microsoft.SharePoint.Administration { FarmConfigDatabaseName = "SP_Config" DatabaseServer = "DatabaseServer\Instance" FarmAccount = $mockFarmAccount - Passphrase = $mockPassphrase + Passphrase = $mockPassphrase AdminContentDatabaseName = "Admin_Content" CentralAdministrationAuth = "Kerberos" CentralAdministrationPort = 1234 @@ -1597,20 +1573,20 @@ namespace Microsoft.SharePoint.Administration { } Mock -CommandName "Get-SPDatabase" -MockWith { return @(@{ - Name = $testParams.FarmConfigDatabaseName - Type = "Configuration Database" - NormalizedDataSource = $testParams.DatabaseServer - }) + Name = $testParams.FarmConfigDatabaseName + Type = "Configuration Database" + NormalizedDataSource = $testParams.DatabaseServer + }) } Mock -CommandName "Get-SPWebApplication" -MockWith { return @{ IsAdministrationWebApplication = $true ContentDatabases = @(@{ - Name = $testParams.AdminContentDatabaseName - }) + Name = $testParams.AdminContentDatabaseName + }) IISSettings = @(@{ - DisableKerberos = $true - }) + DisableKerberos = $true + }) Url = "http://localhost:9999" } } @@ -1622,12 +1598,12 @@ namespace Microsoft.SharePoint.Administration { Name = "WSS_Administration" Status = "Online" } | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - Name = "SPWebServiceInstance" - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + Name = "SPWebServiceInstance" + } + } -PassThru -Force ) } else @@ -1689,26 +1665,26 @@ namespace Microsoft.SharePoint.Administration { } Mock -CommandName "Get-SPDatabase" -MockWith { return @(@{ - Name = $testParams.FarmConfigDatabaseName - Type = "Configuration Database" - Server = @{ - Name = $testParams.DatabaseServer - } - }) + Name = $testParams.FarmConfigDatabaseName + Type = "Configuration Database" + Server = @{ + Name = $testParams.DatabaseServer + } + }) } Mock -CommandName "Get-SPWebApplication" -MockWith { return @{ IsAdministrationWebApplication = $true ContentDatabases = @(@{ - Name = $testParams.AdminContentDatabaseName - }) + Name = $testParams.AdminContentDatabaseName + }) IISSettings = @(@{ - DisableKerberos = $true - }) + DisableKerberos = $true + }) Url = "http://localhost:9999" } } - Mock -CommandName Get-SPServer -MockWith{ + Mock -CommandName Get-SPServer -MockWith { return @{ Name = "spwfe" Role = "WebFrontEnd" @@ -1717,7 +1693,7 @@ namespace Microsoft.SharePoint.Administration { Mock -CommandName Get-SPDscInstalledProductVersion -MockWith { return @{ FileMajorPart = 16; ProductBuildPart = 4700 } } - It "Should return WebFrontEnd from the get method"{ + It "Should return WebFrontEnd from the get method" { (Get-TargetResource @testParams).ServerRole | Should Be "WebFrontEnd" } } @@ -1786,12 +1762,12 @@ namespace Microsoft.SharePoint.Administration { Name = "WSS_Administration" Status = "Online" } | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - Name = "SPWebServiceInstance" - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + Name = "SPWebServiceInstance" + } + } -PassThru -Force ) } else @@ -1862,20 +1838,20 @@ namespace Microsoft.SharePoint.Administration { } Mock -CommandName "Get-SPDatabase" -MockWith { return @(@{ - Name = $testParams.FarmConfigDatabaseName - Type = "Configuration Database" - NormalizedDataSource = $testParams.DatabaseServer - }) + Name = $testParams.FarmConfigDatabaseName + Type = "Configuration Database" + NormalizedDataSource = $testParams.DatabaseServer + }) } Mock -CommandName "Get-SPWebApplication" -MockWith { return @{ IsAdministrationWebApplication = $true ContentDatabases = @(@{ - Name = $testParams.AdminContentDatabaseName - }) + Name = $testParams.AdminContentDatabaseName + }) IISSettings = @(@{ - DisableKerberos = $true - }) + DisableKerberos = $true + }) Url = "http://localhost:9999" } } @@ -1887,12 +1863,12 @@ namespace Microsoft.SharePoint.Administration { Name = "WSS_Administration" Status = "Online" } | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - Name = "SPWebServiceInstance" - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + Name = "SPWebServiceInstance" + } + } -PassThru -Force ) } else diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPFarmAdministrators.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPFarmAdministrators.Tests.ps1 index aa79e4079..0ee983050 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPFarmAdministrators.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPFarmAdministrators.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPFarmAdministrators" + -DscResource "SPFarmAdministrators" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -22,7 +22,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "No central admin site exists" { $testParams = @{ IsSingleInstance = "Yes" - Members = @("Demo\User1", "Demo\User2") + Members = @("Demo\User1", "Demo\User2") } Mock -CommandName Get-SPwebapplication -MockWith { return $null } @@ -43,29 +43,29 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Central admin exists and a fixed members list is used which matches" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - Members = @("Demo\User1", "Demo\User2") + Members = @("Demo\User1", "Demo\User2") } Mock -CommandName Get-SPWebApplication -MockWith { return @{ IsAdministrationWebApplication = $true - Url = "http://admin.shareopoint.contoso.local" + Url = "http://admin.shareopoint.contoso.local" } } Mock -CommandName Get-SPWeb -MockWith { return @{ AssociatedOwnerGroup = "Farm Administrators" - SiteGroups = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name GetByName ` - -Value { - return @{ - Users = @( - @{ UserLogin = "Demo\User1" }, - @{ UserLogin = "Demo\User2" } - ) - } - } -PassThru + SiteGroups = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name GetByName ` + -Value { + return @{ + Users = @( + @{ UserLogin = "Demo\User1" }, + @{ UserLogin = "Demo\User2" } + ) + } + } -PassThru } } @@ -81,48 +81,48 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Central admin exists and a fixed members list is used which does not match" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - Members = @("Demo\User1", "Demo\User2") + Members = @("Demo\User1", "Demo\User2") } Mock -CommandName Get-SPWebApplication -MockWith { return @{ IsAdministrationWebApplication = $true - Url = "http://admin.shareopoint.contoso.local" + Url = "http://admin.shareopoint.contoso.local" } } Mock -CommandName Get-SPWeb -MockWith { - $web = @{ + $web = @{ AssociatedOwnerGroup = "Farm Administrators" - SiteGroups = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name GetByName ` - -Value { - return New-Object -TypeName "Object" | - Add-Member -MemberType ScriptProperty ` - -Name Users ` - -Value { - return @( - @{ - UserLogin = "Demo\User1" - } - ) - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name AddUser ` - -Value { } ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name RemoveUser ` - -Value { } ` - -PassThru - } -PassThru + SiteGroups = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name GetByName ` + -Value { + return New-Object -TypeName "Object" | + Add-Member -MemberType ScriptProperty ` + -Name Users ` + -Value { + return @( + @{ + UserLogin = "Demo\User1" + } + ) + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name AddUser ` + -Value { } ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name RemoveUser ` + -Value { } ` + -PassThru + } -PassThru } return $web } Mock -CommandName Get-SPUser -MockWith { - return @{} + return @{ } } It "Should return values from the get method" { @@ -147,39 +147,39 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPwebapplication -MockWith { return @{ IsAdministrationWebApplication = $true - Url = "http://admin.shareopoint.contoso.local" + Url = "http://admin.shareopoint.contoso.local" } } Mock -CommandName Get-SPWeb -MockWith { return @{ AssociatedOwnerGroup = "Farm Administrators" - SiteGroups = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name GetByName ` - -Value { - return New-Object "Object" | - Add-Member -MemberType ScriptProperty ` - -Name Users ` - -Value { - return @( - @{ - UserLogin = "Demo\User1" - }, - @{ - UserLogin = "Demo\User2" - } - ) - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name AddUser ` - -Value { } ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name RemoveUser ` - -Value { } ` - -PassThru - } -PassThru + SiteGroups = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name GetByName ` + -Value { + return New-Object "Object" | + Add-Member -MemberType ScriptProperty ` + -Name Users ` + -Value { + return @( + @{ + UserLogin = "Demo\User1" + }, + @{ + UserLogin = "Demo\User2" + } + ) + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name AddUser ` + -Value { } ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name RemoveUser ` + -Value { } ` + -PassThru + } -PassThru } } @@ -201,36 +201,36 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPwebapplication -MockWith { return @{ IsAdministrationWebApplication = $true - Url = "http://admin.shareopoint.contoso.local" + Url = "http://admin.shareopoint.contoso.local" } } Mock -CommandName Get-SPWeb -MockWith { return @{ AssociatedOwnerGroup = "Farm Administrators" - SiteGroups = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name GetByName ` - -Value { - return New-Object "Object" | - Add-Member -MemberType ScriptProperty ` - -Name Users ` - -Value { - return @( - @{ - UserLogin = "Demo\User1" - } - ) - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name AddUser ` - -Value { } ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name RemoveUser ` - -Value { } ` - -PassThru - } -PassThru + SiteGroups = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name GetByName ` + -Value { + return New-Object "Object" | + Add-Member -MemberType ScriptProperty ` + -Name Users ` + -Value { + return @( + @{ + UserLogin = "Demo\User1" + } + ) + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name AddUser ` + -Value { } ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name RemoveUser ` + -Value { } ` + -PassThru + } -PassThru } } @@ -256,39 +256,39 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPwebapplication -MockWith { return @{ IsAdministrationWebApplication = $true - Url = "http://admin.shareopoint.contoso.local" + Url = "http://admin.shareopoint.contoso.local" } } Mock -CommandName Get-SPWeb -MockWith { return @{ AssociatedOwnerGroup = "Farm Administrators" - SiteGroups = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name GetByName ` - -Value { - return New-Object "Object" | - Add-Member -MemberType ScriptProperty ` - -Name Users ` - -Value { - return @( - @{ - UserLogin = "Demo\User1" - }, - @{ - UserLogin = "Demo\User2" - } - ) - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name AddUser ` - -Value { } ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name RemoveUser ` - -Value { } ` - -PassThru - } -PassThru + SiteGroups = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name GetByName ` + -Value { + return New-Object "Object" | + Add-Member -MemberType ScriptProperty ` + -Name Users ` + -Value { + return @( + @{ + UserLogin = "Demo\User1" + }, + @{ + UserLogin = "Demo\User2" + } + ) + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name AddUser ` + -Value { } ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name RemoveUser ` + -Value { } ` + -PassThru + } -PassThru } } @@ -313,34 +313,34 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPwebapplication -MockWith { return @{ IsAdministrationWebApplication = $true - Url = "http://admin.shareopoint.contoso.local" - }} + Url = "http://admin.shareopoint.contoso.local" + } } Mock -CommandName Get-SPWeb -MockWith { return @{ AssociatedOwnerGroup = "Farm Administrators" - SiteGroups = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name GetByName ` - -Value { - return New-Object "Object" | - Add-Member -MemberType ScriptProperty ` - -Name Users ` - -Value { - return @( - @{ - UserLogin = "Demo\User2" - } - ) - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name AddUser ` - -Value { } ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name RemoveUser ` - -Value { } ` - -PassThru - } -PassThru + SiteGroups = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name GetByName ` + -Value { + return New-Object "Object" | + Add-Member -MemberType ScriptProperty ` + -Name Users ` + -Value { + return @( + @{ + UserLogin = "Demo\User2" + } + ) + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name AddUser ` + -Value { } ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name RemoveUser ` + -Value { } ` + -PassThru + } -PassThru } } @@ -356,43 +356,43 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The resource is called with both an explicit members list as well as members to include/exclude" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - Members = @("Demo\User1") + Members = @("Demo\User1") MembersToExclude = @("Demo\User1") } Mock -CommandName Get-SPwebapplication -MockWith { return @{ IsAdministrationWebApplication = $true - Url = "http://admin.shareopoint.contoso.local" + Url = "http://admin.shareopoint.contoso.local" } } Mock -CommandName Get-SPWeb -MockWith { return @{ AssociatedOwnerGroup = "Farm Administrators" - SiteGroups = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name GetByName ` - -Value { - return New-Object "Object" | - Add-Member -MemberType ScriptProperty ` - -Name Users ` - -Value { - return @( - @{ - UserLogin = "Demo\User2" - } - ) - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name AddUser ` - -Value { } ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name RemoveUser ` - -Value { } ` - -PassThru - } -PassThru + SiteGroups = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name GetByName ` + -Value { + return New-Object "Object" | + Add-Member -MemberType ScriptProperty ` + -Name Users ` + -Value { + return @( + @{ + UserLogin = "Demo\User2" + } + ) + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name AddUser ` + -Value { } ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name RemoveUser ` + -Value { } ` + -PassThru + } -PassThru } } @@ -417,36 +417,36 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPwebapplication -MockWith { return @{ IsAdministrationWebApplication = $true - Url = "http://admin.sharepoint.contoso.local" + Url = "http://admin.sharepoint.contoso.local" } } Mock -CommandName Get-SPWeb -MockWith { return @{ AssociatedOwnerGroup = "Farm Administrators" - SiteGroups = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name GetByName ` - -Value { - return New-Object "Object" | - Add-Member -MemberType ScriptProperty ` - -Name Users ` - -Value { - return @( - @{ - UserLogin = "Demo\User2" - } - ) - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name AddUser ` - -Value { } ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name RemoveUser ` - -Value { } ` - -PassThru - } -PassThru + SiteGroups = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name GetByName ` + -Value { + return New-Object "Object" | + Add-Member -MemberType ScriptProperty ` + -Name Users ` + -Value { + return @( + @{ + UserLogin = "Demo\User2" + } + ) + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name AddUser ` + -Value { } ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name RemoveUser ` + -Value { } ` + -PassThru + } -PassThru } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPFarmPropertyBag.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPFarmPropertyBag.Tests.ps1 index 804b9e05b..6ed52b71e 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPFarmPropertyBag.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPFarmPropertyBag.Tests.ps1 @@ -1,18 +1,18 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPFarmPropertyBag" + -DscResource "SPFarmPropertyBag" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -21,12 +21,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Test contexts Context -Name 'No local SharePoint farm was detected' { $testParams = @{ - Key = 'FARM_TYPE' + Key = 'FARM_TYPE' Value = 'SearchFarm' } - Mock -CommandName Get-SPFarm -MockWith { - throw 'Unable to detect local farm' + Mock -CommandName Get-SPFarm -MockWith { + throw 'Unable to detect local farm' } $result = Get-TargetResource @testParams @@ -41,7 +41,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It 'Should return null as the value used' { $result.value | Should Be $null - } + } It 'Should return false from the test method' { Test-TargetResource @testParams | Should Be $false @@ -58,21 +58,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { FARM_TYPE = 'SearchFarm' } } - $spFarm = $spFarm | Add-Member ScriptMethod Update { - $Global:SPDscFarmPropertyUpdated = $true + $spFarm = $spFarm | Add-Member ScriptMethod Update { + $Global:SPDscFarmPropertyUpdated = $true } -PassThru - $spFarm = $spFarm | Add-Member ScriptMethod Remove { - $Global:SPDscFarmPropertyRemoved = $true + $spFarm = $spFarm | Add-Member ScriptMethod Remove { + $Global:SPDscFarmPropertyRemoved = $true } -PassThru return $spFarm } Context -Name 'The farm property does not exist, but should be' -Fixture { $testParams = @{ - Key = 'FARM_TYPE' + Key = 'FARM_TYPE' Value = 'NewSearchFarm' } - + $result = Get-TargetResource @testParams It 'Should return present from the get method' { @@ -81,7 +81,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It 'Should return the same key value as passed as parameter' { $result.Key | Should Be $testParams.Key - } + } It 'Should return false from the test method' { Test-TargetResource @testParams | Should Be $false @@ -92,8 +92,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $Global:SPDscFarmPropertyUpdated = $false - It 'Calls Get-SPFarm and update farm property bag from the set method' { - Set-TargetResource @testParams + It 'Calls Get-SPFarm and update farm property bag from the set method' { + Set-TargetResource @testParams $Global:SPDscFarmPropertyUpdated | Should Be $true } @@ -101,11 +101,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name 'The farm property exists, and should be' -Fixture { $testParams = @{ - Key = 'FARM_TYPE' - Value = 'SearchFarm' + Key = 'FARM_TYPE' + Value = 'SearchFarm' Ensure = 'Present' } - + $result = Get-TargetResource @testParams It 'Should return present from the get method' { @@ -115,7 +115,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It 'Should return the same values as passed as parameters' { $result.Key | Should Be $testParams.Key $result.value | Should Be $testParams.value - } + } It 'Should return true from the test method' { Test-TargetResource @testParams | Should Be $true @@ -124,10 +124,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name 'The farm property does not exist, and should be' -Fixture { $testParams = @{ - Key = 'FARM_TYPED' + Key = 'FARM_TYPED' Ensure = 'Absent' } - + $result = Get-TargetResource @testParams It 'Should return absent from the get method' { @@ -137,7 +137,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It 'Should return the same values as passed as parameters' { $result.Key | Should Be $testParams.Key $result.value | Should Be $testParams.value - } + } It 'Should return true from the test method' { Test-TargetResource @testParams | Should Be $true @@ -146,11 +146,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name 'The farm property exists, but should not be' -Fixture { $testParams = @{ - Key = 'FARM_TYPE' - Value = 'SearchFarm' + Key = 'FARM_TYPE' + Value = 'SearchFarm' Ensure = 'Absent' } - + $result = Get-TargetResource @testParams It 'Should return Present from the get method' { @@ -160,7 +160,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It 'Should return the same values as passed as parameters' { $result.Key | Should Be $testParams.Key $result.value | Should Be $testParams.Value - } + } It 'Should return false from the test method' { Test-TargetResource @testParams | Should Be $false @@ -171,8 +171,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $Global:SPDscFarmPropertyUpdated = $false - It 'Calls Get-SPFarm and remove farm property bag from the set method' { - Set-TargetResource @testParams + It 'Calls Get-SPFarm and remove farm property bag from the set method' { + Set-TargetResource @testParams $Global:SPDscFarmPropertyUpdated | Should Be $true } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPFarmSolution.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPFarmSolution.Tests.ps1 index 455945442..f9c5555d1 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPFarmSolution.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPFarmSolution.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPFarmSolution" + -DscResource "SPFarmSolution" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -31,12 +31,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Test contexts Context -Name "The solution isn't installed, but should be" -Fixture { $testParams = @{ - Name = "SomeSolution" - LiteralPath = "\\server\share\file.wsp" - Deployed = $true - Ensure = "Present" - Version = "1.0.0.0" - WebAppUrls = @("http://app1", "http://app2") + Name = "SomeSolution" + LiteralPath = "\\server\share\file.wsp" + Deployed = $true + Ensure = "Present" + Version = "1.0.0.0" + WebAppUrls = @("http://app1", "http://app2") } $global:SPDscSolutionAdded = $false @@ -53,7 +53,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Add-SPSolution -MockWith { - $solution = [pscustomobject] @{ Properties = @{ Version = "" }} + $solution = [pscustomobject] @{ Properties = @{ Version = "" } } $solution | Add-Member -Name Update -MemberType ScriptMethod -Value { } $global:SPDscSolutionAdded = $true return $solution @@ -81,12 +81,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The solution isn't installed, but should be with loop testing" -Fixture { $testParams = @{ - Name = "SomeSolution" - LiteralPath = "\\server\share\file.wsp" - Deployed = $true - Ensure = "Present" - Version = "1.0.0.0" - WebAppUrls = @("http://app1", "http://app2") + Name = "SomeSolution" + LiteralPath = "\\server\share\file.wsp" + Deployed = $true + Ensure = "Present" + Version = "1.0.0.0" + WebAppUrls = @("http://app1", "http://app2") } $global:SPDscSolutionAdded = $false @@ -95,21 +95,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPSolution -MockWith { $global:SPDscLoopCount = $global:SPDscLoopCount + 1 $index = $global:SPDscLoopCount - if ($global:SPDscSolutionAdded) - { - if ($index -gt 2) + if ($global:SPDscSolutionAdded) { - return @{ - JobExists = $false + if ($index -gt 2) + { + return @{ + JobExists = $false + } } - } - else - { - return @{ - JobExists = $true + else + { + return @{ + JobExists = $true + } } } - } else { return $null @@ -117,7 +117,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Add-SPSolution -MockWith { - $solution = [pscustomobject] @{ Properties = @{ Version = "" }} + $solution = [pscustomobject] @{ Properties = @{ Version = "" } } $solution | Add-Member -Name Update -MemberType ScriptMethod -Value { } $global:SPDscSolutionAdded = $true return $solution @@ -148,19 +148,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The solution is installed, but should not be" -Fixture { $testParams = @{ - Name = "SomeSolution" - LiteralPath = "\\server\share\file.wsp" - Deployed = $true - Ensure = "Absent" - Version = "1.0.0.0" - WebAppUrls = @("http://app1", "http://app2") + Name = "SomeSolution" + LiteralPath = "\\server\share\file.wsp" + Deployed = $true + Ensure = "Absent" + Version = "1.0.0.0" + WebAppUrls = @("http://app1", "http://app2") } Mock -CommandName Get-SPSolution -MockWith { return [pscustomobject]@{ Deployed = $true Properties = @{ Version = "1.0.0.0" } - DeployedWebApplications = @( [pscustomobject]@{Url="http://app1"}, [pscustomobject]@{Url="http://app2"}) + DeployedWebApplications = @( [pscustomobject]@{Url = "http://app1" }, [pscustomobject]@{Url = "http://app2" }) ContainsGlobalAssembly = $true } } @@ -186,12 +186,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The solution isn't installed, and should not be" -Fixture { $testParams = @{ - Name = "SomeSolution" - LiteralPath = "\\server\share\file.wsp" - Deployed = $false - Ensure = "Absent" - Version = "0.0.0.0" - WebAppUrls = @() + Name = "SomeSolution" + LiteralPath = "\\server\share\file.wsp" + Deployed = $false + Ensure = "Absent" + Version = "0.0.0.0" + WebAppUrls = @() } Mock -CommandName Get-SPSolution -MockWith { $null } @@ -211,19 +211,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The solution is installed, but needs update" -Fixture { $testParams = @{ - Name = "SomeSolution" - LiteralPath = "\\server\share\file.wsp" - Deployed = $true - Ensure = "Present" - Version = "1.1.0.0" - WebAppUrls = @("http://app1", "http://app2") + Name = "SomeSolution" + LiteralPath = "\\server\share\file.wsp" + Deployed = $true + Ensure = "Present" + Version = "1.1.0.0" + WebAppUrls = @("http://app1", "http://app2") } Mock -CommandName Get-SPSolution -MockWith { $s = [pscustomobject]@{ Deployed = $true Properties = @{ Version = "1.0.0.0" } - DeployedWebApplications = @( [pscustomobject]@{Url="http://app1"}, [pscustomobject]@{Url="http://app2"}) + DeployedWebApplications = @( [pscustomobject]@{Url = "http://app1" }, [pscustomobject]@{Url = "http://app2" }) ContainsGlobalAssembly = $true } $s | Add-Member -Name Update -MemberType ScriptMethod -Value { } @@ -251,19 +251,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The solution is installed, and should be" -Fixture { $testParams = @{ - Name = "SomeSolution" - LiteralPath = "\\server\share\file.wsp" - Deployed = $true - Ensure = "Present" - Version = "1.0.0.0" - WebAppUrls = @("http://app1", "http://app2") + Name = "SomeSolution" + LiteralPath = "\\server\share\file.wsp" + Deployed = $true + Ensure = "Present" + Version = "1.0.0.0" + WebAppUrls = @("http://app1", "http://app2") } Mock -CommandName Get-SPSolution -MockWith { return [pscustomobject]@{ Deployed = $true Properties = @{ Version = "1.0.0.0" } - DeployedWebApplications = @( [pscustomobject]@{Url="http://app1"}, [pscustomobject]@{Url="http://app2"}) + DeployedWebApplications = @( [pscustomobject]@{Url = "http://app1" }, [pscustomobject]@{Url = "http://app2" }) ContainsGlobalAssembly = $true } } @@ -283,20 +283,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The solution exists but is not deloyed, and needs update" -Fixture { $testParams = @{ - Name = "SomeSolution" - LiteralPath = "\\server\share\file.wsp" - Deployed = $true - Ensure = "Present" - Version = "1.1.0.0" - WebAppUrls = @() + Name = "SomeSolution" + LiteralPath = "\\server\share\file.wsp" + Deployed = $true + Ensure = "Present" + Version = "1.1.0.0" + WebAppUrls = @() } $solution = [pscustomobject]@{ - Deployed = $false - Properties = @{ Version = "1.0.0.0" } - DeployedWebApplications = @( [pscustomobject]@{Url="http://app1"}, [pscustomobject]@{Url="http://app2"}) - ContainsGlobalAssembly = $true - } + Deployed = $false + Properties = @{ Version = "1.0.0.0" } + DeployedWebApplications = @( [pscustomobject]@{Url = "http://app1" }, [pscustomobject]@{Url = "http://app2" }) + ContainsGlobalAssembly = $true + } $solution | Add-Member -Name Update -MemberType ScriptMethod -Value { } Mock -CommandName Get-SPSolution -MockWith { $solution } @@ -325,21 +325,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A solution deployment can target a specific compatability level" -Fixture { $testParams = @{ - Name = "SomeSolution" - LiteralPath = "\\server\share\file.wsp" - Deployed = $true - Ensure = "Present" - Version = "1.1.0.0" - WebAppUrls = @() - SolutionLevel = "All" + Name = "SomeSolution" + LiteralPath = "\\server\share\file.wsp" + Deployed = $true + Ensure = "Present" + Version = "1.1.0.0" + WebAppUrls = @() + SolutionLevel = "All" } $solution = [pscustomobject]@{ - Deployed = $false - Properties = @{ Version = "1.0.0.0" } - DeployedWebApplications = @( [pscustomobject]@{Url="http://app1"}, [pscustomobject]@{Url="http://app2"}) - ContainsGlobalAssembly = $true - } + Deployed = $false + Properties = @{ Version = "1.0.0.0" } + DeployedWebApplications = @( [pscustomobject]@{Url = "http://app1" }, [pscustomobject]@{Url = "http://app2" }) + ContainsGlobalAssembly = $true + } $solution | Add-Member -Name Update -MemberType ScriptMethod -Value { } Mock -CommandName Get-SPSolution -MockWith { $solution } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPFeature.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPFeature.Tests.ps1 index a93e94604..9382cb969 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPFeature.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPFeature.Tests.ps1 @@ -1,26 +1,26 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPFeature" + -DscResource "SPFeature" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - # Mocks for all contexts - Mock -CommandName Enable-SPFeature -MockWith {} - Mock -CommandName Disable-SPFeature -MockWith {} + # Mocks for all contexts + Mock -CommandName Enable-SPFeature -MockWith { } + Mock -CommandName Disable-SPFeature -MockWith { } # Test contexts Context -Name "A feature that is not installed in the farm should be turned on" -Fixture { @@ -31,7 +31,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Ensure = "Present" } - Mock -CommandName Get-SPFeature -MockWith { return $null } + Mock -CommandName Get-SPFeature -MockWith { return $null } It "Should return null from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" @@ -49,10 +49,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Url = "http://site.sharepoint.com" Ensure = "Present" } - - Mock -CommandName Get-SPFeature -MockWith { - return $null - } + + Mock -CommandName Get-SPFeature -MockWith { + return $null + } It "Should return null from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" @@ -76,10 +76,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Url = "http://site.sharepoint.com" Ensure = "Present" } - - Mock -CommandName Get-SPFeature -MockWith { - return $null - } + + Mock -CommandName Get-SPFeature -MockWith { + return $null + } It "Should return null from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" @@ -103,10 +103,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Url = "http://site.sharepoint.com" Ensure = "Absent" } - - Mock -CommandName Get-SPFeature -MockWith { - return @{} - } + + Mock -CommandName Get-SPFeature -MockWith { + return @{ } + } It "Should return null from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" @@ -129,10 +129,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Url = "http://site.sharepoint.com" Ensure = "Absent" } - - Mock -CommandName Get-SPFeature -MockWith { - return @{} - } + + Mock -CommandName Get-SPFeature -MockWith { + return @{ } + } It "Should return null from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" @@ -155,8 +155,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Url = "http://site.sharepoint.com" Ensure = "Present" } - - Mock -CommandName Get-SPFeature -MockWith { return @{} } + + Mock -CommandName Get-SPFeature -MockWith { return @{ } } It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $true @@ -170,14 +170,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Url = "http://site.sharepoint.com" Ensure = "Present" } - - Mock -CommandName Get-SPFeature -MockWith { return @{} } + + Mock -CommandName Get-SPFeature -MockWith { return @{ } } It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $true } } - + Context -Name "A site collection scoped features is enabled but has the wrong version" -Fixture { $testParams = @{ Name = "DemoFeature" @@ -186,13 +186,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Version = "1.1.0.0" Ensure = "Present" } - + Mock -CommandName Get-SPFeature -MockWith { return @{ Version = "1.0.0.0" } } It "Should return the version from the get method" { (Get-TargetResource @testParams).Version | Should Be "1.0.0.0" } - + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPHealthAnalyzerRuleState.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPHealthAnalyzerRuleState.Tests.ps1 index be4f818b5..930988331 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPHealthAnalyzerRuleState.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPHealthAnalyzerRuleState.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPHealthAnalyzerRuleState" + -DscResource "SPHealthAnalyzerRuleState" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -23,23 +23,23 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Mocks for all contexts Mock -CommandName Get-SPFarm -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPWebapplication -MockWith { return @{ - Url = "" - IsAdministrationWebApplication=$true + Url = "" + IsAdministrationWebApplication = $true } } # Test contexts Context -Name "The server is not part of SharePoint farm" -Fixture { $testParams = @{ - Name = "Drives are at risk of running out of free space." - Enabled = $true - RuleScope = "All Servers" - Schedule = "Daily" + Name = "Drives are at risk of running out of free space." + Enabled = $true + RuleScope = "All Servers" + Schedule = "Daily" FixAutomatically = $false } @@ -60,10 +60,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The server is in a farm, but no central admin site is found" -Fixture { $testParams = @{ - Name = "Drives are at risk of running out of free space." - Enabled = $true - RuleScope = "All Servers" - Schedule = "Daily" + Name = "Drives are at risk of running out of free space." + Enabled = $true + RuleScope = "All Servers" + Schedule = "Daily" FixAutomatically = $false } @@ -86,10 +86,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The server is in a farm, CA found, but no health analyzer rules list is found" -Fixture { $testParams = @{ - Name = "Drives are at risk of running out of free space." - Enabled = $true - RuleScope = "All Servers" - Schedule = "Daily" + Name = "Drives are at risk of running out of free space." + Enabled = $true + RuleScope = "All Servers" + Schedule = "Daily" FixAutomatically = $false } @@ -114,10 +114,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The server is in a farm, CA found, Health Rules list found, but no rules match the specified rule name" -Fixture { $testParams = @{ - Name = "Drives are at risk of running out of free space." - Enabled = $true - RuleScope = "All Servers" - Schedule = "Daily" + Name = "Drives are at risk of running out of free space." + Enabled = $true + RuleScope = "All Servers" + Schedule = "Daily" FixAutomatically = $false } @@ -126,13 +126,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Lists = @{ BaseTemplate = "HealthRules" } | Add-Member -MemberType ScriptMethod -Name GetItems -Value { - return ,@() - } -PassThru + return , @() + } -PassThru } return $web } - Mock -CommandName Get-SPFarm -MockWith { return @{} } + Mock -CommandName Get-SPFarm -MockWith { return @{ } } It "Should return null from the get method" { (Get-TargetResource @testParams).Name | Should BeNullOrEmpty @@ -149,10 +149,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The server is in a farm, CA/Health Rules list/Health Rule found, but the incorrect settings have been applied" -Fixture { $testParams = @{ - Name = "Drives are at risk of running out of free space." - Enabled = $true - RuleScope = "All Servers" - Schedule = "Daily" + Name = "Drives are at risk of running out of free space." + Enabled = $true + RuleScope = "All Servers" + Schedule = "Daily" FixAutomatically = $false } @@ -161,16 +161,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Lists = @{ BaseTemplate = "HealthRules" } | Add-Member -MemberType ScriptMethod -Name GetItems -Value { - $itemcol = @(@{ - HealthRuleCheckEnabled = $false; - HealthRuleScope = "Any Server"; - HealthRuleSchedule = "Weekly"; + $itemcol = @(@{ + HealthRuleCheckEnabled = $false; + HealthRuleScope = "Any Server"; + HealthRuleSchedule = "Weekly"; HealthRuleAutoRepairEnabled = $true } | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscHealthRulesUpdated = $true } -PassThru ) - return ,$itemcol - } -PassThru + return , $itemcol + } -PassThru } return $web } @@ -179,7 +179,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $result = Get-TargetResource @testParams $result.Enabled | Should Be $false $result.RuleScope | Should Be 'Any Server' - $result.Schedule| Should Be 'Weekly' + $result.Schedule | Should Be 'Weekly' $result.FixAutomatically | Should Be $true } @@ -196,10 +196,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The server is in a farm and the correct settings have been applied" -Fixture { $testParams = @{ - Name = "Drives are at risk of running out of free space." - Enabled = $true - RuleScope = "All Servers" - Schedule = "Daily" + Name = "Drives are at risk of running out of free space." + Enabled = $true + RuleScope = "All Servers" + Schedule = "Daily" FixAutomatically = $false } @@ -208,16 +208,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Lists = @{ BaseTemplate = "HealthRules" } | Add-Member -MemberType ScriptMethod -Name GetItems -Value { - $itemcol = @(@{ - HealthRuleCheckEnabled = $true; - HealthRuleScope = "All Servers"; - HealthRuleSchedule = "Daily"; + $itemcol = @(@{ + HealthRuleCheckEnabled = $true; + HealthRuleScope = "All Servers"; + HealthRuleSchedule = "Daily"; HealthRuleAutoRepairEnabled = $false } | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscHealthRulesUpdated = $true } -PassThru ) - return ,$itemcol - } -PassThru + return , $itemcol + } -PassThru } return $web } @@ -226,7 +226,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $result = Get-TargetResource @testParams $result.Enabled | Should Be $true $result.RuleScope | Should Be 'All Servers' - $result.Schedule| Should Be 'Daily' + $result.Schedule | Should Be 'Daily' $result.FixAutomatically | Should Be $false } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPIncomingEmailSettings.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPIncomingEmailSettings.Tests.ps1 index 3b76a2905..8141b376d 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPIncomingEmailSettings.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPIncomingEmailSettings.Tests.ps1 @@ -24,7 +24,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName 'Get-SPServiceInstance' -MockWith { $serviceInstance = @{ - Service = @{ + Service = @{ Enabled = $mock.Enabled DropFolder = $mock.DropFolder UseAutomaticSettings = $mock.UseAutomaticSettings @@ -37,11 +37,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { DLsRequireAuthenticatedSenders = $mock.DLsRequireAuthenticatedSenders } } - $serviceInstance = $serviceInstance | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = "Microsoft.SharePoint.Administration.SPIncomingEmailServiceInstance"} } -force -PassThru + $serviceInstance = $serviceInstance | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = "Microsoft.SharePoint.Administration.SPIncomingEmailServiceInstance" } } -force -PassThru $serviceInstance.Service = $serviceInstance.Service | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = "Microsoft.SharePoint.Administration.SPIncomingEmailService"} } -force -PassThru - $serviceInstance.Service = $serviceInstance.Service | Add-Member -MemberType ScriptMethod -Name Update -Value { + return @{ FullName = "Microsoft.SharePoint.Administration.SPIncomingEmailService" } } -force -PassThru + $serviceInstance.Service = $serviceInstance.Service | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscUpdateCalled = $true } -PassThru return @($serviceInstance) } @@ -56,8 +56,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName 'Get-SPServiceInstance' -MockWith { - $serviceInstance = @{} - $serviceInstance = $serviceInstance | Add-Member -MemberType ScriptMethod -Name GetType -Value { + $serviceInstance = @{ } + $serviceInstance = $serviceInstance | Add-Member -MemberType ScriptMethod -Name GetType -Value { return $null } -force -PassThru return @($serviceInstance) } @@ -69,9 +69,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $result.UseDirectoryManagementService | Should BeNullorEmpty $result.RemoteDirectoryManagementURL | Should BeNullorEmpty $result.ServerAddress | Should BeNullorEmpty - $result.DLsRequireAuthenticatedSenders| Should BeNullorEmpty + $result.DLsRequireAuthenticatedSenders | Should BeNullorEmpty $result.DistributionGroupsEnabled | Should BeNullorEmpty - $result.ServerDisplayAddress| Should BeNullorEmpty + $result.ServerDisplayAddress | Should BeNullorEmpty $result.DropFolder | Should BeNullorEmpty } @@ -227,8 +227,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name 'When service is enabled, but should be disabled' -Fixture { $testParams = @{ - IsSingleInstance = 'Yes' - Ensure = 'Absent' + IsSingleInstance = 'Yes' + Ensure = 'Absent' } $mock = @{ @@ -268,11 +268,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name 'When switching from manual to automatic settings' -Fixture { $testParams = @{ - IsSingleInstance = 'Yes' - Ensure = 'Present' - UseAutomaticSettings = $true - UseDirectoryManagementService = 'No' - ServerDisplayAddress = "contoso.com" + IsSingleInstance = 'Yes' + Ensure = 'Present' + UseAutomaticSettings = $true + UseDirectoryManagementService = 'No' + ServerDisplayAddress = "contoso.com" } $mock = @{ @@ -312,13 +312,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name 'When updating ServerAddress and Directory Managment Service' -Fixture { $testParams = @{ - IsSingleInstance = 'Yes' - Ensure = 'Present' - UseAutomaticSettings = $false - UseDirectoryManagementService = 'Yes' - ServerDisplayAddress = "contoso.com" - ServerAddress = "mail.contoso.com" - DropFolder = '\\MailServer\SharedFolder' + IsSingleInstance = 'Yes' + Ensure = 'Present' + UseAutomaticSettings = $false + UseDirectoryManagementService = 'Yes' + ServerDisplayAddress = "contoso.com" + ServerAddress = "mail.contoso.com" + DropFolder = '\\MailServer\SharedFolder' } $mock = @{ diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPInfoPathFormsServiceConfig.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPInfoPathFormsServiceConfig.Tests.ps1 index c89b9ae46..4cec85a87 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPInfoPathFormsServiceConfig.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPInfoPathFormsServiceConfig.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPInfoPathFormsServiceConfig" + -DscResource "SPInfoPathFormsServiceConfig" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -20,7 +20,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPInfoPathFormsService -MockWith { return @{ - Ensure = "Present" + Ensure = "Present" AllowUserFormBrowserEnabling = $true AllowUserFormBrowserRendering = $true MaxDataConnectionTimeout = 20000 @@ -35,7 +35,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { MaxUserActionsPerPostback = 200 ActiveSessionsTimeout = 1440 MaxSizeOfUserFormState = 4194304 - }| Add-Member ScriptMethod Update { + } | Add-Member ScriptMethod Update { $global:InfoPathSettingsUpdated = $true } -PassThru } @@ -91,7 +91,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should return false when the Test method is called" { { Set-TargetResource @testParams } | Should throw "This resource cannot undo InfoPath Forms Service Configuration changes. " ` - "Please set Ensure to Present or omit the resource" + "Please set Ensure to Present or omit the resource" } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPInstall.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPInstall.Tests.ps1 index 7dd92ff59..a8f8d4913 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPInstall.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPInstall.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPInstall" + -DscResource "SPInstall" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -29,29 +29,29 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { ) $object = New-Object -TypeName System.Object $object = $object | Add-Member -Type NoteProperty ` - -Name "DisplayName" ` - -Value $Name ` - -PassThru + -Name "DisplayName" ` + -Value $Name ` + -PassThru return $object } # Mocks for all contexts Mock -CommandName Get-ChildItem -MockWith { $full = @{ - Version = "4.5.0.0" - Release = "0" - PSChildName = "Full" - } + Version = "4.5.0.0" + Release = "0" + PSChildName = "Full" + } - $client = @{ - Version = "4.5.0.0" - Release = "0" - PSChildName = "Client" - } + $client = @{ + Version = "4.5.0.0" + Release = "0" + PSChildName = "Client" + } - $returnval = @($full, $client) - $returnVal = $returnVal | Add-Member ScriptMethod GetValue { return 380000 } -PassThru - return $returnval + $returnval = @($full, $client) + $returnVal = $returnVal | Add-Member ScriptMethod GetValue { return 380000 } -PassThru + return $returnval } Mock -CommandName Get-SPDscAssemblyVersion -MockWith { @@ -71,9 +71,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Specified BinaryDir does not exist" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - BinaryDir = "C:\SPInstall" - ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" - Ensure = "Present" + BinaryDir = "C:\SPInstall" + ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" + Ensure = "Present" } Mock -CommandName Test-Path -MockWith { @@ -88,7 +88,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { Set-TargetResource @testParams } | Should Throw "Specified path cannot be found" } - It "Should throw exception in the test method" { + It "Should throw exception in the test method" { { Test-TargetResource @testParams } | Should Throw "Specified path cannot be found" } } @@ -96,9 +96,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Setup.exe does not exist in BinaryDir" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - BinaryDir = "C:\SPInstall" - ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" - Ensure = "Present" + BinaryDir = "C:\SPInstall" + ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" + Ensure = "Present" } Mock -CommandName Test-Path -MockWith { @@ -113,7 +113,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { Set-TargetResource @testParams } | Should Throw "Setup.exe cannot be found" } - It "Should throw exception in the test method" { + It "Should throw exception in the test method" { { Test-TargetResource @testParams } | Should Throw "Setup.exe cannot be found" } } @@ -121,9 +121,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Setup.exe file is blocked" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - BinaryDir = "C:\SPInstall" - ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" - Ensure = "Present" + BinaryDir = "C:\SPInstall" + ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" + Ensure = "Present" } Mock -CommandName Get-Item -MockWith { @@ -138,7 +138,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { Set-TargetResource @testParams } | Should Throw "Setup file is blocked!" } - It "Should throw exception in the test method" { + It "Should throw exception in the test method" { { Test-TargetResource @testParams } | Should Throw "Setup file is blocked!" } } @@ -146,9 +146,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "SharePoint binaries are not installed but should be using UNC path" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - BinaryDir = "\\server\install\SPInstall" - ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" - Ensure = "Present" + BinaryDir = "\\server\install\SPInstall" + ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" + Ensure = "Present" } Mock -CommandName Test-Path -MockWith { @@ -178,9 +178,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "SharePoint binaries are not installed but should be using CDROM drive" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - BinaryDir = "C:\SPInstall" - ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" - Ensure = "Present" + BinaryDir = "C:\SPInstall" + ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" + Ensure = "Present" } Mock -CommandName Test-Path -MockWith { @@ -217,9 +217,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "SharePoint binaries are not installed but should be" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - BinaryDir = "C:\SPInstall" - ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" - Ensure = "Present" + BinaryDir = "C:\SPInstall" + ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" + Ensure = "Present" } Mock -CommandName Get-ItemProperty -MockWith { @@ -230,7 +230,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - It "Should return false from the test method" { + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false } } @@ -238,9 +238,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "SharePoint binaries are installed and should be" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - BinaryDir = "C:\SPInstall" - ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" - Ensure = "Present" + BinaryDir = "C:\SPInstall" + ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" + Ensure = "Present" } Mock -CommandName Get-ItemProperty -MockWith { @@ -274,9 +274,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "SharePoint installation executes as expected" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - BinaryDir = "C:\SPInstall" - ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" - Ensure = "Present" + BinaryDir = "C:\SPInstall" + ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" + Ensure = "Present" } Mock -CommandName Start-Process -MockWith { @@ -294,9 +294,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "SharePoint installation fails" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - BinaryDir = "C:\SPInstall" - ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" - Ensure = "Present" + BinaryDir = "C:\SPInstall" + ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" + Ensure = "Present" } Mock -CommandName Start-Process -MockWith { @@ -313,12 +313,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "SharePoint binaries are installed and should not be" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - BinaryDir = "C:\SPInstall" - ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" - Ensure = "Absent" + BinaryDir = "C:\SPInstall" + ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" + Ensure = "Absent" } - Mock -CommandName Get-ItemProperty -MockWith { return @{} } -ParameterFilter { $null -ne $Path } + Mock -CommandName Get-ItemProperty -MockWith { return @{ } } -ParameterFilter { $null -ne $Path } It "Should throw in the test method because uninstall is unsupported" { { Test-TargetResource @testParams } | Should Throw @@ -332,21 +332,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "SharePoint 2013 is installing on a server with .NET 4.6" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - BinaryDir = "C:\SPInstall" - ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" - Ensure = "Present" + BinaryDir = "C:\SPInstall" + ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" + Ensure = "Present" } Mock -CommandName Get-ChildItem -MockWith { $full = @{ - Version = "4.6.0.0" - Release = "0" + Version = "4.6.0.0" + Release = "0" PSChildName = "Full" } $client = @{ - Version = "4.6.0.0" - Release = "0" + Version = "4.6.0.0" + Release = "0" PSChildName = "Client" } @@ -363,11 +363,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "SharePoint is not installed and should be, using custom install directories" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - BinaryDir = "C:\SPInstall" - ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" - Ensure = "Present" - InstallPath = "C:\somewhere" - DataPath = "C:\somewhere\else" + BinaryDir = "C:\SPInstall" + ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" + Ensure = "Present" + InstallPath = "C:\somewhere" + DataPath = "C:\somewhere\else" } Mock -CommandName Get-ItemProperty -MockWith { @@ -380,7 +380,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - It "Should return false from the test method" { + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPInstallLanguagePack.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPInstallLanguagePack.Tests.ps1 index 22b002278..b5626ec6e 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPInstallLanguagePack.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPInstallLanguagePack.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPInstallLanguagePack" + -DscResource "SPInstallLanguagePack" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -39,8 +39,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscInstalledProductVersion { return @{ - FileMajorPart = $Global:SPDscHelper.CurrentStubBuildNumber.Major - FileBuildPart = $Global:SPDscHelper.CurrentStubBuildNumber.Build + FileMajorPart = $Global:SPDscHelper.CurrentStubBuildNumber.Major + FileBuildPart = $Global:SPDscHelper.CurrentStubBuildNumber.Build ProductBuildPart = $Global:SPDscHelper.CurrentStubBuildNumber.Build } } @@ -72,7 +72,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { Set-TargetResource @testParams } | Should Throw "Specified path cannot be found" } - It "Should throw exception in the test method" { + It "Should throw exception in the test method" { { Test-TargetResource @testParams } | Should Throw "Specified path cannot be found" } } @@ -95,7 +95,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { Set-TargetResource @testParams } | Should Throw "Setup.exe cannot be found" } - It "Should throw exception in the test method" { + It "Should throw exception in the test method" { { Test-TargetResource @testParams } | Should Throw "Setup.exe cannot be found" } } @@ -118,7 +118,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { Set-TargetResource @testParams } | Should Throw "Setup file is blocked!" } - It "Should throw exception in the test method" { + It "Should throw exception in the test method" { { Test-TargetResource @testParams } | Should Throw "Setup file is blocked!" } } @@ -142,10 +142,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscRegProductsInfo -MockWith { switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { return @("Microsoft SharePoint Server 2013", "Language Pack for SharePoint and Project Server 2013 - Dutch/Nederlands") } - 16 { + 16 + { if ($Global:SPDscHelper.CurrentStubBuildNumber.Minor.ToString().Length -le 4) { return @("Microsoft SharePoint Server 2016", "Language Pack for SharePoint and Project Server 2016 - Dutch/Nederlands") @@ -155,7 +157,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @("Microsoft SharePoint Server 2019", "Language Pack for SharePoint and Project Server 2010 - Dutch/Nederlands") } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } @@ -166,7 +169,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $result.Ensure | Should Be "Present" } - It "Should return true from the test method" { + It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $true } } @@ -190,10 +193,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscRegProductsInfo -MockWith { switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { return @("Microsoft SharePoint Server 2013", 'Language Pack for SharePoint and Project Server 2013 - Chinese (Taiwan)/中文 (繁體)') } - 16 { + 16 + { if ($Global:SPDscHelper.CurrentStubBuildNumber.Minor.ToString().Length -le 4) { return @("Microsoft SharePoint Server 2016", 'Language Pack for SharePoint and Project Server 2016 - Chinese (Taiwan)/中文 (繁體)') @@ -203,7 +208,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @("Microsoft SharePoint Server 2019", 'Language Pack for SharePoint and Project Server 2019 - Chinese (Taiwan)/中文 (繁體)') } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } @@ -214,7 +220,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $result.Ensure | Should Be "Present" } - It "Should return true from the test method" { + It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $true } } @@ -238,10 +244,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscRegProductsInfo -MockWith { switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { return @("Microsoft SharePoint Server 2013", 'Language Pack for SharePoint and Project Server 2013 - Chinese (PRC)/中文(简体)') } - 16 { + 16 + { if ($Global:SPDscHelper.CurrentStubBuildNumber.Minor.ToString().Length -le 4) { return @("Microsoft SharePoint Server 2016", 'Language Pack for SharePoint and Project Server 2016 - Chinese (PRC)/中文(简体)') @@ -251,7 +259,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @("Microsoft SharePoint Server 2019", 'Language Pack for SharePoint and Project Server 2019 - Chinese (PRC)/中文(简体)') } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } @@ -262,7 +271,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $result.Ensure | Should Be "Present" } - It "Should return true from the test method" { + It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $true } } @@ -286,10 +295,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscRegProductsInfo -MockWith { switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { return @("Microsoft SharePoint Server 2013", 'Language Pack for SharePoint and Project Server 2013 - درى Dari') } - 16 { + 16 + { if ($Global:SPDscHelper.CurrentStubBuildNumber.Minor.ToString().Length -le 4) { return @("Microsoft SharePoint Server 2016", 'Language Pack for SharePoint and Project Server 2016 - درى Dari') @@ -299,7 +310,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @("Microsoft SharePoint Server 2019", 'Language Pack for SharePoint and Project Server 2019 - درى Dari') } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } @@ -310,7 +322,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $result.Ensure | Should Be "Present" } - It "Should return true from the test method" { + It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $true } } @@ -334,10 +346,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscRegProductsInfo -MockWith { switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { return @("Microsoft SharePoint Server 2013", 'Language Pack for SharePoint and Project Server 2013 - Serbian/srpski') } - 16 { + 16 + { if ($Global:SPDscHelper.CurrentStubBuildNumber.Minor.ToString().Length -le 4) { return @("Microsoft SharePoint Server 2016", 'Language Pack for SharePoint and Project Server 2016 - Serbian/srpski') @@ -347,7 +361,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @("Microsoft SharePoint Server 2019", 'Language Pack for SharePoint and Project Server 2019 - Serbian/srpski') } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } @@ -358,7 +373,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $result.Ensure | Should Be "Present" } - It "Should return true from the test method" { + It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $true } } @@ -382,10 +397,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscRegProductsInfo -MockWith { switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { return @("Microsoft SharePoint Server 2013", 'Language Pack for SharePoint and Project Server 2013 - Serbian/српски') } - 16 { + 16 + { if ($Global:SPDscHelper.CurrentStubBuildNumber.Minor.ToString().Length -le 4) { return @("Microsoft SharePoint Server 2016", 'Language Pack for SharePoint and Project Server 2016 - Serbian/српски') @@ -395,7 +412,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @("Microsoft SharePoint Server 2019", 'Language Pack for SharePoint and Project Server 2019 - Serbian/српски') } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } @@ -406,7 +424,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $result.Ensure | Should Be "Present" } - It "Should return true from the test method" { + It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $true } } @@ -430,10 +448,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscRegProductsInfo -MockWith { switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { return @("Microsoft SharePoint Server 2013", 'Language Pack for SharePoint and Project Server 2013 - Portuguese/Português (Brasil)') } - 16 { + 16 + { if ($Global:SPDscHelper.CurrentStubBuildNumber.Minor.ToString().Length -le 4) { return @("Microsoft SharePoint Server 2016", 'Language Pack for SharePoint and Project Server 2016 - Portuguese/Português (Brasil)') @@ -443,7 +463,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @("Microsoft SharePoint Server 2019", 'Language Pack for SharePoint and Project Server 2019 - Portuguese/Português (Brasil)') } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } @@ -454,7 +475,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $result.Ensure | Should Be "Present" } - It "Should return true from the test method" { + It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $true } } @@ -478,10 +499,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscRegProductsInfo -MockWith { switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { return @("Microsoft SharePoint Server 2013", 'Language Pack for SharePoint and Project Server 2013 - Portuguese/Português') } - 16 { + 16 + { if ($Global:SPDscHelper.CurrentStubBuildNumber.Minor.ToString().Length -le 4) { return @("Microsoft SharePoint Server 2016", 'Language Pack for SharePoint and Project Server 2016 - Portuguese/Português') @@ -491,7 +514,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @("Microsoft SharePoint Server 2019", 'Language Pack for SharePoint and Project Server 2019 - Portuguese/Português') } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } @@ -502,7 +526,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $result.Ensure | Should Be "Present" } - It "Should return true from the test method" { + It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $true } } @@ -526,10 +550,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscRegProductsInfo -MockWith { switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { return @("Microsoft SharePoint Server 2013", 'Language Pack for SharePoint and Project Server 2013 - Arabic/LOCAL ARABIC') } - 16 { + 16 + { if ($Global:SPDscHelper.CurrentStubBuildNumber.Minor.ToString().Length -le 4) { return @("Microsoft SharePoint Server 2016", 'Language Pack for SharePoint and Project Server 2016 - Arabic/LOCAL ARABIC') @@ -539,7 +565,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @("Microsoft SharePoint Server 2019", 'Language Pack for SharePoint and Project Server 2019 - Arabic/LOCAL ARABIC') } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } @@ -550,7 +577,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $result.Ensure | Should Be "Present" } - It "Should return true from the test method" { + It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $true } } @@ -564,10 +591,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscFarmProductsInfo -MockWith { switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { return @("Microsoft SharePoint Server 2013") } - 16 { + 16 + { if ($Global:SPDscHelper.CurrentStubBuildNumber.Minor.ToString().Length -le 4) { return @("Microsoft SharePoint Server 2016") @@ -577,14 +606,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @("Microsoft SharePoint Server 2019") } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } } Mock -CommandName Get-SPDscRegProductsInfo -MockWith { - if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { return @("Microsoft SharePoint Server 2013") } @@ -617,7 +647,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Assert-MockCalled Start-Process } - It "Should return true from the test method" { + It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $false } } @@ -631,10 +661,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscFarmProductsInfo -MockWith { switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { return @("Microsoft SharePoint Server 2013") } - 16 { + 16 + { if ($Global:SPDscHelper.CurrentStubBuildNumber.Minor.ToString().Length -le 4) { return @("Microsoft SharePoint Server 2016") @@ -644,14 +676,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @("Microsoft SharePoint Server 2019") } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } } Mock -CommandName Get-SPDscRegProductsInfo -MockWith { - if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { return @("Microsoft SharePoint Server 2013") } @@ -693,10 +726,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscFarmProductsInfo -MockWith { switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { return @("Microsoft SharePoint Server 2013") } - 16 { + 16 + { if ($Global:SPDscHelper.CurrentStubBuildNumber.Minor.ToString().Length -le 4) { return @("Microsoft SharePoint Server 2016") @@ -706,14 +741,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @("Microsoft SharePoint Server 2019") } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } } Mock -CommandName Get-SPDscRegProductsInfo -MockWith { - if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { return @("Microsoft SharePoint Server 2013") } @@ -762,10 +798,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscFarmProductsInfo -MockWith { switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { return @("Microsoft SharePoint Server 2013") } - 16 { + 16 + { if ($Global:SPDscHelper.CurrentStubBuildNumber.Minor.ToString().Length -le 4) { return @("Microsoft SharePoint Server 2016") @@ -775,14 +813,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @("Microsoft SharePoint Server 2019") } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } } Mock -CommandName Get-SPDscRegProductsInfo -MockWith { - if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { return @("Microsoft SharePoint Server 2013") } @@ -815,7 +854,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Assert-MockCalled Start-Process } - It "Should return true from the test method" { + It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $false } } @@ -829,10 +868,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscFarmProductsInfo -MockWith { switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { return @("Microsoft SharePoint Server 2013") } - 16 { + 16 + { if ($Global:SPDscHelper.CurrentStubBuildNumber.Minor.ToString().Length -le 4) { return @("Microsoft SharePoint Server 2016") @@ -842,14 +883,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @("Microsoft SharePoint Server 2019") } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } } Mock -CommandName Get-SPDscRegProductsInfo -MockWith { - if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { return @("Microsoft SharePoint Server 2013") } @@ -882,7 +924,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Assert-MockCalled Start-Process } - It "Should return true from the test method" { + It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $false } } @@ -902,10 +944,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscFarmProductsInfo { switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { return @("Microsoft SharePoint Server 2013", "Language Pack for SharePoint and Project Server 2013 - Dutch/Nederlands") } - 16 { + 16 + { if ($Global:SPDscHelper.CurrentStubBuildNumber.Minor.ToString().Length -le 4) { return @("Microsoft SharePoint Server 2016", "Language Pack for SharePoint and Project Server 2016 - Dutch/Nederlands") @@ -915,14 +959,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @("Microsoft SharePoint Server 2019", "Language Pack for SharePoint and Project Server 2019 - Dutch/Nederlands") } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } } Mock -CommandName Get-SPDscRegProductsInfo -MockWith { - if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { return @("Microsoft SharePoint Server 2013", "Language Pack for SharePoint and Project Server 2013 - Dutch/Nederlands") } @@ -959,10 +1004,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscFarmProductsInfo -MockWith { switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { return @("Microsoft SharePoint Server 2013", "Language Pack for SharePoint and Project Server 2013 - Dutch/Nederlands") } - 16 { + 16 + { if ($Global:SPDscHelper.CurrentStubBuildNumber.Minor.ToString().Length -le 4) { return @("Microsoft SharePoint Server 2016", "Language Pack for SharePoint and Project Server 2016 - Dutch/Nederlands") @@ -972,14 +1019,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @("Microsoft SharePoint Server 2019", "Language Pack for SharePoint and Project Server 2019 - Dutch/Nederlands") } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } } Mock -CommandName Get-SPDscRegProductsInfo -MockWith { - if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { return @("Microsoft SharePoint Server 2013", "Language Pack for SharePoint and Project Server 2013 - Dutch/Nederlands") } @@ -1014,15 +1062,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "BinaryInstallDays outside range" -Fixture { $testParams = @{ - BinaryDir = "C:\SPInstall" - BinaryInstallDays = "mon" - Ensure = "Present" + BinaryDir = "C:\SPInstall" + BinaryInstallDays = "mon" + Ensure = "Present" } $testDate = Get-Date -Day 17 -Month 7 -Year 2016 -Hour 12 -Minute 00 -Second 00 Mock -CommandName Get-Date -MockWith { - return $testDate + return $testDate } It "Should return null from the set method" { @@ -1032,16 +1080,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "BinaryInstallTime outside range" -Fixture { $testParams = @{ - BinaryDir = "C:\SPInstall" - BinaryInstallDays = "sun" - BinaryInstallTime = "3:00am to 5:00am" - Ensure = "Present" + BinaryDir = "C:\SPInstall" + BinaryInstallDays = "sun" + BinaryInstallTime = "3:00am to 5:00am" + Ensure = "Present" } $testDate = Get-Date -Day 17 -Month 7 -Year 2016 -Hour 12 -Minute 00 -Second 00 Mock -CommandName Get-Date -MockWith { - return $testDate + return $testDate } It "Should return null from the set method" { @@ -1051,16 +1099,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "BinaryInstallTime incorrectly formatted, too many arguments" -Fixture { $testParams = @{ - BinaryDir = "C:\SPInstall" - BinaryInstallDays = "sun" - BinaryInstallTime = "error 3:00am to 5:00am" - Ensure = "Present" + BinaryDir = "C:\SPInstall" + BinaryInstallDays = "sun" + BinaryInstallTime = "error 3:00am to 5:00am" + Ensure = "Present" } $testDate = Get-Date -Day 17 -Month 7 -Year 2016 -Hour 12 -Minute 00 -Second 00 Mock -CommandName Get-Date -MockWith { - return $testDate + return $testDate } It "Should throw exception in the set method" { @@ -1070,16 +1118,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "BinaryInstallTime incorrectly formatted, incorrect start time" -Fixture { $testParams = @{ - BinaryDir = "C:\SPInstall" - BinaryInstallDays = "sun" - BinaryInstallTime = "3:00xm to 5:00am" - Ensure = "Present" + BinaryDir = "C:\SPInstall" + BinaryInstallDays = "sun" + BinaryInstallTime = "3:00xm to 5:00am" + Ensure = "Present" } $testDate = Get-Date -Day 17 -Month 7 -Year 2016 -Hour 12 -Minute 00 -Second 00 Mock -CommandName Get-Date -MockWith { - return $testDate + return $testDate } It "Should throw exception in the set method" { @@ -1089,16 +1137,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "BinaryInstallTime incorrectly formatted, incorrect end time" -Fixture { $testParams = @{ - BinaryDir = "C:\SPInstall" - BinaryInstallDays = "sun" - BinaryInstallTime = "3:00am to 5:00xm" - Ensure = "Present" + BinaryDir = "C:\SPInstall" + BinaryInstallDays = "sun" + BinaryInstallTime = "3:00am to 5:00xm" + Ensure = "Present" } $testDate = Get-Date -Day 17 -Month 7 -Year 2016 -Hour 12 -Minute 00 -Second 00 Mock -CommandName Get-Date -MockWith { - return $testDate + return $testDate } It "Should throw exception in the set method" { @@ -1108,16 +1156,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "BinaryInstallTime start time larger than end time" -Fixture { $testParams = @{ - BinaryDir = "C:\SPInstall" - BinaryInstallDays = "sun" - BinaryInstallTime = "3:00pm to 5:00am" - Ensure = "Present" + BinaryDir = "C:\SPInstall" + BinaryInstallDays = "sun" + BinaryInstallTime = "3:00pm to 5:00am" + Ensure = "Present" } $testDate = Get-Date -Day 17 -Month 7 -Year 2016 -Hour 12 -Minute 00 -Second 00 Mock -CommandName Get-Date -MockWith { - return $testDate + return $testDate } It "Should throw exception in the set method" { @@ -1127,15 +1175,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Ensure is set to Absent" -Fixture { $testParams = @{ - BinaryDir = "C:\SPInstall" - Ensure = "Absent" + BinaryDir = "C:\SPInstall" + Ensure = "Absent" } It "Should throw exception in the set method" { { Set-TargetResource @testParams } | Should Throw "SharePointDsc does not support uninstalling SharePoint Language Packs. Please remove this manually." } - It "Should throw exception in the test method" { + It "Should throw exception in the test method" { { Test-TargetResource @testParams } | Should Throw "SharePointDsc does not support uninstalling SharePoint Language Packs. Please remove this manually." } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPIrmSettings.tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPIrmSettings.tests.ps1 index 0cccbc861..187e68cc6 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPIrmSettings.tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPIrmSettings.tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPIrmSettings" + -DscResource "SPIrmSettings" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -22,15 +22,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Mocks for all contexts Mock -CommandName Get-SPFarm -MockWith { - return @{} + return @{ } } # Test contexts Context -Name "The server is not part of SharePoint farm" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - Ensure = "Present" - RMSserver = "https://myRMSserver.local" + Ensure = "Present" + RMSserver = "https://myRMSserver.local" } Mock -CommandName Get-SPFarm -MockWith { @@ -53,28 +53,28 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "IRM settings match desired settings" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - Ensure = "Present" - RMSserver = "https://myRMSserver.local" + Ensure = "Present" + RMSserver = "https://myRMSserver.local" } Mock -CommandName Get-SPDscContentService -MockWith { $returnVal = @{ IrmSettings = @{ - IrmRMSEnabled = $true - IrmRMSUseAD = $false + IrmRMSEnabled = $true + IrmRMSUseAD = $false IrmRMSCertServer = "https://myRMSserver.local" } } $returnVal = $returnVal | Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value { - $Global:SPDscIRMUpdated = $true - } -PassThru + -Name Update ` + -Value { + $Global:SPDscIRMUpdated = $true + } -PassThru return $returnVal } It "Should return present in the get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Present" + (Get-TargetResource @testParams).Ensure | Should Be "Present" } It "Should return true in the test method" { @@ -85,28 +85,28 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "IRM settings do not match desired settings" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - Ensure = "Present" - RMSserver = "https://myRMSserver.local" + Ensure = "Present" + RMSserver = "https://myRMSserver.local" } Mock -CommandName Get-SPDscContentService -MockWith { $returnVal = @{ IrmSettings = @{ - IrmRMSEnabled = $false - IrmRMSUseAD = $false + IrmRMSEnabled = $false + IrmRMSUseAD = $false IrmRMSCertServer = $null } } $returnVal = $returnVal | Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value { - $Global:SPDscIRMUpdated = $true - } -PassThru + -Name Update ` + -Value { + $Global:SPDscIRMUpdated = $true + } -PassThru return $returnVal } It "Should return absent in the get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return false in the test method" { @@ -120,7 +120,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should throw when UseAD and RMSserver are both supplied" { - $testParams.Add("UseADRMS",$true) + $testParams.Add("UseADRMS", $true) { Set-TargetResource @testParams } | Should Throw } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPLogLevel.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPLogLevel.Tests.ps1 index fc26ff582..85158757f 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPLogLevel.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPLogLevel.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPLogLevel" + -DscResource "SPLogLevel" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -24,14 +24,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Test contexts Context -Name "Multiple Log Category Areas were specified for one item" -Fixture { $testParams = @{ - Name = "My LogLevel Settings" + Name = "My LogLevel Settings" SPLogLevelSetting = @( (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePoint Server","Excel Services Application" - Name = "*" - TraceLevel = "Medium" - EventLevel = "Information" - } -ClientOnly) + Area = "SharePoint Server", "Excel Services Application" + Name = "*" + TraceLevel = "Medium" + EventLevel = "Information" + } -ClientOnly) ) } @@ -51,14 +51,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Multiple Log Category Names were specified for one item" -Fixture { $testParams = @{ - Name = "My LogLevel Settings" + Name = "My LogLevel Settings" SPLogLevelSetting = @( (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePointServer" - Name = "Database","UserProfile" - TraceLevel = "Medium" - EventLevel = "Information" - } -ClientOnly) + Area = "SharePointServer" + Name = "Database", "UserProfile" + TraceLevel = "Medium" + EventLevel = "Information" + } -ClientOnly) ) } @@ -77,12 +77,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "No desired Trace and Event levels were specified" -Fixture { $testParams = @{ - Name = "My LogLevel Settings" + Name = "My LogLevel Settings" SPLogLevelSetting = @( (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePointServer" - Name = "Database" - } -ClientOnly) + Area = "SharePointServer" + Name = "Database" + } -ClientOnly) ) } @@ -101,14 +101,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "An invalid Trace level was specified" -Fixture { $testParams = @{ - Name = "My LogLevel Settings" + Name = "My LogLevel Settings" SPLogLevelSetting = @( (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePointServer" - Name = "Database" - TraceLevel = "detailed" - EventLevel = "Information" - } -ClientOnly) + Area = "SharePointServer" + Name = "Database" + TraceLevel = "detailed" + EventLevel = "Information" + } -ClientOnly) ) } @@ -127,14 +127,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "An invalid Event level was specified" -Fixture { $testParams = @{ - Name = "My LogLevel Settings" + Name = "My LogLevel Settings" SPLogLevelSetting = @( (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePoint Server" - Name = "Database" - TraceLevel = "Medium" - EventLevel = "detailed" - } -ClientOnly) + Area = "SharePoint Server" + Name = "Database" + TraceLevel = "Medium" + EventLevel = "detailed" + } -ClientOnly) ) } @@ -153,26 +153,26 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Desired setting for log level items is the Default, and the current setting is the Default" -Fixture { $testParams = @{ - Name = "My LogLevel Settings" + Name = "My LogLevel Settings" SPLogLevelSetting = @( (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePoint Server" - Name = "Database" - TraceLevel = "Default" - EventLevel = "Default" - } -ClientOnly) + Area = "SharePoint Server" + Name = "Database" + TraceLevel = "Default" + EventLevel = "Default" + } -ClientOnly) ) } Mock -CommandName Get-SPLogLevel -MockWith { return @{ - Area = "SharePoint Server" - Name = "Database" - TraceSeverity = "Medium" - EventSeverity = "Information" - DefaultTraceSeverity = "Medium" - DefaultEventSeverity = "Information" - } + Area = "SharePoint Server" + Name = "Database" + TraceSeverity = "Medium" + EventSeverity = "Information" + DefaultTraceSeverity = "Medium" + DefaultEventSeverity = "Information" + } } It "Should return 'Default' from the get method [TraceLevel]" { @@ -191,26 +191,26 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Desired setting for a log level item is the Default, and the current setting is not the Default" -Fixture { $testParams = @{ - Name = "My LogLevel Settings" + Name = "My LogLevel Settings" SPLogLevelSetting = @( (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePoint Server" - Name = "Database" - TraceLevel = "Default" - EventLevel = "Default" - } -ClientOnly) + Area = "SharePoint Server" + Name = "Database" + TraceLevel = "Default" + EventLevel = "Default" + } -ClientOnly) ) } Mock -CommandName Get-SPLogLevel -MockWith { return @{ - Area = "SharePoint Server" - Name = "Database" - TraceSeverity = "Unexpected" - EventSeverity = "Error" - DefaultTraceSeverity = "Medium" - DefaultEventSeverity = "Information" - } + Area = "SharePoint Server" + Name = "Database" + TraceSeverity = "Unexpected" + EventSeverity = "Error" + DefaultTraceSeverity = "Medium" + DefaultEventSeverity = "Information" + } } It "Should return values from the get method [TraceLevel]" { @@ -233,26 +233,26 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Desired setting for a log level item is a custom value, and the current setting matches" -Fixture { $testParams = @{ - Name = "My LogLevel Settings" + Name = "My LogLevel Settings" SPLogLevelSetting = @( (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePoint Server" - Name = "Database" - TraceLevel = "Unexpected" - EventLevel = "Error" - } -ClientOnly) + Area = "SharePoint Server" + Name = "Database" + TraceLevel = "Unexpected" + EventLevel = "Error" + } -ClientOnly) ) } Mock -CommandName Get-SPLogLevel -MockWith { return @{ - Area = "SharePoint Server" - Name = "Database" - TraceSeverity = "Unexpected" - EventSeverity = "Error" - DefaultTraceSeverity = "Medium" - DefaultEventSeverity = "Information" - } + Area = "SharePoint Server" + Name = "Database" + TraceSeverity = "Unexpected" + EventSeverity = "Error" + DefaultTraceSeverity = "Medium" + DefaultEventSeverity = "Information" + } } It "Should return values from the get method [TraceLevel]" { @@ -271,26 +271,26 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Desired setting for a log level item is a custom value, and the current settings do not match" -Fixture { $testParams = @{ - Name = "My LogLevel Settings" + Name = "My LogLevel Settings" SPLogLevelSetting = @( (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePoint Server" - Name = "Database" - TraceLevel = "Unexpected" - EventLevel = "Error" - } -ClientOnly) + Area = "SharePoint Server" + Name = "Database" + TraceLevel = "Unexpected" + EventLevel = "Error" + } -ClientOnly) ) } Mock -CommandName Get-SPLogLevel -MockWith { return @{ - Area = "SharePoint Server" - Name = "Database" - TraceSeverity = "Medium" - EventSeverity = "Information" - DefaultTraceSeverity = "Medium" - DefaultEventSeverity = "Information" - } + Area = "SharePoint Server" + Name = "Database" + TraceSeverity = "Medium" + EventSeverity = "Information" + DefaultTraceSeverity = "Medium" + DefaultEventSeverity = "Information" + } } It "Should return values from the get method [TraceLevel]" { @@ -313,40 +313,40 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Desired settings for an entire Area is a custom value, and all current settings match" -Fixture { $testParams = @{ - Name = "My LogLevel Settings" + Name = "My LogLevel Settings" SPLogLevelSetting = @( (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePoint Server" - Name = "*" - TraceLevel = "Medium" - EventLevel = "Information" - } -ClientOnly) + Area = "SharePoint Server" + Name = "*" + TraceLevel = "Medium" + EventLevel = "Information" + } -ClientOnly) ) } Mock -CommandName Get-SPLogLevel -MockWith { return @( @{ - Area = "SharePoint Server" - Name = "Database" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "SharePoint Server" + Name = "Database" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" }, @{ - Area = "SharePoint Server" - Name = "Audit" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "SharePoint Server" + Name = "Audit" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" }, @{ - Area = "SharePoint Server" - Name = "User Profile" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "SharePoint Server" + Name = "User Profile" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" } @@ -368,40 +368,40 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Desired settings for an entire Area is a custom value, but one category within the area does not match" -Fixture { $testParams = @{ - Name = "My LogLevel Settings" + Name = "My LogLevel Settings" SPLogLevelSetting = @( (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePoint Server" - Name = "*" - TraceLevel = "Medium" - EventLevel = "Information" - } -ClientOnly) + Area = "SharePoint Server" + Name = "*" + TraceLevel = "Medium" + EventLevel = "Information" + } -ClientOnly) ) } Mock -CommandName Get-SPLogLevel -MockWith { return @( @{ - Area = "SharePoint Server" - Name = "Database" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "SharePoint Server" + Name = "Database" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" }, @{ - Area = "SharePoint Server" - Name = "Audit" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "SharePoint Server" + Name = "Audit" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" }, @{ - Area = "SharePoint Server" - Name = "User Profile" - TraceSeverity = "Verbose" - EventSeverity = "Information" + Area = "SharePoint Server" + Name = "User Profile" + TraceSeverity = "Verbose" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" } @@ -429,64 +429,64 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Desired settings for all areas is the Default, and the current settings match" -Fixture { $testParams = @{ - Name = "My LogLevel Settings" + Name = "My LogLevel Settings" SPLogLevelSetting = @( (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "*" - Name = "*" - TraceLevel = "Default" - EventLevel = "Default" - } -ClientOnly) + Area = "*" + Name = "*" + TraceLevel = "Default" + EventLevel = "Default" + } -ClientOnly) ) } Mock -CommandName Get-SPLogLevel -MockWith { return @( @{ - Area = "Access Services" - Name = "Administration" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "Access Services" + Name = "Administration" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" }, @{ - Area = "Access Services" - Name = "Application Design" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "Access Services" + Name = "Application Design" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" }, @{ - Area = "Business Connectivity Services" - Name = "Business Data" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "Business Connectivity Services" + Name = "Business Data" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" }, @{ - Area = "SharePoint Server" - Name = "Database" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "SharePoint Server" + Name = "Database" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" }, @{ - Area = "SharePoint Server" - Name = "Audit" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "SharePoint Server" + Name = "Audit" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" }, @{ - Area = "SharePoint Server" - Name = "User Profile" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "SharePoint Server" + Name = "User Profile" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" } @@ -508,64 +508,64 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Desired settings for all areas is a custom value, and the current settings do not match" -Fixture { $testParams = @{ - Name = "My LogLevel Settings" + Name = "My LogLevel Settings" SPLogLevelSetting = @( (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "*" - Name = "*" - TraceLevel = "Medium" - EventLevel = "Verbose" - } -ClientOnly) + Area = "*" + Name = "*" + TraceLevel = "Medium" + EventLevel = "Verbose" + } -ClientOnly) ) } Mock -CommandName Get-SPLogLevel -MockWith { return @( @{ - Area = "Access Services" - Name = "Administration" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "Access Services" + Name = "Administration" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" }, @{ - Area = "Access Services" - Name = "Application Design" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "Access Services" + Name = "Application Design" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" }, @{ - Area = "Business Connectivity Services" - Name = "Business Data" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "Business Connectivity Services" + Name = "Business Data" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" }, @{ - Area = "SharePoint Server" - Name = "Database" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "SharePoint Server" + Name = "Database" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" }, @{ - Area = "SharePoint Server" - Name = "Audit" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "SharePoint Server" + Name = "Audit" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" }, @{ - Area = "SharePoint Server" - Name = "User Profile" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "SharePoint Server" + Name = "User Profile" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" } @@ -592,20 +592,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Collection input, Desired settings for all is a custom value, and the current settings do not match" -Fixture { $testParams = @{ - Name = "My LogLevel Settings" + Name = "My LogLevel Settings" SPLogLevelSetting = @( (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePoint Server" - Name = "Database" - TraceLevel = "Unexpected" - EventLevel = "Error" - } -ClientOnly) + Area = "SharePoint Server" + Name = "Database" + TraceLevel = "Unexpected" + EventLevel = "Error" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePoint Server" - Name = "User Profile" - TraceLevel = "None" - EventLevel = "Warning" - } -ClientOnly) + Area = "SharePoint Server" + Name = "User Profile" + TraceLevel = "None" + EventLevel = "Warning" + } -ClientOnly) ) } @@ -613,10 +613,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPLogLevel -MockWith { return @( @{ - Area = "placeholder" - Name = "placeholder" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "placeholder" + Name = "placeholder" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" } @@ -651,20 +651,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Collection input, Desired settings for all is a custom value, and the current settings match" -Fixture { $testParams = @{ - Name = "My LogLevel Settings" + Name = "My LogLevel Settings" SPLogLevelSetting = @( (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePoint Server" - Name = "Database" - TraceLevel = "Medium" - EventLevel = "Information" - } -ClientOnly) + Area = "SharePoint Server" + Name = "Database" + TraceLevel = "Medium" + EventLevel = "Information" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePoint Server" - Name = "User Profile" - TraceLevel = "Medium" - EventLevel = "Information" - } -ClientOnly) + Area = "SharePoint Server" + Name = "User Profile" + TraceLevel = "Medium" + EventLevel = "Information" + } -ClientOnly) ) } @@ -672,10 +672,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPLogLevel -MockWith { return @( @{ - Area = "placeholder" - Name = "placeholder" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "placeholder" + Name = "placeholder" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" } @@ -705,20 +705,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Collection input, Desired settings for all is Default value, and the current settings match" -Fixture { $testParams = @{ - Name = "My LogLevel Settings" + Name = "My LogLevel Settings" SPLogLevelSetting = @( (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePoint Server" - Name = "Database" - TraceLevel = "Default" - EventLevel = "Default" - } -ClientOnly) + Area = "SharePoint Server" + Name = "Database" + TraceLevel = "Default" + EventLevel = "Default" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePoint Server" - Name = "User Profile" - TraceLevel = "Default" - EventLevel = "Default" - } -ClientOnly) + Area = "SharePoint Server" + Name = "User Profile" + TraceLevel = "Default" + EventLevel = "Default" + } -ClientOnly) ) } @@ -726,10 +726,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPLogLevel -MockWith { return @( @{ - Area = "placeholder" - Name = "placeholder" - TraceSeverity = "Medium" - EventSeverity = "Information" + Area = "placeholder" + Name = "placeholder" + TraceSeverity = "Medium" + EventSeverity = "Information" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" } @@ -759,20 +759,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Collection input, Desired settings for all is the Default, and the current settings do not match" -Fixture { $testParams = @{ - Name = "My LogLevel Settings" + Name = "My LogLevel Settings" SPLogLevelSetting = @( (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePoint Server" - Name = "Database" - TraceLevel = "Default" - EventLevel = "Default" - } -ClientOnly) + Area = "SharePoint Server" + Name = "Database" + TraceLevel = "Default" + EventLevel = "Default" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPLogLevelItem -Property @{ - Area = "SharePoint Server" - Name = "User Profile" - TraceLevel = "Default" - EventLevel = "Default" - } -ClientOnly) + Area = "SharePoint Server" + Name = "User Profile" + TraceLevel = "Default" + EventLevel = "Default" + } -ClientOnly) ) } @@ -780,10 +780,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPLogLevel -MockWith { return @( @{ - Area = "placeholder" - Name = "placeholder" - TraceSeverity = "Verbose" - EventSeverity = "Warning" + Area = "placeholder" + Name = "placeholder" + TraceSeverity = "Verbose" + EventSeverity = "Warning" DefaultTraceSeverity = "Medium" DefaultEventSeverity = "Information" } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPMachineTranslationServiceApp.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPMachineTranslationServiceApp.Tests.ps1 index 2249fd0dc..a2d8e6acc 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPMachineTranslationServiceApp.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPMachineTranslationServiceApp.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPMachineTranslationServiceApp" + -DscResource "SPMachineTranslationServiceApp" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -22,19 +22,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $getTypeFullName = "Microsoft.Office.TranslationServices.TranslationServiceApplication" # Mocks for all contexts - Mock -CommandName New-SPTranslationServiceApplication -MockWith { return @{} } + Mock -CommandName New-SPTranslationServiceApplication -MockWith { return @{ } } Mock -CommandName Get-SPServiceApplication -MockWith { } Mock -CommandName Remove-SPServiceApplication -MockWith { } # Test contexts Context -Name "When no service applications exist in the current farm" -Fixture { $testParams = @{ - Name = "Translation Service" - ProxyName = "Machine Translation Service App Proxy" + Name = "Translation Service" + ProxyName = "Machine Translation Service App Proxy" ApplicationPool = "SharePoint Service Applications" - DatabaseServer = "SPDB" - DatabaseName = "Translation" - Ensure = "Present" + DatabaseServer = "SPDB" + DatabaseName = "Translation" + Ensure = "Present" } Mock -CommandName New-SPTranslationServiceApplication -MockWith { @@ -42,9 +42,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Name = $testParams.Name } $returnVal = $returnVal | Add-Member -MemberType ScriptMethod ` - -Name IsConnected -Value { - return $true - } -PassThru + -Name IsConnected -Value { + return $true + } -PassThru return $returnVal } @@ -52,14 +52,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPServiceApplicationProxy -MockWith { $proxiesToReturn = @() $proxy = @{ - Name = $testParams.ProxyName + Name = $testParams.ProxyName DisplayName = $testParams.ProxyName } $proxy = $proxy | Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value {} ` - -PassThru - $proxiesToReturn += $proxy + -Name Delete ` + -Value { } ` + -PassThru + $proxiesToReturn += $proxy return $proxiesToReturn } @@ -80,24 +80,24 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When service applications exist in the current farm but the specific Translation app does not" -Fixture { $testParams = @{ - Name = "Translation Service" + Name = "Translation Service" ApplicationPool = "SharePoint Service Applications" - DatabaseServer = "SPDB" - DatabaseName = "Translation" - Ensure = "Present" + DatabaseServer = "SPDB" + DatabaseName = "Translation" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - } + DisplayName = $testParams.Name + } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "Microsoft.Office.UnKnownWebServiceApplication" - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + FullName = "Microsoft.Office.UnKnownWebServiceApplication" + } + } -PassThru -Force return $spServiceApp } @@ -112,48 +112,48 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and is configured correctly" -Fixture { $testParams = @{ - Name = "Translation Service" - ProxyName = "Machine Translation Service App Proxy" + Name = "Translation Service" + ProxyName = "Machine Translation Service App Proxy" ApplicationPool = "SharePoint Service Applications" - DatabaseServer = "SPDB" - DatabaseName = "Translation" - Ensure = "Present" + DatabaseServer = "SPDB" + DatabaseName = "Translation" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Machine Translation Service" - DisplayName = $testParams.Name + TypeName = "Machine Translation Service" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return (@{ + return (@{ FullName = $getTypeFullName }) - } -PassThru -Force + } -PassThru -Force $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name IsConnected -Value { return $true - } -PassThru -Force + } -PassThru -Force return $spServiceApp } Mock -CommandName Get-SPServiceApplicationProxy -MockWith { $proxiesToReturn = @() $proxy = @{ - Name = $testParams.ProxyName + Name = $testParams.ProxyName DisplayName = $testParams.ProxyName } $proxy = $proxy | Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value {} ` - -PassThru - $proxiesToReturn += $proxy + -Name Delete ` + -Value { } ` + -PassThru + $proxiesToReturn += $proxy return $proxiesToReturn } @@ -169,30 +169,30 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and the app pool is not configured correctly" -Fixture { $testParams = @{ - Name = "Translation Service" + Name = "Translation Service" ApplicationPool = "SharePoint Service Applications" - DatabaseServer = "SPDB" - DatabaseName = "Translation" - Ensure = "Present" + DatabaseServer = "SPDB" + DatabaseName = "Translation" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Machine Translation Service" - DisplayName = $testParams.Name + TypeName = "Machine Translation Service" + DisplayName = $testParams.Name ApplicationPool = @{ Name = "Wrong App Pool Name" } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return (@{ + return (@{ FullName = $getTypeFullName }) - } -PassThru -Force + } -PassThru -Force return $spServiceApp } @@ -219,32 +219,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Assert-MockCalled Get-SPServiceApplication Assert-MockCalled Set-SPTranslationServiceApplication - } + } } Context -Name "When the service application exists but it shouldn't" -Fixture { $testParams = @{ - Name = "Translation Service" + Name = "Translation Service" ApplicationPool = "SharePoint Service Applications" - DatabaseServer = "SPDB" - DatabaseName = "Translation" - Ensure = "Absent" + DatabaseServer = "SPDB" + DatabaseName = "Translation" + Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Machine Translation Service" - DisplayName = $testParams.Name + TypeName = "Machine Translation Service" + DisplayName = $testParams.Name ApplicationPool = @{ Name = "Wrong App Pool Name" } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return (@{ + return (@{ FullName = $getTypeFullName }) } -PassThru -Force @@ -270,11 +270,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service application doesn't exist and it shouldn't" -Fixture { $testParams = @{ - Name = "Translation Service" + Name = "Translation Service" ApplicationPool = "SharePoint Service Applications" - DatabaseServer = "SPDB" - DatabaseName = "Translation" - Ensure = "Absent" + DatabaseServer = "SPDB" + DatabaseName = "Translation" + Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication -MockWith { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPManagedAccount.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPManagedAccount.Tests.ps1 index e653ec6af..6498277a9 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPManagedAccount.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPManagedAccount.Tests.ps1 @@ -2,18 +2,18 @@ [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPManagedAccount" + -DscResource "SPManagedAccount" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -22,9 +22,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Initialize tests $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force $mockCredential = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList @("username", $mockPassword) + -ArgumentList @("username", $mockPassword) - # Mocks for all contexts + # Mocks for all contexts Mock -CommandName New-SPManagedAccount -MockWith { } Mock -CommandName Set-SPManagedAccount -MockWith { } Mock -CommandName Remove-SPManagedAccount -MockWith { } @@ -32,12 +32,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Test contexts Context -Name "The specified managed account does not exist in the farm and it should" -Fixture { $testParams = @{ - Account = $mockCredential + Account = $mockCredential EmailNotification = 7 - PreExpireDays = 7 - Schedule = "" - Ensure = "Present" - AccountName = $mockCredential.Username + PreExpireDays = 7 + Schedule = "" + Ensure = "Present" + AccountName = $mockCredential.Username } Mock -CommandName Get-SPManagedAccount -MockWith { return $null } @@ -59,20 +59,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The specified managed account exists and it should but has an incorrect schedule" -Fixture { $testParams = @{ - Account = $mockCredential + Account = $mockCredential EmailNotification = 7 - PreExpireDays = 7 - Schedule = "" - Ensure = "Present" - AccountName = $mockCredential.Username + PreExpireDays = 7 + Schedule = "" + Ensure = "Present" + AccountName = $mockCredential.Username } - - Mock -CommandName Get-SPManagedAccount -MockWith { + + Mock -CommandName Get-SPManagedAccount -MockWith { return @{ - Username = $testParams.AccountName - DaysBeforeChangeToEmail = $testParams.EmailNotification + Username = $testParams.AccountName + DaysBeforeChangeToEmail = $testParams.EmailNotification DaysBeforeExpiryToChange = $testParams.PreExpireDays - ChangeSchedule = "wrong schedule" + ChangeSchedule = "wrong schedule" } } @@ -88,20 +88,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The specified managed account exists and it should but has incorrect notifcation settings" -Fixture { $testParams = @{ - Account = $mockCredential + Account = $mockCredential EmailNotification = 7 - PreExpireDays = 7 - Schedule = "" - Ensure = "Present" - AccountName = $mockCredential.Username + PreExpireDays = 7 + Schedule = "" + Ensure = "Present" + AccountName = $mockCredential.Username } - - Mock -CommandName Get-SPManagedAccount -MockWith { + + Mock -CommandName Get-SPManagedAccount -MockWith { return @{ - Username = $testParams.AccountName - DaysBeforeChangeToEmail = 0 + Username = $testParams.AccountName + DaysBeforeChangeToEmail = 0 DaysBeforeExpiryToChange = 0 - ChangeSchedule = $testParams.Schedule + ChangeSchedule = $testParams.Schedule } } @@ -112,20 +112,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The specified managed account exists and it should and is also configured correctly" -Fixture { $testParams = @{ - Account = $mockCredential + Account = $mockCredential EmailNotification = 7 - PreExpireDays = 7 - Schedule = "" - Ensure = "Present" - AccountName = $mockCredential.Username + PreExpireDays = 7 + Schedule = "" + Ensure = "Present" + AccountName = $mockCredential.Username } - - Mock -CommandName Get-SPManagedAccount -MockWith { + + Mock -CommandName Get-SPManagedAccount -MockWith { return @{ - Username = $testParams.AccountName - DaysBeforeChangeToEmail = $testParams.EmailNotification + Username = $testParams.AccountName + DaysBeforeChangeToEmail = $testParams.EmailNotification DaysBeforeExpiryToChange = $testParams.PreExpireDays - ChangeSchedule = $testParams.Schedule + ChangeSchedule = $testParams.Schedule } } @@ -137,73 +137,73 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Test-TargetResource @testParams | Should Be $true } } - + Context -Name "The specified account should exist but the account property has not been specified" -Fixture { $testParams = @{ EmailNotification = 7 - PreExpireDays = 7 - Schedule = "" - Ensure = "Present" - AccountName = "username" + PreExpireDays = 7 + Schedule = "" + Ensure = "Present" + AccountName = "username" } - - Mock -CommandName Get-SPManagedAccount -MockWith { + + Mock -CommandName Get-SPManagedAccount -MockWith { return @{ - Username = $testParams.AccountName - DaysBeforeChangeToEmail = $testParams.EmailNotification + Username = $testParams.AccountName + DaysBeforeChangeToEmail = $testParams.EmailNotification DaysBeforeExpiryToChange = $testParams.PreExpireDays - ChangeSchedule = $testParams.Schedule + ChangeSchedule = $testParams.Schedule } } - + It "Should throw an exception in the set method" { { Set-TargetResource @testParams } | Should Throw } } - + Context -Name "The specified account exists but it should not" -Fixture { $testParams = @{ - Ensure = "Absent" + Ensure = "Absent" AccountName = "username" } - Mock -CommandName Get-SPManagedAccount -MockWith { + Mock -CommandName Get-SPManagedAccount -MockWith { return @{ - Username = $testParams.AccountName - DaysBeforeChangeToEmail = $testParams.EmailNotification + Username = $testParams.AccountName + DaysBeforeChangeToEmail = $testParams.EmailNotification DaysBeforeExpiryToChange = $testParams.PreExpireDays - ChangeSchedule = $testParams.Schedule + ChangeSchedule = $testParams.Schedule } } - + It "Should return present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" } - + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false } - + It "Should call the remove cmdlet from the set method" { Set-TargetResource @testParams Assert-MockCalled Remove-SPManagedAccount } } - + Context -Name "The specified account does not exist and it should not" -Fixture { $testParams = @{ - Ensure = "Absent" + Ensure = "Absent" AccountName = "username" } - Mock -CommandName Get-SPManagedAccount -MockWith { - return $null + Mock -CommandName Get-SPManagedAccount -MockWith { + return $null } - + It "Should return absent from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - + It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $true } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPManagedMetadataServiceApp.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPManagedMetadataServiceApp.Tests.ps1 index 195c4485d..081a2c3fd 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPManagedMetadataServiceApp.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPManagedMetadataServiceApp.Tests.ps1 @@ -23,7 +23,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Mocks for all contexts # SPMetadataServiceApplication Mocks - Mock -CommandName New-SPMetadataServiceApplication -MockWith { return @{} } + Mock -CommandName New-SPMetadataServiceApplication -MockWith { return @{ } } Mock -CommandName Set-SPMetadataServiceApplication -MockWith { } # SPMetadataServiceApplicationProxy Mocks @@ -35,23 +35,23 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { -Name Update ` -Value { $Global:SPDscServiceProxyUpdateCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name Delete ` - -Value {$Global:SPDscServiceProxyDeleteCalled = $true } ` + -Value { $Global:SPDscServiceProxyDeleteCalled = $true } ` -PassThru -Force ) } Mock -CommandName Get-SPMetadataServiceApplicationProxy -MockWith { return @{ - Name = "Managed Metadata Service App Proxy" - Properties = @{ + Name = "Managed Metadata Service App Proxy" + Properties = @{ IsNPContentTypeSyndicationEnabled = $true - IsContentTypePushdownEnabled = $true + IsContentTypePushdownEnabled = $true } } | Add-Member -MemberType ScriptMethod ` -Name update ` - -Value {$Global:SPDscMetaDataServiceApplicationProxyUpdateCalled = $true} ` + -Value { $Global:SPDscMetaDataServiceApplicationProxyUpdateCalled = $true } ` -PassThru -Force } @@ -63,9 +63,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { -Name Update ` -Value { $Global:SPDscServiceProxyUpdateCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name Delete ` - -Value {$Global:SPDscServiceProxyDeleteCalled = $true } ` + -Value { $Global:SPDscServiceProxyDeleteCalled = $true } ` -PassThru -Force ) } @@ -99,23 +99,23 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { -Name AddTermStoreAdministrator ` -Value { $Global:SPDscAddUserCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name DeleteTermStoreAdministrator ` -Value { $Global:SPDscDeleteUserCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name CommitAll ` -Value { } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name AddLanguage ` -Value { $Global:SPDscAddLanguageCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name DeleteLanguage ` -Value { $Global:SPDscDeleteLanguageCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name CommitAll ` -Value { } ` -PassThru -Force @@ -163,18 +163,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Test contexts Context -Name "When no service applications exist in the current farm" -Fixture { $testParams = @{ - Name = "Managed Metadata Service App" - ApplicationPool = "SharePoint Service Applications" - DatabaseServer = "databaseserver\instance" - DatabaseName = "SP_MMS" - TermStoreAdministrators = @() - ContentTypeHubUrl = "" - ProxyName = "Proxy Name" - DefaultLanguage = 1033 - Languages = @() - ContentTypePushdownEnabled = $true + Name = "Managed Metadata Service App" + ApplicationPool = "SharePoint Service Applications" + DatabaseServer = "databaseserver\instance" + DatabaseName = "SP_MMS" + TermStoreAdministrators = @() + ContentTypeHubUrl = "" + ProxyName = "Proxy Name" + DefaultLanguage = 1033 + Languages = @() + ContentTypePushdownEnabled = $true ContentTypeSyndicationEnabled = $true - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { return $null } @@ -249,8 +249,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -286,28 +286,28 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` + Add-Member -MemberType NoteProperty ` -Name FullName ` -Value $getTypeFullName ` -PassThru | - Add-Member -MemberType ScriptMethod ` + Add-Member -MemberType ScriptMethod ` -Name GetProperties ` -Value { param($x) return @( (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` + Add-Member -MemberType NoteProperty ` -Name Name ` -Value "DatabaseMapper" ` -PassThru | - Add-Member -MemberType ScriptMethod ` + Add-Member -MemberType ScriptMethod ` -Name GetValue ` -Value { param($x) @@ -371,8 +371,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { ApplicationPool = @{ Name = "Wrong App Pool Name" } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -408,28 +408,28 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { ApplicationPool = @{ Name = "Wrong App Pool Name" } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` + Add-Member -MemberType NoteProperty ` -Name FullName ` -Value $getTypeFullName ` -PassThru | - Add-Member -MemberType ScriptMethod ` + Add-Member -MemberType ScriptMethod ` -Name GetProperties ` -Value { param($x) return @( (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` + Add-Member -MemberType NoteProperty ` -Name Name ` -Value "DatabaseMapper" ` -PassThru | - Add-Member -MemberType ScriptMethod ` + Add-Member -MemberType ScriptMethod ` -Name GetValue ` -Value { param($x) @@ -507,8 +507,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -544,28 +544,28 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { ApplicationPool = @{ Name = "Wrong App Pool Name" } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` + Add-Member -MemberType NoteProperty ` -Name FullName ` -Value $getTypeFullName ` -PassThru | - Add-Member -MemberType ScriptMethod ` + Add-Member -MemberType ScriptMethod ` -Name GetProperties ` -Value { param($x) return @( (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` + Add-Member -MemberType NoteProperty ` -Name Name ` -Value "DatabaseMapper" ` -PassThru | - Add-Member -MemberType ScriptMethod ` + Add-Member -MemberType ScriptMethod ` -Name GetValue ` -Value { param($x) @@ -637,8 +637,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { ApplicationPool = @{ Name = "Wrong App Pool Name" } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -674,28 +674,28 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { ApplicationPool = @{ Name = "Wrong App Pool Name" } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` + Add-Member -MemberType NoteProperty ` -Name FullName ` -Value $getTypeFullName ` -PassThru | - Add-Member -MemberType ScriptMethod ` + Add-Member -MemberType ScriptMethod ` -Name GetProperties ` -Value { param($x) return @( (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` + Add-Member -MemberType NoteProperty ` -Name Name ` -Value "DatabaseMapper" ` -PassThru | - Add-Member -MemberType ScriptMethod ` + Add-Member -MemberType ScriptMethod ` -Name GetValue ` -Value { param($x) @@ -737,9 +737,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { -Name Update ` -Value { $Global:SPDscServiceProxyUpdateCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name Delete ` - -Value {$Global:SPDscServiceProxyDeleteCalled = $true } ` + -Value { $Global:SPDscServiceProxyDeleteCalled = $true } ` -PassThru -Force ) } @@ -800,8 +800,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -856,8 +856,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -919,8 +919,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -966,23 +966,23 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { -Name AddTermStoreAdministrator ` -Value { $Global:SPDscAddUserCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name DeleteTermStoreAdministrator ` -Value { $Global:SPDscDeleteUserCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name CommitAll ` -Value { } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name AddLanguage ` -Value { $Global:SPDscAddLanguageCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name DeleteLanguage ` -Value { $Global:SPDscDeleteLanguageCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name CommitAll ` -Value { } ` -PassThru -Force @@ -1041,7 +1041,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { FullName = $getTypeFullName }) } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name IsConnected ` -Value { param($x) @@ -1059,9 +1059,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { -Name Update ` -Value { $Global:SPDscServiceProxyUpdateCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name Delete ` - -Value {$Global:SPDscServiceProxyDeleteCalled = $true } ` + -Value { $Global:SPDscServiceProxyDeleteCalled = $true } ` -PassThru -Force ) } @@ -1138,23 +1138,23 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { -Name AddTermStoreAdministrator ` -Value { $Global:SPDscAddUserCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name DeleteTermStoreAdministrator ` -Value { $Global:SPDscDeleteUserCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name CommitAll ` -Value { } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name AddLanguage ` -Value { $Global:SPDscAddLanguageCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name DeleteLanguage ` -Value { $Global:SPDscDeleteLanguageCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name CommitAll ` -Value { } ` -PassThru -Force @@ -1212,7 +1212,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { FullName = $getTypeFullName }) } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name IsConnected ` -Value { param($x) @@ -1301,21 +1301,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` + Add-Member -MemberType NoteProperty ` -Name FullName ` -Value $getTypeFullName ` -PassThru | - Add-Member -MemberType ScriptMethod ` + Add-Member -MemberType ScriptMethod ` -Name GetProperties ` -Value { param($x) return @( (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` + Add-Member -MemberType NoteProperty ` -Name Name ` -Value "DatabaseMapper" ` -PassThru | - Add-Member -MemberType ScriptMethod ` + Add-Member -MemberType ScriptMethod ` -Name GetValue ` -Value { param($x) @@ -1377,23 +1377,23 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { -Name AddTermStoreAdministrator ` -Value { $Global:SPDscAddUserCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name DeleteTermStoreAdministrator ` -Value { $Global:SPDscDeleteUserCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name CommitAll ` -Value { } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name AddLanguage ` -Value { $Global:SPDscAddLanguageCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name DeleteLanguage ` -Value { $Global:SPDscDeleteLanguageCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name CommitAll ` -Value { } ` -PassThru -Force @@ -1406,9 +1406,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $metadataServiceApplicationProxy = @{ - Name = "Managed Metadata Service App Proxy" - Properties = @{ - IsContentTypePushdownEnabled = $true + Name = "Managed Metadata Service App Proxy" + Properties = @{ + IsContentTypePushdownEnabled = $true IsNPContentTypeSyndicationEnabled = $true } } | Add-Member -MemberType ScriptMethod ` @@ -1570,21 +1570,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` + Add-Member -MemberType NoteProperty ` -Name FullName ` -Value $getTypeFullName ` -PassThru | - Add-Member -MemberType ScriptMethod ` + Add-Member -MemberType ScriptMethod ` -Name GetProperties ` -Value { param($x) return @( (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` + Add-Member -MemberType NoteProperty ` -Name Name ` -Value "DatabaseMapper" ` -PassThru | - Add-Member -MemberType ScriptMethod ` + Add-Member -MemberType ScriptMethod ` -Name GetValue ` -Value { param($x) @@ -1626,9 +1626,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { -Name Update ` -Value { $Global:SPDscServiceProxyUpdateCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name Delete ` - -Value {$Global:SPDscServiceProxyDeleteCalled = $true } ` + -Value { $Global:SPDscServiceProxyDeleteCalled = $true } ` -PassThru -Force ) } @@ -1657,23 +1657,23 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { -Name AddTermStoreAdministrator ` -Value { $Global:SPDscAddUserCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name DeleteTermStoreAdministrator ` -Value { $Global:SPDscDeleteUserCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name CommitAll ` -Value { } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name AddLanguage ` -Value { $Global:SPDscAddLanguageCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name DeleteLanguage ` -Value { $Global:SPDscDeleteLanguageCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name CommitAll ` -Value { } ` -PassThru -Force diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPManagedMetadataServiceAppDefault.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPManagedMetadataServiceAppDefault.Tests.ps1 index 261f1c4e2..07975c3dc 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPManagedMetadataServiceAppDefault.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPManagedMetadataServiceAppDefault.Tests.ps1 @@ -28,13 +28,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { IsDefaultKeywordTaxonomy = $false } } ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name Update ` -Value { ` $Global:SPDscServiceProxyUpdateCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name GetType ` -Value { ` return (@{ @@ -51,13 +51,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { IsDefaultKeywordTaxonomy = $true } } ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name Update ` -Value { ` $Global:SPDscServiceProxyUpdateCalledDefault = $true ` } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name GetType ` -Value { ` return (@{ @@ -93,7 +93,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Name = "Mock Proxy" } ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name GetType ` -Value { ` return (@{ @@ -128,13 +128,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { IsDefaultKeywordTaxonomy = $false } } ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name Update ` -Value { ` $Global:SPDscServiceProxyUpdateCalled = $true } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name GetType ` -Value { ` return (@{ @@ -219,13 +219,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { IsDefaultKeywordTaxonomy = $true } } ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name Update ` -Value { ` $Global:SPDscServiceProxyUpdateCalledDefault = $true ` } ` -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` + | Add-Member -MemberType ScriptMethod ` -Name GetType ` -Value { ` return (@{ diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPManagedPath.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPManagedPath.Tests.ps1 index 8f8b3687c..17477313c 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPManagedPath.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPManagedPath.Tests.ps1 @@ -1,24 +1,24 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPManagedPath" + -DscResource "SPManagedPath" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - - # Mocks for all contexts + + # Mocks for all contexts Mock -CommandName New-SPManagedPath -MockWith { } Mock -CommandName Remove-SPManagedPath -MockWith { } @@ -32,8 +32,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Ensure = "Present" } - Mock -CommandName Get-SPManagedPath -MockWith { - return $null + Mock -CommandName Get-SPManagedPath -MockWith { + return $null } It "Should return absent from the get method" { @@ -64,12 +64,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { HostHeader = $false Ensure = "Present" } - - Mock -CommandName Get-SPManagedPath -MockWith { + + Mock -CommandName Get-SPManagedPath -MockWith { return @{ Name = $testParams.RelativeUrl Type = "ExplicitInclusion" - } + } } It "Should return false from the test method" { @@ -85,12 +85,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { HostHeader = $false Ensure = "Present" } - - Mock -CommandName Get-SPManagedPath -MockWith { + + Mock -CommandName Get-SPManagedPath -MockWith { return @{ Name = $testParams.RelativeUrl Type = "WildcardInclusion" - } + } } It "Should return present from the get method" { @@ -101,7 +101,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Test-TargetResource @testParams | Should Be $true } } - + Context -Name "The managed path exists but shouldn't" -Fixture { $testParams = @{ WebAppUrl = "http://sites.sharepoint.com" @@ -111,27 +111,27 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Ensure = "Absent" } - Mock -CommandName Get-SPManagedPath -MockWith { + Mock -CommandName Get-SPManagedPath -MockWith { return @{ Name = $testParams.RelativeUrl Type = "WildcardInclusion" - } + } } - + It "Should return present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" } - + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false } - + It "Should call the remove cmdlet from the set method" { Set-TargetResource @testParams Assert-MockCalled Remove-SPManagedPath } } - + Context -Name "The managed path doesn't exist and shouldn't" -Fixture { $testParams = @{ WebAppUrl = "http://sites.sharepoint.com" @@ -140,15 +140,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { HostHeader = $false Ensure = "Absent" } - - Mock -CommandName Get-SPManagedPath -MockWith { - return $null + + Mock -CommandName Get-SPManagedPath -MockWith { + return $null } - + It "Should return absent from the set method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - + It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $true } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPMinRoleCompliance.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPMinRoleCompliance.Tests.ps1 index 14274f7ee..f66338415 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPMinRoleCompliance.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPMinRoleCompliance.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPMinRoleCompliance" + -DscResource "SPMinRoleCompliance" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -24,17 +24,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscRoleTestMethod -MockWith { $obj = New-Object -TypeName System.Object $obj = $obj | Add-Member -MemberType ScriptMethod ` - -Name Invoke ` - -Value { - return $global:SPDscIsRoleCompliant - } -PassThru -Force + -Name Invoke ` + -Value { + return $global:SPDscIsRoleCompliant + } -PassThru -Force return $obj } # Test contexts switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { Context -Name "All methods throw exceptions as MinRole doesn't exist in 2013" -Fixture { It "Should throw on the get method" { { Get-TargetResource @testParams } | Should Throw @@ -49,23 +50,24 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - 16 { + 16 + { Context -Name "The farm is not compliant as services aren't running but should be" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - State = "Compliant" + State = "Compliant" } Mock -CommandName Get-SPService -MockWith { return @( @{ CompliantWithMinRole = $true - Instances = @( + Instances = @( @{ - Id = (New-Guid) - Status = "Disabled" + Id = (New-Guid) + Status = "Disabled" TypeName = "Dummy service 1" - Server = @{ + Server = @{ Name = "ServerName" } } @@ -73,12 +75,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } @{ CompliantWithMinRole = $false - Instances = @( + Instances = @( @{ - Id = (New-Guid) - Status = "Disabled" + Id = (New-Guid) + Status = "Disabled" TypeName = "Dummy service 2" - Server = @{ + Server = @{ Name = "ServerName" } } @@ -107,19 +109,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The farm is not compliant as services are running that shouldn't be" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - State = "Compliant" + State = "Compliant" } Mock -CommandName Get-SPService -MockWith { return @( @{ CompliantWithMinRole = $false - Instances = @( + Instances = @( @{ - Id = (New-Guid) - Status = "Online" + Id = (New-Guid) + Status = "Online" TypeName = "Dummy service 1" - Server = @{ + Server = @{ Name = "ServerName" } } @@ -127,12 +129,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } @{ CompliantWithMinRole = $true - Instances = @( + Instances = @( @{ - Id = (New-Guid) - Status = "Online" + Id = (New-Guid) + Status = "Online" TypeName = "Dummy service 2" - Server = @{ + Server = @{ Name = "ServerName" } } @@ -161,24 +163,24 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The farm is compliant and should be" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - State = "Compliant" + State = "Compliant" } $testParams = @{ IsSingleInstance = "Yes" - State = "Compliant" + State = "Compliant" } Mock -CommandName Get-SPService -MockWith { return @( @{ CompliantWithMinRole = $true - Instances = @( + Instances = @( @{ - Id = (New-Guid) - Status = "Disabled" + Id = (New-Guid) + Status = "Disabled" TypeName = "Dummy service 1" - Server = @{ + Server = @{ Name = "ServerName" } } @@ -186,12 +188,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } @{ CompliantWithMinRole = $true - Instances = @( + Instances = @( @{ - Id = (New-Guid) - Status = "Disabled" + Id = (New-Guid) + Status = "Disabled" TypeName = "Dummy service 2" - Server = @{ + Server = @{ Name = "ServerName" } } @@ -214,7 +216,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "NonCompliant is requested in any function" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - State = "NonCompliant" + State = "NonCompliant" } It "Should throw on the test method" { @@ -226,7 +228,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPOfficeOnlineServerBinding.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPOfficeOnlineServerBinding.Tests.ps1 index a4bef31ce..f35f4cef6 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPOfficeOnlineServerBinding.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPOfficeOnlineServerBinding.Tests.ps1 @@ -1,29 +1,29 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPOfficeOnlineServerBinding" + -DscResource "SPOfficeOnlineServerBinding" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - # Mocks for all contexts - Mock -CommandName Remove-SPWOPIBinding -MockWith {} - Mock -CommandName New-SPWOPIBinding -MockWith {} - Mock -CommandName Set-SPWOPIZone -MockWith {} + # Mocks for all contexts + Mock -CommandName Remove-SPWOPIBinding -MockWith { } + Mock -CommandName New-SPWOPIBinding -MockWith { } + Mock -CommandName Set-SPWOPIZone -MockWith { } Mock -CommandName Get-SPWOPIZone -MockWith { return "internal-https" } - + # Test contexts Context -Name "No bindings are set for the specified zone, but they should be" -Fixture { $testParams = @{ @@ -37,7 +37,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should return absent from the get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return false from the test method" { @@ -46,7 +46,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should create the bindings in the set method" { Set-TargetResource @testParams - Assert-MockCalled New-SPWOPIBinding + Assert-MockCalled New-SPWOPIBinding Assert-MockCalled Set-SPWOPIZone } } @@ -77,7 +77,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should remove the old bindings and create the new bindings in the set method" { Set-TargetResource @testParams Assert-MockCalled Remove-SPWOPIBinding - Assert-MockCalled New-SPWOPIBinding + Assert-MockCalled New-SPWOPIBinding Assert-MockCalled Set-SPWOPIZone } } @@ -133,7 +133,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Set-TargetResource @testParams Assert-MockCalled Remove-SPWOPIBinding } - } + } Context -Name "Bindings are not set for the specified zone, and they should not be" -Fixture { $testParams = @{ diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPOutgoingEmailSettings.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPOutgoingEmailSettings.Tests.ps1 index c42e5cec7..597e7cd87 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPOutgoingEmailSettings.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPOutgoingEmailSettings.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPOutgoingEmailSettings" + -DscResource "SPOutgoingEmailSettings" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -21,14 +21,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Test contexts Context -Name "The Web Application isn't available" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - SMTPServer = "smtp.contoso.com" - FromAddress = "from@email.com" + WebAppUrl = "http://sharepoint.contoso.com" + SMTPServer = "smtp.contoso.com" + FromAddress = "from@email.com" ReplyToAddress = "reply@email.com" - CharacterSet= "65001" + CharacterSet = "65001" } - Mock -CommandName Get-SPWebApplication -MockWith { + Mock -CommandName Get-SPWebApplication -MockWith { return $null } @@ -47,24 +47,24 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web application exists and the properties match" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - SMTPServer = "smtp.contoso.com" - FromAddress = "from@email.com" + WebAppUrl = "http://sharepoint.contoso.com" + SMTPServer = "smtp.contoso.com" + FromAddress = "from@email.com" ReplyToAddress = "reply@email.com" - CharacterSet= "65001" + CharacterSet = "65001" } Mock -CommandName Get-SPWebapplication -MockWith { return @{ - Url= "http://sharepoint.contoso.com" - OutboundMailServiceInstance= @{ + Url = "http://sharepoint.contoso.com" + OutboundMailServiceInstance = @{ Server = @{ Name = "smtp.contoso.com" } } - OutboundMailSenderAddress = "from@email.com" - OutboundMailReplyToAddress= "reply@email.com" - OutboundMailCodePage= "65001" + OutboundMailSenderAddress = "from@email.com" + OutboundMailReplyToAddress = "reply@email.com" + OutboundMailCodePage = "65001" } } @@ -79,42 +79,42 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web application exists and the properties don't match" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - SMTPServer = "smtp.contoso.com" - FromAddress = "from@email.com" + WebAppUrl = "http://sharepoint.contoso.com" + SMTPServer = "smtp.contoso.com" + FromAddress = "from@email.com" ReplyToAddress = "reply@email.com" - CharacterSet= "65001" + CharacterSet = "65001" } Mock -CommandName Get-SPWebapplication -MockWith { $result = @{ - Url= "http://sharepoint.contoso.com" - OutboundMailServiceInstance= @{ + Url = "http://sharepoint.contoso.com" + OutboundMailServiceInstance = @{ Server = @{ Name = "smtp2.contoso.com" } } - OutboundMailSenderAddress = "from@email.com" - OutboundMailReplyToAddress= "reply@email.com" - OutboundMailCodePage= "65001" + OutboundMailSenderAddress = "from@email.com" + OutboundMailReplyToAddress = "reply@email.com" + OutboundMailCodePage = "65001" } $result = $result | Add-Member -MemberType ScriptMethod ` - -Name UpdateMailSettings ` - -Value { - param( - [string] - $SMTPServer, - - [string] - $FromAddress, - - [string] - $ReplyToAddress, - [string] - $CharacterSet - ) - $Global:SPDscUpdateMailSettingsCalled = $true; - } -PassThru + -Name UpdateMailSettings ` + -Value { + param( + [string] + $SMTPServer, + + [string] + $FromAddress, + + [string] + $ReplyToAddress, + [string] + $CharacterSet + ) + $Global:SPDscUpdateMailSettingsCalled = $true; + } -PassThru return $result } @@ -137,12 +137,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { Context -Name "UseTLS is using in SharePoint 2013" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - SMTPServer = "smtp.contoso.com" - FromAddress = "from@email.com" + WebAppUrl = "http://sharepoint.contoso.com" + SMTPServer = "smtp.contoso.com" + FromAddress = "from@email.com" ReplyToAddress = "reply@email.com" - UseTLS = $true - CharacterSet= "65001" + UseTLS = $true + CharacterSet = "65001" } It "Should throw an exception in the get method" { @@ -160,12 +160,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "SMTPPort is using in SharePoint 2013" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - SMTPServer = "smtp.contoso.com" - FromAddress = "from@email.com" + WebAppUrl = "http://sharepoint.contoso.com" + SMTPServer = "smtp.contoso.com" + FromAddress = "from@email.com" ReplyToAddress = "reply@email.com" - SMTPPort = 25 - CharacterSet= "65001" + SMTPPort = 25 + CharacterSet = "65001" } It "Should throw an exception in the get method" { @@ -186,28 +186,28 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { Context -Name "The web application exists and the properties match - SharePoint 2016/2019" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - SMTPServer = "smtp.contoso.com" - FromAddress = "from@email.com" - CharacterSet= "65001" + WebAppUrl = "http://sharepoint.contoso.com" + SMTPServer = "smtp.contoso.com" + FromAddress = "from@email.com" + CharacterSet = "65001" ReplyToAddress = "reply@email.com" - UseTLS = $false - SMTPPort = 25 + UseTLS = $false + SMTPPort = 25 } Mock -CommandName Get-SPWebapplication -MockWith { return @{ - Url= "http://sharepoint.contoso.com" - OutboundMailServiceInstance= @{ + Url = "http://sharepoint.contoso.com" + OutboundMailServiceInstance = @{ Server = @{ Name = "smtp.contoso.com" } } - OutboundMailSenderAddress = "from@email.com" - OutboundMailReplyToAddress= "reply@email.com" - OutboundMailCodePage= "65001" - OutboundMailEnableSsl = $false - OutboundMailPort = 25 + OutboundMailSenderAddress = "from@email.com" + OutboundMailReplyToAddress = "reply@email.com" + OutboundMailCodePage = "65001" + OutboundMailEnableSsl = $false + OutboundMailPort = 25 } } @@ -222,53 +222,53 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web application exists and the properties don't match - SharePoint 2016/2019" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - SMTPServer = "smtp.contoso.com" - FromAddress = "from@email.com" + WebAppUrl = "http://sharepoint.contoso.com" + SMTPServer = "smtp.contoso.com" + FromAddress = "from@email.com" ReplyToAddress = "reply@email.com" - CharacterSet= "65001" - UseTLS = $true - SMTPPort = 25 + CharacterSet = "65001" + UseTLS = $true + SMTPPort = 25 } Mock -CommandName Get-SPWebapplication -MockWith { $result = @{ - Url= "http://sharepoint.contoso.com" - OutboundMailServiceInstance= @{ + Url = "http://sharepoint.contoso.com" + OutboundMailServiceInstance = @{ Server = @{ Name = "smtp.contoso.com" } } - OutboundMailSenderAddress = "from@email.com" - OutboundMailReplyToAddress= "reply@email.com" - OutboundMailCodePage= "65001" - OutboundMailEnableSsl = $false - OutboundMailPort = 25 + OutboundMailSenderAddress = "from@email.com" + OutboundMailReplyToAddress = "reply@email.com" + OutboundMailCodePage = "65001" + OutboundMailEnableSsl = $false + OutboundMailPort = 25 } $result = $result | Add-Member -MemberType ScriptMethod ` - -Name UpdateMailSettings ` - -Value { - param( - [string] - $SMTPServer, + -Name UpdateMailSettings ` + -Value { + param( + [string] + $SMTPServer, - [string] - $FromAddress, + [string] + $FromAddress, - [string] - $ReplyToAddress, + [string] + $ReplyToAddress, - [string] - $CharacterSet, + [string] + $CharacterSet, - [bool] - $EnableSsl, + [bool] + $EnableSsl, - [string] - $Port - ) - $Global:SPDscUpdateMailSettingsCalled = $true; - } -PassThru + [string] + $Port + ) + $Global:SPDscUpdateMailSettingsCalled = $true; + } -PassThru return $result } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPPasswordChangeSettings.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPPasswordChangeSettings.Tests.ps1 index f022f2bec..3694c5e78 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPPasswordChangeSettings.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPPasswordChangeSettings.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPPasswordChangeSettings" + -DscResource "SPPasswordChangeSettings" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -21,9 +21,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Test contexts Context -Name "No local SharePoint farm is available" { $testParams = @{ - IsSingleInstance = "Yes" - MailAddress = "e@mail.com" - DaysBeforeExpiry = 7 + IsSingleInstance = "Yes" + MailAddress = "e@mail.com" + DaysBeforeExpiry = 7 PasswordChangeWaitTimeSeconds = 60 } @@ -43,18 +43,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "There is a local SharePoint farm and the properties are set correctly" { $testParams = @{ - IsSingleInstance = "Yes" - MailAddress = "e@mail.com" - DaysBeforeExpiry = 7 + IsSingleInstance = "Yes" + MailAddress = "e@mail.com" + DaysBeforeExpiry = 7 PasswordChangeWaitTimeSeconds = 60 } Mock -CommandName Get-SPFarm -MockWith { return @{ - PasswordChangeEmailAddress = "e@mail.com" + PasswordChangeEmailAddress = "e@mail.com" DaysBeforePasswordExpirationToSendEmail = 7 - PasswordChangeGuardTime = 60 - PasswordChangeMaximumTries = 3 + PasswordChangeGuardTime = 60 + PasswordChangeMaximumTries = 3 } } @@ -69,24 +69,24 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "There is a local SharePoint farm and the properties are not set correctly" { $testParams = @{ - IsSingleInstance = "Yes" - MailAddress = "e@mail.com" - DaysBeforeExpiry = 7 + IsSingleInstance = "Yes" + MailAddress = "e@mail.com" + DaysBeforeExpiry = 7 PasswordChangeWaitTimeSeconds = 60 } Mock -CommandName Get-SPFarm -MockWith { $result = @{ - PasswordChangeEmailAddress = "" - PasswordChangeGuardTime = 0 - PasswordChangeMaximumTries = 0 + PasswordChangeEmailAddress = "" + PasswordChangeGuardTime = 0 + PasswordChangeMaximumTries = 0 DaysBeforePasswordExpirationToSendEmail = 0 } $result = $result | Add-Member ScriptMethod Update { $Global:SPDscFarmUpdateCalled = $true return $true; - } -PassThru + } -PassThru return $result } @@ -102,7 +102,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $Global:SPDscFarmUpdateCalled = $false Set-TargetResource @testParams Assert-MockCalled Get-SPFarm - $Global:SPDscFarmUpdateCalled | Should Be $true + $Global:SPDscFarmUpdateCalled | Should Be $true } } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPPerformancePointServiceApp.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPPerformancePointServiceApp.Tests.ps1 index 46c92157c..71830b6ae 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPPerformancePointServiceApp.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPPerformancePointServiceApp.Tests.ps1 @@ -1,41 +1,41 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPPerformancePointServiceApp" + -DscResource "SPPerformancePointServiceApp" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - #Initialize tests + #Initialize tests $getTypeFullName = "Microsoft.PerformancePoint.Scorecards.BIMonitoringServiceApplication" - - # Mocks for all contexts - Mock -CommandName Remove-SPServiceApplication -MockWith { } + + # Mocks for all contexts + Mock -CommandName Remove-SPServiceApplication -MockWith { } Mock -CommandName Get-SPServiceApplication -MockWith { return $null } - Mock -CommandName New-SPPerformancePointServiceApplication -MockWith { } - Mock -CommandName New-SPPerformancePointServiceApplicationProxy -MockWith { } + Mock -CommandName New-SPPerformancePointServiceApplication -MockWith { } + Mock -CommandName New-SPPerformancePointServiceApplicationProxy -MockWith { } # Test contexts Context -Name "When no service applications exist in the current farm" -Fixture { $testParams = @{ - Name = "Test Performance Point App" + Name = "Test Performance Point App" ApplicationPool = "Test App Pool" } It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return false when the Test method is called" { @@ -44,61 +44,61 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should create a new service application in the set method" { Set-TargetResource @testParams - Assert-MockCalled New-SPPerformancePointServiceApplication + Assert-MockCalled New-SPPerformancePointServiceApplication } } Context -Name "When service applications exist in the current farm but the specific Performance Point app does not" -Fixture { $testParams = @{ - Name = "Test Performance Point App" + Name = "Test Performance Point App" ApplicationPool = "Test App Pool" } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - } + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + DisplayName = $testParams.Name + } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "Microsoft.Office.UnKnownWebServiceApplication" - } - } -PassThru -Force - return $spServiceApp + -Name GetType ` + -Value { + return @{ + FullName = "Microsoft.Office.UnKnownWebServiceApplication" + } + } -PassThru -Force + return $spServiceApp } It "Should return null from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } } Context -Name "When a service application exists and is configured correctly" -Fixture { $testParams = @{ - Name = "Test Performance Point App" + Name = "Test Performance Point App" ApplicationPool = "Test App Pool" } - Mock -CommandName Get-SPServiceApplication -MockWith { + Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "PerformancePoint Service Application" - DisplayName = $testParams.Name - ApplicationPool = @{ - Name = $testParams.ApplicationPool + TypeName = "PerformancePoint Service Application" + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool } } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = $getTypeFullName - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + FullName = $getTypeFullName + } + } -PassThru -Force return $spServiceApp } @@ -113,31 +113,31 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and is not configured correctly" -Fixture { $testParams = @{ - Name = "Test Performance Point App" + Name = "Test Performance Point App" ApplicationPool = "Test App Pool" } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - TypeName = "Access Services Web Service Application" - DisplayName = $testParams.Name - DatabaseServer = $testParams.DatabaseName + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + TypeName = "Access Services Web Service Application" + DisplayName = $testParams.Name + DatabaseServer = $testParams.DatabaseName ApplicationPool = @{ Name = "Wrong app pool name" } } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = $getTypeFullName - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + FullName = $getTypeFullName + } + } -PassThru -Force return $spServiceApp } - Mock -CommandName Get-SPServiceApplicationPool -MockWith { - return @{ - Name = $testParams.ApplicationPool - } + Mock -CommandName Get-SPServiceApplicationPool -MockWith { + return @{ + Name = $testParams.ApplicationPool + } } It "Should return false when the Test method is called" { @@ -149,55 +149,55 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Assert-MockCalled Get-SPServiceApplicationPool } } - + Context -Name "When the service application exists but it shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "-" - Ensure = "Absent" + Ensure = "Absent" } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - TypeName = "PerformancePoint Service Application" - DisplayName = $testParams.Name + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + TypeName = "PerformancePoint Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = "Wrong App Pool Name" } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } - + It "Should return present from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Present" + (Get-TargetResource @testParams).Ensure | Should Be "Present" } - + It "Should return false when the Test method is called" { Test-TargetResource @testParams | Should Be $false } - + It "Should call the remove service application cmdlet in the set method" { Set-TargetResource @testParams Assert-MockCalled Remove-SPServiceApplication } } - + Context -Name "When the serivce application doesn't exist and it shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "-" - Ensure = "Absent" + Ensure = "Absent" } - Mock -CommandName Get-SPServiceApplication -MockWith { - return $null + Mock -CommandName Get-SPServiceApplication -MockWith { + return $null } - + It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - + It "Should return true when the Test method is called" { Test-TargetResource @testParams | Should Be $true } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPProductUpdate.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPProductUpdate.Tests.ps1 index de4722d2d..1bb1ac2d4 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPProductUpdate.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPProductUpdate.Tests.ps1 @@ -14,10 +14,10 @@ Import-Module -Name (Join-Path -Path $PSScriptRoot ` $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` -DscResource "SPProductUpdate" - # Write-Host $PSScriptRoot +# Write-Host $PSScriptRoot $Global:TestRegistryData = Import-PowerShellDataFile -Path (Join-Path -Path $PSScriptRoot ` - -ChildPath "SharePointDsc.SPProductUpdate.Tests.psd1" ` - -Resolve) + -ChildPath "SharePointDsc.SPProductUpdate.Tests.psd1" ` + -Resolve) Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -39,7 +39,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { ) $productVersion = 2013 - if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16) { + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16) + { if ($Global:SPDscHelper.CurrentStubBuildNumber.Build.ToString().Length -eq 4) { $productVersion = 2016 @@ -89,6 +90,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return $true } + # Additional mock needed for fixing #1087 + Mock -CommandName Get-SPFarm { + return $true + } + Mock -CommandName Get-Service -MockWith { $service = @{ Status = "Running" @@ -162,7 +168,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $Path -and $Path.Length -eq 1 -and $Path[0].Contains("HKEY_LOCAL_MACHINE") } - Mock -CommandName Clear-ComObject -MockWith {} + Mock -CommandName Clear-ComObject -MockWith { } # Test contexts Context -Name "Specified update file not found" -Fixture { @@ -184,7 +190,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { Set-TargetResource @testParams } | Should Throw "Setup file cannot be found" } - It "Should throw exception in the test method" { + It "Should throw exception in the test method" { { Test-TargetResource @testParams } | Should Throw "Setup file cannot be found" } } @@ -212,7 +218,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { Set-TargetResource @testParams } | Should Throw "Setup file is blocked!" } - It "Should throw exception in the test method" { + It "Should throw exception in the test method" { { Test-TargetResource @testParams } | Should Throw "Setup file is blocked!" } } @@ -246,6 +252,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Add-TestRegistryData -PatchLevel "RTM" + Mock -CommandName Get-SPFarm { + return $null + } + Mock -CommandName Get-ItemProperty -MockWith { if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { @@ -294,6 +304,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should run the Start-Process function in the set method" { Set-TargetResource @testParams + # MockCalled set to 0, as there is no farm available. + Assert-MockCalled Get-Service -Exactly 0 Assert-MockCalled Start-Process } @@ -350,24 +362,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $installerMock = New-Module -AsCustomObject -ScriptBlock { - function GetType { # Installer + function GetType + { # Installer New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # InstallerDB + function GetType + { # InstallerDB New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # DBView + function GetType + { # DBView New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($a -eq "Fetch") { New-Module -AsCustomObject -ScriptBlock { - function GetType { # Value + function GetType + { # Value New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { @@ -468,24 +488,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $installerMock = New-Module -AsCustomObject -ScriptBlock { - function GetType { # Installer + function GetType + { # Installer New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # InstallerDB + function GetType + { # InstallerDB New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # DBView + function GetType + { # DBView New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($a -eq "Fetch") { New-Module -AsCustomObject -ScriptBlock { - function GetType { # Value + function GetType + { # Value New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { @@ -586,24 +614,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $installerMock = New-Module -AsCustomObject -ScriptBlock { - function GetType { # Installer + function GetType + { # Installer New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # InstallerDB + function GetType + { # InstallerDB New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # DBView + function GetType + { # DBView New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($a -eq "Fetch") { New-Module -AsCustomObject -ScriptBlock { - function GetType { # Value + function GetType + { # Value New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { @@ -652,6 +688,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should run the Start-Process function in the set method" { Set-TargetResource @testParams + Assert-MockCalled Get-Service -Exactly 6 Assert-MockCalled Start-Process } @@ -700,24 +737,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $installerMock = New-Module -AsCustomObject -ScriptBlock { - function GetType { # Installer + function GetType + { # Installer New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # InstallerDB + function GetType + { # InstallerDB New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # DBView + function GetType + { # DBView New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($a -eq "Fetch") { New-Module -AsCustomObject -ScriptBlock { - function GetType { # Value + function GetType + { # Value New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($Global:SPDscHelper.CurrentStubBuildNumber.Build.ToString().Length -eq 4) { @@ -793,24 +838,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $installerMock = New-Module -AsCustomObject -ScriptBlock { - function GetType { # Installer + function GetType + { # Installer New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # InstallerDB + function GetType + { # InstallerDB New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # DBView + function GetType + { # DBView New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($a -eq "Fetch") { New-Module -AsCustomObject -ScriptBlock { - function GetType { # Value + function GetType + { # Value New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) return "15.0.4569" } @@ -871,24 +924,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $installerMock = New-Module -AsCustomObject -ScriptBlock { - function GetType { # Installer + function GetType + { # Installer New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # InstallerDB + function GetType + { # InstallerDB New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # DBView + function GetType + { # DBView New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($a -eq "Fetch") { New-Module -AsCustomObject -ScriptBlock { - function GetType { # Value + function GetType + { # Value New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) return "15.0.4571" } @@ -949,24 +1010,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $installerMock = New-Module -AsCustomObject -ScriptBlock { - function GetType { # Installer + function GetType + { # Installer New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # InstallerDB + function GetType + { # InstallerDB New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # DBView + function GetType + { # DBView New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($a -eq "Fetch") { New-Module -AsCustomObject -ScriptBlock { - function GetType { # Value + function GetType + { # Value New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) return "15.0.4571" } @@ -1062,24 +1131,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $installerMock = New-Module -AsCustomObject -ScriptBlock { - function GetType { # Installer + function GetType + { # Installer New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # InstallerDB + function GetType + { # InstallerDB New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # DBView + function GetType + { # DBView New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($a -eq "Fetch") { New-Module -AsCustomObject -ScriptBlock { - function GetType { # Value + function GetType + { # Value New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { @@ -1194,24 +1271,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $installerMock = New-Module -AsCustomObject -ScriptBlock { - function GetType { # Installer + function GetType + { # Installer New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # InstallerDB + function GetType + { # InstallerDB New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # DBView + function GetType + { # DBView New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($a -eq "Fetch") { New-Module -AsCustomObject -ScriptBlock { - function GetType { # Value + function GetType + { # Value New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { @@ -1317,24 +1402,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $installerMock = New-Module -AsCustomObject -ScriptBlock { - function GetType { # Installer + function GetType + { # Installer New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # InstallerDB + function GetType + { # InstallerDB New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # DBView + function GetType + { # DBView New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($a -eq "Fetch") { New-Module -AsCustomObject -ScriptBlock { - function GetType { # Value + function GetType + { # Value New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { @@ -1436,24 +1529,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $installerMock = New-Module -AsCustomObject -ScriptBlock { - function GetType { # Installer + function GetType + { # Installer New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # InstallerDB + function GetType + { # InstallerDB New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # DBView + function GetType + { # DBView New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($a -eq "Fetch") { New-Module -AsCustomObject -ScriptBlock { - function GetType { # Value + function GetType + { # Value New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { @@ -1555,24 +1656,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $installerMock = New-Module -AsCustomObject -ScriptBlock { - function GetType { # Installer + function GetType + { # Installer New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # InstallerDB + function GetType + { # InstallerDB New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # DBView + function GetType + { # DBView New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($a -eq "Fetch") { New-Module -AsCustomObject -ScriptBlock { - function GetType { # Value + function GetType + { # Value New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { @@ -1677,24 +1786,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $installerMock = New-Module -AsCustomObject -ScriptBlock { - function GetType { # Installer + function GetType + { # Installer New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # InstallerDB + function GetType + { # InstallerDB New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { New-Module -AsCustomObject -ScriptBlock { - function GetType { # DBView + function GetType + { # DBView New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($a -eq "Fetch") { New-Module -AsCustomObject -ScriptBlock { - function GetType { # Value + function GetType + { # Value New-Module -AsCustomObject -ScriptBlock { - function InvokeMember { + function InvokeMember + { param ($a, $b, $c, $d, $e) if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPProductUpdate.Tests.psd1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPProductUpdate.Tests.psd1 index 27904b8c2..c4e8893e9 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPProductUpdate.Tests.psd1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPProductUpdate.Tests.psd1 @@ -1,6 +1,6 @@ @{ - "2013" = @{ - "RTM" = @{ + "2013" = @{ + "RTM" = @{ "Products" = @' [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products] @@ -2317,7 +2317,7 @@ [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\00005109F70100000100000000F01FEC\Usage] '@ - "Patches" = @' + "Patches" = @' [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\0AE22574CBE1266379CC1B5852EA79B8] @@ -2356,9 +2356,9 @@ [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\FC874E96D96E25548B839615EB3B50B4] "LocalPackage"="c:\\windows\\Installer\\17c2f9.msp" '@ - } - "SP1" = @{ - "Products" = @' + } + "SP1" = @{ + "Products" = @' [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\00005109061100000100000000F01FEC] @@ -4634,15 +4634,15 @@ [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\00005109F70100000100000000F01FEC\Usage] '@ - "Patches" = @' + "Patches" = @' [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\13CC565AFC9A4EB4AB99E119F1FB7CD7] "LocalPackage"="C:\\Windows\\Installer\\548de.msp" '@ - } - "CU" = @{ - "Products" = @' + } + "CU" = @{ + "Products" = @' [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\00005109061100000100000000F01FEC] @@ -7988,7 +7988,7 @@ [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\00005109F70100000100000000F01FEC\Usage] '@ - "Patches" = @' + "Patches" = @' [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\02D2CD0BA1A18494E95A2D6FBD92CE9B] @@ -8204,12 +8204,12 @@ [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\FC007DB1EA079074D91105C96F248583] "LocalPackage"="C:\\Windows\\Installer\\47b911.msp" '@ - } - } + } + } - "2016" = @{ - "RTM" = @{ - "Products" = @' + "2016" = @{ + "RTM" = @{ + "Products" = @' [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\00006109410100000100000000F01FEC] @@ -8862,7 +8862,7 @@ [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\00006109F101C0400100000000F01FEC\Usage] '@ - "Patches" = @' + "Patches" = @' [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\014C4FD0FAEDDE54794B4999D7605596] @@ -8922,9 +8922,9 @@ [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\D283AD42AD4D69E4AB744221D4AB4A63] "LocalPackage"="C:\\Windows\\Installer\\757f9ad.msp" '@ - } - "CU" = @{ - "Products" = @' + } + "CU" = @{ + "Products" = @' [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\00006109211101400100000000F01FEC] @@ -22253,7 +22253,7 @@ [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\00006109F101F3400100000000F01FEC\Usage] '@ - "Patches" = @' + "Patches" = @' [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\00F1E6D4C986CDB47822250CE3F14EC3] @@ -22595,12 +22595,12 @@ [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\FD35F77275C690E4B8253C29AD73DE3F] "LocalPackage"="C:\\Windows\\Installer\\22ff5b3.msp" '@ - } - } + } + } - "2019" = @{ - "RTM" = @{ - "Products" = @' + "2019" = @{ + "RTM" = @{ + "Products" = @' [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\00006109210100000100000000F01FEC] @@ -23209,15 +23209,15 @@ [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\00006109E101C0400100000000F01FEC\Usage] '@ - "Patches" = @' + "Patches" = @' [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\014C4FD0FAEDDE54794B4999D7605596] "LocalPackage"="C:\\Windows\\Installer\\fe7b23.msp" '@ - } - "CU" = @{ - "Products" = @' + } + "CU" = @{ + "Products" = @' [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\00006109210100000100000000F01FEC] @@ -24049,7 +24049,7 @@ [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\00006109E101C0400100000000F01FEC\Usage] '@ - "Patches" = @' + "Patches" = @' [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches] [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\014C4FD0FAEDDE54794B4999D7605596] @@ -24064,6 +24064,6 @@ [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\98AF5B492697215429C537A7D4A54C9F] "LocalPackage"="C:\\windows\\Installer\\2ccc6d.msp" '@ - } - } + } + } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerADResourcePoolSync.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerADResourcePoolSync.Tests.ps1 index c9980d6a5..bc2670dd5 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerADResourcePoolSync.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerADResourcePoolSync.Tests.ps1 @@ -1,26 +1,27 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPProjectServerADResourcePoolSync" + -DscResource "SPProjectServerADResourcePoolSync" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) + switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { Context -Name "All methods throw exceptions as Project Server support in SharePointDsc is only for 2016" -Fixture { It "Should throw on the get method" { { Get-TargetResource @testParams } | Should Throw @@ -35,15 +36,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - 16 { + 16 + { $modulePath = "Modules\SharePointDsc\Modules\SharePointDsc.ProjectServer\ProjectServerConnector.psm1" Import-Module -Name (Join-Path -Path $Global:SPDscHelper.RepoRoot -ChildPath $modulePath -Resolve) - try + try { [SPDscTests.DummyWebService] | Out-Null } - catch + catch { Add-Type -TypeDefinition @" namespace SPDscTests @@ -52,9 +54,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { public void Dispose() { - - } - } + + } + } } "@ } @@ -66,49 +68,49 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - + Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ DisableKerberos = $true } } - Mock -CommandName "Enable-SPProjectActiveDirectoryEnterpriseResourcePoolSync" -MockWith {} - Mock -CommandName "Disable-SPProjectActiveDirectoryEnterpriseResourcePoolSync" -MockWith {} - Mock -CommandName "Import-Module" -MockWith {} - + Mock -CommandName "Enable-SPProjectActiveDirectoryEnterpriseResourcePoolSync" -MockWith { } + Mock -CommandName "Disable-SPProjectActiveDirectoryEnterpriseResourcePoolSync" -MockWith { } + Mock -CommandName "Import-Module" -MockWith { } + Mock -CommandName "Convert-SPDscADGroupIDToName" -MockWith { $global:SPDscSidCount++ return $global:SPDscGroupsToReturn[$global:SPDscSidCount - 1] } Mock -CommandName "Convert-SPDscADGroupNameToID" -MockWith { return New-Guid } - Context -Name "No AD groups are set but there should be" -Fixture { + Context -Name "No AD groups are set but there should be" -Fixture { $testParams = @{ - Url = "http://server/pwa" + Url = "http://server/pwa" GroupNames = @("DOMAIN\Group 1", "DOMAIN\Group 2") - Ensure = "Present" + Ensure = "Present" } Mock -CommandName "New-SPDscProjectServerWebService" -MockWith { $service = [SPDscTests.DummyWebService]::new() $service = $service | Add-Member -MemberType ScriptMethod ` - -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings2 ` - -Value { - return @{ - ADGroupGuids = ([Guid[]]::new(0)) - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings ` - -Value { - return @{ - AutoReactivateInactiveUsers = $false - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name SetActiveDirectorySyncEnterpriseResourcePoolSettings ` - -Value {} -PassThru -Force + -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings2 ` + -Value { + return @{ + ADGroupGuids = ([Guid[]]::new(0)) + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings ` + -Value { + return @{ + AutoReactivateInactiveUsers = $false + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name SetActiveDirectorySyncEnterpriseResourcePoolSettings ` + -Value { } -PassThru -Force return $service } @@ -116,7 +118,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $global:SPDscSidsToReturn = @("example SID", "example SID") It "should return absent from the get method" { - $global:SPDscSidCount = 0 + $global:SPDscSidCount = 0 (Get-TargetResource @testParams).Ensure | Should Be "Absent" } @@ -132,32 +134,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } - Context -Name "AD groups are set but they are incorrect" -Fixture { + Context -Name "AD groups are set but they are incorrect" -Fixture { $testParams = @{ - Url = "http://server/pwa" + Url = "http://server/pwa" GroupNames = @("DOMAIN\Group 1", "DOMAIN\Group 2") - Ensure = "Present" + Ensure = "Present" } Mock -CommandName "New-SPDscProjectServerWebService" -MockWith { $service = [SPDscTests.DummyWebService]::new() $service = $service | Add-Member -MemberType ScriptMethod ` - -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings2 ` - -Value { - return @{ - ADGroupGuids = ([Guid[]](New-Guid)) - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings ` - -Value { - return @{ - AutoReactivateInactiveUsers = $false - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name SetActiveDirectorySyncEnterpriseResourcePoolSettings ` - -Value {} -PassThru -Force + -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings2 ` + -Value { + return @{ + ADGroupGuids = ([Guid[]](New-Guid)) + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings ` + -Value { + return @{ + AutoReactivateInactiveUsers = $false + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name SetActiveDirectorySyncEnterpriseResourcePoolSettings ` + -Value { } -PassThru -Force return $service } @@ -179,34 +181,34 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Set-TargetResource @testParams Assert-MockCalled -CommandName "Enable-SPProjectActiveDirectoryEnterpriseResourcePoolSync" } - } + } - Context -Name "AD groups are set and they are correct" -Fixture { + Context -Name "AD groups are set and they are correct" -Fixture { $testParams = @{ - Url = "http://server/pwa" + Url = "http://server/pwa" GroupNames = @("DOMAIN\Group 1", "DOMAIN\Group 2") - Ensure = "Present" + Ensure = "Present" } Mock -CommandName "New-SPDscProjectServerWebService" -MockWith { $service = [SPDscTests.DummyWebService]::new() $service = $service | Add-Member -MemberType ScriptMethod ` - -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings2 ` - -Value { - return @{ - ADGroupGuids = ([Guid[]]((New-Guid),(New-Guid))) - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings ` - -Value { - return @{ - AutoReactivateInactiveUsers = $false - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name SetActiveDirectorySyncEnterpriseResourcePoolSettings ` - -Value {} -PassThru -Force + -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings2 ` + -Value { + return @{ + ADGroupGuids = ([Guid[]]((New-Guid), (New-Guid))) + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings ` + -Value { + return @{ + AutoReactivateInactiveUsers = $false + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name SetActiveDirectorySyncEnterpriseResourcePoolSettings ` + -Value { } -PassThru -Force return $service } @@ -223,31 +225,31 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } - Context -Name "AD groups are set and there should not be" -Fixture { + Context -Name "AD groups are set and there should not be" -Fixture { $testParams = @{ - Url = "http://server/pwa" + Url = "http://server/pwa" Ensure = "Absent" } Mock -CommandName "New-SPDscProjectServerWebService" -MockWith { $service = [SPDscTests.DummyWebService]::new() $service = $service | Add-Member -MemberType ScriptMethod ` - -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings2 ` - -Value { - return @{ - ADGroupGuids = ([Guid[]]((New-Guid),(New-Guid))) - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings ` - -Value { - return @{ - AutoReactivateInactiveUsers = $false - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name SetActiveDirectorySyncEnterpriseResourcePoolSettings ` - -Value {} -PassThru -Force + -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings2 ` + -Value { + return @{ + ADGroupGuids = ([Guid[]]((New-Guid), (New-Guid))) + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings ` + -Value { + return @{ + AutoReactivateInactiveUsers = $false + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name SetActiveDirectorySyncEnterpriseResourcePoolSettings ` + -Value { } -PassThru -Force return $service } @@ -270,31 +272,31 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } - Context -Name "No AD groups are set and there should not be" -Fixture { + Context -Name "No AD groups are set and there should not be" -Fixture { $testParams = @{ - Url = "http://server/pwa" + Url = "http://server/pwa" Ensure = "Absent" } Mock -CommandName "New-SPDscProjectServerWebService" -MockWith { $service = [SPDscTests.DummyWebService]::new() $service = $service | Add-Member -MemberType ScriptMethod ` - -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings2 ` - -Value { - return @{ - ADGroupGuids = $null - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings ` - -Value { - return @{ - AutoReactivateInactiveUsers = $false - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name SetActiveDirectorySyncEnterpriseResourcePoolSettings ` - -Value {} -PassThru -Force + -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings2 ` + -Value { + return @{ + ADGroupGuids = $null + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings ` + -Value { + return @{ + AutoReactivateInactiveUsers = $false + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name SetActiveDirectorySyncEnterpriseResourcePoolSettings ` + -Value { } -PassThru -Force return $service } @@ -313,33 +315,33 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "AD groups are set correctly, but AutoReactivateUsers property doesn't match" -Fixture { $testParams = @{ - Url = "http://server/pwa" - GroupNames = @("DOMAIN\Group 1", "DOMAIN\Group 2") - Ensure = "Present" + Url = "http://server/pwa" + GroupNames = @("DOMAIN\Group 1", "DOMAIN\Group 2") + Ensure = "Present" AutoReactivateUsers = $true } Mock -CommandName "New-SPDscProjectServerWebService" -MockWith { $service = [SPDscTests.DummyWebService]::new() $service = $service | Add-Member -MemberType ScriptMethod ` - -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings2 ` - -Value { - return @{ - ADGroupGuids = ([Guid[]]((New-Guid),(New-Guid))) - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings ` - -Value { - return @{ - AutoReactivateInactiveUsers = $false - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name SetActiveDirectorySyncEnterpriseResourcePoolSettings ` - -Value { - $global:SPDscAutoReactivateUsersCalled = $true - } -PassThru -Force + -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings2 ` + -Value { + return @{ + ADGroupGuids = ([Guid[]]((New-Guid), (New-Guid))) + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings ` + -Value { + return @{ + AutoReactivateInactiveUsers = $false + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name SetActiveDirectorySyncEnterpriseResourcePoolSettings ` + -Value { + $global:SPDscAutoReactivateUsersCalled = $true + } -PassThru -Force return $service } @@ -365,33 +367,33 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "AD groups are set correctly, and AutoReactivateUsers property matches" -Fixture { $testParams = @{ - Url = "http://server/pwa" - GroupNames = @("DOMAIN\Group 1", "DOMAIN\Group 2") - Ensure = "Present" + Url = "http://server/pwa" + GroupNames = @("DOMAIN\Group 1", "DOMAIN\Group 2") + Ensure = "Present" AutoReactivateUsers = $true } Mock -CommandName "New-SPDscProjectServerWebService" -MockWith { $service = [SPDscTests.DummyWebService]::new() $service = $service | Add-Member -MemberType ScriptMethod ` - -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings2 ` - -Value { - return @{ - ADGroupGuids = ([Guid[]]((New-Guid),(New-Guid))) - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings ` - -Value { - return @{ - AutoReactivateInactiveUsers = $true - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name SetActiveDirectorySyncEnterpriseResourcePoolSettings ` - -Value { - $global:SPDscAutoReactivateUsersCalled = $true - } -PassThru -Force + -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings2 ` + -Value { + return @{ + ADGroupGuids = ([Guid[]]((New-Guid), (New-Guid))) + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name GetActiveDirectorySyncEnterpriseResourcePoolSettings ` + -Value { + return @{ + AutoReactivateInactiveUsers = $true + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name SetActiveDirectorySyncEnterpriseResourcePoolSettings ` + -Value { + $global:SPDscAutoReactivateUsersCalled = $true + } -PassThru -Force return $service } @@ -408,7 +410,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerAdditionalSettings.tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerAdditionalSettings.tests.ps1 index b17e65da2..795729ae2 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerAdditionalSettings.tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerAdditionalSettings.tests.ps1 @@ -1,26 +1,27 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPProjectServerAdditionalSettings" + -DscResource "SPProjectServerAdditionalSettings" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) + switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { Context -Name "All methods throw exceptions as Project Server support in SharePointDsc is only for 2016" -Fixture { It "Should throw on the get method" { { Get-TargetResource @testParams } | Should Throw @@ -35,7 +36,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - 16 { + 16 + { $modulePath = "Modules\SharePointDsc\Modules\SharePointDsc.ProjectServer\ProjectServerConnector.psm1" Import-Module -Name (Join-Path -Path $Global:SPDscHelper.RepoRoot -ChildPath $modulePath -Resolve) @@ -45,13 +47,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $bytes = [System.IO.File]::ReadAllBytes($fullDllPath) [System.Reflection.Assembly]::Load($bytes) | Out-Null - Mock -CommandName "Import-Module" -MockWith {} + Mock -CommandName "Import-Module" -MockWith { } - try + try { [SPDscTests.DummyWebService] | Out-Null } - catch + catch { Add-Type -TypeDefinition @" namespace SPDscTests @@ -60,9 +62,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { public void Dispose() { - - } - } + + } + } } "@ } @@ -74,13 +76,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - + Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ DisableKerberos = $true } } - + Mock -CommandName "Get-SPProjectPermissionMode" -MockWith { return "ProjectServer" } @@ -90,59 +92,59 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } -MockWith { $service = [SPDscTests.DummyWebService]::new() $service = $service | Add-Member -MemberType ScriptMethod ` - -Name GetProjectProfessionalMinimumBuildNumbers ` - -Value { - return @{ - Versions = @{ - Major = 2 - Minor = 0 - Build = 0 - Revision = 0 - Rows = @( - @{ - Major = 2 - Minor = 0 - Build = 0 - Revision = 0 - } - ) - } - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name GetServerCurrency ` - -Value { - return "AUD" - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name GetSingleCurrencyEnforced ` - -Value { - return $true - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name SetProjectProfessionalMinimumBuildNumbers ` - -Value { - $global:SPDscSetProjectProfessionalMinimumBuildNumbersCalled = $true - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name SetServerCurrency ` - -Value { - $global:SPDscSetServerCurrencyCalled = $true - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name SetSingleCurrencyEnforced ` - -Value { - $global:SPDscSetSingleCurrencyEnforcedCalled = $true - } -PassThru -Force + -Name GetProjectProfessionalMinimumBuildNumbers ` + -Value { + return @{ + Versions = @{ + Major = 2 + Minor = 0 + Build = 0 + Revision = 0 + Rows = @( + @{ + Major = 2 + Minor = 0 + Build = 0 + Revision = 0 + } + ) + } + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name GetServerCurrency ` + -Value { + return "AUD" + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name GetSingleCurrencyEnforced ` + -Value { + return $true + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name SetProjectProfessionalMinimumBuildNumbers ` + -Value { + $global:SPDscSetProjectProfessionalMinimumBuildNumbersCalled = $true + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name SetServerCurrency ` + -Value { + $global:SPDscSetServerCurrencyCalled = $true + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name SetSingleCurrencyEnforced ` + -Value { + $global:SPDscSetSingleCurrencyEnforcedCalled = $true + } -PassThru -Force return $service } Context -Name "Has incorrect settings applied" -Fixture { $testParams = @{ - Url = "http://server/pwa" + Url = "http://server/pwa" ProjectProfessionalMinBuildNumber = "1.0.0.0" - ServerCurrency = "USD" - EnforceServerCurrency = $false + ServerCurrency = "USD" + EnforceServerCurrency = $false } It "Should return current settings from the get method" { @@ -166,10 +168,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Has correct settings applied" -Fixture { $testParams = @{ - Url = "http://server/pwa" + Url = "http://server/pwa" ProjectProfessionalMinBuildNumber = "2.0.0.0" - ServerCurrency = "AUD" - EnforceServerCurrency = $true + ServerCurrency = "AUD" + EnforceServerCurrency = $true } It "Should return current settings from the get method" { @@ -180,9 +182,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Test-TargetResource @testParams | Should Be $true } } - + } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerConnector.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerConnector.Tests.ps1 index 1c52d95e9..84020eaae 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerConnector.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerConnector.Tests.ps1 @@ -3,17 +3,17 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -SubModulePath "Modules\SharePointDsc.ProjectServer\ProjectServerConnector.psm1" ` - -ExcludeInvokeHelper + -SubModulePath "Modules\SharePointDsc.ProjectServer\ProjectServerConnector.psm1" ` + -ExcludeInvokeHelper Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -32,26 +32,26 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { DisableKerberos = $true } } - + Context -Name "New-SPDscProjectServerWebService" -Fixture { $serviceNames = @("Admin", "Archive", "Calendar", "CubeAdmin", "CustomFields", - "Driver", "Events", "LookupTable", "Notifications", "ObjectLinkProvider", - "PortfolioAnalyses", "Project", "QueueSystem", "ResourcePlan", "Resource", - "Security", "Statusing", "TimeSheet", "Workflow", "WssInterop") + "Driver", "Events", "LookupTable", "Notifications", "ObjectLinkProvider", + "PortfolioAnalyses", "Project", "QueueSystem", "ResourcePlan", "Resource", + "Security", "Statusing", "TimeSheet", "Workflow", "WssInterop") $serviceNames | ForEach-Object -Process { $service = $_ It "Should create a new HTTP $service web service" { $serviceObject = New-SPDscProjectServerWebService -PwaUrl "http://server/pwa" ` - -EndpointName $service + -EndpointName $service $serviceObject.Dispose() } It "Should create a new HTTPS $service web service" { $serviceObject = New-SPDscProjectServerWebService -PwaUrl "https://server/pwa" ` - -EndpointName $service + -EndpointName $service $serviceObject.Dispose() } } @@ -87,7 +87,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } - Mock -CommandName "Import-Module" -MockWith {} + Mock -CommandName "Import-Module" -MockWith { } try { @@ -115,14 +115,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName "New-SPDscProjectServerWebService" -MockWith { $service = [SPDscTests.DummyWebService]::new() $service = $service | Add-Member -MemberType ScriptMethod ` - -Name ReadResource ` - -Value { - return @{ - Resources = @{ - WRES_ACCOUNT = "DEMO\user" - } - } - } -PassThru -Force + -Name ReadResource ` + -Value { + return @{ + Resources = @{ + WRES_ACCOUNT = "DEMO\user" + } + } + } -PassThru -Force return $service } @@ -182,24 +182,24 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName "New-SPDscProjectServerWebService" -MockWith { $service = [SPDscTests.DummyWebService]::new() $service = $service | Add-Member -MemberType ScriptMethod ` - -Name ReadResources ` - -Value { - return @{ - Resources = @{ - Count = 2 - Rows = @( - @{ - WRES_Account = "DEMO\user1" - RES_UID = (New-Guid) - } - @{ - WRES_Account = "DEMO\user2" - RES_UID = (New-Guid) - } - ) - } - } - } -PassThru -Force + -Name ReadResources ` + -Value { + return @{ + Resources = @{ + Count = 2 + Rows = @( + @{ + WRES_Account = "DEMO\user1" + RES_UID = (New-Guid) + } + @{ + WRES_Account = "DEMO\user2" + RES_UID = (New-Guid) + } + ) + } + } + } -PassThru -Force return $service } @@ -210,24 +210,24 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName "New-SPDscProjectServerWebService" -MockWith { $service = [SPDscTests.DummyWebService]::new() $service = $service | Add-Member -MemberType ScriptMethod ` - -Name ReadResources ` - -Value { - return @{ - Resources = @{ - Count = 2 - Rows = @( - @{ - WRES_Account = "DEMO\user1" - RES_UID = (New-Guid) - } - @{ - WRES_Account = "DEMO\user2" - RES_UID = (New-Guid) - } - ) - } - } - } -PassThru -Force + -Name ReadResources ` + -Value { + return @{ + Resources = @{ + Count = 2 + Rows = @( + @{ + WRES_Account = "DEMO\user1" + RES_UID = (New-Guid) + } + @{ + WRES_Account = "DEMO\user2" + RES_UID = (New-Guid) + } + ) + } + } + } -PassThru -Force return $service } @@ -238,15 +238,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName "New-SPDscProjectServerWebService" -MockWith { $service = [SPDscTests.DummyWebService]::new() $service = $service | Add-Member -MemberType ScriptMethod ` - -Name ReadResources ` - -Value { - return @{ - Resources = @{ - Count = 0 - Rows = @() - } - } - } -PassThru -Force + -Name ReadResources ` + -Value { + return @{ + Resources = @{ + Count = 0 + Rows = @() + } + } + } -PassThru -Force return $service } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerGlobalPermissions.tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerGlobalPermissions.tests.ps1 index 9b2ff2471..117fe5a85 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerGlobalPermissions.tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerGlobalPermissions.tests.ps1 @@ -1,26 +1,27 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPProjectServerGlobalPermissions" + -DscResource "SPProjectServerGlobalPermissions" Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $global:SPDscHelper.InitializeScript -NoNewScope - switch ($global:SPDscHelper.CurrentStubBuildNumber.Major) + switch ($global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { Context -Name "All methods throw exceptions as Project Server support in SharePointDsc is only for 2016" -Fixture { It "Should throw on the get method" { { Get-TargetResource @testParams } | Should Throw @@ -35,7 +36,8 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { } } } - 16 { + 16 + { $modulePath = "Modules\SharePointDsc\Modules\SharePointDsc.ProjectServer\ProjectServerConnector.psm1" Import-Module -Name (Join-Path -Path $global:SPDscHelper.RepoRoot -ChildPath $modulePath -Resolve) @@ -45,7 +47,7 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { $bytes = [System.IO.File]::ReadAllBytes($fullDllPath) [System.Reflection.Assembly]::Load($bytes) | Out-Null - Mock -CommandName "Import-Module" -MockWith {} + Mock -CommandName "Import-Module" -MockWith { } Mock -CommandName Get-SPSite -MockWith { return @{ @@ -54,18 +56,18 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { } } } - + Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ DisableKerberos = $true } } - try + try { [SPDscTests.DummyWebService] | Out-Null } - catch + catch { Add-Type -TypeDefinition @" namespace SPDscTests @@ -74,13 +76,13 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { { public void Dispose() { - - } - } + + } + } } "@ } - + function New-SPDscUserGlobalPermissionsTable { param( @@ -130,27 +132,27 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { } -MockWith { $service = [SPDscTests.DummyWebService]::new() $service = $service | Add-Member -MemberType ScriptMethod ` - -Name ReadGroupList ` - -Value { - return @{ - SecurityGroups = @( - @{ - WSEC_GRP_NAME = "Group1" - WSEC_GRP_UID = $global:SPDscGroupId - } - ) - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name ReadGroup ` - -Value { - return $global:SPDscCurrentGroupDetails - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name SetGroups ` - -Value { - $global:SPDscSetGroupsCalled = $true - } -PassThru -Force + -Name ReadGroupList ` + -Value { + return @{ + SecurityGroups = @( + @{ + WSEC_GRP_NAME = "Group1" + WSEC_GRP_UID = $global:SPDscGroupId + } + ) + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name ReadGroup ` + -Value { + return $global:SPDscCurrentGroupDetails + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name SetGroups ` + -Value { + $global:SPDscSetGroupsCalled = $true + } -PassThru -Force return $service } @@ -159,15 +161,15 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { } -MockWith { $service = [SPDscTests.DummyWebService]::new() $service = $service | Add-Member -MemberType ScriptMethod ` - -Name ReadResourceAuthorization ` - -Value { - return $global:SPDscCurrentResourceAuth - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name UpdateResources ` - -Value { - $global:SPDscUpdateResourcesCalled = $true - } -PassThru -Force + -Name ReadResourceAuthorization ` + -Value { + return $global:SPDscCurrentResourceAuth + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name UpdateResources ` + -Value { + $global:SPDscUpdateResourcesCalled = $true + } -PassThru -Force return $service } @@ -199,14 +201,14 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A resource should have permissions but is missing some" -Fixture { $testParams = @{ - Url = "http://server/pwa" - EntityType = "User" - EntityName = "TEST\user1" + Url = "http://server/pwa" + EntityType = "User" + EntityName = "TEST\user1" AllowPermissions = @( "FakePermission1", "FakePermission2" ) - DenyPermissions = @( + DenyPermissions = @( "FakePermission3", "FakePermission4" ) @@ -214,16 +216,16 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { $global:SPDscCurrentResourceAuth = New-SPDscUserGlobalPermissionsTable -Values @( @{ - RES_UID = $global:SPDscResourceId + RES_UID = $global:SPDscResourceId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7950") - WSEC_ALLOW = $true - WSEC_DENY = $false + WSEC_ALLOW = $true + WSEC_DENY = $false }, @{ - RES_UID = $global:SPDscResourceId + RES_UID = $global:SPDscResourceId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7952") - WSEC_ALLOW = $false - WSEC_DENY = $true + WSEC_ALLOW = $false + WSEC_DENY = $true } ) @@ -232,7 +234,7 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { } It "Should return false from the set method" { - Test-TargetResource @testParams | Should Be $false + Test-TargetResource @testParams | Should Be $false } It "Should call methods to add the missing permissions in the set method" { @@ -244,50 +246,50 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A resource should have permissions but has additional ones" -Fixture { $testParams = @{ - Url = "http://server/pwa" - EntityType = "User" - EntityName = "TEST\user1" + Url = "http://server/pwa" + EntityType = "User" + EntityName = "TEST\user1" AllowPermissions = @( "FakePermission1" ) - DenyPermissions = @( + DenyPermissions = @( "FakePermission3" ) } $global:SPDscCurrentResourceAuth = New-SPDscUserGlobalPermissionsTable -Values @( @{ - RES_UID = $global:SPDscResourceId + RES_UID = $global:SPDscResourceId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7950") - WSEC_ALLOW = $true - WSEC_DENY = $false + WSEC_ALLOW = $true + WSEC_DENY = $false }, @{ - RES_UID = $global:SPDscResourceId + RES_UID = $global:SPDscResourceId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7951") - WSEC_ALLOW = $true - WSEC_DENY = $false + WSEC_ALLOW = $true + WSEC_DENY = $false }, @{ - RES_UID = $global:SPDscResourceId + RES_UID = $global:SPDscResourceId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7952") - WSEC_ALLOW = $false - WSEC_DENY = $true + WSEC_ALLOW = $false + WSEC_DENY = $true }, @{ - RES_UID = $global:SPDscResourceId + RES_UID = $global:SPDscResourceId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7953") - WSEC_ALLOW = $false - WSEC_DENY = $true + WSEC_ALLOW = $false + WSEC_DENY = $true } ) - + It "Should return the current permissions from the get method" { (Get-TargetResource @testParams).AllowPermissions | Should Not BeNullOrEmpty } It "Should return false from the set method" { - Test-TargetResource @testParams | Should Be $false + Test-TargetResource @testParams | Should Be $false } It "Should call methods to add the missing permissions in the set method" { @@ -299,14 +301,14 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A resource should have permissions and they match" -Fixture { $testParams = @{ - Url = "http://server/pwa" - EntityType = "User" - EntityName = "TEST\user1" + Url = "http://server/pwa" + EntityType = "User" + EntityName = "TEST\user1" AllowPermissions = @( "FakePermission1", "FakePermission2" ) - DenyPermissions = @( + DenyPermissions = @( "FakePermission3", "FakePermission4" ) @@ -314,28 +316,28 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { $global:SPDscCurrentResourceAuth = New-SPDscUserGlobalPermissionsTable -Values @( @{ - RES_UID = $global:SPDscResourceId + RES_UID = $global:SPDscResourceId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7950") - WSEC_ALLOW = $true - WSEC_DENY = $false + WSEC_ALLOW = $true + WSEC_DENY = $false }, @{ - RES_UID = $global:SPDscResourceId + RES_UID = $global:SPDscResourceId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7951") - WSEC_ALLOW = $true - WSEC_DENY = $false + WSEC_ALLOW = $true + WSEC_DENY = $false }, @{ - RES_UID = $global:SPDscResourceId + RES_UID = $global:SPDscResourceId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7952") - WSEC_ALLOW = $false - WSEC_DENY = $true + WSEC_ALLOW = $false + WSEC_DENY = $true }, @{ - RES_UID = $global:SPDscResourceId + RES_UID = $global:SPDscResourceId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7953") - WSEC_ALLOW = $false - WSEC_DENY = $true + WSEC_ALLOW = $false + WSEC_DENY = $true } ) @@ -350,14 +352,14 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A group should have permissions but is missing some" -Fixture { $testParams = @{ - Url = "http://server/pwa" - EntityType = "Group" - EntityName = "group1" + Url = "http://server/pwa" + EntityType = "Group" + EntityName = "group1" AllowPermissions = @( "FakePermission1", "FakePermission2" ) - DenyPermissions = @( + DenyPermissions = @( "FakePermission3", "FakePermission4" ) @@ -365,16 +367,16 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { $global:SPDscCurrentGroupDetails = New-SPDscGroupGlobalPermissionsTable -Values @( @{ - WSEC_GRP_UID = $global:SPDscGroupId + WSEC_GRP_UID = $global:SPDscGroupId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7950") - WSEC_ALLOW = $true - WSEC_DENY = $false + WSEC_ALLOW = $true + WSEC_DENY = $false }, @{ - WSEC_GRP_UID = $global:SPDscGroupId + WSEC_GRP_UID = $global:SPDscGroupId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7952") - WSEC_ALLOW = $false - WSEC_DENY = $true + WSEC_ALLOW = $false + WSEC_DENY = $true } ) @@ -383,7 +385,7 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { } It "Should return false from the set method" { - Test-TargetResource @testParams | Should Be $false + Test-TargetResource @testParams | Should Be $false } It "Should call methods to add the missing permissions in the set method" { @@ -395,50 +397,50 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A group should have permissions but has additional ones" -Fixture { $testParams = @{ - Url = "http://server/pwa" - EntityType = "Group" - EntityName = "Group1" + Url = "http://server/pwa" + EntityType = "Group" + EntityName = "Group1" AllowPermissions = @( "FakePermission1" ) - DenyPermissions = @( + DenyPermissions = @( "FakePermission3" ) } $global:SPDscCurrentGroupDetails = New-SPDscGroupGlobalPermissionsTable -Values @( @{ - WSEC_GRP_UID = $global:SPDscGroupId + WSEC_GRP_UID = $global:SPDscGroupId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7950") - WSEC_ALLOW = $true - WSEC_DENY = $false + WSEC_ALLOW = $true + WSEC_DENY = $false }, @{ - WSEC_GRP_UID = $global:SPDscGroupId + WSEC_GRP_UID = $global:SPDscGroupId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7951") - WSEC_ALLOW = $true - WSEC_DENY = $false + WSEC_ALLOW = $true + WSEC_DENY = $false }, @{ - WSEC_GRP_UID = $global:SPDscGroupId + WSEC_GRP_UID = $global:SPDscGroupId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7952") - WSEC_ALLOW = $false - WSEC_DENY = $true + WSEC_ALLOW = $false + WSEC_DENY = $true }, @{ - WSEC_GRP_UID = $global:SPDscGroupId + WSEC_GRP_UID = $global:SPDscGroupId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7953") - WSEC_ALLOW = $false - WSEC_DENY = $true + WSEC_ALLOW = $false + WSEC_DENY = $true } ) - + It "Should return the current permissions from the get method" { (Get-TargetResource @testParams).AllowPermissions | Should Not BeNullOrEmpty } It "Should return false from the set method" { - Test-TargetResource @testParams | Should Be $false + Test-TargetResource @testParams | Should Be $false } It "Should call methods to add the missing permissions in the set method" { @@ -450,14 +452,14 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A group should have permissions and they match" -Fixture { $testParams = @{ - Url = "http://server/pwa" - EntityType = "Group" - EntityName = "Group1" + Url = "http://server/pwa" + EntityType = "Group" + EntityName = "Group1" AllowPermissions = @( "FakePermission1", "FakePermission2" ) - DenyPermissions = @( + DenyPermissions = @( "FakePermission3", "FakePermission4" ) @@ -465,28 +467,28 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { $global:SPDscCurrentGroupDetails = New-SPDscGroupGlobalPermissionsTable -Values @( @{ - WSEC_GRP_UID = $global:SPDscGroupId + WSEC_GRP_UID = $global:SPDscGroupId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7950") - WSEC_ALLOW = $true - WSEC_DENY = $false + WSEC_ALLOW = $true + WSEC_DENY = $false }, @{ - WSEC_GRP_UID = $global:SPDscGroupId + WSEC_GRP_UID = $global:SPDscGroupId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7951") - WSEC_ALLOW = $true - WSEC_DENY = $false + WSEC_ALLOW = $true + WSEC_DENY = $false }, @{ - WSEC_GRP_UID = $global:SPDscGroupId + WSEC_GRP_UID = $global:SPDscGroupId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7952") - WSEC_ALLOW = $false - WSEC_DENY = $true + WSEC_ALLOW = $false + WSEC_DENY = $true }, @{ - WSEC_GRP_UID = $global:SPDscGroupId + WSEC_GRP_UID = $global:SPDscGroupId WSEC_FEA_ACT_UID = [Guid]::Parse("ce501426-c4bf-4619-a635-a937b7be7953") - WSEC_ALLOW = $false - WSEC_DENY = $true + WSEC_ALLOW = $false + WSEC_DENY = $true } ) @@ -499,7 +501,8 @@ Describe -Name $global:SPDscHelper.DescribeHeader -Fixture { } } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerGroup.tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerGroup.tests.ps1 index f5311240b..b9e23f300 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerGroup.tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerGroup.tests.ps1 @@ -1,26 +1,27 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPProjectServerGroup" + -DscResource "SPProjectServerGroup" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) + switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { Context -Name "All methods throw exceptions as Project Server support in SharePointDsc is only for 2016" -Fixture { It "Should throw on the get method" { { Get-TargetResource @testParams } | Should Throw @@ -35,7 +36,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - 16 { + 16 + { $modulePath = "Modules\SharePointDsc\Modules\SharePointDsc.ProjectServer\ProjectServerConnector.psm1" Import-Module -Name (Join-Path -Path $Global:SPDscHelper.RepoRoot -ChildPath $modulePath -Resolve) @@ -45,7 +47,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $bytes = [System.IO.File]::ReadAllBytes($fullDllPath) [System.Reflection.Assembly]::Load($bytes) | Out-Null - Mock -CommandName "Import-Module" -MockWith {} + Mock -CommandName "Import-Module" -MockWith { } Mock -CommandName Get-SPSite -MockWith { return @{ @@ -54,18 +56,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - + Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ DisableKerberos = $true } } - try + try { [SPDscTests.DummyWebService] | Out-Null } - catch + catch { Add-Type -TypeDefinition @" namespace SPDscTests @@ -74,13 +76,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { public void Dispose() { - - } - } + + } + } } "@ } - + function New-SPDscResourceTable { param( @@ -120,34 +122,34 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } -MockWith { $service = [SPDscTests.DummyWebService]::new() $service = $service | Add-Member -MemberType ScriptMethod ` - -Name ReadGroupList ` - -Value { - if ($global:SPDscCreateGroupsCalled -eq $true) - { - return $global:SPDscCurrentGroupList - } - return $global:SPDscEmptyList - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name CreateGroups ` - -Value { - $global:SPDscCreateGroupsCalled = $true - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name ReadGroup ` - -Value { - return $global:SPDscCurrentGroupDetails - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name SetGroups ` - -Value { - $global:SPDscSetGroupsCalled = $true - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name DeleteGroups ` - -Value { - $global:SPDscDeleteGroupsCalled = $true - } -PassThru -Force + -Name ReadGroupList ` + -Value { + if ($global:SPDscCreateGroupsCalled -eq $true) + { + return $global:SPDscCurrentGroupList + } + return $global:SPDscEmptyList + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name CreateGroups ` + -Value { + $global:SPDscCreateGroupsCalled = $true + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name ReadGroup ` + -Value { + return $global:SPDscCurrentGroupDetails + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name SetGroups ` + -Value { + $global:SPDscSetGroupsCalled = $true + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name DeleteGroups ` + -Value { + $global:SPDscDeleteGroupsCalled = $true + } -PassThru -Force return $service } @@ -159,15 +161,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @( @{ WSEC_GRP_NAME = "Not the group you want" - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } ) } Context -Name "A group doesn't exist, but should" -Fixture { $testParams = @{ - Url = "http://server/pwa" - Name = "New Group 1" + Url = "http://server/pwa" + Name = "New Group 1" Description = "An example description" } @@ -175,33 +177,33 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @( @{ WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } @{ WSEC_GRP_NAME = "Not the group you want" - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } ) } $global:SPDscCurrentGroupDetails = @{ SecurityGroups = New-Object -TypeName "System.Object" ` - | Add-Member -MemberType ScriptMethod ` - -Name FindByWSEC_GRP_UID ` - -Value { - return @{ - WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_DESC = "" - WSEC_GRP_AD_GUID = $null - WSEC_GRP_AD_GROUP = $null - } - } ` - -Force -PassThru ` - | Add-Member -MemberType ScriptProperty ` - -Name WSEC_GRP_AD_GUID ` - -Value { return [System.DBNull]::Value } ` - -PassThru -Force - GroupMembers = @{ + | Add-Member -MemberType ScriptMethod ` + -Name FindByWSEC_GRP_UID ` + -Value { + return @{ + WSEC_GRP_NAME = $testParams.Name + WSEC_GRP_DESC = "" + WSEC_GRP_AD_GUID = $null + WSEC_GRP_AD_GROUP = $null + } + } ` + -Force -PassThru ` + | Add-Member -MemberType ScriptProperty ` + -Name WSEC_GRP_AD_GUID ` + -Value { return [System.DBNull]::Value } ` + -PassThru -Force + GroupMembers = @{ Rows = @() } } @@ -227,8 +229,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A group exists, and should and also has a correct description" -Fixture { $testParams = @{ - Url = "http://server/pwa" - Name = "New Group 1" + Url = "http://server/pwa" + Name = "New Group 1" Description = "An example description" } @@ -236,11 +238,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @( @{ WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } @{ WSEC_GRP_NAME = "Not the group you want" - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } ) } @@ -249,22 +251,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @{ WSEC_GRP_NAME = $testParams.Name WSEC_GRP_DESC = $testParams.Description - } | Add-Member -MemberType ScriptMethod ` - -Name FindByWSEC_GRP_UID ` - -Value { - return @{ - WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_DESC = "" - WSEC_GRP_AD_GUID = $null - WSEC_GRP_AD_GROUP = $null - } - } ` - -Force -PassThru ` - | Add-Member -MemberType ScriptProperty ` - -Name WSEC_GRP_AD_GUID ` - -Value { return [System.DBNull]::Value } ` - -PassThru -Force - GroupMembers = @{ + } | Add-Member -MemberType ScriptMethod ` + -Name FindByWSEC_GRP_UID ` + -Value { + return @{ + WSEC_GRP_NAME = $testParams.Name + WSEC_GRP_DESC = "" + WSEC_GRP_AD_GUID = $null + WSEC_GRP_AD_GROUP = $null + } + } ` + -Force -PassThru ` + | Add-Member -MemberType ScriptProperty ` + -Name WSEC_GRP_AD_GUID ` + -Value { return [System.DBNull]::Value } ` + -PassThru -Force + GroupMembers = @{ Rows = @() } } @@ -282,8 +284,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A group exists, but shouldn't" -Fixture { $testParams = @{ - Url = "http://server/pwa" - Name = "New Group 1" + Url = "http://server/pwa" + Name = "New Group 1" Ensure = "Absent" } @@ -291,11 +293,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @( @{ WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } @{ WSEC_GRP_NAME = "Not the group you want" - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } ) } @@ -304,22 +306,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @{ WSEC_GRP_NAME = $testParams.Name WSEC_GRP_DESC = $testParams.Description - } | Add-Member -MemberType ScriptMethod ` - -Name FindByWSEC_GRP_UID ` - -Value { - return @{ - WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_DESC = "" - WSEC_GRP_AD_GUID = $null - WSEC_GRP_AD_GROUP = $null - } - } ` - -Force -PassThru ` - | Add-Member -MemberType ScriptProperty ` - -Name WSEC_GRP_AD_GUID ` - -Value { return [System.DBNull]::Value } ` - -PassThru -Force - GroupMembers = @{ + } | Add-Member -MemberType ScriptMethod ` + -Name FindByWSEC_GRP_UID ` + -Value { + return @{ + WSEC_GRP_NAME = $testParams.Name + WSEC_GRP_DESC = "" + WSEC_GRP_AD_GUID = $null + WSEC_GRP_AD_GROUP = $null + } + } ` + -Force -PassThru ` + | Add-Member -MemberType ScriptProperty ` + -Name WSEC_GRP_AD_GUID ` + -Value { return [System.DBNull]::Value } ` + -PassThru -Force + GroupMembers = @{ Rows = @() } } @@ -343,8 +345,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A group doesn't exist, and shouldn't" -Fixture { $testParams = @{ - Url = "http://server/pwa" - Name = "New Group 1" + Url = "http://server/pwa" + Name = "New Group 1" Ensure = "Absent" } @@ -352,7 +354,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @( @{ WSEC_GRP_NAME = "Not the group you want" - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } ) } @@ -372,8 +374,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A group has an incorrect description set" -Fixture { $testParams = @{ - Url = "http://server/pwa" - Name = "New Group 1" + Url = "http://server/pwa" + Name = "New Group 1" Description = "An example description" } @@ -381,11 +383,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @( @{ WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } @{ WSEC_GRP_NAME = "Not the group you want" - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } ) } @@ -394,22 +396,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @{ WSEC_GRP_NAME = $testParams.Name WSEC_GRP_DESC = "Incorrect description" - } | Add-Member -MemberType ScriptMethod ` - -Name FindByWSEC_GRP_UID ` - -Value { - return @{ - WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_DESC = "" - WSEC_GRP_AD_GUID = $null - WSEC_GRP_AD_GROUP = $null - } - } ` - -Force -PassThru ` - | Add-Member -MemberType ScriptProperty ` - -Name WSEC_GRP_AD_GUID ` - -Value { return [System.DBNull]::Value } ` - -PassThru -Force - GroupMembers = @{ + } | Add-Member -MemberType ScriptMethod ` + -Name FindByWSEC_GRP_UID ` + -Value { + return @{ + WSEC_GRP_NAME = $testParams.Name + WSEC_GRP_DESC = "" + WSEC_GRP_AD_GUID = $null + WSEC_GRP_AD_GROUP = $null + } + } ` + -Force -PassThru ` + | Add-Member -MemberType ScriptProperty ` + -Name WSEC_GRP_AD_GUID ` + -Value { return [System.DBNull]::Value } ` + -PassThru -Force + GroupMembers = @{ Rows = @() } } @@ -434,8 +436,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A group has an incorrect AD group set" -Fixture { $testParams = @{ - Url = "http://server/pwa" - Name = "New Group 1" + Url = "http://server/pwa" + Name = "New Group 1" ADGroup = "DEMO\Group Name" } @@ -443,11 +445,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @( @{ WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } @{ WSEC_GRP_NAME = "Not the group you want" - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } ) } @@ -456,22 +458,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @{ WSEC_GRP_NAME = $testParams.Name WSEC_GRP_DESC = "Incorrect description" - } | Add-Member -MemberType ScriptMethod ` - -Name FindByWSEC_GRP_UID ` - -Value { - return @{ - WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_DESC = "" - WSEC_GRP_AD_GUID = $null - WSEC_GRP_AD_GROUP = $null - } - } ` - -Force -PassThru ` - | Add-Member -MemberType ScriptProperty ` - -Name WSEC_GRP_AD_GUID ` - -Value { return New-Guid } ` - -PassThru -Force - GroupMembers = @{ + } | Add-Member -MemberType ScriptMethod ` + -Name FindByWSEC_GRP_UID ` + -Value { + return @{ + WSEC_GRP_NAME = $testParams.Name + WSEC_GRP_DESC = "" + WSEC_GRP_AD_GUID = $null + WSEC_GRP_AD_GROUP = $null + } + } ` + -Force -PassThru ` + | Add-Member -MemberType ScriptProperty ` + -Name WSEC_GRP_AD_GUID ` + -Value { return New-Guid } ` + -PassThru -Force + GroupMembers = @{ Rows = @() } } @@ -500,8 +502,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A group has a correct AD group set" -Fixture { $testParams = @{ - Url = "http://server/pwa" - Name = "New Group 1" + Url = "http://server/pwa" + Name = "New Group 1" ADGroup = "DEMO\Group Name" } @@ -509,11 +511,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @( @{ WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } @{ WSEC_GRP_NAME = "Not the group you want" - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } ) } @@ -522,22 +524,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @{ WSEC_GRP_NAME = $testParams.Name WSEC_GRP_DESC = "Incorrect description" - } | Add-Member -MemberType ScriptMethod ` - -Name FindByWSEC_GRP_UID ` - -Value { - return @{ - WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_DESC = "" - WSEC_GRP_AD_GUID = $null - WSEC_GRP_AD_GROUP = $null - } - } ` - -Force -PassThru ` - | Add-Member -MemberType ScriptProperty ` - -Name WSEC_GRP_AD_GUID ` - -Value { return New-Guid } ` - -PassThru -Force - GroupMembers = @{ + } | Add-Member -MemberType ScriptMethod ` + -Name FindByWSEC_GRP_UID ` + -Value { + return @{ + WSEC_GRP_NAME = $testParams.Name + WSEC_GRP_DESC = "" + WSEC_GRP_AD_GUID = $null + WSEC_GRP_AD_GROUP = $null + } + } ` + -Force -PassThru ` + | Add-Member -MemberType ScriptProperty ` + -Name WSEC_GRP_AD_GUID ` + -Value { return New-Guid } ` + -PassThru -Force + GroupMembers = @{ Rows = @() } } @@ -559,8 +561,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A group has a fixed members list that doesn't match" -Fixture { $testParams = @{ - Url = "http://server/pwa" - Name = "New Group 1" + Url = "http://server/pwa" + Name = "New Group 1" Members = @( "DEMO\Member1", "DEMO\Member2" @@ -571,11 +573,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @( @{ WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } @{ WSEC_GRP_NAME = "Not the group you want" - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } ) } @@ -584,50 +586,50 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @{ WSEC_GRP_NAME = $testParams.Name WSEC_GRP_DESC = $testParams.Description - } | Add-Member -MemberType ScriptMethod ` - -Name FindByWSEC_GRP_UID ` - -Value { - return @{ - WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_DESC = "" - WSEC_GRP_AD_GUID = $null - WSEC_GRP_AD_GROUP = $null - } - } ` - -Force -PassThru ` - | Add-Member -MemberType ScriptProperty ` - -Name WSEC_GRP_AD_GUID ` - -Value { return [System.DBNull]::Value } ` - -PassThru -Force - GroupMembers = @{ + } | Add-Member -MemberType ScriptMethod ` + -Name FindByWSEC_GRP_UID ` + -Value { + return @{ + WSEC_GRP_NAME = $testParams.Name + WSEC_GRP_DESC = "" + WSEC_GRP_AD_GUID = $null + WSEC_GRP_AD_GROUP = $null + } + } ` + -Force -PassThru ` + | Add-Member -MemberType ScriptProperty ` + -Name WSEC_GRP_AD_GUID ` + -Value { return [System.DBNull]::Value } ` + -PassThru -Force + GroupMembers = @{ Rows = @( @{ RES_UID = New-Guid } @{ RES_UID = New-Guid } @{ RES_UID = New-Guid } ) - } | Add-Member -MemberType ScriptMethod ` - -Name FindByRES_UIDWSEC_GRP_UID ` - -Value { - return New-Object -TypeName "System.Object" ` - | Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value { - $global:SPDscMemberDeleteCalled = $true - } -PassThru -Force - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name NewGroupMembersRow ` - -Value { - return @{ - WSEC_GRP_UID = "" - RES_UID = "" - } - } -PassThru -Force ` + } | Add-Member -MemberType ScriptMethod ` + -Name FindByRES_UIDWSEC_GRP_UID ` + -Value { + return New-Object -TypeName "System.Object" ` | Add-Member -MemberType ScriptMethod ` - -Name AddGroupMembersRow ` - -Value { - $global:SPDscMemberRowAddedCalled = $true - } -PassThru -Force + -Name Delete ` + -Value { + $global:SPDscMemberDeleteCalled = $true + } -PassThru -Force + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name NewGroupMembersRow ` + -Value { + return @{ + WSEC_GRP_UID = "" + RES_UID = "" + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name AddGroupMembersRow ` + -Value { + $global:SPDscMemberRowAddedCalled = $true + } -PassThru -Force } $global:SPDscCurrentMembers = @( @@ -668,8 +670,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A group has a fixed members list that matches" -Fixture { $testParams = @{ - Url = "http://server/pwa" - Name = "New Group 1" + Url = "http://server/pwa" + Name = "New Group 1" Members = @( "DEMO\Member1" "DEMO\Member3" @@ -681,11 +683,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @( @{ WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } @{ WSEC_GRP_NAME = "Not the group you want" - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } ) } @@ -694,50 +696,50 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @{ WSEC_GRP_NAME = $testParams.Name WSEC_GRP_DESC = $testParams.Description - } | Add-Member -MemberType ScriptMethod ` - -Name FindByWSEC_GRP_UID ` - -Value { - return @{ - WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_DESC = "" - WSEC_GRP_AD_GUID = $null - WSEC_GRP_AD_GROUP = $null - } - } ` - -Force -PassThru ` - | Add-Member -MemberType ScriptProperty ` - -Name WSEC_GRP_AD_GUID ` - -Value { return [System.DBNull]::Value } ` - -PassThru -Force - GroupMembers = @{ + } | Add-Member -MemberType ScriptMethod ` + -Name FindByWSEC_GRP_UID ` + -Value { + return @{ + WSEC_GRP_NAME = $testParams.Name + WSEC_GRP_DESC = "" + WSEC_GRP_AD_GUID = $null + WSEC_GRP_AD_GROUP = $null + } + } ` + -Force -PassThru ` + | Add-Member -MemberType ScriptProperty ` + -Name WSEC_GRP_AD_GUID ` + -Value { return [System.DBNull]::Value } ` + -PassThru -Force + GroupMembers = @{ Rows = @( @{ RES_UID = New-Guid } @{ RES_UID = New-Guid } @{ RES_UID = New-Guid } ) - } | Add-Member -MemberType ScriptMethod ` - -Name FindByRES_UIDWSEC_GRP_UID ` - -Value { - return New-Object -TypeName "System.Object" ` - | Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value { - $global:SPDscMemberDeleteCalled = $true - } -PassThru -Force - } -PassThru -Force ` + } | Add-Member -MemberType ScriptMethod ` + -Name FindByRES_UIDWSEC_GRP_UID ` + -Value { + return New-Object -TypeName "System.Object" ` | Add-Member -MemberType ScriptMethod ` - -Name NewGroupMembersRow ` - -Value { - return @{ - WSEC_GRP_UID = "" - RES_UID = "" - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name AddGroupMembersRow ` - -Value { - $global:SPDscMemberRowAddedCalled = $true - } -PassThru -Force + -Name Delete ` + -Value { + $global:SPDscMemberDeleteCalled = $true + } -PassThru -Force + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name NewGroupMembersRow ` + -Value { + return @{ + WSEC_GRP_UID = "" + RES_UID = "" + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name AddGroupMembersRow ` + -Value { + $global:SPDscMemberRowAddedCalled = $true + } -PassThru -Force } $global:SPDscCurrentMembers = @( @@ -766,8 +768,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A group has a list of members to include that doesn't match" -Fixture { $testParams = @{ - Url = "http://server/pwa" - Name = "New Group 1" + Url = "http://server/pwa" + Name = "New Group 1" MembersToInclude = @( "DEMO\Member2" ) @@ -777,11 +779,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @( @{ WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } @{ WSEC_GRP_NAME = "Not the group you want" - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } ) } @@ -790,50 +792,50 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @{ WSEC_GRP_NAME = $testParams.Name WSEC_GRP_DESC = $testParams.Description - } | Add-Member -MemberType ScriptMethod ` - -Name FindByWSEC_GRP_UID ` - -Value { - return @{ - WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_DESC = "" - WSEC_GRP_AD_GUID = $null - WSEC_GRP_AD_GROUP = $null - } - } ` - -Force -PassThru ` - | Add-Member -MemberType ScriptProperty ` - -Name WSEC_GRP_AD_GUID ` - -Value { return [System.DBNull]::Value } ` - -PassThru -Force - GroupMembers = @{ + } | Add-Member -MemberType ScriptMethod ` + -Name FindByWSEC_GRP_UID ` + -Value { + return @{ + WSEC_GRP_NAME = $testParams.Name + WSEC_GRP_DESC = "" + WSEC_GRP_AD_GUID = $null + WSEC_GRP_AD_GROUP = $null + } + } ` + -Force -PassThru ` + | Add-Member -MemberType ScriptProperty ` + -Name WSEC_GRP_AD_GUID ` + -Value { return [System.DBNull]::Value } ` + -PassThru -Force + GroupMembers = @{ Rows = @( @{ RES_UID = New-Guid } @{ RES_UID = New-Guid } @{ RES_UID = New-Guid } ) - } | Add-Member -MemberType ScriptMethod ` - -Name FindByRES_UIDWSEC_GRP_UID ` - -Value { - return New-Object -TypeName "System.Object" ` - | Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value { - $global:SPDscMemberDeleteCalled = $true - } -PassThru -Force - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name NewGroupMembersRow ` - -Value { - return @{ - WSEC_GRP_UID = "" - RES_UID = "" - } - } -PassThru -Force ` + } | Add-Member -MemberType ScriptMethod ` + -Name FindByRES_UIDWSEC_GRP_UID ` + -Value { + return New-Object -TypeName "System.Object" ` | Add-Member -MemberType ScriptMethod ` - -Name AddGroupMembersRow ` - -Value { - $global:SPDscMemberRowAddedCalled = $true - } -PassThru -Force + -Name Delete ` + -Value { + $global:SPDscMemberDeleteCalled = $true + } -PassThru -Force + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name NewGroupMembersRow ` + -Value { + return @{ + WSEC_GRP_UID = "" + RES_UID = "" + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name AddGroupMembersRow ` + -Value { + $global:SPDscMemberRowAddedCalled = $true + } -PassThru -Force } $global:SPDscCurrentMembers = @( @@ -873,8 +875,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A group has a list of members to include that does match" -Fixture { $testParams = @{ - Url = "http://server/pwa" - Name = "New Group 1" + Url = "http://server/pwa" + Name = "New Group 1" MembersToInclude = @( "DEMO\Member1" ) @@ -884,11 +886,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @( @{ WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } @{ WSEC_GRP_NAME = "Not the group you want" - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } ) } @@ -897,50 +899,50 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @{ WSEC_GRP_NAME = $testParams.Name WSEC_GRP_DESC = $testParams.Description - } | Add-Member -MemberType ScriptMethod ` - -Name FindByWSEC_GRP_UID ` - -Value { - return @{ - WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_DESC = "" - WSEC_GRP_AD_GUID = $null - WSEC_GRP_AD_GROUP = $null - } - } ` - -Force -PassThru ` - | Add-Member -MemberType ScriptProperty ` - -Name WSEC_GRP_AD_GUID ` - -Value { return [System.DBNull]::Value } ` - -PassThru -Force - GroupMembers = @{ + } | Add-Member -MemberType ScriptMethod ` + -Name FindByWSEC_GRP_UID ` + -Value { + return @{ + WSEC_GRP_NAME = $testParams.Name + WSEC_GRP_DESC = "" + WSEC_GRP_AD_GUID = $null + WSEC_GRP_AD_GROUP = $null + } + } ` + -Force -PassThru ` + | Add-Member -MemberType ScriptProperty ` + -Name WSEC_GRP_AD_GUID ` + -Value { return [System.DBNull]::Value } ` + -PassThru -Force + GroupMembers = @{ Rows = @( @{ RES_UID = New-Guid } @{ RES_UID = New-Guid } @{ RES_UID = New-Guid } ) - } | Add-Member -MemberType ScriptMethod ` - -Name FindByRES_UIDWSEC_GRP_UID ` - -Value { - return New-Object -TypeName "System.Object" ` - | Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value { - $global:SPDscMemberDeleteCalled = $true - } -PassThru -Force - } -PassThru -Force ` + } | Add-Member -MemberType ScriptMethod ` + -Name FindByRES_UIDWSEC_GRP_UID ` + -Value { + return New-Object -TypeName "System.Object" ` | Add-Member -MemberType ScriptMethod ` - -Name NewGroupMembersRow ` - -Value { - return @{ - WSEC_GRP_UID = "" - RES_UID = "" - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name AddGroupMembersRow ` - -Value { - $global:SPDscMemberRowAddedCalled = $true - } -PassThru -Force + -Name Delete ` + -Value { + $global:SPDscMemberDeleteCalled = $true + } -PassThru -Force + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name NewGroupMembersRow ` + -Value { + return @{ + WSEC_GRP_UID = "" + RES_UID = "" + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name AddGroupMembersRow ` + -Value { + $global:SPDscMemberRowAddedCalled = $true + } -PassThru -Force } $global:SPDscCurrentMembers = @( @@ -969,8 +971,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A group has a list of members to exclude that doesn't match" -Fixture { $testParams = @{ - Url = "http://server/pwa" - Name = "New Group 1" + Url = "http://server/pwa" + Name = "New Group 1" MembersToExclude = @( "DEMO\Member1" ) @@ -980,11 +982,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @( @{ WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } @{ WSEC_GRP_NAME = "Not the group you want" - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } ) } @@ -993,50 +995,50 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @{ WSEC_GRP_NAME = $testParams.Name WSEC_GRP_DESC = $testParams.Description - } | Add-Member -MemberType ScriptMethod ` - -Name FindByWSEC_GRP_UID ` - -Value { - return @{ - WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_DESC = "" - WSEC_GRP_AD_GUID = $null - WSEC_GRP_AD_GROUP = $null - } - } ` - -Force -PassThru ` - | Add-Member -MemberType ScriptProperty ` - -Name WSEC_GRP_AD_GUID ` - -Value { return [System.DBNull]::Value } ` - -PassThru -Force - GroupMembers = @{ + } | Add-Member -MemberType ScriptMethod ` + -Name FindByWSEC_GRP_UID ` + -Value { + return @{ + WSEC_GRP_NAME = $testParams.Name + WSEC_GRP_DESC = "" + WSEC_GRP_AD_GUID = $null + WSEC_GRP_AD_GROUP = $null + } + } ` + -Force -PassThru ` + | Add-Member -MemberType ScriptProperty ` + -Name WSEC_GRP_AD_GUID ` + -Value { return [System.DBNull]::Value } ` + -PassThru -Force + GroupMembers = @{ Rows = @( @{ RES_UID = New-Guid } @{ RES_UID = New-Guid } @{ RES_UID = New-Guid } ) - } | Add-Member -MemberType ScriptMethod ` - -Name FindByRES_UIDWSEC_GRP_UID ` - -Value { - return New-Object -TypeName "System.Object" ` - | Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value { - $global:SPDscMemberDeleteCalled = $true - } -PassThru -Force - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name NewGroupMembersRow ` - -Value { - return @{ - WSEC_GRP_UID = "" - RES_UID = "" - } - } -PassThru -Force ` + } | Add-Member -MemberType ScriptMethod ` + -Name FindByRES_UIDWSEC_GRP_UID ` + -Value { + return New-Object -TypeName "System.Object" ` | Add-Member -MemberType ScriptMethod ` - -Name AddGroupMembersRow ` - -Value { - $global:SPDscMemberRowAddedCalled = $true - } -PassThru -Force + -Name Delete ` + -Value { + $global:SPDscMemberDeleteCalled = $true + } -PassThru -Force + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name NewGroupMembersRow ` + -Value { + return @{ + WSEC_GRP_UID = "" + RES_UID = "" + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name AddGroupMembersRow ` + -Value { + $global:SPDscMemberRowAddedCalled = $true + } -PassThru -Force } $global:SPDscCurrentMembers = @( @@ -1076,8 +1078,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A group has a list of members to exclude that does match" -Fixture { $testParams = @{ - Url = "http://server/pwa" - Name = "New Group 1" + Url = "http://server/pwa" + Name = "New Group 1" MembersToExclude = @( "DEMO\Member2" ) @@ -1087,11 +1089,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @( @{ WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } @{ WSEC_GRP_NAME = "Not the group you want" - WSEC_GRP_UID = (New-Guid) + WSEC_GRP_UID = (New-Guid) } ) } @@ -1100,50 +1102,50 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { SecurityGroups = @{ WSEC_GRP_NAME = $testParams.Name WSEC_GRP_DESC = $testParams.Description - } | Add-Member -MemberType ScriptMethod ` - -Name FindByWSEC_GRP_UID ` - -Value { - return @{ - WSEC_GRP_NAME = $testParams.Name - WSEC_GRP_DESC = "" - WSEC_GRP_AD_GUID = $null - WSEC_GRP_AD_GROUP = $null - } - } ` - -Force -PassThru ` - | Add-Member -MemberType ScriptProperty ` - -Name WSEC_GRP_AD_GUID ` - -Value { return [System.DBNull]::Value } ` - -PassThru -Force - GroupMembers = @{ + } | Add-Member -MemberType ScriptMethod ` + -Name FindByWSEC_GRP_UID ` + -Value { + return @{ + WSEC_GRP_NAME = $testParams.Name + WSEC_GRP_DESC = "" + WSEC_GRP_AD_GUID = $null + WSEC_GRP_AD_GROUP = $null + } + } ` + -Force -PassThru ` + | Add-Member -MemberType ScriptProperty ` + -Name WSEC_GRP_AD_GUID ` + -Value { return [System.DBNull]::Value } ` + -PassThru -Force + GroupMembers = @{ Rows = @( @{ RES_UID = New-Guid } @{ RES_UID = New-Guid } @{ RES_UID = New-Guid } ) - } | Add-Member -MemberType ScriptMethod ` - -Name FindByRES_UIDWSEC_GRP_UID ` - -Value { - return New-Object -TypeName "System.Object" ` - | Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value { - $global:SPDscMemberDeleteCalled = $true - } -PassThru -Force - } -PassThru -Force ` + } | Add-Member -MemberType ScriptMethod ` + -Name FindByRES_UIDWSEC_GRP_UID ` + -Value { + return New-Object -TypeName "System.Object" ` | Add-Member -MemberType ScriptMethod ` - -Name NewGroupMembersRow ` - -Value { - return @{ - WSEC_GRP_UID = "" - RES_UID = "" - } - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name AddGroupMembersRow ` - -Value { - $global:SPDscMemberRowAddedCalled = $true - } -PassThru -Force + -Name Delete ` + -Value { + $global:SPDscMemberDeleteCalled = $true + } -PassThru -Force + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name NewGroupMembersRow ` + -Value { + return @{ + WSEC_GRP_UID = "" + RES_UID = "" + } + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name AddGroupMembersRow ` + -Value { + $global:SPDscMemberRowAddedCalled = $true + } -PassThru -Force } $global:SPDscCurrentMembers = @( @@ -1170,7 +1172,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerLicense.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerLicense.Tests.ps1 index 77f7f9ec2..ba22d29bb 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerLicense.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerLicense.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPProjectServerLicense" + -DscResource "SPProjectServerLicense" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -20,7 +20,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { Context -Name "All methods throw exceptions as Project Server support in SharePointDsc is only for 2016" -Fixture { It "Should throw on the get method" { { Get-TargetResource @testParams } | Should Throw @@ -35,7 +36,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - 16 { + 16 + { Mock -CommandName Enable-ProjectServerLicense -MockWith { } Mock -CommandName Disable-ProjectServerLicense -MockWith { } @@ -158,7 +160,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerPermissionsMode.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerPermissionsMode.Tests.ps1 index 8cded6b14..0d2ea8da2 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerPermissionsMode.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerPermissionsMode.Tests.ps1 @@ -1,26 +1,27 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPProjectServerPermissionMode" + -DscResource "SPProjectServerPermissionMode" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) + switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { Context -Name "All methods throw exceptions as Project Server support in SharePointDsc is only for 2016" -Fixture { It "Should throw on the get method" { { Get-TargetResource @testParams } | Should Throw @@ -35,12 +36,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - 16 { + 16 + { Mock -CommandName Set-SPProjectPermissionMode -MockWith { } Context -Name "Permissions are in SharePoint mode, and should be" -Fixture { $testParams = @{ - Url = "http://projects.contoso.com" + Url = "http://projects.contoso.com" PermissionMode = "SharePoint" } @@ -56,7 +58,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Permissions are in ProjectServer mode, and should be" -Fixture { $testParams = @{ - Url = "http://projects.contoso.com" + Url = "http://projects.contoso.com" PermissionMode = "ProjectServer" } @@ -73,7 +75,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Permissions are in SharePoint mode, and shouldn't be" -Fixture { $testParams = @{ - Url = "http://projects.contoso.com" + Url = "http://projects.contoso.com" PermissionMode = "ProjectServer" } @@ -95,7 +97,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Permissions are in ProjectServer mode, and shouldn't be" -Fixture { $testParams = @{ - Url = "http://projects.contoso.com" + Url = "http://projects.contoso.com" PermissionMode = "SharePoint" } @@ -117,7 +119,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Unable to determine permissions mode" -Fixture { $testParams = @{ - Url = "http://projects.contoso.com" + Url = "http://projects.contoso.com" PermissionMode = "SharePoint" } @@ -128,9 +130,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } - + } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerServiceApp.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerServiceApp.Tests.ps1 index 4d8d46bf1..a461d388b 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerServiceApp.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerServiceApp.Tests.ps1 @@ -1,26 +1,27 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPProjectServerServiceApp" + -DscResource "SPProjectServerServiceApp" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) + switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { Context -Name "All methods throw exceptions as Project Server support in SharePointDsc is only for 2016" -Fixture { It "Should throw on the get method" { { Get-TargetResource @testParams } | Should Throw @@ -35,12 +36,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - 16 { + 16 + { - # Initialize Tests + # Initialize Tests $getTypeFullName = "Microsoft.Office.Project.Server.Administration.PsiServiceApplication" - # Mocks for all contexts + # Mocks for all contexts Mock -CommandName New-SPProjectServiceApplication -MockWith { } Mock -CommandName Set-SPProjectServiceApplication -MockWith { } Mock -CommandName Remove-SPServiceApplication -MockWith { } @@ -49,15 +51,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Test contexts Context -Name "When no service applications exist in the current farm" -Fixture { $testParams = @{ - Name = "Test Project Server App" + Name = "Test Project Server App" ApplicationPool = "Test App Pool" - Ensure = "Present" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplication -MockWith { - return $null + Mock -CommandName Get-SPServiceApplication -MockWith { + return $null } - + It "Should return absent from the Get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" } @@ -74,45 +76,45 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When service applications exist in the current farm but the specific Project Server app does not" -Fixture { $testParams = @{ - Name = "Test Project Server App" + Name = "Test Project Server App" ApplicationPool = "Test App Pool" - Ensure = "Present" + Ensure = "Present" } - - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - } + + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + DisplayName = $testParams.Name + } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "Microsoft.Office.UnKnownWebServiceApplication" - } - } -PassThru -Force - return $spServiceApp + -Name GetType ` + -Value { + return @{ + FullName = "Microsoft.Office.UnKnownWebServiceApplication" + } + } -PassThru -Force + return $spServiceApp } It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } } Context -Name "When a service application exists and is configured correctly" -Fixture { $testParams = @{ - Name = "Test Project Server App" + Name = "Test Project Server App" ApplicationPool = "Test App Pool" - Ensure = "Present" + Ensure = "Present" } - - Mock -CommandName Get-SPServiceApplication -MockWith { + + Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Project Application Services" - DisplayName = $testParams.Name + TypeName = "Project Application Services" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } @@ -128,26 +130,26 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and is not configured correctly" -Fixture { $testParams = @{ - Name = "Test Project Server App" + Name = "Test Project Server App" ApplicationPool = "Test App Pool" - Ensure = "Present" + Ensure = "Present" } - - Mock -CommandName Get-SPServiceApplication -MockWith { + + Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Project Application Services" - DisplayName = $testParams.Name + TypeName = "Project Application Services" + DisplayName = $testParams.Name ApplicationPool = @{ Name = "Wrong App Pool Name" } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } - Mock -CommandName Get-SPServiceApplicationPool { - return @{ - Name = $testParams.ApplicationPool - } + Mock -CommandName Get-SPServiceApplicationPool { + return @{ + Name = $testParams.ApplicationPool + } } It "Should return false when the Test method is called" { @@ -160,55 +162,55 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Assert-MockCalled Set-SPProjectServiceApplication } } - + Context -Name "When the service app exists but it shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "-" - Ensure = "Absent" + Ensure = "Absent" } - - Mock -CommandName Get-SPServiceApplication -MockWith { + + Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Project Application Services" - DisplayName = $testParams.Name + TypeName = "Project Application Services" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } - + It "Should return present from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Present" + (Get-TargetResource @testParams).Ensure | Should Be "Present" } - + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false } - + It "Should remove the service application in the set method" { Set-TargetResource @testParams Assert-MockCalled Remove-SPServiceApplication } } - + Context -Name "When the service app doesn't exist and shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "-" - Ensure = "Absent" + Ensure = "Absent" } - - Mock -CommandName Get-SPServiceApplication -MockWith { - return $null + + Mock -CommandName Get-SPServiceApplication -MockWith { + return $null } - + It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $true } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerTimeSheetSettings.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerTimeSheetSettings.Tests.ps1 index 0c6943154..4922afefb 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerTimeSheetSettings.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerTimeSheetSettings.Tests.ps1 @@ -1,26 +1,27 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPProjectServerTimeSheetSettings" + -DscResource "SPProjectServerTimeSheetSettings" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) + switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { Context -Name "All methods throw exceptions as Project Server support in SharePointDsc is only for 2016" -Fixture { It "Should throw on the get method" { { Get-TargetResource @testParams } | Should Throw @@ -35,11 +36,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - 16 { + 16 + { $modulePath = "Modules\SharePointDsc\Modules\SharePointDsc.ProjectServer\ProjectServerConnector.psm1" Import-Module -Name (Join-Path -Path $Global:SPDscHelper.RepoRoot -ChildPath $modulePath -Resolve) - Mock -CommandName "Import-Module" -MockWith {} + Mock -CommandName "Import-Module" -MockWith { } Mock -CommandName Get-SPSite -MockWith { return @{ @@ -48,18 +50,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - + Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ DisableKerberos = $true } } - try + try { [SPDscTests.DummyWebService] | Out-Null } - catch + catch { Add-Type -TypeDefinition @" namespace SPDscTests @@ -68,13 +70,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { public void Dispose() { - - } - } + + } + } } "@ } - + function New-SPDscTimeSheetSettingsTable { param( @@ -98,40 +100,40 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName "New-SPDscProjectServerWebService" -MockWith { $service = [SPDscTests.DummyWebService]::new() $service = $service | Add-Member -MemberType ScriptMethod ` - -Name ReadTimeSheetSettings ` - -Value { - return $global:SPDscCurrentTimeSheetSettings - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name UpdateTimeSheetSettings ` - -Value { - $global:SPDscUpdateTimeSheetSettingsCalled = $true - } -PassThru -Force + -Name ReadTimeSheetSettings ` + -Value { + return $global:SPDscCurrentTimeSheetSettings + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name UpdateTimeSheetSettings ` + -Value { + $global:SPDscUpdateTimeSheetSettingsCalled = $true + } -PassThru -Force return $service } Context -Name "Timesheet settings cannot be read" -Fixture { $testParams = @{ - Url = "http://sites.contoso.com/pwa" - EnableOvertimeAndNonBillableTracking = $true - DefaultTimesheetCreationMode = "CurrentProjects" - DefaultTrackingUnit = "Days" - DefaultReportingUnit = "Days" - HoursInStandardDay = 8 - HoursInStandardWeek = 40 - MaxHoursPerTimesheet = 100 - MinHoursPerTimesheet = 0 - MaxHoursPerDay = 18 - AllowFutureTimeReporting = $true - AllowNewPersonalTasks = $true - AllowTopLevelTimeReporting = $true - RequireTaskStatusManagerApproval = $true + Url = "http://sites.contoso.com/pwa" + EnableOvertimeAndNonBillableTracking = $true + DefaultTimesheetCreationMode = "CurrentProjects" + DefaultTrackingUnit = "Days" + DefaultReportingUnit = "Days" + HoursInStandardDay = 8 + HoursInStandardWeek = 40 + MaxHoursPerTimesheet = 100 + MinHoursPerTimesheet = 0 + MaxHoursPerDay = 18 + AllowFutureTimeReporting = $true + AllowNewPersonalTasks = $true + AllowTopLevelTimeReporting = $true + RequireTaskStatusManagerApproval = $true RequireLineApprovalBeforeTimesheetApproval = $true - EnableTimesheetAuditing = $true - FixedApprovalRouting = $true - SingleEntryMode = $true - DefaultTrackingMode = "PercentComplete" - ForceTrackingModeForAllProjects = $true + EnableTimesheetAuditing = $true + FixedApprovalRouting = $true + SingleEntryMode = $true + DefaultTrackingMode = "PercentComplete" + ForceTrackingModeForAllProjects = $true } $global:SPDscCurrentTimeSheetSettings = $null @@ -143,50 +145,50 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Timesheet settings exist but are not set correctly" -Fixture { $testParams = @{ - Url = "http://sites.contoso.com/pwa" - EnableOvertimeAndNonBillableTracking = $true - DefaultTimesheetCreationMode = "CurrentProjects" - DefaultTrackingUnit = "Days" - DefaultReportingUnit = "Days" - HoursInStandardDay = 8 - HoursInStandardWeek = 40 - MaxHoursPerTimesheet = 100 - MinHoursPerTimesheet = 0 - MaxHoursPerDay = 18 - AllowFutureTimeReporting = $true - AllowNewPersonalTasks = $true - AllowTopLevelTimeReporting = $true - RequireTaskStatusManagerApproval = $true + Url = "http://sites.contoso.com/pwa" + EnableOvertimeAndNonBillableTracking = $true + DefaultTimesheetCreationMode = "CurrentProjects" + DefaultTrackingUnit = "Days" + DefaultReportingUnit = "Days" + HoursInStandardDay = 8 + HoursInStandardWeek = 40 + MaxHoursPerTimesheet = 100 + MinHoursPerTimesheet = 0 + MaxHoursPerDay = 18 + AllowFutureTimeReporting = $true + AllowNewPersonalTasks = $true + AllowTopLevelTimeReporting = $true + RequireTaskStatusManagerApproval = $true RequireLineApprovalBeforeTimesheetApproval = $true - EnableTimesheetAuditing = $true - FixedApprovalRouting = $true - SingleEntryMode = $true - DefaultTrackingMode = "PercentComplete" - ForceTrackingModeForAllProjects = $true + EnableTimesheetAuditing = $true + FixedApprovalRouting = $true + SingleEntryMode = $true + DefaultTrackingMode = "PercentComplete" + ForceTrackingModeForAllProjects = $true } $global:SPDscCurrentTimeSheetSettings = @{ TimeSheetSettings = (New-SPDscTimeSheetSettingsTable -Values @{ - WADMIN_TS_DEF_DISPLAY_ENUM = 0 - WADMIN_TS_CREATE_MODE_ENUM = 0 - WADMIN_TS_DEF_ENTRY_MODE_ENUM = 1 - WADMIN_TS_REPORT_UNIT_ENUM = 0 - WADMIN_TS_HOURS_PER_DAY = 450000 - WADMIN_TS_HOURS_PER_WEEK = 2250000 - WADMIN_TS_MAX_HR_PER_TS = 6600000 - WADMIN_TS_MIN_HR_PER_TS = 60000 - WADMIN_TS_MAX_HR_PER_DAY = 480000 - WADMIN_TS_IS_FUTURE_REP_ALLOWED = $false - WADMIN_TS_IS_UNVERS_TASK_ALLOWED = $false - WADMIN_TS_ALLOW_PROJECT_LEVEL = $false - WADMIN_TS_PROJECT_MANAGER_COORDINATION = $false - WADMIN_TS_PROJECT_MANAGER_APPROVAL = $false - WADMIN_TS_IS_AUDIT_ENABLED = $false - WADMIN_TS_FIXED_APPROVAL_ROUTING = $false - WADMIN_TS_TIED_MODE = $false - WADMIN_DEFAULT_TRACKING_METHOD = 0 - WADMIN_IS_TRACKING_METHOD_LOCKED = $false - }).Tables[0] + WADMIN_TS_DEF_DISPLAY_ENUM = 0 + WADMIN_TS_CREATE_MODE_ENUM = 0 + WADMIN_TS_DEF_ENTRY_MODE_ENUM = 1 + WADMIN_TS_REPORT_UNIT_ENUM = 0 + WADMIN_TS_HOURS_PER_DAY = 450000 + WADMIN_TS_HOURS_PER_WEEK = 2250000 + WADMIN_TS_MAX_HR_PER_TS = 6600000 + WADMIN_TS_MIN_HR_PER_TS = 60000 + WADMIN_TS_MAX_HR_PER_DAY = 480000 + WADMIN_TS_IS_FUTURE_REP_ALLOWED = $false + WADMIN_TS_IS_UNVERS_TASK_ALLOWED = $false + WADMIN_TS_ALLOW_PROJECT_LEVEL = $false + WADMIN_TS_PROJECT_MANAGER_COORDINATION = $false + WADMIN_TS_PROJECT_MANAGER_APPROVAL = $false + WADMIN_TS_IS_AUDIT_ENABLED = $false + WADMIN_TS_FIXED_APPROVAL_ROUTING = $false + WADMIN_TS_TIED_MODE = $false + WADMIN_DEFAULT_TRACKING_METHOD = 0 + WADMIN_IS_TRACKING_METHOD_LOCKED = $false + }).Tables[0] } It "Should return the current values from the get method" { @@ -206,50 +208,50 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Timesheet settings exist and are set correctly" -Fixture { $testParams = @{ - Url = "http://sites.contoso.com/pwa" - EnableOvertimeAndNonBillableTracking = $true - DefaultTimesheetCreationMode = "CurrentProjects" - DefaultTrackingUnit = "Days" - DefaultReportingUnit = "Days" - HoursInStandardDay = 8 - HoursInStandardWeek = 40 - MaxHoursPerTimesheet = 100 - MinHoursPerTimesheet = 0 - MaxHoursPerDay = 18 - AllowFutureTimeReporting = $true - AllowNewPersonalTasks = $true - AllowTopLevelTimeReporting = $true - RequireTaskStatusManagerApproval = $true + Url = "http://sites.contoso.com/pwa" + EnableOvertimeAndNonBillableTracking = $true + DefaultTimesheetCreationMode = "CurrentProjects" + DefaultTrackingUnit = "Days" + DefaultReportingUnit = "Days" + HoursInStandardDay = 8 + HoursInStandardWeek = 40 + MaxHoursPerTimesheet = 100 + MinHoursPerTimesheet = 0 + MaxHoursPerDay = 18 + AllowFutureTimeReporting = $true + AllowNewPersonalTasks = $true + AllowTopLevelTimeReporting = $true + RequireTaskStatusManagerApproval = $true RequireLineApprovalBeforeTimesheetApproval = $true - EnableTimesheetAuditing = $true - FixedApprovalRouting = $true - SingleEntryMode = $true - DefaultTrackingMode = "PercentComplete" - ForceTrackingModeForAllProjects = $true + EnableTimesheetAuditing = $true + FixedApprovalRouting = $true + SingleEntryMode = $true + DefaultTrackingMode = "PercentComplete" + ForceTrackingModeForAllProjects = $true } $global:SPDscCurrentTimeSheetSettings = @{ TimeSheetSettings = (New-SPDscTimeSheetSettingsTable -Values @{ - WADMIN_TS_DEF_DISPLAY_ENUM = 7 - WADMIN_TS_CREATE_MODE_ENUM = 2 - WADMIN_TS_DEF_ENTRY_MODE_ENUM = 0 - WADMIN_TS_REPORT_UNIT_ENUM = 1 - WADMIN_TS_HOURS_PER_DAY = 480000 - WADMIN_TS_HOURS_PER_WEEK = 2400000 - WADMIN_TS_MAX_HR_PER_TS = 6000000 - WADMIN_TS_MIN_HR_PER_TS = 0 - WADMIN_TS_MAX_HR_PER_DAY = 1080000 - WADMIN_TS_IS_FUTURE_REP_ALLOWED = $true - WADMIN_TS_IS_UNVERS_TASK_ALLOWED = $true - WADMIN_TS_ALLOW_PROJECT_LEVEL = $true - WADMIN_TS_PROJECT_MANAGER_COORDINATION = $true - WADMIN_TS_PROJECT_MANAGER_APPROVAL = $true - WADMIN_TS_IS_AUDIT_ENABLED = $true - WADMIN_TS_FIXED_APPROVAL_ROUTING = $true - WADMIN_TS_TIED_MODE = $true - WADMIN_DEFAULT_TRACKING_METHOD = 2 - WADMIN_IS_TRACKING_METHOD_LOCKED = $true - }).Tables[0] + WADMIN_TS_DEF_DISPLAY_ENUM = 7 + WADMIN_TS_CREATE_MODE_ENUM = 2 + WADMIN_TS_DEF_ENTRY_MODE_ENUM = 0 + WADMIN_TS_REPORT_UNIT_ENUM = 1 + WADMIN_TS_HOURS_PER_DAY = 480000 + WADMIN_TS_HOURS_PER_WEEK = 2400000 + WADMIN_TS_MAX_HR_PER_TS = 6000000 + WADMIN_TS_MIN_HR_PER_TS = 0 + WADMIN_TS_MAX_HR_PER_DAY = 1080000 + WADMIN_TS_IS_FUTURE_REP_ALLOWED = $true + WADMIN_TS_IS_UNVERS_TASK_ALLOWED = $true + WADMIN_TS_ALLOW_PROJECT_LEVEL = $true + WADMIN_TS_PROJECT_MANAGER_COORDINATION = $true + WADMIN_TS_PROJECT_MANAGER_APPROVAL = $true + WADMIN_TS_IS_AUDIT_ENABLED = $true + WADMIN_TS_FIXED_APPROVAL_ROUTING = $true + WADMIN_TS_TIED_MODE = $true + WADMIN_DEFAULT_TRACKING_METHOD = 2 + WADMIN_IS_TRACKING_METHOD_LOCKED = $true + }).Tables[0] } It "Should return the current values from the get method" { @@ -261,7 +263,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerUserSyncSettings.tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerUserSyncSettings.tests.ps1 index 440c039cb..d862403df 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerUserSyncSettings.tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerUserSyncSettings.tests.ps1 @@ -1,26 +1,27 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPProjectServerUserSyncSettings" + -DscResource "SPProjectServerUserSyncSettings" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) + switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { Context -Name "All methods throw exceptions as Project Server support in SharePointDsc is only for 2016" -Fixture { It "Should throw on the get method" { { Get-TargetResource @testParams } | Should Throw @@ -35,11 +36,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - 16 { + 16 + { $modulePath = "Modules\SharePointDsc\Modules\SharePointDsc.ProjectServer\ProjectServerConnector.psm1" Import-Module -Name (Join-Path -Path $Global:SPDscHelper.RepoRoot -ChildPath $modulePath -Resolve) - Mock -CommandName "Import-Module" -MockWith {} + Mock -CommandName "Import-Module" -MockWith { } Mock -CommandName Get-SPSite -MockWith { return @{ @@ -48,18 +50,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - + Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ DisableKerberos = $true } } - try + try { [SPDscTests.DummyWebService] | Out-Null } - catch + catch { Add-Type -TypeDefinition @" namespace SPDscTests @@ -68,13 +70,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { public void Dispose() { - - } - } + + } + } } "@ } - + function New-SPDscWssAdminTable { param( @@ -98,10 +100,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName "New-SPDscProjectServerWebService" -MockWith { $service = [SPDscTests.DummyWebService]::new() $service = $service | Add-Member -MemberType ScriptMethod ` - -Name ReadWssSettings ` - -Value { - return $global:SPDscCurrentWssSettings - } -PassThru -Force + -Name ReadWssSettings ` + -Value { + return $global:SPDscCurrentWssSettings + } -PassThru -Force return $service } @@ -109,9 +111,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "WSS settings can not be found" -Fixture { $testParams = @{ - Url = "http://sites.contoso.com/pwa" - EnableProjectWebAppSync = $false - EnableProjectSiteSync = $true + Url = "http://sites.contoso.com/pwa" + EnableProjectWebAppSync = $false + EnableProjectSiteSync = $true EnableProjectSiteSyncForSPTaskLists = $false } @@ -127,16 +129,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "WSS settings are not applied correctly" -Fixture { $testParams = @{ - Url = "http://sites.contoso.com/pwa" - EnableProjectWebAppSync = $true - EnableProjectSiteSync = $true + Url = "http://sites.contoso.com/pwa" + EnableProjectWebAppSync = $true + EnableProjectSiteSync = $true EnableProjectSiteSyncForSPTaskLists = $true } $global:SPDscCurrentWssSettings = @{ WssAdmin = (New-SPDscWssAdminTable -Values @{ - WADMIN_USER_SYNC_SETTING = 11 - }).Tables[0] + WADMIN_USER_SYNC_SETTING = 11 + }).Tables[0] } It "should return false on the values from the get method" { @@ -155,19 +157,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Assert-MockCalled -CommandName "Set-SPProjectUserSync" } } - + Context -Name "WSS settings are applied correctly" -Fixture { $testParams = @{ - Url = "http://sites.contoso.com/pwa" - EnableProjectWebAppSync = $true - EnableProjectSiteSync = $true + Url = "http://sites.contoso.com/pwa" + EnableProjectWebAppSync = $true + EnableProjectSiteSync = $true EnableProjectSiteSyncForSPTaskLists = $true } $global:SPDscCurrentWssSettings = @{ WssAdmin = (New-SPDscWssAdminTable -Values @{ - WADMIN_USER_SYNC_SETTING = 240 - }).Tables[0] + WADMIN_USER_SYNC_SETTING = 240 + }).Tables[0] } It "should return true on the values from the get method" { @@ -182,7 +184,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerWssSettings.tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerWssSettings.tests.ps1 index 60e53b5cc..32976335b 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerWssSettings.tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPProjectServerWssSettings.tests.ps1 @@ -1,26 +1,27 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPProjectServerWssSettings" + -DscResource "SPProjectServerWssSettings" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) + switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { Context -Name "All methods throw exceptions as Project Server support in SharePointDsc is only for 2016" -Fixture { It "Should throw on the get method" { { Get-TargetResource @testParams } | Should Throw @@ -35,11 +36,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - 16 { + 16 + { $modulePath = "Modules\SharePointDsc\Modules\SharePointDsc.ProjectServer\ProjectServerConnector.psm1" Import-Module -Name (Join-Path -Path $Global:SPDscHelper.RepoRoot -ChildPath $modulePath -Resolve) - Mock -CommandName "Import-Module" -MockWith {} + Mock -CommandName "Import-Module" -MockWith { } Mock -CommandName Get-SPSite -MockWith { return @{ @@ -48,18 +50,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - + Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ DisableKerberos = $true } } - try + try { [SPDscTests.DummyWebService] | Out-Null } - catch + catch { Add-Type -TypeDefinition @" namespace SPDscTests @@ -68,13 +70,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { public void Dispose() { - - } - } + + } + } } "@ } - + function New-SPDscWssAdminTable { param( @@ -98,15 +100,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName "New-SPDscProjectServerWebService" -MockWith { $service = [SPDscTests.DummyWebService]::new() $service = $service | Add-Member -MemberType ScriptMethod ` - -Name ReadWssSettings ` - -Value { - return $global:SPDscCurrentWssSettings - } -PassThru -Force ` - | Add-Member -MemberType ScriptMethod ` - -Name UpdateWssSettings ` - -Value { - $global:SPDscUpdateWssSettingsCalled = $true - } -PassThru -Force + -Name ReadWssSettings ` + -Value { + return $global:SPDscCurrentWssSettings + } -PassThru -Force ` + | Add-Member -MemberType ScriptMethod ` + -Name UpdateWssSettings ` + -Value { + $global:SPDscUpdateWssSettingsCalled = $true + } -PassThru -Force return $service } @@ -114,7 +116,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "WSS settings can not be found" -Fixture { $testParams = @{ - Url = "http://sites.contoso.com/pwa" + Url = "http://sites.contoso.com/pwa" CreateProjectSiteMode = "AutoCreate" } @@ -127,14 +129,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "WSS settings are not applied correctly" -Fixture { $testParams = @{ - Url = "http://sites.contoso.com/pwa" + Url = "http://sites.contoso.com/pwa" CreateProjectSiteMode = "AutoCreate" } $global:SPDscCurrentWssSettings = @{ WssAdmin = (New-SPDscWssAdminTable -Values @{ - WADMIN_AUTO_CREATE_SUBWEBS = 2 - }).Tables[0] + WADMIN_AUTO_CREATE_SUBWEBS = 2 + }).Tables[0] } It "should return false on the values from the get method" { @@ -151,17 +153,17 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $global:SPDscUpdateWssSettingsCalled | Should Be $true } } - + Context -Name "WSS settings are applied correctly" -Fixture { $testParams = @{ - Url = "http://sites.contoso.com/pwa" + Url = "http://sites.contoso.com/pwa" CreateProjectSiteMode = "AutoCreate" } $global:SPDscCurrentWssSettings = @{ WssAdmin = (New-SPDscWssAdminTable -Values @{ - WADMIN_AUTO_CREATE_SUBWEBS = 1 - }).Tables[0] + WADMIN_AUTO_CREATE_SUBWEBS = 1 + }).Tables[0] } It "should return true on the values from the get method" { @@ -173,7 +175,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - Default { + Default + { throw [Exception] "A supported version of SharePoint was not used in testing" } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPPublishServiceApplication.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPPublishServiceApplication.Tests.ps1 index b8d541026..5f4cf10cf 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPPublishServiceApplication.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPPublishServiceApplication.Tests.ps1 @@ -15,7 +15,7 @@ Import-Module (Join-Path $RepoRoot "Modules\SharePointDsc\DSCResources\$ModuleNa Describe "SPPublishServiceApplication - SharePoint Build $((Get-Item $SharePointCmdletModule).Directory.BaseName)" { InModuleScope $ModuleName { $testParams = @{ - Name = "Managed Metadata" + Name = "Managed Metadata" Ensure = "Present" } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..\..).Path) "Modules\SharePointDsc") @@ -33,7 +33,7 @@ Describe "SPPublishServiceApplication - SharePoint Build $((Get-Item $SharePoint Mock -CommandName Get-SPServiceApplication { $spServiceApp = [pscustomobject]@{ Name = $testParams.Name - Uri = $null + Uri = $null } return $spServiceApp } @@ -53,8 +53,8 @@ Describe "SPPublishServiceApplication - SharePoint Build $((Get-Item $SharePoint Context -Name "The service application is not published but should be" { Mock -CommandName Get-SPServiceApplication { $spServiceApp = [pscustomobject]@{ - Name = $testParams.Name - Uri = "urn:schemas-microsoft-com:sharepoint:service:mmsid" + Name = $testParams.Name + Uri = "urn:schemas-microsoft-com:sharepoint:service:mmsid" Shared = $false } return $spServiceApp @@ -78,8 +78,8 @@ Describe "SPPublishServiceApplication - SharePoint Build $((Get-Item $SharePoint Context -Name "The service application is published and should be" { Mock -CommandName Get-SPServiceApplication { $spServiceApp = [pscustomobject]@{ - Name = $testParams.Name - Uri = "urn:schemas-microsoft-com:sharepoint:service:mmsid" + Name = $testParams.Name + Uri = "urn:schemas-microsoft-com:sharepoint:service:mmsid" Shared = $true } return $spServiceApp @@ -95,7 +95,7 @@ Describe "SPPublishServiceApplication - SharePoint Build $((Get-Item $SharePoint } Context -Name "The service application specified does not exist" { - Mock -CommandName Get-SPServiceApplication { return $null } + Mock -CommandName Get-SPServiceApplication { return $null } It "Should return absent from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" @@ -115,8 +115,8 @@ Describe "SPPublishServiceApplication - SharePoint Build $((Get-Item $SharePoint Context -Name "The service application is not published and should not be" { Mock -CommandName Get-SPServiceApplication { $spServiceApp = [pscustomobject]@{ - Name = $testParams.Name - Uri = "urn:schemas-microsoft-com:sharepoint:service:mmsid" + Name = $testParams.Name + Uri = "urn:schemas-microsoft-com:sharepoint:service:mmsid" Shared = $false } return $spServiceApp @@ -134,8 +134,8 @@ Describe "SPPublishServiceApplication - SharePoint Build $((Get-Item $SharePoint Context -Name "The service application is published and should not be" { Mock -CommandName Get-SPServiceApplication { $spServiceApp = [pscustomobject]@{ - Name = $testParams.Name - Uri = "urn:schemas-microsoft-com:sharepoint:service:mmsid" + Name = $testParams.Name + Uri = "urn:schemas-microsoft-com:sharepoint:service:mmsid" Shared = $true } return $spServiceApp diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPQuotaTemplate.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPQuotaTemplate.Tests.ps1 index 156ca43ba..486c14cee 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPQuotaTemplate.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPQuotaTemplate.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPQuotaTemplate" + -DscResource "SPQuotaTemplate" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -35,18 +35,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Mocks for all contexts Mock -CommandName Get-SPFarm -MockWith { - return @{} + return @{ } } # Test contexts Context -Name "WarningUsagePointsSolutions is lower than MaximumUsagePointsSolutions" -Fixture { $testParams = @{ - Name = "Test" - StorageMaxInMB = 1024 - StorageWarningInMB = 512 + Name = "Test" + StorageMaxInMB = 1024 + StorageWarningInMB = 512 MaximumUsagePointsSolutions = 1000 WarningUsagePointsSolutions = 1800 - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPFarm -MockWith { @@ -68,12 +68,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "StorageWarningInMB is lower than StorageMaxInMB" -Fixture { $testParams = @{ - Name = "Test" - StorageMaxInMB = 1024 - StorageWarningInMB = 1512 + Name = "Test" + StorageMaxInMB = 1024 + StorageWarningInMB = 1512 MaximumUsagePointsSolutions = 1000 WarningUsagePointsSolutions = 800 - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPFarm -MockWith { @@ -95,12 +95,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Using Max or Warning parameters with Ensure=Absent" -Fixture { $testParams = @{ - Name = "Test" - StorageMaxInMB = 1024 - StorageWarningInMB = 512 + Name = "Test" + StorageMaxInMB = 1024 + StorageWarningInMB = 512 MaximumUsagePointsSolutions = 1000 WarningUsagePointsSolutions = 800 - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPFarm -MockWith { @@ -122,12 +122,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The server is not part of SharePoint farm" -Fixture { $testParams = @{ - Name = "Test" - StorageMaxInMB = 1024 - StorageWarningInMB = 512 + Name = "Test" + StorageMaxInMB = 1024 + StorageWarningInMB = 512 MaximumUsagePointsSolutions = 1000 WarningUsagePointsSolutions = 800 - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPFarm -MockWith { @@ -149,34 +149,34 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The server is in a farm and the incorrect settings have been applied to the template" -Fixture { $testParams = @{ - Name = "Test" - StorageMaxInMB = 1024 - StorageWarningInMB = 512 + Name = "Test" + StorageMaxInMB = 1024 + StorageWarningInMB = 512 MaximumUsagePointsSolutions = 1000 WarningUsagePointsSolutions = 800 - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPDscContentService -MockWith { $quotaTemplates = @(@{ Test = @{ - StorageMaximumLevel = 512 - StorageWarningLevel = 256 + StorageMaximumLevel = 512 + StorageWarningLevel = 256 UserCodeMaximumLevel = 400 UserCodeWarningLevel = 200 } }) - $quotaTemplatesCol = {$quotaTemplates}.Invoke() + $quotaTemplatesCol = { $quotaTemplates }.Invoke() $contentService = @{ QuotaTemplates = $quotaTemplatesCol } $contentService = $contentService | Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value { - $Global:SPDscQuotaTemplatesUpdated = $true - } -PassThru + -Name Update ` + -Value { + $Global:SPDscQuotaTemplatesUpdated = $true + } -PassThru return $contentService } @@ -197,29 +197,29 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The server is in a farm and the template doesn't exist" -Fixture { $testParams = @{ - Name = "Test" - StorageMaxInMB = 1024 - StorageWarningInMB = 512 + Name = "Test" + StorageMaxInMB = 1024 + StorageWarningInMB = 512 MaximumUsagePointsSolutions = 1000 WarningUsagePointsSolutions = 800 - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPDscContentService -MockWith { $quotaTemplates = @(@{ Test = $null }) - $quotaTemplatesCol = {$quotaTemplates}.Invoke() + $quotaTemplatesCol = { $quotaTemplates }.Invoke() $contentService = @{ QuotaTemplates = $quotaTemplatesCol } $contentService = $contentService | Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value { - $Global:SPDscQuotaTemplatesUpdated = $true - } -PassThru + -Name Update ` + -Value { + $Global:SPDscQuotaTemplatesUpdated = $true + } -PassThru return $contentService } @@ -240,32 +240,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The server is in a farm and the correct settings have been applied" -Fixture { $testParams = @{ - Name = "Test" - StorageMaxInMB = 1024 - StorageWarningInMB = 512 + Name = "Test" + StorageMaxInMB = 1024 + StorageWarningInMB = 512 MaximumUsagePointsSolutions = 1000 WarningUsagePointsSolutions = 800 - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPDscContentService -MockWith { - $returnVal = @{ - QuotaTemplates = @{ - Test = @{ - StorageMaximumLevel = 1073741824 - StorageWarningLevel = 536870912 - UserCodeMaximumLevel = 1000 - UserCodeWarningLevel = 800 - } - } - } - $returnVal = $returnVal | Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value { - $Global:SPDscQuotaTemplatesUpdated = $true - } -PassThru - return $returnVal - } + $returnVal = @{ + QuotaTemplates = @{ + Test = @{ + StorageMaximumLevel = 1073741824 + StorageWarningLevel = 536870912 + UserCodeMaximumLevel = 1000 + UserCodeWarningLevel = 800 + } + } + } + $returnVal = $returnVal | Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { + $Global:SPDscQuotaTemplatesUpdated = $true + } -PassThru + return $returnVal + } It "Should return values from the get method" { $result = Get-TargetResource @testParams diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPRemoteFarmTrust.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPRemoteFarmTrust.Tests.ps1 index 1e7cadc68..1b6eca6f5 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPRemoteFarmTrust.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPRemoteFarmTrust.Tests.ps1 @@ -1,24 +1,24 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPRemoteFarmTrust" + -DscResource "SPRemoteFarmTrust" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - # Mocks for all contexts + # Mocks for all contexts Mock -CommandName Get-SPSite -MockWith { return @{ Url = $Identity @@ -37,11 +37,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Site = $Site } } - Mock -CommandName Set-SPAuthenticationRealm {} - Mock -CommandName Set-SPAppPrincipalPermission {} - Mock -CommandName Remove-SPAppPrincipalPermission {} - Mock -CommandName Remove-SPTrustedRootAuthority {} - Mock -CommandName Remove-SPTrustedSecurityTokenIssuer {} + Mock -CommandName Set-SPAuthenticationRealm { } + Mock -CommandName Set-SPAppPrincipalPermission { } + Mock -CommandName Remove-SPAppPrincipalPermission { } + Mock -CommandName Remove-SPTrustedRootAuthority { } + Mock -CommandName Remove-SPTrustedSecurityTokenIssuer { } Mock -CommandName New-SPTrustedSecurityTokenIssuer { return @{ NameId = "f5a433c7-69f9-48ef-916b-dde8b5fa6fdb@14757a87-4d74-4323-83b9-fb1e77e8f22f" @@ -56,10 +56,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Test contexts Context -Name "A remote farm trust doesn't exist, but should" -Fixture { $testParams = @{ - Name = "SendingFarm" - LocalWebAppUrl = "https://sharepoint.adventureworks.com" + Name = "SendingFarm" + LocalWebAppUrl = "https://sharepoint.adventureworks.com" RemoteWebAppUrl = "https://sharepoint.contoso.com" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPTrustedSecurityTokenIssuer -MockWith { @@ -86,10 +86,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A remote farm trust exists and should" -Fixture { $testParams = @{ - Name = "SendingFarm" - LocalWebAppUrl = "https://sharepoint.adventureworks.com" + Name = "SendingFarm" + LocalWebAppUrl = "https://sharepoint.adventureworks.com" RemoteWebAppUrl = "https://sharepoint.contoso.com" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPTrustedSecurityTokenIssuer -MockWith { @@ -116,10 +116,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A remote farm trust exists and shouldn't" -Fixture { $testParams = @{ - Name = "SendingFarm" - LocalWebAppUrl = "https://sharepoint.adventureworks.com" + Name = "SendingFarm" + LocalWebAppUrl = "https://sharepoint.adventureworks.com" RemoteWebAppUrl = "https://sharepoint.contoso.com" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPTrustedSecurityTokenIssuer -MockWith { @@ -152,10 +152,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A remote farm trust doesn't exist and shouldn't" -Fixture { $testParams = @{ - Name = "SendingFarm" - LocalWebAppUrl = "https://sharepoint.adventureworks.com" + Name = "SendingFarm" + LocalWebAppUrl = "https://sharepoint.adventureworks.com" RemoteWebAppUrl = "https://sharepoint.contoso.com" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPTrustedSecurityTokenIssuer -MockWith { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchAuthoritativePage.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchAuthoritativePage.Tests.ps1 index e6a8d643d..0911268da 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchAuthoritativePage.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchAuthoritativePage.Tests.ps1 @@ -1,26 +1,26 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSearchAuthoritativePage" + -DscResource "SPSearchAuthoritativePage" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope -try -{ - Add-Type -TypeDefinition @" -namespace Microsoft.Office.Server.Search.Administration { + try + { + Add-Type -TypeDefinition @" +namespace Microsoft.Office.Server.Search.Administration { public enum SearchObjectLevel { SPWeb, @@ -28,93 +28,93 @@ namespace Microsoft.Office.Server.Search.Administration { SPSiteSubscription, Ssa } - - + + public class SearchObjectOwner { public SearchObjectOwner(Microsoft.Office.Server.Search.Administration.SearchObjectLevel level) { } } } "@ -ErrorAction SilentlyContinue -} -catch -{ + } + catch + { + + } + # Mocks for all contexts -} - # Mocks for all contexts - Mock -CommandName Get-SPEnterpriseSearchQueryAuthority -MockWith { } Mock -CommandName New-SPEnterpriseSearchQueryAuthority -MockWith { } Mock -CommandName Set-SPEnterpriseSearchQueryAuthority -MockWith { } Mock -CommandName Remove-SPEnterpriseSearchQueryAuthority -MockWith { } - + Mock -CommandName Get-SPEnterpriseSearchQueryDemoted -MockWith { } Mock -CommandName New-SPEnterpriseSearchQueryDemoted -MockWith { } Mock -CommandName Remove-SPEnterpriseSearchQueryDemoted -MockWith { } - + # Test contexts Context -Name "A SharePoint Search Service doesn't exists" { $testParams = @{ ServiceAppName = "Search Service Application" - Path = "http://site.sharepoint.com/pages/authoratative.aspx" - Action = "Authoratative" - Level = 0.0 - Ensure = "Present" + Path = "http://site.sharepoint.com/pages/authoratative.aspx" + Action = "Authoratative" + Level = 0.0 + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { return $null } - + It "Should return absent from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - + 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 "Search Service App was not available." + { Set-TargetResource @testParams } | Should Throw "Search Service App was not available." } } - + Context -Name "A search query authoratative page does exist and should" { $testParams = @{ ServiceAppName = "Search Service Application" - Path = "http://site.sharepoint.com/pages/authoratative.aspx" - Action = "Authoratative" - Level = 0.0 - Ensure = "Present" + Path = "http://site.sharepoint.com/pages/authoratative.aspx" + Action = "Authoratative" + Level = 0.0 + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { - return @{ + return @{ DisplayName = $testParams.ServiceAppName } } Mock -CommandName Get-SPEnterpriseSearchQueryAuthority -MockWith { - return @{ + return @{ Identity = $testParams.Path - Level = $testParams.Level + Level = $testParams.Level } } Mock -CommandName Set-SPEnterpriseSearchQueryAuthority -MockWith { return @{ Identity = $testParams.Path - Level = $testParams.Level + Level = $testParams.Level } } - - + + It "Should return present from the get method" { $result = Get-TargetResource @testParams $result.Ensure | Should Be "Present" } - + It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $true } @@ -126,61 +126,61 @@ catch } } - + Context -Name "A search query authoratative page does exist and shouldn't" { $testParams = @{ ServiceAppName = "Search Service Application" - Path = "http://site.sharepoint.com/pages/authoratative.aspx" - Action = "Authoratative" - Level = 0.0 - Ensure = "Absent" + Path = "http://site.sharepoint.com/pages/authoratative.aspx" + Action = "Authoratative" + Level = 0.0 + Ensure = "Absent" } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { - return @{ + return @{ DisplayName = $testParams.ServiceAppName } } Mock -CommandName Get-SPEnterpriseSearchQueryAuthority -MockWith { - return @{ + return @{ Identity = $testParams.Path - Level = $testParams.Level + Level = $testParams.Level } } Mock -CommandName Remove-SPEnterpriseSearchQueryAuthority -MockWith { - return $null + return $null } - + It "Should return present from the get method" { $result = Get-TargetResource @testParams $result.Ensure | Should Be "Present" } - + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false } - - It "Should call Set functions from the Set method" { + + It "Should call Set functions from the Set method" { Set-TargetResource @testParams Assert-MockCalled Get-SPEnterpriseSearchServiceApplication -Times 1 Assert-MockCalled Remove-SPEnterpriseSearchQueryAuthority -Times 1 } } - + Context -Name "A search query authoratative page doesn't exist and shouldn't" { $testParams = @{ ServiceAppName = "Search Service Application" - Path = "http://site.sharepoint.com/pages/authoratative.aspx" - Action = "Authoratative" - Level = 0.0 - Ensure = "Absent" - } - + Path = "http://site.sharepoint.com/pages/authoratative.aspx" + Action = "Authoratative" + Level = 0.0 + Ensure = "Absent" + } + Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { - return @{ + return @{ DisplayName = $testParams.ServiceAppName } } @@ -198,7 +198,7 @@ catch $result = Get-TargetResource @testParams $result.Ensure | Should Be "Absent" } - + It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $true } @@ -209,18 +209,18 @@ catch Assert-MockCalled Remove-SPEnterpriseSearchQueryAuthority -Times 1 } } - + Context -Name "A search query authoratative page doesn't exist but should" -Fixture { $testParams = @{ ServiceAppName = "Search Service Application" - Path = "http://site.sharepoint.com/pages/authoratative.aspx" - Action = "Authoratative" - Level = 0.0 - Ensure = "Present" + Path = "http://site.sharepoint.com/pages/authoratative.aspx" + Action = "Authoratative" + Level = 0.0 + Ensure = "Present" } - Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { - return @{ + Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { + return @{ DisplayName = $testParams.ServiceAppName } } @@ -232,44 +232,44 @@ catch Mock -CommandName New-SPEnterpriseSearchQueryAuthority -MockWith { return @{ Identity = $testParams.Path - Level = $testParams.Level + Level = $testParams.Level } } - - + + It "Should return absent from the get method" { $result = Get-TargetResource @testParams $result.Ensure | Should Be "Absent" } - + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false } - + It "Should create the content source in the set method" { Set-TargetResource @testParams - - Assert-MockCalled -CommandName Get-SPEnterpriseSearchServiceApplication -Times 1 - + + Assert-MockCalled -CommandName Get-SPEnterpriseSearchServiceApplication -Times 1 + } } - + Context -Name "A search query demoted page does exist and should" { $testParams = @{ ServiceAppName = "Search Service Application" - Path = "http://site.sharepoint.com/pages/authoratative.aspx" - Action = "Demoted" - Ensure = "Present" + Path = "http://site.sharepoint.com/pages/authoratative.aspx" + Action = "Demoted" + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { - return @{ + return @{ DisplayName = $testParams.ServiceAppName } } Mock -CommandName Get-SPEnterpriseSearchQueryDemoted -MockWith { - return @{ + return @{ Identity = $testParams.Path } } @@ -278,65 +278,65 @@ catch $result = Get-TargetResource @testParams $result.Ensure | Should Be "Present" } - + It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $true } - It "Should create the content source in the set method" { + It "Should create the content source in the set method" { Set-TargetResource @testParams - - Assert-MockCalled -CommandName Get-SPEnterpriseSearchServiceApplication -Times 1 + + Assert-MockCalled -CommandName Get-SPEnterpriseSearchServiceApplication -Times 1 } } - + Context -Name "A search query demoted page does exist and shouldn't" { $testParams = @{ ServiceAppName = "Search Service Application" - Path = "http://site.sharepoint.com/pages/authoratative.aspx" - Action = "Demoted" - Ensure = "Absent" + Path = "http://site.sharepoint.com/pages/authoratative.aspx" + Action = "Demoted" + Ensure = "Absent" } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { - return @{ + return @{ DisplayName = $testParams.ServiceAppName } } Mock -CommandName Get-SPEnterpriseSearchQueryDemoted -MockWith { - return @{ + return @{ Identity = $testParams.Path } } - + It "Should return present from the get method" { $result = Get-TargetResource @testParams $result.Ensure | Should Be "Present" } - + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false } - + It "Should remove the content source in the set method" { Set-TargetResource @testParams - - Assert-MockCalled -CommandName Get-SPEnterpriseSearchServiceApplication -Times 1 - Assert-MockCalled -CommandName Remove-SPEnterpriseSearchQueryDemoted -Times 1 + + Assert-MockCalled -CommandName Get-SPEnterpriseSearchServiceApplication -Times 1 + Assert-MockCalled -CommandName Remove-SPEnterpriseSearchQueryDemoted -Times 1 } } - + Context -Name "A search query demoted page doesn't exist and shouldn't" { $testParams = @{ ServiceAppName = "Search Service Application" - Path = "http://site.sharepoint.com/pages/authoratative.aspx" - Action = "Demoted" - Ensure = "Absent" + Path = "http://site.sharepoint.com/pages/authoratative.aspx" + Action = "Demoted" + Ensure = "Absent" } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { - return @{ + return @{ DisplayName = $testParams.ServiceAppName } } @@ -344,33 +344,33 @@ catch Mock -CommandName Get-SPEnterpriseSearchQueryDemoted -MockWith { return $null } - + It "Should return absent from the get method" { $result = Get-TargetResource @testParams $result.Ensure | Should Be "Absent" } - + It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $true } It "Should remove the content source in the set method" { Set-TargetResource @testParams - - Assert-MockCalled -CommandName Get-SPEnterpriseSearchServiceApplication -Times 1 - Assert-MockCalled -CommandName Remove-SPEnterpriseSearchQueryDemoted -Times 1 + + Assert-MockCalled -CommandName Get-SPEnterpriseSearchServiceApplication -Times 1 + Assert-MockCalled -CommandName Remove-SPEnterpriseSearchQueryDemoted -Times 1 } } - + Context -Name "A search query demoted page doesn't exist but should" -Fixture { $testParams = @{ ServiceAppName = "Search Service Application" - Path = "http://site.sharepoint.com/pages/authoratative.aspx" - Action = "Demoted" - Ensure = "Present" + Path = "http://site.sharepoint.com/pages/authoratative.aspx" + Action = "Demoted" + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { - return @{ + return @{ DisplayName = $testParams.ServiceAppName } } @@ -384,24 +384,24 @@ catch Url = $params.Path } } - + It "Should return absent from the get method" { $result = Get-TargetResource @testParams $result.Ensure | Should Be "Absent" } - + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false } - + It "Should create a new query demoted element in the set method" { Set-TargetResource @testParams - - Assert-MockCalled -CommandName Get-SPEnterpriseSearchServiceApplication -Times 1 - Assert-MockCalled -CommandName New-SPEnterpriseSearchQueryDemoted -Times 1 + + Assert-MockCalled -CommandName Get-SPEnterpriseSearchServiceApplication -Times 1 + Assert-MockCalled -CommandName New-SPEnterpriseSearchQueryDemoted -Times 1 } } - + } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchContentSource.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchContentSource.Tests.ps1 index 5eb608470..b3a04cbdb 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchContentSource.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchContentSource.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSearchContentSource" + -DscResource "SPSearchContentSource" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -55,20 +55,20 @@ namespace Microsoft.Office.Server.Search.Administration { "@ # Mocks for all contexts - Mock -CommandName Start-Sleep -MockWith {} - Mock -CommandName Set-SPEnterpriseSearchCrawlContentSource -MockWith {} - Mock -CommandName Remove-SPEnterpriseSearchCrawlContentSource -MockWith {} + Mock -CommandName Start-Sleep -MockWith { } + Mock -CommandName Set-SPEnterpriseSearchCrawlContentSource -MockWith { } + Mock -CommandName Remove-SPEnterpriseSearchCrawlContentSource -MockWith { } # Test contexts Context -Name "LimitPageDepth should not be used with Content Source Type SharePoint" { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "SharePoint" - LimitPageDepth = 2 - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - Ensure = "Present" + LimitPageDepth = 2 + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + Ensure = "Present" } It "Should create the content source in the test method" { @@ -82,13 +82,13 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "LimitServerHops should not be used with Content Source Type SharePoint" { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "SharePoint" - LimitServerHops = 2 - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - Ensure = "Present" + LimitServerHops = 2 + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + Ensure = "Present" } It "Should create the content source in the test method" { @@ -102,12 +102,12 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "CrawlSetting=Custom should not be used with Content Source Type SharePoint" { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "SharePoint" - Addresses = @("http://site.contoso.com") - CrawlSetting = "Custom" - Ensure = "Present" + Addresses = @("http://site.contoso.com") + CrawlSetting = "Custom" + Ensure = "Present" } It "Should create the content source in the test method" { @@ -121,13 +121,13 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "LimitServerHops should not be used with Content Source Type Website" { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Website" - LimitServerHops = 2 - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - Ensure = "Present" + LimitServerHops = 2 + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + Ensure = "Present" } It "Should create the content source in the test method" { @@ -141,13 +141,13 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "ContinuousCrawl should not be used with Content Source Type SharePoint" { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Website" - ContinuousCrawl = $true - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - Ensure = "Present" + ContinuousCrawl = $true + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + Ensure = "Present" } It "Should create the content source in the test method" { @@ -161,13 +161,13 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "LimitPageDepth should not be used with Content Source Type FileShare" { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "FileShare" - LimitPageDepth = 2 - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - Ensure = "Present" + LimitPageDepth = 2 + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + Ensure = "Present" } It "Should create the content source in the test method" { @@ -181,13 +181,13 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "LimitServerHops should not be used with Content Source Type FileShare" { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "FileShare" - LimitServerHops = 2 - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - Ensure = "Present" + LimitServerHops = 2 + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + Ensure = "Present" } It "Should create the content source in the test method" { @@ -201,12 +201,12 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "CrawlSetting=Custom should not be used with Content Source Type FileShare" { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "FileShare" - Addresses = @("http://site.contoso.com") - CrawlSetting = "Custom" - Ensure = "Present" + Addresses = @("http://site.contoso.com") + CrawlSetting = "Custom" + Ensure = "Present" } It "Should create the content source in the test method" { @@ -220,12 +220,12 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A SharePoint content source doesn't exist but should" { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "SharePoint" - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - Ensure = "Present" + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { @@ -234,18 +234,18 @@ namespace Microsoft.Office.Server.Search.Administration { Mock -CommandName New-SPEnterpriseSearchCrawlContentSource -MockWith { return @{ - Type = "SharePoint" - SharePointCrawlBehavior = "CrawlVirtualServers" - StartAddresses = @( + Type = "SharePoint" + SharePointCrawlBehavior = "CrawlVirtualServers" + StartAddresses = @( @{ AbsoluteUri = "http://site.contoso.com" } ) - EnableContinuousCrawls = $false + EnableContinuousCrawls = $false IncrementalCrawlSchedule = $null - FullCrawlSchedule = $null - CrawlPriority = "Normal" - CrawlStatus = "Idle" + FullCrawlSchedule = $null + CrawlPriority = "Normal" + CrawlStatus = "Idle" } } @@ -268,28 +268,28 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A SharePoint content source does exist and should" { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "SharePoint" - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlFirstOnly" - Ensure = "Present" + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlFirstOnly" + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { return @{ - Name = "Example content source" - Type = "SharePoint" - SharePointCrawlBehavior = "CrawlSites" - StartAddresses = @( + Name = "Example content source" + Type = "SharePoint" + SharePointCrawlBehavior = "CrawlSites" + StartAddresses = @( @{ AbsoluteUri = "http://site.contoso.com" } ) - EnableContinuousCrawls = $false + EnableContinuousCrawls = $false IncrementalCrawlSchedule = $null - FullCrawlSchedule = $null - CrawlPriority = "Normal" - CrawlStatus = "Idle" + FullCrawlSchedule = $null + CrawlPriority = "Normal" + CrawlStatus = "Idle" } } @@ -305,28 +305,28 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A SharePoint content source does exist and shouldn't" { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "SharePoint" - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - Ensure = "Absent" + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + Ensure = "Absent" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { return @{ - Name = "Example content source" - Type = "SharePoint" - SharePointCrawlBehavior = "CrawlVirtualServers" - StartAddresses = @( + Name = "Example content source" + Type = "SharePoint" + SharePointCrawlBehavior = "CrawlVirtualServers" + StartAddresses = @( @{ AbsoluteUri = "http://site.contoso.com" } ) - EnableContinuousCrawls = $false + EnableContinuousCrawls = $false IncrementalCrawlSchedule = $null - FullCrawlSchedule = $null - CrawlPriority = "Normal" - CrawlStatus = "Idle" + FullCrawlSchedule = $null + CrawlPriority = "Normal" + CrawlStatus = "Idle" } } @@ -348,12 +348,12 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A SharePoint content source doesn't exist and shouldn't" { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "SharePoint" - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - Ensure = "Absent" + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + Ensure = "Absent" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { return $null @@ -371,29 +371,29 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A SharePoint source that uses continuous crawl has incorrect settings applied" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "SharePoint" - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - ContinuousCrawl = $true - Ensure = "Present" + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + ContinuousCrawl = $true + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { return @{ - Name = "Example content source" - Type = "SharePoint" - SharePointCrawlBehavior = "CrawlVirtualServers" - StartAddresses = @( + Name = "Example content source" + Type = "SharePoint" + SharePointCrawlBehavior = "CrawlVirtualServers" + StartAddresses = @( @{ AbsoluteUri = "http://wrong.site" } ) - EnableContinuousCrawls = $true + EnableContinuousCrawls = $true IncrementalCrawlSchedule = $null - FullCrawlSchedule = $null - CrawlPriority = "Normal" - CrawlStatus = "Idle" + FullCrawlSchedule = $null + CrawlPriority = "Normal" + CrawlStatus = "Idle" } } @@ -415,30 +415,30 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A website content source doesn't exist but should" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Website" - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - Ensure = "Present" + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { return $null } Mock -CommandName New-SPEnterpriseSearchCrawlContentSource -MockWith { return @{ - Type = "Web" - MaxPageEnumerationDepth = [System.Int32]::MaxValue - MaxSiteEnumerationDepth = 0 - StartAddresses = @( + Type = "Web" + MaxPageEnumerationDepth = [System.Int32]::MaxValue + MaxSiteEnumerationDepth = 0 + StartAddresses = @( @{ AbsoluteUri = "http://site.contoso.com" } ) IncrementalCrawlSchedule = $null - FullCrawlSchedule = $null - CrawlPriority = "Normal" - CrawlStatus = "Idle" + FullCrawlSchedule = $null + CrawlPriority = "Normal" + CrawlStatus = "Idle" } } @@ -461,28 +461,28 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A website content source does exist and should" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Website" - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - Ensure = "Present" + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { return @{ - Name = "Example content source" - Type = "Web" - MaxPageEnumerationDepth = [System.Int32]::MaxValue - MaxSiteEnumerationDepth = 0 - StartAddresses = @( + Name = "Example content source" + Type = "Web" + MaxPageEnumerationDepth = [System.Int32]::MaxValue + MaxSiteEnumerationDepth = 0 + StartAddresses = @( @{ AbsoluteUri = "http://site.contoso.com" } ) IncrementalCrawlSchedule = $null - FullCrawlSchedule = $null - CrawlPriority = "Normal" - CrawlStatus = "Idle" + FullCrawlSchedule = $null + CrawlPriority = "Normal" + CrawlStatus = "Idle" } } @@ -498,29 +498,29 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A website content source does exist and shouldn't" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Website" - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - Ensure = "Absent" + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + Ensure = "Absent" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { return @{ - Name = "Example content source" - Type = "Web" - MaxPageEnumerationDepth = [System.Int32]::MaxValue - MaxSiteEnumerationDepth = 0 - StartAddresses = @( + Name = "Example content source" + Type = "Web" + MaxPageEnumerationDepth = [System.Int32]::MaxValue + MaxSiteEnumerationDepth = 0 + StartAddresses = @( @{ AbsoluteUri = "http://site.contoso.com" } ) IncrementalCrawlSchedule = $null - FullCrawlSchedule = $null - CrawlPriority = "Normal" - CrawlStatus = "Idle" + FullCrawlSchedule = $null + CrawlPriority = "Normal" + CrawlStatus = "Idle" } } @@ -542,12 +542,12 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A website content source doesn't exist and shouldn't" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Website" - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - Ensure = "Absent" + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + Ensure = "Absent" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { @@ -566,29 +566,29 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A website content source has incorrect crawl depth settings applied" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Website" - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - Ensure = "Present" + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { return @{ - Name = "Example content source" - Type = "Web" - MaxPageEnumerationDepth = 0 - MaxSiteEnumerationDepth = 0 - StartAddresses = @( + Name = "Example content source" + Type = "Web" + MaxPageEnumerationDepth = 0 + MaxSiteEnumerationDepth = 0 + StartAddresses = @( @{ AbsoluteUri = "http://site.contoso.com" } ) IncrementalCrawlSchedule = $null - FullCrawlSchedule = $null - CrawlPriority = "Normal" - CrawlStatus = "Idle" + FullCrawlSchedule = $null + CrawlPriority = "Normal" + CrawlStatus = "Idle" } } @@ -605,29 +605,29 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A file share content source doesn't exist but should" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Fileshare" - Addresses = @("\\server\share") - CrawlSetting = "CrawlEverything" - Ensure = "Present" + Addresses = @("\\server\share") + CrawlSetting = "CrawlEverything" + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { return $null } Mock -CommandName New-SPEnterpriseSearchCrawlContentSource -MockWith { return @{ - Type = "File" - FollowDirectories = $true - StartAddresses = @( + Type = "File" + FollowDirectories = $true + StartAddresses = @( @{ AbsoluteUri = "file:///server/share" } ) IncrementalCrawlSchedule = $null - FullCrawlSchedule = $null - CrawlPriority = "Normal" - CrawlStatus = "Idle" + FullCrawlSchedule = $null + CrawlPriority = "Normal" + CrawlStatus = "Idle" } } @@ -650,28 +650,28 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A file share content source does exist and should" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Fileshare" - Addresses = @("\\server\share") - CrawlSetting = "CrawlEverything" - Ensure = "Present" + Addresses = @("\\server\share") + CrawlSetting = "CrawlEverything" + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { return @{ - Name = "Example content source" - Type = "File" - FollowDirectories = $true - StartAddresses = @( + Name = "Example content source" + Type = "File" + FollowDirectories = $true + StartAddresses = @( @{ AbsoluteUri = "file:///server/share" } ) IncrementalCrawlSchedule = $null - FullCrawlSchedule = $null - CrawlPriority = "Normal" - CrawlStatus = "Idle" + FullCrawlSchedule = $null + CrawlPriority = "Normal" + CrawlStatus = "Idle" } } @@ -687,28 +687,28 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A file share content source does exist and shouldn't" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Fileshare" - Addresses = @("\\server\share") - CrawlSetting = "CrawlEverything" - Ensure = "Absent" + Addresses = @("\\server\share") + CrawlSetting = "CrawlEverything" + Ensure = "Absent" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { return @{ - Name = "Example content source" - Type = "File" - FollowDirectories = $true - StartAddresses = @( + Name = "Example content source" + Type = "File" + FollowDirectories = $true + StartAddresses = @( @{ AbsoluteUri = "file:///server/share" } ) IncrementalCrawlSchedule = $null - FullCrawlSchedule = $null - CrawlPriority = "Normal" - CrawlStatus = "Idle" + FullCrawlSchedule = $null + CrawlPriority = "Normal" + CrawlStatus = "Idle" } } @@ -730,12 +730,12 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A file share content source doesn't exist and shouldn't" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Fileshare" - Addresses = @("\\server\share") - CrawlSetting = "CrawlEverything" - Ensure = "Absent" + Addresses = @("\\server\share") + CrawlSetting = "CrawlEverything" + Ensure = "Absent" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { return $null @@ -753,27 +753,27 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A file share content source has incorrect crawl depth settings applied" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Fileshare" - Addresses = @("\\server\share") - CrawlSetting = "CrawlEverything" - Ensure = "Present" + Addresses = @("\\server\share") + CrawlSetting = "CrawlEverything" + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { return @{ - Name = "Example content source" - Type = "File" - FollowDirectories = $false - StartAddresses = @( + Name = "Example content source" + Type = "File" + FollowDirectories = $false + StartAddresses = @( @{ AbsoluteUri = "file:///server/share" } ) IncrementalCrawlSchedule = $null - FullCrawlSchedule = $null - CrawlPriority = "Normal" - CrawlStatus = "Idle" + FullCrawlSchedule = $null + CrawlPriority = "Normal" + CrawlStatus = "Idle" } } @@ -790,19 +790,19 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A content source has a full schedule that does not match the desired schedule" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "SharePoint" - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - Ensure = "Present" - FullSchedule = (New-CimInstance -ClassName MSFT_SPSearchCrawlSchedule -Property @{ - ScheduleType = "Daily" - StartHour = "0" - StartMinute = "0" - CrawlScheduleRepeatDuration = "1440" - CrawlScheduleRepeatInterval = "5" - } -ClientOnly) + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + Ensure = "Present" + FullSchedule = (New-CimInstance -ClassName MSFT_SPSearchCrawlSchedule -Property @{ + ScheduleType = "Daily" + StartHour = "0" + StartMinute = "0" + CrawlScheduleRepeatDuration = "1440" + CrawlScheduleRepeatInterval = "5" + } -ClientOnly) } $Global:SPDscContentSourceLoopCount = 0 @@ -824,24 +824,24 @@ namespace Microsoft.Office.Server.Search.Administration { $crawlStatus = "Idle" } $returnval = @{ - Name = "Example content source" - Type = "SharePoint" - SharePointCrawlBehavior = "CrawlVirtualServers" - StartAddresses = @( + Name = "Example content source" + Type = "SharePoint" + SharePointCrawlBehavior = "CrawlVirtualServers" + StartAddresses = @( @{ AbsoluteUri = "http://site.contoso.com" } ) - EnableContinuousCrawls = $false + EnableContinuousCrawls = $false IncrementalCrawlSchedule = $null - FullCrawlSchedule = $schedule - CrawlPriority = "Normal" - CrawlStatus = $crawlStatus + FullCrawlSchedule = $schedule + CrawlPriority = "Normal" + CrawlStatus = $crawlStatus } $returnval = $returnval | Add-Member -MemberType ScriptMethod ` - -Name StopCrawl ` - -Value { - } -PassThru -Force + -Name StopCrawl ` + -Value { + } -PassThru -Force $Global:SPDscContentSourceLoopCount++ return $returnval @@ -860,19 +860,19 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A content source has a full schedule that does match the desired schedule" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "SharePoint" - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - Ensure = "Present" - FullSchedule = (New-CimInstance -ClassName MSFT_SPSearchCrawlSchedule -Property @{ - ScheduleType = "Daily" - StartHour = "0" - StartMinute = "0" - CrawlScheduleRepeatDuration = "1440" - CrawlScheduleRepeatInterval = "5" - } -ClientOnly) + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + Ensure = "Present" + FullSchedule = (New-CimInstance -ClassName MSFT_SPSearchCrawlSchedule -Property @{ + ScheduleType = "Daily" + StartHour = "0" + StartMinute = "0" + CrawlScheduleRepeatDuration = "1440" + CrawlScheduleRepeatInterval = "5" + } -ClientOnly) } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { @@ -883,19 +883,19 @@ namespace Microsoft.Office.Server.Search.Administration { $schedule.StartMinute = 0 $schedule.DaysInterval = 1 return @{ - Name = "Example content source" - Type = "SharePoint" - SharePointCrawlBehavior = "CrawlVirtualServers" - StartAddresses = @( + Name = "Example content source" + Type = "SharePoint" + SharePointCrawlBehavior = "CrawlVirtualServers" + StartAddresses = @( @{ AbsoluteUri = "http://site.contoso.com" } ) - EnableContinuousCrawls = $false + EnableContinuousCrawls = $false IncrementalCrawlSchedule = $null - FullCrawlSchedule = $schedule - CrawlPriority = "Normal" - CrawlStatus = "Idle" + FullCrawlSchedule = $schedule + CrawlPriority = "Normal" + CrawlStatus = "Idle" } } @@ -906,18 +906,18 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A content source has a incremental schedule that does not match the desired schedule" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" - ContentSourceType = "SharePoint" - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - Ensure = "Present" + Name = "Example content source" + ServiceAppName = "Search Service Application" + ContentSourceType = "SharePoint" + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + Ensure = "Present" IncrementalSchedule = (New-CimInstance -ClassName MSFT_SPSearchCrawlSchedule -Property @{ - ScheduleType = "Weekly" - StartHour = "0" - StartMinute = "0" - CrawlScheduleDaysOfWeek = @("Monday", "Wednesday") - } -ClientOnly) + ScheduleType = "Weekly" + StartHour = "0" + StartMinute = "0" + CrawlScheduleDaysOfWeek = @("Monday", "Wednesday") + } -ClientOnly) } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { @@ -926,19 +926,19 @@ namespace Microsoft.Office.Server.Search.Administration { $schedule.StartMinute = 0 $schedule.DaysOfWeek = [enum]::Parse([Microsoft.Office.Server.Search.Administration.DaysOfWeek], "Monday, Wednesday, Friday") return @{ - Name = "Example content source" - Type = "SharePoint" - SharePointCrawlBehavior = "CrawlVirtualServers" - StartAddresses = @( + Name = "Example content source" + Type = "SharePoint" + SharePointCrawlBehavior = "CrawlVirtualServers" + StartAddresses = @( @{ AbsoluteUri = "http://site.contoso.com" } ) - EnableContinuousCrawls = $false + EnableContinuousCrawls = $false IncrementalCrawlSchedule = $schedule - FullCrawlSchedule = $null - CrawlPriority = "Normal" - CrawlStatus = "Idle" + FullCrawlSchedule = $null + CrawlPriority = "Normal" + CrawlStatus = "Idle" } } @@ -954,18 +954,18 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A content source has a incremental schedule that does match the desired schedule" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" - ContentSourceType = "SharePoint" - Addresses = @("http://site.contoso.com") - CrawlSetting = "CrawlEverything" - Ensure = "Present" + Name = "Example content source" + ServiceAppName = "Search Service Application" + ContentSourceType = "SharePoint" + Addresses = @("http://site.contoso.com") + CrawlSetting = "CrawlEverything" + Ensure = "Present" IncrementalSchedule = (New-CimInstance -ClassName MSFT_SPSearchCrawlSchedule -Property @{ - ScheduleType = "Weekly" - StartHour = "0" - StartMinute = "0" - CrawlScheduleDaysOfWeek = @("Monday", "Wednesday", "Friday") - } -ClientOnly) + ScheduleType = "Weekly" + StartHour = "0" + StartMinute = "0" + CrawlScheduleDaysOfWeek = @("Monday", "Wednesday", "Friday") + } -ClientOnly) } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { @@ -974,19 +974,19 @@ namespace Microsoft.Office.Server.Search.Administration { $schedule.StartMinute = 0 $schedule.DaysOfWeek = [enum]::Parse([Microsoft.Office.Server.Search.Administration.DaysOfWeek], "Monday, Wednesday, Friday") return @{ - Name = "Example content source" - Type = "SharePoint" - SharePointCrawlBehavior = "CrawlVirtualServers" - StartAddresses = @( + Name = "Example content source" + Type = "SharePoint" + SharePointCrawlBehavior = "CrawlVirtualServers" + StartAddresses = @( @{ AbsoluteUri = "http://site.contoso.com" } ) - EnableContinuousCrawls = $false + EnableContinuousCrawls = $false IncrementalCrawlSchedule = $schedule - FullCrawlSchedule = $null - CrawlPriority = "Normal" - CrawlStatus = "Idle" + FullCrawlSchedule = $null + CrawlPriority = "Normal" + CrawlStatus = "Idle" } } @@ -997,22 +997,22 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A business content source does exist and should" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Business" - LOBSystemSet = @("MyDataSource", "MyDataSourceInstance") - Ensure = "Present" + LOBSystemSet = @("MyDataSource", "MyDataSourceInstance") + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { return @{ - Name = "Example content source" - Type = "Business" + Name = "Example content source" + Type = "Business" IncrementalCrawlSchedule = $null - FullCrawlSchedule = $null - StartAddresses = @( + FullCrawlSchedule = $null + StartAddresses = @( @{ AbsoluteUri = "bdc3://segment1/segment2/segment3/MyDataSource/MyDataSourceInstance&fakevalue=1" - Segments = @("bdc3", "segment1", "segment2", "segment3", "MyDataSource", "MyDataSourceInstance&fakevalue=1") + Segments = @("bdc3", "segment1", "segment2", "segment3", "MyDataSource", "MyDataSourceInstance&fakevalue=1") } ) } @@ -1035,11 +1035,11 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A business content source does not exist and should" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Business" - LOBSystemSet = @("MyDataSource", "MyDataSourceInstance") - Ensure = "Present" + LOBSystemSet = @("MyDataSource", "MyDataSourceInstance") + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { return $null @@ -1047,12 +1047,12 @@ namespace Microsoft.Office.Server.Search.Administration { Mock -CommandName New-SPEnterpriseSearchCrawlContentSource -MockWith { return @{ - Type = "Business" - SearchApplication = $testParams.ServiceAppName + Type = "Business" + SearchApplication = $testParams.ServiceAppName IncrementalCrawlSchedule = $null - FullCrawlSchedule = $null - LOBSystemSet = $testParams.LOBSystemSet - CrawlStatus = "Idle" + FullCrawlSchedule = $null + LOBSystemSet = $testParams.LOBSystemSet + CrawlStatus = "Idle" } } @@ -1080,23 +1080,23 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A business content source does exist and shouldn't" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Business" - LOBSystemSet = @("MyDataSource", "MyDataSourceInstance") - Ensure = "Absent" + LOBSystemSet = @("MyDataSource", "MyDataSourceInstance") + Ensure = "Absent" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { return @{ - Name = "Example content source" - Type = "Business" + Name = "Example content source" + Type = "Business" IncrementalCrawlSchedule = $null - FullCrawlSchedule = $null - StartAddresses = @( + FullCrawlSchedule = $null + StartAddresses = @( @{ AbsoluteUri = "bdc3://segment1/segment2/segment3/MyDataSource/MyDataSourceInstance&fakevalue=1" - Segments = @("bdc3", "segment1", "segment2", "segment3", "MyDataSource", "MyDataSourceInstance&fakevalue=1") + Segments = @("bdc3", "segment1", "segment2", "segment3", "MyDataSource", "MyDataSourceInstance&fakevalue=1") } ) } @@ -1120,11 +1120,11 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "A business content source doesn't exist and shouldn't" -Fixture { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Business" - LOBSystemSet = @("MyDataSource", "MyDataSourceInstance") - Ensure = "Absent" + LOBSystemSet = @("MyDataSource", "MyDataSourceInstance") + Ensure = "Absent" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { @@ -1143,10 +1143,10 @@ namespace Microsoft.Office.Server.Search.Administration { Context -Name "Invalid Content Source Type" { $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Business" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchCrawlContentSource -MockWith { return @{ @@ -1167,11 +1167,11 @@ namespace Microsoft.Office.Server.Search.Administration { } $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "SharePoint" - LimitPageDepth = 1 - Ensure = "Present" + LimitPageDepth = 1 + Ensure = "Present" } It "Should throw Invalid parameter error" { @@ -1180,11 +1180,11 @@ namespace Microsoft.Office.Server.Search.Administration { } $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "SharePoint" - LimitServerHops = 1 - Ensure = "Present" + LimitServerHops = 1 + Ensure = "Present" } It "Should throw Invalid parameter error" { @@ -1193,11 +1193,11 @@ namespace Microsoft.Office.Server.Search.Administration { } $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "SharePoint" - CrawlSetting = "Custom" - Ensure = "Present" + CrawlSetting = "Custom" + Ensure = "Present" } It "Should throw Invalid parameter error" { @@ -1213,11 +1213,11 @@ namespace Microsoft.Office.Server.Search.Administration { } $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Website" - ContinuousCrawl = $true - Ensure = "Present" + ContinuousCrawl = $true + Ensure = "Present" } It "Should throw Invalid parameter error" { @@ -1226,11 +1226,11 @@ namespace Microsoft.Office.Server.Search.Administration { } $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Website" - LimitServerHops = 1 - Ensure = "Present" + LimitServerHops = 1 + Ensure = "Present" } It "Should throw Invalid parameter error" { @@ -1246,11 +1246,11 @@ namespace Microsoft.Office.Server.Search.Administration { } $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "FileShare" - LimitPageDepth = 1 - Ensure = "Present" + LimitPageDepth = 1 + Ensure = "Present" } It "Should throw Invalid parameter error" { @@ -1259,11 +1259,11 @@ namespace Microsoft.Office.Server.Search.Administration { } $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "FileShare" - LimitServerHops = 1 - Ensure = "Present" + LimitServerHops = 1 + Ensure = "Present" } It "Should throw Invalid parameter error" { @@ -1272,11 +1272,11 @@ namespace Microsoft.Office.Server.Search.Administration { } $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "FileShare" - CrawlSetting = "Custom" - Ensure = "Present" + CrawlSetting = "Custom" + Ensure = "Present" } It "Should throw Invalid parameter error" { @@ -1292,11 +1292,11 @@ namespace Microsoft.Office.Server.Search.Administration { } $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Business" - LimitPageDepth = 1 - Ensure = "Present" + LimitPageDepth = 1 + Ensure = "Present" } It "Should throw Invalid parameter error" { @@ -1305,11 +1305,11 @@ namespace Microsoft.Office.Server.Search.Administration { } $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Business" - LimitServerHops = 1 - Ensure = "Present" + LimitServerHops = 1 + Ensure = "Present" } It "Should throw Invalid parameter error" { @@ -1318,11 +1318,11 @@ namespace Microsoft.Office.Server.Search.Administration { } $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "Business" - ContinuousCrawl = $true - Ensure = "Present" + ContinuousCrawl = $true + Ensure = "Present" } It "Should throw Invalid parameter error" { @@ -1337,22 +1337,22 @@ namespace Microsoft.Office.Server.Search.Administration { Name = "Example content source" } $returnval = $returnval | Add-Member -MemberType NoteProperty ` - -Name Type ` - -Value "Business" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name StopCrawl ` - -Value { - $null - } -PassThru -Force + -Name Type ` + -Value "Business" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name StopCrawl ` + -Value { + $null + } -PassThru -Force return $returnval } $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "FileShare" - Ensure = "Present" + Ensure = "Present" } It "Should throw error complaining cannot change type without the force parameter" { @@ -1360,11 +1360,11 @@ namespace Microsoft.Office.Server.Search.Administration { } $testParams = @{ - Name = "Example content source" - ServiceAppName = "Search Service Application" + Name = "Example content source" + ServiceAppName = "Search Service Application" ContentSourceType = "FileShare" - Force = $true - Ensure = "Present" + Force = $true + Ensure = "Present" } It "Should change the Content Source Type" { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchCrawlMapping.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchCrawlMapping.Tests.ps1 index 81b07512d..f85040e0d 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchCrawlMapping.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchCrawlMapping.Tests.ps1 @@ -1,93 +1,93 @@ [CmdletBinding()] -param( +param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSearchCrawlMapping" + -DscResource "SPSearchCrawlMapping" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - + # Initialize tests $getTypeFullName = "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - # Mocks for all contexts - Mock -CommandName Remove-SPEnterpriseSearchCrawlMapping -MockWith {} - Mock -CommandName New-SPEnterpriseSearchCrawlMapping -MockWith {} - Mock -CommandName Get-SPEnterpriseSearchCrawlMapping -MockWith {} - Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith {} + # Mocks for all contexts + Mock -CommandName Remove-SPEnterpriseSearchCrawlMapping -MockWith { } + Mock -CommandName New-SPEnterpriseSearchCrawlMapping -MockWith { } + Mock -CommandName Get-SPEnterpriseSearchCrawlMapping -MockWith { } + Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { } - Mock -CommandName Get-SPServiceApplication -MockWith { + Mock -CommandName Get-SPServiceApplication -MockWith { return @( - New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru - } ` - -PassThru -Force) + New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name FullName ` + -Value $getTypeFullName ` + -PassThru + } ` + -PassThru -Force) } # Test contexts Context -Name "When enterprise search service doesn't exist in the current farm" -Fixture { $testParams = @{ ServiceAppName = "Search Service Application" - Url = "http://crawl.sharepoint.com" - Target = "http://site.sharepoint.com" - Ensure = "Present" + Url = "http://crawl.sharepoint.com" + Target = "http://site.sharepoint.com" + Ensure = "Present" } - Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { - return $null + Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { + return $null } - + It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return false when the Test method is called" { Test-TargetResource @testParams | Should Be $false } - It "Should throw Exception -- The Search Service Application does not exist" { - { Set-TargetResource @testParams } | Should throw "The Search Service Application does not exist" + It "Should throw Exception -- The Search Service Application does not exist" { + { Set-TargetResource @testParams } | Should throw "The Search Service Application does not exist" } } Context -Name "When no crawl mappings exists" -Fixture { $testParams = @{ - ServiceAppName = "Search Service Application" - Url = "http://crawl.sharepoint.com" - Target = "http://site.sharepoint.com" - Ensure = "Present" + ServiceAppName = "Search Service Application" + Url = "http://crawl.sharepoint.com" + Target = "http://site.sharepoint.com" + Ensure = "Present" } - - Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { + + Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { return @{ Name = "Search Service Application" } } - Mock -CommandName Get-SPEnterpriseSearchCrawlMapping -MockWith { + Mock -CommandName Get-SPEnterpriseSearchCrawlMapping -MockWith { return $null } - + It "Should return absent from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" } @@ -96,37 +96,37 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Test-TargetResource @testParams | Should Be $false } - + } Context -Name "When crawl mappings exists but specific mapping does not" -Fixture { $testParams = @{ - ServiceAppName = "Search Service Application" - Url = "http://crawl.sharepoint.com" - Target = "http://site.sharepoint.com" - Ensure = "Present" + ServiceAppName = "Search Service Application" + Url = "http://crawl.sharepoint.com" + Target = "http://site.sharepoint.com" + Ensure = "Present" } - - Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { + + Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { return @{ Name = "Search Service Application" } } - Mock -CommandName Get-SPEnterpriseSearchCrawlMapping -MockWith { + Mock -CommandName Get-SPEnterpriseSearchCrawlMapping -MockWith { return @( @{ - Url = "http://other.sharepoint.com" + Url = "http://other.sharepoint.com" Target = "http://site.sharepoint.com" }, @{ - Url = "http://site.sharepoint.com" + Url = "http://site.sharepoint.com" Target = "http://site2.sharepoint.com" } ) } - + It "Should return absent from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" } @@ -135,24 +135,24 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Test-TargetResource @testParams | Should Be $false } } - + Context -Name "When a crawl mapping exists, and is configured correctly" -Fixture { - - $testParams = @{ - ServiceAppName = "Search Service Application" - Url = "http://crawl.sharepoint.com" - Target = "http://site.sharepoint.com" - Ensure = "Present" - } - - Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { + + $testParams = @{ + ServiceAppName = "Search Service Application" + Url = "http://crawl.sharepoint.com" + Target = "http://site.sharepoint.com" + Ensure = "Present" + } + + Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { return @{ Name = "Search Service Application" } } - Mock -CommandName Get-SPEnterpriseSearchCrawlMapping -MockWith { + Mock -CommandName Get-SPEnterpriseSearchCrawlMapping -MockWith { return @( @{ Source = "http://other.sharepoint.com" @@ -164,7 +164,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { }, @{ Source = $testParams.Url - Target = $testParams.Target + Target = $testParams.Target } ) } @@ -182,26 +182,26 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Assert-MockCalled Get-SPEnterpriseSearchServiceApplication Assert-MockCalled Get-SPEnterpriseSearchCrawlMapping Assert-MockCalled Remove-SPEnterpriseSearchCrawlMapping - Assert-MockCalled New-SPEnterpriseSearchCrawlMapping + Assert-MockCalled New-SPEnterpriseSearchCrawlMapping } } Context -Name "When a crawl mapping exists, but isn't configured correctly" -Fixture { - $testParams = @{ - ServiceAppName = "Search Service Application" - Url = "http://crawl.sharepoint.com" - Target = "http://site.sharepoint.com" - Ensure = "Present" - } - - Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { + $testParams = @{ + ServiceAppName = "Search Service Application" + Url = "http://crawl.sharepoint.com" + Target = "http://site.sharepoint.com" + Ensure = "Present" + } + + Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { return @{ Name = "Search Service Application" } } - Mock -CommandName Get-SPEnterpriseSearchCrawlMapping -MockWith { + Mock -CommandName Get-SPEnterpriseSearchCrawlMapping -MockWith { return @( @{ Source = "http://other.sharepoint.com" @@ -230,26 +230,26 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Set-TargetResource @testParams Assert-MockCalled Get-SPEnterpriseSearchCrawlMapping Assert-MockCalled Remove-SPEnterpriseSearchCrawlMapping - Assert-MockCalled New-SPEnterpriseSearchCrawlMapping + Assert-MockCalled New-SPEnterpriseSearchCrawlMapping } } Context -Name "When a crawl mapping doesn't exists, but it should" -Fixture { $testParams = @{ - ServiceAppName = "Search Service Application" - Url = "http://crawl.sharepoint.com" - Target = "http://site.sharepoint.com" - Ensure = "Present" + ServiceAppName = "Search Service Application" + Url = "http://crawl.sharepoint.com" + Target = "http://site.sharepoint.com" + Ensure = "Present" } - - Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { + + Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { return @{ Name = "Search Service Application" } } - Mock -CommandName Get-SPEnterpriseSearchCrawlMapping -MockWith { + Mock -CommandName Get-SPEnterpriseSearchCrawlMapping -MockWith { return @( @{ Source = "http://other.sharepoint.com" @@ -270,28 +270,28 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Test-TargetResource @testParams | Should Be $false } - It "Should call the Get Remove New -SPEnterpriseSearchCrawlMapping update the crawl mapping" { + It "Should call the Get Remove New -SPEnterpriseSearchCrawlMapping update the crawl mapping" { Set-TargetResource @testParams - Assert-MockCalled New-SPEnterpriseSearchCrawlMapping - } + Assert-MockCalled New-SPEnterpriseSearchCrawlMapping + } } Context -Name "When a crawl mapping exists, but isn't configured correctly" -Fixture { - $testParams = @{ - ServiceAppName = "Search Service Application" - Url = "http://crawl.sharepoint.com" - Target = "http://site.sharepoint.com" - Ensure = "Present" - } - - Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { + $testParams = @{ + ServiceAppName = "Search Service Application" + Url = "http://crawl.sharepoint.com" + Target = "http://site.sharepoint.com" + Ensure = "Present" + } + + Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { return @{ Name = "Search Service Application" } } - Mock -CommandName Get-SPEnterpriseSearchCrawlMapping -MockWith { + Mock -CommandName Get-SPEnterpriseSearchCrawlMapping -MockWith { return @( @{ Source = "http://other.sharepoint.com" @@ -320,26 +320,26 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Set-TargetResource @testParams Assert-MockCalled Get-SPEnterpriseSearchCrawlMapping Assert-MockCalled Remove-SPEnterpriseSearchCrawlMapping - Assert-MockCalled New-SPEnterpriseSearchCrawlMapping + Assert-MockCalled New-SPEnterpriseSearchCrawlMapping } } Context -Name "When a crawl mapping does exists, but it shouldn't" -Fixture { $testParams = @{ - ServiceAppName = "Search Service Application" - Url = "http://crawl.sharepoint.com" - Target = "http://site.sharepoint.com" - Ensure = "Absent" + ServiceAppName = "Search Service Application" + Url = "http://crawl.sharepoint.com" + Target = "http://site.sharepoint.com" + Ensure = "Absent" } - - Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { + + Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { return @{ Name = "Search Service Application" } } - Mock -CommandName Get-SPEnterpriseSearchCrawlMapping -MockWith { + Mock -CommandName Get-SPEnterpriseSearchCrawlMapping -MockWith { return @( @{ Source = "http://other.sharepoint.com" @@ -366,12 +366,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should call the Get Remove New -SPEnterpriseSearchCrawlMapping update the crawl mapping" { Set-TargetResource @testParams - Assert-MockCalled Get-SPEnterpriseSearchCrawlMapping - Assert-MockCalled Remove-SPEnterpriseSearchCrawlMapping + Assert-MockCalled Get-SPEnterpriseSearchCrawlMapping + Assert-MockCalled Remove-SPEnterpriseSearchCrawlMapping } } - } + } } - - + + Invoke-Command -ScriptBlock $Global:SPDscHelper.CleanupScript -NoNewScope diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchCrawlRule.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchCrawlRule.Tests.ps1 index 710df66bd..50a98e611 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchCrawlRule.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchCrawlRule.Tests.ps1 @@ -1,18 +1,18 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSearchCrawlRule" + -DscResource "SPSearchCrawlRule" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -21,38 +21,38 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Initialize tests $getTypeFullName = "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - # Mocks for all contexts - Mock -CommandName Remove-SPEnterpriseSearchCrawlRule -MockWith {} - Mock -CommandName New-SPEnterpriseSearchCrawlRule -MockWith {} - Mock -CommandName Set-SPEnterpriseSearchCrawlRule -MockWith {} + # Mocks for all contexts + Mock -CommandName Remove-SPEnterpriseSearchCrawlRule -MockWith { } + Mock -CommandName New-SPEnterpriseSearchCrawlRule -MockWith { } + Mock -CommandName Set-SPEnterpriseSearchCrawlRule -MockWith { } - Mock -CommandName Get-SPServiceApplication -MockWith { + Mock -CommandName Get-SPServiceApplication -MockWith { return @( - New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru - } ` - -PassThru -Force) + New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name FullName ` + -Value $getTypeFullName ` + -PassThru + } ` + -PassThru -Force) } # Test contexts Context -Name "AuthenticationType=CertificateRuleAccess specified, but CertificateName missing" -Fixture { $testParams = @{ - Path = "http://www.contoso.com" - ServiceAppName = "Search Service Application" - CrawlConfigurationRules = "FollowLinksNoPageCrawl","CrawlComplexUrls", "CrawlAsHTTP" - AuthenticationType = "CertificateRuleAccess" - Ensure = "Present" + Path = "http://www.contoso.com" + ServiceAppName = "Search Service Application" + CrawlConfigurationRules = "FollowLinksNoPageCrawl", "CrawlComplexUrls", "CrawlAsHTTP" + AuthenticationType = "CertificateRuleAccess" + Ensure = "Present" } - + It "Should return null from the Get method" { - { Get-TargetResource @testParams } | Should throw "When AuthenticationType=CertificateRuleAccess, the parameter CertificateName is required" + { Get-TargetResource @testParams } | Should throw "When AuthenticationType=CertificateRuleAccess, the parameter CertificateName is required" } It "Should return false when the Test method is called" { @@ -66,16 +66,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "CertificateName specified, but AuthenticationType is not CertificateRuleAccess" -Fixture { $testParams = @{ - Path = "http://www.contoso.com" - ServiceAppName = "Search Service Application" - CrawlConfigurationRules = "FollowLinksNoPageCrawl","CrawlComplexUrls", "CrawlAsHTTP" - AuthenticationType = "DefaultRuleAccess" - CertificateName = "Test Certificate" - Ensure = "Present" - } - + Path = "http://www.contoso.com" + ServiceAppName = "Search Service Application" + CrawlConfigurationRules = "FollowLinksNoPageCrawl", "CrawlComplexUrls", "CrawlAsHTTP" + AuthenticationType = "DefaultRuleAccess" + CertificateName = "Test Certificate" + Ensure = "Present" + } + It "Should return null from the Get method" { - { Get-TargetResource @testParams } | Should throw "When specifying CertificateName, the AuthenticationType parameter is required" + { Get-TargetResource @testParams } | Should throw "When specifying CertificateName, the AuthenticationType parameter is required" } It "Should return false when the Test method is called" { @@ -89,13 +89,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name " AuthenticationType=NTLMAccountRuleAccess and AuthenticationCredentialsparameters not specified" -Fixture { $testParams = @{ - Path = "http://www.contoso.com" - ServiceAppName = "Search Service Application" - CrawlConfigurationRules = "FollowLinksNoPageCrawl","CrawlComplexUrls", "CrawlAsHTTP" - AuthenticationType = "NTLMAccountRuleAccess" - Ensure = "Present" + Path = "http://www.contoso.com" + ServiceAppName = "Search Service Application" + CrawlConfigurationRules = "FollowLinksNoPageCrawl", "CrawlComplexUrls", "CrawlAsHTTP" + AuthenticationType = "NTLMAccountRuleAccess" + Ensure = "Present" } - + It "Should return null from the Get method" { { Get-TargetResource @testParams } | Should throw "When AuthenticationType is NTLMAccountRuleAccess or BasicAccountRuleAccess, the parameter AuthenticationCredentials is required" } @@ -113,14 +113,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $User = "Domain01\User01" $PWord = ConvertTo-SecureString -String "P@sSwOrd" -AsPlainText -Force $Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, $PWord - + $testParams = @{ - Path = "http://www.contoso.com" - ServiceAppName = "Search Service Application" - CrawlConfigurationRules = "FollowLinksNoPageCrawl","CrawlComplexUrls", "CrawlAsHTTP" - AuthenticationType = "DefaultRuleAccess" + Path = "http://www.contoso.com" + ServiceAppName = "Search Service Application" + CrawlConfigurationRules = "FollowLinksNoPageCrawl", "CrawlComplexUrls", "CrawlAsHTTP" + AuthenticationType = "DefaultRuleAccess" AuthenticationCredentials = $Credential - Ensure = "Present" + Ensure = "Present" } It "Should return null from the Get method" { @@ -138,12 +138,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "ExclusionRule only with CrawlConfigurationRules=CrawlComplexUrls" -Fixture { $testParams = @{ - Path = "http://www.contoso.com" - ServiceAppName = "Search Service Application" - CrawlConfigurationRules = "FollowLinksNoPageCrawl","CrawlComplexUrls", "CrawlAsHTTP" - AuthenticationType = "DefaultRuleAccess" - RuleType = "ExclusionRule" - Ensure = "Present" + Path = "http://www.contoso.com" + ServiceAppName = "Search Service Application" + CrawlConfigurationRules = "FollowLinksNoPageCrawl", "CrawlComplexUrls", "CrawlAsHTTP" + AuthenticationType = "DefaultRuleAccess" + RuleType = "ExclusionRule" + Ensure = "Present" } It "Should return null from the Get method" { @@ -161,14 +161,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "ExclusionRule cannot be used with AuthenticationCredentials, CertificateName or AuthenticationType parameters" -Fixture { $testParams = @{ - Path = "http://www.contoso.com" - ServiceAppName = "Search Service Application" + Path = "http://www.contoso.com" + ServiceAppName = "Search Service Application" CrawlConfigurationRules = "CrawlComplexUrls" - AuthenticationType = "DefaultRuleAccess" - RuleType = "ExclusionRule" - Ensure = "Present" + AuthenticationType = "DefaultRuleAccess" + RuleType = "ExclusionRule" + Ensure = "Present" } - + It "Should return null from the Get method" { { Get-TargetResource @testParams } | Should throw "When Type=ExclusionRule, parameters AuthenticationCredentials, CertificateName or AuthenticationType are not allowed" } @@ -184,20 +184,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When no service applications exist in the current farm" -Fixture { $testParams = @{ - Path = "http://www.contoso.com" - ServiceAppName = "Search Service Application" - RuleType = "InclusionRule" - CrawlConfigurationRules = "FollowLinksNoPageCrawl","CrawlComplexUrls", "CrawlAsHTTP" - AuthenticationType = "DefaultRuleAccess" - Ensure = "Present" + Path = "http://www.contoso.com" + ServiceAppName = "Search Service Application" + RuleType = "InclusionRule" + CrawlConfigurationRules = "FollowLinksNoPageCrawl", "CrawlComplexUrls", "CrawlAsHTTP" + AuthenticationType = "DefaultRuleAccess" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplication -MockWith { - return $null + Mock -CommandName Get-SPServiceApplication -MockWith { + return $null } - + It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return false when the Test method is called" { @@ -206,28 +206,28 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should create a new service application in the set method" { Set-TargetResource @testParams - Assert-MockCalled New-SPEnterpriseSearchCrawlRule + Assert-MockCalled New-SPEnterpriseSearchCrawlRule } } Context -Name "When service applications exist in the current farm but the specific search app does not" -Fixture { $testParams = @{ - Path = "http://www.contoso.com" - ServiceAppName = "Search Service Application" - RuleType = "InclusionRule" - CrawlConfigurationRules = "FollowLinksNoPageCrawl","CrawlComplexUrls", "CrawlAsHTTP" - AuthenticationType = "DefaultRuleAccess" - Ensure = "Present" + Path = "http://www.contoso.com" + ServiceAppName = "Search Service Application" + RuleType = "InclusionRule" + CrawlConfigurationRules = "FollowLinksNoPageCrawl", "CrawlComplexUrls", "CrawlAsHTTP" + AuthenticationType = "DefaultRuleAccess" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplication -MockWith { + Mock -CommandName Get-SPServiceApplication -MockWith { return @(@{ - TypeName = "Some other service app type" - }) + TypeName = "Some other service app type" + }) } It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return false when the Test method is called" { @@ -236,30 +236,30 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should create a new service application in the set method" { Set-TargetResource @testParams - Assert-MockCalled New-SPEnterpriseSearchCrawlRule + Assert-MockCalled New-SPEnterpriseSearchCrawlRule } } Context -Name "When a crawl rule exists and is configured correctly" -Fixture { $testParams = @{ - Path = "http://www.contoso.com" - ServiceAppName = "Search Service Application" - RuleType = "InclusionRule" - CrawlConfigurationRules = "FollowLinksNoPageCrawl","CrawlComplexUrls", "CrawlAsHTTP" - AuthenticationType = "DefaultRuleAccess" - Ensure = "Present" - } - + Path = "http://www.contoso.com" + ServiceAppName = "Search Service Application" + RuleType = "InclusionRule" + CrawlConfigurationRules = "FollowLinksNoPageCrawl", "CrawlComplexUrls", "CrawlAsHTTP" + AuthenticationType = "DefaultRuleAccess" + Ensure = "Present" + } + Mock -CommandName Get-SPEnterpriseSearchCrawlRule -MockWith { return @{ - Path = "http://www.contoso.com" - Type = "InclusionRule" - SuppressIndexing = $true - FollowComplexUrls = $true - CrawlAsHttp = $true + Path = "http://www.contoso.com" + Type = "InclusionRule" + SuppressIndexing = $true + FollowComplexUrls = $true + CrawlAsHttp = $true AuthenticationType = "DefaultRuleAccess" } } - + It "Should return present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" } @@ -271,20 +271,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a crawl rule exists, but isn't configured correctly" -Fixture { $testParams = @{ - Path = "http://www.contoso.com" - ServiceAppName = "Search Service Application" - RuleType = "InclusionRule" - CrawlConfigurationRules = "FollowLinksNoPageCrawl","CrawlComplexUrls", "CrawlAsHTTP" - AuthenticationType = "DefaultRuleAccess" - Ensure = "Present" + Path = "http://www.contoso.com" + ServiceAppName = "Search Service Application" + RuleType = "InclusionRule" + CrawlConfigurationRules = "FollowLinksNoPageCrawl", "CrawlComplexUrls", "CrawlAsHTTP" + AuthenticationType = "DefaultRuleAccess" + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchCrawlRule -MockWith { return @{ - Path = "http://www.contoso.com" - Type = "InclusionRule" - SuppressIndexing = $false - FollowComplexUrls = $true - CrawlAsHttp = $true + Path = "http://www.contoso.com" + Type = "InclusionRule" + SuppressIndexing = $false + FollowComplexUrls = $true + CrawlAsHttp = $true AuthenticationType = "DefaultRuleAccess" } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchCrawlerImpactRule.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchCrawlerImpactRule.Tests.ps1 index 006953a7d..c374900e6 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchCrawlerImpactRule.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchCrawlerImpactRule.Tests.ps1 @@ -1,18 +1,18 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSearchCrawlerImpactRule" + -DscResource "SPSearchCrawlerImpactRule" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -21,32 +21,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Initialize tests $getTypeFullName = "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - # Mocks for all contexts - Mock -CommandName Remove-SPEnterpriseSearchSiteHitRule -MockWith { } - Mock -CommandName New-SPEnterpriseSearchSiteHitRule -MockWith { } - - Mock -CommandName Get-SPServiceApplication -MockWith { + # Mocks for all contexts + Mock -CommandName Remove-SPEnterpriseSearchSiteHitRule -MockWith { } + Mock -CommandName New-SPEnterpriseSearchSiteHitRule -MockWith { } + + Mock -CommandName Get-SPServiceApplication -MockWith { return @( - New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru - } ` - -PassThru -Force) + New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name FullName ` + -Value $getTypeFullName ` + -PassThru + } ` + -PassThru -Force) } # Test contexts Context -Name "When crawler impact requestlimit rule should exist and doesn't exist" -Fixture { $testParams = @{ ServiceAppName = "Search Service Application" - Name = "http://site.sharepoint.com" - RequestLimit = 8 - Ensure = "Present" + Name = "http://site.sharepoint.com" + RequestLimit = 8 + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { @@ -55,12 +55,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } - Mock -CommandName Get-SPEnterpriseSearchSiteHitRule -MockWith { - return $null + Mock -CommandName Get-SPEnterpriseSearchSiteHitRule -MockWith { + return $null } - + It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return false when the Test method is called" { @@ -69,16 +69,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should create a new search site hit rule in the set method" { Set-TargetResource @testParams - Assert-MockCalled New-SPEnterpriseSearchSiteHitRule + Assert-MockCalled New-SPEnterpriseSearchSiteHitRule } } - + Context -Name "When crawler impact requestlimit rule should exist and does exist" -Fixture { $testParams = @{ ServiceAppName = "Search Service Application" - Name = "http://site.sharepoint.com" - RequestLimit = 8 - Ensure = "Present" + Name = "http://site.sharepoint.com" + RequestLimit = 8 + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { @@ -87,16 +87,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } - Mock -CommandName Get-SPEnterpriseSearchSiteHitRule -MockWith { + Mock -CommandName Get-SPEnterpriseSearchSiteHitRule -MockWith { return @{ - Name = $testParams.Name - HitRate = $testParams.RequestLimit + Name = $testParams.Name + HitRate = $testParams.RequestLimit Behavior = "0" } } - + It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Present" + (Get-TargetResource @testParams).Ensure | Should Be "Present" } It "Should return true when the Test method is called" { @@ -105,7 +105,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should update a new search Site hit rule in the set method" { Set-TargetResource @testParams - Assert-MockCalled Remove-SPEnterpriseSearchSiteHitRule + Assert-MockCalled Remove-SPEnterpriseSearchSiteHitRule Assert-MockCalled New-SPEnterpriseSearchSiteHitRule } } @@ -113,8 +113,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When crawler impact requestlimit rule shouldn't exist and doesn't exist" -Fixture { $testParams = @{ ServiceAppName = "Search Service Application" - Name = "http://site.sharepoint.com" - Ensure = "Absent" + Name = "http://site.sharepoint.com" + Ensure = "Absent" } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { @@ -123,15 +123,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } - Mock -CommandName Get-SPEnterpriseSearchSiteHitRule -MockWith { + Mock -CommandName Get-SPEnterpriseSearchSiteHitRule -MockWith { return @{ - Name = $testParams.Name + Name = $testParams.Name HitRate = $testParams.RequestLimit } } - + It "Should return present from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Present" + (Get-TargetResource @testParams).Ensure | Should Be "Present" } It "Should return false when the Test method is called" { @@ -140,16 +140,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should remove the search Site hit rule in the set method" { Set-TargetResource @testParams - Assert-MockCalled Remove-SPEnterpriseSearchSiteHitRule - + Assert-MockCalled Remove-SPEnterpriseSearchSiteHitRule + } } Context -Name "When crawler impact requestlimit rule shouldn't exist and does exist" -Fixture { $testParams = @{ ServiceAppName = "Search Service Application" - Name = "http://site.sharepoint.com" - Ensure = "Absent" + Name = "http://site.sharepoint.com" + Ensure = "Absent" } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { @@ -158,12 +158,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } - Mock -CommandName Get-SPEnterpriseSearchSiteHitRule -MockWith { + Mock -CommandName Get-SPEnterpriseSearchSiteHitRule -MockWith { return $null } - + It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return true when the Test method is called" { @@ -172,16 +172,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should remove the search Site hit rule in the set method" { Set-TargetResource @testParams - Assert-MockCalled Remove-SPEnterpriseSearchSiteHitRule - + Assert-MockCalled Remove-SPEnterpriseSearchSiteHitRule + } } Context -Name "When the Search Service does not exist" -Fixture { $testParams = @{ ServiceAppName = "Search Service Application" - Name = "http://site.sharepoint.com" - Ensure = "Absent" + Name = "http://site.sharepoint.com" + Ensure = "Absent" } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { @@ -190,7 +190,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return false when the Test method is called" { @@ -198,36 +198,36 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should throw a search service not found exception" { - { Set-TargetResource @testParams } | Should Throw "The Search Service Application does not exist." - - + { Set-TargetResource @testParams } | Should Throw "The Search Service Application does not exist." + + } } - Context -Name "When the both RequestLimit and WaitTime are specified" -Fixture { + Context -Name "When the both RequestLimit and WaitTime are specified" -Fixture { $testParams = @{ ServiceAppName = "Search Service Application" - Name = "http://site.sharepoint.com" - RequestLimit = 8 - WaitTime = 60 - Ensure = "Present" + Name = "http://site.sharepoint.com" + RequestLimit = 8 + WaitTime = 60 + Ensure = "Present" } It "Should throw an exception when called with both RequestLimit and WaitTime" { { Get-TargetResource @testParams } | Should Throw "Only one Crawler Impact Rule HitRate argument (RequestLimit, WaitTime) can be specified" - { Test-TargetResource @testParams } | Should Throw "Only one Crawler Impact Rule HitRate argument (RequestLimit, WaitTime) can be specified" + { Test-TargetResource @testParams } | Should Throw "Only one Crawler Impact Rule HitRate argument (RequestLimit, WaitTime) can be specified" { Set-TargetResource @testParams } | Should Throw "Only one Crawler Impact Rule HitRate argument (RequestLimit, WaitTime) can be specified" - + } } Context -Name "When crawler impact WaitTime rule should exist and doesn't exist" -Fixture { $testParams = @{ ServiceAppName = "Search Service Application" - Name = "http://site.sharepoint.com" - WaitTime = 300 - Ensure = "Present" + Name = "http://site.sharepoint.com" + WaitTime = 300 + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { @@ -236,12 +236,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } - Mock -CommandName Get-SPEnterpriseSearchSiteHitRule -MockWith { - return $null + Mock -CommandName Get-SPEnterpriseSearchSiteHitRule -MockWith { + return $null } - + It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return false when the Test method is called" { @@ -250,16 +250,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should create a new search site hit rule in the set method" { Set-TargetResource @testParams - Assert-MockCalled New-SPEnterpriseSearchSiteHitRule + Assert-MockCalled New-SPEnterpriseSearchSiteHitRule } } - + Context -Name "When crawler impact WaitTime rule should exist and does exist" -Fixture { $testParams = @{ ServiceAppName = "Search Service Application" - Name = "http://site.sharepoint.com" - WaitTime = 300 - Ensure = "Present" + Name = "http://site.sharepoint.com" + WaitTime = 300 + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { @@ -268,16 +268,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } - Mock -CommandName Get-SPEnterpriseSearchSiteHitRule -MockWith { + Mock -CommandName Get-SPEnterpriseSearchSiteHitRule -MockWith { return @{ - Name = $testParams.Name - HitRate = $testParams.WaitTime + Name = $testParams.Name + HitRate = $testParams.WaitTime Behavior = "1" } } - + It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Present" + (Get-TargetResource @testParams).Ensure | Should Be "Present" } It "Should return true when the Test method is called" { @@ -286,7 +286,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should update a new search Site hit rule in the set method" { Set-TargetResource @testParams - Assert-MockCalled Remove-SPEnterpriseSearchSiteHitRule + Assert-MockCalled Remove-SPEnterpriseSearchSiteHitRule Assert-MockCalled New-SPEnterpriseSearchSiteHitRule } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchFileType.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchFileType.Tests.ps1 index f150e77cc..200a949f2 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchFileType.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchFileType.Tests.ps1 @@ -1,18 +1,18 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSearchFileType" + -DscResource "SPSearchFileType" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -21,41 +21,41 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Initialize tests $getTypeFullName = "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - # Mocks for all contexts - Mock -CommandName Remove-SPEnterpriseSearchFileFormat -MockWith {} - Mock -CommandName New-SPEnterpriseSearchFileFormat -MockWith {} - Mock -CommandName Set-SPEnterpriseSearchFileFormatState -MockWith {} + # Mocks for all contexts + Mock -CommandName Remove-SPEnterpriseSearchFileFormat -MockWith { } + Mock -CommandName New-SPEnterpriseSearchFileFormat -MockWith { } + Mock -CommandName Set-SPEnterpriseSearchFileFormatState -MockWith { } - Mock -CommandName Get-SPServiceApplication -MockWith { + Mock -CommandName Get-SPServiceApplication -MockWith { return @( - New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru - } ` - -PassThru -Force) + New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name FullName ` + -Value $getTypeFullName ` + -PassThru + } ` + -PassThru -Force) } Context -Name "When no service applications exist in the current farm" -Fixture { $testParams = @{ - FileType = "abc" - Description = "ABC" - MimeType = "application/abc" + FileType = "abc" + Description = "ABC" + MimeType = "application/abc" ServiceAppName = "Search Service Application" - Ensure = "Present" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplication -MockWith { - return $null + Mock -CommandName Get-SPServiceApplication -MockWith { + return $null } - + It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return false when the Test method is called" { @@ -69,21 +69,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When service applications exist in the current farm but the specific search app does not" -Fixture { $testParams = @{ - FileType = "abc" - Description = "ABC" - MimeType = "application/abc" + FileType = "abc" + Description = "ABC" + MimeType = "application/abc" ServiceAppName = "Search Service Application" - Ensure = "Present" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplication -MockWith { + Mock -CommandName Get-SPServiceApplication -MockWith { return @(@{ - TypeName = "Some other service app type" - }) + TypeName = "Some other service app type" + }) } It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return false when the Test method is called" { @@ -97,9 +97,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When Ensure=Present, but Description and MimeType parameters are missing" -Fixture { $testParams = @{ - FileType = "abc" + FileType = "abc" ServiceAppName = "Search Service Application" - Ensure = "Present" + Ensure = "Present" } It "Should return absent from the Get method" { @@ -117,17 +117,17 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a file type does not exists, but should be" -Fixture { $testParams = @{ - FileType = "abc" - Description = "ABC" - MimeType = "application/abc" + FileType = "abc" + Description = "ABC" + MimeType = "application/abc" ServiceAppName = "Search Service Application" - Ensure = "Present" + Ensure = "Present" } - + Mock -CommandName Get-SPEnterpriseSearchFileFormat -MockWith { return $null } - + It "Should return absent from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" } @@ -144,20 +144,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a file type does not exists, but should be" -Fixture { $testParams = @{ - FileType = "abc" + FileType = "abc" ServiceAppName = "Search Service Application" - Ensure = "Absent" + Ensure = "Absent" } - + Mock -CommandName Get-SPEnterpriseSearchFileFormat -MockWith { - return @{ + return @{ Identity = $testParams.FileType - Name = "ABC" - MimeType = "application/abc" - Enabled = $true + Name = "ABC" + MimeType = "application/abc" + Enabled = $true } } - + It "Should return present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" } @@ -174,22 +174,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a file type exists, but with the incorrect settings" -Fixture { $testParams = @{ - FileType = "abc" + FileType = "abc" ServiceAppName = "Search Service Application" - Description = "XYZ" - MimeType = "application/xyz" - Ensure = "Present" + Description = "XYZ" + MimeType = "application/xyz" + Ensure = "Present" } - + Mock -CommandName Get-SPEnterpriseSearchFileFormat -MockWith { - return @{ + return @{ Identity = $testParams.FileType - Name = "ABC" - MimeType = "application/abc" - Enabled = $true + Name = "ABC" + MimeType = "application/abc" + Enabled = $true } } - + It "Should return present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" } @@ -207,23 +207,23 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a file type exists, but with the incorrect state" -Fixture { $testParams = @{ - FileType = "abc" + FileType = "abc" ServiceAppName = "Search Service Application" - Description = "ABC" - MimeType = "application/abc" - Enabled = $true - Ensure = "Present" + Description = "ABC" + MimeType = "application/abc" + Enabled = $true + Ensure = "Present" } - + Mock -CommandName Get-SPEnterpriseSearchFileFormat -MockWith { - return @{ + return @{ Identity = $testParams.FileType - Name = "ABC" - MimeType = "application/abc" - Enabled = $false + Name = "ABC" + MimeType = "application/abc" + Enabled = $false } } - + It "Should return present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" } @@ -240,22 +240,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a file type exists and is configured correctly" -Fixture { $testParams = @{ - FileType = "abc" + FileType = "abc" ServiceAppName = "Search Service Application" - Description = "ABC" - MimeType = "application/abc" - Ensure = "Present" + Description = "ABC" + MimeType = "application/abc" + Ensure = "Present" } - + Mock -CommandName Get-SPEnterpriseSearchFileFormat -MockWith { - return @{ + return @{ Identity = $testParams.FileType - Name = "ABC" - MimeType = "application/abc" - Enabled = $true + Name = "ABC" + MimeType = "application/abc" + Enabled = $true } } - + It "Should return present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchIndexPartition.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchIndexPartition.Tests.ps1 index 8ec912277..3a8e691ee 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchIndexPartition.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchIndexPartition.Tests.ps1 @@ -1,18 +1,18 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSearchIndexPartition" + -DscResource "SPSearchIndexPartition" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -20,10 +20,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Initialize tests Add-Type -TypeDefinition @" - public class IndexComponent - { - public string ServerName { get; set; } - public System.Guid ComponentId {get; set;} + public class IndexComponent + { + public string ServerName { get; set; } + public System.Guid ComponentId {get; set;} public System.Int32 IndexPartitionOrdinal {get; set;} } "@ @@ -31,26 +31,26 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $indexComponent.ServerName = $env:COMPUTERNAME $indexComponent.IndexPartitionOrdinal = 0 - # Mocks for all contexts + # Mocks for all contexts Mock -CommandName New-PSSession -MockWith { return $null } - Mock -CommandName New-Item -MockWith { - return @{} + Mock -CommandName New-Item -MockWith { + return @{ } } - Mock -CommandName Start-Sleep -MockWith {} + Mock -CommandName Start-Sleep -MockWith { } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { return @{ - ActiveTopology = @{} + ActiveTopology = @{ } } - } - Mock -CommandName New-SPEnterpriseSearchTopology -MockWith { - return @{} + } + Mock -CommandName New-SPEnterpriseSearchTopology -MockWith { + return @{ } } $Global:SPDscSearchRoleInstanceCallCount = 0 Mock -CommandName Get-SPEnterpriseSearchServiceInstance -MockWith { - if ($Global:SPDscSearchRoleInstanceCallCount -eq 2) + if ($Global:SPDscSearchRoleInstanceCallCount -eq 2) { $Global:SPDscSearchRoleInstanceCallCount = 0 return @{ @@ -59,8 +59,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Status = "Online" } - } - else + } + else { $Global:SPDscSearchRoleInstanceCallCount++ return @{ @@ -71,32 +71,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - Mock -CommandName Start-SPEnterpriseSearchServiceInstance -MockWith { - return $null + Mock -CommandName Start-SPEnterpriseSearchServiceInstance -MockWith { + return $null } - Mock -CommandName New-SPEnterpriseSearchIndexComponent -MockWith { - return $null + Mock -CommandName New-SPEnterpriseSearchIndexComponent -MockWith { + return $null } - Mock -CommandName Remove-SPEnterpriseSearchComponent -MockWith { - return $null + Mock -CommandName Remove-SPEnterpriseSearchComponent -MockWith { + return $null } - Mock -CommandName Set-SPEnterpriseSearchTopology -MockWith { - return $null + Mock -CommandName Set-SPEnterpriseSearchTopology -MockWith { + return $null } - # Test contexts + # Test contexts Context -Name "Search index doesn't exist and it should" { $testParams = @{ - Index = "0" - Servers = @($env:COMPUTERNAME) - RootDirectory = "C:\SearchIndex\0" + Index = "0" + Servers = @($env:COMPUTERNAME) + RootDirectory = "C:\SearchIndex\0" ServiceAppName = "Search Service Application" } - Mock -CommandName Get-SPEnterpriseSearchComponent { - return @() + Mock -CommandName Get-SPEnterpriseSearchComponent { + return @() } - + $Global:SPDscSearchRoleInstanceCallCount = 0 It "Should return an empty server list from the get method" { @@ -113,17 +113,17 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Assert-MockCalled New-SPEnterpriseSearchIndexComponent } } - + Context -Name "Search index does exist and it should" { $testParams = @{ - Index = "0" - Servers = @($env:COMPUTERNAME) - RootDirectory = "C:\SearchIndex\0" + Index = "0" + Servers = @($env:COMPUTERNAME) + RootDirectory = "C:\SearchIndex\0" ServiceAppName = "Search Service Application" } - - Mock -CommandName Get-SPEnterpriseSearchComponent -MockWith { - return @($indexComponent) + + Mock -CommandName Get-SPEnterpriseSearchComponent -MockWith { + return @($indexComponent) } It "Should return present from the get method" { @@ -138,14 +138,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Search index exists and it shouldn't" { $testParams = @{ - Index = "0" - Servers = @("SharePoint2") - RootDirectory = "C:\SearchIndex\0" + Index = "0" + Servers = @("SharePoint2") + RootDirectory = "C:\SearchIndex\0" ServiceAppName = "Search Service Application" } - - Mock -CommandName Get-SPEnterpriseSearchComponent -MockWith { - return @($indexComponent) + + Mock -CommandName Get-SPEnterpriseSearchComponent -MockWith { + return @($indexComponent) } It "Should return false from the test method" { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchManagedProperty.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchManagedProperty.Tests.ps1 index 14c18e13e..3bb3a1c00 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchManagedProperty.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchManagedProperty.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSearchManagedProperty" + -DscResource "SPSearchManagedProperty" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -22,8 +22,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Mocks for all contexts Mock -CommandName New-SPEnterpriseSearchMetadataManagedProperty -MockWith { $Script:PropertyCreated = $true } - Mock -CommandName Set-SPEnterpriseSearchMetadataManagedProperty -MockWith {} - Mock -CommandName Remove-SPEnterpriseSearchMetadataManagedProperty -MockWith {} + Mock -CommandName Set-SPEnterpriseSearchMetadataManagedProperty -MockWith { } + Mock -CommandName Remove-SPEnterpriseSearchMetadataManagedProperty -MockWith { } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { return @( @{ @@ -32,23 +32,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { ) } - try { [Microsoft.Office.Server.Search.Administration] } - catch { - try { + try + { [Microsoft.Office.Server.Search.Administration] + } + catch + { + try + { Add-Type -TypeDefinition @" namespace Microsoft.Office.Server.Search.Administration { public enum ManagedDataType { Text, YesNo, Integer, DateTime, Double }; } "@ -ErrorAction SilentlyContinue } - catch { + catch + { Write-Verbose "The Type Microsoft.Office.Server.Search.Administration.ManagedDataType was already added." } } - try { [Microsoft.Office.Server.Search.Administration.MappingCollection] } - catch { - try { + try + { [Microsoft.Office.Server.Search.Administration.MappingCollection] + } + catch + { + try + { Add-Type -TypeDefinition @" namespace Microsoft.Office.Server.Search.Administration { public class MappingCollection @@ -58,14 +67,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } "@ -ErrorAction SilentlyContinue } - catch { + catch + { Write-Verbose "The Type Microsoft.Office.Server.Search.Administration.MappingCollection was already added." } } - try { [Microsoft.Office.Server.Search.Administration.Mapping] } - catch { - try { + try + { [Microsoft.Office.Server.Search.Administration.Mapping] + } + catch + { + try + { Add-Type -TypeDefinition @" namespace Microsoft.Office.Server.Search.Administration { public class Mapping @@ -77,20 +91,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } "@ -ErrorAction SilentlyContinue } - catch { + catch + { Write-Verbose "The Type Microsoft.Office.Server.Search.Administration.Mapping was already added." } } Context -Name "When the property doesn't exist and should" -Fixture { $testParams = @{ - Name = "TestParam" - PropertyType = "Text" - ServiceAppName = "Search Service Application" + Name = "TestParam" + PropertyType = "Text" + ServiceAppName = "Search Service Application" HasMultipleValues = $false - Aliases = @("TestAlias") + Aliases = @("TestAlias") CrawledProperties = @("CP1", "CP2") - Ensure = "Present" + Ensure = "Present" } $Script:PropertyCreated = $false @@ -100,51 +115,51 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPEnterpriseSearchMetadataManagedProperty -MockWith { $results = @{ - Name = "TestParam" - PID = 1 - ManagedType = "Text" - Searchable = $true - Refinable = $true - Queryable = $true - Sortable = $true - NoWordBreaker = $true + Name = "TestParam" + PID = 1 + ManagedType = "Text" + Searchable = $true + Refinable = $true + Queryable = $true + Sortable = $true + NoWordBreaker = $true HasMultipleValues = $false } | Add-Member -MemberType ScriptMethod ` -Name GetAliases ` -Value { - @("Alias1", "Alias2") - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + @("Alias1", "Alias2") + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name GetMappedCrawledProperties ` -Value { - return @("Map1") - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + return @("Map1") + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name Update ` -Value { - $null - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + $null + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name AddAlias ` -Value { - $null - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + $null + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name SetMappings ` -Value { - $null - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + $null + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name DeleteAlias ` -Value { - $null - } -PassThru -Force + $null + } -PassThru -Force return $results } -ParameterFilter { $Script:PropertyCreated -eq $true } Mock -CommandName Get-SPEnterpriseSearchMetadataCrawledProperty -MockWith { - return @{CrawledPropertyName = 'FakeValue';} + return @{CrawledPropertyName = 'FakeValue'; } } It "Should return absent from the Get method" { @@ -163,54 +178,54 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the property already exists with the proper type and should" -Fixture { $testParams = @{ - Name = "TestParam" - PropertyType = "Text" + Name = "TestParam" + PropertyType = "Text" ServiceAppName = "Search Service Application" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchMetadataManagedProperty -MockWith { $results = @{ - Name = "TestParam" - PID = 1 - ManagedType = "Text" - Searchable = $true - Refinable = $true - Queryable = $true - Sortable = $true - NoWordBreaker = $true + Name = "TestParam" + PID = 1 + ManagedType = "Text" + Searchable = $true + Refinable = $true + Queryable = $true + Sortable = $true + NoWordBreaker = $true HasMultipleValues = $false - Ensure = "Present" + Ensure = "Present" } | Add-Member -MemberType ScriptMethod ` -Name GetAliases ` -Value { - $null - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + $null + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name GetMappedCrawledProperties ` -Value { - $null - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + $null + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name Update ` -Value { - $null - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + $null + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name AddAlias ` -Value { - $null - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + $null + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name SetMappings ` -Value { - $null - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + $null + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name DeleteAllMappings ` -Value { - $null - } -PassThru -Force + $null + } -PassThru -Force return $results } @@ -227,54 +242,54 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the property already exists, but with the invalid property type" -Fixture { $testParams = @{ - Name = "TestParam" - PropertyType = "Text" + Name = "TestParam" + PropertyType = "Text" ServiceAppName = "Search Service Application" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPEnterpriseSearchMetadataManagedProperty -MockWith { $results = @{ - Name = "TestParam" - PID = 1 - ManagedType = "Number" - Searchable = $true - Refinable = $true - Queryable = $true - Sortable = $true - NoWordBreaker = $true + Name = "TestParam" + PID = 1 + ManagedType = "Number" + Searchable = $true + Refinable = $true + Queryable = $true + Sortable = $true + NoWordBreaker = $true HasMultipleValues = $false - Ensure = "Present" + Ensure = "Present" } | Add-Member -MemberType ScriptMethod ` -Name GetAliases ` -Value { - $null - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + $null + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name GetMappedCrawledProperties ` -Value { - $null - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + $null + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name Update ` -Value { - $null - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + $null + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name AddAlias ` -Value { - $null - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + $null + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name SetMappings ` -Value { - $null - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + $null + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name DeleteAllMappings ` -Value { - $null - } -PassThru -Force + $null + } -PassThru -Force return $results } @@ -291,54 +306,54 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the property should not exist" -Fixture { $testParams = @{ - Name = "TestParam" - PropertyType = "Text" + Name = "TestParam" + PropertyType = "Text" ServiceAppName = "Search Service Application" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPEnterpriseSearchMetadataManagedProperty -MockWith { $results = @{ - Name = "TestParam" - PID = 1 - ManagedType = "Text" - Searchable = $true - Refinable = $true - Queryable = $true - Sortable = $true - NoWordBreaker = $true + Name = "TestParam" + PID = 1 + ManagedType = "Text" + Searchable = $true + Refinable = $true + Queryable = $true + Sortable = $true + NoWordBreaker = $true HasMultipleValues = $false - Ensure = "Present" + Ensure = "Present" } | Add-Member -MemberType ScriptMethod ` -Name GetAliases ` -Value { - $null - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + $null + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name GetMappedCrawledProperties ` -Value { - $null - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + $null + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name Update ` -Value { - $null - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + $null + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name AddAlias ` -Value { - $null - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + $null + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name SetMappings ` -Value { - $null - } -PassThru -Force | - Add-Member -MemberType ScriptMethod ` + $null + } -PassThru -Force | + Add-Member -MemberType ScriptMethod ` -Name DeleteAllMappings ` -Value { - $null - } -PassThru -Force + $null + } -PassThru -Force return $results } @@ -355,36 +370,36 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When specified Service Application does not exist" -Fixture { $testParams = @{ - Name = "TestParam" - PropertyType = "Text" + Name = "TestParam" + PropertyType = "Text" ServiceAppName = "InvalidSSA" - Ensure = "Absent" + Ensure = "Absent" } - Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith{ + Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { return $null } It "Should throw an error" { - { Get-TargetResource @testParams }| Should Throw "The specified Search Service Application InvalidSSA is ` + { Get-TargetResource @testParams } | Should Throw "The specified Search Service Application InvalidSSA is ` invalid. Please make sure you specify the name of an existing service application." } } Context -Name "When specified Service Application does not exist" -Fixture { $testParams = @{ - Name = "TestParam" - PropertyType = "Text" + Name = "TestParam" + PropertyType = "Text" ServiceAppName = "InvalidSSA" - Ensure = "Absent" + Ensure = "Absent" } - Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith{ + Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { return $null } It "Should throw an error" { - { Get-TargetResource @testParams }| Should Throw "The specified Search Service Application InvalidSSA is ` + { Get-TargetResource @testParams } | Should Throw "The specified Search Service Application InvalidSSA is ` invalid. Please make sure you specify the name of an existing service application." } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchMetadataCategory.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchMetadataCategory.Tests.ps1 index 8f5db8237..d27cf0a24 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchMetadataCategory.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchMetadataCategory.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSearchMetadataCategory" + -DscResource "SPSearchMetadataCategory" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -32,11 +32,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Set-SPEnterpriseSearchMetadataCategory { - return @{} + return @{ } } Mock -CommandName Remove-SPEnterpriseSearchMetadataCategory { - return @{} + return @{ } } # Test contexts @@ -46,12 +46,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $testParams = @{ - Name = "Test Category" - ServiceAppName = "Search Service Application" + Name = "Test Category" + ServiceAppName = "Search Service Application" AutoCreateNewManagedProperties = $true - DiscoverNewProperties = $true - MapToContents = $true - Ensure = "Present" + DiscoverNewProperties = $true + MapToContents = $true + Ensure = "Present" } It "Should return absent from the get method" { @@ -75,9 +75,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $testParams = @{ - Name = "Test Category" + Name = "Test Category" ServiceAppName = "Search Service Application" - Ensure = "Absent" + Ensure = "Absent" } It "Should return Present from the Get Method" { @@ -92,15 +92,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Trying to delete a non-empty metadata category" -Fixture { Mock -CommandName Get-SPEnterpriseSearchMetadataCategory { return @{ - Name = "Test Category" + Name = "Test Category" CrawledPropertyCount = 1 } } $testParams = @{ - Name = "Test Category" + Name = "Test Category" ServiceAppName = "Search Service Application" - Ensure = "Absent" + Ensure = "Absent" } It "Should throw an error from the Set Method" { @@ -110,9 +110,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "An invalid Search Service Aplication was specified" -Fixture { $testParams = @{ - Name = "Test Category" + Name = "Test Category" ServiceAppName = "Search Service Application" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPEnterpriseSearchServiceApplication { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchResultSource.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchResultSource.Tests.ps1 index 8b54bad38..a911c517c 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchResultSource.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchResultSource.Tests.ps1 @@ -3,23 +3,24 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSearchResultSource" + -DscResource "SPSearchResultSource" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope -try { - # Initialize tests - Add-Type -TypeDefinition @" + try + { + # Initialize tests + Add-Type -TypeDefinition @" namespace Microsoft.Office.Server.Search.Administration { public enum SearchObjectLevel { @@ -30,10 +31,11 @@ try { } } "@ -ErrorAction SilentlyContinue -} -catch { - Write-Verbose "Could not instantiante the enum Microsoft.Office.Server.Search.Administration.SearchObjectLevel" -} + } + catch + { + Write-Verbose "Could not instantiante the enum Microsoft.Office.Server.Search.Administration.SearchObjectLevel" + } # Mocks for all contexts Mock -CommandName Get-SPEnterpriseSearchServiceApplication { @@ -43,112 +45,117 @@ catch { } Mock -CommandName Get-SPWeb -MockWith { - return @{} + return @{ } } $Global:SPDscResultSourceProviders = @( @{ "Exchange Search Provider" = @{ - Id = "c1e2843d-1825-4a37-ad15-dce5d50f46d2" + Id = "c1e2843d-1825-4a37-ad15-dce5d50f46d2" Name = "Exchange Search Provider" } }, @{ "Local People Provider" = @{ - Id = "5acc53f4-64b1-4f5d-ad16-7e9ab7372f93" + Id = "5acc53f4-64b1-4f5d-ad16-7e9ab7372f93" Name = "Local People Provider" } }, @{ "Local SharePoint Provider" = @{ - Id = "2d443d0a-61ba-472d-9964-ef27b14c8a07" + Id = "2d443d0a-61ba-472d-9964-ef27b14c8a07" Name = "Local SharePoint Provider" } }, @{ "OpenSearch Provider" = @{ - Id = "eec636ac-013c-4dea-b794-dadcb4136dfe" + Id = "eec636ac-013c-4dea-b794-dadcb4136dfe" Name = "OpenSearch Provider" } }, @{ "Remote People Provider" = @{ - Id = "bb76bb0b-035d-4981-86ae-bd9587f3b0e4" + Id = "bb76bb0b-035d-4981-86ae-bd9587f3b0e4" Name = "Remote People Provider" } }, @{ "Remote SharePoint Provider" = @{ - Id = "f7a3db86-fb85-40e4-a178-7ad85c732ba6" + Id = "f7a3db86-fb85-40e4-a178-7ad85c732ba6" Name = "Remote SharePoint Provider" } } ) Mock -CommandName New-Object { - switch ($TypeName) { - "Microsoft.Office.Server.Search.Administration.SearchObjectOwner" { + switch ($TypeName) + { + "Microsoft.Office.Server.Search.Administration.SearchObjectOwner" + { return [System.Object]::new() } - "Microsoft.Office.Server.Search.Administration.Query.FederationManager" { + "Microsoft.Office.Server.Search.Administration.Query.FederationManager" + { return [System.Object]::new() | Add-Member -Name GetSourceByName ` - -MemberType ScriptMethod ` - -PassThru ` - -Value { - return $Global:SPDscCurrentResultSourceMocks - } ` - | Add-Member -Name ListProviders ` - -MemberType ScriptMethod ` - -PassThru ` - -Value { - return $Global:SPDscResultSourceProviders - } ` - | Add-Member -Name ListSources ` - -MemberType ScriptMethod ` - -PassThru ` - -Value { - return @( - @{ - Name = "Test source" - } - ) - } ` - | Add-Member -Name CreateSource ` - -MemberType ScriptMethod ` - -PassThru ` - -Value { - return [PSObject]@{ - ProviderId = [guid]::Empty - Name = [string]::Empty - ConnectionUrlTemplate = [string]::Empty - } | Add-Member -Name CreateQueryTransform ` - -MemberType ScriptMethod ` - -PassThru ` - -Value { } ` - | Add-Member -Name Commit ` - -MemberType ScriptMethod ` - -PassThru ` - -Value { - $Global:SPDscResultSourceUpdated = $true - } - } ` - | Add-Member -Name RemoveSource ` - -MemberType ScriptMethod ` - -PassThru ` - -Value { } ` + -MemberType ScriptMethod ` + -PassThru ` + -Value { + return $Global:SPDscCurrentResultSourceMocks + } ` + | Add-Member -Name ListProviders ` + -MemberType ScriptMethod ` + -PassThru ` + -Value { + return $Global:SPDscResultSourceProviders + } ` + | Add-Member -Name ListSources ` + -MemberType ScriptMethod ` + -PassThru ` + -Value { + return @( + @{ + Name = "Test source" + } + ) + } ` + | Add-Member -Name CreateSource ` + -MemberType ScriptMethod ` + -PassThru ` + -Value { + return [PSObject]@{ + ProviderId = [guid]::Empty + Name = [string]::Empty + ConnectionUrlTemplate = [string]::Empty + } | Add-Member -Name CreateQueryTransform ` + -MemberType ScriptMethod ` + -PassThru ` + -Value { } ` + | Add-Member -Name Commit ` + -MemberType ScriptMethod ` + -PassThru ` + -Value { + $Global:SPDscResultSourceUpdated = $true + } + } ` + | Add-Member -Name RemoveSource ` + -MemberType ScriptMethod ` + -PassThru ` + -Value { } ` + } - "Microsoft.Office.Server.Search.Administration.SearchObjectFilter" { + "Microsoft.Office.Server.Search.Administration.SearchObjectFilter" + { return [System.Object]::new() | Add-Member -Name IncludeHigherLevel ` -MemberType ScriptProperty ` -PassThru ` - { - # get - "getter" - }` - { - # set - param ( $arg ) - } + { + # get + "getter" + }` + { + # set + param ( $arg ) + } } } } @@ -156,14 +163,14 @@ catch { # Test contexts Context -Name "A search result source doesn't exist and should" -Fixture { $testParams = @{ - Name = "New source" - ScopeName = "SSA" - ScopeUrl = "Global" + Name = "New source" + ScopeName = "SSA" + ScopeUrl = "Global" SearchServiceAppName = "Search Service Application" - ProviderType = "Remote SharePoint Provider" - Query = "{searchTerms}" - ConnectionUrl = "https://sharepoint.contoso.com" - Ensure = "Present" + ProviderType = "Remote SharePoint Provider" + Query = "{searchTerms}" + ConnectionUrl = "https://sharepoint.contoso.com" + Ensure = "Present" } $Global:SPDscCurrentResultSourceMocks = $null @@ -183,22 +190,22 @@ catch { Context -Name "A search result source exists and should" -Fixture { $testParams = @{ - Name = "Test source" - ScopeName = "SSA" - ScopeUrl = "https://sharepoint.contoso.com" + Name = "Test source" + ScopeName = "SSA" + ScopeUrl = "https://sharepoint.contoso.com" SearchServiceAppName = "Search Service Application" - ProviderType = "Remote SharePoint Provider" - Query = "{searchTerms}" - ConnectionUrl = "https://sharepoint.contoso.com" - Ensure = "Present" + ProviderType = "Remote SharePoint Provider" + Query = "{searchTerms}" + ConnectionUrl = "https://sharepoint.contoso.com" + Ensure = "Present" } $Global:SPDscCurrentResultSourceMocks = @{ - Name = $testParams.Name + Name = $testParams.Name QueryTransform = @{ QueryTemplate = $testParams.Query } - ProviderId = "f7a3db86-fb85-40e4-a178-7ad85c732ba6" + ProviderId = "f7a3db86-fb85-40e4-a178-7ad85c732ba6" } It "Should return present from the get method" { @@ -212,22 +219,22 @@ catch { Context -Name "A search result source exists and shouldn't" -Fixture { $testParams = @{ - Name = "Test source" - ScopeUrl = "Global" + Name = "Test source" + ScopeUrl = "Global" SearchServiceAppName = "Search Service Application" - ProviderType = "Remote SharePoint Provider" - Query = "{searchTerms}" - ScopeName = "SSA" - ConnectionUrl = "https://sharepoint.contoso.com" - Ensure = "Absent" + ProviderType = "Remote SharePoint Provider" + Query = "{searchTerms}" + ScopeName = "SSA" + ConnectionUrl = "https://sharepoint.contoso.com" + Ensure = "Absent" } $Global:SPDscCurrentResultSourceMocks = @{ - Name = $testParams.Name + Name = $testParams.Name QueryTransform = @{ QueryTemplate = $testParams.Query } - ProviderId = "f7a3db86-fb85-40e4-a178-7ad85c732ba6" + ProviderId = "f7a3db86-fb85-40e4-a178-7ad85c732ba6" } It "Should return present from the get method" { @@ -245,14 +252,14 @@ catch { Context -Name "A search result source doesn't exist and shouldn't" -Fixture { $testParams = @{ - Name = "Non-Existing source" - ScopeName = "SSA" - ScopeUrl = "Global" + Name = "Non-Existing source" + ScopeName = "SSA" + ScopeUrl = "Global" SearchServiceAppName = "Search Service Application" - ProviderType = "Remote SharePoint Provider" - Query = "{searchTerms}" - ConnectionUrl = "https://sharepoint.contoso.com" - Ensure = "Absent" + ProviderType = "Remote SharePoint Provider" + Query = "{searchTerms}" + ConnectionUrl = "https://sharepoint.contoso.com" + Ensure = "Absent" } $Global:SPDscCurrentResultSourceMocks = $null @@ -268,14 +275,14 @@ catch { Context -Name "Valid SPWeb ScopeName was provided" -Fixture { $testParams = @{ - Name = "New source" - ScopeName = "SPWeb" - ScopeUrl = "https://SharePoint.contoso.com" + Name = "New source" + ScopeName = "SPWeb" + ScopeUrl = "https://SharePoint.contoso.com" SearchServiceAppName = "Search Service Application" - ProviderType = "Remote SharePoint Provider" - Query = "{searchTerms}" - ConnectionUrl = "https://sharepoint.contoso.com" - Ensure = "Present" + ProviderType = "Remote SharePoint Provider" + Query = "{searchTerms}" + ConnectionUrl = "https://sharepoint.contoso.com" + Ensure = "Present" } It "Should return absent from the get method" { @@ -293,14 +300,14 @@ catch { Context -Name "Local Result Source" -Fixture { $testParams = @{ - Name = "Test source Local" + Name = "Test source Local" SearchServiceAppName = "Search Service Application" - ProviderType = "Remote SharePoint Provider" - Query = "{searchTerms}" - ConnectionUrl = "https://sharepoint.contoso.com" - ScopeName = "SSA" - ScopeUrl = "Global" - Ensure = "Present" + ProviderType = "Remote SharePoint Provider" + Query = "{searchTerms}" + ConnectionUrl = "https://sharepoint.contoso.com" + ScopeName = "SSA" + ScopeUrl = "Global" + Ensure = "Present" } It "Should return absent from the get method" { @@ -318,14 +325,14 @@ catch { Context -Name "The specified ProviderType doesn't exist" -Fixture { $testParams = @{ - Name = "New source" - ScopeName = "SSA" - ScopeUrl = "Global" + Name = "New source" + ScopeName = "SSA" + ScopeUrl = "Global" SearchServiceAppName = "Search Service Application" - ProviderType = "DoesNotExist" - Query = "{searchTerms}" - ConnectionUrl = "https://sharepoint.contoso.com" - Ensure = "Present" + ProviderType = "DoesNotExist" + Query = "{searchTerms}" + ConnectionUrl = "https://sharepoint.contoso.com" + Ensure = "Present" } $Global:SPDscCurrentResultSourceMocks = $null diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchServiceApp.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchServiceApp.Tests.ps1 index e8c34760f..a46132a38 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchServiceApp.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchServiceApp.Tests.ps1 @@ -4,16 +4,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSearchServiceApp" + -DscResource "SPSearchServiceApp" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -34,22 +34,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force $mockCredential = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList @("DOMAIN\username", $mockPassword) + -ArgumentList @("DOMAIN\username", $mockPassword) # Mocks for all contexts - Mock -CommandName Start-SPEnterpriseSearchServiceInstance -MockWith {} - Mock -CommandName Remove-SPServiceApplication -MockWith {} - Mock -CommandName New-SPEnterpriseSearchServiceApplicationProxy -MockWith {} - Mock -CommandName Set-SPEnterpriseSearchServiceApplication -MockWith {} + Mock -CommandName Start-SPEnterpriseSearchServiceInstance -MockWith { } + Mock -CommandName Remove-SPServiceApplication -MockWith { } + Mock -CommandName New-SPEnterpriseSearchServiceApplicationProxy -MockWith { } + Mock -CommandName Set-SPEnterpriseSearchServiceApplication -MockWith { } Mock -CommandName New-SPBusinessDataCatalogServiceApplication -MockWith { } Mock -CommandName Set-SPEnterpriseSearchServiceApplication -MockWith { } - Mock -CommandName Set-SPEnterpriseSearchService -MockWith {} + Mock -CommandName Set-SPEnterpriseSearchService -MockWith { } Mock -CommandName Get-SPEnterpriseSearchServiceInstance -MockWith { - return @{} + return @{ } } Mock -CommandName New-SPEnterpriseSearchServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPServiceApplicationPool -MockWith { return @{ @@ -69,14 +69,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } - Mock Import-Module -MockWith {} -ParameterFilter { $_.Name -eq $ModuleName } + Mock Import-Module -MockWith { } -ParameterFilter { $_.Name -eq $ModuleName } # Test contexts Context -Name "When no service applications exist in the current farm" -Fixture { $testParams = @{ - Name = "Search Service Application" - ApplicationPool = "SharePoint Search Services" - Ensure = "Present" + Name = "Search Service Application" + ApplicationPool = "SharePoint Search Services" + Ensure = "Present" WindowsServiceAccount = $mockCredential } @@ -91,10 +91,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When no service applications exist in the current farm" -Fixture { $testParams = @{ - Name = "Search Service Application" - ApplicationPool = "SharePoint Search Services" - AlertsEnabled = $true - Ensure = "Present" + Name = "Search Service Application" + ApplicationPool = "SharePoint Search Services" + AlertsEnabled = $true + Ensure = "Present" WindowsServiceAccount = $mockCredential } @@ -108,12 +108,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { else { $spServiceApp = [PSCustomObject]@{ - TypeName = "Search Service Application" - DisplayName = $testParams.Name + TypeName = "Search Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } - AlertsEnabled = $false - Database = @{ - Name = $testParams.DatabaseName + AlertsEnabled = $false + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -147,22 +147,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When service applications exist in the current farm but the specific search app does not" -Fixture { $testParams = @{ - Name = "Search Service Application" + Name = "Search Service Application" ApplicationPool = "SharePoint Search Services" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - } + DisplayName = $testParams.Name + } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "Microsoft.Office.UnKnownWebServiceApplication" - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + FullName = "Microsoft.Office.UnKnownWebServiceApplication" + } + } -PassThru -Force return $spServiceApp } @@ -182,18 +182,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and is configured correctly" -Fixture { $testParams = @{ - Name = "Search Service Application" + Name = "Search Service Application" ApplicationPool = "SharePoint Search Services" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Search Service Application" - DisplayName = $testParams.Name + TypeName = "Search Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -215,18 +215,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and the app pool is not configured correctly" -Fixture { $testParams = @{ - Name = "Search Service Application" + Name = "Search Service Application" ApplicationPool = "SharePoint Search Services" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Search Service Application" - DisplayName = $testParams.Name + TypeName = "Search Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = "Wrong App Pool Name" } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -265,19 +265,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and the Proxy Name is not configured correctly" -Fixture { $testParams = @{ - Name = "Search Service Application" - ProxyName = "Search SA Proxy" + Name = "Search Service Application" + ProxyName = "Search SA Proxy" ApplicationPool = "SharePoint Search Services" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Search Service Application" - DisplayName = $testParams.Name + TypeName = "Search Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -297,7 +297,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-SPServiceApplicationProxy -MockWith { - $returnval = @{ + $returnval = @{ Name = "$($testParams.Name) Proxy" } $returnval = $returnval | Add-Member -MemberType ScriptMethod -Name Update -Value { @@ -319,19 +319,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists, but the Proxy doesn't" -Fixture { $testParams = @{ - Name = "Search Service Application" - ProxyName = "Search SA Proxy" + Name = "Search Service Application" + ProxyName = "Search SA Proxy" ApplicationPool = "SharePoint Search Services" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Search Service Application" - DisplayName = $testParams.Name + TypeName = "Search Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -366,19 +366,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the default content access account does not match" -Fixture { $testParams = @{ - Name = "Search Service Application" - ApplicationPool = "SharePoint Search Services" - Ensure = "Present" + Name = "Search Service Application" + ApplicationPool = "SharePoint Search Services" + Ensure = "Present" DefaultContentAccessAccount = $mockCredential } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Search Service Application" - DisplayName = $testParams.Name + TypeName = "Search Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -419,21 +419,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the default content access account does match" -Fixture { $testParams = @{ - Name = "Search Service Application" - ApplicationPool = "SharePoint Search Services" - Ensure = "Present" + Name = "Search Service Application" + ApplicationPool = "SharePoint Search Services" + Ensure = "Present" DefaultContentAccessAccount = $mockCredential } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Search Service Application" - DisplayName = $testParams.Name + TypeName = "Search Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -458,9 +458,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the search center URL does not match" -Fixture { $testParams = @{ - Name = "Search Service Application" + Name = "Search Service Application" ApplicationPool = "SharePoint Search Services" - Ensure = "Present" + Ensure = "Present" SearchCenterUrl = "http://search.sp.contoso.com" } @@ -468,12 +468,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Search Service Application" - DisplayName = $testParams.Name + TypeName = "Search Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } SearchCenterUrl = "http://wrong.url.here" - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -521,22 +521,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When AlertsEnabled does not match" -Fixture { $testParams = @{ - Name = "Search Service Application" + Name = "Search Service Application" ApplicationPool = "SharePoint Search Services" - Ensure = "Present" - AlertsEnabled = $true + Ensure = "Present" + AlertsEnabled = $true } $Global:SPDscAlertsEnabledUpdated = $false Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Search Service Application" - DisplayName = $testParams.Name + TypeName = "Search Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } - AlertsEnabled = $false - Database = @{ - Name = $testParams.DatabaseName + AlertsEnabled = $false + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -584,9 +584,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the search center URL does match" -Fixture { $testParams = @{ - Name = "Search Service Application" + Name = "Search Service Application" ApplicationPool = "SharePoint Search Services" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplicationPool -MockWith { @@ -597,12 +597,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Search Service Application" - DisplayName = $testParams.Name + TypeName = "Search Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } SearchCenterUrl = "http://search.sp.contoso.com" - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -627,20 +627,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service app exists but it shouldn't" -Fixture { $testParams = @{ - Name = "Search Service Application" + Name = "Search Service Application" ApplicationPool = "SharePoint Search Services" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Search Service Application" - DisplayName = $testParams.Name + TypeName = "Search Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -666,9 +666,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service app doesn't exist and shouldn't" -Fixture { $testParams = @{ - Name = "Search Service Application" + Name = "Search Service Application" ApplicationPool = "SharePoint Search Services" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication -MockWith { @@ -686,20 +686,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service app exists and is cloud enabled" -Fixture { $testParams = @{ - Name = "Search Service Application" + Name = "Search Service Application" ApplicationPool = "SharePoint Search Services" - Ensure = "Present" - CloudIndex = $true + Ensure = "Present" + CloudIndex = $true } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Search Service Application" - DisplayName = $testParams.Name + TypeName = "Search Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } - CloudIndex = $true - Database = @{ - Name = $testParams.DatabaseName + CloudIndex = $true + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } @@ -734,10 +734,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service doesn't exist and it should be cloud enabled" -Fixture { $testParams = @{ - Name = "Search Service Application" + Name = "Search Service Application" ApplicationPool = "SharePoint Search Services" - Ensure = "Present" - CloudIndex = $true + Ensure = "Present" + CloudIndex = $true } Mock -CommandName Get-SPServiceApplication -MockWith { @@ -769,19 +769,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context "A service app exists that has a correct windows service account in use" -Fixture { $testParams = @{ - Name = "Search Service Application" - ApplicationPool = "SharePoint Search Services" - Ensure = "Present" + Name = "Search Service Application" + ApplicationPool = "SharePoint Search Services" + Ensure = "Present" WindowsServiceAccount = $mockCredential } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Search Service Application" - DisplayName = $testParams.Name + TypeName = "Search Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName + Database = @{ + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchServiceSettings.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchServiceSettings.Tests.ps1 index 98be4342b..ef8a1c9f8 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchServiceSettings.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchServiceSettings.Tests.ps1 @@ -4,16 +4,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSearchServiceSettings" + -DscResource "SPSearchServiceSettings" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -22,7 +22,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Initialize tests $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force $mockCredential = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList @("DOMAIN\username", $mockPassword) + -ArgumentList @("DOMAIN\username", $mockPassword) # Mocks for all contexts @@ -57,7 +57,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "No optional parameters are specified" -Fixture { $testParams = @{ - IsSingleInstance = "Yes" + IsSingleInstance = "Yes" } It "Should return null from the get method" { @@ -120,7 +120,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } - Mock -CommandName Set-SPEnterpriseSearchService -MockWith {} + Mock -CommandName Set-SPEnterpriseSearchService -MockWith { } It "Should return the configured values from the Get method" { $result = Get-TargetResource @testParams @@ -153,7 +153,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } - Mock -CommandName Set-SPEnterpriseSearchService -MockWith {} + Mock -CommandName Set-SPEnterpriseSearchService -MockWith { } It "Should return the configured values from the Get method" { $result = Get-TargetResource @testParams @@ -186,7 +186,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } - Mock -CommandName Set-SPEnterpriseSearchService -MockWith {} + Mock -CommandName Set-SPEnterpriseSearchService -MockWith { } It "Should return the configured values from the Get method" { $result = Get-TargetResource @testParams diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchTopology.Mocks.cs b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchTopology.Mocks.cs index 1afddc4a0..2e4e9f00c 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchTopology.Mocks.cs +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchTopology.Mocks.cs @@ -1,45 +1,45 @@ -namespace Microsoft.Office.Server.Search.Administration.Topology -{ - public class AdminComponent - { - public string ServerName { get; set; } - public System.Guid ComponentId { get; set; } +namespace Microsoft.Office.Server.Search.Administration.Topology +{ + public class AdminComponent + { + public string ServerName { get; set; } + public System.Guid ComponentId { get; set; } public System.Guid ServerId { get; set; } } - public class CrawlComponent - { - public string ServerName { get; set; } - public System.Guid ComponentId { get; set; } + public class CrawlComponent + { + public string ServerName { get; set; } + public System.Guid ComponentId { get; set; } public System.Guid ServerId {get; set;} } - public class ContentProcessingComponent - { - public string ServerName { get; set; } - public System.Guid ComponentId { get; set; } + public class ContentProcessingComponent + { + public string ServerName { get; set; } + public System.Guid ComponentId { get; set; } public System.Guid ServerId {get; set;} } - public class AnalyticsProcessingComponent - { - public string ServerName { get; set; } - public System.Guid ComponentId { get; set; } + public class AnalyticsProcessingComponent + { + public string ServerName { get; set; } + public System.Guid ComponentId { get; set; } public System.Guid ServerId {get; set;} } - public class QueryProcessingComponent - { - public string ServerName { get; set; } - public System.Guid ComponentId { get; set; } + public class QueryProcessingComponent + { + public string ServerName { get; set; } + public System.Guid ComponentId { get; set; } public System.Guid ServerId {get; set;} } - public class IndexComponent - { - public string ServerName { get; set; } - public System.Guid ComponentId { get; set; } - public System.Int32 IndexPartitionOrdinal { get; set; } + public class IndexComponent + { + public string ServerName { get; set; } + public System.Guid ComponentId { get; set; } + public System.Int32 IndexPartitionOrdinal { get; set; } public System.Guid ServerId { get; set; } } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchTopology.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchTopology.Tests.ps1 index 417bdb20c..9075b1571 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchTopology.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSearchTopology.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSearchTopology" + -DscResource "SPSearchTopology" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -20,7 +20,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Initialize tests $mockPath = Join-Path -Path $Global:SPDscHelper.RepoRoot ` - -ChildPath "Tests/Unit/SharePointDsc/SharePointDsc.SPSearchTopology.Mocks.cs" + -ChildPath "Tests/Unit/SharePointDsc/SharePointDsc.SPSearchTopology.Mocks.cs" Add-Type -LiteralPath $mockPath $serverId = New-Guid @@ -56,11 +56,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $indexComponent.IndexPartitionOrdinal = 0 # Mocks for all contexts - Mock -CommandName Start-Sleep -MockWith {} - Mock -CommandName New-Item -MockWith { return @{} } - Mock -CommandName Get-SPEnterpriseSearchServiceInstance -MockWith { + Mock -CommandName Start-Sleep -MockWith { } + Mock -CommandName New-Item -MockWith { return @{ } } + Mock -CommandName Get-SPEnterpriseSearchServiceInstance -MockWith { return @{ - Server = @{ + Server = @{ Address = $env:COMPUTERNAME } Components = @( @@ -71,40 +71,40 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { IndexLocation = @("C:\Program Files\Fake3") } ) - Status = "Online" + Status = "Online" } } Mock -CommandName Get-SPEnterpriseSearchServiceApplication -MockWith { return @{ - ActiveTopology = @{} + ActiveTopology = @{ } } } Mock -CommandName Start-SPEnterpriseSearchServiceInstance -MockWith { return $null } Mock -CommandName New-SPEnterpriseSearchTopology -MockWith { - return @{} + return @{ } } Mock -CommandName New-SPEnterpriseSearchAdminComponent -MockWith { - return @{} + return @{ } } Mock -CommandName New-SPEnterpriseSearchCrawlComponent -MockWith { - return @{} + return @{ } } Mock -CommandName New-SPEnterpriseSearchContentProcessingComponent -MockWith { - return @{} + return @{ } } Mock -CommandName New-SPEnterpriseSearchAnalyticsProcessingComponent -MockWith { - return @{} + return @{ } } Mock -CommandName New-SPEnterpriseSearchQueryProcessingComponent -MockWith { - return @{} + return @{ } } Mock -CommandName New-SPEnterpriseSearchIndexComponent -MockWith { - return @{} + return @{ } } Mock -CommandName Set-SPEnterpriseSearchTopology -MockWith { - return @{} + return @{ } } Mock -CommandName Remove-SPEnterpriseSearchComponent -MockWith { return $null @@ -113,7 +113,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @( @{ Name = $env:COMPUTERNAME - Id = $serverId + Id = $serverId } ) } @@ -132,7 +132,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-SPEnterpriseSearchComponent -MockWith { - return @{} + return @{ } } It "Should return empty values from the get method" { @@ -166,10 +166,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-SPEnterpriseSearchComponent -MockWith { - return @{} + return @{ } } - Mock -CommandName Get-SPEnterpriseSearchServiceInstance -MockWith { + Mock -CommandName Get-SPEnterpriseSearchServiceInstance -MockWith { return @{ Server = @{ Address = "$($env:COMPUTERNAME).domain.com" @@ -184,7 +184,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } - Mock -CommandName Get-SPEnterpriseSearchServiceInstance -MockWith { + Mock -CommandName Get-SPEnterpriseSearchServiceInstance -MockWith { return $null } -ParameterFilter { $Identity -ne "$($env:COMPUTERNAME).domain.com" } @@ -219,16 +219,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-SPEnterpriseSearchComponent -MockWith { - return @{} + return @{ } } $Global:SPDscSearchRoleInstanceCalLCount = 0 Mock -CommandName Get-SPEnterpriseSearchServiceInstance -MockWith { - if ($Global:SPDscSearchRoleInstanceCalLCount -eq 2) { + if ($Global:SPDscSearchRoleInstanceCalLCount -eq 2) + { $Global:SPDscSearchRoleInstanceCalLCount = 0 return @{ Status = "Online" } - } else { + } + else + { $Global:SPDscSearchRoleInstanceCalLCount++ return @{ Status = "Offline" @@ -371,15 +374,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $indexComponent) } - Mock -CommandName Get-SPEnterpriseSearchServiceInstance { + Mock -CommandName Get-SPEnterpriseSearchServiceInstance { return @{ - Server = @{ + Server = @{ Address = $env:COMPUTERNAME } Components = @{ IndexLocation = "D:\Index" } - Status = "Online" + Status = "Online" } } @@ -409,7 +412,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return $null } Mock -CommandName Get-SPEnterpriseSearchComponent -MockWith { - return @{} + return @{ } } It "Should return empty values from the get method" { @@ -457,7 +460,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $indexComponent.ServerId = $newServerId $indexComponent.IndexPartitionOrdinal = 0 - $testParams = @{ + $testParams = @{ ServiceAppName = "Search Service Application" Admin = @($env:COMPUTERNAME) Crawler = @($env:COMPUTERNAME) @@ -478,7 +481,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $indexComponent) } - Mock -CommandName Get-SPEnterpriseSearchServiceInstance { + Mock -CommandName Get-SPEnterpriseSearchServiceInstance { return @{ Server = @{ Address = $env:COMPUTERNAME diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSecureStoreServiceApp.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSecureStoreServiceApp.Tests.ps1 index a88c90722..bb232a04b 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSecureStoreServiceApp.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSecureStoreServiceApp.Tests.ps1 @@ -2,18 +2,18 @@ [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSecureStoreServiceApp" + -DscResource "SPSecureStoreServiceApp" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -23,10 +23,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $getTypeFullName = "Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplication" $mockPassword = ConvertTo-SecureString -String "passwprd" -AsPlainText -Force $mockCredential = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList @("SqlUser", $mockPassword) + -ArgumentList @("SqlUser", $mockPassword) - # Mocks for all contexts - Mock -CommandName Remove-SPServiceApplication -MockWith {} + # Mocks for all contexts + Mock -CommandName Remove-SPServiceApplication -MockWith { } Mock -CommandName New-SPSecureStoreServiceApplication -MockWith { } Mock -CommandName New-SPSecureStoreServiceApplicationProxy -MockWith { } Mock -CommandName Set-SPSecureStoreServiceApplication -MockWith { } @@ -34,18 +34,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Test contexts Context -Name "When no service application exists in the current farm" -Fixture { $testParams = @{ - Name = "Secure Store Service Application" + Name = "Secure Store Service Application" ApplicationPool = "SharePoint Search Services" AuditingEnabled = $false - Ensure = "Present" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplication -MockWith { - return $null + Mock -CommandName Get-SPServiceApplication -MockWith { + return $null } It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return false when the Test method is called" { @@ -54,40 +54,40 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should create a new service application in the set method" { Set-TargetResource @testParams - Assert-MockCalled New-SPSecureStoreServiceApplication + Assert-MockCalled New-SPSecureStoreServiceApplication } $testParams.Add("DatabaseName", "SP_SecureStore") It "Should create a new service application in the set method where parameters beyond the minimum required set" { Set-TargetResource @testParams - Assert-MockCalled New-SPSecureStoreServiceApplication + Assert-MockCalled New-SPSecureStoreServiceApplication } } Context -Name "When service applications exist in the current farm but the specific search app does not" -Fixture { $testParams = @{ - Name = "Secure Store Service Application" + Name = "Secure Store Service Application" ApplicationPool = "SharePoint Search Services" AuditingEnabled = $false - Ensure = "Present" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - } + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + DisplayName = $testParams.Name + } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "Microsoft.Office.UnKnownWebServiceApplication" - } - } -PassThru -Force - return $spServiceApp - } - + -Name GetType ` + -Value { + return @{ + FullName = "Microsoft.Office.UnKnownWebServiceApplication" + } + } -PassThru -Force + return $spServiceApp + } + It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return false when the Test method is called" { @@ -97,74 +97,74 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and is configured correctly" -Fixture { $testParams = @{ - Name = "Secure Store Service Application" + Name = "Secure Store Service Application" ApplicationPool = "SharePoint Search Services" AuditingEnabled = $false - Ensure = "Present" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplication -MockWith { + Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Secure Store Service Application" - DisplayName = $testParams.Name - ApplicationPool = @{ - Name = $testParams.ApplicationPool + TypeName = "Secure Store Service Application" + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetProperties ` - -Value { - param($x) - return @( - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "Database" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return (@{ - FullName = $getTypeFullName - Name = "Database" - NormalizedDataSource = "DBServer" - Server = @{ - Name = "DBServer" - } - FailoverServer = @{ - Name = "DBServer_Failover" - } - }) - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "AuditEnabled" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return $params.AuditEnabled - } -PassThru - ) - ) - } -PassThru + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name FullName ` + -Value $getTypeFullName ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetProperties ` + -Value { + param($x) + return @( + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "Database" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return (@{ + FullName = $getTypeFullName + Name = "Database" + NormalizedDataSource = "DBServer" + Server = @{ + Name = "DBServer" + } + FailoverServer = @{ + Name = "DBServer_Failover" + } + }) + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "AuditEnabled" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return $params.AuditEnabled + } -PassThru + ) + ) + } -PassThru } -PassThru -Force - + return $spServiceApp } It "Should return present from the get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Present" + (Get-TargetResource @testParams).Ensure | Should Be "Present" } It "Should return true when the Test method is called" { @@ -174,76 +174,76 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and the app pool is not configured correctly" -Fixture { $testParams = @{ - Name = "Secure Store Service Application" + Name = "Secure Store Service Application" ApplicationPool = "SharePoint Search Services" AuditingEnabled = $false - Ensure = "Present" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplication -MockWith { + Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Secure Store Service Application" - DisplayName = $testParams.Name - ApplicationPool = @{ + TypeName = "Secure Store Service Application" + DisplayName = $testParams.Name + ApplicationPool = @{ Name = "Wrong App Pool Name" } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetProperties ` - -Value { - param($x) - return @( - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "Database" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return (@{ - FullName = $getTypeFullName - Name = "Database" - NormalizedDataSource = "DBServer" - Server = @{ - Name = "DBServer" - } - FailoverServer = @{ - Name = "DBServer_Failover" - } - }) - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "AuditEnabled" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return $params.AuditEnabled - } -PassThru - ) - ) - } -PassThru + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name FullName ` + -Value $getTypeFullName ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetProperties ` + -Value { + param($x) + return @( + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "Database" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return (@{ + FullName = $getTypeFullName + Name = "Database" + NormalizedDataSource = "DBServer" + Server = @{ + Name = "DBServer" + } + FailoverServer = @{ + Name = "DBServer_Failover" + } + }) + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "AuditEnabled" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return $params.AuditEnabled + } -PassThru + ) + ) + } -PassThru } -PassThru -Force - + return $spServiceApp } - - Mock -CommandName Get-SPServiceApplicationPool -MockWith { - return @{ - Name = $testParams.ApplicationPool - } + + Mock -CommandName Get-SPServiceApplicationPool -MockWith { + return @{ + Name = $testParams.ApplicationPool + } } It "Should return false when the Test method is called" { @@ -260,22 +260,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When specific windows credentials are to be used for the database" -Fixture { $testParams = @{ - Name = "Secure Store Service Application" - ApplicationPool = "SharePoint Search Services" - AuditingEnabled = $false - DatabaseName = "SP_ManagedMetadata" - DatabaseCredentials = $mockCredential + Name = "Secure Store Service Application" + ApplicationPool = "SharePoint Search Services" + AuditingEnabled = $false + DatabaseName = "SP_ManagedMetadata" + DatabaseCredentials = $mockCredential DatabaseAuthenticationType = "Windows" - Ensure = "Present" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplication -MockWith { - return $null + Mock -CommandName Get-SPServiceApplication -MockWith { + return $null } It "allows valid Windows credentials can be passed" { Set-TargetResource @testParams - Assert-MockCalled New-SPSecureStoreServiceApplication + Assert-MockCalled New-SPSecureStoreServiceApplication } It "Should throw an exception if database authentication type is not specified" { @@ -292,20 +292,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When specific SQL credentials are to be used for the database" -Fixture { $testParams = @{ - Name = "Secure Store Service Application" - ApplicationPool = "SharePoint Search Services" - AuditingEnabled = $false - DatabaseName = "SP_ManagedMetadata" - DatabaseCredentials = $mockCredential + Name = "Secure Store Service Application" + ApplicationPool = "SharePoint Search Services" + AuditingEnabled = $false + DatabaseName = "SP_ManagedMetadata" + DatabaseCredentials = $mockCredential DatabaseAuthenticationType = "SQL" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { return $null } It "allows valid SQL credentials can be passed" { Set-TargetResource @testParams - Assert-MockCalled New-SPSecureStoreServiceApplication + Assert-MockCalled New-SPSecureStoreServiceApplication } It "Should throw an exception if database authentication type is not specified" { @@ -319,83 +319,83 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { Set-TargetResource @testParams } | Should Throw } } - + Context -Name "When the service app exists but it shouldn't" -Fixture { $testParams = @{ - Name = "Secure Store Service Application" + Name = "Secure Store Service Application" ApplicationPool = "-" AuditingEnabled = $false - Ensure = "Absent" + Ensure = "Absent" } - Mock -CommandName Get-SPServiceApplication -MockWith { + Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Secure Store Service Application" - DisplayName = $testParams.Name - ApplicationPool = @{ + TypeName = "Secure Store Service Application" + DisplayName = $testParams.Name + ApplicationPool = @{ Name = "Wrong App Pool Name" } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetProperties ` - -Value { - param($x) - return @( - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "Database" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return (@{ - FullName = $getTypeFullName - Name = "Database" - NormalizedDataSource = "DBServer" - Server = @{ - Name = "DBServer" - } - FailoverServer = @{ - Name = "DBServer_Failover" - } - }) - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "AuditEnabled" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return $params.AuditEnabled - } -PassThru - ) - ) - } -PassThru + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name FullName ` + -Value $getTypeFullName ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetProperties ` + -Value { + param($x) + return @( + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "Database" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return (@{ + FullName = $getTypeFullName + Name = "Database" + NormalizedDataSource = "DBServer" + Server = @{ + Name = "DBServer" + } + FailoverServer = @{ + Name = "DBServer_Failover" + } + }) + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "AuditEnabled" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return $params.AuditEnabled + } -PassThru + ) + ) + } -PassThru } -PassThru -Force - + return $spServiceApp } - + It "Should return present from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Present" + (Get-TargetResource @testParams).Ensure | Should Be "Present" } - + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false } - + It "Should remove the service application in the set method" { Set-TargetResource @testParams Assert-MockCalled Remove-SPServiceApplication @@ -404,192 +404,192 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the database name does not match the actual name" -Fixture { $testParams = @{ - Name = "Secure Store Service Application" + Name = "Secure Store Service Application" ApplicationPool = "Service App Pool" AuditingEnabled = $false - DatabaseName = "SecureStoreDB" - Ensure = "Present" + DatabaseName = "SecureStoreDB" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplication -MockWith { + Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Secure Store Service Application" - DisplayName = $testParams.Name - ApplicationPool = @{ + TypeName = "Secure Store Service Application" + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetProperties ` - -Value { - param($x) - return @( - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "Database" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return (@{ - FullName = $getTypeFullName - Name = "Wrong Database" - NormalizedDataSource = "DBServer" - Server = @{ - Name = "DBServer" - } - FailoverServer = @{ - Name = "DBServer_Failover" - } - }) - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "AuditEnabled" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return $params.AuditEnabled - } -PassThru - ) - ) - } -PassThru + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name FullName ` + -Value $getTypeFullName ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetProperties ` + -Value { + param($x) + return @( + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "Database" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return (@{ + FullName = $getTypeFullName + Name = "Wrong Database" + NormalizedDataSource = "DBServer" + Server = @{ + Name = "DBServer" + } + FailoverServer = @{ + Name = "DBServer_Failover" + } + }) + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "AuditEnabled" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return $params.AuditEnabled + } -PassThru + ) + ) + } -PassThru } -PassThru -Force - + return $spServiceApp } - + It "Should return present from the Get method" { $result = Get-TargetResource @testParams $result.Ensure | Should Be "Present" } - + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false } It "Should throw exception in the set method" { { Set-TargetResource @testParams } | Should Throw ("Specified database name does not match " + ` - "the actual database name. This resource " + ` - "cannot rename the database.") + "the actual database name. This resource " + ` + "cannot rename the database.") } } Context -Name "When the database server does not match the actual server" -Fixture { $testParams = @{ - Name = "Secure Store Service Application" + Name = "Secure Store Service Application" ApplicationPool = "Service App Pool" AuditingEnabled = $false - DatabaseName = "SecureStoreDB" - DatabaseServer = "SQL_Instance" - Ensure = "Present" + DatabaseName = "SecureStoreDB" + DatabaseServer = "SQL_Instance" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplication -MockWith { + Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Secure Store Service Application" - DisplayName = $testParams.Name - ApplicationPool = @{ + TypeName = "Secure Store Service Application" + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetProperties ` - -Value { - param($x) - return @( - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "Database" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return (@{ - FullName = $getTypeFullName - Name = "SecureStoreDB" - NormalizedDataSource = "Wrong DBServer" - Server = @{ - Name = "Wrong DBServer" - } - FailoverServer = @{ - Name = "DBServer_Failover" - } - }) - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "AuditEnabled" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return $params.AuditEnabled - } -PassThru - ) - ) - } -PassThru + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name FullName ` + -Value $getTypeFullName ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetProperties ` + -Value { + param($x) + return @( + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "Database" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return (@{ + FullName = $getTypeFullName + Name = "SecureStoreDB" + NormalizedDataSource = "Wrong DBServer" + Server = @{ + Name = "Wrong DBServer" + } + FailoverServer = @{ + Name = "DBServer_Failover" + } + }) + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "AuditEnabled" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return $params.AuditEnabled + } -PassThru + ) + ) + } -PassThru } -PassThru -Force - + return $spServiceApp } - + It "Should return present from the Get method" { $result = Get-TargetResource @testParams $result.Ensure | Should Be "Present" } - + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false } It "Should throw exception in the set method" { { Set-TargetResource @testParams } | Should Throw ("Specified database server does " + ` - "not match the actual database server. " + ` - "This resource cannot move the database " + ` - "to a different SQL instance.") + "not match the actual database server. " + ` + "This resource cannot move the database " + ` + "to a different SQL instance.") } } Context -Name "When the service app doesn't exist and shouldn't" -Fixture { $testParams = @{ - Name = "Secure Store Service Application" + Name = "Secure Store Service Application" ApplicationPool = "-" AuditingEnabled = $false - Ensure = "Absent" + Ensure = "Absent" } - - Mock -CommandName Get-SPServiceApplication -MockWith { - return $null + + Mock -CommandName Get-SPServiceApplication -MockWith { + return $null } - + It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $true } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSecurityTokenServiceConfig.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSecurityTokenServiceConfig.Tests.ps1 index 5925f4794..993764c97 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSecurityTokenServiceConfig.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSecurityTokenServiceConfig.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSecurityTokenServiceConfig" + -DscResource "SPSecurityTokenServiceConfig" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -25,7 +25,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $testParams = @{ IsSingleInstance = "Yes" - Name = "Security Token Service" + Name = "Security Token Service" } It "Should return false when the Test method is called" { @@ -36,17 +36,17 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When setting the configurations for the Security Token Service" { $params = @{ IsSingleInstance = "Yes" - Name = "New name" - Ensure = "Present" + Name = "New name" + Ensure = "Present" } Mock -CommandName Get-SPSecurityTokenServiceConfig -MockWith { return @{ - Name = "Security Token Service" - NameIdentifier = "12345-12345-12345-12345@12345-12345" - UseSessionCookies = $false - AllowOAuthOverHttp = $false + Name = "Security Token Service" + NameIdentifier = "12345-12345-12345-12345@12345-12345" + UseSessionCookies = $false + AllowOAuthOverHttp = $false AllowMetadataOverHttp = $false - }| Add-Member ScriptMethod Update { + } | Add-Member ScriptMethod Update { $Global:UpdatedCalled = $true } -PassThru } @@ -62,7 +62,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should throw an error when trying to set to Absent" { $params.Ensure = "Absent" { Set-TargetResource @params } | Should throw "This resource cannot undo Security " ` - "Token Service Configuration changes. Please set Ensure to Present or omit the resource" + "Token Service Configuration changes. Please set Ensure to Present or omit the resource" } } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSelfServiceSiteCreation.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSelfServiceSiteCreation.Tests.ps1 index 611e2ddbd..b899066b6 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSelfServiceSiteCreation.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSelfServiceSiteCreation.Tests.ps1 @@ -3,17 +3,17 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Set-StrictMode -Version 2 Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSelfServiceSiteCreation" + -DscResource "SPSelfServiceSiteCreation" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -35,17 +35,17 @@ namespace Microsoft.SharePoint.Administration { $webAppImplementation = { $webApp = @{ - Url = $null - SelfServiceSiteCreationEnabled = $null - SelfServiceSiteCreationOnlineEnabled = $null - SelfServiceCreationQuotaTemplate = $null - ShowStartASiteMenuItem = $null - SelfServiceCreateIndividualSite = $null - SelfServiceCreationParentSiteUrl = $null - SelfServiceSiteCustomFormUrl = $null + Url = $null + SelfServiceSiteCreationEnabled = $null + SelfServiceSiteCreationOnlineEnabled = $null + SelfServiceCreationQuotaTemplate = $null + ShowStartASiteMenuItem = $null + SelfServiceCreateIndividualSite = $null + SelfServiceCreationParentSiteUrl = $null + SelfServiceSiteCustomFormUrl = $null RequireContactForSelfServiceSiteCreation = $null - Properties = @{} - UpdateCalled = $false + Properties = @{ } + UpdateCalled = $false } $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { @@ -56,8 +56,8 @@ namespace Microsoft.SharePoint.Administration { Mock -CommandName Get-SPDscInstalledProductVersion { return @{ - FileMajorPart = $Global:SPDscHelper.CurrentStubBuildNumber.Major - FileBuildPart = $Global:SPDscHelper.CurrentStubBuildNumber.Build + FileMajorPart = $Global:SPDscHelper.CurrentStubBuildNumber.Major + FileBuildPart = $Global:SPDscHelper.CurrentStubBuildNumber.Build ProductBuildPart = $Global:SPDscHelper.CurrentStubBuildNumber.Build } } @@ -66,15 +66,15 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Self service site creation settings matches the current state" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - Enabled = $true - OnlineEnabled = $false - QuotaTemplate = "SSCQoutaTemplate" - ShowStartASiteMenuItem = $true - CreateIndividualSite = $false - ParentSiteUrl = "/sites/SSC" - CustomFormUrl = "" - PolicyOption = "CanHavePolicy" + WebAppUrl = "http://sites.sharepoint.com" + Enabled = $true + OnlineEnabled = $false + QuotaTemplate = "SSCQoutaTemplate" + ShowStartASiteMenuItem = $true + CreateIndividualSite = $false + ParentSiteUrl = "/sites/SSC" + CustomFormUrl = "" + PolicyOption = "CanHavePolicy" RequireSecondaryContact = $true } @@ -124,15 +124,15 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Self service site creation settings does not match the current state" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - Enabled = $true - OnlineEnabled = $false - QuotaTemplate = "SSCQoutaTemplate" - ShowStartASiteMenuItem = $true - CreateIndividualSite = $false - ParentSiteUrl = "/sites/SSC" - CustomFormUrl = "http://CustomForm.SharePoint.com" - PolicyOption = "CanHavePolicy" + WebAppUrl = "http://sites.sharepoint.com" + Enabled = $true + OnlineEnabled = $false + QuotaTemplate = "SSCQoutaTemplate" + ShowStartASiteMenuItem = $true + CreateIndividualSite = $false + ParentSiteUrl = "/sites/SSC" + CustomFormUrl = "http://CustomForm.SharePoint.com" + PolicyOption = "CanHavePolicy" RequireSecondaryContact = $true } @@ -166,7 +166,7 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Disabling self service site creation does not match the current state" -Fixture { $testParams = @{ WebAppUrl = "http://sites.sharepoint.com" - Enabled = $false + Enabled = $false } Mock -CommandName Get-SPWebApplication -MockWith { @@ -202,8 +202,8 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Disabling self service site creation and enabling show start a site menu item" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - Enabled = $false + WebAppUrl = "http://sites.sharepoint.com" + Enabled = $false ShowStartASiteMenuItem = $true } @@ -238,8 +238,8 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Web application does not exist" -Fixture { $testParams = @{ WebAppUrl = "http://sites.sharepoint.com" - Enabled = $true - } + Enabled = $true + } Mock -CommandName Get-SPWebApplication -MockWith { return($null) @@ -274,16 +274,16 @@ namespace Microsoft.SharePoint.Administration { { Context -Name "Using SP2019 parameters in SP2013/2016" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - Enabled = $true - OnlineEnabled = $false - QuotaTemplate = "SSCQoutaTemplate" - ShowStartASiteMenuItem = $true - CreateIndividualSite = $false - ParentSiteUrl = "/sites/SSC" - CustomFormUrl = "" - ManagedPath = "CANNOT BE USED" - PolicyOption = "CanHavePolicy" + WebAppUrl = "http://sites.sharepoint.com" + Enabled = $true + OnlineEnabled = $false + QuotaTemplate = "SSCQoutaTemplate" + ShowStartASiteMenuItem = $true + CreateIndividualSite = $false + ParentSiteUrl = "/sites/SSC" + CustomFormUrl = "" + ManagedPath = "CANNOT BE USED" + PolicyOption = "CanHavePolicy" RequireSecondaryContact = $true } @@ -292,16 +292,16 @@ namespace Microsoft.SharePoint.Administration { } $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - Enabled = $true - OnlineEnabled = $false - QuotaTemplate = "SSCQoutaTemplate" - ShowStartASiteMenuItem = $true - CreateIndividualSite = $false - ParentSiteUrl = "/sites/SSC" - CustomFormUrl = "" - AlternateUrl = "CANNOT BE USED" - PolicyOption = "CanHavePolicy" + WebAppUrl = "http://sites.sharepoint.com" + Enabled = $true + OnlineEnabled = $false + QuotaTemplate = "SSCQoutaTemplate" + ShowStartASiteMenuItem = $true + CreateIndividualSite = $false + ParentSiteUrl = "/sites/SSC" + CustomFormUrl = "" + AlternateUrl = "CANNOT BE USED" + PolicyOption = "CanHavePolicy" RequireSecondaryContact = $true } @@ -310,16 +310,16 @@ namespace Microsoft.SharePoint.Administration { } $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - Enabled = $true - OnlineEnabled = $false - QuotaTemplate = "SSCQoutaTemplate" - ShowStartASiteMenuItem = $true - CreateIndividualSite = $false - ParentSiteUrl = "/sites/SSC" - CustomFormUrl = "" - UserExperienceVersion = "Modern" # CANNOT BE USED - PolicyOption = "CanHavePolicy" + WebAppUrl = "http://sites.sharepoint.com" + Enabled = $true + OnlineEnabled = $false + QuotaTemplate = "SSCQoutaTemplate" + ShowStartASiteMenuItem = $true + CreateIndividualSite = $false + ParentSiteUrl = "/sites/SSC" + CustomFormUrl = "" + UserExperienceVersion = "Modern" # CANNOT BE USED + PolicyOption = "CanHavePolicy" RequireSecondaryContact = $true } @@ -334,17 +334,17 @@ namespace Microsoft.SharePoint.Administration { { Context -Name "Using both ManagedPath and AlternateUrl" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - Enabled = $true - OnlineEnabled = $false - QuotaTemplate = "SSCQoutaTemplate" - ShowStartASiteMenuItem = $true - CreateIndividualSite = $false - ParentSiteUrl = "/sites/SSC" - CustomFormUrl = "" - ManagedPath = "sites" - AlternateUrl = "sharepoint.contoso.com" - PolicyOption = "CanHavePolicy" + WebAppUrl = "http://sites.sharepoint.com" + Enabled = $true + OnlineEnabled = $false + QuotaTemplate = "SSCQoutaTemplate" + ShowStartASiteMenuItem = $true + CreateIndividualSite = $false + ParentSiteUrl = "/sites/SSC" + CustomFormUrl = "" + ManagedPath = "sites" + AlternateUrl = "sharepoint.contoso.com" + PolicyOption = "CanHavePolicy" RequireSecondaryContact = $true } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceAppPool.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceAppPool.Tests.ps1 index 9640a830f..90a79e295 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceAppPool.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceAppPool.Tests.ps1 @@ -1,18 +1,18 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPServiceAppPool" + -DscResource "SPServiceAppPool" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -20,7 +20,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Initialize tests - # Mocks for all contexts + # Mocks for all contexts Mock -CommandName New-SPServiceApplicationPool -MockWith { } Mock -CommandName Set-SPServiceApplicationPool -MockWith { } Mock -CommandName Remove-SPServiceApplicationPool -MockWith { } @@ -28,13 +28,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Test contexts Context -Name "A service account pool does not exist but should" -Fixture { $testParams = @{ - Name = "Service pool" + Name = "Service pool" ServiceAccount = "DEMO\svcSPServiceApps" - Ensure = "Present" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplicationPool -MockWith { - return $null + Mock -CommandName Get-SPServiceApplicationPool -MockWith { + return $null } It "Should return absent from the get method" { @@ -47,45 +47,45 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should call the set method to create a new service account pool" { Set-TargetResource @testParams - Assert-MockCalled New-SPServiceApplicationPool + Assert-MockCalled New-SPServiceApplicationPool } } Context -Name "A service account pool exists but has the wrong service account" -Fixture { $testParams = @{ - Name = "Service pool" + Name = "Service pool" ServiceAccount = "DEMO\svcSPServiceApps" - Ensure = "Present" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplicationPool -MockWith { + Mock -CommandName Get-SPServiceApplicationPool -MockWith { return @{ - Name = $testParams.Name + Name = $testParams.Name ProcessAccountName = "WRONG\account" } } It "Should return false from the test method" { - Test-TargetResource @testParams | Should Be $false + Test-TargetResource @testParams | Should Be $false } It "Should call the set method to update the service account pool" { Set-TargetResource @testParams - Assert-MockCalled Set-SPServiceApplicationPool + Assert-MockCalled Set-SPServiceApplicationPool } } Context -Name "A service account pool exists and uses the correct account" -Fixture { $testParams = @{ - Name = "Service pool" + Name = "Service pool" ServiceAccount = "DEMO\svcSPServiceApps" - Ensure = "Present" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplicationPool -MockWith { + Mock -CommandName Get-SPServiceApplicationPool -MockWith { return @{ - Name = $testParams.Name + Name = $testParams.Name ProcessAccountName = $testParams.ServiceAccount } } @@ -98,50 +98,50 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Test-TargetResource @testParams | Should Be $true } } - + Context -Name "When the service app pool exists but it shouldn't" -Fixture { $testParams = @{ - Name = "Service pool" + Name = "Service pool" ServiceAccount = "DEMO\svcSPServiceApps" - Ensure = "Absent" + Ensure = "Absent" } - Mock -CommandName Get-SPServiceApplicationPool -MockWith { + Mock -CommandName Get-SPServiceApplicationPool -MockWith { return @{ - Name = $testParams.Name + Name = $testParams.Name ProcessAccountName = $testParams.ServiceAccount } } - + It "Should return present from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Present" + (Get-TargetResource @testParams).Ensure | Should Be "Present" } - + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false } - + It "Should remove the service application in the set method" { Set-TargetResource @testParams Assert-MockCalled Remove-SPServiceApplicationPool } } - + Context -Name "When the service app pool doesn't exist and shouldn't" -Fixture { $testParams = @{ - Name = "Service pool" + Name = "Service pool" ServiceAccount = "DEMO\svcSPServiceApps" - Ensure = "Absent" + Ensure = "Absent" } - Mock -CommandName Get-SPServiceApplicationPool -MockWith { - return $null + Mock -CommandName Get-SPServiceApplicationPool -MockWith { + return $null } - + It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $true } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceAppProxyGroup.tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceAppProxyGroup.tests.ps1 index 8f0e6647f..33c8f77b3 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceAppProxyGroup.tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceAppProxyGroup.tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPServiceAppProxyGroup" + -DscResource "SPServiceAppProxyGroup" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -27,13 +27,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { ) # Mocks for all contexts - Mock -CommandName Add-SPServiceApplicationProxyGroupMember -MockWith {} - Mock -CommandName Remove-SPServiceApplicationProxyGroupMember -MockWith {} + Mock -CommandName Add-SPServiceApplicationProxyGroupMember -MockWith { } + Mock -CommandName Remove-SPServiceApplicationProxyGroupMember -MockWith { } Mock -CommandName Get-SPServiceApplicationProxy -MockWith { $proxiesToReturn = @() foreach ($ServiceAppProxy in $listofAllServiceAppProxies) { - $proxiesToReturn += @{ + $proxiesToReturn += @{ DisplayName = $ServiceAppProxy } } @@ -48,9 +48,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Test contexts Context -Name "ServiceAppProxies and ServiceAppProxiesToInclude parameters used simultaniously" -Fixture { $testParams = @{ - Name = "Shared Services" - Ensure = "Present" - ServiceAppProxies = "Web 1 User Profile Service Application","Web 1 MMS Service Application","State Service Application" + Name = "Shared Services" + Ensure = "Present" + ServiceAppProxies = "Web 1 User Profile Service Application", "Web 1 MMS Service Application", "State Service Application" ServiceAppProxiesToInclude = "Web 2 User Profile Service Application" } @@ -69,8 +69,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "None of the ServiceAppProxies, ServiceAppProxiesToInclude and ServiceAppProxiesToExclude parameters are used" -Fixture { $testParams = @{ - Name = "My Proxy Group" - Ensure = "Present" + Name = "My Proxy Group" + Ensure = "Present" } It "Should return Ensure=null from the get method" { @@ -90,7 +90,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $testParams = @{ Name = "Shared Services" Ensure = "Present" - ServiceAppProxies = @("State Service Application","Web 1 User Profile Service Application") + ServiceAppProxies = @("State Service Application", "Web 1 User Profile Service Application") } Mock -CommandName Get-SPServiceApplicationProxyGroup -MockWith { @@ -113,8 +113,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The ServiceApplication Proxy Group does not exist, and should not" -Fixture { $testParams = @{ - Name = "Shared Services" - Ensure = "Absent" + Name = "Shared Services" + Ensure = "Absent" } Mock -CommandName Get-SPServiceApplicationProxyGroup -MockWith { @@ -134,7 +134,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $testParams = @{ Name = "Shared Services" Ensure = "Present" - ServiceAppProxies = @("State Service Application","Web 1 User Profile Service Application") + ServiceAppProxies = @("State Service Application", "Web 1 User Profile Service Application") } Mock -CommandName Get-SPServiceApplicationProxyGroup -MockWith { @@ -146,7 +146,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } return @{ - Name = $testParams.Name + Name = $testParams.Name Proxies = $proxiesToReturn } } @@ -182,7 +182,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } return @{ - Name = $testParams.Name + Name = $testParams.Name Proxies = $proxiesToReturn } } @@ -204,8 +204,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The Service Application Proxy Group exists and should, ServiceAppProxiesToInclude matches" -Fixture { $testParams = @{ - Name = "Shared Services" - Ensure = "Present" + Name = "Shared Services" + Ensure = "Present" ServiceAppProxiesToInclude = @( "State Service Application", "Web 1 User Profile Service Application") @@ -225,7 +225,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } return @{ - Name = $testParams.Name + Name = $testParams.Name Proxies = $proxiesToReturn } } @@ -241,8 +241,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The Service Application Proxy Group exists and should, ServiceAppProxiesToInclude does not match" -Fixture { $testParams = @{ - Name = "Shared Services" - Ensure = "Present" + Name = "Shared Services" + Ensure = "Present" ServiceAppProxiesToInclude = @( "State Service Application", "Web 1 User Profile Service Application") @@ -256,12 +256,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $proxiesToReturn = @() foreach ($ServiceAppProxy in $serviceAppProxiesConfigured) { - $proxiesToReturn += @{ + $proxiesToReturn += @{ DisplayName = $ServiceAppProxy } } return @{ - Name = $testParams.Name + Name = $testParams.Name Proxies = $proxiesToReturn } } @@ -283,8 +283,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The Service Application Proxy Group exists and should, ServiceAppProxiesToExclude matches" -Fixture { $testParams = @{ - Name = "Shared Services" - Ensure = "Present" + Name = "Shared Services" + Ensure = "Present" ServiceAppProxiesToExclude = @("Web 1 User Profile Service Application") } @@ -301,7 +301,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } return @{ - Name = $testParams.Name + Name = $testParams.Name Proxies = $proxiesToReturn } } @@ -317,9 +317,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The Service Application Proxy Group exists and should, ServiceAppProxiesToExclude does not match" -Fixture { $testParams = @{ - Name = "Shared Services" - Ensure = "Present" - ServiceAppProxiesToExclude = @("Web 1 User Profile Service Application","Web 2 User Profile Service Application") + Name = "Shared Services" + Ensure = "Present" + ServiceAppProxiesToExclude = @("Web 1 User Profile Service Application", "Web 2 User Profile Service Application") } $serviceAppProxiesConfigured = @( @@ -331,12 +331,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $proxiesToReturn = @() foreach ($ServiceAppProxy in $serviceAppProxiesConfigured) { - $proxiesToReturn += @{ + $proxiesToReturn += @{ DisplayName = $ServiceAppProxy } } return @{ - Name = $testParams.Name + Name = $testParams.Name Proxies = $proxiesToReturn } } @@ -369,12 +369,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $proxiesToReturn = @() foreach ($ServiceAppProxy in "Web 1 User Profile Service Application") { - $proxiesToReturn += @{ + $proxiesToReturn += @{ DisplayName = $ServiceAppProxy } } return @{ - Name = $testParams.Name + Name = $testParams.Name Proxies = $proxiesToReturn } } @@ -388,14 +388,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should throw an error from the set method" { - { Set-TargetResource @testParams } | Should throw "Invalid Service Application Proxy No Such Service Application" + { Set-TargetResource @testParams } | Should throw "Invalid Service Application Proxy No Such Service Application" } } Context -Name "Specified service application does not exist, ServiceAppProxiesToInclude specified" -Fixture { $testParams = @{ - Name = "Shared Services" - Ensure = "Present" + Name = "Shared Services" + Ensure = "Present" ServiceAppProxiesToInclude = @( "No Such Service Application", "Web 1 User Profile Service Application") @@ -410,7 +410,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } return @{ - Name = $testParams.Name + Name = $testParams.Name Proxies = $proxiesToReturn } } @@ -424,7 +424,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should throw an error from the set method" { - { Set-TargetResource @testParams }| Should throw "Invalid Service Application Proxy No Such Service Application" + { Set-TargetResource @testParams } | Should throw "Invalid Service Application Proxy No Such Service Application" } } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceAppSecurity.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceAppSecurity.Tests.ps1 index 43983ead7..f281e8abb 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceAppSecurity.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceAppSecurity.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPServiceAppSecurity" + -DscResource "SPServiceAppSecurity" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -23,9 +23,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Mocks for all contexts Mock -CommandName Test-SPDscIsADUser -MockWith { return $true } - Mock Grant-SPObjectSecurity -MockWith {} - Mock Revoke-SPObjectSecurity -MockWith {} - Mock -CommandName Set-SPServiceApplicationSecurity -MockWith {} + Mock Grant-SPObjectSecurity -MockWith { } + Mock Revoke-SPObjectSecurity -MockWith { } + Mock -CommandName Set-SPServiceApplicationSecurity -MockWith { } Mock -CommandName New-SPClaimsPrincipal -MockWith { return @{ @@ -37,10 +37,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $Global:SPDscClaimsPrincipalUser = $Identity return ( New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod ` - -Name ToEncodedString ` - -Value { - return "i:0#.w|$($Global:SPDscClaimsPrincipalUser)" - } -PassThru + -Name ToEncodedString ` + -Value { + return "i:0#.w|$($Global:SPDscClaimsPrincipalUser)" + } -PassThru ) } -ParameterFilter { $IdentityType -eq "WindowsSamAccountName" } @@ -54,20 +54,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service app that security should be applied to does not exist" -Fixture { $testParams = @{ ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" - Members = @( + SecurityType = "SharingPermissions" + Members = @( (New-CimInstance -ClassName "MSFT_SPServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user1" - AccessLevels = "Full Control" - }), + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user1" + AccessLevels = "Full Control" + }), (New-CimInstance -ClassName "MSFT_SPServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user2" - AccessLevels = "Full Control" - }) + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user2" + AccessLevels = "Full Control" + }) ) } @@ -91,7 +91,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "None of the required members properties are provided" -Fixture { $testParams = @{ ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" + SecurityType = "SharingPermissions" } It "Should throw an exception from the test method" { @@ -105,23 +105,23 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "All of the members properties are provided" -Fixture { $testParams = @{ - ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" - Members = @( + ServiceAppName = "Example Service App" + SecurityType = "SharingPermissions" + Members = @( (New-CimInstance -ClassName "MSFT_SPServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user1" - AccessLevels = "Full Control" - }) + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user1" + AccessLevels = "Full Control" + }) ) MembersToInclude = @( (New-CimInstance -ClassName "MSFT_SPServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user1" - AccessLevels = "Full Control" - }) + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user1" + AccessLevels = "Full Control" + }) ) MembersToExclude = @("CONTOSO\user2") } @@ -138,20 +138,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A specified access level does not match the allowed list of (localized) access levels (Members)" -Fixture { $testParams = @{ ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" - Members = @( + SecurityType = "SharingPermissions" + Members = @( (New-CimInstance -ClassName "MSFT_SPSearchServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user1" - AccessLevels = "Read" - }), + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user1" + AccessLevels = "Read" + }), (New-CimInstance -ClassName "MSFT_SPSearchServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user2" - AccessLevels = "Full Control" - }) + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user2" + AccessLevels = "Full Control" + }) ) } @@ -186,21 +186,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A specified access level does not match the allowed list of (localized) access levels (MembersToInclude)" -Fixture { $testParams = @{ - ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" + ServiceAppName = "Example Service App" + SecurityType = "SharingPermissions" MembersToInclude = @( (New-CimInstance -ClassName "MSFT_SPSearchServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user1" - AccessLevels = "Read" - }), + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user1" + AccessLevels = "Read" + }), (New-CimInstance -ClassName "MSFT_SPSearchServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user2" - AccessLevels = "Full Control" - }) + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user2" + AccessLevels = "Full Control" + }) ) } @@ -236,29 +236,29 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service app exists and a fixed members list is provided that does not match the current settings" -Fixture { $testParams = @{ ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" - Members = @( + SecurityType = "SharingPermissions" + Members = @( (New-CimInstance -ClassName "MSFT_SPSearchServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user1" - AccessLevels = "Full Control" - }), + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user1" + AccessLevels = "Full Control" + }), (New-CimInstance -ClassName "MSFT_SPSearchServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user2" - AccessLevels = "Full Control" - }) + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user2" + AccessLevels = "Full Control" + }) ) } Mock -CommandName Get-SPServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPServiceApplicationSecurity -MockWith { - if ($Global:SPDscRunCount -in 0,1,3,4) + if ($Global:SPDscRunCount -in 0, 1, 3, 4) { $Global:SPDscRunCount++ return @{ @@ -275,7 +275,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @{ AccessRules = @( @{ - Name = "CONTOSO\user1" + Name = "CONTOSO\user1" AllowedRights = "Read" } ) @@ -296,7 +296,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $Global:SPDscRunCount = 0 It "Should call the update cmdlet from the set method" { Set-TargetResource @testParams - Assert-MockCalled Grant-SPObjectSecurity -ParameterFilter {$Replace -eq $true} + Assert-MockCalled Grant-SPObjectSecurity -ParameterFilter { $Replace -eq $true } Assert-MockCalled Set-SPServiceApplicationSecurity } } @@ -304,47 +304,47 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service app exists and a fixed members list is provided that does match the current settings" -Fixture { $testParams = @{ ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" - Members = @( + SecurityType = "SharingPermissions" + Members = @( (New-CimInstance -ClassName "MSFT_SPServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user1" - AccessLevels = "Full Control" - }), + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user1" + AccessLevels = "Full Control" + }), (New-CimInstance -ClassName "MSFT_SPServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user2" - AccessLevels = "Full Control" - }) + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user2" + AccessLevels = "Full Control" + }) ) } Mock -CommandName Get-SPServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPServiceApplicationSecurity -MockWith { $security = @{ NamedAccessRights = @( @{ - Name = "Full Control" + Name = "Full Control" Rights = @{ RightsFlags = 0xff } } ) - AccessRules = @( + AccessRules = @( @{ - Name = "CONTOSO\user1" + Name = "CONTOSO\user1" AllowedObjectRights = @{ RightsFlags = 0xff } } @{ - Name = "CONTOSO\user2" + Name = "CONTOSO\user2" AllowedObjectRights = @{ RightsFlags = 0xff @@ -354,8 +354,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $security.NamedAccessRights | ForEach-Object { $_.Rights } | Add-Member -MemberType ScriptMethod ` - -Name IsSubsetOf ` - -Value { + -Name IsSubsetOf ` + -Value { param($objectRights) return ($objectRights.RightsFlags -band $this.RightsFlags) -eq $this.RightsFlags } @@ -374,25 +374,25 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service app exists and a specific list of members to add and remove is provided, which does not match the desired state" -Fixture { $testParams = @{ - ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" + ServiceAppName = "Example Service App" + SecurityType = "SharingPermissions" MembersToInclude = @( (New-CimInstance -ClassName "MSFT_SPServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user1" - AccessLevels = "Full Control" - }) + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user1" + AccessLevels = "Full Control" + }) ) MembersToExclude = @("CONTOSO\user2") } Mock -CommandName Get-SPServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPServiceApplicationSecurity -MockWith { - if ($Global:SPDscRunCount -in 0,1,3,4) + if ($Global:SPDscRunCount -in 0, 1, 3, 4) { $Global:SPDscRunCount++ return @{ @@ -409,7 +409,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @{ AccessRules = @( @{ - Name = "CONTOSO\user2" + Name = "CONTOSO\user2" AllowedRights = "FullControl" } ) @@ -438,20 +438,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service app exists and a specific list of members to remove is provided, which does not match the desired state" -Fixture { $testParams = @{ - ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" + ServiceAppName = "Example Service App" + SecurityType = "SharingPermissions" MembersToExclude = @("CONTOSO\user2") } Mock -CommandName Get-SPServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPServiceApplicationSecurity -MockWith { return @{ AccessRules = @( @{ - Name = "CONTOSO\user2" + Name = "CONTOSO\user2" AllowedRights = "FullControl" } ) @@ -475,36 +475,36 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service app exists and a specific list of members to add and remove is provided, which does match the desired state" -Fixture { $testParams = @{ - ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" + ServiceAppName = "Example Service App" + SecurityType = "SharingPermissions" MembersToInclude = @( (New-CimInstance -ClassName "MSFT_SPServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user1" - AccessLevels = "Full Control" - }) + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user1" + AccessLevels = "Full Control" + }) ) MembersToExclude = @("CONTOSO\user2") } Mock -CommandName Get-SPServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPServiceApplicationSecurity { $security = @{ NamedAccessRights = @( @{ - Name = "Full Control" + Name = "Full Control" Rights = @{ RightsFlags = 0xff } } ) - AccessRules = @( + AccessRules = @( @{ - Name = "CONTOSO\user1" + Name = "CONTOSO\user1" AllowedObjectRights = @{ RightsFlags = 0xff @@ -514,8 +514,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $security.NamedAccessRights | ForEach-Object { $_.Rights } | Add-Member -MemberType ScriptMethod ` - -Name IsSubsetOf ` - -Value { + -Name IsSubsetOf ` + -Value { param($objectRights) return ($objectRights.RightsFlags -band $this.RightsFlags) -eq $this.RightsFlags } @@ -534,24 +534,24 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service app exists and a specific list of members to add is provided with different access level, which does not match the desired state" -Fixture { $testParams = @{ - ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" + ServiceAppName = "Example Service App" + SecurityType = "SharingPermissions" MembersToInclude = @( (New-CimInstance -ClassName "MSFT_SPServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user1" - AccessLevels = "Read" - }) + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user1" + AccessLevels = "Read" + }) ) } Mock -CommandName Get-SPServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPServiceApplicationSecurity -MockWith { - if ($Global:SPDscRunCount -in 0,1) + if ($Global:SPDscRunCount -in 0, 1) { $Global:SPDscRunCount++ return @{ @@ -571,7 +571,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @{ AccessRules = @( @{ - Name = "CONTOSO\user1" + Name = "CONTOSO\user1" AllowedRights = "FullControl" } ) @@ -588,23 +588,23 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service app exists and a specific list of members is provided with different access level, which does not match the desired state" -Fixture { $testParams = @{ ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" - Members = @( + SecurityType = "SharingPermissions" + Members = @( (New-CimInstance -ClassName "MSFT_SPServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user1" - AccessLevels = "Read" - }) + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user1" + AccessLevels = "Read" + }) ) } Mock -CommandName Get-SPServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPServiceApplicationSecurity -MockWith { - if ($Global:SPDscRunCount -in 0,1,3,4) + if ($Global:SPDscRunCount -in 0, 1, 3, 4) { $Global:SPDscRunCount++ return @{ @@ -621,7 +621,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @{ AccessRules = @( @{ - Name = "CONTOSO\user1" + Name = "CONTOSO\user1" AllowedRights = "FullControl" } ) @@ -637,31 +637,31 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $Global:SPDscRunCount = 0 It "Should call the update cmdlet from the set method" { Set-TargetResource @testParams - Assert-MockCalled Grant-SPObjectSecurity -Times 1 -ParameterFilter {$Replace -eq $true} + Assert-MockCalled Grant-SPObjectSecurity -Times 1 -ParameterFilter { $Replace -eq $true } Assert-MockCalled Set-SPServiceApplicationSecurity -Times 1 } } Context -Name "The service app exists and a specific list of members to add is provided with different access level, which does not match the desired state" -Fixture { $testParams = @{ - ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" + ServiceAppName = "Example Service App" + SecurityType = "SharingPermissions" MembersToInclude = @( (New-CimInstance -ClassName "MSFT_SPServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user1" - AccessLevels = "Read" - }) + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user1" + AccessLevels = "Read" + }) ) } Mock -CommandName Get-SPServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPServiceApplicationSecurity -MockWith { - if ($Global:SPDscRunCount -in 0,1,3,4) + if ($Global:SPDscRunCount -in 0, 1, 3, 4) { $Global:SPDscRunCount++ return @{ @@ -678,7 +678,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @{ AccessRules = @( @{ - Name = "CONTOSO\user1" + Name = "CONTOSO\user1" AllowedRights = "FullControl" } ) @@ -694,7 +694,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $Global:SPDscRunCount = 0 It "Should call the update cmdlet from the set method" { Set-TargetResource @testParams - Assert-MockCalled Grant-SPObjectSecurity -Times 1 -ParameterFilter {$Replace -eq $true} + Assert-MockCalled Grant-SPObjectSecurity -Times 1 -ParameterFilter { $Replace -eq $true } Assert-MockCalled Set-SPServiceApplicationSecurity -Times 1 } } @@ -702,12 +702,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service app exists and an empty list of members is provided, which matches the desired state" -Fixture { $testParams = @{ ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" - Members = @() + SecurityType = "SharingPermissions" + Members = @() } Mock -CommandName Get-SPServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPServiceApplicationSecurity -MockWith { @@ -729,19 +729,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service app exists and an empty list of members is provided, which does not match the desired state" -Fixture { $testParams = @{ ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" - Members = @() + SecurityType = "SharingPermissions" + Members = @() } Mock -CommandName Get-SPServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPServiceApplicationSecurity -MockWith { return @{ AccessRules = @( @{ - Name = "CONTOSO\user1" + Name = "CONTOSO\user1" AllowedRights = "FullControl" } ) @@ -761,36 +761,36 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service app exists and a specific list of members to add and remove is provided, which does match the desired state and includes a claims based group" -Fixture { $testParams = @{ - ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" + ServiceAppName = "Example Service App" + SecurityType = "SharingPermissions" MembersToInclude = @( (New-CimInstance -ClassName "MSFT_SPServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user1" - AccessLevels = "Full Control" - }) + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user1" + AccessLevels = "Full Control" + }) ) MembersToExclude = @("CONTOSO\user2") } Mock -CommandName Get-SPServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPServiceApplicationSecurity { $security = @{ NamedAccessRights = @( @{ - Name = "Full Control" + Name = "Full Control" Rights = @{ RightsFlags = 0xff } } ) - AccessRules = @( + AccessRules = @( @{ - Name = "i:0#.w|s-1-5-21-2753725054-2932589700-2007370523-2138" + Name = "i:0#.w|s-1-5-21-2753725054-2932589700-2007370523-2138" AllowedObjectRights = @{ RightsFlags = 0xff @@ -800,8 +800,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $security.NamedAccessRights | ForEach-Object { $_.Rights } | Add-Member -MemberType ScriptMethod ` - -Name IsSubsetOf ` - -Value { + -Name IsSubsetOf ` + -Value { param($objectRights) return ($objectRights.RightsFlags -band $this.RightsFlags) -eq $this.RightsFlags } @@ -825,35 +825,35 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service app exists and the local farm token is provided in the members list that match the current settings" -Fixture { $testParams = @{ ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" - Members = @( + SecurityType = "SharingPermissions" + Members = @( (New-CimInstance -ClassName "MSFT_SPServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "{LocalFarm}" - AccessLevels = "Full Control" - }) + -ClientOnly ` + -Property @{ + Username = "{LocalFarm}" + AccessLevels = "Full Control" + }) ) } Mock -CommandName Get-SPServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPServiceApplicationSecurity { $security = @{ NamedAccessRights = @( @{ - Name = "Full Control" + Name = "Full Control" Rights = @{ RightsFlags = 0xff } } ) - AccessRules = @( + AccessRules = @( @{ - Name = "c:0%.c|system|02a0cea2-d4e0-4e4e-ba2e-e532a433cfef" + Name = "c:0%.c|system|02a0cea2-d4e0-4e4e-ba2e-e532a433cfef" AllowedObjectRights = @{ RightsFlags = 0xff @@ -863,8 +863,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $security.NamedAccessRights | ForEach-Object { $_.Rights } | Add-Member -MemberType ScriptMethod ` - -Name IsSubsetOf ` - -Value { + -Name IsSubsetOf ` + -Value { param($objectRights) return ($objectRights.RightsFlags -band $this.RightsFlags) -eq $this.RightsFlags } @@ -885,23 +885,23 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service app exists and the local farm token is provided in the members list that does not match the current settings" -Fixture { $testParams = @{ ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" - Members = @( + SecurityType = "SharingPermissions" + Members = @( (New-CimInstance -ClassName "MSFT_SPServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "{LocalFarm}" - AccessLevels = "Full Control" - }) + -ClientOnly ` + -Property @{ + Username = "{LocalFarm}" + AccessLevels = "Full Control" + }) ) } Mock -CommandName Get-SPServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPServiceApplicationSecurity -MockWith { - if ($Global:SPDscRunCount -in 0,1,3,4) + if ($Global:SPDscRunCount -in 0, 1, 3, 4) { $Global:SPDscRunCount++ return @{ @@ -938,24 +938,24 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service app exists and local farm token is included in the specific list of members to add, which does not match the desired state" -Fixture { $testParams = @{ - ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" + ServiceAppName = "Example Service App" + SecurityType = "SharingPermissions" MembersToInclude = @( (New-CimInstance -ClassName "MSFT_SPServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "{LocalFarm}" - AccessLevels = "Full Control" - }) + -ClientOnly ` + -Property @{ + Username = "{LocalFarm}" + AccessLevels = "Full Control" + }) ) } Mock -CommandName Get-SPServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPServiceApplicationSecurity -MockWith { - if ($Global:SPDscRunCount -in 0,1,3,4) + if ($Global:SPDscRunCount -in 0, 1, 3, 4) { $Global:SPDscRunCount++ return @{ @@ -972,7 +972,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @{ AccessRules = @( @{ - Name = "CONTOSO\user2" + Name = "CONTOSO\user2" AllowedRights = "FullControl" } ) @@ -996,20 +996,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service app exists and local farm token is included in the specific list of members to remove, which does not match the desired state" -Fixture { $testParams = @{ - ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" + ServiceAppName = "Example Service App" + SecurityType = "SharingPermissions" MembersToExclude = @("{LocalFarm}") } Mock -CommandName Get-SPServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPServiceApplicationSecurity -MockWith { return @{ AccessRules = @( @{ - Name = "c:0%.c|system|02a0cea2-d4e0-4e4e-ba2e-e532a433cfef" + Name = "c:0%.c|system|02a0cea2-d4e0-4e4e-ba2e-e532a433cfef" AllowedRights = "FullControl" } ) @@ -1031,19 +1031,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service app exists and an empty list of members are specified, which does not match the desired state" -Fixture { $testParams = @{ ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" - Members = @() + SecurityType = "SharingPermissions" + Members = @() } Mock -CommandName Get-SPServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPServiceApplicationSecurity -MockWith { return @{ AccessRules = @( @{ - Name = "c:0%.c|system|02a0cea2-d4e0-4e4e-ba2e-e532a433cfef" + Name = "c:0%.c|system|02a0cea2-d4e0-4e4e-ba2e-e532a433cfef" AllowedRights = "FullControl" } ) @@ -1063,47 +1063,47 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Context -Name "Access level that includes other access levels is specified when multiple named access rights exists" -Fixture { $testParams = @{ - ServiceAppName = "Example Service App" - SecurityType = "SharingPermissions" + ServiceAppName = "Example Service App" + SecurityType = "SharingPermissions" MembersToInclude = @( (New-CimInstance -ClassName "MSFT_SPServiceAppSecurityEntry" ` - -ClientOnly ` - -Property @{ - Username = "CONTOSO\user1" - AccessLevels = "Contribute" - }) + -ClientOnly ` + -Property @{ + Username = "CONTOSO\user1" + AccessLevels = "Contribute" + }) ) } Mock -CommandName Get-SPServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName Get-SPServiceApplicationSecurity { $security = @{ NamedAccessRights = @( @{ - Name = "Full Control" + Name = "Full Control" Rights = @{ RightsFlags = 0xff } } @{ - Name = "Contribute" + Name = "Contribute" Rights = @{ RightsFlags = 0x0f } } @{ - Name = "Read" + Name = "Read" Rights = @{ RightsFlags = 0x01 } } ) - AccessRules = @( + AccessRules = @( @{ - Name = "CONTOSO\user1" + Name = "CONTOSO\user1" AllowedObjectRights = @{ RightsFlags = 0x0f @@ -1113,8 +1113,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $security.NamedAccessRights | ForEach-Object { $_.Rights } | Add-Member -MemberType ScriptMethod ` - -Name IsSubsetOf ` - -Value { + -Name IsSubsetOf ` + -Value { param($objectRights) return ($objectRights.RightsFlags -band $this.RightsFlags) -eq $this.RightsFlags } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceIdentity.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceIdentity.Tests.ps1 index 175468a52..c45b444e0 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceIdentity.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceIdentity.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPServiceIdentity" + -DscResource "SPServiceIdentity" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -39,30 +39,30 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Service is set to use the specified identity" -Fixture { $testParams = @{ - Name = "Claims to Windows Token Service" + Name = "Claims to Windows Token Service" ManagedAccount = "CONTOSO\svc.c2wts" } Mock -CommandName Get-SPServiceInstance -MockWith { - $ProcessIdentity = @{ - username = $testParams.ManagedAccount - } + $ProcessIdentity = @{ + username = $testParams.ManagedAccount + } - $ProcessIdentity = $ProcessIdentity | Add-Member -MemberType ScriptMethod -Name Update -Value { - $Global:SPDscSPServiceInstanceUpdateCalled = $true - } -PassThru + $ProcessIdentity = $ProcessIdentity | Add-Member -MemberType ScriptMethod -Name Update -Value { + $Global:SPDscSPServiceInstanceUpdateCalled = $true + } -PassThru - $ProcessIdentity = $ProcessIdentity | Add-Member -MemberType ScriptMethod -Name Deploy -Value { - } -PassThru + $ProcessIdentity = $ProcessIdentity | Add-Member -MemberType ScriptMethod -Name Deploy -Value { + } -PassThru - $ServiceIdentity = @{ - TypeName = $testParams.Name - Service = @{ - processidentity = $ProcessIdentity - } - } + $ServiceIdentity = @{ + TypeName = $testParams.Name + Service = @{ + processidentity = $ProcessIdentity + } + } - return $ServiceIdentity + return $ServiceIdentity } It "Should return the current identity from the get method" { @@ -77,30 +77,30 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Service is not set to use the specified identity" -Fixture { $testParams = @{ - Name = "Claims to Windows Token Service" + Name = "Claims to Windows Token Service" ManagedAccount = "CONTOSO\svc.c2wts" } Mock -CommandName Get-SPServiceInstance -MockWith { - $ProcessIdentity = @{ - username = "NT AUTHORITY\SYSTEM" - } + $ProcessIdentity = @{ + username = "NT AUTHORITY\SYSTEM" + } - $ProcessIdentity = $ProcessIdentity | Add-Member -MemberType ScriptMethod -Name Update -Value { - $Global:SPDscSPServiceInstanceUpdateCalled = $true - } -PassThru + $ProcessIdentity = $ProcessIdentity | Add-Member -MemberType ScriptMethod -Name Update -Value { + $Global:SPDscSPServiceInstanceUpdateCalled = $true + } -PassThru - $ProcessIdentity = $ProcessIdentity | Add-Member -MemberType ScriptMethod -Name Deploy -Value { - } -PassThru + $ProcessIdentity = $ProcessIdentity | Add-Member -MemberType ScriptMethod -Name Deploy -Value { + } -PassThru - $ServiceIdentity = @{ - TypeName = $testParams.Name - Service = @{ - processidentity = $ProcessIdentity - } - } + $ServiceIdentity = @{ + TypeName = $testParams.Name + Service = @{ + processidentity = $ProcessIdentity + } + } - return $ServiceIdentity + return $ServiceIdentity } It "Should return the current identity from the get method" { @@ -120,17 +120,17 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Search Service is not set to use the specified identity" -Fixture { $testParams = @{ - Name = "SharePoint Server Search" + Name = "SharePoint Server Search" ManagedAccount = "CONTOSO\svc.search" } Mock -CommandName Get-SPEnterpriseSearchService -MockWith { - $EnterpriseSearchService = @{} + $EnterpriseSearchService = @{ } $EnterpriseSearchService = $EnterpriseSearchService | Add-Member -MemberType ScriptMethod -Name get_ProcessIdentity -Value { $ProcessIdentity = @{ CurrentIdentityType = "account" - Username = "CONTOSO\wrong_account" + Username = "CONTOSO\wrong_account" } $ProcessIdentity = $ProcessIdentity | Add-Member -MemberType ScriptMethod -Name Update -Value { @@ -143,7 +143,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return $ProcessIdentity } -PassThru - return $EnterpriseSearchService + return $EnterpriseSearchService } It "Should return the current identity from the get method" { @@ -163,17 +163,17 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Search Service is not set to use the LocalSystem" -Fixture { $testParams = @{ - Name = "SharePoint Server Search" + Name = "SharePoint Server Search" ManagedAccount = "LocalSystem" } Mock -CommandName Get-SPEnterpriseSearchService -MockWith { - $EnterpriseSearchService = @{} + $EnterpriseSearchService = @{ } $EnterpriseSearchService = $EnterpriseSearchService | Add-Member -MemberType ScriptMethod -Name get_ProcessIdentity -Value { $ProcessIdentity = @{ CurrentIdentityType = "LocalService" - Username = "CONTOSO\wrong_account" + Username = "CONTOSO\wrong_account" } $ProcessIdentity = $ProcessIdentity | Add-Member -MemberType ScriptMethod -Name Update -Value { @@ -186,7 +186,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return $ProcessIdentity } -PassThru - return $EnterpriseSearchService + return $EnterpriseSearchService } It "Should return the current identity from the get method" { @@ -207,12 +207,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Invalid Service Specified" -Fixture { $testParams = @{ - Name = "No Such Windows Token Service" + Name = "No Such Windows Token Service" ManagedAccount = "CONTOSO\svc.c2wts" } Mock -CommandName Get-SPServiceInstance -MockWith { - return $null + return $null } It "Should return null from the get method" { @@ -225,14 +225,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should throw an error for the set method" { - {Set-TargetResource @testParams} | Should throw "Unable to locate service $($testParams.name)" + { Set-TargetResource @testParams } | Should throw "Unable to locate service $($testParams.name)" } } Context -Name "Invalid managed account specified" -Fixture { $testParams = @{ - Name = "Claims to Windows Token Service" + Name = "Claims to Windows Token Service" ManagedAccount = "CONTOSO\svc.badAccount" } @@ -241,25 +241,25 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-SPServiceInstance -MockWith { - $ProcessIdentity = @{ - username = "CONTOSO\svc.c2wts" - } + $ProcessIdentity = @{ + username = "CONTOSO\svc.c2wts" + } - $ProcessIdentity = $ProcessIdentity | Add-Member -MemberType ScriptMethod -Name Update -Value { - $Global:SPDscSPServiceInstanceUpdateCalled = $true - } -PassThru + $ProcessIdentity = $ProcessIdentity | Add-Member -MemberType ScriptMethod -Name Update -Value { + $Global:SPDscSPServiceInstanceUpdateCalled = $true + } -PassThru - $ProcessIdentity = $ProcessIdentity | Add-Member -MemberType ScriptMethod -Name Deploy -Value { - } -PassThru + $ProcessIdentity = $ProcessIdentity | Add-Member -MemberType ScriptMethod -Name Deploy -Value { + } -PassThru - $ServiceIdentity = @{ - TypeName = $testParams.Name - Service = @{ - processidentity = $ProcessIdentity - } - } + $ServiceIdentity = @{ + TypeName = $testParams.Name + Service = @{ + processidentity = $ProcessIdentity + } + } - return $ServiceIdentity + return $ServiceIdentity } It "Should return the current identity from the get method" { @@ -272,14 +272,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should throw an error for the set method" { - {Set-TargetResource @testParams} | Should throw "Unable to locate Managed Account $($testParams.ManagedAccount)" + { Set-TargetResource @testParams } | Should throw "Unable to locate Managed Account $($testParams.ManagedAccount)" } } Context -Name "Service does not support setting process identity" -Fixture { $testParams = @{ - Name = "Machine Translation Service" + Name = "Machine Translation Service" ManagedAccount = "CONTOSO\svc.mts" } @@ -288,14 +288,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-SPServiceInstance -MockWith { - $ServiceIdentity = @{ - TypeName = $testParams.Name - Service = @{ - TypeName = $testParams.Name - } - } + $ServiceIdentity = @{ + TypeName = $testParams.Name + Service = @{ + TypeName = $testParams.Name + } + } - return $ServiceIdentity + return $ServiceIdentity } It "Should return null for the current identity from the get method" { @@ -307,10 +307,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should throw an error for the set method" { - Mock -CommandName Get-SPManagedAccount -MockWith { - return "CONTOSO\svc.mts" - } - {Set-TargetResource @testParams} | Should throw "Service $($testParams.name) does not support setting the process identity" + Mock -CommandName Get-SPManagedAccount -MockWith { + return "CONTOSO\svc.mts" + } + { Set-TargetResource @testParams } | Should throw "Service $($testParams.name) does not support setting the process identity" } } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceInstance.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceInstance.Tests.ps1 index 9c52690af..3420ba496 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceInstance.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPServiceInstance.Tests.ps1 @@ -1,36 +1,36 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPServiceInstance" + -DscResource "SPServiceInstance" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - # Mocks for all contexts + # Mocks for all contexts Mock -CommandName Start-SPServiceInstance -MockWith { } Mock -CommandName Stop-SPServiceInstance -MockWith { } # Test contexts Context -Name "The service instance is not running but should be" -Fixture { $testParams = @{ - Name = "Service pool" + Name = "Service pool" Ensure = "Present" } - Mock -CommandName Get-SPServiceInstance -MockWith { - return @() + Mock -CommandName Get-SPServiceInstance -MockWith { + return @() } It "Should return absent from the get method" { @@ -44,15 +44,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service instance is not running but should be" -Fixture { $testParams = @{ - Name = "Service pool" + Name = "Service pool" Ensure = "Present" } - - Mock -CommandName Get-SPServiceInstance -MockWith { + + Mock -CommandName Get-SPServiceInstance -MockWith { return @(@{ - TypeName = $testParams.Name - Status = "Disabled" - }) + TypeName = $testParams.Name + Status = "Disabled" + }) } It "Should return absent from the get method" { @@ -71,15 +71,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service instance is running and should be" -Fixture { $testParams = @{ - Name = "Service pool" + Name = "Service pool" Ensure = "Present" } - - Mock -CommandName Get-SPServiceInstance -MockWith { + + Mock -CommandName Get-SPServiceInstance -MockWith { return @(@{ - TypeName = $testParams.Name - Status = "Online" - }) + TypeName = $testParams.Name + Status = "Online" + }) } It "Should return present from the get method" { @@ -93,12 +93,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "An invalid service application is specified to start" -Fixture { $testParams = @{ - Name = "Service pool" + Name = "Service pool" Ensure = "Present" } - - Mock -CommandName Get-SPServiceInstance { - return $null + + Mock -CommandName Get-SPServiceInstance { + return $null } It "Should throw when the set method is called" { @@ -108,15 +108,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service instance is not running and should not be" -Fixture { $testParams = @{ - Name = "Service pool" + Name = "Service pool" Ensure = "Absent" } - - Mock -CommandName Get-SPServiceInstance -MockWith { + + Mock -CommandName Get-SPServiceInstance -MockWith { return @(@{ - TypeName = $testParams.Name - Status = "Disabled" - }) + TypeName = $testParams.Name + Status = "Disabled" + }) } It "Should return absent from the get method" { @@ -130,15 +130,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The service instance is running and should not be" -Fixture { $testParams = @{ - Name = "Service pool" + Name = "Service pool" Ensure = "Absent" } - - Mock -CommandName Get-SPServiceInstance -MockWith { + + Mock -CommandName Get-SPServiceInstance -MockWith { return @(@{ - TypeName = $testParams.Name - Status = "Online" - }) + TypeName = $testParams.Name + Status = "Online" + }) } It "Should return present from the get method" { @@ -158,12 +158,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "An invalid service application is specified to stop" -Fixture { $testParams = @{ - Name = "Service pool" + Name = "Service pool" Ensure = "Absent" } - - Mock -CommandName Get-SPServiceInstance { - return $null + + Mock -CommandName Get-SPServiceInstance { + return $null } It "Should throw when the set method is called" { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSessionStateService.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSessionStateService.Tests.ps1 index 24817ab32..a89475871 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSessionStateService.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSessionStateService.Tests.ps1 @@ -1,44 +1,44 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSessionStateService" + -DscResource "SPSessionStateService" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - # Mocks for all contexts - Mock -CommandName Set-SPSessionStateService -MockWith { return @{} } - Mock -CommandName Enable-SPSessionStateService -MockWith { return @{} } - Mock -CommandName Disable-SPSessionStateService -MockWith { return @{} } + # Mocks for all contexts + Mock -CommandName Set-SPSessionStateService -MockWith { return @{ } } + Mock -CommandName Enable-SPSessionStateService -MockWith { return @{ } } + Mock -CommandName Disable-SPSessionStateService -MockWith { return @{ } } # Test contexts Context -Name "the service isn't enabled but should be" -Fixture { $testParams = @{ - DatabaseName = "SP_StateService" + DatabaseName = "SP_StateService" DatabaseServer = "SQL.test.domain" - Ensure = "Present" + Ensure = "Present" SessionTimeout = 60 } - Mock -CommandName Get-SPSessionStateService -MockWith { - return @{ + Mock -CommandName Get-SPSessionStateService -MockWith { + return @{ SessionStateEnabled = $false - Timeout = @{ + Timeout = @{ TotalMinutes = 60 } - } + } } It "Should return absent from the get method" { @@ -50,7 +50,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should enable the session service from the set method" { - Set-TargetResource @testParams + Set-TargetResource @testParams Assert-MockCalled Enable-SPSessionStateService } @@ -58,19 +58,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "the service is enabled and should be" -Fixture { $testParams = @{ - DatabaseName = "SP_StateService" + DatabaseName = "SP_StateService" DatabaseServer = "SQL.test.domain" - Ensure = "Present" + Ensure = "Present" SessionTimeout = 60 } - - Mock -CommandName Get-SPSessionStateService -MockWith { - return @{ + + Mock -CommandName Get-SPSessionStateService -MockWith { + return @{ SessionStateEnabled = $true - Timeout = @{ + Timeout = @{ TotalMinutes = 60 } - } + } } It "Should return present from the get method" { @@ -81,26 +81,26 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Test-TargetResource @testParams | Should Be $true } } - + Context -Name "the timeout should be set to 90 seconds but is 60" -Fixture { $testParams = @{ - DatabaseName = "SP_StateService" + DatabaseName = "SP_StateService" DatabaseServer = "SQL.test.domain" - Ensure = "Present" + Ensure = "Present" SessionTimeout = 90 } - - Mock -CommandName Get-SPSessionStateService -MockWith { - return @{ + + Mock -CommandName Get-SPSessionStateService -MockWith { + return @{ SessionStateEnabled = $true - Timeout = @{ + Timeout = @{ TotalMinutes = 60 } - } + } } It "Should return present from the get method" { - $result = Get-TargetResource @testParams + $result = Get-TargetResource @testParams $result.Ensure | Should Be "Present" $result.SessionTimeout | Should Be 60 } @@ -108,28 +108,28 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $false } - + It "Should update session timeout to 90 seconds" { - Set-TargetResource @testParams + Set-TargetResource @testParams - Assert-MockCalled Set-SPSessionStateService + Assert-MockCalled Set-SPSessionStateService } } - + Context -Name "the service is enabled but shouldn't be" -Fixture { $testParams = @{ - DatabaseName = "SP_StateService" + DatabaseName = "SP_StateService" DatabaseServer = "SQL.test.domain" - Ensure = "Absent" + Ensure = "Absent" } - - Mock -CommandName Get-SPSessionStateService -MockWith { - return @{ + + Mock -CommandName Get-SPSessionStateService -MockWith { + return @{ SessionStateEnabled = $true - Timeout = @{ + Timeout = @{ TotalMinutes = 60 } - } + } } It "Should return present from the get method" { @@ -141,27 +141,27 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "disable the session service from the set method" { - Set-TargetResource @testParams + Set-TargetResource @testParams Assert-MockCalled Disable-SPSessionStateService } } - + Context -Name "the service is disabled and should be" -Fixture { $testParams = @{ - DatabaseName = "SP_StateService" + DatabaseName = "SP_StateService" DatabaseServer = "SQL.test.domain" - Ensure = "Absent" + Ensure = "Absent" } - - Mock -CommandName Get-SPSessionStateService -MockWith { - return @{ + + Mock -CommandName Get-SPSessionStateService -MockWith { + return @{ SessionStateEnabled = $false - Timeout = @{ + Timeout = @{ TotalMinutes = 60 } - } + } } - + It "Should return enabled from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPShellAdmins.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPShellAdmins.Tests.ps1 index 07b8e8fc7..3628cb159 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPShellAdmins.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPShellAdmins.Tests.ps1 @@ -3,24 +3,24 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPShellAdmins" + -DscResource "SPShellAdmins" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope # Mocks for all contexts - Mock -CommandName Add-SPShellAdmin -MockWith {} - Mock -CommandName Remove-SPShellAdmin -MockWith {} + Mock -CommandName Add-SPShellAdmin -MockWith { } + Mock -CommandName Remove-SPShellAdmin -MockWith { } # Test contexts Context -Name "The server is not part of SharePoint farm" -Fixture { @@ -53,13 +53,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $testParams = @{ IsSingleInstance = "Yes" Members = "contoso\user1", "contoso\user2" - Databases = @( + Databases = @( (New-CimInstance -ClassName MSFT_SPContentDatabasePermissions -Property @{ - Name = "SharePoint_Content_Contoso1" - Members = "contoso\user1", "contoso\user2" - } -ClientOnly) + Name = "SharePoint_Content_Contoso1" + Members = "contoso\user1", "contoso\user2" + } -ClientOnly) ) - AllDatabases = $true + AllDatabases = $true } It "Should return null from the get method" { @@ -125,12 +125,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Members and MembersToInclude parameters used simultaneously - Database permissions" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - Databases = @( + Databases = @( (New-CimInstance -ClassName MSFT_SPDatabasePermissions -Property @{ - Name = "SharePoint_Content_Contoso1" - Members = "contoso\user1", "contoso\user2" - MembersToInclude = "contoso\user1", "contoso\user2" - } -ClientOnly) + Name = "SharePoint_Content_Contoso1" + Members = "contoso\user1", "contoso\user2" + MembersToInclude = "contoso\user1", "contoso\user2" + } -ClientOnly) ) } @@ -153,11 +153,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Databases and ExcludeDatabases parameters used simultaneously" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - Databases = @( + Databases = @( (New-CimInstance -ClassName MSFT_SPDatabasePermissions -Property @{ - Name = "SharePoint_Content_Contoso1" - Members = "contoso\user1", "contoso\user2" - } -ClientOnly) + Name = "SharePoint_Content_Contoso1" + Members = "contoso\user1", "contoso\user2" + } -ClientOnly) ) ExcludeDatabases = "SharePoint_Content_Contoso2" } @@ -178,10 +178,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "None of the Members, MembersToInclude and MembersToExclude parameters are used - Database permissions" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - Databases = @( + Databases = @( (New-CimInstance -ClassName MSFT_SPDatabasePermissions -Property @{ - Name = "SharePoint_Content_Contoso1" - } -ClientOnly) + Name = "SharePoint_Content_Contoso1" + } -ClientOnly) ) } @@ -204,11 +204,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Specified content database does not exist - Database permissions" -Fixture { $testParams = @{ IsSingleInstance = "Yes" - Databases = @( + Databases = @( (New-CimInstance -ClassName MSFT_SPDatabasePermissions -Property @{ - Name = "SharePoint_Content_Contoso3" - Members = "contoso\user1", "contoso\user2" - } -ClientOnly) + Name = "SharePoint_Content_Contoso3" + Members = "contoso\user1", "contoso\user2" + } -ClientOnly) ) } @@ -242,7 +242,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $testParams = @{ IsSingleInstance = "Yes" Members = "contoso\user1", "contoso\user2" - AllDatabases = $true + AllDatabases = $true } Mock -CommandName Get-SPShellAdmin -MockWith { @@ -250,14 +250,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { # Database parameter used, return database permissions return @{ - UserName = "contoso\user3","contoso\user4" + UserName = "contoso\user3", "contoso\user4" } } else { # Database parameter not used, return general permissions return @{ - UserName = "contoso\user3","contoso\user4" + UserName = "contoso\user3", "contoso\user4" } } } @@ -303,14 +303,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { # Database parameter used, return database permissions return @{ - UserName = "contoso\user3","contoso\user4" + UserName = "contoso\user3", "contoso\user4" } } else { # Database parameter not used, return general permissions return @{ - UserName = "contoso\user1","contoso\user2" + UserName = "contoso\user1", "contoso\user2" } } } @@ -357,12 +357,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { if ($database) { # Database parameter used, return database permissions - return @{} + return @{ } } else { # Database parameter not used, return general permissions - return @{ UserName = "contoso\user3","contoso\user4" } + return @{ UserName = "contoso\user3", "contoso\user4" } } } @@ -391,7 +391,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { if ($database) { # Database parameter used, return database permissions - return @{} + return @{ } } else { @@ -416,13 +416,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { IsSingleInstance = "Yes" Databases = @( (New-CimInstance -ClassName MSFT_SPDatabasePermissions -Property @{ - Name = "SharePoint_Content_Contoso1" - Members = "contoso\user1", "contoso\user2" - } -ClientOnly) + Name = "SharePoint_Content_Contoso1" + Members = "contoso\user1", "contoso\user2" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPDatabasePermissions -Property @{ - Name = "SharePoint_Content_Contoso2" - Members = "contoso\user1", "contoso\user2" - } -ClientOnly) + Name = "SharePoint_Content_Contoso2" + Members = "contoso\user1", "contoso\user2" + } -ClientOnly) ) } @@ -431,14 +431,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { # Database parameter used, return database permissions return @{ - UserName = "contoso\user3","contoso\user4" + UserName = "contoso\user3", "contoso\user4" } } else { # Database parameter not used, return general permissions return @{ - UserName = "contoso\user1","contoso\user2" + UserName = "contoso\user1", "contoso\user2" } } } @@ -476,13 +476,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { IsSingleInstance = "Yes" Databases = @( (New-CimInstance -ClassName MSFT_SPDatabasePermissions -Property @{ - Name = "SharePoint_Content_Contoso1" - Members = "contoso\user1", "contoso\user2" - } -ClientOnly) + Name = "SharePoint_Content_Contoso1" + Members = "contoso\user1", "contoso\user2" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPDatabasePermissions -Property @{ - Name = "SharePoint_Content_Contoso2" - Members = "contoso\user1", "contoso\user2" - } -ClientOnly) + Name = "SharePoint_Content_Contoso2" + Members = "contoso\user1", "contoso\user2" + } -ClientOnly) ) } @@ -491,14 +491,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { # Database parameter used, return database permissions return @{ - UserName = "contoso\user1","contoso\user2" + UserName = "contoso\user1", "contoso\user2" } } else { # Database parameter not used, return general permissions return @{ - UserName = "contoso\user1","contoso\user2" + UserName = "contoso\user1", "contoso\user2" } } } @@ -535,13 +535,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { if ($database) { # Database parameter used, return database permissions - return @{} + return @{ } } else { # Database parameter not used, return general permissions return @{ - UserName = "contoso\user3","contoso\user4" + UserName = "contoso\user3", "contoso\user4" } } } @@ -570,7 +570,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { if ($database) { # Database parameter used, return database permissions - return @{} + return @{ } } else { @@ -595,13 +595,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { IsSingleInstance = "Yes" Databases = @( (New-CimInstance -ClassName MSFT_SPDatabasePermissions -Property @{ - Name = "SharePoint_Content_Contoso1" - MembersToInclude = "contoso\user1", "contoso\user2" - } -ClientOnly) + Name = "SharePoint_Content_Contoso1" + MembersToInclude = "contoso\user1", "contoso\user2" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPDatabasePermissions -Property @{ - Name = "SharePoint_Content_Contoso2" - MembersToInclude = "contoso\user1", "contoso\user2" - } -ClientOnly) + Name = "SharePoint_Content_Contoso2" + MembersToInclude = "contoso\user1", "contoso\user2" + } -ClientOnly) ) } @@ -610,14 +610,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { # Database parameter used, return database permissions return @{ - UserName = "contoso\user3","contoso\user4" + UserName = "contoso\user3", "contoso\user4" } } else { # Database parameter not used, return general permissions return @{ - UserName = "contoso\user1","contoso\user2" + UserName = "contoso\user1", "contoso\user2" } } } @@ -654,13 +654,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { IsSingleInstance = "Yes" Databases = @( (New-CimInstance -ClassName MSFT_SPDatabasePermissions -Property @{ - Name = "SharePoint_Content_Contoso1" - MembersToInclude = "contoso\user1", "contoso\user2" - } -ClientOnly) + Name = "SharePoint_Content_Contoso1" + MembersToInclude = "contoso\user1", "contoso\user2" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPDatabasePermissions -Property @{ - Name = "SharePoint_Content_Contoso2" - MembersToInclude = "contoso\user1", "contoso\user2" - } -ClientOnly) + Name = "SharePoint_Content_Contoso2" + MembersToInclude = "contoso\user1", "contoso\user2" + } -ClientOnly) ) } @@ -669,14 +669,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { # Database parameter used, return database permissions return @{ - UserName = "contoso\user1","contoso\user2", "contoso\user3" + UserName = "contoso\user1", "contoso\user2", "contoso\user3" } } else { # Database parameter not used, return general permissions return @{ - UserName = "contoso\user1","contoso\user2" + UserName = "contoso\user1", "contoso\user2" } } } @@ -713,13 +713,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { if ($database) { # Database parameter used, return database permissions - return @{} + return @{ } } else { # Database parameter not used, return general permissions return @{ - UserName = "contoso\user1","contoso\user2" + UserName = "contoso\user1", "contoso\user2" } } } @@ -748,7 +748,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { if ($database) { # Database parameter used, return database permissions - return @{} + return @{ } } else { @@ -773,13 +773,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { IsSingleInstance = "Yes" Databases = @( (New-CimInstance -ClassName MSFT_SPDatabasePermissions -Property @{ - Name = "SharePoint_Content_Contoso1" - MembersToExclude = "contoso\user1", "contoso\user2" - } -ClientOnly) + Name = "SharePoint_Content_Contoso1" + MembersToExclude = "contoso\user1", "contoso\user2" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPDatabasePermissions -Property @{ - Name = "SharePoint_Content_Contoso2" - MembersToExclude = "contoso\user1", "contoso\user2" - } -ClientOnly) + Name = "SharePoint_Content_Contoso2" + MembersToExclude = "contoso\user1", "contoso\user2" + } -ClientOnly) ) } @@ -788,14 +788,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { # Database parameter used, return database permissions return @{ - UserName = "contoso\user1","contoso\user2" + UserName = "contoso\user1", "contoso\user2" } } else { # Database parameter not used, return general permissions return @{ - UserName = "contoso\user1","contoso\user2" + UserName = "contoso\user1", "contoso\user2" } } } @@ -832,13 +832,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { IsSingleInstance = "Yes" Databases = @( (New-CimInstance -ClassName MSFT_SPDatabasePermissions -Property @{ - Name = "SharePoint_Content_Contoso1" - MembersToExclude = "contoso\user3", "contoso\user4" - } -ClientOnly) + Name = "SharePoint_Content_Contoso1" + MembersToExclude = "contoso\user3", "contoso\user4" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPDatabasePermissions -Property @{ - Name = "SharePoint_Content_Contoso2" - MembersToExclude = "contoso\user5", "contoso\user6" - } -ClientOnly) + Name = "SharePoint_Content_Contoso2" + MembersToExclude = "contoso\user5", "contoso\user6" + } -ClientOnly) ) } @@ -847,14 +847,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { # Database parameter used, return database permissions return @{ - UserName = "contoso\user1","contoso\user2" + UserName = "contoso\user1", "contoso\user2" } } else { # Database parameter not used, return general permissions return @{ - UserName = "contoso\user1","contoso\user2" + UserName = "contoso\user1", "contoso\user2" } } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSite.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSite.Tests.ps1 index a5ef2d35b..96f3e776e 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSite.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSite.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSite" + -DscResource "SPSite" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -41,27 +41,27 @@ namespace Microsoft.SharePoint.Administration { $siteImplementation = { $rootWeb = @{ - AssociatedVisitorGroup = $null - AssociatedMemberGroup = $null - AssociatedOwnerGroup = $null + AssociatedVisitorGroup = $null + AssociatedMemberGroup = $null + AssociatedOwnerGroup = $null CreateDefaultAssociatedGroupsCalled = $false } $rootWeb | Add-Member -MemberType ScriptMethod ` - -Name CreateDefaultAssociatedGroups ` - -Value { - $this.CreateDefaultAssociatedGroupsCalled = $true - } + -Name CreateDefaultAssociatedGroups ` + -Value { + $this.CreateDefaultAssociatedGroupsCalled = $true + } $site = @{ - HostHeaderIsSiteName = $false - WebApplication = @{ - Url = "https://site.contoso.com" + HostHeaderIsSiteName = $false + WebApplication = @{ + Url = "https://site.contoso.com" UseClaimsAuthentication = $true } - Url = "https://site.contoso.com" - Owner = @{ UserLogin = "DEMO\owner" } - Quota = @{ QuotaId = 65000 } - RootWeb = $rootWeb + Url = "https://site.contoso.com" + Owner = @{ UserLogin = "DEMO\owner" } + Quota = @{ QuotaId = 65000 } + RootWeb = $rootWeb AdministrationSiteType = "None" } return $site @@ -71,7 +71,7 @@ namespace Microsoft.SharePoint.Administration { Mock -CommandName Get-SPSite -MockWith { return @{ - Id = 1 + Id = 1 SystemAccount = @{ UserToken = "CentralAdminSystemAccountUserToken" } @@ -90,23 +90,23 @@ namespace Microsoft.SharePoint.Administration { } Mock -CommandName New-SPSite -MockWith { - $rootWeb = @{} + $rootWeb = @{ } $rootWeb = $rootWeb | Add-Member -MemberType ScriptMethod ` - -Name CreateDefaultAssociatedGroups ` - -Value {} -PassThru + -Name CreateDefaultAssociatedGroups ` + -Value { } -PassThru $returnval = @{ HostHeaderIsSiteName = $true - WebApplication = @{ - Url = $testParams.Url + WebApplication = @{ + Url = $testParams.Url UseClaimsAuthentication = $false } - Url = $testParams.Url - Owner = @{ UserLogin = "DEMO\owner" } - SecondaryContact = @{ UserLogin = "DEMO\secondowner" } - Quota = @{ + Url = $testParams.Url + Owner = @{ UserLogin = "DEMO\owner" } + SecondaryContact = @{ UserLogin = "DEMO\secondowner" } + Quota = @{ QuotaId = 1 } - RootWeb = $rootWeb + RootWeb = $rootWeb } return $returnval } @@ -116,24 +116,24 @@ namespace Microsoft.SharePoint.Administration { QuotaId = 65000 } }) - $quotaTemplatesCol = {$quotaTemplates}.Invoke() + $quotaTemplatesCol = { $quotaTemplates }.Invoke() $contentService = @{ QuotaTemplates = $quotaTemplatesCol } $contentService = $contentService | Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value { - $Global:SPDscQuotaTemplatesUpdated = $true - } -PassThru + -Name Update ` + -Value { + $Global:SPDscQuotaTemplatesUpdated = $true + } -PassThru return $contentService } # Test contexts Context -Name "The site doesn't exist yet and should" -Fixture { $testParams = @{ - Url = "http://site.sharepoint.com" + Url = "http://site.sharepoint.com" OwnerAlias = "DEMO\User" } @@ -199,7 +199,7 @@ namespace Microsoft.SharePoint.Administration { return $site } - Mock -CommandName Set-SPSite -MockWith {} -ParameterFilter { + Mock -CommandName Set-SPSite -MockWith { } -ParameterFilter { $OwnerAlias = "DEMO\User" $SecondaryOwnerAlias = "DEMO\SecondUser" $QuotaTemplate = "Test" @@ -207,21 +207,21 @@ namespace Microsoft.SharePoint.Administration { } Mock -CommandName Get-SPDscContentService -MockWith { $quotaTemplates = @(@{ - QuotaId = 1 - Name = "WrongTemplate" - WrongTemplate = @{ - StorageMaximumLevel = 512 - StorageWarningLevel = 256 + QuotaId = 1 + Name = "WrongTemplate" + WrongTemplate = @{ + StorageMaximumLevel = 512 + StorageWarningLevel = 256 UserCodeMaximumLevel = 400 UserCodeWarningLevel = 200 } }) - $quotaTemplatesCol = {$quotaTemplates}.Invoke() + $quotaTemplatesCol = { $quotaTemplates }.Invoke() $contentService = @{ QuotaTemplates = $quotaTemplatesCol } - return $contentService + return $contentService } It "Should return the site data from the get method" { @@ -244,7 +244,7 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The site exists and is a host named site collection" -Fixture { $testParams = @{ - Url = "http://site.sharepoint.com" + Url = "http://site.sharepoint.com" OwnerAlias = "DEMO\owner" } @@ -289,7 +289,7 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The site exists, but doesn't have default groups configured" -Fixture { $testParams = @{ - Url = "http://site.sharepoint.com" + Url = "http://site.sharepoint.com" OwnerAlias = "DEMO\User" } @@ -326,7 +326,7 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The site exists and uses claims authentication" -Fixture { $testParams = @{ - Url = "http://site.sharepoint.com" + Url = "http://site.sharepoint.com" OwnerAlias = "DEMO\User" } @@ -409,7 +409,7 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The site exists and uses classic authentication" -Fixture { $testParams = @{ - Url = "http://site.sharepoint.com" + Url = "http://site.sharepoint.com" OwnerAlias = "DEMO\owner" } @@ -455,14 +455,14 @@ namespace Microsoft.SharePoint.Administration { Mock -CommandName Get-SPSite -MockWith { return @{ HostHeaderIsSiteName = $false - WebApplication = @{ - Url = $testParams.Url + WebApplication = @{ + Url = $testParams.Url UseClaimsAuthentication = $false } - Url = $testParams.Url - Owner = @{ UserLogin = "DEMO\owner" } - SecondaryContact = @{ UserLogin = "DEMO\secondary" } - Quota = @{ QuotaId = 65000 } + Url = $testParams.Url + Owner = @{ UserLogin = "DEMO\owner" } + SecondaryContact = @{ UserLogin = "DEMO\secondary" } + Quota = @{ QuotaId = 65000 } } } @@ -473,8 +473,8 @@ namespace Microsoft.SharePoint.Administration { Context -Name "CreateDefaultGroups is set to false, don't correct anything" -Fixture { $testParams = @{ - Url = "http://site.sharepoint.com" - OwnerAlias = "DEMO\owner" + Url = "http://site.sharepoint.com" + OwnerAlias = "DEMO\owner" CreateDefaultGroups = $false } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSitePropertyBag.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSitePropertyBag.Tests.ps1 index cf34de32e..3c84e9591 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSitePropertyBag.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSitePropertyBag.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSitePropertyBag" + -DscResource "SPSitePropertyBag" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -35,8 +35,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } -PassThru $returnval = @{ - Properties = $prop - AllProperties = @{} + Properties = $prop + AllProperties = @{ } } $returnval = $returnval | Add-Member ScriptMethod Update { @@ -76,13 +76,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Url = "http://sharepoint.contoso.com" Key = 'PropertyKey' Value = 'NewPropertyValue' - Ensure ='Present' + Ensure = 'Present' } It 'Should return present from the get method' { $result = Get-TargetResource @testParams $result.Ensure | Should Be 'Present' - $result.Key | Should Be $testParams.Key + $result.Key | Should Be $testParams.Key } It 'Should return false from the test method' { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSiteUrl.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSiteUrl.Tests.ps1 index 5b07d5b1e..4348fc930 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSiteUrl.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSiteUrl.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSiteUrl" + -DscResource "SPSiteUrl" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -27,15 +27,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $global:SpDscSPSiteUrlRanOnce = $true return @( @{ - Url = "http://sharepoint.contoso.intra" + Url = "http://sharepoint.contoso.intra" Zone = "Default" }, @{ - Url = "http://sharepoint.contoso.com" + Url = "http://sharepoint.contoso.com" Zone = "Intranet" }, @{ - Url = "https://sharepoint.contoso.com" + Url = "https://sharepoint.contoso.com" Zone = "Internet" } ) @@ -50,7 +50,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Test contexts Context -Name "No zones specified" -Fixture { $testParams = @{ - Url = "http://sharepoint.contoso.intra" + Url = "http://sharepoint.contoso.intra" } Mock -CommandName Get-SPSite -MockWith { return $null } @@ -128,7 +128,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPSiteUrl -MockWith { return @( @{ - Url = "http://sharepoint.contoso.intra" + Url = "http://sharepoint.contoso.intra" Zone = "Default" } ) @@ -154,7 +154,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPSiteUrl -MockWith { return @( @{ - Url = "http://sharepoint.contoso.intra" + Url = "http://sharepoint.contoso.intra" Zone = "Default" } ) @@ -180,7 +180,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPSiteUrl -MockWith { return @( @{ - Url = "http://sharepoint.contoso.intra" + Url = "http://sharepoint.contoso.intra" Zone = "Default" } ) @@ -193,7 +193,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The site exists, but the specified Custom is already in use" -Fixture { $testParams = @{ - Url = "http://sharepoint.contoso.intra" + Url = "http://sharepoint.contoso.intra" Custom = "http://sharepoint.contoso.com" } @@ -206,7 +206,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPSiteUrl -MockWith { return @( @{ - Url = "http://sharepoint.contoso.intra" + Url = "http://sharepoint.contoso.intra" Zone = "Default" } ) @@ -265,23 +265,23 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $global:SpDscSPSiteUrlRanOnce = $true return @( @{ - Url = "http://sharepoint.contoso.intra" + Url = "http://sharepoint.contoso.intra" Zone = "Default" }, @{ - Url = "http://sharepoint.contoso.com" + Url = "http://sharepoint.contoso.com" Zone = "Extranet" }, @{ - Url = "https://sharepoint.contoso.com" + Url = "https://sharepoint.contoso.com" Zone = "Custom" } ) - } - else - { - return $null - } + } + else + { + return $null + } } $global:SpDscSPSiteUrlRanOnce = $false @@ -322,15 +322,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $global:SpDscSPSiteUrlRanOnce = $true return @( @{ - Url = "http://sharepoint.contoso.intra" + Url = "http://sharepoint.contoso.intra" Zone = "Default" }, @{ - Url = "http://sharepoint.contoso.com" + Url = "http://sharepoint.contoso.com" Zone = "Intranet" }, @{ - Url = "https://sharepoint.contoso.com" + Url = "https://sharepoint.contoso.com" Zone = "Internet" } ) diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPStateServiceApp.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPStateServiceApp.Tests.ps1 index c90bc07a9..e7675411e 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPStateServiceApp.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPStateServiceApp.Tests.ps1 @@ -4,16 +4,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPStateServiceApp" + -DscResource "SPStateServiceApp" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -22,23 +22,23 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Initialize tests $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force $mockCredential = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList @("username", $mockPassword) + -ArgumentList @("username", $mockPassword) # Mocks for all contexts - Mock -CommandName New-SPStateServiceDatabase -MockWith { return @{} } - Mock -CommandName New-SPStateServiceApplication -MockWith { return @{} } - Mock -CommandName New-SPStateServiceApplicationProxy -MockWith { return @{} } + Mock -CommandName New-SPStateServiceDatabase -MockWith { return @{ } } + Mock -CommandName New-SPStateServiceApplication -MockWith { return @{ } } + Mock -CommandName New-SPStateServiceApplicationProxy -MockWith { return @{ } } Mock -CommandName Remove-SPServiceApplication -MockWith { } # Test contexts Context -Name "the service app doesn't exist and should" -Fixture { $testParams = @{ - Name = "State Service App" - ProxyName = "State Service Proxy" - DatabaseName = "SP_StateService" - DatabaseServer = "SQL.test.domain" + Name = "State Service App" + ProxyName = "State Service Proxy" + DatabaseName = "SP_StateService" + DatabaseServer = "SQL.test.domain" DatabaseCredentials = $mockCredential - Ensure = "Present" + Ensure = "Present" } Mock -CommandName New-SPStateServiceApplication -MockWith { @@ -46,9 +46,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Name = $testParams.Name } $returnVal = $returnVal | Add-Member -MemberType ScriptMethod ` - -Name IsConnected -Value { - return $true - } -PassThru + -Name IsConnected -Value { + return $true + } -PassThru return $returnVal } @@ -56,14 +56,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPServiceApplicationProxy -MockWith { $proxiesToReturn = @() $proxy = @{ - Name = $testParams.ProxyName + Name = $testParams.ProxyName DisplayName = $testParams.ProxyName } $proxy = $proxy | Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value {} ` - -PassThru - $proxiesToReturn += $proxy + -Name Delete ` + -Value { } ` + -PassThru + $proxiesToReturn += $proxy return $proxiesToReturn } @@ -85,36 +85,36 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "the service app exists and should" -Fixture { $testParams = @{ - Name = "State Service App" - DatabaseName = "SP_StateService" - DatabaseServer = "SQL.test.domain" + Name = "State Service App" + DatabaseName = "SP_StateService" + DatabaseServer = "SQL.test.domain" DatabaseCredentials = $mockCredential - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPStateServiceApplication -MockWith { $returnVal = @{ DisplayName = $testParams.Name - Name = $testParams.Name + Name = $testParams.Name } $returnVal = $returnVal | Add-Member -MemberType ScriptMethod ` - -Name IsConnected -Value { - return $true - } -PassThru + -Name IsConnected -Value { + return $true + } -PassThru return $returnVal } Mock -CommandName Get-SPServiceApplicationProxy -MockWith { $proxiesToReturn = @() $proxy = @{ - Name = $testParams.ProxyName + Name = $testParams.ProxyName DisplayName = $testParams.ProxyName } $proxy = $proxy | Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value {} ` - -PassThru - $proxiesToReturn += $proxy + -Name Delete ` + -Value { } ` + -PassThru + $proxiesToReturn += $proxy return $proxiesToReturn } @@ -130,9 +130,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service app exists but it shouldn't" -Fixture { $testParams = @{ - Name = "State Service App" + Name = "State Service App" DatabaseName = "-" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPStateServiceApplication -MockWith { @@ -157,9 +157,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service app doesn't exist and shouldn't" -Fixture { $testParams = @{ - Name = "State Service App" + Name = "State Service App" DatabaseName = "-" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication -MockWith { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPSubscriptionSettingsServiceApp.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPSubscriptionSettingsServiceApp.Tests.ps1 index 1fa6678ff..c7018dd8c 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPSubscriptionSettingsServiceApp.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPSubscriptionSettingsServiceApp.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPSubscriptionSettingsServiceApp" + -DscResource "SPSubscriptionSettingsServiceApp" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -23,10 +23,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Mocks for all contexts Mock -CommandName New-SPSubscriptionSettingsServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName New-SPSubscriptionSettingsServiceApplicationProxy -MockWith { - return @{} + return @{ } } Mock -CommandName Set-SPSubscriptionSettingsServiceApplication -MockWith { } Mock -CommandName Remove-SPServiceApplication -MockWith { } @@ -34,11 +34,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Test contexts Context -Name "When no service applications exist in the current farm" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "Test App Pool" - DatabaseName = "Test_DB" - DatabaseServer = "TestServer\Instance" - Ensure = "Present" + DatabaseName = "Test_DB" + DatabaseServer = "TestServer\Instance" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { @@ -46,11 +46,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName New-SPSubscriptionSettingsServiceApplication -MockWith { - return @{} + return @{ } } Mock -CommandName New-SPSubscriptionSettingsServiceApplicationProxy -MockWith { - return @{} + return @{ } } It "Should return absent from the Get method" { @@ -70,24 +70,24 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When service applications exist in the current farm but the specific subscription settings service app does not" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "Test App Pool" - DatabaseName = "Test_DB" - DatabaseServer = "TestServer\Instance" - Ensure = "Present" + DatabaseName = "Test_DB" + DatabaseServer = "TestServer\Instance" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - } + DisplayName = $testParams.Name + } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "Microsoft.Office.UnKnownWebServiceApplication" - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + FullName = "Microsoft.Office.UnKnownWebServiceApplication" + } + } -PassThru -Force return $spServiceApp } @@ -98,59 +98,59 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service application exist in the current farm but has no proxy" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "Test App Pool" - DatabaseName = "Test_DB" - DatabaseServer = "TestServer\Instance" - Ensure = "Present" + DatabaseName = "Test_DB" + DatabaseServer = "TestServer\Instance" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Microsoft SharePoint Foundation Subscription Settings Service Application" - DisplayName = $testParams.Name + TypeName = "Microsoft SharePoint Foundation Subscription Settings Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetProperties ` - -Value { - param($x) - return @( - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "Database" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return (@{ - FullName = $getTypeFullName - Name = "Test_DB" - NormalizedDataSource = "TestServer\Instance" - FailoverServer = @{ - Name = "DBServer_Failover" - } - }) - } -PassThru - ) - ) - } -PassThru + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name FullName ` + -Value $getTypeFullName ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetProperties ` + -Value { + param($x) + return @( + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "Database" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return (@{ + FullName = $getTypeFullName + Name = "Test_DB" + NormalizedDataSource = "TestServer\Instance" + FailoverServer = @{ + Name = "DBServer_Failover" + } + }) + } -PassThru + ) + ) + } -PassThru } -PassThru -Force $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name IsConnected ` - -Value { + -Name IsConnected ` + -Value { param($x) return $false } -PassThru -Force @@ -182,54 +182,54 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and is configured correctly" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "Test App Pool" - DatabaseName = "Test_DB" - DatabaseServer = "TestServer\Instance" - Ensure = "Present" + DatabaseName = "Test_DB" + DatabaseServer = "TestServer\Instance" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Microsoft SharePoint Foundation Subscription Settings Service Application" - DisplayName = $testParams.Name + TypeName = "Microsoft SharePoint Foundation Subscription Settings Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetProperties ` - -Value { - param($x) - return @( - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "Database" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return (@{ - FullName = $getTypeFullName - Name = "Test_DB" - NormalizedDataSource = "TestServer\Instance" - FailoverServer = @{ - Name = "DBServer_Failover" - } - }) - } -PassThru - ) - ) - } -PassThru + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name FullName ` + -Value $getTypeFullName ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetProperties ` + -Value { + param($x) + return @( + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "Database" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return (@{ + FullName = $getTypeFullName + Name = "Test_DB" + NormalizedDataSource = "TestServer\Instance" + FailoverServer = @{ + Name = "DBServer_Failover" + } + }) + } -PassThru + ) + ) + } -PassThru } -PassThru -Force return $spServiceApp @@ -246,57 +246,57 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and the app pool is not configured correctly" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "Test App Pool" - DatabaseName = "Test_DB" - DatabaseServer = "TestServer\Instance" - Ensure = "Present" + DatabaseName = "Test_DB" + DatabaseServer = "TestServer\Instance" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [pscustomobject]@{ - TypeName = "Microsoft SharePoint Foundation Subscription Settings Service Application" - DisplayName = $testParams.Name + TypeName = "Microsoft SharePoint Foundation Subscription Settings Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = "Wrong App Pool Name" } } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value { - $Global:SPDscSubscriptionServiceUpdateCalled = $true - } -PassThru + -Name Update ` + -Value { + $Global:SPDscSubscriptionServiceUpdateCalled = $true + } -PassThru $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetProperties ` - -Value { - param($x) - return @( - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "Database" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return (@{ - FullName = $getTypeFullName - Name = "Test_DB" - NormalizedDataSource = "TestServer\Instance" - FailoverServer = @{ - Name = "DBServer_Failover" - } - }) - } -PassThru - ) - ) - } -PassThru + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name FullName ` + -Value $getTypeFullName ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetProperties ` + -Value { + param($x) + return @( + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "Database" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return (@{ + FullName = $getTypeFullName + Name = "Test_DB" + NormalizedDataSource = "TestServer\Instance" + FailoverServer = @{ + Name = "DBServer_Failover" + } + }) + } -PassThru + ) + ) + } -PassThru } -PassThru -Force return $spServiceApp @@ -322,9 +322,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service app needs to be created and no database parameters are provided" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "Test App Pool" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { @@ -340,51 +340,51 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service app exists but it shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "-" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Microsoft SharePoint Foundation Subscription Settings Service Application" - DisplayName = $testParams.Name + TypeName = "Microsoft SharePoint Foundation Subscription Settings Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetProperties ` - -Value { - param($x) - return @( - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "Database" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return (@{ - FullName = $getTypeFullName - Name = "Test_DB" - NormalizedDataSource = "TestServer\Instance" - FailoverServer = @{ - Name = "DBServer_Failover" - } - }) - } -PassThru - ) - ) - } -PassThru + New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name FullName ` + -Value $getTypeFullName ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetProperties ` + -Value { + param($x) + return @( + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "Database" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return (@{ + FullName = $getTypeFullName + Name = "Test_DB" + NormalizedDataSource = "TestServer\Instance" + FailoverServer = @{ + Name = "DBServer_Failover" + } + }) + } -PassThru + ) + ) + } -PassThru } -PassThru -Force return $spServiceApp } @@ -405,9 +405,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service app doesn't exist and shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "-" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication -MockWith { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPTimerJobState.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPTimerJobState.Tests.ps1 index cf3afe7e0..a7854d7b4 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPTimerJobState.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPTimerJobState.Tests.ps1 @@ -1,18 +1,18 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPTimerJobState" + -DscResource "SPTimerJobState" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -20,18 +20,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Initialize tests - # Mocks for all contexts - Mock -CommandName Set-SPTimerJob -MockWith { - return $null + # Mocks for all contexts + Mock -CommandName Set-SPTimerJob -MockWith { + return $null } - Mock -CommandName Enable-SPTimerJob -MockWith { - return $null + Mock -CommandName Enable-SPTimerJob -MockWith { + return $null } - Mock -CommandName Get-SPFarm -MockWith { - return @{} + Mock -CommandName Get-SPFarm -MockWith { + return @{ } } - Mock -CommandName Get-SPWebApplication -MockWith { - return @{} + Mock -CommandName Get-SPWebApplication -MockWith { + return @{ } } # Test contexts @@ -43,8 +43,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Schedule = "hourly between 0 and 59" } - Mock -CommandName Get-SPFarm -MockWith { - throw "Unable to detect local farm" + Mock -CommandName Get-SPFarm -MockWith { + throw "Unable to detect local farm" } It "Should return null from the get method" { @@ -68,8 +68,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Schedule = "hourly between 0 and 59" } - Mock -CommandName Get-SPWebApplication -MockWith { - return $null + Mock -CommandName Get-SPWebApplication -MockWith { + return $null } It "Should return null from the get method" { @@ -94,7 +94,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-SPTimerJob -MockWith { - return $null + return $null } It "Should return null from the get method" { @@ -119,14 +119,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Enabled = $true Schedule = "hourly between 0 and 59" } - + Mock -CommandName Get-SPTimerJob -MockWith { $returnVal = @{ - TypeName = "job-spapp-statequery" + TypeName = "job-spapp-statequery" IsDisabled = $true - Schedule = "hourly between 0 and 59" + Schedule = "hourly between 0 and 59" } - return ,@($returnVal) + return , @($returnVal) } It "Should return values from the get method" { @@ -150,14 +150,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Enabled = $true Schedule = "hourly between 0 and 59" } - + Mock -CommandName Get-SPTimerJob -MockWith { $returnVal = @{ - TypeName = "job-spapp-statequery" + TypeName = "job-spapp-statequery" IsDisabled = $true - Schedule = "hourly between 0 and 59" + Schedule = "hourly between 0 and 59" } - return ,@($returnVal) + return , @($returnVal) } It "Should return values from the get method" { @@ -181,14 +181,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Enabled = $true Schedule = "hourly between 0 and 59" } - + Mock -CommandName Get-SPTimerJob -MockWith { $returnVal = @{ - TypeName = "job-spapp-statequery" + TypeName = "job-spapp-statequery" IsDisabled = $false - Schedule = "weekly at sat 23:00:00" + Schedule = "weekly at sat 23:00:00" } - return ,@($returnVal) + return , @($returnVal) } It "Should return values from the get method" { @@ -212,14 +212,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Enabled = $true Schedule = "hourly between 0 and 59" } - + Mock -CommandName Get-SPTimerJob -MockWith { $returnVal = @{ - TypeName = "job-spapp-statequery" + TypeName = "job-spapp-statequery" IsDisabled = $false - Schedule = "weekly at sat 23:00:00" + Schedule = "weekly at sat 23:00:00" } - return ,@($returnVal) + return , @($returnVal) } It "Should return values from the get method" { @@ -243,18 +243,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Enabled = $true Schedule = "hourly between 0 and 59" } - + Mock -CommandName Get-SPTimerJob -MockWith { $returnVal = @{ - TypeName = "job-spapp-statequery" + TypeName = "job-spapp-statequery" IsDisabled = $false - Schedule = "incorrect format" + Schedule = "incorrect format" } - return ,@($returnVal) + return , @($returnVal) } - Mock -CommandName Set-SPTimerJob -MockWith { - throw "Invalid Time: `"The time given was not given in the proper format. See: Get-Help Set-SPTimerJob -detailed`"" + Mock -CommandName Set-SPTimerJob -MockWith { + throw "Invalid Time: `"The time given was not given in the proper format. See: Get-Help Set-SPTimerJob -detailed`"" } It "Should return values from the get method" { @@ -277,18 +277,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Enabled = $true Schedule = "hourly between 0 and 59" } - + Mock -CommandName Get-SPTimerJob -MockWith { $returnVal = @{ - TypeName = "job-spapp-statequery" + TypeName = "job-spapp-statequery" IsDisabled = $false - Schedule = "incorrect format" + Schedule = "incorrect format" } - return ,@($returnVal) + return , @($returnVal) } - Mock -CommandName Set-SPTimerJob -MockWith { - throw "Invalid Time: `"The time given was not given in the proper format. See: Get-Help Set-SPTimerJob -detailed`"" + Mock -CommandName Set-SPTimerJob -MockWith { + throw "Invalid Time: `"The time given was not given in the proper format. See: Get-Help Set-SPTimerJob -detailed`"" } It "Should return values from the get method" { @@ -311,14 +311,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Enabled = $true Schedule = "hourly between 0 and 59" } - + Mock -CommandName Get-SPTimerJob -MockWith { $returnVal = @{ - TypeName = "job-spapp-statequery" + TypeName = "job-spapp-statequery" IsDisabled = $false - Schedule = "hourly between 0 and 59" + Schedule = "hourly between 0 and 59" } - return ,@($returnVal) + return , @($returnVal) } It "Should return values from the get method" { @@ -337,14 +337,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Enabled = $true Schedule = "hourly between 0 and 59" } - + Mock -CommandName Get-SPTimerJob -MockWith { $returnVal = @{ - TypeName = "job-spapp-statequery" + TypeName = "job-spapp-statequery" IsDisabled = $false - Schedule = "hourly between 0 and 59" + Schedule = "hourly between 0 and 59" } - return ,@($returnVal) + return , @($returnVal) } It "Should return values from the get method" { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPTrustedIdentityTokenIssuer.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPTrustedIdentityTokenIssuer.Tests.ps1 index e26bc27cd..58cd54a15 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPTrustedIdentityTokenIssuer.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPTrustedIdentityTokenIssuer.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPTrustedIdentityTokenIssuer" + -DscResource "SPTrustedIdentityTokenIssuer" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -29,8 +29,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName New-SPTrustedIdentityTokenIssuer -MockWith { $sptrust = [pscustomobject]@{ - Name = $testParams.Name - ClaimProviderName = "" + Name = $testParams.Name + ClaimProviderName = "" ProviderSignOutUri = "" } $sptrust | Add-Member -Name Update -MemberType ScriptMethod -Value { } @@ -45,8 +45,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPClaimProvider -MockWith { return [pscustomobject]@(@{ - DisplayName = $testParams.ClaimProviderName - }) + DisplayName = $testParams.ClaimProviderName + }) } try @@ -85,14 +85,14 @@ namespace Microsoft.SharePoint.Administration { IdentifierClaim = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" ClaimsMappings = @( (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Email" - IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" - } -ClientOnly) + Name = "Email" + IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Role" - IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" - LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" - } -ClientOnly) + Name = "Role" + IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" + LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" + } -ClientOnly) ) SigningCertificateThumbprint = "123ABCFACE123ABCFACE123ABCFACE123ABCFACE" ClaimProviderName = "LDAPCP" @@ -117,26 +117,26 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The SPTrustedLoginProvider does not exist but should, using a signing certificate in the file path" -Fixture { $testParams = @{ - Name = "Contoso" - Description = "Contoso" - Realm = "https://sharepoint.contoso.com" - SignInUrl = "https://adfs.contoso.com/adfs/ls/" - IdentifierClaim = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" - ClaimsMappings = @( + Name = "Contoso" + Description = "Contoso" + Realm = "https://sharepoint.contoso.com" + SignInUrl = "https://adfs.contoso.com/adfs/ls/" + IdentifierClaim = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" + ClaimsMappings = @( (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Email" - IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" - } -ClientOnly) + Name = "Email" + IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Role" - IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" - LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" - } -ClientOnly) + Name = "Role" + IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" + LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" + } -ClientOnly) ) - SigningCertificateFilePath = "F:\Data\DSC\FakeSigning.cer" - ClaimProviderName = "LDAPCP" - ProviderSignOutUri = "https://adfs.contoso.com/adfs/ls/" - Ensure = "Present" + SigningCertificateFilePath = "F:\Data\DSC\FakeSigning.cer" + ClaimProviderName = "LDAPCP" + ProviderSignOutUri = "https://adfs.contoso.com/adfs/ls/" + Ensure = "Present" } Mock -CommandName New-Object -MockWith { @@ -171,14 +171,14 @@ namespace Microsoft.SharePoint.Administration { IdentifierClaim = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" ClaimsMappings = @( (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Email" - IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" - } -ClientOnly) + Name = "Email" + IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Role" - IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" - LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" - } -ClientOnly) + Name = "Role" + IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" + LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" + } -ClientOnly) ) SigningCertificateThumbprint = "123ABCFACE123ABCFACE123ABCFACE123ABCFACE" SigningCertificateFilePath = "F:\Data\DSC\FakeSigning.cer" @@ -194,25 +194,25 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The SPTrustedLoginProvider is desired, but none of parameters SigningCertificateThumbprint and SigningCertificateFilePath is set while exactly 1 should" -Fixture { $testParams = @{ - Name = "Contoso" - Description = "Contoso" - Realm = "https://sharepoint.contoso.com" - SignInUrl = "https://adfs.contoso.com/adfs/ls/" - IdentifierClaim = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" - ClaimsMappings = @( + Name = "Contoso" + Description = "Contoso" + Realm = "https://sharepoint.contoso.com" + SignInUrl = "https://adfs.contoso.com/adfs/ls/" + IdentifierClaim = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" + ClaimsMappings = @( (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Email" - IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" - } -ClientOnly) + Name = "Email" + IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Role" - IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" - LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" - } -ClientOnly) + Name = "Role" + IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" + LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" + } -ClientOnly) ) - ClaimProviderName = "LDAPCP" - ProviderSignOutUri = "https://adfs.contoso.com/adfs/ls/" - Ensure = "Present" + ClaimProviderName = "LDAPCP" + ProviderSignOutUri = "https://adfs.contoso.com/adfs/ls/" + Ensure = "Present" } It "should fail validation of signing certificate parameters in the set method" { @@ -229,14 +229,14 @@ namespace Microsoft.SharePoint.Administration { IdentifierClaim = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" ClaimsMappings = @( (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Email" - IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" - } -ClientOnly) + Name = "Email" + IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Role" - IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" - LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" - } -ClientOnly) + Name = "Role" + IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" + LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" + } -ClientOnly) ) SigningCertificateThumbprint = "XX123ABCFACEXX" ClaimProviderName = "LDAPCP" @@ -244,7 +244,7 @@ namespace Microsoft.SharePoint.Administration { Ensure = "Present" } - It "should fail validation of parameter SigningCertificateThumbprint in the set method" { + It "should fail validation of parameter SigningCertificateThumbprint in the set method" { { Set-TargetResource @testParams } | Should Throw "Parameter SigningCertificateThumbprint does not match valid format '^[A-Fa-f0-9]{40}$'." } } @@ -258,14 +258,14 @@ namespace Microsoft.SharePoint.Administration { IdentifierClaim = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" ClaimsMappings = @( (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Email" - IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" - } -ClientOnly) + Name = "Email" + IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Role" - IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" - LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" - } -ClientOnly) + Name = "Role" + IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" + LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" + } -ClientOnly) ) SigningCertificateThumbprint = "123ABCFACE123ABCFACE123ABCFACE123ABCFACE" ClaimProviderName = "LDAPCP" @@ -276,13 +276,13 @@ namespace Microsoft.SharePoint.Administration { Mock -CommandName Get-ChildItem -MockWith { return @( @{ - Thumbprint = "123ABCFACE123ABCFACE123ABCFACE123ABCFACE" + Thumbprint = "123ABCFACE123ABCFACE123ABCFACE123ABCFACE" HasPrivateKey = $true } ) } -ParameterFilter { $Path -eq 'Cert:\LocalMachine\My' } - It "should fail validation of certificate in the set method" { + It "should fail validation of certificate in the set method" { { Set-TargetResource @testParams } | Should Throw "SharePoint requires that the private key of the signing certificate is not installed in the certificate store." } } @@ -296,14 +296,14 @@ namespace Microsoft.SharePoint.Administration { IdentifierClaim = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" ClaimsMappings = @( (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Email" - IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" - } -ClientOnly) + Name = "Email" + IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Role" - IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" - LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" - } -ClientOnly) + Name = "Role" + IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" + LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" + } -ClientOnly) ) SigningCertificateThumbprint = "123ABCFACE123ABCFACE123ABCFACE123ABCFACE" ClaimProviderName = "LDAPCP" @@ -316,7 +316,7 @@ namespace Microsoft.SharePoint.Administration { Name = $testParams.Name ClaimProviderName = $testParams.ClaimProviderName } - $sptrust| Add-Member -Name Update -MemberType ScriptMethod -Value { } + $sptrust | Add-Member -Name Update -MemberType ScriptMethod -Value { } return $sptrust } @@ -336,14 +336,14 @@ namespace Microsoft.SharePoint.Administration { IdentifierClaim = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" ClaimsMappings = @( (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Email" - IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" - } -ClientOnly) + Name = "Email" + IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Role" - IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" - LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" - } -ClientOnly) + Name = "Role" + IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" + LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" + } -ClientOnly) ) SigningCertificateThumbprint = "123ABCFACE123ABCFACE123ABCFACE123ABCFACE" ClaimProviderName = "LDAPCP" @@ -378,14 +378,14 @@ namespace Microsoft.SharePoint.Administration { IdentifierClaim = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" ClaimsMappings = @( (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Email" - IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" - } -ClientOnly) + Name = "Email" + IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Role" - IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" - LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" - } -ClientOnly) + Name = "Role" + IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" + LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" + } -ClientOnly) ) SigningCertificateThumbprint = "123ABCFACE123ABCFACE123ABCFACE123ABCFACE" ClaimProviderName = "LDAPCP" @@ -395,7 +395,7 @@ namespace Microsoft.SharePoint.Administration { Mock -CommandName Get-SPTrustedIdentityTokenIssuer -MockWith { $sptrust = [pscustomobject]@{ - Name = $testParams.Name + Name = $testParams.Name } $sptrust | Add-Member -Name Update -MemberType ScriptMethod -Value { } return $sptrust @@ -403,7 +403,7 @@ namespace Microsoft.SharePoint.Administration { Mock -CommandName Get-SPWebApplication -MockWith { $spWebApp = [pscustomobject]@{ - Url = "http://webAppUrl" + Url = "http://webAppUrl" } $spWebApp | Add-Member -Name Update -MemberType ScriptMethod -Value { } $spWebApp | Add-Member -Name GetIisSettingsWithFallback -MemberType ScriptMethod -Value { } @@ -412,16 +412,16 @@ namespace Microsoft.SharePoint.Administration { Mock -CommandName Get-SPAuthenticationProvider -MockWith { $spAP = [pscustomobject]@{ - LoginProviderName = "" + LoginProviderName = "" } $spAP | Add-Member -Name Update -MemberType ScriptMethod -Value { } $spAP | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "Microsoft.SharePoint.Administration.SPTrustedAuthenticationProvider" - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + FullName = "Microsoft.SharePoint.Administration.SPTrustedAuthenticationProvider" + } + } -PassThru -Force return $spAP } @@ -450,14 +450,14 @@ namespace Microsoft.SharePoint.Administration { IdentifierClaim = "IdentityClaimTypeNotSpecifiedInClaimsMappings" ClaimsMappings = @( (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Email" - IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" - } -ClientOnly) + Name = "Email" + IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPClaimTypeMapping -Property @{ - Name = "Role" - IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" - LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" - } -ClientOnly) + Name = "Role" + IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" + LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" + } -ClientOnly) ) SigningCertificateThumbprint = "123ABCFACE123ABCFACE123ABCFACE123ABCFACE" ClaimProviderName = "LDAPCP" diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPTrustedIdentityTokenIssuerProviderRealms.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPTrustedIdentityTokenIssuerProviderRealms.Tests.ps1 index f80f878b9..b41b0ac04 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPTrustedIdentityTokenIssuerProviderRealms.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPTrustedIdentityTokenIssuerProviderRealms.Tests.ps1 @@ -2,16 +2,16 @@ param ( [Parameter()] [string]$SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPTrustedIdentityTokenIssuerProviderRealms" + -DscResource "SPTrustedIdentityTokenIssuerProviderRealms" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -19,16 +19,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The SPTrustedLoginProvider not exists in the farm" -Fixture { $testParams = @{ - IssuerName = "Contoso" + IssuerName = "Contoso" ProviderRealms = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } -ClientOnly) - (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://intranet.contoso.com" - RealmUrn = "urn:sharepoint:contoso:intranet" - } -ClientOnly)) - Ensure = "Present" + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } -ClientOnly) + (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ + RealmUrl = "https://intranet.contoso.com" + RealmUrn = "urn:sharepoint:contoso:intranet" + } -ClientOnly)) + Ensure = "Present" } Mock -CommandName Get-SPTrustedIdentityTokenIssuer -MockWith { return $null } @@ -40,16 +40,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The SPTrustedLoginProviderRealms already exists and should not be changed" -Fixture { $testParams = @{ - IssuerName = "Contoso" + IssuerName = "Contoso" ProviderRealms = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } -ClientOnly) - (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://intranet.contoso.com" - RealmUrn = "urn:sharepoint:contoso:intranet" - } -ClientOnly)) - Ensure = "Present" + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } -ClientOnly) + (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ + RealmUrl = "https://intranet.contoso.com" + RealmUrn = "urn:sharepoint:contoso:intranet" + } -ClientOnly)) + Ensure = "Present" } Mock -CommandName Get-SPTrustedIdentityTokenIssuer -MockWith { @@ -60,7 +60,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $realmsDict[$url.ToString()] = $realm.RealmUrn } $realmRet = [pscustomobject]@{ - ProviderRealms = $realmsDict + ProviderRealms = $realmsDict } return $realmRet } @@ -77,16 +77,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The SPTrustedLoginProviderRealms already exists but one realm will be added" -Fixture { $testParams = @{ - IssuerName = "Contoso" + IssuerName = "Contoso" ProviderRealms = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } -ClientOnly) - (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://intranet.contoso.com" - RealmUrn = "urn:sharepoint:contoso:intranet" - } -ClientOnly)) - Ensure = "Present" + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } -ClientOnly) + (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ + RealmUrl = "https://intranet.contoso.com" + RealmUrn = "urn:sharepoint:contoso:intranet" + } -ClientOnly)) + Ensure = "Present" } $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount = 0 @@ -128,22 +128,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Set-TargetResource: Realm added to SPTrustedIdentityTokenIssuer.ProviderRealms" { Set-TargetResource @testParams $($Global:SPTrustedIdentityTokenIssuerUpdateCalledCount -eq 1 ` - -and $Global:SPTrustedIdentityTokenIssuerAddProviderRealmCalledCount -eq 2) | Should Be $true + -and $Global:SPTrustedIdentityTokenIssuerAddProviderRealmCalledCount -eq 2) | Should Be $true } } Context -Name "The SPTrustedLoginProviderRealms empty and all will be added" -Fixture { $testParams = @{ - IssuerName = "Contoso" + IssuerName = "Contoso" ProviderRealms = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } -ClientOnly) - (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://intranet.contoso.com" - RealmUrn = "urn:sharepoint:contoso:intranet" - } -ClientOnly)) - Ensure = "Present" + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } -ClientOnly) + (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ + RealmUrl = "https://intranet.contoso.com" + RealmUrn = "urn:sharepoint:contoso:intranet" + } -ClientOnly)) + Ensure = "Present" } $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount = 0 @@ -185,22 +185,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Set-TargetResource: Realms added to SPTrustedIdentityTokenIssuer.ProviderRealms" { Set-TargetResource @testParams $($Global:SPTrustedIdentityTokenIssuerAddProviderRealmCalledCount -eq 2 ` - -and $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount -eq 1 ) | Should Be $true + -and $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount -eq 1 ) | Should Be $true } } Context -Name "The SPTrustedLoginProviderRealms already exists and one realm will be removed" -Fixture { $testParams = @{ - IssuerName = "Contoso" + IssuerName = "Contoso" ProviderRealms = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } -ClientOnly) - (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://intranet.contoso.com" - RealmUrn = "urn:sharepoint:contoso:intranet" - } -ClientOnly)) - Ensure = "Absent" + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } -ClientOnly) + (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ + RealmUrl = "https://intranet.contoso.com" + RealmUrn = "urn:sharepoint:contoso:intranet" + } -ClientOnly)) + Ensure = "Absent" } $Global:SPTrustedIdentityTokenIssuerRemoveProviderRealmCalledCount = 0 @@ -244,16 +244,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The SPTrustedLoginProviderRealms already exists and all will be removed" -Fixture { $testParams = @{ - IssuerName = "Contoso" + IssuerName = "Contoso" ProviderRealms = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } -ClientOnly) - (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://intranet.contoso.com" - RealmUrn = "urn:sharepoint:contoso:intranet" - } -ClientOnly)) - Ensure = "Absent" + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } -ClientOnly) + (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ + RealmUrl = "https://intranet.contoso.com" + RealmUrn = "urn:sharepoint:contoso:intranet" + } -ClientOnly)) + Ensure = "Absent" } $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount = 0 @@ -294,16 +294,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The SPTrustedLoginProviderRealms already exists and one realm will be updated" -Fixture { $testParams = @{ - IssuerName = "Contoso" + IssuerName = "Contoso" ProviderRealms = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } -ClientOnly) - (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://intranet.contoso.com" - RealmUrn = "urn:sharepoint:contoso:intranet" - } -ClientOnly)) - Ensure = "Present" + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } -ClientOnly) + (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ + RealmUrl = "https://intranet.contoso.com" + RealmUrn = "urn:sharepoint:contoso:intranet" + } -ClientOnly)) + Ensure = "Present" } $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount = 0 @@ -316,7 +316,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $realmsDict[$url.ToString()] = $realm.RealmUrn } - $realmsDict["https://intranet.contoso.com/"]="urn:sharepoint:contoso:intranet1" + $realmsDict["https://intranet.contoso.com/"] = "urn:sharepoint:contoso:intranet1" $realmRet = [pscustomobject]@{ ProviderRealms = $realmsDict @@ -346,28 +346,28 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Set-TargetResource: Realm updated in SPTrustedIdentityTokenIssuer.ProviderRealms" { Set-TargetResource @testParams $($Global:SPTrustedIdentityTokenIssuerAddProviderRealmCalledCount -eq 2 ` - -and $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount -eq 1) | Should Be $true + -and $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount -eq 1) | Should Be $true } } Context -Name "The SPTrustedLoginProviderRealms already exists and one will be excluded" -Fixture { $testParams = @{ - IssuerName = "Contoso" + IssuerName = "Contoso" ProviderRealmsToExclude = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } -ClientOnly)) - Ensure = "Present" + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } -ClientOnly)) + Ensure = "Present" } $pRealms = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } -ClientOnly) + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://intranet.contoso.com" - RealmUrn = "urn:sharepoint:contoso:intranet" - } -ClientOnly)) + RealmUrl = "https://intranet.contoso.com" + RealmUrn = "urn:sharepoint:contoso:intranet" + } -ClientOnly)) $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount = 0 $Global:SPTrustedIdentityTokenIssuerAddProviderRealmCalledCount = 0 @@ -407,28 +407,28 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Set-TargetResource: Realm removed in SPTrustedIdentityTokenIssuer.ProviderRealms" { Set-TargetResource @testParams $($Global:SPTrustedIdentityTokenIssuerAddProviderRealmCalledCount -eq 1 ` - -and $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount -eq 1) | Should Be $true + -and $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount -eq 1) | Should Be $true } } Context -Name "The SPTrustedLoginProviderRealms already exists and one should be excluded but not found" -Fixture { $testParams = @{ - IssuerName = "Contoso" + IssuerName = "Contoso" ProviderRealmsToExclude = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search1" - } -ClientOnly)) - Ensure = "Present" + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search1" + } -ClientOnly)) + Ensure = "Present" } $pRealms = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } -ClientOnly) + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://intranet.contoso.com" - RealmUrn = "urn:sharepoint:contoso:intranet" - } -ClientOnly)) + RealmUrl = "https://intranet.contoso.com" + RealmUrn = "urn:sharepoint:contoso:intranet" + } -ClientOnly)) $realmsDict = New-Object 'system.collections.generic.dictionary[system.uri,string]' foreach ($realm in $pRealms) @@ -457,22 +457,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The SPTrustedLoginProviderRealms already exists and one should be included" -Fixture { $testParams = @{ - IssuerName = "Contoso" + IssuerName = "Contoso" ProviderRealmsToInclude = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://searchx.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } -ClientOnly)) - Ensure = "Present" + RealmUrl = "https://searchx.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } -ClientOnly)) + Ensure = "Present" } $pRealms = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } -ClientOnly) + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://intranet.contoso.com" - RealmUrn = "urn:sharepoint:contoso:intranet" - } -ClientOnly)) + RealmUrl = "https://intranet.contoso.com" + RealmUrn = "urn:sharepoint:contoso:intranet" + } -ClientOnly)) $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount = 0 $Global:SPTrustedIdentityTokenIssuerAddProviderRealmCalledCount = 0 @@ -512,32 +512,32 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Set-TargetResource: Realm added in SPTrustedIdentityTokenIssuer.ProviderRealms" { Set-TargetResource @testParams $($Global:SPTrustedIdentityTokenIssuerAddProviderRealmCalledCount -eq 3 ` - -and $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount -eq 1) | Should Be $true + -and $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount -eq 1) | Should Be $true } } Context -Name "The SPTrustedLoginProviderRealms empty and two should be included" -Fixture { $testParams = @{ - IssuerName = "Contoso" + IssuerName = "Contoso" ProviderRealmsToInclude = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } -ClientOnly) - (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://intranet.contoso.com" - RealmUrn = "urn:sharepoint:contoso:intranet" - } -ClientOnly)) - Ensure = "Present" + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } -ClientOnly) + (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ + RealmUrl = "https://intranet.contoso.com" + RealmUrn = "urn:sharepoint:contoso:intranet" + } -ClientOnly)) + Ensure = "Present" } $pRealms = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } -ClientOnly) + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://intranet.contoso.com" - RealmUrn = "urn:sharepoint:contoso:intranet" - } -ClientOnly)) + RealmUrl = "https://intranet.contoso.com" + RealmUrn = "urn:sharepoint:contoso:intranet" + } -ClientOnly)) $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount = 0 $Global:SPTrustedIdentityTokenIssuerAddProviderRealmCalledCount = 0 @@ -579,28 +579,28 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Set-TargetResource: Realms included in to SPTrustedIdentityTokenIssuer.ProviderRealms" { Set-TargetResource @testParams $($Global:SPTrustedIdentityTokenIssuerAddProviderRealmCalledCount -eq 2 ` - -and $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount -eq 1) | Should Be $true + -and $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount -eq 1) | Should Be $true } } Context -Name "The SPTrustedLoginProviderRealms already exists and one should be included but found" -Fixture { $testParams = @{ - IssuerName = "Contoso" + IssuerName = "Contoso" ProviderRealmsToInclude = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } -ClientOnly)) - Ensure = "Present" + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } -ClientOnly)) + Ensure = "Present" } $pRealms = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } -ClientOnly) + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://intranet.contoso.com" - RealmUrn = "urn:sharepoint:contoso:intranet" - } -ClientOnly)) + RealmUrl = "https://intranet.contoso.com" + RealmUrn = "urn:sharepoint:contoso:intranet" + } -ClientOnly)) $realmsDict = New-Object 'system.collections.generic.dictionary[system.uri,string]' foreach ($realm in $pRealms) @@ -629,22 +629,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The SPTrustedLoginProviderRealms already exists and one should be included and updated" -Fixture { $testParams = @{ - IssuerName = "Contoso" + IssuerName = "Contoso" ProviderRealmsToInclude = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search1" - } -ClientOnly)) - Ensure = "Present" + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search1" + } -ClientOnly)) + Ensure = "Present" } $pRealms = @((New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } -ClientOnly) + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPProviderRealm -Property @{ - RealmUrl = "https://intranet.contoso.com" - RealmUrn = "urn:sharepoint:contoso:intranet" - } -ClientOnly)) + RealmUrl = "https://intranet.contoso.com" + RealmUrn = "urn:sharepoint:contoso:intranet" + } -ClientOnly)) $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount = 0 $Global:SPTrustedIdentityTokenIssuerAddProviderRealmCalledCount = 0 @@ -684,7 +684,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Set-TargetResource: Realm updated in SPTrustedIdentityTokenIssuer.ProviderRealms" { Set-TargetResource @testParams $($Global:SPTrustedIdentityTokenIssuerAddProviderRealmCalledCount -eq 2 ` - -and $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount -eq 1) | Should Be $true + -and $Global:SPTrustedIdentityTokenIssuerUpdateCalledCount -eq 1) | Should Be $true } } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPTrustedRootAuthority.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPTrustedRootAuthority.Tests.ps1 index ade92d432..0fac0fa63 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPTrustedRootAuthority.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPTrustedRootAuthority.Tests.ps1 @@ -3,38 +3,38 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPTrustedRootAuthority" + -DscResource "SPTrustedRootAuthority" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - Mock -CommandName Remove-SPTrustedRootAuthority -MockWith { } - Mock -CommandName Set-SPTrustedRootAuthority -MockWith { } - Mock -CommandName New-SPTrustedRootAuthority -MockWith { } + Mock -CommandName Remove-SPTrustedRootAuthority -MockWith { } + Mock -CommandName Set-SPTrustedRootAuthority -MockWith { } + Mock -CommandName New-SPTrustedRootAuthority -MockWith { } Context -Name "When both CertificalThumbprint and CertificateFilePath are specified" -Fixture { $testParams = @{ - Name = "CertIdentifier" + Name = "CertIdentifier" CertificateThumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" - CertificateFilePath = "C:\cert.cer" - Ensure = "Present" + CertificateFilePath = "C:\cert.cer" + Ensure = "Present" } Mock -CommandName Get-Item -MockWith { return @{ - Subject = "CN=CertName" - Thumbprint = $testParams.CertificateThumbprint - } + Subject = "CN=CertName" + Thumbprint = $testParams.CertificateThumbprint + } } Mock -CommandName Test-Path -MockWith { @@ -43,7 +43,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPTrustedRootAuthority -MockWith { return @{ - Name = $testParams.Name + Name = $testParams.Name Certificate = @{ Thumbprint = $testParams.CertificateThumbprint } @@ -65,15 +65,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When neither CertificalThumbprint and CertificateFilePath are specified" -Fixture { $testParams = @{ - Name = "CertIdentifier" + Name = "CertIdentifier" Ensure = "Present" } Mock -CommandName Get-Item -MockWith { return @{ - Subject = "CN=CertName" - Thumbprint = $testParams.CertificateThumbprint - } + Subject = "CN=CertName" + Thumbprint = $testParams.CertificateThumbprint + } } Mock -CommandName Test-Path -MockWith { @@ -82,7 +82,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPTrustedRootAuthority -MockWith { return @{ - Name = $testParams.Name + Name = $testParams.Name Certificate = @{ Thumbprint = $testParams.CertificateThumbprint } @@ -104,16 +104,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When specified CertificateFilePath does not exist" -Fixture { $testParams = @{ - Name = "CertIdentifier" + Name = "CertIdentifier" CertificateFilePath = "C:\cert.cer" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-Item -MockWith { return @{ - Subject = "CN=CertName" - Thumbprint = $testParams.CertificateThumbprint - } + Subject = "CN=CertName" + Thumbprint = $testParams.CertificateThumbprint + } } Mock -CommandName Test-Path -MockWith { @@ -122,7 +122,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPTrustedRootAuthority -MockWith { return @{ - Name = $testParams.Name + Name = $testParams.Name Certificate = @{ Thumbprint = $testParams.CertificateThumbprint } @@ -142,25 +142,25 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } -## CertFile - RA does not exist + ## CertFile - RA does not exist Context -Name "When TrustedRootAuthority should exist and does exist in the farm (Thumbprint)." -Fixture { $testParams = @{ - Name = "CertIdentifier" + Name = "CertIdentifier" CertificateThumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-Item -MockWith { return @{ - Subject = "CN=CertName" - Thumbprint = $testParams.CertificateThumbprint - } + Subject = "CN=CertName" + Thumbprint = $testParams.CertificateThumbprint + } } Mock -CommandName Get-SPTrustedRootAuthority -MockWith { return @{ - Name = $testParams.Name + Name = $testParams.Name Certificate = @{ Thumbprint = $testParams.CertificateThumbprint } @@ -184,9 +184,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When TrustedRootAuthority should exist and does exist in the farm (FilePath)." -Fixture { $testParams = @{ - Name = "CertIdentifier" + Name = "CertIdentifier" CertificateThumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Test-Path -MockWith { @@ -194,16 +194,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-Item -MockWith { - return @{ - Subject = "CN=CertName" - Thumbprint = $testParams.CertificateThumbprint - } + return @{ + Subject = "CN=CertName" + Thumbprint = $testParams.CertificateThumbprint + } } Mock -CommandName New-Object -MockWith { $retVal = [pscustomobject]@{ - Subject = "CN=CertIdentifer" - Thumbprint = "770515261D1AB169057E246E0EE6431D557C3AFC" + Subject = "CN=CertIdentifer" + Thumbprint = "770515261D1AB169057E246E0EE6431D557C3AFC" HasPrivateKey = $false } Add-Member -InputObject $retVal -MemberType ScriptMethod Import { } @@ -213,7 +213,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPTrustedRootAuthority -MockWith { return @{ - Name = $testParams.Name + Name = $testParams.Name Certificate = @{ Thumbprint = $testParams.CertificateThumbprint } @@ -237,14 +237,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When TrustedRootAuthority should exist and does exist in the farm, but has incorrect certificate (Thumbprint)." -Fixture { $testParams = @{ - Name = "CertIdentifier" + Name = "CertIdentifier" CertificateThumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPTrustedRootAuthority -MockWith { return @{ - Name = $testParams.Name + Name = $testParams.Name Certificate = @{ Thumbprint = "770515261D1AB169057E246E0EE6431D557C3AFC" } @@ -252,10 +252,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-Item -MockWith { - return @{ - Subject = "CN=CertName" - Thumbprint = $testParams.CertificateThumbprint - } + return @{ + Subject = "CN=CertName" + Thumbprint = $testParams.CertificateThumbprint + } } It "Should return Present from the Get method" { @@ -282,7 +282,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPTrustedRootAuthority -MockWith { return @{ - Name = $testParams.Name + Name = $testParams.Name Certificate = @{ Thumbprint = "770515261D1AB169057E246E0EE6431D557C3AFC" } @@ -294,16 +294,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-Item -MockWith { - return @{ - Subject = "CN=CertName" - Thumbprint = $testParams.CertificateThumbprint - } + return @{ + Subject = "CN=CertName" + Thumbprint = $testParams.CertificateThumbprint + } } Mock -CommandName New-Object -MockWith { $retVal = [pscustomobject]@{ - Subject = "CN=CertIdentifer" - Thumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" + Subject = "CN=CertIdentifer" + Thumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" HasPrivateKey = $false } Add-Member -InputObject $retVal -MemberType ScriptMethod Import { } @@ -328,14 +328,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When TrustedRootAuthority should exist and does exist in the farm, but has incorrect certificate, but specified certificate doesn't exist;" -Fixture { $testParams = @{ - Name = "CertIdentifier" + Name = "CertIdentifier" CertificateThumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPTrustedRootAuthority -MockWith { return @{ - Name = $testParams.Name + Name = $testParams.Name Certificate = @{ Thumbprint = "770515261D1AB169057E246E0EE6431D557C3AFC" } @@ -343,7 +343,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-Item -MockWith { - return $null + return $null } It "Should return Present from the Get method" { @@ -355,15 +355,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should thorw Certificate not found error in the set method" { - { Set-TargetResource @testParams } | Should Throw "Certificate not found in the local Certificate Store" + { Set-TargetResource @testParams } | Should Throw "Certificate not found in the local Certificate Store" } } Context -Name "When TrustedRootAuthority should exist and doesn't exist in the farm, but has an invalid certificate." -Fixture { $testParams = @{ - Name = "CertIdentifier" + Name = "CertIdentifier" CertificateThumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPTrustedRootAuthority -MockWith { @@ -371,7 +371,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-Item -MockWith { - return $null + return $null } It "Should return Absent from the Get method" { @@ -389,16 +389,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When TrustedRootAuthority should exist and doesn't exist in the farm (Thumbprint)." -Fixture { $testParams = @{ - Name = "CertIdentifier" + Name = "CertIdentifier" CertificateThumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-Item -MockWith { - return @{ - Subject = "CN=CertIdentifier" - Thumbprint = $testParams.CertificateThumbprint - } + return @{ + Subject = "CN=CertIdentifier" + Thumbprint = $testParams.CertificateThumbprint + } } Mock -CommandName Get-SPTrustedRootAuthority -MockWith { @@ -414,9 +414,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should create a new service application in the set method" { - Set-TargetResource @testParams - Assert-MockCalled Get-Item -Times 1 - Assert-MockCalled New-SPTrustedRootAuthority -Times 1 + Set-TargetResource @testParams + Assert-MockCalled Get-Item -Times 1 + Assert-MockCalled New-SPTrustedRootAuthority -Times 1 } } @@ -432,16 +432,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-Item -MockWith { - return @{ - Subject = "CN=CertName" - Thumbprint = $testParams.CertificateThumbprint - } + return @{ + Subject = "CN=CertName" + Thumbprint = $testParams.CertificateThumbprint + } } Mock -CommandName New-Object -MockWith { $retVal = [pscustomobject]@{ - Subject = "CN=CertIdentifer" - Thumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" + Subject = "CN=CertIdentifer" + Thumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" HasPrivateKey = $false } Add-Member -InputObject $retVal -MemberType ScriptMethod Import { } @@ -462,48 +462,48 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should create a new service application in the set method" { - Set-TargetResource @testParams - Assert-MockCalled New-SPTrustedRootAuthority -Times 1 + Set-TargetResource @testParams + Assert-MockCalled New-SPTrustedRootAuthority -Times 1 } } Context -Name "When TrustedRootAuthority should exist and doesn't exist in the farm, but specified cert contains a private key" -Fixture { $testParams = @{ - Name = "CertIdentifier" + Name = "CertIdentifier" CertificateThumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-Item ` - -MockWith { - $retVal = [pscustomobject]@{ - Subject = "CN=CertIdentifier" - Thumbprint = $testParams.CertificateThumbprint - HasPrivateKey = $true - } + -MockWith { + $retVal = [pscustomobject]@{ + Subject = "CN=CertIdentifier" + Thumbprint = $testParams.CertificateThumbprint + HasPrivateKey = $true + } - Add-Member -InputObject $retVal -MemberType ScriptMethod Export { - $bytes = [System.Byte[]]::CreateInstance([System.Byte],512) - return $bytes - } + Add-Member -InputObject $retVal -MemberType ScriptMethod Export { + $bytes = [System.Byte[]]::CreateInstance([System.Byte], 512) + return $bytes + } - return $retVal + return $retVal } Mock -CommandName New-Object ` - -ParameterFilter { $TypeName -eq "System.Security.Cryptography.X509Certificates.X509Certificate2" } ` - -MockWith { - $retVal = [pscustomobject]@{} - Add-Member -InputObject $retVal -MemberType ScriptMethod Import { - param([System.Byte[]]$bytes) - return @{ - Subject = "CN=CertIdentifer" - Thumbprint = $testParams.CertificateThumbprint - HasPrivateKey = $false - } + -ParameterFilter { $TypeName -eq "System.Security.Cryptography.X509Certificates.X509Certificate2" } ` + -MockWith { + $retVal = [pscustomobject]@{ } + Add-Member -InputObject $retVal -MemberType ScriptMethod Import { + param([System.Byte[]]$bytes) + return @{ + Subject = "CN=CertIdentifer" + Thumbprint = $testParams.CertificateThumbprint + HasPrivateKey = $false } + } - return $retVal + return $retVal } Mock -CommandName Get-SPTrustedRootAuthority -MockWith { @@ -519,29 +519,29 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should create a new Trusted Root Authority in the set method" { - Set-TargetResource @testParams - Assert-MockCalled Get-Item -Times 1 - Assert-MockCalled New-SPTrustedRootAuthority -Times 1 - Assert-MockCalled New-Object -Times 1 + Set-TargetResource @testParams + Assert-MockCalled Get-Item -Times 1 + Assert-MockCalled New-SPTrustedRootAuthority -Times 1 + Assert-MockCalled New-Object -Times 1 } } Context -Name "When TrustedRootAuthority should exist and does exist but is incorrect certificate and specified cert contains a private key" -Fixture { $testParams = @{ - Name = "CertIdentifier" + Name = "CertIdentifier" CertificateThumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-Item -MockWith { $retVal = [pscustomobject]@{ - Subject = "CN=CertIdentifier" - Thumbprint = $testParams.CertificateThumbprint + Subject = "CN=CertIdentifier" + Thumbprint = $testParams.CertificateThumbprint HasPrivateKey = $true } Add-Member -InputObject $retVal -MemberType ScriptMethod Export { - $bytes = [System.Byte[]]::CreateInstance([System.Byte],512) + $bytes = [System.Byte[]]::CreateInstance([System.Byte], 512) return $bytes } @@ -549,13 +549,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName New-Object -MockWith { - $retVal = [pscustomobject]@{} + $retVal = [pscustomobject]@{ } Add-Member -InputObject $retVal -MemberType ScriptMethod Import { param([System.Byte[]]$bytes) return @{ - Subject = "CN=CertIdentifer" - Thumbprint = $testParams.CertificateThumbprint - HasPrivateKey = $false + Subject = "CN=CertIdentifer" + Thumbprint = $testParams.CertificateThumbprint + HasPrivateKey = $false } } @@ -564,7 +564,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPTrustedRootAuthority -MockWith { return @{ - Name = $testParams.Name + Name = $testParams.Name Certificate = @{ Thumbprint = "770515261D1AB169057E246E0EE6431D557C3AFC" } @@ -580,30 +580,30 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should create a new Trusted Root Authority in the set method" { - Set-TargetResource @testParams - Assert-MockCalled Get-Item -Times 1 - Assert-MockCalled Set-SPTrustedRootAuthority -Times 1 - Assert-MockCalled New-Object -Times 1 + Set-TargetResource @testParams + Assert-MockCalled Get-Item -Times 1 + Assert-MockCalled Set-SPTrustedRootAuthority -Times 1 + Assert-MockCalled New-Object -Times 1 } } Context -Name "When TrustedRootAuthority shouldn't exist and does exist in the farm." -Fixture { $testParams = @{ - Name = "CertIdentifier" + Name = "CertIdentifier" CertificateThumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-Item -MockWith { - return @{ - Subject = "CN=CertIdentifier" - Thumbprint = $testParams.CertificateThumbprint - } + return @{ + Subject = "CN=CertIdentifier" + Thumbprint = $testParams.CertificateThumbprint + } } Mock -CommandName Get-SPTrustedRootAuthority -MockWith { return @{ - Name = $testParams.Name + Name = $testParams.Name Certificate = @{ Thumbprint = $testParams.CertificateThumbprint } @@ -626,16 +626,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When TrustedRootAuthority shouldn't exist and doesn't exist in the farm." -Fixture { $testParams = @{ - Name = "CertIdentifier" + Name = "CertIdentifier" CertificateThumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-Item -MockWith { - return @{ - Subject = "CN=CertIdentifier" - Thumbprint = $testParams.CertificateThumbprint - } + return @{ + Subject = "CN=CertIdentifier" + Thumbprint = $testParams.CertificateThumbprint + } } Mock -CommandName Get-SPTrustedRootAuthority -MockWith { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPTrustedSecurityTokenIssuer.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPTrustedSecurityTokenIssuer.Tests.ps1 new file mode 100644 index 000000000..af2d94b76 --- /dev/null +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPTrustedSecurityTokenIssuer.Tests.ps1 @@ -0,0 +1,464 @@ +[CmdletBinding()] +param( + [Parameter()] + [string] + $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) +) + +Import-Module -Name (Join-Path -Path $PSScriptRoot ` + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) + +$Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` + -DscResource "SPTrustedSecurityTokenIssuer" + +Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { + InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { + Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope + + # global variables + $SPTrustName = "HighTrust" + $SPTrustDescription = "HighTrust fake" + $SPTrustRegisteredIssuerNameIdentifier = "22222222-2222-2222-2222-222222222222" + $SPTrustSigningCertificateThumbprint = "123ABCFACE123ABCFACE123ABCFACE123ABCFACE" + $SPTrustSigningCertificateFilePath = "F:\Data\DSC\FakeSigning.cer" + $SPTrustAuthenticationRealm = [Guid]::New("D683A811-9F0E-49BC-8BF1-DC1C5FEC8447") + + # Mocks for all contexts + Mock -CommandName New-SPTrustedSecurityTokenIssuer -MockWith { + $sptrust = [pscustomobject]@{ + RegisteredIssuerName = "$SPTrustRegisteredIssuerNameIdentifier@$(Get-SPAuthenticationRealm)" + Name = $testParams.Name + Description = $SPTrustDescription + } + $sptrust | Add-Member -Name Update -MemberType ScriptMethod -Value { } + return $sptrust + } + + Mock -CommandName Get-ChildItem -MockWith { + return @( + @{ + Thumbprint = $SPTrustSigningCertificateThumbprint + } + ) + } -ParameterFilter { $Path -eq "Cert:\LocalMachine\My" } + + Mock -CommandName New-Object -MockWith { + return @( + @{ + Thumbprint = $SPTrustSigningCertificateThumbprint + } + ) + } -ParameterFilter { $TypeName -eq "System.Security.Cryptography.X509Certificates.X509Certificate2" } + #} -ParameterFilter { $TypeName -eq "System.Security.Cryptography.X509Certificates.X509Certificate2" -and $PSBoundParameters[0] -match $SPTrustSigningCertificateFilePath } + + Mock -CommandName Get-SPAuthenticationRealm -MockWith { + return $SPTrustAuthenticationRealm + } + + Mock -CommandName Set-SPTrustedSecurityTokenIssuer -MockWith { } + + # Test contexts + Context -Name "The SPTrustedSecurityTokenIssuer does not exist and should be created, using a signing certificate in the certificate store and the realm of the farm" -Fixture { + $testParams = @{ + Name = $SPTrustName + Description = $SPTrustDescription + RegisteredIssuerNameIdentifier = $SPTrustRegisteredIssuerNameIdentifier + RegisteredIssuerNameRealm = "" + SigningCertificateThumbprint = $SPTrustSigningCertificateThumbprint + IsTrustBroker = $true + Ensure = "Present" + } + + It "Should create the SPTrustedSecurityTokenIssuer using the realm of the farm" { + Set-TargetResource @testParams + Assert-MockCalled -CommandName "New-SPTrustedSecurityTokenIssuer" + Assert-MockCalled -Times 1 -CommandName "Get-SPAuthenticationRealm" + } + } + + Context -Name "The SPTrustedSecurityTokenIssuer does not exist and should be created, using a signing certificate in the fire system and the realm of the farm" -Fixture { + $testParams = @{ + Name = $SPTrustName + Description = $SPTrustDescription + RegisteredIssuerNameIdentifier = $SPTrustRegisteredIssuerNameIdentifier + RegisteredIssuerNameRealm = $null + SigningCertificateFilePath = $SPTrustSigningCertificateFilePath + IsTrustBroker = $true + Ensure = "Present" + } + + It "Should create the SPTrustedSecurityTokenIssuer using the realm of the farm" { + Set-TargetResource @testParams + Assert-MockCalled -CommandName "New-SPTrustedSecurityTokenIssuer" + Assert-MockCalled -Times 1 -CommandName "Get-SPAuthenticationRealm" + } + } + + Context -Name "The SPTrustedSecurityTokenIssuer does not exist and should be created, using a custom realm" -Fixture { + $testParams = @{ + Name = $SPTrustName + Description = $SPTrustDescription + RegisteredIssuerNameIdentifier = $SPTrustRegisteredIssuerNameIdentifier + RegisteredIssuerNameRealm = "C47023F3-4109-4C6E-8913-DFC3DBACD8C5" + SigningCertificateThumbprint = $SPTrustSigningCertificateThumbprint + IsTrustBroker = $true + Ensure = "Present" + } + + Mock -CommandName New-SPTrustedSecurityTokenIssuer -MockWith { + $sptrust = [pscustomobject]@{ + Name = $testParams.Name + RegisteredIssuerName = "$($testParams.RegisteredIssuerNameIdentifier)@$($testParams.RegisteredIssuerNameRealm)" + Description = $SPTrustDescription + } + $sptrust | Add-Member -Name Update -MemberType ScriptMethod -Value { } + return $sptrust + } + + It "Should create the SPTrustedSecurityTokenIssuer using the custom realm" { + Set-TargetResource @testParams + Assert-MockCalled -CommandName "New-SPTrustedSecurityTokenIssuer" + Assert-MockCalled -Times 0 -CommandName "Get-SPAuthenticationRealm" + } + } + + Context -Name "The SPTrustedSecurityTokenIssuer does not exist and should be created, using a MetadataEndPoint" -Fixture { + $testParams = @{ + Name = $SPTrustName + Description = $SPTrustDescription + MetadataEndPoint = "https://accounts.accesscontrol.windows.net/TENANT.onmicrosoft.com/metadata/json/1" + IsTrustBroker = $true + Ensure = "Present" + } + + Mock -CommandName Get-SPTrustedSecurityTokenIssuer -MockWith { + return $null + } + + Mock -CommandName New-SPTrustedSecurityTokenIssuer -MockWith { + $sptrust = [pscustomobject]@{ + Name = $testParams.Name + RegisteredIssuerName = "$SPTrustRegisteredIssuerNameIdentifier@5d38d3ac-eeb7-4fa4-992b-8d1d3a1cb405" + Description = $SPTrustDescription + MetadataEndPoint = $testParams.MetadataEndPoint + } + $sptrust | Add-Member -Name Update -MemberType ScriptMethod -Value { } + return $sptrust + } + + It "Should create the SPTrustedSecurityTokenIssuer using a MetadataEndPoint" { + Set-TargetResource @testParams + Assert-MockCalled -CommandName "New-SPTrustedSecurityTokenIssuer" + Assert-MockCalled -Times 0 -CommandName "Get-SPAuthenticationRealm" + } + } + + Context -Name "The SPTrustedSecurityTokenIssuer is desired, but both parameters SigningCertificateThumbprint and SigningCertificateFilePath are set while exactly 1 should" -Fixture { + $testParams = @{ + Name = $SPTrustName + Description = $SPTrustDescription + RegisteredIssuerNameIdentifier = $SPTrustRegisteredIssuerNameIdentifier + SigningCertificateThumbprint = $SPTrustSigningCertificateThumbprint + SigningCertificateFilePath = $SPTrustSigningCertificateFilePath + IsTrustBroker = $true + Ensure = "Present" + } + + It "should fail validation of signing certificate parameters in the Set method" { + { Set-TargetResource @testParams } | Should Throw "Cannot use both parameters SigningCertificateThumbprint and SigningCertificateFilePath at the same time." + } + + It "should fail validation of signing certificate parameters in the Test method" { + { Test-TargetResource @testParams } | Should Throw "Cannot use both parameters SigningCertificateThumbprint and SigningCertificateFilePath at the same time." + } + } + + Context -Name "The SPTrustedSecurityTokenIssuer is desired, but both parameters SigningCertificateThumbprint and MetadataEndPoint are set while exactly 1 should" -Fixture { + $testParams = @{ + Name = $SPTrustName + Description = $SPTrustDescription + RegisteredIssuerNameIdentifier = $SPTrustRegisteredIssuerNameIdentifier + SigningCertificateThumbprint = $SPTrustSigningCertificateThumbprint + MetadataEndPoint = "https://accounts.accesscontrol.windows.net/TENANT.onmicrosoft.com/metadata/json/1" + IsTrustBroker = $true + Ensure = "Present" + } + + It "should fail validation of signing certificate parameters in the Set method" { + { Set-TargetResource @testParams } | Should Throw "Cannot use both parameters SigningCertificateThumbprint and MetadataEndPoint at the same time." + } + + It "should fail validation of signing certificate parameters in the Test method" { + { Test-TargetResource @testParams } | Should Throw "Cannot use both parameters SigningCertificateThumbprint and MetadataEndPoint at the same time." + } + } + + Context -Name "The SPTrustedSecurityTokenIssuer is desired, but both parameters SigningCertificateFilePath and MetadataEndPoint are set while exactly 1 should" -Fixture { + $testParams = @{ + Name = $SPTrustName + Description = $SPTrustDescription + RegisteredIssuerNameIdentifier = $SPTrustRegisteredIssuerNameIdentifier + SigningCertificateFilePath = $SPTrustSigningCertificateFilePath + MetadataEndPoint = "https://accounts.accesscontrol.windows.net/TENANT.onmicrosoft.com/metadata/json/1" + IsTrustBroker = $true + Ensure = "Present" + } + + It "should fail validation of signing certificate parameters in the Set method" { + { Set-TargetResource @testParams } | Should Throw "Cannot use both parameters SigningCertificateFilePath and MetadataEndPoint at the same time." + } + + It "should fail validation of signing certificate parameters in the Test method" { + { Test-TargetResource @testParams } | Should Throw "Cannot use both parameters SigningCertificateFilePath and MetadataEndPoint at the same time." + } + } + + Context -Name "The SPTrustedSecurityTokenIssuer is desired, but the thumbprint of the signing certificate in parameter SigningCertificateThumbprint is invalid" -Fixture { + $testParams = @{ + Name = $SPTrustName + Description = $SPTrustDescription + RegisteredIssuerNameIdentifier = $SPTrustRegisteredIssuerNameIdentifier + SigningCertificateThumbprint = "XX123ABCFACEXX" + IsTrustBroker = $true + Ensure = "Present" + } + + It "should fail validation of parameter SigningCertificateThumbprint in the Set method" { + { Set-TargetResource @testParams } | Should Throw "Parameter SigningCertificateThumbprint does not match valid format '^[A-Fa-f0-9]{40}$'." + } + } + + Context -Name "The SPTrustedSecurityTokenIssuer already exists and its signing certificate is specified using SigningCertificateThumbprint, and should not be changed" -Fixture { + $testParams = @{ + Name = $SPTrustName + Description = $SPTrustDescription + RegisteredIssuerNameIdentifier = $SPTrustRegisteredIssuerNameIdentifier + SigningCertificateThumbprint = $SPTrustSigningCertificateThumbprint + IsTrustBroker = $true + Ensure = "Present" + } + + Mock -CommandName Get-SPTrustedSecurityTokenIssuer -MockWith { + $sptrust = [pscustomobject]@{ + Name = $testParams.Name + RegisteredIssuerName = "$($testParams.RegisteredIssuerNameIdentifier)@$(Get-SPAuthenticationRealm)" + Description = $testParams.Description + IsSelfIssuer = !$testParams.IsTrustBroker + SigningCertificate = [pscustomobject]@{ + Thumbprint = $testParams.SigningCertificateThumbprint + } + } + return $sptrust + } + + It "Should be returned the get method with expected properties" { + $getResults = Get-TargetResource @testParams + $getResults.Ensure | Should Be "Present" + $getResults.Description | Should Be "$($testParams.Description)" + $getResults.RegisteredIssuerNameIdentifier | Should Be "$($testParams.RegisteredIssuerNameIdentifier)" + $getResults.RegisteredIssuerNameRealm | Should Be $null + $getResults.SigningCertificateThumbprint | Should Be "$($testParams.SigningCertificateThumbprint)" + $getResults.IsTrustBroker | Should Be "$($testParams.IsTrustBroker)" + } + + It "Should return true from the Test method" { + Test-TargetResource @testParams | Should Be $true + } + } + + Context -Name "The SPTrustedSecurityTokenIssuer already exists and its signing certificate is specified using SigningCertificateFilePath, and should not be changed" -Fixture { + $testParams = @{ + Name = $SPTrustName + Description = $SPTrustDescription + RegisteredIssuerNameIdentifier = $SPTrustRegisteredIssuerNameIdentifier + SigningCertificateFilePath = $SPTrustSigningCertificateFilePath + IsTrustBroker = $true + Ensure = "Present" + } + + Mock -CommandName Get-SPTrustedSecurityTokenIssuer -MockWith { + $sptrust = [pscustomobject]@{ + Name = $testParams.Name + RegisteredIssuerName = "$($testParams.RegisteredIssuerNameIdentifier)@$(Get-SPAuthenticationRealm)" + Description = $testParams.Description + IsSelfIssuer = !$testParams.IsTrustBroker + SigningCertificate = [pscustomobject]@{ + Thumbprint = $testParams.SigningCertificateThumbprint + } + } + return $sptrust + } + + It "Should be returned the get method with expected properties" { + $getResults = Get-TargetResource @testParams + $getResults.Ensure | Should Be "Present" + $getResults.Description | Should Be "$($testParams.Description)" + $getResults.RegisteredIssuerNameIdentifier | Should Be "$($testParams.RegisteredIssuerNameIdentifier)" + $getResults.RegisteredIssuerNameRealm | Should Be $null + $getResults.SigningCertificateFilePath | Should Be "$($testParams.SigningCertificateFilePath)" + $getResults.IsTrustBroker | Should Be "$($testParams.IsTrustBroker)" + } + + It "Should return true from the Test method" { + Test-TargetResource @testParams | Should Be $true + } + } + + Context -Name "The SPTrustedSecurityTokenIssuer exists and should be removed" -Fixture { + $testParams = @{ + Name = $SPTrustName + Description = $SPTrustDescription + RegisteredIssuerNameIdentifier = $SPTrustRegisteredIssuerNameIdentifier + SigningCertificateThumbprint = $SPTrustSigningCertificateThumbprint + IsTrustBroker = $true + Ensure = "Absent" + } + + Mock -CommandName Get-SPTrustedSecurityTokenIssuer -MockWith { + $sptrust = [pscustomobject]@{ + Name = $testParams.Name + RegisteredIssuerName = "$($testParams.RegisteredIssuerNameIdentifier)@$(Get-SPAuthenticationRealm)" + } + return $sptrust + } + + Mock -CommandName Remove-SPTrustedSecurityTokenIssuer -MockWith { } + + It "Should be returned the get method with expected properties" { + $getResults = Get-TargetResource @testParams + $getResults.Ensure | Should Be "Present" + $getResults.RegisteredIssuerNameIdentifier | Should Be "$($testParams.RegisteredIssuerNameIdentifier)" + $getResults.RegisteredIssuerNameRealm | Should Be $null + } + + It "Should return false from the Test method" { + Test-TargetResource @testParams | Should Be $false + } + + It "Should remove the SPTrustedSecurityTokenIssuer" { + Set-TargetResource @testParams + Assert-MockCalled Remove-SPTrustedSecurityTokenIssuer + } + } + + Context -Name "The SPTrustedSecurityTokenIssuer exists and should be updated with a new RegisteredIssuerName" -Fixture { + $testParams = @{ + Name = $SPTrustName + Description = $SPTrustDescription + RegisteredIssuerNameIdentifier = "22222222-2222-2222-2222-333333333333" + SigningCertificateThumbprint = $SPTrustSigningCertificateThumbprint + IsTrustBroker = $true + Ensure = "Present" + } + + Mock -CommandName Get-SPTrustedSecurityTokenIssuer -MockWith { + $sptrust = [pscustomobject]@{ + Name = $testParams.Name + RegisteredIssuerName = "$SPTrustRegisteredIssuerNameIdentifier@$(Get-SPAuthenticationRealm)" + Description = $SPTrustDescription + IsSelfIssuer = $true + SigningCertificate = [pscustomobject]@{ + Thumbprint = $testParams.$SPTrustSigningCertificateThumbprint + } + } + return $sptrust + } + + It "Should be returned the get method with expected properties" { + $getResults = Get-TargetResource @testParams + $getResults.Ensure | Should Be "Present" + } + + It "Should return false from the Test method" { + Test-TargetResource @testParams | Should Be $false + } + + It "Should update the SPTrustedSecurityTokenIssuer" { + Set-TargetResource @testParams + Assert-MockCalled Set-SPTrustedSecurityTokenIssuer + } + } + + Context -Name "The SPTrustedSecurityTokenIssuer exists and should be updated with a new RegisteredIssuerRealm" -Fixture { + $testParams = @{ + Name = $SPTrustName + Description = $SPTrustDescription + RegisteredIssuerNameIdentifier = $SPTrustRegisteredIssuerNameIdentifier + RegisteredIssuerNameRealm = [Guid]::NewGuid() + SigningCertificateThumbprint = $SPTrustSigningCertificateThumbprint + IsTrustBroker = $true + Ensure = "Present" + } + + Mock -CommandName Get-SPTrustedSecurityTokenIssuer -MockWith { + $sptrust = [pscustomobject]@{ + Name = $testParams.Name + RegisteredIssuerName = "$SPTrustRegisteredIssuerNameIdentifier@$(Get-SPAuthenticationRealm)" + Description = $SPTrustDescription + IsSelfIssuer = $true + SigningCertificate = [pscustomobject]@{ + Thumbprint = $testParams.$SPTrustSigningCertificateThumbprint + } + } + return $sptrust + } + + It "Should be returned the get method with expected properties" { + $getResults = Get-TargetResource @testParams + $getResults.Ensure | Should Be "Present" + } + + It "Should return false from the Test method" { + Test-TargetResource @testParams | Should Be $false + } + + It "Should update the SPTrustedSecurityTokenIssuer" { + Set-TargetResource @testParams + Assert-MockCalled Set-SPTrustedSecurityTokenIssuer + } + } + + Context -Name "The SPTrustedSecurityTokenIssuer exists and should be updated with a new Description" -Fixture { + $testParams = @{ + Name = $SPTrustName + Description = "New description" + RegisteredIssuerNameIdentifier = $SPTrustRegisteredIssuerNameIdentifier + SigningCertificateThumbprint = $SPTrustSigningCertificateThumbprint + IsTrustBroker = $true + Ensure = "Present" + } + + Mock -CommandName Get-SPTrustedSecurityTokenIssuer -MockWith { + $sptrust = [pscustomobject]@{ + Name = $testParams.Name + RegisteredIssuerName = "$SPTrustRegisteredIssuerNameIdentifier@$(Get-SPAuthenticationRealm)" + Description = $SPTrustDescription + IsSelfIssuer = $true + SigningCertificate = [pscustomobject]@{ + Thumbprint = $testParams.$SPTrustSigningCertificateThumbprint + } + } + return $sptrust + } + + It "Should be returned the get method with expected properties" { + $getResults = Get-TargetResource @testParams + $getResults.Ensure | Should Be "Present" + } + + It "Should return false from the Test method" { + Test-TargetResource @testParams | Should Be $false + } + + It "Should update the SPTrustedSecurityTokenIssuer" { + Set-TargetResource @testParams + Assert-MockCalled Set-SPTrustedSecurityTokenIssuer + } + } + } +} + +Invoke-Command -ScriptBlock $Global:SPDscHelper.CleanupScript -NoNewScope diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPUsageApplication.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPUsageApplication.Tests.ps1 index 7593da6a5..c51efae88 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPUsageApplication.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPUsageApplication.Tests.ps1 @@ -2,18 +2,18 @@ [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPUsageApplication" + -DscResource "SPUsageApplication" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -22,55 +22,55 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Initialize tests $getTypeFullName = "Microsoft.SharePoint.Administration.SPUsageApplication" $getTypeFullNameProxy = "Microsoft.SharePoint.Administration.SPUsageApplicationProxy" - + $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force $mockCredential = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList @("DOMAIN\username", $mockPassword) + -ArgumentList @("DOMAIN\username", $mockPassword) - # Mocks for all contexts + # Mocks for all contexts Mock -CommandName New-SPUsageApplication -MockWith { } Mock -CommandName Set-SPUsageService -MockWith { } - Mock -CommandName Get-SPUsageService -MockWith { + Mock -CommandName Get-SPUsageService -MockWith { return @{ - UsageLogCutTime = $testParams.UsageLogCutTime - UsageLogDir = $testParams.UsageLogLocation + UsageLogCutTime = $testParams.UsageLogCutTime + UsageLogDir = $testParams.UsageLogLocation UsageLogMaxFileSize = ($testParams.UsageLogMaxFileSizeKB * 1024) - UsageLogMaxSpaceGB = $testParams.UsageLogMaxSpaceGB + UsageLogMaxSpaceGB = $testParams.UsageLogMaxSpaceGB } } - Mock -CommandName Remove-SPServiceApplication -MockWith {} + Mock -CommandName Remove-SPServiceApplication -MockWith { } Mock -CommandName Get-SPServiceApplicationProxy -MockWith { - return (New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name Provision ` - -Value {} ` - -PassThru | - Add-Member -NotePropertyName Status ` - -NotePropertyValue "Online" ` - -PassThru | - Add-Member -NotePropertyName TypeName ` - -NotePropertyValue "Usage and Health Data Collection Proxy" ` - -PassThru) - } + return (New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name Provision ` + -Value { } ` + -PassThru | + Add-Member -NotePropertyName Status ` + -NotePropertyValue "Online" ` + -PassThru | + Add-Member -NotePropertyName TypeName ` + -NotePropertyValue "Usage and Health Data Collection Proxy" ` + -PassThru) + } # Test contexts Context -Name "When no service applications exist in the current farm" -Fixture { $testParams = @{ - Name = "Usage Service App" - UsageLogCutTime = 60 - UsageLogLocation = "L:\UsageLogs" - UsageLogMaxFileSizeKB = 1024 - UsageLogMaxSpaceGB = 10 - DatabaseName = "SP_Usage" - DatabaseServer = "sql.test.domain" + Name = "Usage Service App" + UsageLogCutTime = 60 + UsageLogLocation = "L:\UsageLogs" + UsageLogMaxFileSizeKB = 1024 + UsageLogMaxSpaceGB = 10 + DatabaseName = "SP_Usage" + DatabaseServer = "sql.test.domain" FailoverDatabaseServer = "anothersql.test.domain" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { return $null } It "Should return null from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return false when the Test method is called" { @@ -91,33 +91,33 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When service applications exist in the current farm but not the specific usage service app" -Fixture { $testParams = @{ - Name = "Usage Service App" - UsageLogCutTime = 60 - UsageLogLocation = "L:\UsageLogs" - UsageLogMaxFileSizeKB = 1024 - UsageLogMaxSpaceGB = 10 - DatabaseName = "SP_Usage" - DatabaseServer = "sql.test.domain" + Name = "Usage Service App" + UsageLogCutTime = 60 + UsageLogLocation = "L:\UsageLogs" + UsageLogMaxFileSizeKB = 1024 + UsageLogMaxSpaceGB = 10 + DatabaseName = "SP_Usage" + DatabaseServer = "sql.test.domain" FailoverDatabaseServer = "anothersql.test.domain" - Ensure = "Present" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - } + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + DisplayName = $testParams.Name + } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "Microsoft.Office.UnKnownWebServiceApplication" - } - } -PassThru -Force - return $spServiceApp + -Name GetType ` + -Value { + return @{ + FullName = "Microsoft.Office.UnKnownWebServiceApplication" + } + } -PassThru -Force + return $spServiceApp } It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return false when the Test method is called" { @@ -127,34 +127,34 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and is configured correctly" -Fixture { $testParams = @{ - Name = "Usage Service App" - UsageLogCutTime = 60 - UsageLogLocation = "L:\UsageLogs" - UsageLogMaxFileSizeKB = 1024 - UsageLogMaxSpaceGB = 10 - DatabaseName = "SP_Usage" - DatabaseServer = "sql.test.domain" + Name = "Usage Service App" + UsageLogCutTime = 60 + UsageLogLocation = "L:\UsageLogs" + UsageLogMaxFileSizeKB = 1024 + UsageLogMaxSpaceGB = 10 + DatabaseName = "SP_Usage" + DatabaseServer = "sql.test.domain" FailoverDatabaseServer = "anothersql.test.domain" - Ensure = "Present" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplication -MockWith { + Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Usage and Health Data Collection Service Application" - DisplayName = $testParams.Name + TypeName = "Usage and Health Data Collection Service Application" + DisplayName = $testParams.Name UsageDatabase = @{ - Name = $testParams.DatabaseName + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } It "Should return values from the get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Present" + (Get-TargetResource @testParams).Ensure | Should Be "Present" } It "Should return true when the Test method is called" { @@ -164,38 +164,38 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and log path are not configured correctly" -Fixture { $testParams = @{ - Name = "Usage Service App" - UsageLogCutTime = 60 - UsageLogLocation = "L:\UsageLogs" - UsageLogMaxFileSizeKB = 1024 - UsageLogMaxSpaceGB = 10 - DatabaseName = "SP_Usage" - DatabaseServer = "sql.test.domain" + Name = "Usage Service App" + UsageLogCutTime = 60 + UsageLogLocation = "L:\UsageLogs" + UsageLogMaxFileSizeKB = 1024 + UsageLogMaxSpaceGB = 10 + DatabaseName = "SP_Usage" + DatabaseServer = "sql.test.domain" FailoverDatabaseServer = "anothersql.test.domain" - Ensure = "Present" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplication -MockWith { + Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Usage and Health Data Collection Service Application" - DisplayName = $testParams.Name + TypeName = "Usage and Health Data Collection Service Application" + DisplayName = $testParams.Name UsageDatabase = @{ - Name = $testParams.DatabaseName + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } - Mock -CommandName Get-SPUsageService -MockWith { + Mock -CommandName Get-SPUsageService -MockWith { return @{ - UsageLogCutTime = $testParams.UsageLogCutTime - UsageLogDir = "C:\Wrong\Location" + UsageLogCutTime = $testParams.UsageLogCutTime + UsageLogDir = "C:\Wrong\Location" UsageLogMaxFileSize = ($testParams.UsageLogMaxFileSizeKB * 1024) - UsageLogMaxSpaceGB = $testParams.UsageLogMaxSpaceGB + UsageLogMaxSpaceGB = $testParams.UsageLogMaxSpaceGB } } @@ -211,38 +211,38 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and log size is not configured correctly" -Fixture { $testParams = @{ - Name = "Usage Service App" - UsageLogCutTime = 60 - UsageLogLocation = "L:\UsageLogs" - UsageLogMaxFileSizeKB = 1024 - UsageLogMaxSpaceGB = 10 - DatabaseName = "SP_Usage" - DatabaseServer = "sql.test.domain" + Name = "Usage Service App" + UsageLogCutTime = 60 + UsageLogLocation = "L:\UsageLogs" + UsageLogMaxFileSizeKB = 1024 + UsageLogMaxSpaceGB = 10 + DatabaseName = "SP_Usage" + DatabaseServer = "sql.test.domain" FailoverDatabaseServer = "anothersql.test.domain" - Ensure = "Present" + Ensure = "Present" } - Mock -CommandName Get-SPServiceApplication -MockWith { + Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Usage and Health Data Collection Service Application" - DisplayName = $testParams.Name + TypeName = "Usage and Health Data Collection Service Application" + DisplayName = $testParams.Name UsageDatabase = @{ - Name = $testParams.DatabaseName + Name = $testParams.DatabaseName NormalizedDataSource = $testParams.DatabaseServer } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } - Mock -CommandName Get-SPUsageService -MockWith { + Mock -CommandName Get-SPUsageService -MockWith { return @{ - UsageLogCutTime = $testParams.UsageLogCutTime - UsageLogDir = $testParams.UsageLogLocation + UsageLogCutTime = $testParams.UsageLogCutTime + UsageLogDir = $testParams.UsageLogLocation UsageLogMaxFileSize = ($testParams.UsageLogMaxFileSizeKB * 1024) - UsageLogMaxSpaceGB = 1 + UsageLogMaxSpaceGB = 1 } } @@ -255,109 +255,109 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Assert-MockCalled Set-SPUsageService } } - + Context -Name "When the service app exists but it shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" Ensure = "Absent" } - - Mock -CommandName Get-SPServiceApplication -MockWith { + + Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Usage and Health Data Collection Service Application" - DisplayName = $testParams.Name + TypeName = "Usage and Health Data Collection Service Application" + DisplayName = $testParams.Name UsageDatabase = @{ - Name = "db" + Name = "db" NormalizedDataSource = "server" } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } - + It "Should return present from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Present" + (Get-TargetResource @testParams).Ensure | Should Be "Present" } - + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false } - + It "Should remove the service application in the set method" { Set-TargetResource @testParams Assert-MockCalled Remove-SPServiceApplication } } - + Context -Name "When the service app doesn't exist and shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" Ensure = "Absent" } - - Mock -CommandName Get-SPServiceApplication -MockWith { - return $null + + Mock -CommandName Get-SPServiceApplication -MockWith { + return $null } - + It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $true } } - + Context -Name "The proxy for the service app is offline when it should be running" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" Ensure = "Present" } - Mock -CommandName Get-SPServiceApplication -MockWith { + Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Usage and Health Data Collection Service Application" - DisplayName = $testParams.Name + TypeName = "Usage and Health Data Collection Service Application" + DisplayName = $testParams.Name UsageDatabase = @{ - Name = "db" + Name = "db" NormalizedDataSource = "server" } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } Mock -CommandName Get-SPServiceApplicationProxy -MockWith { - $proxy = (New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod ` - -Name Provision ` - -Value { - $Global:SPDscUSageAppProxyStarted = $true - } -PassThru | - Add-Member -NotePropertyName Status ` - -NotePropertyValue "Disabled" ` - -PassThru | - Add-Member -NotePropertyName TypeName ` - -NotePropertyValue "Usage and Health Data Collection Proxy" ` - -PassThru) - $proxy = $proxy | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullNameProxy } + $proxy = (New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod ` + -Name Provision ` + -Value { + $Global:SPDscUSageAppProxyStarted = $true + } -PassThru | + Add-Member -NotePropertyName Status ` + -NotePropertyValue "Disabled" ` + -PassThru | + Add-Member -NotePropertyName TypeName ` + -NotePropertyValue "Usage and Health Data Collection Proxy" ` + -PassThru) + $proxy = $proxy | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullNameProxy } } -PassThru -Force return $proxy - } - + } + It "Should return absent from the get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - + It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false } - + It "Should start the proxy in the set method" { $Global:SPDscUSageAppProxyStarted = $false Set-TargetResource @testParams diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileProperty.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileProperty.Tests.ps1 index 54c8296fd..7e5c84c53 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileProperty.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileProperty.Tests.ps1 @@ -168,7 +168,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { CoreProperty = $corePropertyUpdate TypeProperty = $typePropertyUpdate UserOverridePrivacy = $false - }| Add-Member ScriptMethod Commit { + } | Add-Member ScriptMethod Commit { $Global:SPUPPropertyCommitCalled = $true } -PassThru @@ -229,7 +229,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $Global:SPUPGetPropertyByNameCalled = $true return $result - } -PassThru| Add-Member ScriptMethod Add { + } -PassThru | Add-Member ScriptMethod Add { $Global:SPUPSubTypeAddCalled = $true } -PassThru -Force @@ -247,7 +247,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDscUserProfileSubTypeManager -MockWith { $result = @{ - }| Add-Member ScriptMethod GetProfileSubtype { + } | Add-Member ScriptMethod GetProfileSubtype { $Global:SPUPGetProfileSubtypeCalled = $true return @{ Properties = $userProfileSubTypePropertiesNoProperty @@ -325,7 +325,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return $true } -PassThru - $propertyMapping = @{} | Add-Member ScriptMethod Item { + $propertyMapping = @{ } | Add-Member ScriptMethod Item { param( [string] $property @@ -354,7 +354,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $connection = $connection | Add-Member ScriptMethod Update { $Global:SPUPSSyncConnectionUpdateCalled = $true - } -PassThru | Add-Member ScriptMethod AddPropertyMapping { + } -PassThru | Add-Member ScriptMethod AddPropertyMapping { $Global:SPUPSSyncConnectionAddPropertyMappingCalled = $true } -PassThru @@ -452,7 +452,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When property doesn't exist, connection doesn't exist" { Mock -CommandName New-Object -MockWith { - $ProfilePropertyManager = @{"Contoso" = $connection} | Add-Member ScriptMethod GetCoreProperties { + $ProfilePropertyManager = @{"Contoso" = $connection } | Add-Member ScriptMethod GetCoreProperties { $Global:UpsConfigManagerGetCorePropertiesCalled = $true return ($coreProperties) } -PassThru | Add-Member ScriptMethod GetProfileTypeProperties { @@ -461,7 +461,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } -PassThru return (@{ ProfilePropertyManager = $ProfilePropertyManager - ConnectionManager = @{} + ConnectionManager = @{ } } | Add-Member ScriptMethod IsSynchronizationRunning { $Global:UpsSyncIsSynchronizationRunning = $true return $false @@ -490,7 +490,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $Global:SPUPGetPropertyByNameCalled = $false $Global:SPUPSMappingItemCalled = $false - {Set-TargetResource @testParamsNewProperty} | should throw "connection not found" + { Set-TargetResource @testParamsNewProperty } | should throw "connection not found" $Global:SPUPGetProfileSubtypeCalled | Should be $true $Global:SPUPGetPropertyByNameCalled | Should be $true @@ -524,7 +524,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $Global:SPUPGetProfileSubtypeCalled = $false $Global:SPUPSMappingItemCalled = $false - {Set-TargetResource @testParamsNewProperty} | should throw "Term Set $($testParamsNewProperty.TermSet) not found" + { Set-TargetResource @testParamsNewProperty } | should throw "Term Set $($testParamsNewProperty.TermSet) not found" $Global:SPUPGetProfileSubtypeCalled | Should be $true $Global:SPUPSMappingItemCalled | Should be $false @@ -542,7 +542,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When ConfigurationManager is null" { Mock -CommandName New-Object -MockWith { - $ProfilePropertyManager = @{"Contoso" = $connection} | Add-Member ScriptMethod GetCoreProperties { + $ProfilePropertyManager = @{"Contoso" = $connection } | Add-Member ScriptMethod GetCoreProperties { $Global:UpsConfigManagerGetCorePropertiesCalled = $true return ($coreProperties) } -PassThru | Add-Member ScriptMethod GetProfileTypeProperties { @@ -567,7 +567,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When Sync Connection is set to Export" { Mock -CommandName New-Object -MockWith { - $ProfilePropertyManager = @{"Contoso" = $connection} | Add-Member ScriptMethod GetCoreProperties { + $ProfilePropertyManager = @{"Contoso" = $connection } | Add-Member ScriptMethod GetCoreProperties { $Global:UpsConfigManagerGetCorePropertiesCalled = $true return ($coreProperties) } -PassThru | Add-Member ScriptMethod GetProfileTypeProperties { @@ -613,7 +613,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $Global:SPUPGetProfileSubtypeCalled = $false $Global:SPUPSMappingItemCalled = $false - {Set-TargetResource @testParamsNewProperty} | should throw "Term Group $($testParamsNewProperty.TermGroup) not found" + { Set-TargetResource @testParamsNewProperty } | should throw "Term Group $($testParamsNewProperty.TermGroup) not found" $Global:SPUPGetProfileSubtypeCalled | Should be $true $Global:SPUPSMappingItemCalled | Should be $false @@ -647,7 +647,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $Global:SPUPGetProfileSubtypeCalled = $false $Global:SPUPSMappingItemCalled = $false - {Set-TargetResource @testParamsNewProperty} | should throw "Term Store $($testParamsNewProperty.TermStore) not found" + { Set-TargetResource @testParamsNewProperty } | should throw "Term Store $($testParamsNewProperty.TermStore) not found" $Global:SPUPGetProfileSubtypeCalled | Should be $true $Global:SPUPSMappingItemCalled | Should be $false @@ -658,7 +658,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When property exists and all properties match" { Mock -CommandName Get-SPDscUserProfileSubTypeManager -MockWith { - $result = @{}| Add-Member ScriptMethod GetProfileSubtype { + $result = @{ } | Add-Member ScriptMethod GetProfileSubtype { $Global:SPUPGetProfileSubtypeCalled = $true return @{ Properties = $userProfileSubTypePropertiesUpdateProperty @@ -708,7 +708,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $currentType = $testParamsUpdateProperty.Type $testParamsUpdateProperty.Type = "String (Multi Value)" Mock -CommandName Get-SPDscUserProfileSubTypeManager -MockWith { - $result = @{}| Add-Member ScriptMethod GetProfileSubtype { + $result = @{ } | Add-Member ScriptMethod GetProfileSubtype { $Global:SPUPGetProfileSubtypeCalled = $true return @{ Properties = $userProfileSubTypePropertiesUpdateProperty @@ -740,7 +740,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $Global:SPUPGetPropertyByNameCalled = $false $Global:SPUPSMappingItemCalled = $false - {Set-TargetResource @testParamsUpdateProperty} | should throw "Can't change property type. Current Type" + { Set-TargetResource @testParamsUpdateProperty } | should throw "Can't change property type. Current Type" $Global:SPUPGetProfileSubtypeCalled | Should be $true $Global:SPUPGetPropertyByNameCalled | Should be $true @@ -754,7 +754,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { #$propertyMappingItem.DataSourcePropertyName = "property" Mock -CommandName Get-SPDscUserProfileSubTypeManager -MockWith { - $result = @{}| Add-Member ScriptMethod GetProfileSubtype { + $result = @{ } | Add-Member ScriptMethod GetProfileSubtype { $Global:SPUPGetProfileSubtypeCalled = $true return @{ Properties = $userProfileSubTypePropertiesUpdateProperty @@ -797,7 +797,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When property exists and mapping does not exist" { $propertyMappingItem = $null Mock -CommandName Get-SPDscUserProfileSubTypeManager -MockWith { - $result = @{}| Add-Member ScriptMethod GetProfileSubtype { + $result = @{ } | Add-Member ScriptMethod GetProfileSubtype { $Global:SPUPGetProfileSubtypeCalled = $true return @{ Properties = $userProfileSubTypePropertiesUpdateProperty @@ -839,7 +839,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When property exists and ensure equals Absent" { Mock -CommandName Get-SPDscUserProfileSubTypeManager -MockWith { - $result = @{}| Add-Member ScriptMethod GetProfileSubtype { + $result = @{ } | Add-Member ScriptMethod GetProfileSubtype { $Global:SPUPGetProfileSubtypeCalled = $true return @{ Properties = $userProfileSubTypePropertiesUpdateProperty @@ -871,7 +871,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Mocks for AD Import Connection Mock -CommandName Get-SPDscUserProfileSubTypeManager -MockWith { - $result = @{}| Add-Member ScriptMethod GetProfileSubtype { + $result = @{ } | Add-Member ScriptMethod GetProfileSubtype { $Global:SPUPGetProfileSubtypeCalled = $true return @{ Properties = $userProfileSubTypePropertiesUpdateProperty @@ -881,7 +881,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return $result } - $propertyMapping = ([PSCustomObject]@{}) | Add-Member ScriptMethod Item { + $propertyMapping = ([PSCustomObject]@{ }) | Add-Member ScriptMethod Item { param( [string] $property @@ -909,7 +909,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } | Add-Member -MemberType ScriptMethod -Name Invoke -Value { return @( (([PSCustomObject]"Microsoft.Office.Server.UserProfiles.ADImport.UserProfileADImportPropertyMapping") ` - | Add-Member -MemberType ScriptMethod -Name GetType -Value { + | Add-Member -MemberType ScriptMethod -Name GetType -Value { return @{ FullName = "" } | Add-Member -MemberType ScriptMethod -Name GetMembers -Value { @@ -931,7 +931,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } -PassThru -Force ), (([PSCustomObject]"Microsoft.Office.Server.UserProfiles.ADImport.UserProfileADImportPropertyMapping") ` - | Add-Member -MemberType ScriptMethod -Name GetType -Value { + | Add-Member -MemberType ScriptMethod -Name GetType -Value { return @{ FullName = "" } | Add-Member -MemberType ScriptMethod -Name GetMembers -Value { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileSection.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileSection.Tests.ps1 index 23b95171e..65682ecd4 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileSection.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileSection.Tests.ps1 @@ -3,31 +3,35 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPUserProfileSection" + -DscResource "SPUserProfileSection" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - $testParams= @{ - Name = "PersonalInformation" - UserProfileService = "User Profile Service Application" - DisplayName = "Personal Information" - DisplayOrder = 5000 + $testParams = @{ + Name = "PersonalInformation" + UserProfileService = "User Profile Service Application" + DisplayName = "Personal Information" + DisplayOrder = 5000 } - try { [Microsoft.Office.Server.UserProfiles] } - catch { - try { + try + { [Microsoft.Office.Server.UserProfiles] + } + catch + { + try + { Add-Type -TypeDefinition @" namespace Microsoft.Office.Server.UserProfiles { public enum ConnectionType { ActiveDirectory, BusinessDataCatalog }; @@ -35,114 +39,118 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } "@ -ErrorAction SilentlyContinue } - catch { + catch + { Write-Verbose -Message "The Type was already added." } } $coreProperty = @{ - DisplayName = $testParams.DisplayName - Name = $testParams.Name - } | Add-Member -MemberType ScriptMethod Commit { - $Global:SPUPSPropertyCommitCalled = $true - } -PassThru | Add-Member -MemberType ScriptMethod Delete { - $Global:SPUPSPropertyDeleteCalled = $true - } -PassThru + DisplayName = $testParams.DisplayName + Name = $testParams.Name + } | Add-Member -MemberType ScriptMethod Commit { + $Global:SPUPSPropertyCommitCalled = $true + } -PassThru | Add-Member -MemberType ScriptMethod Delete { + $Global:SPUPSPropertyDeleteCalled = $true + } -PassThru $subTypeProperty = @{ - Name= $testParams.Name - DisplayName= $testParams.DisplayName - DisplayOrder =$testParams.DisplayOrder - CoreProperty = $coreProperty - }| Add-Member -MemberType ScriptMethod Commit { - $Global:SPUPSPropertyCommitCalled = $true - } -PassThru - $userProfileSubTypePropertiesNoProperty = @{} | Add-Member -MemberType ScriptMethod Create { - param($section) - $Global:SPUPSubTypeCreateCalled = $true - } -PassThru | Add-Member -MemberType ScriptMethod GetSectionByName { - $result = $null - if ($Global:SPUPGetSectionByNameCalled -eq $TRUE){ - $result = $subTypeProperty - } - $Global:SPUPGetSectionByNameCalled = $true - return $result - } -PassThru| Add-Member -MemberType ScriptMethod -Name Add -Value { - $Global:SPUPSubTypeAddCalled = $true - } -PassThru -Force - $coreProperties = @{ProfileInformation = $coreProperty} + Name = $testParams.Name + DisplayName = $testParams.DisplayName + DisplayOrder = $testParams.DisplayOrder + CoreProperty = $coreProperty + } | Add-Member -MemberType ScriptMethod Commit { + $Global:SPUPSPropertyCommitCalled = $true + } -PassThru + $userProfileSubTypePropertiesNoProperty = @{ } | Add-Member -MemberType ScriptMethod Create { + param($section) + $Global:SPUPSubTypeCreateCalled = $true + } -PassThru | Add-Member -MemberType ScriptMethod GetSectionByName { + $result = $null + if ($Global:SPUPGetSectionByNameCalled -eq $TRUE) + { + $result = $subTypeProperty + } + $Global:SPUPGetSectionByNameCalled = $true + return $result + } -PassThru | Add-Member -MemberType ScriptMethod -Name Add -Value { + $Global:SPUPSubTypeAddCalled = $true + } -PassThru -Force + $coreProperties = @{ProfileInformation = $coreProperty } $userProfileSubTypePropertiesProperty = @{"ProfileInformation" = $subTypeProperty } | Add-Member -MemberType ScriptMethod Create { - $Global:SPUPSubTypeCreateCalled = $true - } -PassThru | Add-Member -MemberType ScriptMethod -Name Add -Value { - $Global:SPUPSubTypeAddCalled = $true - } -PassThru -Force + $Global:SPUPSubTypeCreateCalled = $true + } -PassThru | Add-Member -MemberType ScriptMethod -Name Add -Value { + $Global:SPUPSubTypeAddCalled = $true + } -PassThru -Force Mock -CommandName Get-SPDscUserProfileSubTypeManager -MockWith { - $result = @{}| Add-Member -MemberType ScriptMethod GetProfileSubtype { - $Global:SPUPGetProfileSubtypeCalled = $true - return @{ - Properties = $userProfileSubTypePropertiesNoProperty - } - } -PassThru + $result = @{ } | Add-Member -MemberType ScriptMethod GetProfileSubtype { + $Global:SPUPGetProfileSubtypeCalled = $true + return @{ + Properties = $userProfileSubTypePropertiesNoProperty + } + } -PassThru - return $result + return $result } - Mock -CommandName Set-SPDscObjectPropertyIfValuePresent -MockWith {return ;} + Mock -CommandName Set-SPDscObjectPropertyIfValuePresent -MockWith { return ; } Mock -CommandName Get-SPWebApplication -MockWith { return @( - @{ - IsAdministrationWebApplication=$true - Url ="caURL" - }) + @{ + IsAdministrationWebApplication = $true + Url = "caURL" + }) } Mock -CommandName New-Object -MockWith { - $ProfilePropertyManager = @{"Contoso" = $null} # $connection is never set, so it will always be $null + $ProfilePropertyManager = @{"Contoso" = $null } # $connection is never set, so it will always be $null return (@{ - ProfilePropertyManager = $ProfilePropertyManager - ConnectionManager = $null # $ConnnectionManager is never set, so it will always be $null - } | Add-Member -MemberType ScriptMethod GetPropertiesWithSection { - $Global:UpsConfigManagerGetPropertiesWithSectionCalled=$true; + ProfilePropertyManager = $ProfilePropertyManager + ConnectionManager = $null # $ConnnectionManager is never set, so it will always be $null + } | Add-Member -MemberType ScriptMethod GetPropertiesWithSection { + $Global:UpsConfigManagerGetPropertiesWithSectionCalled = $true; - $result = (@{}|Add-Member -MemberType ScriptMethod Create { - param ($section) + $result = (@{ } | Add-Member -MemberType ScriptMethod Create { + param ($section) - $result = @{Name = "" - DisplayName="" - DisplayOrder=0}|Add-Member -MemberType ScriptMethod Commit { - $Global:UpsConfigManagerCommitCalled=$true; + $result = @{Name = "" + DisplayName = "" + DisplayOrder = 0 + } | Add-Member -MemberType ScriptMethod Commit { + $Global:UpsConfigManagerCommitCalled = $true; } -PassThru - return $result - } -PassThru -Force | Add-Member -MemberType ScriptMethod GetSectionByName { - $result = $null - if ($Global:UpsConfigManagerGetSectionByNameCalled -eq $TRUE){ + return $result + } -PassThru -Force | Add-Member -MemberType ScriptMethod GetSectionByName { + $result = $null + if ($Global:UpsConfigManagerGetSectionByNameCalled -eq $TRUE) + { $result = $subTypeProperty } - $Global:UpsConfigManagerGetSectionByNameCalled=$true + $Global:UpsConfigManagerGetSectionByNameCalled = $true return $result - return $null # $userProfileSubTypePropertiesUpdateProperty is never set, so it will always be $null; - } -PassThru | Add-Member -MemberType ScriptMethod SetDisplayOrderBySectionName { - $Global:UpsConfigManagerSetDisplayOrderBySectionNameCalled=$true; - return $null # $userProfileSubTypePropertiesUpdateProperty is never set, so it will always be $null; - } -PassThru | Add-Member -MemberType ScriptMethod CommitDisplayOrder { - $Global:UpsConfigManagerCommitDisplayOrderCalled=$true; - return $null # $userProfileSubTypePropertiesUpdateProperty is never set, so it will always be $null; - } -PassThru| Add-Member -MemberType ScriptMethod RemoveSectionByName { - $Global:UpsConfigManagerRemoveSectionByNameCalled=$true; - return ($coreProperties); - } -PassThru + return $null # $userProfileSubTypePropertiesUpdateProperty is never set, so it will always be $null; + } -PassThru | Add-Member -MemberType ScriptMethod SetDisplayOrderBySectionName { + $Global:UpsConfigManagerSetDisplayOrderBySectionNameCalled = $true; + return $null # $userProfileSubTypePropertiesUpdateProperty is never set, so it will always be $null; + } -PassThru | Add-Member -MemberType ScriptMethod CommitDisplayOrder { + $Global:UpsConfigManagerCommitDisplayOrderCalled = $true; + return $null # $userProfileSubTypePropertiesUpdateProperty is never set, so it will always be $null; + } -PassThru | Add-Member -MemberType ScriptMethod RemoveSectionByName { + $Global:UpsConfigManagerRemoveSectionByNameCalled = $true; + return ($coreProperties); + } -PassThru -) - return $result + ) + return $result - } -PassThru ) + } -PassThru ) } -ParameterFilter { $TypeName -eq "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" } - $userProfileService = @{ - Name = "User Profile Service Application" - TypeName = "User Profile Service Application" - ApplicationPool = "SharePoint Service Applications" + $userProfileService = @{ + Name = "User Profile Service Application" + TypeName = "User Profile Service Application" + ApplicationPool = "SharePoint Service Applications" ServiceApplicationProxyGroup = "Proxy Group" } @@ -167,11 +175,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should create a new user profile section in the set method" { $Global:SPUPSubTypeCreateCalled = $false $Global:UpsConfigManagerSetDisplayOrderBySectionNameCalled = $false - $Global:SPUPSPropertyCommitCalled=$false; + $Global:SPUPSPropertyCommitCalled = $false; Set-TargetResource @testParams $Global:SPUPSubTypeCreateCalled | should be $false - $Global:SPUPSPropertyCommitCalled|should be $true + $Global:SPUPSPropertyCommitCalled | should be $true $Global:UpsConfigManagerSetDisplayOrderBySectionNameCalled | Should be $true } @@ -198,16 +206,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When section exists and ensure equals Absent" { Mock -CommandName Get-SPDscUserProfileSubTypeManager -MockWith { - $result = @{}| Add-Member -MemberType ScriptMethod GetProfileSubtype { - $Global:SPUPGetProfileSubtypeCalled = $true - return @{ - Properties = $userProfileSubTypePropertiesProperty - } - } -PassThru + $result = @{ } | Add-Member -MemberType ScriptMethod GetProfileSubtype { + $Global:SPUPGetProfileSubtypeCalled = $true + return @{ + Properties = $userProfileSubTypePropertiesProperty + } + } -PassThru - return $result + return $result } - $testParams.Ensure = "Absent" + $testParams.Ensure = "Absent" It "Should return true when the Test method is called" { $Global:SPUPGetSectionByNameCalled = $true @@ -218,7 +226,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "deletes an user profile property in the set method" { $Global:UpsConfigManagerGetSectionByNameCalled = $true - $Global:UpsConfigManagerRemoveSectionByNameCalled=$false + $Global:UpsConfigManagerRemoveSectionByNameCalled = $false Set-TargetResource @testParams $Global:UpsConfigManagerRemoveSectionByNameCalled | Should be $true } @@ -227,12 +235,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When section exists and display name and display order are different" { Mock -CommandName Get-SPDscUserProfileSubTypeManager -MockWith { - $result = @{}| Add-Member -MemberType ScriptMethod GetProfileSubtype { - $Global:SPUPGetProfileSubtypeCalled = $true - return @{ - Properties = $userProfileSubTypePropertiesProperty - } - } -PassThru + $result = @{ } | Add-Member -MemberType ScriptMethod GetProfileSubtype { + $Global:SPUPGetProfileSubtypeCalled = $true + return @{ + Properties = $userProfileSubTypePropertiesProperty + } + } -PassThru return $result } $testParams.Ensure = "Present" @@ -253,7 +261,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should update an user profile property in the set method" { $Global:SPUPSubTypeCreateCalled = $false $Global:UpsConfigManagerSetDisplayOrderBySectionNameCalled = $false - $Global:SPUPGetSectionByNameCalled=$true + $Global:SPUPGetSectionByNameCalled = $true Set-TargetResource @testParams Assert-MockCalled Set-SPDscObjectPropertyIfValuePresent $Global:SPUPSubTypeCreateCalled | should be $false diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileServiceApp.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileServiceApp.Tests.ps1 index 5a0376d78..52d9da71b 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileServiceApp.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileServiceApp.Tests.ps1 @@ -4,16 +4,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPUserProfileServiceApp" + -DscResource "SPUserProfileServiceApp" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -23,9 +23,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $getTypeFullName = "Microsoft.Office.Server.Administration.UserProfileApplication" $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force $mockCredential = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList @("$($Env:USERDOMAIN)\$($Env:USERNAME)", $mockPassword) + -ArgumentList @("$($Env:USERDOMAIN)\$($Env:USERNAME)", $mockPassword) $mockFarmCredential = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList @("DOMAIN\sp_farm", $mockPassword) + -ArgumentList @("DOMAIN\sp_farm", $mockPassword) try { @@ -87,9 +87,9 @@ namespace Microsoft.SharePoint.Administration.AccessControl { } Mock -CommandName New-SPProfileServiceApplication -MockWith { return (@{ - NetBIOSDomainNamesEnabled = $false - NoILMUsed = $false - } + NetBIOSDomainNamesEnabled = $false + NoILMUsed = $false + } ) } Mock -CommandName New-SPProfileServiceApplicationProxy -MockWith { } @@ -101,22 +101,22 @@ namespace Microsoft.SharePoint.Administration.AccessControl { Mock -CommandName Get-SPWebApplication -MockWith { return @{ IsAdministrationWebApplication = $true - Url = "http://fake.contoso.com" - Sites = @("FakeSite1") + Url = "http://fake.contoso.com" + Sites = @("FakeSite1") } } Mock -CommandName Get-SPServiceContext -MockWith { return (@{ - Fake1 = $true - }) + Fake1 = $true + }) } # Test contexts Context -Name "When PSDSCRunAsCredential matches the Farm Account and Service App is null" -Fixture { $testParams = @{ - Name = "User Profile Service App" + Name = "User Profile Service App" ApplicationPool = "SharePoint Service Applications" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPDscFarmAccount -MockWith { @@ -127,7 +127,7 @@ namespace Microsoft.SharePoint.Administration.AccessControl { return $null } - Mock -CommandName Restart-Service {} + Mock -CommandName Restart-Service { } It "Should throw exception in the Get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" @@ -144,9 +144,9 @@ namespace Microsoft.SharePoint.Administration.AccessControl { Context -Name "When PSDSCRunAsCredential matches the Farm Account and Service App is not null" -Fixture { $testParams = @{ - Name = "User Profile Service App" + Name = "User Profile Service App" ApplicationPool = "SharePoint Service Applications" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPDscFarmAccount -MockWith { @@ -156,86 +156,86 @@ namespace Microsoft.SharePoint.Administration.AccessControl { Mock -CommandName Get-SPServiceApplication -MockWith { return @( New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name TypeName ` + -Value "User Profile Service Application" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name DisplayName ` + -Value $testParams.Name ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { + $Global:SPDscUPSAUpdateCalled = $true + } -PassThru | + Add-Member -MemberType NoteProperty ` + -Name ApplicationPool ` + -Value @{ + Name = $testParams.ApplicationPool + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + New-Object -TypeName "Object" | Add-Member -MemberType NoteProperty ` - -Name TypeName ` - -Value "User Profile Service Application" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name DisplayName ` - -Value $testParams.Name ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value { - $Global:SPDscUPSAUpdateCalled = $true - } -PassThru | - Add-Member -MemberType NoteProperty ` - -Name ApplicationPool ` - -Value @{ - Name = $testParams.ApplicationPool - } -PassThru | + -Name FullName ` + -Value $getTypeFullName ` + -PassThru | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetProperties ` - -Value { - param($x) - return @( - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SocialDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return @{ - Name = "SP_SocialDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "ProfileDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SynchronizationDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileSyncDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru - ) - ) - } -PassThru - } -PassThru -Force + -Name GetProperties ` + -Value { + param($x) + return @( + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SocialDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return @{ + Name = "SP_SocialDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "ProfileDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SynchronizationDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileSyncDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru + ) + ) + } -PassThru + } -PassThru -Force ) } - Mock -CommandName Restart-Service {} + Mock -CommandName Restart-Service { } It "Should NOT throw exception in the Get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" @@ -252,17 +252,17 @@ namespace Microsoft.SharePoint.Administration.AccessControl { Context -Name "When InstallAccount matches the Farm Account" -Fixture { $testParams = @{ - Name = "User Profile Service App" + Name = "User Profile Service App" ApplicationPool = "SharePoint Service Applications" - Ensure = "Present" - InstallAccount = $mockFarmCredential + Ensure = "Present" + InstallAccount = $mockFarmCredential } Mock -CommandName Get-SPServiceApplication -MockWith { return $null } - Mock -CommandName Restart-Service {} + Mock -CommandName Restart-Service { } It "Should throw exception in the Get method" { { Get-TargetResource @testParams } | Should throw "Specified InstallAccount " @@ -279,9 +279,9 @@ namespace Microsoft.SharePoint.Administration.AccessControl { Context -Name "When no service applications exist in the current farm" -Fixture { $testParams = @{ - Name = "User Profile Service App" + Name = "User Profile Service App" ApplicationPool = "SharePoint Service Applications" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { @@ -289,10 +289,10 @@ namespace Microsoft.SharePoint.Administration.AccessControl { } Mock -CommandName New-SPClaimsPrincipal -MockWith { return @("") } Mock -CommandName Get-SPServiceApplicationSecurity -MockWith { return @("") } - Mock -CommandName Grant-SPObjectSecurity -MockWith {} - Mock -CommandName Set-SPServiceApplicationSecurity -MockWith {} + Mock -CommandName Grant-SPObjectSecurity -MockWith { } + Mock -CommandName Set-SPServiceApplicationSecurity -MockWith { } - Mock -CommandName Restart-Service {} + Mock -CommandName Restart-Service { } It "Should return absent from the Get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" @@ -310,22 +310,22 @@ namespace Microsoft.SharePoint.Administration.AccessControl { Context -Name "When service applications exist in the current farm but not the specific user profile service app" -Fixture { $testParams = @{ - Name = "User Profile Service App" + Name = "User Profile Service App" ApplicationPool = "SharePoint Service Applications" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - } + DisplayName = $testParams.Name + } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "Microsoft.Office.UnKnownWebServiceApplication" - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + FullName = "Microsoft.Office.UnKnownWebServiceApplication" + } + } -PassThru -Force return $spServiceApp } @@ -340,97 +340,97 @@ namespace Microsoft.SharePoint.Administration.AccessControl { Context -Name "When service applications exist in the current farm and NetBios isn't enabled but it needs to be" -Fixture { $testParams = @{ - Name = "User Profile Service App" + Name = "User Profile Service App" ApplicationPool = "SharePoint Service Applications" - EnableNetBIOS = $true - Ensure = "Present" + EnableNetBIOS = $true + Ensure = "Present" } - Mock -CommandName Restart-Service -MockWith {} + Mock -CommandName Restart-Service -MockWith { } Mock -CommandName Get-SPServiceApplication -MockWith { return @( New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name TypeName ` + -Value "User Profile Service Application" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name DisplayName ` + -Value $testParams.Name ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name "NetBIOSDomainNamesEnabled" ` + -Value $false ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { + $Global:SPDscUPSAUpdateCalled = $true + } -PassThru | + Add-Member -MemberType NoteProperty ` + -Name ApplicationPool ` + -Value @{ + Name = $testParams.ApplicationPool + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + New-Object -TypeName "Object" | Add-Member -MemberType NoteProperty ` - -Name TypeName ` - -Value "User Profile Service Application" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name DisplayName ` - -Value $testParams.Name ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name "NetBIOSDomainNamesEnabled" ` - -Value $false ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value { - $Global:SPDscUPSAUpdateCalled = $true - } -PassThru | - Add-Member -MemberType NoteProperty ` - -Name ApplicationPool ` - -Value @{ - Name = $testParams.ApplicationPool - } -PassThru | + -Name FullName ` + -Value $getTypeFullName ` + -PassThru | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetProperties ` - -Value { - param($x) - return @( - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SocialDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return @{ - Name = "SP_SocialDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "ProfileDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SynchronizationDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileSyncDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru - ) - ) - } -PassThru - } -PassThru -Force + -Name GetProperties ` + -Value { + param($x) + return @( + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SocialDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return @{ + Name = "SP_SocialDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "ProfileDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SynchronizationDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileSyncDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru + ) + ) + } -PassThru + } -PassThru -Force ) } @@ -456,97 +456,97 @@ namespace Microsoft.SharePoint.Administration.AccessControl { Context -Name "When service applications exist in the current farm and NoILMUsed isn't enabled but it needs to be" -Fixture { $testParams = @{ - Name = "User Profile Service App" + Name = "User Profile Service App" ApplicationPool = "SharePoint Service Applications" - NoILMUsed = $true - Ensure = "Present" + NoILMUsed = $true + Ensure = "Present" } - Mock -CommandName Restart-Service -MockWith {} + Mock -CommandName Restart-Service -MockWith { } Mock -CommandName Get-SPServiceApplication -MockWith { return @( New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name TypeName ` + -Value "User Profile Service Application" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name DisplayName ` + -Value $testParams.Name ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name "NoILMUsed" ` + -Value $false ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { + $Global:SPDscUPSAUpdateCalled = $true + } -PassThru | + Add-Member -MemberType NoteProperty ` + -Name ApplicationPool ` + -Value @{ + Name = $testParams.ApplicationPool + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + New-Object -TypeName "Object" | Add-Member -MemberType NoteProperty ` - -Name TypeName ` - -Value "User Profile Service Application" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name DisplayName ` - -Value $testParams.Name ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name "NoILMUsed" ` - -Value $false ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value { - $Global:SPDscUPSAUpdateCalled = $true - } -PassThru | - Add-Member -MemberType NoteProperty ` - -Name ApplicationPool ` - -Value @{ - Name = $testParams.ApplicationPool - } -PassThru | + -Name FullName ` + -Value $getTypeFullName ` + -PassThru | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetProperties ` - -Value { - param($x) - return @( - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SocialDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return @{ - Name = "SP_SocialDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "ProfileDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SynchronizationDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileSyncDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru - ) - ) - } -PassThru - } -PassThru -Force + -Name GetProperties ` + -Value { + param($x) + return @( + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SocialDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return @{ + Name = "SP_SocialDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "ProfileDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SynchronizationDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileSyncDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru + ) + ) + } -PassThru + } -PassThru -Force ) } @@ -578,91 +578,91 @@ namespace Microsoft.SharePoint.Administration.AccessControl { Ensure = "Present" } - Mock -CommandName Restart-Service -MockWith {} + Mock -CommandName Restart-Service -MockWith { } Mock -CommandName Get-SPServiceApplication -MockWith { return @( New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name TypeName ` + -Value "User Profile Service Application" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name DisplayName ` + -Value $testParams.Name ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name "NoILMUsed" ` + -Value $false ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { + $Global:SPDscUPSAUpdateCalled = $true + } -PassThru | + Add-Member -MemberType NoteProperty ` + -Name ApplicationPool ` + -Value @{ + Name = $testParams.ApplicationPool + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + New-Object -TypeName "Object" | Add-Member -MemberType NoteProperty ` - -Name TypeName ` - -Value "User Profile Service Application" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name DisplayName ` - -Value $testParams.Name ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name "NoILMUsed" ` - -Value $false ` - -PassThru | + -Name FullName ` + -Value $getTypeFullName ` + -PassThru | Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value { - $Global:SPDscUPSAUpdateCalled = $true - } -PassThru | - Add-Member -MemberType NoteProperty ` - -Name ApplicationPool ` - -Value @{ - Name = $testParams.ApplicationPool - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetProperties ` - -Value { - param($x) - return @( - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SocialDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return @{ - Name = "SP_SocialDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "ProfileDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SynchronizationDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileSyncDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru - ) - ) - } -PassThru - } -PassThru -Force + -Name GetProperties ` + -Value { + param($x) + return @( + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SocialDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return @{ + Name = "SP_SocialDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "ProfileDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SynchronizationDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileSyncDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru + ) + ) + } -PassThru + } -PassThru -Force ) } @@ -682,95 +682,95 @@ namespace Microsoft.SharePoint.Administration.AccessControl { Context -Name "When a service application exists and is configured correctly" -Fixture { $testParams = @{ - Name = "User Profile Service App" + Name = "User Profile Service App" ApplicationPool = "SharePoint Service Applications" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { return @( New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name TypeName ` + -Value "User Profile Service Application" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name DisplayName ` + -Value $testParams.Name ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name "NetBIOSDomainNamesEnabled" ` + -Value $false ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { + $Global:SPDscUPSAUpdateCalled = $true + } -PassThru | + Add-Member -MemberType NoteProperty ` + -Name ApplicationPool ` + -Value @{ + Name = $testParams.ApplicationPool + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + New-Object -TypeName "Object" | Add-Member -MemberType NoteProperty ` - -Name TypeName ` - -Value "User Profile Service Application" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name DisplayName ` - -Value $testParams.Name ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name "NetBIOSDomainNamesEnabled" ` - -Value $false ` - -PassThru | + -Name FullName ` + -Value $getTypeFullName ` + -PassThru | Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value { - $Global:SPDscUPSAUpdateCalled = $true - } -PassThru | - Add-Member -MemberType NoteProperty ` - -Name ApplicationPool ` - -Value @{ - Name = $testParams.ApplicationPool - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetProperties ` - -Value { - param($x) - return @( - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SocialDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return @{ - Name = "SP_SocialDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "ProfileDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SynchronizationDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileSyncDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru - ) - ) - } -PassThru - } -PassThru -Force + -Name GetProperties ` + -Value { + param($x) + return @( + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SocialDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return @{ + Name = "SP_SocialDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "ProfileDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SynchronizationDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileSyncDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru + ) + ) + } -PassThru + } -PassThru -Force ) } @@ -785,95 +785,95 @@ namespace Microsoft.SharePoint.Administration.AccessControl { Context -Name "When the service app exists but it shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "-" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication -MockWith { return @( New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name TypeName ` + -Value "User Profile Service Application" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name DisplayName ` + -Value $testParams.Name ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name "NetBIOSDomainNamesEnabled" ` + -Value $false ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { + $Global:SPDscUPSAUpdateCalled = $true + } -PassThru | + Add-Member -MemberType NoteProperty ` + -Name ApplicationPool ` + -Value @{ + Name = $testParams.ApplicationPool + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + New-Object -TypeName "Object" | Add-Member -MemberType NoteProperty ` - -Name TypeName ` - -Value "User Profile Service Application" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name DisplayName ` - -Value $testParams.Name ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name "NetBIOSDomainNamesEnabled" ` - -Value $false ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value { - $Global:SPDscUPSAUpdateCalled = $true - } -PassThru | - Add-Member -MemberType NoteProperty ` - -Name ApplicationPool ` - -Value @{ - Name = $testParams.ApplicationPool - } -PassThru | + -Name FullName ` + -Value $getTypeFullName ` + -PassThru | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetProperties ` - -Value { - param($x) - return @( - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SocialDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return @{ - Name = "SP_SocialDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "ProfileDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SynchronizationDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileSyncDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru - ) - ) - } -PassThru - } -PassThru -Force + -Name GetProperties ` + -Value { + param($x) + return @( + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SocialDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return @{ + Name = "SP_SocialDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "ProfileDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SynchronizationDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileSyncDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru + ) + ) + } -PassThru + } -PassThru -Force ) } @@ -893,9 +893,9 @@ namespace Microsoft.SharePoint.Administration.AccessControl { Context -Name "When the service app doesn't exist and shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "-" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication -MockWith { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileServiceAppPermissions.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileServiceAppPermissions.Tests.ps1 index 9f496bc40..a6b9df789 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileServiceAppPermissions.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileServiceAppPermissions.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPUserProfileServiceAppPermissions" + -DscResource "SPUserProfileServiceAppPermissions" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -55,7 +55,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Test contexts Context -Name "The proxy does not exist" -Fixture { $testParams = @{ - ProxyName = "User Profile Service App Proxy" + ProxyName = "User Profile Service App Proxy" CreatePersonalSite = @("DEMO\User2", "DEMO\User1") FollowAndEditProfile = @("Everyone") UseTagsAndNotes = @("None") @@ -83,7 +83,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Users who should have access do not have access" -Fixture { $testParams = @{ - ProxyName = "User Profile Service App Proxy" + ProxyName = "User Profile Service App Proxy" CreatePersonalSite = @("DEMO\User2", "DEMO\User1") FollowAndEditProfile = @("Everyone") UseTagsAndNotes = @("None") @@ -111,7 +111,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Users who should have access have incorrect permissions" -Fixture { $testParams = @{ - ProxyName = "User Profile Service App Proxy" + ProxyName = "User Profile Service App Proxy" CreatePersonalSite = @("DEMO\User2", "DEMO\User1") FollowAndEditProfile = @("Everyone") UseTagsAndNotes = @("None") @@ -121,15 +121,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @{ AccessRules = @( @{ - Name = "i:0#.w|DEMO\User2" + Name = "i:0#.w|DEMO\User2" AllowedRights = "UsePersonalFeatures" }, @{ - Name = "i:0#.w|DEMO\User1" + Name = "i:0#.w|DEMO\User1" AllowedRights = "UsePersonalFeatures" }, @{ - Name = "c:0(.s|true" + Name = "c:0(.s|true" AllowedRights = "CreatePersonalSite,UseMicrobloggingAndFollowing" } ) @@ -152,7 +152,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Users who should have permissions have the correct permissions" -Fixture { $testParams = @{ - ProxyName = "User Profile Service App Proxy" + ProxyName = "User Profile Service App Proxy" CreatePersonalSite = @("DEMO\User2", "DEMO\User1") FollowAndEditProfile = @("Everyone") UseTagsAndNotes = @("None") @@ -162,15 +162,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @{ AccessRules = @( @{ - Name = "i:0#.w|DEMO\User2" + Name = "i:0#.w|DEMO\User2" AllowedRights = "CreatePersonalSite,UseMicrobloggingAndFollowing" }, @{ - Name = "i:0#.w|DEMO\User1" + Name = "i:0#.w|DEMO\User1" AllowedRights = "CreatePersonalSite,UseMicrobloggingAndFollowing" }, @{ - Name = "c:0(.s|true" + Name = "c:0(.s|true" AllowedRights = "UsePersonalFeatures" } ) @@ -188,7 +188,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Users who should not have access have permissions assigned" -Fixture { $testParams = @{ - ProxyName = "User Profile Service App Proxy" + ProxyName = "User Profile Service App Proxy" CreatePersonalSite = @("DEMO\User2", "DEMO\User1") FollowAndEditProfile = @("Everyone") UseTagsAndNotes = @("None") @@ -198,19 +198,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @{ AccessRules = @( @{ - Name = "i:0#.w|DEMO\User2" + Name = "i:0#.w|DEMO\User2" AllowedRights = "CreatePersonalSite,UseMicrobloggingAndFollowing" }, @{ - Name = "i:0#.w|DEMO\User1" + Name = "i:0#.w|DEMO\User1" AllowedRights = "CreatePersonalSite,UseMicrobloggingAndFollowing" }, @{ - Name = "i:0#.w|DEMO\User3" + Name = "i:0#.w|DEMO\User3" AllowedRights = "CreatePersonalSite,UseMicrobloggingAndFollowing" }, @{ - Name = "c:0(.s|true" + Name = "c:0(.s|true" AllowedRights = "UsePersonalFeatures" } ) @@ -233,7 +233,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The old non-claims 'Authenticated Users' entry exists in the permissions" -Fixture { $testParams = @{ - ProxyName = "User Profile Service App Proxy" + ProxyName = "User Profile Service App Proxy" CreatePersonalSite = @("DEMO\User2", "DEMO\User1") FollowAndEditProfile = @("Everyone") UseTagsAndNotes = @("None") @@ -243,19 +243,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @{ AccessRules = @( @{ - Name = "i:0#.w|DEMO\User2" + Name = "i:0#.w|DEMO\User2" AllowedRights = "CreatePersonalSite,UseMicrobloggingAndFollowing" }, @{ - Name = "i:0#.w|DEMO\User1" + Name = "i:0#.w|DEMO\User1" AllowedRights = "CreatePersonalSite,UseMicrobloggingAndFollowing" }, @{ - Name = "NT Authority\Authenticated Users" + Name = "NT Authority\Authenticated Users" AllowedRights = "CreatePersonalSite,UseMicrobloggingAndFollowing" }, @{ - Name = "c:0(.s|true" + Name = "c:0(.s|true" AllowedRights = "UsePersonalFeatures" } ) @@ -285,15 +285,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return @{ AccessRules = @( @{ - Name = "i:0#.w|DEMO\User2" + Name = "i:0#.w|DEMO\User2" AllowedRights = "CreatePersonalSite,UseMicrobloggingAndFollowing" }, @{ - Name = "i:0#.w|DEMO\User1" + Name = "i:0#.w|DEMO\User1" AllowedRights = "CreatePersonalSite,UseMicrobloggingAndFollowing" }, @{ - Name = "c:0(.s|true" + Name = "c:0(.s|true" AllowedRights = "UsePersonalFeatures" } ) diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileSyncConnection.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileSyncConnection.Tests.ps1 index cc33bd9db..c8fb82aa6 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileSyncConnection.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileSyncConnection.Tests.ps1 @@ -4,16 +4,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPUserProfileSyncConnection" + -DscResource "SPUserProfileSyncConnection" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -22,7 +22,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Initialize tests $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force $mockCredential = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList @("DOMAIN\username", $mockPassword) + -ArgumentList @("DOMAIN\username", $mockPassword) if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16) { @@ -35,9 +35,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $defaultDistinguishedName = "litware.net" } - try { [Microsoft.Office.Server.UserProfiles] } - catch { - try { + try + { [Microsoft.Office.Server.UserProfiles] + } + catch + { + try + { Add-Type -TypeDefinition @" namespace Microsoft.Office.Server.UserProfiles { public enum ConnectionType { ActiveDirectory, BusinessDataCatalog }; @@ -45,14 +49,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } "@ -ErrorAction SilentlyContinue } - catch { + catch + { Write-Verbose "The Type Microsoft.Office.Server.UserProfile was already added." } } - try { [Microsoft.Office.Server.UserProfiles.DirectoryServiceNamingContext] } - catch { - try { + try + { [Microsoft.Office.Server.UserProfiles.DirectoryServiceNamingContext] + } + catch + { + try + { Add-Type -TypeDefinition @" namespace Microsoft.Office.Server.UserProfiles { public class DirectoryServiceNamingContext { @@ -64,15 +73,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } "@ -ErrorAction SilentlyContinue } - catch { + catch + { Write-Verbose -Message "The Type Microsoft.Office.Server.UserProfiles.DirectoryServiceNamingContext was already added." } } - try { [Microsoft.Office.Server.UserProfiles.ActiveDirectoryImportConnection] } - catch { - try { + try + { [Microsoft.Office.Server.UserProfiles.ActiveDirectoryImportConnection] + } + catch + { + try + { Add-Type -TypeDefinition @" namespace Microsoft.Office.Server.UserProfiles{ public class ActiveDirectoryImportConnection{ @@ -90,17 +104,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { "@ -ErrorAction SilentlyContinue -PassThru | Add-Member -MemberType ScriptMethod -Name GetMethod -Value { param ($a, $b) return (@{ - FullName = $a - }) | Add-Member -MemberType ScriptMethod -Name Invoke -Value { - switch ($this.FullName) - { - get_NamingContexts { return "NC" } - get_UseSSL { return $false } - } - } -PassThru -Force + FullName = $a + }) | Add-Member -MemberType ScriptMethod -Name Invoke -Value { + switch ($this.FullName) + { + get_NamingContexts + { return "NC" + } + get_UseSSL + { return $false + } + } + } -PassThru -Force } -PassThru -Force } - catch { + catch + { Write-Verbose -Message "The Type Microsoft.Office.Server.UserProfiles.ActiveDirectoryImportConnection was already added." } } @@ -109,51 +128,51 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Add-SPProfileSyncConnection -MockWith { $Global:SPDscUPSAddActiveDirectoryConnectionCalled = $true } Mock -CommandName Get-SPDscServiceContext -MockWith { - return @{} + return @{ } } Mock -CommandName Start-Sleep -MockWith { } Mock -CommandName Get-SPWebapplication -MockWith { return @{ - Url = "http://ca" + Url = "http://ca" IsAdministrationWebApplication = $true } } $connection = @{ - DisplayName = $name - Server = "contoso.com" - NamingContexts = New-Object -TypeName System.Collections.ArrayList - AccountDomain = "Contoso" - AccountUsername = "TestAccount" + DisplayName = $name + Server = "contoso.com" + NamingContexts = New-Object -TypeName System.Collections.ArrayList + AccountDomain = "Contoso" + AccountUsername = "TestAccount" UseDisabledFilter = $false - Type = "ActiveDirectory" + Type = "ActiveDirectory" } - $connection = $connection | Add-Member -MemberType ScriptMethod ` - -Name RefreshSchema ` - -Value { - $Global:SPDscUPSSyncConnectionRefreshSchemaCalled = $true - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Update ` - -Value { - $Global:SPDscUPSSyncConnectionUpdateCalled = $true - } -PassThru | ` - Add-Member -MemberType ScriptMethod ` - -Name SetCredentials ` - -Value { - param($userAccount,$securePassword) - $Global:SPDscUPSSyncConnectionSetCredentialsCalled = $true - } -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value { - $Global:SPDscUPSSyncConnectionDeleteCalled = $true - } -PassThru - - $namingContext =@{ - ContainersIncluded = New-Object -TypeName System.Collections.ArrayList - ContainersExcluded = New-Object -TypeName System.Collections.ArrayList - DisplayName = "Contoso" + $connection = $connection | Add-Member -MemberType ScriptMethod ` + -Name RefreshSchema ` + -Value { + $Global:SPDscUPSSyncConnectionRefreshSchemaCalled = $true + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { + $Global:SPDscUPSSyncConnectionUpdateCalled = $true + } -PassThru | ` + Add-Member -MemberType ScriptMethod ` + -Name SetCredentials ` + -Value { + param($userAccount, $securePassword) + $Global:SPDscUPSSyncConnectionSetCredentialsCalled = $true + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name Delete ` + -Value { + $Global:SPDscUPSSyncConnectionDeleteCalled = $true + } -PassThru + + $namingContext = @{ + ContainersIncluded = New-Object -TypeName System.Collections.ArrayList + ContainersExcluded = New-Object -TypeName System.Collections.ArrayList + DisplayName = "Contoso" PreferredDomainControllers = $null } $namingContext.ContainersIncluded.Add("OU=com, OU=Contoso, OU=Included") @@ -161,69 +180,69 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $connection.NamingContexts.Add($namingContext); $ConnnectionManager = New-Object -TypeName System.Collections.ArrayList | - Add-Member -MemberType ScriptMethod ` - -Name AddActiveDirectoryConnection ` - -Value { - param( - [Microsoft.Office.Server.UserProfiles.ConnectionType] - $connectionType, - $name, - $forest, - $useSSL, - $userName, - $securePassword, - $namingContext, - $p1, - $p2 - ) - $Global:SPDscUPSAddActiveDirectoryConnectionCalled = $true - } -PassThru + Add-Member -MemberType ScriptMethod ` + -Name AddActiveDirectoryConnection ` + -Value { + param( + [Microsoft.Office.Server.UserProfiles.ConnectionType] + $connectionType, + $name, + $forest, + $useSSL, + $userName, + $securePassword, + $namingContext, + $p1, + $p2 + ) + $Global:SPDscUPSAddActiveDirectoryConnectionCalled = $true + } -PassThru Mock -CommandName New-Object -MockWith { return (@{ - ConnectionManager = $ConnnectionManager - } | Add-Member -MemberType ScriptMethod ` - -Name IsSynchronizationRunning ` - -Value { - $Global:SPDscUpsSyncIsSynchronizationRunning = $true - return $false - } -PassThru - )} -ParameterFilter { - $TypeName -eq "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" - } + ConnectionManager = $ConnnectionManager + } | Add-Member -MemberType ScriptMethod ` + -Name IsSynchronizationRunning ` + -Value { + $Global:SPDscUpsSyncIsSynchronizationRunning = $true + return $false + } -PassThru + ) } -ParameterFilter { + $TypeName -eq "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" + } - $userProfileServiceValidConnection = @{ - Name = "User Profile Service Application" - TypeName = "User Profile Service Application" - ApplicationPool = "SharePoint Service Applications" - FarmAccount = $mockCredential + $userProfileServiceValidConnection = @{ + Name = "User Profile Service Application" + TypeName = "User Profile Service Application" + ApplicationPool = "SharePoint Service Applications" + FarmAccount = $mockCredential ServiceApplicationProxyGroup = "Proxy Group" - ConnectionManager= New-Object -TypeName System.Collections.ArrayList + ConnectionManager = New-Object -TypeName System.Collections.ArrayList } $userProfileServiceValidConnection.ConnectionManager.Add($connection) Mock -CommandName Get-SPDscADSIObject -MockWith { return @{ distinguishedName = "DC=Contoso,DC=Com" - objectGUID = (New-Guid).ToString() + objectGUID = (New-Guid).ToString() } } - Mock -CommandName Import-Module {} -ParameterFilter { + Mock -CommandName Import-Module { } -ParameterFilter { $_.Name -eq $ModuleName } # Test contexts Context -Name "When UPS doesn't exist" -Fixture { $testParams = @{ - UserProfileService = "User Profile Service Application" - Forest = "contoso.com" - Name = "Contoso" + UserProfileService = "User Profile Service Application" + Forest = "contoso.com" + Name = "Contoso" ConnectionCredentials = $mockCredential - Server = "server.contoso.com" - UseSSL = $false - IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") - ConnectionType = "ActiveDirectory" + Server = "server.contoso.com" + UseSSL = $false + IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") + ConnectionType = "ActiveDirectory" } Mock -CommandName Get-SPServiceApplication -MockWith { return $null } @@ -244,22 +263,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When connection doesn't exist" -Fixture { $testParams = @{ - UserProfileService = "User Profile Service Application" - Forest = "contoso.com" - Name = "Contoso" + UserProfileService = "User Profile Service Application" + Forest = "contoso.com" + Name = "Contoso" ConnectionCredentials = $mockCredential - Server = "server.contoso.com" - UseSSL = $false - IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") - ConnectionType = "ActiveDirectory" + Server = "server.contoso.com" + UseSSL = $false + IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") + ConnectionType = "ActiveDirectory" } - $userProfileServiceNoConnections = @{ - Name = "User Profile Service Application" - ApplicationPool = "SharePoint Service Applications" - FarmAccount = $mockCredential + $userProfileServiceNoConnections = @{ + Name = "User Profile Service Application" + ApplicationPool = "SharePoint Service Applications" + FarmAccount = $mockCredential ServiceApplicationProxyGroup = "Proxy Group" - ConnnectionManager = @() + ConnnectionManager = @() } Mock -CommandName Get-SPServiceApplication -MockWith { return $userProfileServiceNoConnections } @@ -274,7 +293,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should create a new service application in the set method" { - $Global:SPDscUPSAddActiveDirectoryConnectionCalled =$false + $Global:SPDscUPSAddActiveDirectoryConnectionCalled = $false Set-TargetResource @testParams $Global:SPDscUPSAddActiveDirectoryConnectionCalled | Should be $true } @@ -282,14 +301,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When connection exists and account is different" -Fixture { $testParams = @{ - UserProfileService = "User Profile Service Application" - Forest = "contoso.com" - Name = "Contoso" + UserProfileService = "User Profile Service Application" + Forest = "contoso.com" + Name = "Contoso" ConnectionCredentials = $mockCredential - Server = "server.contoso.com" - UseSSL = $false - IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") - ConnectionType = "ActiveDirectory" + Server = "server.contoso.com" + UseSSL = $false + IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") + ConnectionType = "ActiveDirectory" } Mock -CommandName Get-SPServiceApplication -MockWith { @@ -308,8 +327,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "execute update credentials" { - $Global:SPDscUPSSyncConnectionSetCredentialsCalled=$false - $Global:SPDscUPSSyncConnectionRefreshSchemaCalled=$false + $Global:SPDscUPSSyncConnectionSetCredentialsCalled = $false + $Global:SPDscUPSSyncConnectionRefreshSchemaCalled = $false Set-TargetResource @testParams $Global:SPDscUPSSyncConnectionSetCredentialsCalled | Should be $true $Global:SPDscUPSSyncConnectionRefreshSchemaCalled | Should be $true @@ -319,16 +338,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Port and UseDisabledFilter are specified and UseSSL is True" -Fixture { $testParams = @{ - UserProfileService = "User Profile Service Application" - Forest = "contoso.com" - Name = "Contoso" + UserProfileService = "User Profile Service Application" + Forest = "contoso.com" + Name = "Contoso" ConnectionCredentials = $mockCredential - Server = "server.contoso.com" - UseSSL = $true - UseDisabledFilter = $true - Port = 636 - IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") - ConnectionType = "ActiveDirectory" + Server = "server.contoso.com" + UseSSL = $true + UseDisabledFilter = $true + Port = 636 + IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") + ConnectionType = "ActiveDirectory" } Mock -CommandName Get-SPServiceApplication -MockWith { @@ -347,8 +366,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "execute update credentials" { - $Global:SPDscUPSSyncConnectionSetCredentialsCalled=$false - $Global:SPDscUPSSyncConnectionRefreshSchemaCalled=$false + $Global:SPDscUPSSyncConnectionSetCredentialsCalled = $false + $Global:SPDscUPSSyncConnectionRefreshSchemaCalled = $false Set-TargetResource @testParams $Global:SPDscUPSSyncConnectionSetCredentialsCalled | Should be $true $Global:SPDscUPSSyncConnectionRefreshSchemaCalled | Should be $true @@ -357,62 +376,62 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When connection exists and forest is different" -Fixture { $testParams = @{ - UserProfileService = "User Profile Service Application" - Forest = "contoso.com" - Name = "Contoso" + UserProfileService = "User Profile Service Application" + Forest = "contoso.com" + Name = "Contoso" ConnectionCredentials = $mockCredential - Server = "server.contoso.com" - IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") - ConnectionType = "ActiveDirectory" + Server = "server.contoso.com" + IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") + ConnectionType = "ActiveDirectory" } $litWareconnection = @{ - DisplayName = $name - Server = "litware.net" - NamingContexts= New-Object -TypeName System.Collections.ArrayList - AccountDomain = "Contoso" + DisplayName = $name + Server = "litware.net" + NamingContexts = New-Object -TypeName System.Collections.ArrayList + AccountDomain = "Contoso" AccountUsername = "TestAccount" - Type= "ActiveDirectory" + Type = "ActiveDirectory" } $litWareconnection.NamingContexts.Add($namingContext); $litWareconnection = $litWareconnection | Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value { - $Global:SPDscUPSSyncConnectionDeleteCalled = $true - } -PassThru - $userProfileServiceValidConnection = @{ - Name = "User Profile Service Application" - TypeName = "User Profile Service Application" - ApplicationPool = "SharePoint Service Applications" - FarmAccount = $mockCredential + -Name Delete ` + -Value { + $Global:SPDscUPSSyncConnectionDeleteCalled = $true + } -PassThru + $userProfileServiceValidConnection = @{ + Name = "User Profile Service Application" + TypeName = "User Profile Service Application" + ApplicationPool = "SharePoint Service Applications" + FarmAccount = $mockCredential ServiceApplicationProxyGroup = "Proxy Group" - ConnectionManager= New-Object -TypeName System.Collections.ArrayList + ConnectionManager = New-Object -TypeName System.Collections.ArrayList } $userProfileServiceValidConnection.ConnectionManager.Add($litWareconnection); Mock -CommandName Get-SPServiceApplication -MockWith { return $userProfileServiceValidConnection } - $litwareConnnectionManager = New-Object -TypeName System.Collections.ArrayList | Add-Member -MemberType ScriptMethod AddActiveDirectoryConnection{ ` - param([Microsoft.Office.Server.UserProfiles.ConnectionType] $connectionType, ` - $name, ` - $forest, ` - $useSSL, ` - $userName, ` - $securePassword, ` - $namingContext, ` - $p1, $p2 ` - ) - - $Global:SPDscUPSAddActiveDirectoryConnectionCalled =$true + $litwareConnnectionManager = New-Object -TypeName System.Collections.ArrayList | Add-Member -MemberType ScriptMethod AddActiveDirectoryConnection { ` + param([Microsoft.Office.Server.UserProfiles.ConnectionType] $connectionType, ` + $name, ` + $forest, ` + $useSSL, ` + $userName, ` + $securePassword, ` + $namingContext, ` + $p1, $p2 ` + ) + + $Global:SPDscUPSAddActiveDirectoryConnectionCalled = $true } -PassThru $litwareConnnectionManager.Add($litWareconnection) Mock -CommandName New-Object -MockWith { - return (@{} | Add-Member -MemberType ScriptMethod IsSynchronizationRunning { - $Global:SPDscUpsSyncIsSynchronizationRunning=$true; - return $false; - } -PassThru | Add-Member ConnectionManager $litwareConnnectionManager -PassThru ) + return (@{ } | Add-Member -MemberType ScriptMethod IsSynchronizationRunning { + $Global:SPDscUpsSyncIsSynchronizationRunning = $true; + return $false; + } -PassThru | Add-Member ConnectionManager $litwareConnnectionManager -PassThru ) } -ParameterFilter { $TypeName -eq "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" } It "Should return service instance from the Get method" { @@ -426,33 +445,35 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { It "Should throw exception as force isn't specified" { - $Global:SPDscUPSSyncConnectionDeleteCalled=$false - {Set-TargetResource @testParams} | should throw + $Global:SPDscUPSSyncConnectionDeleteCalled = $false + { Set-TargetResource @testParams } | should throw $Global:SPDscUPSSyncConnectionDeleteCalled | Should be $false } } } $forceTestParams = @{ - UserProfileService = "User Profile Service Application" - Forest = "contoso.com" - Name = "Contoso" + UserProfileService = "User Profile Service Application" + Forest = "contoso.com" + Name = "Contoso" ConnectionCredentials = $mockCredential - Server = "server.contoso.com" - UseSSL = $false - Force = $true - IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") - ConnectionType = "ActiveDirectory" + Server = "server.contoso.com" + UseSSL = $false + Force = $true + IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") + ConnectionType = "ActiveDirectory" } switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { It "delete and create as force is specified" { - $Global:SPDscUPSSyncConnectionDeleteCalled=$false - $Global:SPDscUPSAddActiveDirectoryConnectionCalled =$false + $Global:SPDscUPSSyncConnectionDeleteCalled = $false + $Global:SPDscUPSAddActiveDirectoryConnectionCalled = $false Set-TargetResource @forceTestParams $Global:SPDscUPSSyncConnectionDeleteCalled | Should be $true $Global:SPDscUPSAddActiveDirectoryConnectionCalled | Should be $true @@ -468,77 +489,77 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When synchronization is running" -Fixture { $testParams = @{ - UserProfileService = "User Profile Service Application" - Forest = "contoso.com" - Name = "Contoso" + UserProfileService = "User Profile Service Application" + Forest = "contoso.com" + Name = "Contoso" ConnectionCredentials = $mockCredential - Server = "server.contoso.com" - UseSSL = $false - IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") - ConnectionType = "ActiveDirectory" + Server = "server.contoso.com" + UseSSL = $false + IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") + ConnectionType = "ActiveDirectory" } Mock -CommandName Get-SPServiceApplication -MockWith { return @( New-Object -TypeName "Object" | Add-Member -MemberType NoteProperty ` - -Name ServiceApplicationProxyGroup ` - -Value "Proxy Group" ` - -PassThru + -Name ServiceApplicationProxyGroup ` + -Value "Proxy Group" ` + -PassThru ) } Mock -CommandName New-Object -MockWith { - return (@{} | Add-Member -MemberType ScriptMethod ` - -Name IsSynchronizationRunning ` - -Value { - $Global:SPDscUpsSyncIsSynchronizationRunning=$true; - return $true - } -PassThru) + return (@{ } | Add-Member -MemberType ScriptMethod ` + -Name IsSynchronizationRunning ` + -Value { + $Global:SPDscUpsSyncIsSynchronizationRunning = $true; + return $true + } -PassThru) } -ParameterFilter { $TypeName -eq "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" } It "attempts to execute method but synchronization is running" { - $Global:SPDscUpsSyncIsSynchronizationRunning=$false - $Global:SPDscUPSAddActiveDirectoryConnectionCalled =$false - { Set-TargetResource @testParams }| Should throw + $Global:SPDscUpsSyncIsSynchronizationRunning = $false + $Global:SPDscUPSAddActiveDirectoryConnectionCalled = $false + { Set-TargetResource @testParams } | Should throw Assert-MockCalled Get-SPServiceApplication Assert-MockCalled New-Object -ParameterFilter { $TypeName -eq "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" } - $Global:SPDscUpsSyncIsSynchronizationRunning| Should be $true; + $Global:SPDscUpsSyncIsSynchronizationRunning | Should be $true; $Global:SPDscUPSAddActiveDirectoryConnectionCalled | Should be $false; } } Context -Name "When connection exists and Excluded and Included OUs are different. force parameter provided" -Fixture { $testParams = @{ - UserProfileService = "User Profile Service Application" - Forest = "contoso.com" - Name = "Contoso" + UserProfileService = "User Profile Service Application" + Forest = "contoso.com" + Name = "Contoso" ConnectionCredentials = $mockCredential - Server = "server.contoso.com" - UseSSL = $false - IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") - ConnectionType = "ActiveDirectory" + Server = "server.contoso.com" + UseSSL = $false + IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") + ConnectionType = "ActiveDirectory" } - $userProfileServiceValidConnection = @{ - Name = "User Profile Service Application" - TypeName = "User Profile Service Application" - ApplicationPool = "SharePoint Service Applications" - FarmAccount = $mockCredential + $userProfileServiceValidConnection = @{ + Name = "User Profile Service Application" + TypeName = "User Profile Service Application" + ApplicationPool = "SharePoint Service Applications" + FarmAccount = $mockCredential ServiceApplicationProxyGroup = "Proxy Group" - ConnectionManager= New-Object -TypeName System.Collections.ArrayList + ConnectionManager = New-Object -TypeName System.Collections.ArrayList } | Add-Member -MemberType ScriptMethod -Name GetMethod -Value { - return (@{ - FullName = $getTypeFullName - }) | Add-Member -MemberType ScriptMethod -Name GetMethods -Value { return (@{ - Name = "get_NamingContexts" - }) | Add-Member -MemberType ScriptMethod -Name Invoke -Value { - return @{ - AbsoluteUri = "http://contoso.sharepoint.com/sites/ct" - } - } -PassThru -Force + FullName = $getTypeFullName + }) | Add-Member -MemberType ScriptMethod -Name GetMethods -Value { + return (@{ + Name = "get_NamingContexts" + }) | Add-Member -MemberType ScriptMethod -Name Invoke -Value { + return @{ + AbsoluteUri = "http://contoso.sharepoint.com/sites/ct" + } + } -PassThru -Force } -PassThru -Force } -PassThru -Force $userProfileServiceValidConnection.ConnectionManager.Add($connection) @@ -548,16 +569,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $difOUsTestParams = @{ - UserProfileService = "User Profile Service Application" - Forest = "contoso.com" - Name = "Contoso" + UserProfileService = "User Profile Service Application" + Forest = "contoso.com" + Name = "Contoso" ConnectionCredentials = $mockCredential - Server = "server.contoso.com" - UseSSL = $false - Force = $false - IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com","OU=Notes Users,DC=Contoso,DC=com") - ExcludedOUs = @("OU=Excluded, OU=SharePoint Users,DC=Contoso,DC=com") - ConnectionType = "ActiveDirectory" + Server = "server.contoso.com" + UseSSL = $false + Force = $false + IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com", "OU=Notes Users,DC=Contoso,DC=com") + ExcludedOUs = @("OU=Excluded, OU=SharePoint Users,DC=Contoso,DC=com") + ConnectionType = "ActiveDirectory" } It "Should return values from the get method" { @@ -570,61 +591,61 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should update OU lists" { - $Global:SPDscUPSSyncConnectionUpdateCalled= $false - $Global:SPDscUPSSyncConnectionSetCredentialsCalled = $false - $Global:SPDscUPSSyncConnectionRefreshSchemaCalled =$false + $Global:SPDscUPSSyncConnectionUpdateCalled = $false + $Global:SPDscUPSSyncConnectionSetCredentialsCalled = $false + $Global:SPDscUPSSyncConnectionRefreshSchemaCalled = $false Set-TargetResource @difOUsTestParams $Global:SPDscUPSSyncConnectionUpdateCalled | Should be $true - $Global:SPDscUPSSyncConnectionSetCredentialsCalled | Should be $true + $Global:SPDscUPSSyncConnectionSetCredentialsCalled | Should be $true $Global:SPDscUPSSyncConnectionRefreshSchemaCalled | Should be $true } } Context -Name "Connection exists and name contains dots" -Fixture { $testParams = @{ - UserProfileService = "User Profile Service Application" - Forest = "contoso.com" - Name = "contoso.com" + UserProfileService = "User Profile Service Application" + Forest = "contoso.com" + Name = "contoso.com" ConnectionCredentials = $mockCredential - Server = "server.contoso.com" - IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") - ConnectionType = "ActiveDirectory" + Server = "server.contoso.com" + IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") + ConnectionType = "ActiveDirectory" } $litWareconnection = @{ - DisplayName = "contoso.com" - Server = "litware.net" - NamingContexts= New-Object -TypeName System.Collections.ArrayList - AccountDomain = "Contoso" - AccountUsername = "TestAccount" + DisplayName = "contoso.com" + Server = "litware.net" + NamingContexts = New-Object -TypeName System.Collections.ArrayList + AccountDomain = "Contoso" + AccountUsername = "TestAccount" UseDisabledFilter = $false - Type= "ActiveDirectory" + Type = "ActiveDirectory" } - $namingContext =@{ + $namingContext = @{ DistinguishedName = $defaultDistinguishedName } $litWareconnection.NamingContexts.Add($namingContext); - $userProfileServiceValidConnection = @{ - Name = "User Profile Service Application" - TypeName = "User Profile Service Application" - ApplicationPool = "SharePoint Service Applications" - FarmAccount = $mockCredential + $userProfileServiceValidConnection = @{ + Name = "User Profile Service Application" + TypeName = "User Profile Service Application" + ApplicationPool = "SharePoint Service Applications" + FarmAccount = $mockCredential ServiceApplicationProxyGroup = "Proxy Group" - ConnectionManager= New-Object -TypeName System.Collections.ArrayList + ConnectionManager = New-Object -TypeName System.Collections.ArrayList } | Add-Member -MemberType ScriptMethod -Name GetMethod -Value { return (@{ - FullName = $getTypeFullName - }) | Add-Member -MemberType ScriptMethod -Name GetMethods -Value { - return (@{ - Name = "get_NamingContexts" - }) | Add-Member -MemberType ScriptMethod -Name Invoke -Value { - return @{ - AbsoluteUri = "http://contoso.sharepoint.com/sites/ct" - } - } -PassThru -Force + FullName = $getTypeFullName + }) | Add-Member -MemberType ScriptMethod -Name GetMethods -Value { + return (@{ + Name = "get_NamingContexts" + }) | Add-Member -MemberType ScriptMethod -Name Invoke -Value { + return @{ + AbsoluteUri = "http://contoso.sharepoint.com/sites/ct" + } + } -PassThru -Force } -PassThru -Force } -PassThru -Force $userProfileServiceValidConnection.ConnectionManager.Add($connection) @@ -633,26 +654,26 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return $userProfileServiceValidConnection } - $litwareConnnectionManager = New-Object -TypeName System.Collections.ArrayList | Add-Member -MemberType ScriptMethod AddActiveDirectoryConnection{ ` - param([Microsoft.Office.Server.UserProfiles.ConnectionType] $connectionType, ` - $name, ` - $forest, ` - $useSSL, ` - $userName, ` - $securePassword, ` - $namingContext, ` - $p1, $p2 ` + $litwareConnnectionManager = New-Object -TypeName System.Collections.ArrayList | Add-Member -MemberType ScriptMethod AddActiveDirectoryConnection { ` + param([Microsoft.Office.Server.UserProfiles.ConnectionType] $connectionType, ` + $name, ` + $forest, ` + $useSSL, ` + $userName, ` + $securePassword, ` + $namingContext, ` + $p1, $p2 ` ) - $Global:SPDscUPSAddActiveDirectoryConnectionCalled =$true + $Global:SPDscUPSAddActiveDirectoryConnectionCalled = $true } -PassThru $litwareConnnectionManager.Add($litWareconnection) Mock -CommandName New-Object -MockWith { - return (@{} | Add-Member -MemberType ScriptMethod IsSynchronizationRunning { - $Global:SPDscUpsSyncIsSynchronizationRunning=$true; - return $false; - } -PassThru | Add-Member ConnectionManager $litwareConnnectionManager -PassThru ) + return (@{ } | Add-Member -MemberType ScriptMethod IsSynchronizationRunning { + $Global:SPDscUpsSyncIsSynchronizationRunning = $true; + return $false; + } -PassThru | Add-Member ConnectionManager $litwareConnnectionManager -PassThru ) } -ParameterFilter { $TypeName -eq "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" } It "Should return Ensure Present from the get method" { @@ -670,70 +691,70 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Connection exists, but shouldn't" -Fixture { $testParams = @{ - UserProfileService = "User Profile Service Application" - Ensure = "Absent" - Forest = "contoso.com" - Name = "contoso.com" + UserProfileService = "User Profile Service Application" + Ensure = "Absent" + Forest = "contoso.com" + Name = "contoso.com" ConnectionCredentials = $mockCredential - Server = "server.contoso.com" - IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") - ConnectionType = "ActiveDirectory" + Server = "server.contoso.com" + IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") + ConnectionType = "ActiveDirectory" } if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { $litWareconnection = @{ - DisplayName = "contoso.com" - Server = "litware.net" - NamingContexts= New-Object -TypeName System.Collections.ArrayList - AccountDomain = "Contoso" - AccountUsername = "TestAccount" + DisplayName = "contoso.com" + Server = "litware.net" + NamingContexts = New-Object -TypeName System.Collections.ArrayList + AccountDomain = "Contoso" + AccountUsername = "TestAccount" UseDisabledFilter = $false - Type= "ActiveDirectory" + Type = "ActiveDirectory" } } else { $litWareconnection = @{ - DisplayName = "contoso-com" - Server = "litware.net" - NamingContexts= New-Object -TypeName System.Collections.ArrayList - AccountDomain = "Contoso" - AccountUsername = "TestAccount" + DisplayName = "contoso-com" + Server = "litware.net" + NamingContexts = New-Object -TypeName System.Collections.ArrayList + AccountDomain = "Contoso" + AccountUsername = "TestAccount" UseDisabledFilter = $false - Type= "ActiveDirectory" + Type = "ActiveDirectory" } } - $namingContext =@{ + $namingContext = @{ DistinguishedName = $defaultDistinguishedName } $litWareconnection.NamingContexts.Add($namingContext); $litWareconnection = $litWareconnection | Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value { - $Global:SPDscUPSSyncConnectionDeleteCalled = $true - } -PassThru - $userProfileServiceValidConnection = @{ - Name = "User Profile Service Application" - TypeName = "User Profile Service Application" - ApplicationPool = "SharePoint Service Applications" - FarmAccount = $mockCredential + -Name Delete ` + -Value { + $Global:SPDscUPSSyncConnectionDeleteCalled = $true + } -PassThru + $userProfileServiceValidConnection = @{ + Name = "User Profile Service Application" + TypeName = "User Profile Service Application" + ApplicationPool = "SharePoint Service Applications" + FarmAccount = $mockCredential ServiceApplicationProxyGroup = "Proxy Group" - ConnectionManager= New-Object -TypeName System.Collections.ArrayList + ConnectionManager = New-Object -TypeName System.Collections.ArrayList } | Add-Member -MemberType ScriptMethod -Name GetMethod -Value { return (@{ - FullName = $getTypeFullName - }) | Add-Member -MemberType ScriptMethod -Name GetMethods -Value { - return (@{ - Name = "get_NamingContexts" - }) | Add-Member -MemberType ScriptMethod -Name Invoke -Value { - return @{ - AbsoluteUri = "http://contoso.sharepoint.com/sites/ct" - } - } -PassThru -Force + FullName = $getTypeFullName + }) | Add-Member -MemberType ScriptMethod -Name GetMethods -Value { + return (@{ + Name = "get_NamingContexts" + }) | Add-Member -MemberType ScriptMethod -Name Invoke -Value { + return @{ + AbsoluteUri = "http://contoso.sharepoint.com/sites/ct" + } + } -PassThru -Force } -PassThru -Force } -PassThru -Force $userProfileServiceValidConnection.ConnectionManager.Add($connection) @@ -742,26 +763,26 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return $userProfileServiceValidConnection } - $litwareConnnectionManager = New-Object -TypeName System.Collections.ArrayList | Add-Member -MemberType ScriptMethod AddActiveDirectoryConnection{ ` - param([Microsoft.Office.Server.UserProfiles.ConnectionType] $connectionType, ` - $name, ` - $forest, ` - $useSSL, ` - $userName, ` - $securePassword, ` - $namingContext, ` - $p1, $p2 ` + $litwareConnnectionManager = New-Object -TypeName System.Collections.ArrayList | Add-Member -MemberType ScriptMethod AddActiveDirectoryConnection { ` + param([Microsoft.Office.Server.UserProfiles.ConnectionType] $connectionType, ` + $name, ` + $forest, ` + $useSSL, ` + $userName, ` + $securePassword, ` + $namingContext, ` + $p1, $p2 ` ) - $Global:SPDscUPSAddActiveDirectoryConnectionCalled =$true + $Global:SPDscUPSAddActiveDirectoryConnectionCalled = $true } -PassThru $litwareConnnectionManager.Add($litWareconnection) Mock -CommandName New-Object -MockWith { - return (@{} | Add-Member -MemberType ScriptMethod IsSynchronizationRunning { - $Global:SPDscUpsSyncIsSynchronizationRunning=$true; - return $false; - } -PassThru | Add-Member ConnectionManager $litwareConnnectionManager -PassThru ) + return (@{ } | Add-Member -MemberType ScriptMethod IsSynchronizationRunning { + $Global:SPDscUpsSyncIsSynchronizationRunning = $true; + return $false; + } -PassThru | Add-Member ConnectionManager $litwareConnnectionManager -PassThru ) } -ParameterFilter { $TypeName -eq "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" } It "Should return Ensure Present from the get method" { @@ -773,7 +794,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should remove the existing connection in the set method" { - $Global:SPDscUPSSyncConnectionDeleteCalled=$false + $Global:SPDscUPSSyncConnectionDeleteCalled = $false Set-TargetResource @testParams $Global:SPDscUPSSyncConnectionDeleteCalled | Should be $true } @@ -783,39 +804,39 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { Context -Name "When naming context is null (ADImport for SP2016)" -Fixture { $testParams = @{ - UserProfileService = "User Profile Service Application" - Forest = "contoso.com" - Name = "Contoso" + UserProfileService = "User Profile Service Application" + Forest = "contoso.com" + Name = "Contoso" ConnectionCredentials = $mockCredential - Server = "server.contoso.com" - UseSSL = $false - IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") - ConnectionType = "ActiveDirectory" + Server = "server.contoso.com" + UseSSL = $false + IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") + ConnectionType = "ActiveDirectory" } $litWareconnection = @{ - DisplayName = $name - Server = "litware.net" - NamingContexts= New-Object -TypeName System.Collections.ArrayList - AccountDomain = "Contoso" - AccountUsername = "TestAccount" + DisplayName = $name + Server = "litware.net" + NamingContexts = New-Object -TypeName System.Collections.ArrayList + AccountDomain = "Contoso" + AccountUsername = "TestAccount" UseDisabledFilter = $false - Type= "ActiveDirectory" + Type = "ActiveDirectory" } - $namingContext =@{ + $namingContext = @{ DistinguishedName = "DC=LITWARE,DC=NET" } $litWareconnection.NamingContexts.Add($namingContext); - $userProfileServiceValidConnection = @{ - Name = "User Profile Service Application" - TypeName = "User Profile Service Application" - ApplicationPool = "SharePoint Service Applications" - FarmAccount = $mockCredential + $userProfileServiceValidConnection = @{ + Name = "User Profile Service Application" + TypeName = "User Profile Service Application" + ApplicationPool = "SharePoint Service Applications" + FarmAccount = $mockCredential ServiceApplicationProxyGroup = "Proxy Group" - ConnectionManager= New-Object -TypeName System.Collections.ArrayList + ConnectionManager = New-Object -TypeName System.Collections.ArrayList } | Add-Member -MemberType ScriptMethod -Name GetMethod -Value { return (@{ FullName = $getTypeFullName @@ -827,34 +848,34 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { AbsoluteUri = "http://contoso.sharepoint.com/sites/ct" } } -PassThru -Force - } -PassThru -Force } -PassThru -Force - $userProfileServiceValidConnection.ConnectionManager.Add($connection); + } -PassThru -Force + $userProfileServiceValidConnection.ConnectionManager.Add($connection); $userProfileServiceValidConnection.ConnectionManager.Add($litWareconnection); Mock -CommandName Get-SPServiceApplication -MockWith { return $userProfileServiceValidConnection } - $litwareConnnectionManager = New-Object -TypeName System.Collections.ArrayList | Add-Member -MemberType ScriptMethod AddActiveDirectoryConnection{ ` - param([Microsoft.Office.Server.UserProfiles.ConnectionType] $connectionType, ` - $name, ` - $forest, ` - $useSSL, ` - $userName, ` - $securePassword, ` - $namingContext, ` - $p1, $p2 ` - ) - - $Global:SPDscUPSAddActiveDirectoryConnectionCalled =$true + $litwareConnnectionManager = New-Object -TypeName System.Collections.ArrayList | Add-Member -MemberType ScriptMethod AddActiveDirectoryConnection { ` + param([Microsoft.Office.Server.UserProfiles.ConnectionType] $connectionType, ` + $name, ` + $forest, ` + $useSSL, ` + $userName, ` + $securePassword, ` + $namingContext, ` + $p1, $p2 ` + ) + + $Global:SPDscUPSAddActiveDirectoryConnectionCalled = $true } -PassThru $litwareConnnectionManager.Add($litWareconnection) Mock -CommandName New-Object -MockWith { - return (@{} | Add-Member -MemberType ScriptMethod IsSynchronizationRunning { - $Global:SPDscUpsSyncIsSynchronizationRunning=$true; - return $false; - } -PassThru | Add-Member ConnectionManager $litwareConnnectionManager -PassThru ) + return (@{ } | Add-Member -MemberType ScriptMethod IsSynchronizationRunning { + $Global:SPDscUpsSyncIsSynchronizationRunning = $true; + return $false; + } -PassThru | Add-Member ConnectionManager $litwareConnnectionManager -PassThru ) } -ParameterFilter { $TypeName -eq "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" } It "Should return values from the get method" { @@ -864,49 +885,49 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Connection exists and name contains hyphens instead of dots" -Fixture { $testParams = @{ - UserProfileService = "User Profile Service Application" - Forest = "contoso.com" - Name = "contoso.com" + UserProfileService = "User Profile Service Application" + Forest = "contoso.com" + Name = "contoso.com" ConnectionCredentials = $mockCredential - Server = "server.contoso.com" - IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") - ConnectionType = "ActiveDirectory" + Server = "server.contoso.com" + IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") + ConnectionType = "ActiveDirectory" } $litWareconnection = @{ - DisplayName = "contoso-com" - Server = "litware.net" - NamingContexts= New-Object -TypeName System.Collections.ArrayList - AccountDomain = "Contoso" - AccountUsername = "TestAccount" + DisplayName = "contoso-com" + Server = "litware.net" + NamingContexts = New-Object -TypeName System.Collections.ArrayList + AccountDomain = "Contoso" + AccountUsername = "TestAccount" UseDisabledFilter = $false - Type= "ActiveDirectory" + Type = "ActiveDirectory" } - $namingContext =@{ + $namingContext = @{ DistinguishedName = "DC=LITWARE,DC=NET" } $litWareconnection.NamingContexts.Add($namingContext); - $userProfileServiceValidConnection = @{ - Name = "User Profile Service Application" - TypeName = "User Profile Service Application" - ApplicationPool = "SharePoint Service Applications" - FarmAccount = $mockCredential + $userProfileServiceValidConnection = @{ + Name = "User Profile Service Application" + TypeName = "User Profile Service Application" + ApplicationPool = "SharePoint Service Applications" + FarmAccount = $mockCredential ServiceApplicationProxyGroup = "Proxy Group" - ConnectionManager= New-Object -TypeName System.Collections.ArrayList + ConnectionManager = New-Object -TypeName System.Collections.ArrayList } | Add-Member -MemberType ScriptMethod -Name GetMethod -Value { return (@{ - FullName = $getTypeFullName - }) | Add-Member -MemberType ScriptMethod -Name GetMethods -Value { - return (@{ - Name = "get_NamingContexts" - }) | Add-Member -MemberType ScriptMethod -Name Invoke -Value { - return @{ - AbsoluteUri = "http://contoso.sharepoint.com/sites/ct" - } - } -PassThru -Force + FullName = $getTypeFullName + }) | Add-Member -MemberType ScriptMethod -Name GetMethods -Value { + return (@{ + Name = "get_NamingContexts" + }) | Add-Member -MemberType ScriptMethod -Name Invoke -Value { + return @{ + AbsoluteUri = "http://contoso.sharepoint.com/sites/ct" + } + } -PassThru -Force } -PassThru -Force } -PassThru -Force $userProfileServiceValidConnection.ConnectionManager.Add($connection) @@ -915,26 +936,26 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return $userProfileServiceValidConnection } - $litwareConnnectionManager = New-Object -TypeName System.Collections.ArrayList | Add-Member -MemberType ScriptMethod AddActiveDirectoryConnection{ ` - param([Microsoft.Office.Server.UserProfiles.ConnectionType] $connectionType, ` - $name, ` - $forest, ` - $useSSL, ` - $userName, ` - $securePassword, ` - $namingContext, ` - $p1, $p2 ` + $litwareConnnectionManager = New-Object -TypeName System.Collections.ArrayList | Add-Member -MemberType ScriptMethod AddActiveDirectoryConnection { ` + param([Microsoft.Office.Server.UserProfiles.ConnectionType] $connectionType, ` + $name, ` + $forest, ` + $useSSL, ` + $userName, ` + $securePassword, ` + $namingContext, ` + $p1, $p2 ` ) - $Global:SPDscUPSAddActiveDirectoryConnectionCalled =$true + $Global:SPDscUPSAddActiveDirectoryConnectionCalled = $true } -PassThru $litwareConnnectionManager.Add($litWareconnection) Mock -CommandName New-Object -MockWith { - return (@{} | Add-Member -MemberType ScriptMethod IsSynchronizationRunning { - $Global:SPDscUpsSyncIsSynchronizationRunning=$true; - return $false; - } -PassThru | Add-Member ConnectionManager $litwareConnnectionManager -PassThru ) + return (@{ } | Add-Member -MemberType ScriptMethod IsSynchronizationRunning { + $Global:SPDscUpsSyncIsSynchronizationRunning = $true; + return $false; + } -PassThru | Add-Member ConnectionManager $litwareConnnectionManager -PassThru ) } -ParameterFilter { $TypeName -eq "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" } It "Should return Ensure Present from the get method" { @@ -954,43 +975,43 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { Context -Name "Connection exists and name contains hyphens instead of dots" -Fixture { $testParams = @{ - UserProfileService = "User Profile Service Application" - Forest = "contoso.com" - Name = "contoso.com" + UserProfileService = "User Profile Service Application" + Forest = "contoso.com" + Name = "contoso.com" ConnectionCredentials = $mockCredential - Server = "server.contoso.com" - IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") - ConnectionType = "ActiveDirectory" + Server = "server.contoso.com" + IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") + ConnectionType = "ActiveDirectory" } $litWareconnection = @{ - DisplayName = "contoso-com" - Server = "litware.net" - NamingContexts= New-Object -TypeName System.Collections.ArrayList - AccountDomain = "Contoso" - AccountUsername = "TestAccount" + DisplayName = "contoso-com" + Server = "litware.net" + NamingContexts = New-Object -TypeName System.Collections.ArrayList + AccountDomain = "Contoso" + AccountUsername = "TestAccount" UseDisabledFilter = $false - Type= "ActiveDirectory" + Type = "ActiveDirectory" } - $userProfileServiceValidConnection = @{ - Name = "User Profile Service Application" - TypeName = "User Profile Service Application" - ApplicationPool = "SharePoint Service Applications" - FarmAccount = $mockCredential + $userProfileServiceValidConnection = @{ + Name = "User Profile Service Application" + TypeName = "User Profile Service Application" + ApplicationPool = "SharePoint Service Applications" + FarmAccount = $mockCredential ServiceApplicationProxyGroup = "Proxy Group" - ConnectionManager= New-Object -TypeName System.Collections.ArrayList + ConnectionManager = New-Object -TypeName System.Collections.ArrayList } | Add-Member -MemberType ScriptMethod -Name GetMethod -Value { return (@{ - FullName = $getTypeFullName - }) | Add-Member -MemberType ScriptMethod -Name GetMethods -Value { - return (@{ - Name = "get_NamingContexts" - }) | Add-Member -MemberType ScriptMethod -Name Invoke -Value { - return @{ - AbsoluteUri = "http://contoso.sharepoint.com/sites/ct" - } - } -PassThru -Force + FullName = $getTypeFullName + }) | Add-Member -MemberType ScriptMethod -Name GetMethods -Value { + return (@{ + Name = "get_NamingContexts" + }) | Add-Member -MemberType ScriptMethod -Name Invoke -Value { + return @{ + AbsoluteUri = "http://contoso.sharepoint.com/sites/ct" + } + } -PassThru -Force } -PassThru -Force } -PassThru -Force $userProfileServiceValidConnection.ConnectionManager.Add($connection) @@ -999,26 +1020,26 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { return $userProfileServiceValidConnection } - $litwareConnnectionManager = New-Object -TypeName System.Collections.ArrayList | Add-Member -MemberType ScriptMethod AddActiveDirectoryConnection{ ` - param([Microsoft.Office.Server.UserProfiles.ConnectionType] $connectionType, ` - $name, ` - $forest, ` - $useSSL, ` - $userName, ` - $securePassword, ` - $namingContext, ` - $p1, $p2 ` + $litwareConnnectionManager = New-Object -TypeName System.Collections.ArrayList | Add-Member -MemberType ScriptMethod AddActiveDirectoryConnection { ` + param([Microsoft.Office.Server.UserProfiles.ConnectionType] $connectionType, ` + $name, ` + $forest, ` + $useSSL, ` + $userName, ` + $securePassword, ` + $namingContext, ` + $p1, $p2 ` ) - $Global:SPDscUPSAddActiveDirectoryConnectionCalled =$true + $Global:SPDscUPSAddActiveDirectoryConnectionCalled = $true } -PassThru $litwareConnnectionManager.Add($litWareconnection) Mock -CommandName New-Object -MockWith { - return (@{} | Add-Member -MemberType ScriptMethod IsSynchronizationRunning { - $Global:SPDscUpsSyncIsSynchronizationRunning=$true; - return $false; - } -PassThru | Add-Member ConnectionManager $litwareConnnectionManager -PassThru ) + return (@{ } | Add-Member -MemberType ScriptMethod IsSynchronizationRunning { + $Global:SPDscUpsSyncIsSynchronizationRunning = $true; + return $false; + } -PassThru | Add-Member ConnectionManager $litwareConnnectionManager -PassThru ) } -ParameterFilter { $TypeName -eq "Microsoft.Office.Server.UserProfiles.UserProfileConfigManager" } It "Should return Ensure Absent from the get method" { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileSyncService.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileSyncService.Tests.ps1 index d8d198a8c..810a7648c 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileSyncService.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileSyncService.Tests.ps1 @@ -4,16 +4,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPUserProfileSyncService" + -DscResource "SPUserProfileSyncService" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -23,9 +23,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $getTypeFullName = "Microsoft.Office.Server.Administration.UserProfileApplication" $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force $mockCredential = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList @("$($Env:USERDOMAIN)\$($Env:USERNAME)", $mockPassword) + -ArgumentList @("$($Env:USERDOMAIN)\$($Env:USERNAME)", $mockPassword) $mockFarmCredential = New-Object -TypeName System.Management.Automation.PSCredential ` - -ArgumentList @("DOMAIN\sp_farm", $mockPassword) + -ArgumentList @("DOMAIN\sp_farm", $mockPassword) # Mocks for all contexts Mock -CommandName Clear-SPDscKerberosToken -MockWith { } @@ -44,96 +44,97 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPServiceApplication -MockWith { return @( New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name TypeName ` + -Value "User Profile Service Application" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name DisplayName ` + -Value "User Profile Service Service App" ` + -PassThru | + Add-Member -MemberType NoteProperty ` + -Name ApplicationPool ` + -Value @{ + Name = "Service Pool" + } -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + New-Object -TypeName "Object" | Add-Member -MemberType NoteProperty ` - -Name TypeName ` - -Value "User Profile Service Application" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name DisplayName ` - -Value "User Profile Service Service App" ` - -PassThru | - Add-Member -MemberType NoteProperty ` - -Name ApplicationPool ` - -Value @{ - Name = "Service Pool" - } -PassThru | + -Name FullName ` + -Value $getTypeFullName ` + -PassThru | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetProperties ` - -Value { - param($x) - return @( - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SocialDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return @{ - Name = "SP_SocialDB" - Server = @{ - Name = "SQL.domain.local" - } - } - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "ProfileDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileDB" - Server = @{ - Name = "SQL.domain.local" - } - } - } -PassThru - ), - (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SynchronizationDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileSyncDB" - Server = @{ - Name = "SQL.domain.local" - } - } - } -PassThru - ) - ) - } -PassThru - } -PassThru -Force + -Name GetProperties ` + -Value { + param($x) + return @( + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SocialDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return @{ + Name = "SP_SocialDB" + Server = @{ + Name = "SQL.domain.local" + } + } + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "ProfileDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileDB" + Server = @{ + Name = "SQL.domain.local" + } + } + } -PassThru + ), + (New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SynchronizationDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileSyncDB" + Server = @{ + Name = "SQL.domain.local" + } + } + } -PassThru + ) + ) + } -PassThru + } -PassThru -Force ) } # Test contexts switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) { - 15 { + 15 + { Context -Name "When PSDSCRunAsCredential is not the Farm Account" -Fixture { $testParams = @{ UserProfileServiceAppName = "User Profile Sync Service App" - FarmAccount = $mockCredential - Ensure = "Present" + FarmAccount = $mockCredential + Ensure = "Present" } Mock -CommandName Get-SPDscFarmAccount -MockWith { @@ -160,9 +161,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When InstallAccount is the Farm Account" -Fixture { $testParams = @{ UserProfileServiceAppName = "User Profile Service Service App" - FarmAccount = $mockCredential - Ensure = "Present" - InstallAccount = $mockFarmCredential + FarmAccount = $mockCredential + Ensure = "Present" + InstallAccount = $mockFarmCredential } Mock -CommandName Get-SPServiceInstance -MockWith { @@ -185,8 +186,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "User profile sync service is not found locally" -Fixture { $testParams = @{ UserProfileServiceAppName = "User Profile Service Service App" - FarmAccount = $mockCredential - Ensure = "Present" + FarmAccount = $mockCredential + Ensure = "Present" } Mock -CommandName Get-SPServiceInstance -MockWith { @@ -202,13 +203,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "User profile sync service is not running and should be" -Fixture { $testParams = @{ UserProfileServiceAppName = "User Profile Service Service App" - FarmAccount = $mockCredential - Ensure = "Present" + FarmAccount = $mockCredential + Ensure = "Present" } Mock -CommandName Get-SPServiceInstance -MockWith { $spSvcInstance = [pscustomobject]@{ - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") TypeName = "User Profile Synchronization Service" } $spSvcInstance = $spSvcInstance | Add-Member ScriptMethod GetType { @@ -231,30 +232,30 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPServiceApplication -MockWith { return @( New-Object -TypeName "Object" | + Add-Member -MemberType NoteProperty ` + -Name ID ` + -Value ([Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f")) ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + New-Object -TypeName "Object" | Add-Member -MemberType NoteProperty ` - -Name ID ` - -Value ([Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f")) ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name FullName ` - -Value $getTypeFullName ` - -PassThru - } ` - -PassThru -Force | - Add-Member -MemberType ScriptMethod ` - -Name SetSynchronizationMachine ` - -Value { - param( - $computerName, - $syncServiceID, - $FarmUserName, - $FarmPassword - ) - } -PassThru + -Name FullName ` + -Value $getTypeFullName ` + -PassThru + } ` + -PassThru -Force | + Add-Member -MemberType ScriptMethod ` + -Name SetSynchronizationMachine ` + -Value { + param( + $computerName, + $syncServiceID, + $FarmUserName, + $FarmPassword + ) + } -PassThru ) } @@ -288,13 +289,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "User profile sync service is running and should be" -Fixture { $testParams = @{ UserProfileServiceAppName = "User Profile Service Service App" - FarmAccount = $mockCredential - Ensure = "Present" + FarmAccount = $mockCredential + Ensure = "Present" } Mock -CommandName Get-SPServiceInstance -MockWith { $spSvcInstance = [pscustomobject]@{ - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") TypeName = "User Profile Synchronization Service" } $spSvcInstance = $spSvcInstance | Add-Member ScriptMethod GetType { @@ -317,13 +318,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "User profile sync service is running and shouldn't be" -Fixture { $testParams = @{ UserProfileServiceAppName = "User Profile Service Service App" - FarmAccount = $mockCredential - Ensure = "Absent" + FarmAccount = $mockCredential + Ensure = "Absent" } Mock -CommandName Get-SPServiceInstance -MockWith { $spSvcInstance = [pscustomobject]@{ - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") TypeName = "User Profile Synchronization Service" } $spSvcInstance = $spSvcInstance | Add-Member ScriptMethod GetType { @@ -364,13 +365,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "User profile sync service is not running and shouldn't be" -Fixture { $testParams = @{ UserProfileServiceAppName = "User Profile Service Service App" - FarmAccount = $mockCredential - Ensure = "Absent" + FarmAccount = $mockCredential + Ensure = "Absent" } Mock -CommandName Get-SPServiceInstance -MockWith { $spSvcInstance = [pscustomobject]@{ - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") TypeName = "User Profile Synchronization Service" } $spSvcInstance = $spSvcInstance | Add-Member ScriptMethod GetType { @@ -393,14 +394,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "User profile sync service is not running and shouldn't be because the database is read only" -Fixture { $testParams = @{ UserProfileServiceAppName = "User Profile Service Service App" - FarmAccount = $mockCredential - Ensure = "Present" - RunOnlyWhenWriteable = $true + FarmAccount = $mockCredential + Ensure = "Present" + RunOnlyWhenWriteable = $true } Mock -CommandName Get-SPServiceInstance -MockWith { $spSvcInstance = [pscustomobject]@{ - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") TypeName = "User Profile Synchronization Service" } $spSvcInstance = $spSvcInstance | Add-Member ScriptMethod GetType { @@ -414,7 +415,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDatabase -MockWith { return @( @{ - Name = "SP_ProfileDB" + Name = "SP_ProfileDB" IsReadyOnly = $true } ) @@ -432,15 +433,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "User profile sync service is running and shouldn't be because the database is read only" -Fixture { $testParams = @{ UserProfileServiceAppName = "User Profile Service Service App" - FarmAccount = $mockCredential - Ensure = "Present" - RunOnlyWhenWriteable = $true + FarmAccount = $mockCredential + Ensure = "Present" + RunOnlyWhenWriteable = $true } $Global:ServiceStatus = "Online" Mock -CommandName Get-SPServiceInstance -MockWith { $spSvcInstance = [pscustomobject]@{ - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") TypeName = "User Profile Synchronization Service" } $spSvcInstance = $spSvcInstance | Add-Member ScriptMethod GetType { @@ -456,7 +457,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPDatabase -MockWith { return @( @{ - Name = "SP_ProfileDB" + Name = "SP_ProfileDB" IsReadyOnly = $true } ) @@ -480,9 +481,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "User profile sync service is not found" -Fixture { $testParams = @{ UserProfileServiceAppName = "User Profile Service Service App" - FarmAccount = $mockCredential - Ensure = "Present" - RunOnlyWhenWriteable = $true + FarmAccount = $mockCredential + Ensure = "Present" + RunOnlyWhenWriteable = $true } Mock -CommandName Get-SPServiceInstance -MockWith { @@ -504,15 +505,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } - Context -Name "Can't get the Farm Account" -Fixture{ + Context -Name "Can't get the Farm Account" -Fixture { $testParams = @{ UserProfileServiceAppName = "User Profile Service Service App" - FarmAccount = $mockCredential - Ensure = "Present" - RunOnlyWhenWriteable = $true + FarmAccount = $mockCredential + Ensure = "Present" + RunOnlyWhenWriteable = $true } - Mock -CommandName Get-SPDscFarmAccount -MockWith{ + Mock -CommandName Get-SPDscFarmAccount -MockWith { return $null } @@ -525,11 +526,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } } - 16 { + 16 + { Context -Name "All methods throw exceptions as user profile sync doesn't exist in 2016" -Fixture { $testParams = @{ UserProfileServiceAppName = "User Profile Service Service App" - FarmAccount = $mockCredential + FarmAccount = $mockCredential } It "Should throw on the get method" { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPVisioServiceApp.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPVisioServiceApp.Tests.ps1 index 797a7bad5..f6e319a38 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPVisioServiceApp.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPVisioServiceApp.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPVisioServiceApp" + -DscResource "SPVisioServiceApp" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -29,10 +29,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Test contexts Context -Name "When no service applications exist in the current farm" -Fixture { $testParams = @{ - Name = "Test Visio App" - ProxyName = "Visio Proxy" + Name = "Test Visio App" + ProxyName = "Visio Proxy" ApplicationPool = "Test App Pool" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { @@ -54,22 +54,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When service applications exist in the current farm but the specific Visio Graphics app does not" -Fixture { $testParams = @{ - Name = "Test Visio App" + Name = "Test Visio App" ApplicationPool = "Test App Pool" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - } + DisplayName = $testParams.Name + } $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "Microsoft.Office.UnKnownWebServiceApplication" - } - } -PassThru -Force + -Name GetType ` + -Value { + return @{ + FullName = "Microsoft.Office.UnKnownWebServiceApplication" + } + } -PassThru -Force return $spServiceApp } @@ -81,16 +81,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and is configured correctly" -Fixture { $testParams = @{ - Name = "Test Visio App" - ProxyName = "Visio Proxy" + Name = "Test Visio App" + ProxyName = "Visio Proxy" ApplicationPool = "Test App Pool" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Visio Graphics Service Application" - DisplayName = $testParams.Name + TypeName = "Visio Graphics Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { @@ -104,14 +104,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPServiceApplicationProxy -MockWith { $proxiesToReturn = @() $proxy = @{ - Name = $testParams.ProxyName + Name = $testParams.ProxyName DisplayName = $testParams.ProxyName } $proxy = $proxy | Add-Member -MemberType ScriptMethod ` - -Name Delete ` - -Value {} ` - -PassThru - $proxiesToReturn += $proxy + -Name Delete ` + -Value { } ` + -PassThru + $proxiesToReturn += $proxy return $proxiesToReturn } @@ -127,15 +127,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and is not configured correctly" -Fixture { $testParams = @{ - Name = "Test Visio App" + Name = "Test Visio App" ApplicationPool = "Test App Pool" - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Visio Graphics Service Application" - DisplayName = $testParams.Name + TypeName = "Visio Graphics Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = "Wrong App Pool Name" } } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { @@ -162,15 +162,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service app exists but it shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "-" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [PSCustomObject]@{ - TypeName = "Visio Graphics Service Application" - DisplayName = $testParams.Name + TypeName = "Visio Graphics Service Application" + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { @@ -195,9 +195,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When the service app doesn't exist and shouldn't" -Fixture { $testParams = @{ - Name = "Test App" + Name = "Test App" ApplicationPool = "-" - Ensure = "Absent" + Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication -MockWith { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWeb.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWeb.Tests.ps1 index 7fec09e54..eaf3dd2cd 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWeb.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWeb.Tests.ps1 @@ -1,7 +1,7 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` -Resolve) @@ -25,16 +25,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { -PassThru ` -Value { } - # Mocks for all contexts - Mock -CommandName New-Object -MockWith { - [PSCustomObject]@{ + # Mocks for all contexts + Mock -CommandName New-Object -MockWith { + [PSCustomObject]@{ WebApplication = $fakeWebApp - } - } -ParameterFilter { - $TypeName -eq "Microsoft.SharePoint.SPSite" + } + } -ParameterFilter { + $TypeName -eq "Microsoft.SharePoint.SPSite" } Mock -CommandName Remove-SPWeb -MockWith { } - + # Test contexts Context -Name "The SPWeb doesn't exist yet and should" -Fixture { $testParams = @{ @@ -70,7 +70,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Description = "desc" } - Mock -CommandName Get-SPWeb -MockWith { + Mock -CommandName Get-SPWeb -MockWith { return @{ Url = $testParams.Url Title = $testParams.Name @@ -85,21 +85,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should return the SPWeb data from the get method" { - + $result = Get-TargetResource @testParams - $result.Ensure | Should be "Present" - $result.Template | Should be "STS#0" - $result.UniquePermissions | Should be $false - $result.UseParentTopNav | Should be $true - $result.RequestAccessEmail | Should be "valid@contoso.com" + $result.Ensure | Should be "Present" + $result.Template | Should be "STS#0" + $result.UniquePermissions | Should be $false + $result.UseParentTopNav | Should be $true + $result.RequestAccessEmail | Should be "valid@contoso.com" } It "Should return true from the test method" { Test-TargetResource @testParams | Should Be $true } } - + Context -Name "The SPWeb exists and should not" -Fixture { $testParams = @{ Url = "http://site.sharepoint.com/sites/web" @@ -108,14 +108,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Ensure = "Absent" } - Mock -CommandName Get-SPWeb -MockWith { + Mock -CommandName Get-SPWeb -MockWith { return @{ Url = $testParams.Url } } It "Should return 'Present' from the get method" { - (Get-TargetResource @testParams).Ensure | Should be "Present" + (Get-TargetResource @testParams).Ensure | Should be "Present" } It "Should return false from the test method" { @@ -146,19 +146,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { HasUniquePerm = $false } - $web | Add-Member -Name Update ` + $web | Add-Member -Name Update ` -MemberType ScriptMethod ` -Value { } Mock -CommandName Get-SPWeb -MockWith { $web } It "Should return the SPWeb data from the get method" { - + $result = Get-TargetResource @testParams - $result.Ensure | Should be "Present" + $result.Ensure | Should be "Present" $result.UniquePermissions | Should be $false - $result.UseParentTopNav | Should be $true + $result.UseParentTopNav | Should be $true } @@ -167,10 +167,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should update the values in the set method" { - + Set-TargetResource @testParams - $web.Title | Should be $testParams.Name + $web.Title | Should be $testParams.Name $web.Description | Should be $testParams.Description $web.Navigation.UseShared | Should be $false $web.HasUniquePerm | Should be $true @@ -191,7 +191,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { RequestAccessEmail = "notvalid@contoso.com" } - $web | Add-Member -Name Update ` + $web | Add-Member -Name Update ` -MemberType ScriptMethod ` -Value { } @@ -202,7 +202,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should update the values in the set method" { - + Set-TargetResource @testParams $web.RequestAccessEmail | Should be $testParams.RequestAccessEmail @@ -223,7 +223,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { RequestAccessEmail = "valid@contoso.com" } - $web | Add-Member -Name Update ` + $web | Add-Member -Name Update ` -MemberType ScriptMethod ` -Value { } @@ -234,7 +234,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should update the values in the set method" { - + Set-TargetResource @testParams $web.RequestAccessEmail | Should be "" @@ -256,7 +256,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { RequestAccessEmail = "valid@contoso.com" } - $web | Add-Member -Name Update ` + $web | Add-Member -Name Update ` -MemberType ScriptMethod ` -Value { } @@ -267,11 +267,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should not update the values set method" { - + Set-TargetResource @testParams $web.RequestAccessEmail | Should be "valid@contoso.com" - $web.HasUniquePerm | Should be $false + $web.HasUniquePerm | Should be $false Assert-MockCalled New-Object } @@ -290,7 +290,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { RequestAccessEmail = "notvalid@contoso.com" } - $web | Add-Member -Name Update ` + $web | Add-Member -Name Update ` -MemberType ScriptMethod ` -Value { } @@ -301,11 +301,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "Should update the value of unique permissions and not change the request access email in the set method" { - + Set-TargetResource @testParams $web.RequestAccessEmail | Should be "notvalid@contoso.com" - $web.HasUniquePerm | Should be $false + $web.HasUniquePerm | Should be $false Assert-MockCalled New-Object } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppAuthentication.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppAuthentication.Tests.ps1 index 40d3d205e..ff58dafc5 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppAuthentication.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppAuthentication.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWebAppAuthentication" + -DscResource "SPWebAppAuthentication" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -21,25 +21,25 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Initialize tests # Mocks for all contexts - Mock -CommandName Set-SPWebApplication {} + Mock -CommandName Set-SPWebApplication { } # Test contexts Context -Name "The web application doesn't exist" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Default = @( + WebAppUrl = "http://sharepoint.contoso.com" + Default = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "NTLM" - } -ClientOnly), + AuthenticationMethod = "NTLM" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "Federated" - AuthenticationProvider = "ADFS" - } -ClientOnly), + AuthenticationMethod = "Federated" + AuthenticationProvider = "ADFS" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "FBA" - MembershipProvider = "MemberProvider" - RoleProvider = "RoleProvider" - } -ClientOnly) + AuthenticationMethod = "FBA" + MembershipProvider = "MemberProvider" + RoleProvider = "RoleProvider" + } -ClientOnly) ) } @@ -66,12 +66,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "AuthenticationMethod=NTLM used with AuthenticationProvider parameter" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Default = @( + WebAppUrl = "http://sharepoint.contoso.com" + Default = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "NTLM" - AuthenticationProvider = "INCORRECT" - } -ClientOnly) + AuthenticationMethod = "NTLM" + AuthenticationProvider = "INCORRECT" + } -ClientOnly) ) } @@ -97,12 +97,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "AuthenticationMethod=Kerberos used with MembershipProvider parameter" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Default = @( + WebAppUrl = "http://sharepoint.contoso.com" + Default = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "Kerberos" - MembershipProvider = "INCORRECT" - } -ClientOnly) + AuthenticationMethod = "Kerberos" + MembershipProvider = "INCORRECT" + } -ClientOnly) ) } @@ -128,14 +128,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "AuthenticationMethod=FBA used with AuthenticationProvider parameter" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Default = @( - (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "FBA" - AuthenticationProvider = "INCORRECT" - MembershipProvider = "INCORRECT" - RoleProvider = "INCORRECT" - } -ClientOnly) + WebAppUrl = "http://sharepoint.contoso.com" + Default = @( + (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ + AuthenticationMethod = "FBA" + AuthenticationProvider = "INCORRECT" + MembershipProvider = "INCORRECT" + RoleProvider = "INCORRECT" + } -ClientOnly) ) } @@ -161,13 +161,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "AuthenticationMethod=Federated used with RoleProvider parameter" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Default = @( + WebAppUrl = "http://sharepoint.contoso.com" + Default = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "Federated" - AuthenticationProvider = "INCORRECT" - RoleProvider = "INCORRECT" - } -ClientOnly) + AuthenticationMethod = "Federated" + AuthenticationProvider = "INCORRECT" + RoleProvider = "INCORRECT" + } -ClientOnly) ) } @@ -193,12 +193,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "AuthenticationMethod=FBA and missing MembershipProvider parameter" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Default = @( + WebAppUrl = "http://sharepoint.contoso.com" + Default = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "FBA" - AuthenticationProvider = "INCORRECT" - } -ClientOnly) + AuthenticationMethod = "FBA" + AuthenticationProvider = "INCORRECT" + } -ClientOnly) ) } @@ -224,11 +224,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "AuthenticationMethod=Federated and missing AuthenticationProvider parameter" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Default = @( + WebAppUrl = "http://sharepoint.contoso.com" + Default = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "Federated" - } -ClientOnly) + AuthenticationMethod = "Federated" + } -ClientOnly) ) } @@ -254,14 +254,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "AuthenticationMethod=Federated and missing AuthenticationProvider parameter" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Default = @( + WebAppUrl = "http://sharepoint.contoso.com" + Default = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "NTLM" - } -ClientOnly), + AuthenticationMethod = "NTLM" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "Kerberos" - } -ClientOnly) + AuthenticationMethod = "Kerberos" + } -ClientOnly) ) } @@ -287,7 +287,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "No zones are specified" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" + WebAppUrl = "http://sharepoint.contoso.com" } Mock -CommandName Get-SPWebapplication -MockWith { return $null } @@ -312,11 +312,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "WebApplication is Classic, but Default Zone config is Claims" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Default = @( + WebAppUrl = "http://sharepoint.contoso.com" + Default = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "NTLM" - } -ClientOnly) + AuthenticationMethod = "NTLM" + } -ClientOnly) ) } @@ -329,8 +329,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-SPAuthenticationProvider -MockWith { } - Mock -CommandName New-SPAuthenticationProvider -MockWith { return @{} } - Mock -CommandName Get-SPTrustedIdentityTokenIssuer -MockWith { return @{} } + Mock -CommandName New-SPAuthenticationProvider -MockWith { return @{ } } + Mock -CommandName Get-SPTrustedIdentityTokenIssuer -MockWith { return @{ } } It "Should return null from the get method" { $result = Get-TargetResource @testParams @@ -348,20 +348,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Default Zone of Web application is configured as specified" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Default = @( + WebAppUrl = "http://sharepoint.contoso.com" + Default = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "NTLM" - } -ClientOnly), + AuthenticationMethod = "NTLM" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "Federated" - AuthenticationProvider = "ADFS" - } -ClientOnly), + AuthenticationMethod = "Federated" + AuthenticationProvider = "ADFS" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "FBA" - MembershipProvider = "MemberProvider" - RoleProvider = "RoleProvider" - } -ClientOnly) + AuthenticationMethod = "FBA" + MembershipProvider = "MemberProvider" + RoleProvider = "RoleProvider" + } -ClientOnly) ) } @@ -375,11 +375,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @( @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $true }, @{ - DisplayName = "Forms Authentication" + DisplayName = "Forms Authentication" RoleProvider = "RoleProvider" MembershipProvider = "MemberProvider" }, @@ -403,15 +403,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Specified Federated AuthenticationProvider does not exist" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Default = @( + WebAppUrl = "http://sharepoint.contoso.com" + Default = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "NTLM" - } -ClientOnly), + AuthenticationMethod = "NTLM" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "Federated" - AuthenticationProvider = "ADFS" - } -ClientOnly) + AuthenticationMethod = "Federated" + AuthenticationProvider = "ADFS" + } -ClientOnly) ) } @@ -425,13 +425,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @( @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $true } ) } - Mock -CommandName New-SPAuthenticationProvider -MockWith { return @{} } + Mock -CommandName New-SPAuthenticationProvider -MockWith { return @{ } } Mock -CommandName Get-SPTrustedIdentityTokenIssuer -MockWith { return $null } It "Should throw exception in the set method" { @@ -441,20 +441,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Default Zone of Web application is not configured as specified" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Default = @( + WebAppUrl = "http://sharepoint.contoso.com" + Default = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "NTLM" - } -ClientOnly), + AuthenticationMethod = "NTLM" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "Federated" - AuthenticationProvider = "ADFS" - } -ClientOnly), + AuthenticationMethod = "Federated" + AuthenticationProvider = "ADFS" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "FBA" - MembershipProvider = "MemberProvider" - RoleProvider = "RoleProvider" - } -ClientOnly) + AuthenticationMethod = "FBA" + MembershipProvider = "MemberProvider" + RoleProvider = "RoleProvider" + } -ClientOnly) ) } @@ -468,19 +468,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @( @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $true }, @{ - DisplayName = "Forms Authentication" + DisplayName = "Forms Authentication" RoleProvider = "RoleProvider" MembershipProvider = "MemberProvider" } ) } - Mock -CommandName New-SPAuthenticationProvider -MockWith { return @{} } - Mock -CommandName Get-SPTrustedIdentityTokenIssuer -MockWith { return @{} } + Mock -CommandName New-SPAuthenticationProvider -MockWith { return @{ } } + Mock -CommandName Get-SPTrustedIdentityTokenIssuer -MockWith { return @{ } } It "Should return null from the get method" { $result = Get-TargetResource @testParams @@ -501,38 +501,38 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Intranet Zone of Web application is configured as specified" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Intranet = @( + WebAppUrl = "http://sharepoint.contoso.com" + Intranet = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "NTLM" - } -ClientOnly), + AuthenticationMethod = "NTLM" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "Federated" - AuthenticationProvider = "ADFS" - } -ClientOnly), + AuthenticationMethod = "Federated" + AuthenticationProvider = "ADFS" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "FBA" - MembershipProvider = "MemberProvider" - RoleProvider = "RoleProvider" - } -ClientOnly) + AuthenticationMethod = "FBA" + MembershipProvider = "MemberProvider" + RoleProvider = "RoleProvider" + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { return @{ IisSettings = @{ - Keys = "Default","Intranet" + Keys = "Default", "Intranet" } } } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @( @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $true }, @{ - DisplayName = "Forms Authentication" + DisplayName = "Forms Authentication" RoleProvider = "RoleProvider" MembershipProvider = "MemberProvider" }, @@ -556,46 +556,46 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Intranet Zone of Web application is not configured as specified" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Intranet = @( + WebAppUrl = "http://sharepoint.contoso.com" + Intranet = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "NTLM" - } -ClientOnly), + AuthenticationMethod = "NTLM" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "Federated" - AuthenticationProvider = "ADFS" - } -ClientOnly), + AuthenticationMethod = "Federated" + AuthenticationProvider = "ADFS" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "FBA" - MembershipProvider = "MemberProvider" - RoleProvider = "RoleProvider" - } -ClientOnly) + AuthenticationMethod = "FBA" + MembershipProvider = "MemberProvider" + RoleProvider = "RoleProvider" + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { return @{ IisSettings = @{ - Keys = "Default","Intranet" + Keys = "Default", "Intranet" } } } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @( @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $true }, @{ - DisplayName = "Forms Authentication" + DisplayName = "Forms Authentication" RoleProvider = "RoleProvider" MembershipProvider = "MemberProvider" } ) } - Mock -CommandName New-SPAuthenticationProvider -MockWith { return @{} } - Mock -CommandName Get-SPTrustedIdentityTokenIssuer -MockWith { return @{} } + Mock -CommandName New-SPAuthenticationProvider -MockWith { return @{ } } + Mock -CommandName Get-SPTrustedIdentityTokenIssuer -MockWith { return @{ } } It "Should return null from the get method" { $result = Get-TargetResource @testParams @@ -616,38 +616,38 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Internet Zone of Web application is configured as specified" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Internet = @( + WebAppUrl = "http://sharepoint.contoso.com" + Internet = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "NTLM" - } -ClientOnly), + AuthenticationMethod = "NTLM" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "Federated" - AuthenticationProvider = "ADFS" - } -ClientOnly), + AuthenticationMethod = "Federated" + AuthenticationProvider = "ADFS" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "FBA" - MembershipProvider = "MemberProvider" - RoleProvider = "RoleProvider" - } -ClientOnly) + AuthenticationMethod = "FBA" + MembershipProvider = "MemberProvider" + RoleProvider = "RoleProvider" + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { return @{ IisSettings = @{ - Keys = "Default","Internet" + Keys = "Default", "Internet" } } } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @( @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $true }, @{ - DisplayName = "Forms Authentication" + DisplayName = "Forms Authentication" RoleProvider = "RoleProvider" MembershipProvider = "MemberProvider" }, @@ -671,46 +671,46 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Internet Zone of Web application is not configured as specified" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Internet = @( + WebAppUrl = "http://sharepoint.contoso.com" + Internet = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "NTLM" - } -ClientOnly), + AuthenticationMethod = "NTLM" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "Federated" - AuthenticationProvider = "ADFS" - } -ClientOnly), + AuthenticationMethod = "Federated" + AuthenticationProvider = "ADFS" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "FBA" - MembershipProvider = "MemberProvider" - RoleProvider = "RoleProvider" - } -ClientOnly) + AuthenticationMethod = "FBA" + MembershipProvider = "MemberProvider" + RoleProvider = "RoleProvider" + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { return @{ IisSettings = @{ - Keys = "Default","Internet" + Keys = "Default", "Internet" } } } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @( @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $true }, @{ - DisplayName = "Forms Authentication" + DisplayName = "Forms Authentication" RoleProvider = "RoleProvider" MembershipProvider = "MemberProvider" } ) } - Mock -CommandName New-SPAuthenticationProvider -MockWith { return @{} } - Mock -CommandName Get-SPTrustedIdentityTokenIssuer -MockWith { return @{} } + Mock -CommandName New-SPAuthenticationProvider -MockWith { return @{ } } + Mock -CommandName Get-SPTrustedIdentityTokenIssuer -MockWith { return @{ } } It "Should return null from the get method" { $result = Get-TargetResource @testParams @@ -731,38 +731,38 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Extranet Zone of Web application is configured as specified" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Extranet = @( + WebAppUrl = "http://sharepoint.contoso.com" + Extranet = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "NTLM" - } -ClientOnly), + AuthenticationMethod = "NTLM" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "Federated" - AuthenticationProvider = "ADFS" - } -ClientOnly), + AuthenticationMethod = "Federated" + AuthenticationProvider = "ADFS" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "FBA" - MembershipProvider = "MemberProvider" - RoleProvider = "RoleProvider" - } -ClientOnly) + AuthenticationMethod = "FBA" + MembershipProvider = "MemberProvider" + RoleProvider = "RoleProvider" + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { return @{ IisSettings = @{ - Keys = "Default","Extranet" + Keys = "Default", "Extranet" } } } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @( @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $true }, @{ - DisplayName = "Forms Authentication" + DisplayName = "Forms Authentication" RoleProvider = "RoleProvider" MembershipProvider = "MemberProvider" }, @@ -786,33 +786,33 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Extranet Zone of Web application is not configured as specified" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Extranet = @( + WebAppUrl = "http://sharepoint.contoso.com" + Extranet = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "NTLM" - } -ClientOnly), + AuthenticationMethod = "NTLM" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "Federated" - AuthenticationProvider = "ADFS" - } -ClientOnly) + AuthenticationMethod = "Federated" + AuthenticationProvider = "ADFS" + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { return @{ IisSettings = @{ - Keys = "Default","Extranet" + Keys = "Default", "Extranet" } } } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @( @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $true }, @{ - DisplayName = "Forms Authentication" + DisplayName = "Forms Authentication" RoleProvider = "RoleProvider" MembershipProvider = "MemberProvider" }, @@ -822,8 +822,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { ) } - Mock -CommandName New-SPAuthenticationProvider -MockWith { return @{} } - Mock -CommandName Get-SPTrustedIdentityTokenIssuer -MockWith { return @{} } + Mock -CommandName New-SPAuthenticationProvider -MockWith { return @{ } } + Mock -CommandName Get-SPTrustedIdentityTokenIssuer -MockWith { return @{ } } It "Should return null from the get method" { $result = Get-TargetResource @testParams @@ -844,38 +844,38 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Custom Zone of Web application is configured as specified" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Custom = @( + WebAppUrl = "http://sharepoint.contoso.com" + Custom = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "NTLM" - } -ClientOnly), + AuthenticationMethod = "NTLM" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "Federated" - AuthenticationProvider = "ADFS" - } -ClientOnly), + AuthenticationMethod = "Federated" + AuthenticationProvider = "ADFS" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "FBA" - MembershipProvider = "MemberProvider" - RoleProvider = "RoleProvider" - } -ClientOnly) + AuthenticationMethod = "FBA" + MembershipProvider = "MemberProvider" + RoleProvider = "RoleProvider" + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { return @{ IisSettings = @{ - Keys = "Default","Custom" + Keys = "Default", "Custom" } } } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @( @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $true }, @{ - DisplayName = "Forms Authentication" + DisplayName = "Forms Authentication" RoleProvider = "RoleProvider" MembershipProvider = "MemberProvider" }, @@ -899,46 +899,46 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Custom Zone of Web application is not configured as specified" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Custom = @( + WebAppUrl = "http://sharepoint.contoso.com" + Custom = @( (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "Kerberos" - } -ClientOnly), + AuthenticationMethod = "Kerberos" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "Federated" - AuthenticationProvider = "ADFS" - } -ClientOnly), + AuthenticationMethod = "Federated" + AuthenticationProvider = "ADFS" + } -ClientOnly), (New-CimInstance -ClassName MSFT_SPWebAppAuthenticationMode -Property @{ - AuthenticationMethod = "FBA" - MembershipProvider = "MemberProvider" - RoleProvider = "RoleProvider" - } -ClientOnly) + AuthenticationMethod = "FBA" + MembershipProvider = "MemberProvider" + RoleProvider = "RoleProvider" + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { return @{ IisSettings = @{ - Keys = "Default","Custom" + Keys = "Default", "Custom" } } } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @( @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $false }, @{ - DisplayName = "Forms Authentication" + DisplayName = "Forms Authentication" RoleProvider = "RoleProvider" MembershipProvider = "MemberProvider" } ) } - Mock -CommandName New-SPAuthenticationProvider -MockWith { return @{} } - Mock -CommandName Get-SPTrustedIdentityTokenIssuer -MockWith { return @{} } + Mock -CommandName New-SPAuthenticationProvider -MockWith { return @{ } } + Mock -CommandName Get-SPTrustedIdentityTokenIssuer -MockWith { return @{ } } It "Should return null from the get method" { $result = Get-TargetResource @testParams diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppBlockedFileTypes.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppBlockedFileTypes.Tests.ps1 index 94a38c803..332f0f692 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppBlockedFileTypes.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppBlockedFileTypes.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWebAppBlockedFileTypes" + -DscResource "SPWebAppBlockedFileTypes" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -26,7 +26,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ DisableKerberos = $true - AllowAnonymous = $false + AllowAnonymous = $false } } @@ -34,27 +34,27 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web appliation exists and a specific blocked file type list matches" -Fixture { $testParams = @{ WebAppUrl = "http://sites.sharepoint.com" - Blocked = @("exe", "dll", "ps1") + Blocked = @("exe", "dll", "ps1") } Mock -CommandName Get-SPWebapplication -MockWith { [Collections.Generic.List[String]]$CurrentBlockedFiles = @("exe", "ps1", "dll") $webApp = @{ - DisplayName = $testParams.Name - ApplicationPool = @{ - Name = $testParams.ApplicationPool + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool Username = $testParams.ApplicationPoolAccount } - ContentDatabases = @( + ContentDatabases = @( @{ - Name = "SP_Content_01" + Name = "SP_Content_01" Server = "sql.domain.local" } ) - IisSettings = @( + IisSettings = @( @{ Path = "C:\inetpub\wwwroot\something" } ) - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl BlockedFileExtensions = $CurrentBlockedFiles } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { @@ -75,27 +75,27 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web appliation exists and a specific blocked file type list does not match" -Fixture { $testParams = @{ WebAppUrl = "http://sites.sharepoint.com" - Blocked = @("exe", "dll", "ps1") + Blocked = @("exe", "dll", "ps1") } Mock -CommandName Get-SPWebapplication -MockWith { [Collections.Generic.List[String]]$CurrentBlockedFiles = @("exe", "pdf", "dll") $webApp = @{ - DisplayName = $testParams.Name - ApplicationPool = @{ - Name = $testParams.ApplicationPool + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool Username = $testParams.ApplicationPoolAccount } - ContentDatabases = @( + ContentDatabases = @( @{ - Name = "SP_Content_01" + Name = "SP_Content_01" Server = "sql.domain.local" } ) - IisSettings = @( + IisSettings = @( @{ Path = "C:\inetpub\wwwroot\something" } ) - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl BlockedFileExtensions = $CurrentBlockedFiles } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { @@ -121,7 +121,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web appliation exists and a list of types to include and exclude both match" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" EnsureBlocked = @("exe") EnsureAllowed = @("pdf") } @@ -129,21 +129,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPWebapplication -MockWith { [Collections.Generic.List[String]]$CurrentBlockedFiles = @("exe", "ps1", "dll") $webApp = @{ - DisplayName = $testParams.Name - ApplicationPool = @{ - Name = $testParams.ApplicationPool + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool Username = $testParams.ApplicationPoolAccount } - ContentDatabases = @( + ContentDatabases = @( @{ - Name = "SP_Content_01" + Name = "SP_Content_01" Server = "sql.domain.local" } ) - IisSettings = @( + IisSettings = @( @{ Path = "C:\inetpub\wwwroot\something" } ) - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl BlockedFileExtensions = $CurrentBlockedFiles } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { @@ -163,7 +163,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web appliation exists and a list of types to include and exclude both failed" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" EnsureBlocked = @("exe") EnsureAllowed = @("pdf") } @@ -171,21 +171,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPWebapplication -MockWith { [Collections.Generic.List[String]]$CurrentBlockedFiles = @("pdf", "dll") $webApp = @{ - DisplayName = $testParams.Name - ApplicationPool = @{ - Name = $testParams.ApplicationPool + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool Username = $testParams.ApplicationPoolAccount } - ContentDatabases = @( + ContentDatabases = @( @{ - Name = "SP_Content_01" + Name = "SP_Content_01" Server = "sql.domain.local" } ) - IisSettings = @( + IisSettings = @( @{ Path = "C:\inetpub\wwwroot\something" } ) - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl BlockedFileExtensions = $CurrentBlockedFiles } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { @@ -211,8 +211,8 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "All blocked file type parameters are passed to the methods" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - Blocked = @("exe", "dll", "ps1") + WebAppUrl = "http://sites.sharepoint.com" + Blocked = @("exe", "dll", "ps1") EnsureBlocked = @("exe", "dll") EnsureAllowed = @("ps1") } @@ -220,21 +220,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPWebapplication -MockWith { [Collections.Generic.List[String]]$CurrentBlockedFiles = @("pdf", "dll") $webApp = @{ - DisplayName = $testParams.Name - ApplicationPool = @{ - Name = $testParams.ApplicationPool + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool Username = $testParams.ApplicationPoolAccount } - ContentDatabases = @( + ContentDatabases = @( @{ - Name = "SP_Content_01" + Name = "SP_Content_01" Server = "sql.domain.local" } ) - IisSettings = @( + IisSettings = @( @{ Path = "C:\inetpub\wwwroot\something" } ) - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl BlockedFileExtensions = $CurrentBlockedFiles } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { @@ -260,21 +260,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPWebapplication -MockWith { [Collections.Generic.List[String]]$CurrentBlockedFiles = @("pdf", "dll") $webApp = @{ - DisplayName = $testParams.Name - ApplicationPool = @{ - Name = $testParams.ApplicationPool + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool Username = $testParams.ApplicationPoolAccount } - ContentDatabases = @( + ContentDatabases = @( @{ - Name = "SP_Content_01" + Name = "SP_Content_01" Server = "sql.domain.local" } ) - IisSettings = @( + IisSettings = @( @{ Path = "C:\inetpub\wwwroot\something" } ) - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl BlockedFileExtensions = $CurrentBlockedFiles } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppClientCallableSettings.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppClientCallableSettings.Tests.ps1 index 53848ff94..5d24a7435 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppClientCallableSettings.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppClientCallableSettings.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWebAppClientCallableSettings" + -DscResource "SPWebAppClientCallableSettings" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -42,21 +42,21 @@ namespace Microsoft.SharePoint.Administration { $webAppImplementation = { $clientCallableSettings = [PSCustomObject] @{ - ProxyLibraries = [System.Collections.ObjectModel.Collection[Microsoft.SharePoint.Administration.SPClientCallableProxyLibrary]]@() - MaxResourcesPerRequest = 16 - MaxObjectPaths = 256 - ExecutionTimeout = [System.TimeSpan]::FromMinutes(90); - RequestXmlMaxDepth = 32 - EnableXsdValidation = $true - EnableStackTrace = $false + ProxyLibraries = [System.Collections.ObjectModel.Collection[Microsoft.SharePoint.Administration.SPClientCallableProxyLibrary]]@() + MaxResourcesPerRequest = 16 + MaxObjectPaths = 256 + ExecutionTimeout = [System.TimeSpan]::FromMinutes(90); + RequestXmlMaxDepth = 32 + EnableXsdValidation = $true + EnableStackTrace = $false RequestUsageExecutionTimeThreshold = 800 - EnableRequestUsage = $true - LogActionsIfHasRequestException = $true + EnableRequestUsage = $true + LogActionsIfHasRequestException = $true } $webApp = @{ ClientCallableSettings = $clientCallableSettings - UpdateCalled = $false + UpdateCalled = $false } $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { @@ -68,24 +68,24 @@ namespace Microsoft.SharePoint.Administration { # Test contexts Context -Name "Client callable settings and a specific proxy library list matches current state" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - ProxyLibraries = @( + WebAppUrl = "http://sites.sharepoint.com" + ProxyLibraries = @( (New-CimInstance -ClassName "MSFT_SPProxyLibraryEntry" ` - -ClientOnly ` - -Property @{ - AssemblyName = "Assembly" - SupportAppAuthentication = $true - }) + -ClientOnly ` + -Property @{ + AssemblyName = "Assembly" + SupportAppAuthentication = $true + }) ) - MaxResourcesPerRequest = 16 - MaxObjectPaths = 256 - ExecutionTimeout = 90 - RequestXmlMaxDepth = 32 - EnableXsdValidation = $true - EnableStackTrace = $false + MaxResourcesPerRequest = 16 + MaxObjectPaths = 256 + ExecutionTimeout = 90 + RequestXmlMaxDepth = 32 + EnableXsdValidation = $true + EnableStackTrace = $false RequestUsageExecutionTimeThreshold = 800 - EnableRequestUsage = $true - LogActionsIfHasRequestException = $true + EnableRequestUsage = $true + LogActionsIfHasRequestException = $true } Mock -CommandName Get-SPWebapplication -MockWith { @@ -136,16 +136,16 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Client callable settings does not match the current state" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - MaxResourcesPerRequest = 8 - MaxObjectPaths = 128 - ExecutionTimeout = 45 - RequestXmlMaxDepth = 16 - EnableXsdValidation = $false - EnableStackTrace = $true + WebAppUrl = "http://sites.sharepoint.com" + MaxResourcesPerRequest = 8 + MaxObjectPaths = 128 + ExecutionTimeout = 45 + RequestXmlMaxDepth = 16 + EnableXsdValidation = $false + EnableStackTrace = $true RequestUsageExecutionTimeThreshold = 400 - EnableRequestUsage = $false - LogActionsIfHasRequestException = $false + EnableRequestUsage = $false + LogActionsIfHasRequestException = $false } Mock -CommandName Get-SPWebapplication -MockWith { @@ -200,14 +200,14 @@ namespace Microsoft.SharePoint.Administration { Context -Name "A proxy library does not match the current state" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" ProxyLibraries = @( (New-CimInstance -ClassName "MSFT_SPProxyLibraryEntry" ` - -ClientOnly ` - -Property @{ - AssemblyName = "Assembly" - SupportAppAuthentication = $true - }) + -ClientOnly ` + -Property @{ + AssemblyName = "Assembly" + SupportAppAuthentication = $true + }) ) } @@ -239,14 +239,14 @@ namespace Microsoft.SharePoint.Administration { Context -Name "A proxy library to include does not match the current state" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" ProxyLibrariesToInclude = @( (New-CimInstance -ClassName "MSFT_SPProxyLibraryEntry" ` - -ClientOnly ` - -Property @{ - AssemblyName = "Assembly" - SupportAppAuthentication = $true - }) + -ClientOnly ` + -Property @{ + AssemblyName = "Assembly" + SupportAppAuthentication = $true + }) ) } @@ -278,14 +278,14 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Proxy libraries does not match the current state" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" ProxyLibraries = @( (New-CimInstance -ClassName "MSFT_SPProxyLibraryEntry" ` - -ClientOnly ` - -Property @{ - AssemblyName = "NewAssembly" - SupportAppAuthentication = $true - }) + -ClientOnly ` + -Property @{ + AssemblyName = "NewAssembly" + SupportAppAuthentication = $true + }) ) } @@ -317,20 +317,20 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Multiple proxy libraries matches the current state" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" ProxyLibraries = @( (New-CimInstance -ClassName "MSFT_SPProxyLibraryEntry" ` - -ClientOnly ` - -Property @{ - AssemblyName = "Assembly1" - SupportAppAuthentication = $true - }), + -ClientOnly ` + -Property @{ + AssemblyName = "Assembly1" + SupportAppAuthentication = $true + }), (New-CimInstance -ClassName "MSFT_SPProxyLibraryEntry" ` - -ClientOnly ` - -Property @{ - AssemblyName = "Assembly2" - SupportAppAuthentication = $true - }) + -ClientOnly ` + -Property @{ + AssemblyName = "Assembly2" + SupportAppAuthentication = $true + }) ) } @@ -368,14 +368,14 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Proxy libraries to include does not match the current state" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" ProxyLibrariesToInclude = @( (New-CimInstance -ClassName "MSFT_SPProxyLibraryEntry" ` - -ClientOnly ` - -Property @{ - AssemblyName = "NewAssembly" - SupportAppAuthentication = $true - }) + -ClientOnly ` + -Property @{ + AssemblyName = "NewAssembly" + SupportAppAuthentication = $true + }) ) } @@ -409,14 +409,14 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Proxy library to include matches the current state" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" ProxyLibrariesToInclude = @( (New-CimInstance -ClassName "MSFT_SPProxyLibraryEntry" ` - -ClientOnly ` - -Property @{ - AssemblyName = "Assembly" - SupportAppAuthentication = $true - }) + -ClientOnly ` + -Property @{ + AssemblyName = "Assembly" + SupportAppAuthentication = $true + }) ) } @@ -448,7 +448,7 @@ namespace Microsoft.SharePoint.Administration { Context -Name "A proxy library to exclude does not match the current state" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" ProxyLibrariesToExclude = @("Assembly") } @@ -485,7 +485,7 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Proxy library to exclude matches the current state" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" ProxyLibrariesToExclude = @("Assembly") } @@ -517,14 +517,14 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Proxy libraries does not match the current state of empty proxy libraries" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" ProxyLibraries = @( (New-CimInstance -ClassName "MSFT_SPProxyLibraryEntry" ` - -ClientOnly ` - -Property @{ - AssemblyName = "Assembly" - SupportAppAuthentication = $true - }) + -ClientOnly ` + -Property @{ + AssemblyName = "Assembly" + SupportAppAuthentication = $true + }) ) } @@ -541,7 +541,7 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Empty proxy libraries matches the current state of empty proxy libraries" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" ProxyLibraries = @() } @@ -558,7 +558,7 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Empty proxy libraries does not match the current state" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" ProxyLibraries = @() } @@ -588,14 +588,14 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Proxy libraries to include does not match the current state of empty proxy libraries" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" ProxyLibrariesToInclude = @( (New-CimInstance -ClassName "MSFT_SPProxyLibraryEntry" ` - -ClientOnly ` - -Property @{ - AssemblyName = "Assembly" - SupportAppAuthentication = $true - }) + -ClientOnly ` + -Property @{ + AssemblyName = "Assembly" + SupportAppAuthentication = $true + }) ) } @@ -612,7 +612,7 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Proxy libraries to exclude matches the current state of empty proxy libraries" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" ProxyLibrariesToExclude = @("Assembly") } @@ -629,22 +629,22 @@ namespace Microsoft.SharePoint.Administration { Context -Name "ProxyLibraries and ProxyLibrariesToInclude properties are provided" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - ProxyLibraries = @( + WebAppUrl = "http://sites.sharepoint.com" + ProxyLibraries = @( (New-CimInstance -ClassName "MSFT_SPProxyLibraryEntry" ` - -ClientOnly ` - -Property @{ - AssemblyName = "Assembly" - SupportAppAuthentication = $true - }) + -ClientOnly ` + -Property @{ + AssemblyName = "Assembly" + SupportAppAuthentication = $true + }) ) ProxyLibrariesToInclude = @( (New-CimInstance -ClassName "MSFT_SPProxyLibraryEntry" ` - -ClientOnly ` - -Property @{ - AssemblyName = "Assembly" - SupportAppAuthentication = $true - }) + -ClientOnly ` + -Property @{ + AssemblyName = "Assembly" + SupportAppAuthentication = $true + }) ) } @@ -667,14 +667,14 @@ namespace Microsoft.SharePoint.Administration { Context -Name "ProxyLibraries and ProxyLibrariesToExclude properties are provided" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - ProxyLibraries = @( + WebAppUrl = "http://sites.sharepoint.com" + ProxyLibraries = @( (New-CimInstance -ClassName "MSFT_SPProxyLibraryEntry" ` - -ClientOnly ` - -Property @{ - AssemblyName = "Assembly" - SupportAppAuthentication = $true - }) + -ClientOnly ` + -Property @{ + AssemblyName = "Assembly" + SupportAppAuthentication = $true + }) ) ProxyLibrariesToExclude = @("Assembly") } @@ -698,22 +698,22 @@ namespace Microsoft.SharePoint.Administration { Context -Name "All of the proxy libraries properties are provided" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - ProxyLibraries = @( + WebAppUrl = "http://sites.sharepoint.com" + ProxyLibraries = @( (New-CimInstance -ClassName "MSFT_SPProxyLibraryEntry" ` - -ClientOnly ` - -Property @{ - AssemblyName = "Assembly" - SupportAppAuthentication = $true - }) + -ClientOnly ` + -Property @{ + AssemblyName = "Assembly" + SupportAppAuthentication = $true + }) ) ProxyLibrariesToInclude = @( (New-CimInstance -ClassName "MSFT_SPProxyLibraryEntry" ` - -ClientOnly ` - -Property @{ - AssemblyName = "Assembly" - SupportAppAuthentication = $true - }) + -ClientOnly ` + -Property @{ + AssemblyName = "Assembly" + SupportAppAuthentication = $true + }) ) ProxyLibrariesToExclude = @("Assembly") } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppGeneralSettings.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppGeneralSettings.Tests.ps1 index 03f602e0b..56505a704 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppGeneralSettings.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppGeneralSettings.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWebAppGeneralSettings" + -DscResource "SPWebAppGeneralSettings" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -26,71 +26,71 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ DisableKerberos = $true - AllowAnonymous = $false + AllowAnonymous = $false } } # Test contexts Context -Name "The web application exists and has the correct general settings" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - TimeZone = 3081 - Alerts = $true - AlertsLimit = 10 - RSS = $true - BlogAPI = $true - BlogAPIAuthenticated = $true - BrowserFileHandling = "Permissive" - SecurityValidation = $true - SecurityValidationExpires = $true + WebAppUrl = "http://sites.sharepoint.com" + TimeZone = 3081 + Alerts = $true + AlertsLimit = 10 + RSS = $true + BlogAPI = $true + BlogAPIAuthenticated = $true + BrowserFileHandling = "Permissive" + SecurityValidation = $true + SecurityValidationExpires = $true SecurityValidationTimeoutMinutes = 10 - RecycleBinEnabled = $true - RecycleBinCleanupEnabled = $true - RecycleBinRetentionPeriod = 30 - SecondStageRecycleBinQuota = 30 - MaximumUploadSize = 100 - CustomerExperienceProgram = $true - PresenceEnabled = $true - DefaultQuotaTemplate = "Project" + RecycleBinEnabled = $true + RecycleBinCleanupEnabled = $true + RecycleBinRetentionPeriod = 30 + SecondStageRecycleBinQuota = 30 + MaximumUploadSize = 100 + CustomerExperienceProgram = $true + PresenceEnabled = $true + DefaultQuotaTemplate = "Project" } Mock -CommandName Get-SPWebapplication -MockWith { $webApp = @{ - DisplayName = $testParams.Name - ApplicationPool = @{ - Name = $testParams.ApplicationPool + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool Username = $testParams.ApplicationPoolAccount } - ContentDatabases = @( + ContentDatabases = @( @{ - Name = "SP_Content_01" + Name = "SP_Content_01" Server = "sql.domain.local" } ) - IisSettings = @( + IisSettings = @( @{ Path = "C:\inetpub\wwwroot\something" } ) - Url = $testParams.WebAppUrl - DefaultTimeZone = $testParams.TimeZone - AlertsEnabled = $testParams.Alerts - AlertsMaximum = $testParams.AlertsLimit - SyndicationEnabled = $testParams.RSS - MetaWeblogEnabled = $testParams.BlogAPI + Url = $testParams.WebAppUrl + DefaultTimeZone = $testParams.TimeZone + AlertsEnabled = $testParams.Alerts + AlertsMaximum = $testParams.AlertsLimit + SyndicationEnabled = $testParams.RSS + MetaWeblogEnabled = $testParams.BlogAPI MetaWeblogAuthenticationEnabled = $testParams.BlogAPIAuthenticated - BrowserFileHandling = $testParams.BrowserFileHandling - FormDigestSettings = @{ + BrowserFileHandling = $testParams.BrowserFileHandling + FormDigestSettings = @{ Enabled = $testParams.SecurityValidation Expires = $testParams.SecurityValidationExpires Timeout = (new-timespan -minutes $testParams.SecurityValidationTimeoutMinutes) } - RecycleBinEnabled = $testParams.RecycleBinEnabled - RecycleBinCleanupEnabled = $testParams.RecycleBinCleanupEnabled - RecycleBinRetentionPeriod = $testParams.RecycleBinRetentionPeriod - SecondStageRecycleBinQuota = $testParams.SecondStageRecycleBinQuota - MaximumFileSize = $testParams.MaximumUploadSize - BrowserCEIPEnabled = $testParams.CustomerExperienceProgram - PresenceEnabled = $testParams.PresenceEnabled - DefaultQuotaTemplate = $testParams.DefaultQuotaTemplate + RecycleBinEnabled = $testParams.RecycleBinEnabled + RecycleBinCleanupEnabled = $testParams.RecycleBinCleanupEnabled + RecycleBinRetentionPeriod = $testParams.RecycleBinRetentionPeriod + SecondStageRecycleBinQuota = $testParams.SecondStageRecycleBinQuota + MaximumFileSize = $testParams.MaximumUploadSize + BrowserCEIPEnabled = $testParams.CustomerExperienceProgram + PresenceEnabled = $testParams.PresenceEnabled + DefaultQuotaTemplate = $testParams.DefaultQuotaTemplate } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true @@ -109,33 +109,33 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web application exists and uses incorrect general settings" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - TimeZone = 3081 - Alerts = $true - AlertsLimit = 10 - RSS = $true - BlogAPI = $true - BlogAPIAuthenticated = $true - BrowserFileHandling = "Permissive" - SecurityValidation = $true - SecurityValidationExpires = $true + WebAppUrl = "http://sites.sharepoint.com" + TimeZone = 3081 + Alerts = $true + AlertsLimit = 10 + RSS = $true + BlogAPI = $true + BlogAPIAuthenticated = $true + BrowserFileHandling = "Permissive" + SecurityValidation = $true + SecurityValidationExpires = $true SecurityValidationTimeoutMinutes = 10 - RecycleBinEnabled = $true - RecycleBinCleanupEnabled = $true - RecycleBinRetentionPeriod = 30 - SecondStageRecycleBinQuota = 30 - MaximumUploadSize = 100 - CustomerExperienceProgram = $true - PresenceEnabled = $true - DefaultQuotaTemplate = "Project" + RecycleBinEnabled = $true + RecycleBinCleanupEnabled = $true + RecycleBinRetentionPeriod = 30 + SecondStageRecycleBinQuota = 30 + MaximumUploadSize = 100 + CustomerExperienceProgram = $true + PresenceEnabled = $true + DefaultQuotaTemplate = "Project" } Mock -CommandName Get-SPDscContentService -MockWith { $returnVal = @{ QuotaTemplates = @{ Project = @{ - StorageMaximumLevel = 1073741824 - StorageWarningLevel = 536870912 + StorageMaximumLevel = 1073741824 + StorageWarningLevel = 536870912 UserCodeMaximumLevel = 1000 UserCodeWarningLevel = 800 } @@ -146,38 +146,38 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPWebapplication -MockWith { $webApp = @{ - DisplayName = $testParams.Name - ApplicationPool = @{ - Name = $testParams.ApplicationPool + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool Username = $testParams.ApplicationPoolAccount } - ContentDatabases = @( + ContentDatabases = @( @{ - Name = "SP_Content_01" + Name = "SP_Content_01" Server = "sql.domain.local" } ) - IisSettings = @( + IisSettings = @( @{ Path = "C:\inetpub\wwwroot\something" } ) - Url = $testParams.WebAppUrl - DefaultTimeZone = 1 - AlertsEnabled = $false - AlertsMaximum = 1 - SyndicationEnabled = $false - MetaWeblogEnabled = $false + Url = $testParams.WebAppUrl + DefaultTimeZone = 1 + AlertsEnabled = $false + AlertsMaximum = 1 + SyndicationEnabled = $false + MetaWeblogEnabled = $false MetaWeblogAuthenticationEnabled = $false - BrowserFileHandling = "Strict" - FormDigestSettings = @{ + BrowserFileHandling = "Strict" + FormDigestSettings = @{ Enabled = $false } - RecycleBinEnabled = $false - RecycleBinCleanupEnabled = $false - RecycleBinRetentionPeriod = 1 - SecondStageRecycleBinQuota = 1 - MaximumFileSize = 1 - BrowserCEIPEnabled = $false - PresenceEnabled = $false + RecycleBinEnabled = $false + RecycleBinCleanupEnabled = $false + RecycleBinRetentionPeriod = 1 + SecondStageRecycleBinQuota = 1 + MaximumFileSize = 1 + BrowserCEIPEnabled = $false + PresenceEnabled = $false } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true @@ -202,25 +202,25 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The specified web application does not exist" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - TimeZone = 3081 - Alerts = $true - AlertsLimit = 10 - RSS = $true - BlogAPI = $true - BlogAPIAuthenticated = $true - BrowserFileHandling = "Permissive" - SecurityValidation = $true - SecurityValidationExpires = $true + WebAppUrl = "http://sites.sharepoint.com" + TimeZone = 3081 + Alerts = $true + AlertsLimit = 10 + RSS = $true + BlogAPI = $true + BlogAPIAuthenticated = $true + BrowserFileHandling = "Permissive" + SecurityValidation = $true + SecurityValidationExpires = $true SecurityValidationTimeoutMinutes = 10 - RecycleBinEnabled = $true - RecycleBinCleanupEnabled = $true - RecycleBinRetentionPeriod = 30 - SecondStageRecycleBinQuota = 30 - MaximumUploadSize = 100 - CustomerExperienceProgram = $true - PresenceEnabled = $true - DefaultQuotaTemplate = "NotExist" + RecycleBinEnabled = $true + RecycleBinCleanupEnabled = $true + RecycleBinRetentionPeriod = 30 + SecondStageRecycleBinQuota = 30 + MaximumUploadSize = 100 + CustomerExperienceProgram = $true + PresenceEnabled = $true + DefaultQuotaTemplate = "NotExist" } Mock -CommandName Get-SPWebapplication -MockWith { @@ -238,33 +238,33 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The specified Quota Template does not exist" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - TimeZone = 3081 - Alerts = $true - AlertsLimit = 10 - RSS = $true - BlogAPI = $true - BlogAPIAuthenticated = $true - BrowserFileHandling = "Permissive" - SecurityValidation = $true - SecurityValidationExpires = $true + WebAppUrl = "http://sites.sharepoint.com" + TimeZone = 3081 + Alerts = $true + AlertsLimit = 10 + RSS = $true + BlogAPI = $true + BlogAPIAuthenticated = $true + BrowserFileHandling = "Permissive" + SecurityValidation = $true + SecurityValidationExpires = $true SecurityValidationTimeoutMinutes = 10 - RecycleBinEnabled = $true - RecycleBinCleanupEnabled = $true - RecycleBinRetentionPeriod = 30 - SecondStageRecycleBinQuota = 30 - MaximumUploadSize = 100 - CustomerExperienceProgram = $true - PresenceEnabled = $true - DefaultQuotaTemplate = "NotExist" + RecycleBinEnabled = $true + RecycleBinCleanupEnabled = $true + RecycleBinRetentionPeriod = 30 + SecondStageRecycleBinQuota = 30 + MaximumUploadSize = 100 + CustomerExperienceProgram = $true + PresenceEnabled = $true + DefaultQuotaTemplate = "NotExist" } Mock -CommandName Get-SPDscContentService -MockWith { $returnVal = @{ QuotaTemplates = @{ Project = @{ - StorageMaximumLevel = 1073741824 - StorageWarningLevel = 536870912 + StorageMaximumLevel = 1073741824 + StorageWarningLevel = 536870912 UserCodeMaximumLevel = 1000 UserCodeWarningLevel = 800 } @@ -275,38 +275,38 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPWebapplication -MockWith { $webApp = @{ - DisplayName = $testParams.Name - ApplicationPool = @{ - Name = $testParams.ApplicationPool + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool Username = $testParams.ApplicationPoolAccount } - ContentDatabases = @( + ContentDatabases = @( @{ - Name = "SP_Content_01" + Name = "SP_Content_01" Server = "sql.domain.local" } ) - IisSettings = @( + IisSettings = @( @{ Path = "C:\inetpub\wwwroot\something" } ) - Url = $testParams.WebAppUrl - DefaultTimeZone = 1 - AlertsEnabled = $false - AlertsMaximum = 1 - SyndicationEnabled = $false - MetaWeblogEnabled = $false + Url = $testParams.WebAppUrl + DefaultTimeZone = 1 + AlertsEnabled = $false + AlertsMaximum = 1 + SyndicationEnabled = $false + MetaWeblogEnabled = $false MetaWeblogAuthenticationEnabled = $false - BrowserFileHandling = "Strict" - FormDigestSettings = @{ + BrowserFileHandling = "Strict" + FormDigestSettings = @{ Enabled = $false } - RecycleBinEnabled = $false - RecycleBinCleanupEnabled = $false - RecycleBinRetentionPeriod = 1 - SecondStageRecycleBinQuota = 1 - MaximumFileSize = 1 - BrowserCEIPEnabled = $false - PresenceEnabled = $false + RecycleBinEnabled = $false + RecycleBinCleanupEnabled = $false + RecycleBinRetentionPeriod = 1 + SecondStageRecycleBinQuota = 1 + MaximumFileSize = 1 + BrowserCEIPEnabled = $false + PresenceEnabled = $false } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppPeoplePickerSettings.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppPeoplePickerSettings.Tests.ps1 index d69f0d58f..79380e80b 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppPeoplePickerSettings.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppPeoplePickerSettings.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWebAppPeoplePickerSettings" + -DscResource "SPWebAppPeoplePickerSettings" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -21,10 +21,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Initialize tests $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force $mockAccount = New-Object -TypeName "System.Management.Automation.PSCredential" ` - -ArgumentList @("username", $mockPassword) + -ArgumentList @("username", $mockPassword) - try { [Microsoft.SharePoint.Administration.SPPeoplePickerSearchActiveDirectoryDomain] } - catch { + try + { [Microsoft.SharePoint.Administration.SPPeoplePickerSearchActiveDirectoryDomain] + } + catch + { Add-Type -TypeDefinition @" namespace Microsoft.SharePoint.Administration { public class SPPeoplePickerSearchActiveDirectoryDomain { @@ -45,7 +48,7 @@ namespace Microsoft.SharePoint.Administration { # Test contexts Context -Name "The web application doesn't exist" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" + WebAppUrl = "http://sharepoint.contoso.com" ActiveDirectoryCustomFilter = $null ActiveDirectoryCustomQuery = $null ActiveDirectorySearchTimeout = 30 @@ -56,7 +59,7 @@ namespace Microsoft.SharePoint.Administration { Mock -CommandName Get-SPWebApplication -MockWith { return $null } It "Should return null for all properties from the get method" { - (Get-TargetResource @testParams).OnlySearchWithinSiteCollection | Should BeNullOrEmpty + (Get-TargetResource @testParams).OnlySearchWithinSiteCollection | Should BeNullOrEmpty } It "Should return false from the test method" { @@ -70,34 +73,34 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Search domain settings do not match actual values" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - SearchActiveDirectoryDomains = @( + WebAppUrl = "http://sharepoint.contoso.com" + SearchActiveDirectoryDomains = @( (New-CimInstance -ClassName MSFT_SPWebAppPPSearchDomain -Property @{ - FQDN = "contoso.intra" - IsForest = $false - AccessAccount = (New-CimInstance -ClassName MSFT_Credential ` - -Property @{ - Username=[string]$mockAccount.UserName; - Password=[string]$mockAccount.Password; - } ` - -Namespace root/microsoft/windows/desiredstateconfiguration ` - -ClientOnly) - } -ClientOnly) + FQDN = "contoso.intra" + IsForest = $false + AccessAccount = (New-CimInstance -ClassName MSFT_Credential ` + -Property @{ + Username = [string]$mockAccount.UserName; + Password = [string]$mockAccount.Password; + } ` + -Namespace root/microsoft/windows/desiredstateconfiguration ` + -ClientOnly) + } -ClientOnly) ) } Mock -CommandName Get-SPWebApplication -MockWith { - $searchADdom = New-Object -TypeName "System.Collections.Generic.List[System.Object]" + $searchADdom = New-Object -TypeName "System.Collections.Generic.List[System.Object]" $searchDom1 = New-Object -TypeName "Object" | ` - Add-Member -MemberType NoteProperty ` - -Name DomainName ` - -Value ( "contosonew.intra" ) -PassThru | ` - Add-Member -MemberType NoteProperty ` - -Name IsForest ` - -Value ( $false ) -PassThru | ` - Add-Member -MemberType NoteProperty ` - -Name LoginName ` - -Value ( $mockAccount.UserName ) -PassThru + Add-Member -MemberType NoteProperty ` + -Name DomainName ` + -Value ( "contosonew.intra" ) -PassThru | ` + Add-Member -MemberType NoteProperty ` + -Name IsForest ` + -Value ( $false ) -PassThru | ` + Add-Member -MemberType NoteProperty ` + -Name LoginName ` + -Value ( $mockAccount.UserName ) -PassThru $searchADdom.Add($searchDom1) $returnval = @{ @@ -135,7 +138,7 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Settings do not match actual values" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" + WebAppUrl = "http://sharepoint.contoso.com" ActiveDirectoryCustomFilter = $null ActiveDirectoryCustomQuery = $null ActiveDirectorySearchTimeout = 30 @@ -143,17 +146,17 @@ namespace Microsoft.SharePoint.Administration { } Mock -CommandName Get-SPWebApplication -MockWith { - $searchADdom = New-Object -TypeName "System.Collections.Generic.List[System.Object]" + $searchADdom = New-Object -TypeName "System.Collections.Generic.List[System.Object]" $searchDom1 = New-Object -TypeName "Object" | ` - Add-Member -MemberType NoteProperty ` - -Name DomainName ` - -Value ( "contoso.intra" ) -PassThru | ` - Add-Member -MemberType NoteProperty ` - -Name IsForest ` - -Value ( $false ) -PassThru | ` - Add-Member -MemberType NoteProperty ` - -Name LoginName ` - -Value ( $mockAccount.UserName ) -PassThru + Add-Member -MemberType NoteProperty ` + -Name DomainName ` + -Value ( "contoso.intra" ) -PassThru | ` + Add-Member -MemberType NoteProperty ` + -Name IsForest ` + -Value ( $false ) -PassThru | ` + Add-Member -MemberType NoteProperty ` + -Name LoginName ` + -Value ( $mockAccount.UserName ) -PassThru $searchADdom.Add($searchDom1) $returnval = @{ @@ -191,34 +194,34 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Search domain settings match actual values" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - SearchActiveDirectoryDomains = @( + WebAppUrl = "http://sharepoint.contoso.com" + SearchActiveDirectoryDomains = @( (New-CimInstance -ClassName MSFT_SPWebAppPPSearchDomain -Property @{ - FQDN = "contoso.intra" - IsForest = $false - AccessAccount = (New-CimInstance -ClassName MSFT_Credential ` - -Property @{ - Username=[string]$mockAccount.UserName; - Password=[string]$mockAccount.Password; - } ` - -Namespace root/microsoft/windows/desiredstateconfiguration ` - -ClientOnly) - } -ClientOnly) + FQDN = "contoso.intra" + IsForest = $false + AccessAccount = (New-CimInstance -ClassName MSFT_Credential ` + -Property @{ + Username = [string]$mockAccount.UserName; + Password = [string]$mockAccount.Password; + } ` + -Namespace root/microsoft/windows/desiredstateconfiguration ` + -ClientOnly) + } -ClientOnly) ) } Mock -CommandName Get-SPWebApplication -MockWith { - $searchADdom = New-Object -TypeName "System.Collections.Generic.List[System.Object]" + $searchADdom = New-Object -TypeName "System.Collections.Generic.List[System.Object]" $searchDom1 = New-Object -TypeName "Object" | ` - Add-Member -MemberType NoteProperty ` - -Name DomainName ` - -Value ( "contoso.intra" ) -PassThru | ` - Add-Member -MemberType NoteProperty ` - -Name IsForest ` - -Value ( $false ) -PassThru | ` - Add-Member -MemberType NoteProperty ` - -Name LoginName ` - -Value ( $mockAccount.UserName ) -PassThru + Add-Member -MemberType NoteProperty ` + -Name DomainName ` + -Value ( "contoso.intra" ) -PassThru | ` + Add-Member -MemberType NoteProperty ` + -Name IsForest ` + -Value ( $false ) -PassThru | ` + Add-Member -MemberType NoteProperty ` + -Name LoginName ` + -Value ( $mockAccount.UserName ) -PassThru $searchADdom.Add($searchDom1) $returnval = @{ @@ -251,7 +254,7 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Settings match actual values" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" + WebAppUrl = "http://sharepoint.contoso.com" ActiveDirectoryCustomFilter = $null ActiveDirectoryCustomQuery = $null ActiveDirectorySearchTimeout = 30 diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppPermissions.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppPermissions.Tests.ps1 index ba9e36c87..827aec43b 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppPermissions.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppPermissions.Tests.ps1 @@ -1,40 +1,43 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWebAppPermissions" + -DscResource "SPWebAppPermissions" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope # Initialize tests - try { [Microsoft.SharePoint.SPBasePermissions] } - catch { + try + { [Microsoft.SharePoint.SPBasePermissions] + } + catch + { Add-Type -TypeDefinition @" namespace Microsoft.SharePoint { - public enum SPBasePermissions { - FullMask, EmptyMask, ManageLists, CancelCheckout, AddListItems, EditListItems, DeleteListItems, - ViewListItems, ApproveItems, OpenItems, ViewVersions, DeleteVersions, CreateAlerts, - ViewFormPages, ManagePermissions, ViewUsageData, ManageSubwebs, ManageWeb, AddAndCustomizePages, - ApplyThemeAndBorder, ApplyStyleSheets, CreateGroups, BrowseDirectories,CreateSSCSite, ViewPages, - EnumeratePermissions, BrowseUserInfo, ManageAlerts, UseRemoteAPIs, UseClientIntegration, Open, + public enum SPBasePermissions { + FullMask, EmptyMask, ManageLists, CancelCheckout, AddListItems, EditListItems, DeleteListItems, + ViewListItems, ApproveItems, OpenItems, ViewVersions, DeleteVersions, CreateAlerts, + ViewFormPages, ManagePermissions, ViewUsageData, ManageSubwebs, ManageWeb, AddAndCustomizePages, + ApplyThemeAndBorder, ApplyStyleSheets, CreateGroups, BrowseDirectories,CreateSSCSite, ViewPages, + EnumeratePermissions, BrowseUserInfo, ManageAlerts, UseRemoteAPIs, UseClientIntegration, Open, EditMyUserInfo, ManagePersonalViews, AddDelPrivateWebParts, UpdatePersonalWebParts }; } "@ } - # Mocks for all contexts + # Mocks for all contexts # Test contexts Context -Name "The web application doesn't exist" -Fixture { @@ -60,23 +63,23 @@ namespace Microsoft.SharePoint { Context -Name "AllPermissions specified together with one of the other parameters" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - AllPermissions = $true - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","View Items","Approve Items", - "Open Items","View Versions","Delete Versions", - "Create Alerts","View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Add and Customize Pages","Apply Themes and Borders", - "Apply Style Sheets","Create Groups","Browse Directories", - "Use Self-Service Site Creation","View Pages", - "Enumerate Permissions","Browse User Information", - "Manage Alerts","Use Remote Interfaces", - "Use Client Integration Features","Open", - "Edit Personal User Information") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + WebAppUrl = "http://sharepoint.contoso.com" + AllPermissions = $true + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "View Items", "Approve Items", + "Open Items", "View Versions", "Delete Versions", + "Create Alerts", "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", + "Enumerate Permissions", "Browse User Information", + "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", "Open", + "Edit Personal User Information") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { return $null } @@ -101,51 +104,51 @@ namespace Microsoft.SharePoint { Context -Name "Not all three parameters specified" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","View Items","Approve Items", - "Open Items","View Versions","Delete Versions", - "Create Alerts","View Application Pages") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + WebAppUrl = "http://sharepoint.contoso.com" + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "View Items", "Approve Items", + "Open Items", "View Versions", "Delete Versions", + "Create Alerts", "View Application Pages") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { return $null } It "Should return exception from the get method" { { Get-TargetResource @testParams } | Should throw ("One of the parameters " + ` - "ListPermissions, SitePermissions or PersonalPermissions is missing") + "ListPermissions, SitePermissions or PersonalPermissions is missing") } It "Should return exception from the test method" { { Test-TargetResource @testParams } | Should throw ("One of the parameters " + ` - "ListPermissions, SitePermissions or PersonalPermissions is missing") + "ListPermissions, SitePermissions or PersonalPermissions is missing") } It "Should return exception from the set method" { { Set-TargetResource @testParams } | Should throw ("One of the parameters " + ` - "ListPermissions, SitePermissions or PersonalPermissions is missing") + "ListPermissions, SitePermissions or PersonalPermissions is missing") } } Context -Name "Approve items without Edit Items" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Delete Items","View Items","Approve Items","Open Items", - "View Versions","Delete Versions","Create Alerts", - "View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Add and Customize Pages","Apply Themes and Borders", - "Apply Style Sheets","Create Groups","Browse Directories", - "Use Self-Service Site Creation","View Pages", - "Enumerate Permissions","Browse User Information", - "Manage Alerts","Use Remote Interfaces", - "Use Client Integration Features","Open", - "Edit Personal User Information") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + WebAppUrl = "http://sharepoint.contoso.com" + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Delete Items", "View Items", "Approve Items", "Open Items", + "View Versions", "Delete Versions", "Create Alerts", + "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", + "Enumerate Permissions", "Browse User Information", + "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", "Open", + "Edit Personal User Information") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { return $null } @@ -165,22 +168,22 @@ namespace Microsoft.SharePoint { Context -Name "View Items missing for various other parameters" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","Approve Items","Open Items", - "View Versions","Delete Versions","Create Alerts", - "View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Add and Customize Pages","Apply Themes and Borders", - "Apply Style Sheets","Create Groups","Browse Directories", - "Use Self-Service Site Creation","View Pages", - "Enumerate Permissions","Browse User Information", - "Manage Alerts","Use Remote Interfaces", - "Use Client Integration Features","Open", - "Edit Personal User Information") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + WebAppUrl = "http://sharepoint.contoso.com" + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "Approve Items", "Open Items", + "View Versions", "Delete Versions", "Create Alerts", + "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", + "Enumerate Permissions", "Browse User Information", + "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", "Open", + "Edit Personal User Information") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { return $null } @@ -218,98 +221,98 @@ namespace Microsoft.SharePoint { Context -Name "View Versions or Manage Permissions without Open Items" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","View Items", - "Approve Items","View Versions","Delete Versions", - "Create Alerts","View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Add and Customize Pages","Apply Themes and Borders", - "Apply Style Sheets","Create Groups","Browse Directories", - "Use Self-Service Site Creation","View Pages", - "Enumerate Permissions","Browse User Information", - "Manage Alerts","Use Remote Interfaces", - "Use Client Integration Features","Open", - "Edit Personal User Information") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + WebAppUrl = "http://sharepoint.contoso.com" + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "View Items", + "Approve Items", "View Versions", "Delete Versions", + "Create Alerts", "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", + "Enumerate Permissions", "Browse User Information", + "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", "Open", + "Edit Personal User Information") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { return $null } It "Should return exception from the get method" { { Get-TargetResource @testParams } | Should throw ("Open Items is required when " + ` - "specifying View Versions or Manage Permissions") + "specifying View Versions or Manage Permissions") } It "Should return exception from the test method" { { Test-TargetResource @testParams } | Should throw ("Open Items is required when " + ` - "specifying View Versions or Manage Permissions") + "specifying View Versions or Manage Permissions") } It "Should return exception from the set method" { { Set-TargetResource @testParams } | Should throw ("Open Items is required when " + ` - "specifying View Versions or Manage Permissions") + "specifying View Versions or Manage Permissions") } } Context -Name "Delete Versions or Manage Permissions without View Versions" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","View Items", - "Approve Items","Open Items","Delete Versions", - "Create Alerts","View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Add and Customize Pages","Apply Themes and Borders", - "Apply Style Sheets","Create Groups","Browse Directories", - "Use Self-Service Site Creation","View Pages", - "Enumerate Permissions","Browse User Information", - "Manage Alerts","Use Remote Interfaces", - "Use Client Integration Features","Open", - "Edit Personal User Information") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + WebAppUrl = "http://sharepoint.contoso.com" + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "View Items", + "Approve Items", "Open Items", "Delete Versions", + "Create Alerts", "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", + "Enumerate Permissions", "Browse User Information", + "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", "Open", + "Edit Personal User Information") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { return $null } It "Should return exception from the get method" { { Get-TargetResource @testParams } | Should throw ("View Versions is required " + ` - "when specifying Delete Versions or Manage Permissions") + "when specifying Delete Versions or Manage Permissions") } It "Should return exception from the test method" { { Test-TargetResource @testParams } | Should throw ("View Versions is required " + ` - "when specifying Delete Versions or Manage Permissions") + "when specifying Delete Versions or Manage Permissions") } It "Should return exception from the set method" { { Set-TargetResource @testParams } | Should throw ("View Versions is required " + ` - "when specifying Delete Versions or Manage Permissions") + "when specifying Delete Versions or Manage Permissions") } } - + Context -Name "Manage Alerts without Create Alerts" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","View Items","Approve Items", - "Open Items","View Versions","Delete Versions", - "View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Add and Customize Pages","Apply Themes and Borders", - "Apply Style Sheets","Create Groups","Browse Directories", - "Use Self-Service Site Creation","View Pages", - "Enumerate Permissions","Browse User Information", - "Manage Alerts","Use Remote Interfaces", - "Use Client Integration Features","Open", - "Edit Personal User Information") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + WebAppUrl = "http://sharepoint.contoso.com" + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "View Items", "Approve Items", + "Open Items", "View Versions", "Delete Versions", + "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", + "Enumerate Permissions", "Browse User Information", + "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", "Open", + "Edit Personal User Information") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { return $null } @@ -329,22 +332,22 @@ namespace Microsoft.SharePoint { Context -Name "Manage Web Site without Add and Customize Pages" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","View Items","Approve Items", - "Open Items","View Versions","Delete Versions", - "Create Alerts","View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Apply Themes and Borders","Apply Style Sheets", - "Create Groups","Browse Directories", - "Use Self-Service Site Creation","View Pages", - "Enumerate Permissions","Browse User Information", - "Manage Alerts","Use Remote Interfaces", - "Use Client Integration Features","Open", - "Edit Personal User Information") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + WebAppUrl = "http://sharepoint.contoso.com" + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "View Items", "Approve Items", + "Open Items", "View Versions", "Delete Versions", + "Create Alerts", "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Apply Themes and Borders", "Apply Style Sheets", + "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", + "Enumerate Permissions", "Browse User Information", + "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", "Open", + "Edit Personal User Information") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { return $null } @@ -363,118 +366,118 @@ namespace Microsoft.SharePoint { Context -Name "Manage Permissions, Manage Web Site, Add and Customize Pages or Enumerate Permissions without Browse Directories" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","View Items","Approve Items", - "Open Items","View Versions","Delete Versions", - "Create Alerts","View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Add and Customize Pages","Apply Themes and Borders", - "Apply Style Sheets","Create Groups", - "Use Self-Service Site Creation","View Pages", - "Enumerate Permissions","Browse User Information", - "Manage Alerts","Use Remote Interfaces", - "Use Client Integration Features","Open", - "Edit Personal User Information") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + WebAppUrl = "http://sharepoint.contoso.com" + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "View Items", "Approve Items", + "Open Items", "View Versions", "Delete Versions", + "Create Alerts", "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", + "Use Self-Service Site Creation", "View Pages", + "Enumerate Permissions", "Browse User Information", + "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", "Open", + "Edit Personal User Information") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { return $null } It "Should return exception from the get method" { { Get-TargetResource @testParams } | Should throw ("Browse Directories is " + ` - "required when specifying Manage Permissions, Manage Web Site, " + ` - "Add and Customize Pages or Enumerate Permissions") + "required when specifying Manage Permissions, Manage Web Site, " + ` + "Add and Customize Pages or Enumerate Permissions") } It "Should return exception from the test method" { { Test-TargetResource @testParams } | Should throw ("Browse Directories is " + ` - "required when specifying Manage Permissions, Manage Web Site, " + ` - "Add and Customize Pages or Enumerate Permissions") + "required when specifying Manage Permissions, Manage Web Site, " + ` + "Add and Customize Pages or Enumerate Permissions") } It "Should return exception from the set method" { { Set-TargetResource @testParams } | Should throw ("Browse Directories is " + ` - "required when specifying Manage Permissions, Manage Web Site, " + ` - "Add and Customize Pages or Enumerate Permissions") + "required when specifying Manage Permissions, Manage Web Site, " + ` + "Add and Customize Pages or Enumerate Permissions") } } - + Context -Name "View Pages missing for various other parameters" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","View Items","Approve Items", - "Open Items","View Versions","Delete Versions", - "Create Alerts","View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Add and Customize Pages","Apply Themes and Borders", - "Apply Style Sheets","Create Groups","Browse Directories", - "Use Self-Service Site Creation","Enumerate Permissions", - "Browse User Information","Manage Alerts", - "Use Remote Interfaces","Use Client Integration Features", - "Open","Edit Personal User Information") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + WebAppUrl = "http://sharepoint.contoso.com" + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "View Items", "Approve Items", + "Open Items", "View Versions", "Delete Versions", + "Create Alerts", "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "Enumerate Permissions", + "Browse User Information", "Manage Alerts", + "Use Remote Interfaces", "Use Client Integration Features", + "Open", "Edit Personal User Information") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { return $null } It "Should return exception from the get method" { { Get-TargetResource @testParams } | Should throw ("View Pages is required when " + ` - "specifying Manage Lists, Override List Behaviors, Add Items, Edit " + ` - "Items, Delete Items, View Items, Approve Items, Open Items, View " + ` - "Versions, Delete Versions, Create Alerts, Manage Permissions, View " + ` - "Web Analytics Data, Create Subsites, Manage Web Site, Add and " + ` - "Customize Pages, Apply Themes and Borders, Apply Style Sheets, Create " + ` - "Groups, Browse Directories, Use Self-Service Site Creation, Enumerate " + ` - "Permissions, Manage Alerts, Manage Personal Views, Add/Remove Personal " + ` - "Web Parts or Update Personal Web Parts") + "specifying Manage Lists, Override List Behaviors, Add Items, Edit " + ` + "Items, Delete Items, View Items, Approve Items, Open Items, View " + ` + "Versions, Delete Versions, Create Alerts, Manage Permissions, View " + ` + "Web Analytics Data, Create Subsites, Manage Web Site, Add and " + ` + "Customize Pages, Apply Themes and Borders, Apply Style Sheets, Create " + ` + "Groups, Browse Directories, Use Self-Service Site Creation, Enumerate " + ` + "Permissions, Manage Alerts, Manage Personal Views, Add/Remove Personal " + ` + "Web Parts or Update Personal Web Parts") } It "Should return exception from the test method" { { Test-TargetResource @testParams } | Should throw ("View Pages is required when " + ` - "specifying Manage Lists, Override List Behaviors, Add Items, Edit " + ` - "Items, Delete Items, View Items, Approve Items, Open Items, View " + ` - "Versions, Delete Versions, Create Alerts, Manage Permissions, View " + ` - "Web Analytics Data, Create Subsites, Manage Web Site, Add and " + ` - "Customize Pages, Apply Themes and Borders, Apply Style Sheets, Create " + ` - "Groups, Browse Directories, Use Self-Service Site Creation, Enumerate " + ` - "Permissions, Manage Alerts, Manage Personal Views, Add/Remove Personal " + ` - "Web Parts or Update Personal Web Parts") + "specifying Manage Lists, Override List Behaviors, Add Items, Edit " + ` + "Items, Delete Items, View Items, Approve Items, Open Items, View " + ` + "Versions, Delete Versions, Create Alerts, Manage Permissions, View " + ` + "Web Analytics Data, Create Subsites, Manage Web Site, Add and " + ` + "Customize Pages, Apply Themes and Borders, Apply Style Sheets, Create " + ` + "Groups, Browse Directories, Use Self-Service Site Creation, Enumerate " + ` + "Permissions, Manage Alerts, Manage Personal Views, Add/Remove Personal " + ` + "Web Parts or Update Personal Web Parts") } It "Should return exception from the set method" { { Set-TargetResource @testParams } | Should throw ("View Pages is required when " + ` - "specifying Manage Lists, Override List Behaviors, Add Items, Edit " + ` - "Items, Delete Items, View Items, Approve Items, Open Items, View " + ` - "Versions, Delete Versions, Create Alerts, Manage Permissions, View " + ` - "Web Analytics Data, Create Subsites, Manage Web Site, Add and " + ` - "Customize Pages, Apply Themes and Borders, Apply Style Sheets, Create " + ` - "Groups, Browse Directories, Use Self-Service Site Creation, Enumerate " + ` - "Permissions, Manage Alerts, Manage Personal Views, Add/Remove Personal " + ` - "Web Parts or Update Personal Web Parts") + "specifying Manage Lists, Override List Behaviors, Add Items, Edit " + ` + "Items, Delete Items, View Items, Approve Items, Open Items, View " + ` + "Versions, Delete Versions, Create Alerts, Manage Permissions, View " + ` + "Web Analytics Data, Create Subsites, Manage Web Site, Add and " + ` + "Customize Pages, Apply Themes and Borders, Apply Style Sheets, Create " + ` + "Groups, Browse Directories, Use Self-Service Site Creation, Enumerate " + ` + "Permissions, Manage Alerts, Manage Personal Views, Add/Remove Personal " + ` + "Web Parts or Update Personal Web Parts") } } Context -Name "Manage Permissions or Manage Web Site without Enumerate Permissions" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","View Items","Approve Items", - "Open Items","View Versions","Delete Versions", - "Create Alerts","View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Add and Customize Pages","Apply Themes and Borders", - "Apply Style Sheets","Create Groups","Browse Directories", - "Use Self-Service Site Creation","View Pages", - "Browse User Information","Manage Alerts", - "Use Remote Interfaces","Use Client Integration Features", - "Open","Edit Personal User Information") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + WebAppUrl = "http://sharepoint.contoso.com" + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "View Items", "Approve Items", + "Open Items", "View Versions", "Delete Versions", + "Create Alerts", "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", + "Browse User Information", "Manage Alerts", + "Use Remote Interfaces", "Use Client Integration Features", + "Open", "Edit Personal User Information") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { return $null } @@ -494,63 +497,63 @@ namespace Microsoft.SharePoint { Context -Name "Manage Permissions, Create Subsites, Manage Web Site, Create Groups, Use Self-Service Site Creation, Enumerate Permissions or Edit Personal User Information without Browse User Information" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","View Items","Approve Items", - "Open Items","View Versions","Delete Versions", - "Create Alerts","View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Add and Customize Pages","Apply Themes and Borders", - "Apply Style Sheets","Create Groups","Browse Directories", - "Use Self-Service Site Creation","View Pages", - "Enumerate Permissions","Manage Alerts", - "Use Remote Interfaces","Use Client Integration Features", - "Open","Edit Personal User Information") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + WebAppUrl = "http://sharepoint.contoso.com" + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "View Items", "Approve Items", + "Open Items", "View Versions", "Delete Versions", + "Create Alerts", "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", + "Enumerate Permissions", "Manage Alerts", + "Use Remote Interfaces", "Use Client Integration Features", + "Open", "Edit Personal User Information") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { return $null } It "Should return exception from the get method" { { Get-TargetResource @testParams } | Should throw ("Browse User Information is " + ` - "required when specifying Manage Permissions, Create Subsites, " + ` - "Manage Web Site, Create Groups, Use Self-Service Site Creation, " + ` - "Enumerate Permissions or Edit Personal User Information") + "required when specifying Manage Permissions, Create Subsites, " + ` + "Manage Web Site, Create Groups, Use Self-Service Site Creation, " + ` + "Enumerate Permissions or Edit Personal User Information") } It "Should return exception from the test method" { { Test-TargetResource @testParams } | Should throw ("Browse User Information is " + ` - "required when specifying Manage Permissions, Create Subsites, " + ` - "Manage Web Site, Create Groups, Use Self-Service Site Creation, " + ` - "Enumerate Permissions or Edit Personal User Information") + "required when specifying Manage Permissions, Create Subsites, " + ` + "Manage Web Site, Create Groups, Use Self-Service Site Creation, " + ` + "Enumerate Permissions or Edit Personal User Information") } It "Should return exception from the set method" { { Set-TargetResource @testParams } | Should throw ("Browse User Information is " + ` - "required when specifying Manage Permissions, Create Subsites, " + ` - "Manage Web Site, Create Groups, Use Self-Service Site Creation, " + ` - "Enumerate Permissions or Edit Personal User Information") + "required when specifying Manage Permissions, Create Subsites, " + ` + "Manage Web Site, Create Groups, Use Self-Service Site Creation, " + ` + "Enumerate Permissions or Edit Personal User Information") } } Context -Name "Use Client Integration Features without Use Remote Interfaces" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","View Items","Approve Items", - "Open Items","View Versions","Delete Versions", - "Create Alerts","View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Add and Customize Pages","Apply Themes and Borders", - "Apply Style Sheets","Create Groups","Browse Directories", - "Use Self-Service Site Creation","View Pages", - "Enumerate Permissions","Browse User Information", - "Manage Alerts","Use Client Integration Features","Open", - "Edit Personal User Information") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + WebAppUrl = "http://sharepoint.contoso.com" + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "View Items", "Approve Items", + "Open Items", "View Versions", "Delete Versions", + "Create Alerts", "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", + "Enumerate Permissions", "Browse User Information", + "Manage Alerts", "Use Client Integration Features", "Open", + "Edit Personal User Information") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { return $null } @@ -570,22 +573,22 @@ namespace Microsoft.SharePoint { Context -Name "Open is required when specifying any of the other permissions" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","View Items","Approve Items", - "Open Items","View Versions","Delete Versions", - "Create Alerts","View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Add and Customize Pages","Apply Themes and Borders", - "Apply Style Sheets","Create Groups","Browse Directories", - "Use Self-Service Site Creation","View Pages", - "Enumerate Permissions","Browse User Information", - "Manage Alerts","Use Remote Interfaces", - "Use Client Integration Features", - "Edit Personal User Information") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + WebAppUrl = "http://sharepoint.contoso.com" + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "View Items", "Approve Items", + "Open Items", "View Versions", "Delete Versions", + "Create Alerts", "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", + "Enumerate Permissions", "Browse User Information", + "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", + "Edit Personal User Information") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { return $null } @@ -605,21 +608,21 @@ namespace Microsoft.SharePoint { Context -Name "Add/Remove Personal Web Parts without Update Personal Web Parts" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","View Items","Approve Items", - "Open Items","View Versions","Delete Versions", - "Create Alerts","View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Add and Customize Pages","Apply Themes and Borders", - "Apply Style Sheets","Create Groups","Browse Directories", - "Use Self-Service Site Creation","View Pages", - "Enumerate Permissions","Browse User Information", - "Manage Alerts","Use Remote Interfaces", - "Use Client Integration Features","Open", - "Edit Personal User Information") - PersonalPermissions = "Manage Personal Views","Add/Remove Personal Web Parts" + WebAppUrl = "http://sharepoint.contoso.com" + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "View Items", "Approve Items", + "Open Items", "View Versions", "Delete Versions", + "Create Alerts", "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", + "Enumerate Permissions", "Browse User Information", + "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", "Open", + "Edit Personal User Information") + PersonalPermissions = "Manage Personal Views", "Add/Remove Personal Web Parts" } Mock -CommandName Get-SPWebapplication -MockWith { return $null } @@ -645,16 +648,16 @@ namespace Microsoft.SharePoint { Mock -CommandName Get-SPWebapplication -MockWith { $returnval = @{ - RightsMask = @("ManageLists","CancelCheckout","AddListItems","EditListItems", - "DeleteListItems","ViewListItems","ApproveItems","OpenItems", - "ViewVersions","DeleteVersions","CreateAlerts","ViewFormPages") + RightsMask = @("ManageLists", "CancelCheckout", "AddListItems", "EditListItems", + "DeleteListItems", "ViewListItems", "ApproveItems", "OpenItems", + "ViewVersions", "DeleteVersions", "CreateAlerts", "ViewFormPages") } - + $returnval = $returnval | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true } -PassThru return $returnval - } + } It "Should return values from the get method" { Get-TargetResource @testParams | Should Not BeNullOrEmpty @@ -674,33 +677,33 @@ namespace Microsoft.SharePoint { Context -Name "FullMask is set, but AllPermissions is not specified" -Fixture { $testParams = @{ WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","View Items","Approve Items", - "Open Items","View Versions","Delete Versions", - "Create Alerts","View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Add and Customize Pages","Apply Themes and Borders", - "Apply Style Sheets","Create Groups","Browse Directories", - "Use Self-Service Site Creation","View Pages", - "Enumerate Permissions","Browse User Information", - "Manage Alerts","Use Remote Interfaces", - "Use Client Integration Features","Open", - "Edit Personal User Information") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "View Items", "Approve Items", + "Open Items", "View Versions", "Delete Versions", + "Create Alerts", "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", + "Enumerate Permissions", "Browse User Information", + "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", "Open", + "Edit Personal User Information") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { $returnval = @{ RightsMask = "FullMask" } - + $returnval = $returnval | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true } -PassThru return $returnval - } + } It "Should return values from the get method" { Get-TargetResource @testParams | Should Not BeNullOrEmpty @@ -719,20 +722,20 @@ namespace Microsoft.SharePoint { Context -Name "AllPermissions specified and FullMask is set" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - AllPermissions = $true + WebAppUrl = "http://sharepoint.contoso.com" + AllPermissions = $true } Mock -CommandName Get-SPWebapplication -MockWith { $returnval = @{ RightsMask = "FullMask" } - + $returnval = $returnval | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true } -PassThru return $returnval - } + } It "Should return values from the get method" { Get-TargetResource @testParams | Should Not BeNullOrEmpty @@ -746,41 +749,41 @@ namespace Microsoft.SharePoint { Context -Name "List/Site/Personal permissions set, but ListPermissions does not match" -Fixture { $testParams = @{ WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","View Items","Approve Items", - "Open Items","View Versions","Delete Versions", - "Create Alerts","View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Add and Customize Pages","Apply Themes and Borders", - "Apply Style Sheets","Create Groups","Browse Directories", - "Use Self-Service Site Creation","View Pages", - "Enumerate Permissions","Browse User Information", - "Manage Alerts","Use Remote Interfaces", - "Use Client Integration Features","Open", - "Edit Personal User Information") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "View Items", "Approve Items", + "Open Items", "View Versions", "Delete Versions", + "Create Alerts", "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", + "Enumerate Permissions", "Browse User Information", + "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", "Open", + "Edit Personal User Information") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { $returnval = @{ - RightsMask = @("CancelCheckout","AddListItems","EditListItems","DeleteListItems", - "ViewListItems","ApproveItems","OpenItems","ViewVersions", - "DeleteVersions","CreateAlerts","ViewFormPages", - "ManagePermissions","ViewUsageData","ManageSubwebs","ManageWeb", - "AddAndCustomizePages","ApplyThemeAndBorder","ApplyStyleSheets", - "CreateGroups","BrowseDirectories","CreateSSCSite","ViewPages", - "EnumeratePermissions","BrowseUserInfo","ManageAlerts","UseRemoteAPIs", - "UseClientIntegration","Open","EditMyUserInfo","ManagePersonalViews", - "AddDelPrivateWebParts","UpdatePersonalWebParts") + RightsMask = @("CancelCheckout", "AddListItems", "EditListItems", "DeleteListItems", + "ViewListItems", "ApproveItems", "OpenItems", "ViewVersions", + "DeleteVersions", "CreateAlerts", "ViewFormPages", + "ManagePermissions", "ViewUsageData", "ManageSubwebs", "ManageWeb", + "AddAndCustomizePages", "ApplyThemeAndBorder", "ApplyStyleSheets", + "CreateGroups", "BrowseDirectories", "CreateSSCSite", "ViewPages", + "EnumeratePermissions", "BrowseUserInfo", "ManageAlerts", "UseRemoteAPIs", + "UseClientIntegration", "Open", "EditMyUserInfo", "ManagePersonalViews", + "AddDelPrivateWebParts", "UpdatePersonalWebParts") } - + $returnval = $returnval | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true } -PassThru return $returnval - } + } It "Should return values from the get method" { Get-TargetResource @testParams | Should Not BeNullOrEmpty @@ -800,42 +803,42 @@ namespace Microsoft.SharePoint { Context -Name "List/Site/Personal permissions set, but SitePermissions does not match" -Fixture { $testParams = @{ WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","View Items","Approve Items", - "Open Items","View Versions","Delete Versions", - "Create Alerts","View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Add and Customize Pages","Apply Themes and Borders", - "Apply Style Sheets","Create Groups","Browse Directories", - "Use Self-Service Site Creation","View Pages", - "Enumerate Permissions","Browse User Information", - "Manage Alerts","Use Remote Interfaces", - "Use Client Integration Features","Open", - "Edit Personal User Information") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "View Items", "Approve Items", + "Open Items", "View Versions", "Delete Versions", + "Create Alerts", "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", + "Enumerate Permissions", "Browse User Information", + "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", "Open", + "Edit Personal User Information") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { $returnval = @{ - RightsMask = @("ManageLists","CancelCheckout","AddListItems","EditListItems", - "DeleteListItems","ViewListItems","ApproveItems","OpenItems", - "ViewVersions","DeleteVersions","CreateAlerts","ViewFormPages", - "ViewUsageData","ManageSubwebs","ManageWeb", - "AddAndCustomizePages","ApplyThemeAndBorder","ApplyStyleSheets", - "CreateGroups","BrowseDirectories","CreateSSCSite","ViewPages", - "EnumeratePermissions","BrowseUserInfo","ManageAlerts", - "UseRemoteAPIs","UseClientIntegration","Open","EditMyUserInfo", - "ManagePersonalViews","AddDelPrivateWebParts", - "UpdatePersonalWebParts") + RightsMask = @("ManageLists", "CancelCheckout", "AddListItems", "EditListItems", + "DeleteListItems", "ViewListItems", "ApproveItems", "OpenItems", + "ViewVersions", "DeleteVersions", "CreateAlerts", "ViewFormPages", + "ViewUsageData", "ManageSubwebs", "ManageWeb", + "AddAndCustomizePages", "ApplyThemeAndBorder", "ApplyStyleSheets", + "CreateGroups", "BrowseDirectories", "CreateSSCSite", "ViewPages", + "EnumeratePermissions", "BrowseUserInfo", "ManageAlerts", + "UseRemoteAPIs", "UseClientIntegration", "Open", "EditMyUserInfo", + "ManagePersonalViews", "AddDelPrivateWebParts", + "UpdatePersonalWebParts") } - + $returnval = $returnval | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true } -PassThru return $returnval - } + } It "Should return values from the get method" { Get-TargetResource @testParams | Should Not BeNullOrEmpty @@ -851,45 +854,45 @@ namespace Microsoft.SharePoint { $Global:SPDscWebApplicationUpdateCalled | Should Be $true } } - + Context -Name "List/Site/Personal permissions set, but PersonalPermissions does not match" -Fixture { $testParams = @{ WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","View Items","Approve Items", - "Open Items","View Versions","Delete Versions", - "Create Alerts","View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Add and Customize Pages","Apply Themes and Borders", - "Apply Style Sheets","Create Groups","Browse Directories", - "Use Self-Service Site Creation","View Pages", - "Enumerate Permissions","Browse User Information", - "Manage Alerts","Use Remote Interfaces", - "Use Client Integration Features","Open", - "Edit Personal User Information") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "View Items", "Approve Items", + "Open Items", "View Versions", "Delete Versions", + "Create Alerts", "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", + "Enumerate Permissions", "Browse User Information", + "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", "Open", + "Edit Personal User Information") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { $returnval = @{ - RightsMask = @("ManageLists","CancelCheckout","AddListItems","EditListItems", - "DeleteListItems","ViewListItems","ApproveItems","OpenItems", - "ViewVersions","DeleteVersions","CreateAlerts","ViewFormPages", - "ManagePermissions","ViewUsageData","ManageSubwebs","ManageWeb", - "AddAndCustomizePages","ApplyThemeAndBorder","ApplyStyleSheets", - "CreateGroups","BrowseDirectories","CreateSSCSite","ViewPages", - "EnumeratePermissions","BrowseUserInfo","ManageAlerts", - "UseRemoteAPIs","UseClientIntegration","Open","EditMyUserInfo", - "AddDelPrivateWebParts","UpdatePersonalWebParts") + RightsMask = @("ManageLists", "CancelCheckout", "AddListItems", "EditListItems", + "DeleteListItems", "ViewListItems", "ApproveItems", "OpenItems", + "ViewVersions", "DeleteVersions", "CreateAlerts", "ViewFormPages", + "ManagePermissions", "ViewUsageData", "ManageSubwebs", "ManageWeb", + "AddAndCustomizePages", "ApplyThemeAndBorder", "ApplyStyleSheets", + "CreateGroups", "BrowseDirectories", "CreateSSCSite", "ViewPages", + "EnumeratePermissions", "BrowseUserInfo", "ManageAlerts", + "UseRemoteAPIs", "UseClientIntegration", "Open", "EditMyUserInfo", + "AddDelPrivateWebParts", "UpdatePersonalWebParts") } - + $returnval = $returnval | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true } -PassThru return $returnval - } + } It "Should return values from the get method" { Get-TargetResource @testParams | Should Not BeNullOrEmpty @@ -909,42 +912,42 @@ namespace Microsoft.SharePoint { Context -Name "List/Site/Personal permissions set and all permissions match" -Fixture { $testParams = @{ WebAppUrl = "http://sharepoint.contoso.com" - ListPermissions = @("Manage Lists","Override List Behaviors", "Add Items", - "Edit Items","Delete Items","View Items","Approve Items", - "Open Items","View Versions","Delete Versions", - "Create Alerts","View Application Pages") - SitePermissions = @("Manage Permissions","View Web Analytics Data", - "Create Subsites","Manage Web Site", - "Add and Customize Pages","Apply Themes and Borders", - "Apply Style Sheets","Create Groups","Browse Directories", - "Use Self-Service Site Creation","View Pages", - "Enumerate Permissions","Browse User Information", - "Manage Alerts","Use Remote Interfaces", - "Use Client Integration Features","Open", - "Edit Personal User Information") - PersonalPermissions = @("Manage Personal Views","Add/Remove Personal Web Parts", - "Update Personal Web Parts") + ListPermissions = @("Manage Lists", "Override List Behaviors", "Add Items", + "Edit Items", "Delete Items", "View Items", "Approve Items", + "Open Items", "View Versions", "Delete Versions", + "Create Alerts", "View Application Pages") + SitePermissions = @("Manage Permissions", "View Web Analytics Data", + "Create Subsites", "Manage Web Site", + "Add and Customize Pages", "Apply Themes and Borders", + "Apply Style Sheets", "Create Groups", "Browse Directories", + "Use Self-Service Site Creation", "View Pages", + "Enumerate Permissions", "Browse User Information", + "Manage Alerts", "Use Remote Interfaces", + "Use Client Integration Features", "Open", + "Edit Personal User Information") + PersonalPermissions = @("Manage Personal Views", "Add/Remove Personal Web Parts", + "Update Personal Web Parts") } Mock -CommandName Get-SPWebapplication -MockWith { $returnval = @{ - RightsMask = @("ManageLists","CancelCheckout","AddListItems","EditListItems", - "DeleteListItems","ViewListItems","ApproveItems","OpenItems", - "ViewVersions","DeleteVersions","CreateAlerts","ViewFormPages", - "ManagePermissions","ViewUsageData","ManageSubwebs","ManageWeb", - "AddAndCustomizePages","ApplyThemeAndBorder","ApplyStyleSheets", - "CreateGroups","BrowseDirectories","CreateSSCSite","ViewPages", - "EnumeratePermissions","BrowseUserInfo","ManageAlerts", - "UseRemoteAPIs","UseClientIntegration","Open","EditMyUserInfo", - "ManagePersonalViews","AddDelPrivateWebParts", - "UpdatePersonalWebParts") + RightsMask = @("ManageLists", "CancelCheckout", "AddListItems", "EditListItems", + "DeleteListItems", "ViewListItems", "ApproveItems", "OpenItems", + "ViewVersions", "DeleteVersions", "CreateAlerts", "ViewFormPages", + "ManagePermissions", "ViewUsageData", "ManageSubwebs", "ManageWeb", + "AddAndCustomizePages", "ApplyThemeAndBorder", "ApplyStyleSheets", + "CreateGroups", "BrowseDirectories", "CreateSSCSite", "ViewPages", + "EnumeratePermissions", "BrowseUserInfo", "ManageAlerts", + "UseRemoteAPIs", "UseClientIntegration", "Open", "EditMyUserInfo", + "ManagePersonalViews", "AddDelPrivateWebParts", + "UpdatePersonalWebParts") } - + $returnval = $returnval | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true } -PassThru return $returnval - } + } It "Should return values from the get method" { Get-TargetResource @testParams | Should Not BeNullOrEmpty diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppPolicy.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppPolicy.Tests.ps1 index fcc19eee5..ae41d7a9c 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppPolicy.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppPolicy.Tests.ps1 @@ -3,24 +3,27 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWebAppPolicy" + -DscResource "SPWebAppPolicy" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope # Initialize tests - try { [Microsoft.SharePoint.Administration.SPPolicyRoleType] } - catch { + try + { [Microsoft.SharePoint.Administration.SPPolicyRoleType] + } + catch + { Add-Type -TypeDefinition @" namespace Microsoft.SharePoint.Administration { public enum SPPolicyRoleType { FullRead, FullControl, DenyWrite, DenyAll }; @@ -53,18 +56,18 @@ namespace Microsoft.SharePoint.Administration { # Test contexts Context -Name "The web application doesn't exist" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Members = @( + WebAppUrl = "http://sharepoint.contoso.com" + Members = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Control" - ActAsSystemAccount = $true - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Control" + ActAsSystemAccount = $true + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user2" - PermissionLevel = "Full Read" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\user2" + PermissionLevel = "Full Read" + ActAsSystemAccount = $false + } -ClientOnly) ) } @@ -85,20 +88,20 @@ namespace Microsoft.SharePoint.Administration { Context -Name "Members and MembersToInclude parameters used simultaniously" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Members = @( + WebAppUrl = "http://sharepoint.contoso.com" + Members = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Control" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Control" + ActAsSystemAccount = $false + } -ClientOnly) ) MembersToInclude = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Control" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Control" + ActAsSystemAccount = $false + } -ClientOnly) ) } @@ -117,7 +120,7 @@ namespace Microsoft.SharePoint.Administration { Context -Name "No Member parameters at all" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" + WebAppUrl = "http://sharepoint.contoso.com" } It "Should return WebAppUrl=null from the get method" { @@ -135,13 +138,13 @@ namespace Microsoft.SharePoint.Administration { Context -Name "ActAsSystemAccount parameter specified without Full Control in Members" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Members = @( + WebAppUrl = "http://sharepoint.contoso.com" + Members = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Read" - ActAsSystemAccount = $true - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Read" + ActAsSystemAccount = $true + } -ClientOnly) ) } @@ -160,13 +163,13 @@ namespace Microsoft.SharePoint.Administration { Context -Name "ActAsSystemAccount parameter specified without Full Control in MembersToInclude" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" + WebAppUrl = "http://sharepoint.contoso.com" MembersToInclude = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Read" - ActAsSystemAccount = $true - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Read" + ActAsSystemAccount = $true + } -ClientOnly) ) } @@ -185,16 +188,16 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The Members parameter used with SetCacheAccounts to True, but the Cache Users users aren't configured in the policy" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Members = @( + WebAppUrl = "http://sharepoint.contoso.com" + Members = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Read" - IdentityType = "Native" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Read" + IdentityType = "Native" + ActAsSystemAccount = $false + } -ClientOnly) ) - SetCacheAccounts=$true + SetCacheAccounts = $true } Mock -CommandName Get-SPWebapplication -MockWith { $roleBindings = @( @@ -209,9 +212,9 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "contoso\user1" + UserName = "contoso\user1" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } ) $policies = $policies | Add-Member -MemberType ScriptMethod -Name Add -Value { @@ -219,19 +222,19 @@ namespace Microsoft.SharePoint.Administration { IsSystemUser = $false } $policy = $policy | Add-Member ScriptProperty -Name PolicyRoleBindings -Value { - return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value {} -PassThru + return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value { } -PassThru } -PassThru return $policy } -PassThru -Force $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{ - portalsuperuseraccount = "contoso\sp_psu" + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ + portalsuperuseraccount = "contoso\sp_psu" portalsuperreaderaccount = "contoso\sp_psr" } } @@ -260,16 +263,16 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The MembersToInclude parameter used with SetCacheAccounts to True, but the Cache Users users aren't configured in the policy" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" + WebAppUrl = "http://sharepoint.contoso.com" MembersToInclude = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Read" - IdentityType = "Native" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Read" + IdentityType = "Native" + ActAsSystemAccount = $false + } -ClientOnly) ) - SetCacheAccounts=$true + SetCacheAccounts = $true } Mock -CommandName Get-SPWebapplication -MockWith { $roleBindings = @( @@ -284,9 +287,9 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "contoso\user1" + UserName = "contoso\user1" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } ) $policies = $policies | Add-Member -MemberType ScriptMethod -Name Add -Value { @@ -294,19 +297,19 @@ namespace Microsoft.SharePoint.Administration { IsSystemUser = $false } $policy = $policy | Add-Member ScriptProperty -Name PolicyRoleBindings -Value { - return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value {} -PassThru + return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value { } -PassThru } -PassThru return $policy } -PassThru -Force $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{ - portalsuperuseraccount = "contoso\sp_psu" + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ + portalsuperuseraccount = "contoso\sp_psu" portalsuperreaderaccount = "contoso\sp_psr" } } @@ -335,16 +338,16 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The Members parameter used with SetCacheAccounts to True, but the Cache Users users aren't configured in the webapp" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Members = @( + WebAppUrl = "http://sharepoint.contoso.com" + Members = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Read" - IdentityType = "Native" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Read" + IdentityType = "Native" + ActAsSystemAccount = $false + } -ClientOnly) ) - SetCacheAccounts=$true + SetCacheAccounts = $true } Mock -CommandName Get-SPWebapplication -MockWith { $roleBindings = @( @@ -359,9 +362,9 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "contoso\user1" + UserName = "contoso\user1" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } ) $policies = $policies | Add-Member -MemberType ScriptMethod -Name Add -Value { @@ -369,18 +372,18 @@ namespace Microsoft.SharePoint.Administration { IsSystemUser = $false } $policy = $policy | Add-Member ScriptProperty -Name PolicyRoleBindings -Value { - return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value {} -PassThru + return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value { } -PassThru } -PassThru return $policy } -PassThru -Force $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{ + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ } } @@ -406,16 +409,16 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The MembersToInclude parameter used with SetCacheAccounts to True, but the Cache Users users aren't configured in the webapp" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" + WebAppUrl = "http://sharepoint.contoso.com" MembersToInclude = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Read" - IdentityType = "Native" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Read" + IdentityType = "Native" + ActAsSystemAccount = $false + } -ClientOnly) ) - SetCacheAccounts=$true + SetCacheAccounts = $true } Mock -CommandName Get-SPWebapplication -MockWith { $roleBindings = @( @@ -430,9 +433,9 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "contoso\user1" + UserName = "contoso\user1" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } ) $policies = $policies | Add-Member -MemberType ScriptMethod -Name Add -Value { @@ -440,18 +443,18 @@ namespace Microsoft.SharePoint.Administration { IsSystemUser = $false } $policy = $policy | Add-Member ScriptProperty -Name PolicyRoleBindings -Value { - return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value {} -PassThru + return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value { } -PassThru } -PassThru return $policy } -PassThru -Force $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{ + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ } } @@ -477,15 +480,15 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The Members parameter used with SetCacheAccounts to True and the Cache Users users are configured correctly" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Members = @( + WebAppUrl = "http://sharepoint.contoso.com" + Members = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Read" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Read" + ActAsSystemAccount = $false + } -ClientOnly) ) - SetCacheAccounts=$true + SetCacheAccounts = $true } Mock -CommandName Get-SPWebapplication -MockWith { $roleBindingsFR = @( @@ -510,19 +513,19 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "i:0#.w|contoso\user1" + UserName = "i:0#.w|contoso\user1" PolicyRoleBindings = $roleBindingsFR - IsSystemUser = $false + IsSystemUser = $false } @{ - UserName = "i:0#.w|contoso\sp_psu" + UserName = "i:0#.w|contoso\sp_psu" PolicyRoleBindings = $roleBindingsFC - IsSystemUser = $false + IsSystemUser = $false } @{ - UserName = "i:0#.w|contoso\sp_psr" + UserName = "i:0#.w|contoso\sp_psr" PolicyRoleBindings = $roleBindingsFR - IsSystemUser = $false + IsSystemUser = $false } ) $policies = $policies | Add-Member -MemberType ScriptMethod -Name Add -Value { @@ -530,19 +533,19 @@ namespace Microsoft.SharePoint.Administration { IsSystemUser = $false } $policy = $policy | Add-Member ScriptProperty -Name PolicyRoleBindings -Value { - return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value {} -PassThru + return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value { } -PassThru } -PassThru return $policy } -PassThru -Force $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{ - portalsuperuseraccount = "i:0#.w|contoso\sp_psu" + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ + portalsuperuseraccount = "i:0#.w|contoso\sp_psu" portalsuperreaderaccount = "i:0#.w|contoso\sp_psr" } } @@ -565,16 +568,16 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The MembersToInclude parameter used with SetCacheAccounts to True and the Cache Users users are configured correctly" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" + WebAppUrl = "http://sharepoint.contoso.com" MembersToInclude = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Read" - IdentityType = "Claims" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Read" + IdentityType = "Claims" + ActAsSystemAccount = $false + } -ClientOnly) ) - SetCacheAccounts=$true + SetCacheAccounts = $true } Mock -CommandName Get-SPWebapplication -MockWith { $roleBindingsFR = @( @@ -599,19 +602,19 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "i:0#.w|contoso\user1" + UserName = "i:0#.w|contoso\user1" PolicyRoleBindings = $roleBindingsFR - IsSystemUser = $false + IsSystemUser = $false } @{ - UserName = "i:0#.w|contoso\sp_psu" + UserName = "i:0#.w|contoso\sp_psu" PolicyRoleBindings = $roleBindingsFC - IsSystemUser = $false + IsSystemUser = $false } @{ - UserName = "i:0#.w|contoso\sp_psr" + UserName = "i:0#.w|contoso\sp_psr" PolicyRoleBindings = $roleBindingsFR - IsSystemUser = $false + IsSystemUser = $false } ) $policies = $policies | Add-Member -MemberType ScriptMethod -Name Add -Value { @@ -619,19 +622,19 @@ namespace Microsoft.SharePoint.Administration { IsSystemUser = $false } $policy = $policy | Add-Member ScriptProperty -Name PolicyRoleBindings -Value { - return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value {} -PassThru + return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value { } -PassThru } -PassThru return $policy } -PassThru -Force $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{ - portalsuperuseraccount = "contoso\sp_psu" + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ + portalsuperuseraccount = "contoso\sp_psu" portalsuperreaderaccount = "contoso\sp_psr" } } @@ -654,14 +657,14 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The MembersToExclude parameter used, but it specifies a Cache User" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" + WebAppUrl = "http://sharepoint.contoso.com" MembersToExclude = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\sp_psr" - PermissionLevel = "Full Read" - IdentityType = "Native" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\sp_psr" + PermissionLevel = "Full Read" + IdentityType = "Native" + ActAsSystemAccount = $false + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { @@ -687,19 +690,19 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "contoso\user1" + UserName = "contoso\user1" PolicyRoleBindings = $roleBindingsFR - IsSystemUser = $false + IsSystemUser = $false } @{ - UserName = "contoso\sp_psu" + UserName = "contoso\sp_psu" PolicyRoleBindings = $roleBindingsFC - IsSystemUser = $false + IsSystemUser = $false } @{ - UserName = "contoso\sp_psr" + UserName = "contoso\sp_psr" PolicyRoleBindings = $roleBindingsFR - IsSystemUser = $false + IsSystemUser = $false } ) $policies = $policies | Add-Member -MemberType ScriptMethod -Name Add -Value { @@ -707,19 +710,19 @@ namespace Microsoft.SharePoint.Administration { IsSystemUser = $false } $policy = $policy | Add-Member ScriptProperty -Name PolicyRoleBindings -Value { - return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value {} -PassThru + return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value { } -PassThru } -PassThru return $policy } -PassThru -Force $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{ - portalsuperuseraccount = "contoso\sp_psu" + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ + portalsuperuseraccount = "contoso\sp_psu" portalsuperreaderaccount = "contoso\sp_psr" } } @@ -746,20 +749,20 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The Members parameter contains users that aren't configured in the policy" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Members = @( + WebAppUrl = "http://sharepoint.contoso.com" + Members = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Read" - IdentityType = "Native" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Read" + IdentityType = "Native" + ActAsSystemAccount = $false + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user2" - PermissionLevel = "Full Control" - IdentityType = "Native" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\user2" + PermissionLevel = "Full Control" + IdentityType = "Native" + ActAsSystemAccount = $false + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { @@ -775,9 +778,9 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "contoso\user1" + UserName = "contoso\user1" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } ) $policies = $policies | Add-Member -MemberType ScriptMethod -Name Add -Value { @@ -785,18 +788,18 @@ namespace Microsoft.SharePoint.Administration { IsSystemUser = $false } $policy = $policy | Add-Member ScriptProperty -Name PolicyRoleBindings -Value { - return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value {} -PassThru + return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value { } -PassThru } -PassThru return $policy } -PassThru -Force $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{} + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ } } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true @@ -821,14 +824,14 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The Members parameter does not contains users that are configured in the policy" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Members = @( + WebAppUrl = "http://sharepoint.contoso.com" + Members = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Read" - IdentityType = "Claims" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Read" + IdentityType = "Claims" + ActAsSystemAccount = $false + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { @@ -844,24 +847,24 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "i:0#.w|contoso\user1" + UserName = "i:0#.w|contoso\user1" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } @{ - UserName = "i:0#.w|contoso\user2" + UserName = "i:0#.w|contoso\user2" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } ) | Add-Member -MemberType ScriptMethod -Name Add -Value { param($input) return $null } -Force -PassThru $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{} + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ } } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true @@ -886,20 +889,20 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The MembersToInclude parameter contains users that are not configured in the policy" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" + WebAppUrl = "http://sharepoint.contoso.com" MembersToInclude = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Read" - IdentityType = "Native" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Read" + IdentityType = "Native" + ActAsSystemAccount = $false + } -ClientOnly) (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user2" - PermissionLevel = "Full Control" - IdentityType = "Native" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\user2" + PermissionLevel = "Full Control" + IdentityType = "Native" + ActAsSystemAccount = $false + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { @@ -915,9 +918,9 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "contoso\user1" + UserName = "contoso\user1" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } ) $policies = $policies | Add-Member -MemberType ScriptMethod -Name Add -Value { @@ -925,18 +928,18 @@ namespace Microsoft.SharePoint.Administration { IsSystemUser = $false } $policy = $policy | Add-Member ScriptProperty -Name PolicyRoleBindings -Value { - return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value {} -PassThru + return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value { } -PassThru } -PassThru return $policy } -PassThru -Force $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{} + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ } } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true @@ -961,14 +964,14 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The MembersToInclude parameter contains users that are configured in the policy" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" + WebAppUrl = "http://sharepoint.contoso.com" MembersToInclude = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Read" - IdentityType = "Claims" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Read" + IdentityType = "Claims" + ActAsSystemAccount = $false + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { @@ -981,24 +984,24 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "i:0#.w|contoso\user1" + UserName = "i:0#.w|contoso\user1" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false }, @{ - UserName = "i:0#.w|contoso\user2" + UserName = "i:0#.w|contoso\user2" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } ) $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{} + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ } } return @($webApp) } @@ -1014,11 +1017,11 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The MembersToExclude parameter contains users that are configured in the policy" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" + WebAppUrl = "http://sharepoint.contoso.com" MembersToExclude = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - } -ClientOnly) + Username = "contoso\user1" + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { @@ -1034,29 +1037,29 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "contoso\user1" + UserName = "contoso\user1" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } @{ - UserName = "contoso\user2" + UserName = "contoso\user2" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } ) $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{} + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ } } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true } -PassThru | - Add-Member -MemberType NoteProperty Properties @{} -PassThru + Add-Member -MemberType NoteProperty Properties @{ } -PassThru return @($webApp) } @@ -1077,14 +1080,14 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The users in the Members parameter have different settings than configured in the policy" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Members = @( + WebAppUrl = "http://sharepoint.contoso.com" + Members = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Control" - IdentityType = "Native" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Control" + IdentityType = "Native" + ActAsSystemAccount = $false + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { @@ -1103,9 +1106,9 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "contoso\user1" + UserName = "contoso\user1" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } ) $policies = $policies | Add-Member -MemberType ScriptMethod -Name Add -Value { @@ -1113,18 +1116,18 @@ namespace Microsoft.SharePoint.Administration { IsSystemUser = $false } $policy = $policy | Add-Member ScriptProperty -Name PolicyRoleBindings -Value { - return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value {} -PassThru + return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value { } -PassThru } -PassThru return $policy } -PassThru -Force $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{} + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ } } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true @@ -1149,14 +1152,14 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The users in the MembersToInclude parameter have different settings than configured in the policy" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" + WebAppUrl = "http://sharepoint.contoso.com" MembersToInclude = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Control" - IdentityType = "Native" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Control" + IdentityType = "Native" + ActAsSystemAccount = $false + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { @@ -1175,9 +1178,9 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "contoso\user1" + UserName = "contoso\user1" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } ) $policies = $policies | Add-Member -MemberType ScriptMethod -Name Add -Value { @@ -1185,18 +1188,18 @@ namespace Microsoft.SharePoint.Administration { IsSystemUser = $false } $policy = $policy | Add-Member ScriptProperty -Name PolicyRoleBindings -Value { - return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value {} -PassThru + return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value { } -PassThru } -PassThru return $policy } -PassThru -Force $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{} + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ } } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true @@ -1221,14 +1224,14 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The users in the Members parameter have different settings than configured in the policy - ActAsSystemAccount" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Members = @( + WebAppUrl = "http://sharepoint.contoso.com" + Members = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Control" - IdentityType = "Native" - ActAsSystemAccount = $true - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Control" + IdentityType = "Native" + ActAsSystemAccount = $true + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { @@ -1247,9 +1250,9 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "contoso\user1" + UserName = "contoso\user1" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } ) $policies = $policies | Add-Member -MemberType ScriptMethod -Name Add -Value { @@ -1257,18 +1260,18 @@ namespace Microsoft.SharePoint.Administration { IsSystemUser = $false } $policy = $policy | Add-Member ScriptProperty -Name PolicyRoleBindings -Value { - return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value {} -PassThru + return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value { } -PassThru } -PassThru return $policy } -PassThru -Force $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{} + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ } } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true @@ -1293,14 +1296,14 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The users in the MembersToInclude parameter have different settings than configured in the policy - ActAsSystemAccount" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" + WebAppUrl = "http://sharepoint.contoso.com" MembersToInclude = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Control" - IdentityType = "Native" - ActAsSystemAccount = $true - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Control" + IdentityType = "Native" + ActAsSystemAccount = $true + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { @@ -1319,9 +1322,9 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "contoso\user1" + UserName = "contoso\user1" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } ) $policies = $policies | Add-Member -MemberType ScriptMethod -Name Add -Value { @@ -1329,18 +1332,18 @@ namespace Microsoft.SharePoint.Administration { IsSystemUser = $false } $policy = $policy | Add-Member ScriptProperty -Name PolicyRoleBindings -Value { - return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value {} -PassThru + return New-Object -TypeName "Object" | Add-Member -MemberType ScriptMethod -Name Add -Value { } -PassThru } -PassThru return $policy } -PassThru -Force $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{} + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ } } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true @@ -1365,14 +1368,14 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The users in the Members parameter have the same settings as configured in the policy" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Members = @( + WebAppUrl = "http://sharepoint.contoso.com" + Members = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Control" - ActAsSystemAccount = $false - IdentityType = "Native" - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Control" + ActAsSystemAccount = $false + IdentityType = "Native" + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { @@ -1385,19 +1388,19 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "contoso\user1" + UserName = "contoso\user1" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } ) $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{} + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ } } return @($webApp) } @@ -1413,14 +1416,14 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The users in the Members parameter have the same settings as configured in the policy, in Claims format" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Members = @( + WebAppUrl = "http://sharepoint.contoso.com" + Members = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Control" - ActAsSystemAccount = $false - IdentityType = "Claims" - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Control" + ActAsSystemAccount = $false + IdentityType = "Claims" + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { @@ -1433,19 +1436,19 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "i:0#.w|contoso\user1" + UserName = "i:0#.w|contoso\user1" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } ) $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{} + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ } } return @($webApp) } @@ -1461,13 +1464,13 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The users in the MembersToInclude parameter have the same settings as configured in the policy" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" + WebAppUrl = "http://sharepoint.contoso.com" MembersToInclude = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user1" - PermissionLevel = "Full Control" - ActAsSystemAccount = $false - } -ClientOnly) + Username = "contoso\user1" + PermissionLevel = "Full Control" + ActAsSystemAccount = $false + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { @@ -1480,19 +1483,19 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "i:0#.w|contoso\user1" + UserName = "i:0#.w|contoso\user1" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } ) $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{} + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ } } return @($webApp) } @@ -1508,11 +1511,11 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The users in the MembersToExclude parameter aren't configured in the policy" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" + WebAppUrl = "http://sharepoint.contoso.com" MembersToExclude = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\user2" - } -ClientOnly) + Username = "contoso\user2" + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { @@ -1525,19 +1528,19 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "contoso\user1" + UserName = "contoso\user1" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } ) $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{} + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ } } return @($webApp) } @@ -1553,14 +1556,14 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The users in the Members parameter have the same settings as configured in the policy, in Claims format with a windows group in the results" -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Members = @( + WebAppUrl = "http://sharepoint.contoso.com" + Members = @( (New-CimInstance -ClassName MSFT_SPWebAppPolicy -Property @{ - Username = "contoso\group1" - PermissionLevel = "Full Control" - ActAsSystemAccount = $false - IdentityType = "Claims" - } -ClientOnly) + Username = "contoso\group1" + PermissionLevel = "Full Control" + ActAsSystemAccount = $false + IdentityType = "Claims" + } -ClientOnly) ) } Mock -CommandName Get-SPWebapplication -MockWith { @@ -1573,19 +1576,19 @@ namespace Microsoft.SharePoint.Administration { $policies = @( @{ - UserName = "i:0#.w|s-1-5-21-2753725054-2932589700-2007370523-2138" + UserName = "i:0#.w|s-1-5-21-2753725054-2932589700-2007370523-2138" PolicyRoleBindings = $roleBindings - IsSystemUser = $false + IsSystemUser = $false } ) $webApp = @{ - Url = $testParams.WebAppUrl + Url = $testParams.WebAppUrl UseClaimsAuthentication = $true - PolicyRoles = New-Object -TypeName "Object" | - Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{} } -PassThru - Policies = $policies - Properties = @{} + PolicyRoles = New-Object -TypeName "Object" | + Add-Member -MemberType ScriptMethod -Name GetSpecialRole -Value { return @{ } } -PassThru + Policies = $policies + Properties = @{ } } return @($webApp) } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppPropertyBag.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppPropertyBag.Tests.ps1 index 36347639f..6d146f59f 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppPropertyBag.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppPropertyBag.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWebAppPropertyBag" + -DscResource "SPWebAppPropertyBag" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -35,9 +35,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name 'The web application does not exist' -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Key = 'PropertyKey' - Value = 'NewPropertyValue' + WebAppUrl = "http://sharepoint.contoso.com" + Key = 'PropertyKey' + Value = 'NewPropertyValue' } Mock -CommandName Get-SPWebApplication -MockWith { return $null @@ -56,10 +56,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name 'The web application property value does not match' -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Key = 'PropertyKey' - Value = 'NewPropertyValue' - Ensure ='Present' + WebAppUrl = "http://sharepoint.contoso.com" + Key = 'PropertyKey' + Value = 'NewPropertyValue' + Ensure = 'Present' } $result = Get-TargetResource @testParams @@ -90,10 +90,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name 'The web application property exists, and the value match' -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Key = 'PropertyKey' - Value = 'PropertyValue' - Ensure = 'Present' + WebAppUrl = "http://sharepoint.contoso.com" + Key = 'PropertyKey' + Value = 'PropertyValue' + Ensure = 'Present' } $result = Get-TargetResource @testParams @@ -114,10 +114,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name 'The web application property does not exist, and should be removed' -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Key = 'NonExistingPropertyKey' - Value = 'PropertyValue' - Ensure = 'Absent' + WebAppUrl = "http://sharepoint.contoso.com" + Key = 'NonExistingPropertyKey' + Value = 'PropertyValue' + Ensure = 'Absent' } $result = Get-TargetResource @testParams @@ -138,10 +138,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name 'The web application property exists, and should not be' -Fixture { $testParams = @{ - WebAppUrl = "http://sharepoint.contoso.com" - Key = 'PropertyKey' - Value = 'PropertyValue' - Ensure = 'Absent' + WebAppUrl = "http://sharepoint.contoso.com" + Key = 'PropertyKey' + Value = 'PropertyValue' + Ensure = 'Absent' } $result = Get-TargetResource @testParams diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppProxyGroup.tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppProxyGroup.tests.ps1 index 09d542e69..505b8dce3 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppProxyGroup.tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppProxyGroup.tests.ps1 @@ -1,18 +1,18 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWebAppProxyGroup" + -DscResource "SPWebAppProxyGroup" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -20,17 +20,17 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Initialize tests - # Mocks for all contexts + # Mocks for all contexts Mock -CommandName Set-SPWebApplication -MockWith { } # Test contexts Context -Name "WebApplication does not exist" -Fixture { $testParams = @{ - WebAppUrl = "https://web.contoso.com" - ServiceAppProxyGroup = "Web1ProxyGroup" + WebAppUrl = "https://web.contoso.com" + ServiceAppProxyGroup = "Web1ProxyGroup" } - Mock -CommandName Get-SPWebApplication -MockWIth {} + Mock -CommandName Get-SPWebApplication -MockWIth { } It "Should return null property from the get method" { (Get-TargetResource @testParams).WebAppUrl | Should Be $null @@ -44,13 +44,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "WebApplication Proxy Group connection matches desired config" -Fixture { $testParams = @{ - WebAppUrl = "https://web.contoso.com" - ServiceAppProxyGroup = "Web1ProxyGroup" + WebAppUrl = "https://web.contoso.com" + ServiceAppProxyGroup = "Web1ProxyGroup" } - Mock -CommandName Get-SPWebApplication -MockWIth { - return @{ - ServiceApplicationProxyGroup = @{ + Mock -CommandName Get-SPWebApplication -MockWIth { + return @{ + ServiceApplicationProxyGroup = @{ Name = "Web1ProxyGroup" } } @@ -67,26 +67,26 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "WebApplication Proxy Group connection does not match desired config" -Fixture { $testParams = @{ - WebAppUrl = "https://web.contoso.com" - ServiceAppProxyGroup = "Default" + WebAppUrl = "https://web.contoso.com" + ServiceAppProxyGroup = "Default" } - Mock -CommandName Get-SPWebApplication -MockWIth { - return @{ - ServiceApplicationProxyGroup = @{ + Mock -CommandName Get-SPWebApplication -MockWIth { + return @{ + ServiceApplicationProxyGroup = @{ Name = "Web1ProxyGroup" } - } + } } - + It "Should return values from the get method" { (Get-TargetResource @testParams).ServiceAppProxyGroup | Should Be "Web1ProxyGroup" } It "Should return false from the test method" { - Test-TargetResource @testParams | Should Be $false + Test-TargetResource @testParams | Should Be $false } - + It "Should update the webapplication from the set method" { Set-TargetResource @testParams Assert-MockCalled Set-SPWebApplication diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppSiteUseAndDeletion.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppSiteUseAndDeletion.Tests.ps1 index 5f4b45edb..3657f3aa0 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppSiteUseAndDeletion.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppSiteUseAndDeletion.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWebAppSiteUseAndDeletion" + -DscResource "SPWebAppSiteUseAndDeletion" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -56,7 +56,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { UnusedSiteNotificationsBeforeDeletion = 30 } - Mock -CommandName Get-SPWebApplication -MockWith { + Mock -CommandName Get-SPWebApplication -MockWith { return $null } @@ -82,18 +82,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { UnusedSiteNotificationsBeforeDeletion = 24 } - Mock -CommandName Get-SPWebApplication -MockWith { + Mock -CommandName Get-SPWebApplication -MockWith { $returnVal = @{ - SendUnusedSiteCollectionNotifications = $false - UnusedSiteNotificationPeriod = @{ TotalDays = 45; } - AutomaticallyDeleteUnusedSiteCollections = $false - UnusedSiteNotificationsBeforeDeletion = 28 + SendUnusedSiteCollectionNotifications = $false + UnusedSiteNotificationPeriod = @{ TotalDays = 45; } + AutomaticallyDeleteUnusedSiteCollections = $false + UnusedSiteNotificationsBeforeDeletion = 28 } $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscSiteUseUpdated = $true } -PassThru return $returnVal } - Mock -CommandName Get-SPFarm -MockWith { return @{} } + Mock -CommandName Get-SPFarm -MockWith { return @{ } } It "Should throw an exception - Daily schedule" { Mock -CommandName Get-SPTimerJob -MockWith { @@ -144,17 +144,17 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { UnusedSiteNotificationsBeforeDeletion = 30 } - Mock -CommandName Get-SPWebApplication -MockWith { + Mock -CommandName Get-SPWebApplication -MockWith { $returnVal = @{ - SendUnusedSiteCollectionNotifications = $false - UnusedSiteNotificationPeriod = @{ TotalDays = 45; } - AutomaticallyDeleteUnusedSiteCollections = $false - UnusedSiteNotificationsBeforeDeletion = 28 + SendUnusedSiteCollectionNotifications = $false + UnusedSiteNotificationPeriod = @{ TotalDays = 45; } + AutomaticallyDeleteUnusedSiteCollections = $false + UnusedSiteNotificationsBeforeDeletion = 28 } return $returnVal } - Mock -CommandName Get-SPFarm -MockWith { return @{} } + Mock -CommandName Get-SPFarm -MockWith { return @{ } } Mock -CommandName Get-SPTimerJob -MockWith { return $null } It "Should update the Site Use and Deletion settings" { @@ -171,18 +171,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { UnusedSiteNotificationsBeforeDeletion = 30 } - Mock -CommandName Get-SPWebApplication -MockWith { + Mock -CommandName Get-SPWebApplication -MockWith { $returnVal = @{ - SendUnusedSiteCollectionNotifications = $false - UnusedSiteNotificationPeriod = @{ TotalDays = 45; } - AutomaticallyDeleteUnusedSiteCollections = $false - UnusedSiteNotificationsBeforeDeletion = 28 + SendUnusedSiteCollectionNotifications = $false + UnusedSiteNotificationPeriod = @{ TotalDays = 45; } + AutomaticallyDeleteUnusedSiteCollections = $false + UnusedSiteNotificationsBeforeDeletion = 28 } $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscSiteUseUpdated = $true } -PassThru return $returnVal } - Mock -CommandName Get-SPFarm -MockWith { return @{} } + Mock -CommandName Get-SPFarm -MockWith { return @{ } } Mock -CommandName Get-SPTimerJob -MockWith { return @{ Schedule = @{ @@ -215,7 +215,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { UnusedSiteNotificationsBeforeDeletion = 30 } - Mock -CommandName Get-SPWebApplication -MockWith { + Mock -CommandName Get-SPWebApplication -MockWith { $returnVal = @{ SendUnusedSiteCollectionNotifications = $true UnusedSiteNotificationPeriod = @{ TotalDays = 90; } @@ -225,7 +225,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscSiteUseUpdated = $true } -PassThru return $returnVal } - Mock -CommandName Get-SPFarm -MockWith { return @{} } + Mock -CommandName Get-SPFarm -MockWith { return @{ } } It "Should return SendUnusedSiteCollectionNotifications=True from the get method" { (Get-TargetResource @testParams).SendUnusedSiteCollectionNotifications | Should Be $true diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppSuiteBar.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppSuiteBar.Tests.ps1 index 1d97e53f6..6f84d8525 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppSuiteBar.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppSuiteBar.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWebAppSuiteBar" + -DscResource "SPWebAppSuiteBar" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -26,7 +26,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Web application does not exist" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" SuiteBarBrandingElementHtml = "
Test
" } @@ -50,18 +50,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { Context -Name "Only all SP2016 parameters passed for a SP2013 environment" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" SuiteNavBrandingLogoNavigationUrl = "http://sites.sharepoint.com" - SuiteNavBrandingLogoTitle = "LogoTitle" - SuiteNavBrandingLogoUrl = "http://sites.sharepoint.com/images/logo.gif" - SuiteNavBrandingText = "Suite Bar Text" + SuiteNavBrandingLogoTitle = "LogoTitle" + SuiteNavBrandingLogoUrl = "http://sites.sharepoint.com/images/logo.gif" + SuiteNavBrandingText = "Suite Bar Text" } - Mock -CommandName Get-SPWebApplication -MockWith {return @(@{ - DisplayName = "Test Web App" - Url = "http://sites.sharepoint.com" - SuiteBarBrandingElementHtml = "
Test
" - })} + Mock -CommandName Get-SPWebApplication -MockWith { return @(@{ + DisplayName = "Test Web App" + Url = "http://sites.sharepoint.com" + SuiteBarBrandingElementHtml = "
Test
" + }) } It "return error that invalid sp2013 parameters were passed" { { Set-TargetResource @testParams } | Should Throw "Cannot specify SuiteNavBrandingLogoNavigationUrl, SuiteNavBrandingLogoTitle, SuiteNavBrandingLogoUrl or SuiteNavBrandingText with SharePoint 2013. Instead, only specify the SuiteBarBrandingElementHtml parameter" @@ -70,16 +70,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Only some SP2016 parameters passed for a SP2013 environment" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" SuiteNavBrandingLogoNavigationUrl = "http://sites.sharepoint.com" - SuiteNavBrandingText = "Suite Bar Text" + SuiteNavBrandingText = "Suite Bar Text" } - Mock -CommandName Get-SPWebApplication -MockWith {return @(@{ - DisplayName = "Test Web App" - Url = "http://sites.sharepoint.com" - SuiteBarBrandingElementHtml = "
Test
" - })} + Mock -CommandName Get-SPWebApplication -MockWith { return @(@{ + DisplayName = "Test Web App" + Url = "http://sites.sharepoint.com" + SuiteBarBrandingElementHtml = "
Test
" + }) } It "return error that invalid sp2013 parameters were passed" { { Set-TargetResource @testParams } | Should Throw "Cannot specify SuiteNavBrandingLogoNavigationUrl, SuiteNavBrandingLogoTitle, SuiteNavBrandingLogoUrl or SuiteNavBrandingText with SharePoint 2013. Instead, only specify the SuiteBarBrandingElementHtml parameter" @@ -88,19 +88,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Only the SP2013 parameter passed for a SP2013 environment" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" SuiteBarBrandingElementHtml = "
Test
" } Mock -CommandName Get-SPWebApplication -MockWith { $webApp = @{ - DisplayName = "Test Web App" - Url = "http://sites.sharepoint.com" - SuiteBarBrandingElementHtml = "
Test
" + DisplayName = "Test Web App" + Url = "http://sites.sharepoint.com" + SuiteBarBrandingElementHtml = "
Test
" SuiteNavBrandingLogoNavigationUrl = $null - SuiteNavBrandingLogoTitle = $null - SuiteNavBrandingLogoUrl = $null - SuiteNavBrandingText = $null + SuiteNavBrandingLogoTitle = $null + SuiteNavBrandingLogoUrl = $null + SuiteNavBrandingText = $null } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true @@ -140,15 +140,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Context -Name "Configured values does not match" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" SuiteBarBrandingElementHtml = "
Test
" } Mock -CommandName Get-SPWebApplication -MockWith { return @(@{ - DisplayName = "Test Web App" - Url = "http://sites.sharepoint.com" - SuiteBarBrandingElementHtml = "
Another Test
" - })} + DisplayName = "Test Web App" + Url = "http://sites.sharepoint.com" + SuiteBarBrandingElementHtml = "
Another Test
" + }) } It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false @@ -159,23 +159,23 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { Context -Name "Only all SP2016 parameters passed for a SP2016 environment" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" SuiteNavBrandingLogoNavigationUrl = "http://sites.sharepoint.com" - SuiteNavBrandingLogoTitle = "LogoTitle" - SuiteNavBrandingLogoUrl = "http://sites.sharepoint.com/images/logo.gif" - SuiteNavBrandingText = "Suite Bar Text" - SuiteBarBrandingElementHtml = "
Test
" + SuiteNavBrandingLogoTitle = "LogoTitle" + SuiteNavBrandingLogoUrl = "http://sites.sharepoint.com/images/logo.gif" + SuiteNavBrandingText = "Suite Bar Text" + SuiteBarBrandingElementHtml = "
Test
" } Mock -CommandName Get-SPWebApplication -MockWith { $webApp = @{ - DisplayName = "Test Web App" - Url = "http://sites.sharepoint.com" + DisplayName = "Test Web App" + Url = "http://sites.sharepoint.com" SuiteNavBrandingLogoNavigationUrl = "http://sites.sharepoint.com" - SuiteNavBrandingLogoTitle = "LogoTitle" - SuiteNavBrandingLogoUrl = "http://sites.sharepoint.com/images/logo.gif" - SuiteNavBrandingText = "Suite Bar Text" - SuiteBarBrandingElementHtml = "
Test
" + SuiteNavBrandingLogoTitle = "LogoTitle" + SuiteNavBrandingLogoUrl = "http://sites.sharepoint.com/images/logo.gif" + SuiteNavBrandingText = "Suite Bar Text" + SuiteBarBrandingElementHtml = "
Test
" } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true @@ -204,20 +204,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Only some SP2016 parameters passed for a SP2016 environment" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" SuiteNavBrandingLogoNavigationUrl = "http://sites.sharepoint.com" - SuiteNavBrandingText = "Suite Bar Text" + SuiteNavBrandingText = "Suite Bar Text" } Mock -CommandName Get-SPWebApplication -MockWith { $webApp = @{ - DisplayName = "Test Web App" - Url = "http://sites.sharepoint.com" + DisplayName = "Test Web App" + Url = "http://sites.sharepoint.com" SuiteNavBrandingLogoNavigationUrl = "http://sites.sharepoint.com" - SuiteNavBrandingLogoTitle = "LogoTitle" - SuiteNavBrandingLogoUrl = "http://sites.sharepoint.com/images/logo.gif" - SuiteNavBrandingText = "Suite Bar Text" - SuiteBarBrandingElementHtml = "
Test
" + SuiteNavBrandingLogoTitle = "LogoTitle" + SuiteNavBrandingLogoUrl = "http://sites.sharepoint.com/images/logo.gif" + SuiteNavBrandingText = "Suite Bar Text" + SuiteBarBrandingElementHtml = "
Test
" } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true @@ -249,13 +249,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-SPWebApplication -MockWith { return @(@{ - DisplayName = "Test Web App" - Url = "http://sites.sharepoint.com" - SuiteNavBrandingLogoNavigationUrl = "http://sites.sharepoint.com" - SuiteNavBrandingLogoTitle = "LogoTitle" - SuiteNavBrandingLogoUrl = "http://sites.sharepoint.com/images/logo.gif" - SuiteNavBrandingText = "Suite Bar Text" - })} + DisplayName = "Test Web App" + Url = "http://sites.sharepoint.com" + SuiteNavBrandingLogoNavigationUrl = "http://sites.sharepoint.com" + SuiteNavBrandingLogoTitle = "LogoTitle" + SuiteNavBrandingLogoUrl = "http://sites.sharepoint.com/images/logo.gif" + SuiteNavBrandingText = "Suite Bar Text" + }) } It "return error that sp2016 parameters are required" { { Set-TargetResource @testParams } | Should Throw "You need to specify a value for either SuiteNavBrandingLogoNavigationUrl, SuiteNavBrandingLogoTitle, SuiteNavBrandingLogoUrl, SuiteNavBrandingText or SuiteBarBrandingElementHtml with SharePoint 2016 or 2019" @@ -264,21 +264,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "Configured values does not match" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" + WebAppUrl = "http://sites.sharepoint.com" SuiteNavBrandingLogoNavigationUrl = "http://sites.sharepoint.com" - SuiteNavBrandingLogoTitle = "LogoTitle" - SuiteNavBrandingLogoUrl = "http://sites.sharepoint.com/images/logo.gif" - SuiteNavBrandingText = "Suite Bar Text" + SuiteNavBrandingLogoTitle = "LogoTitle" + SuiteNavBrandingLogoUrl = "http://sites.sharepoint.com/images/logo.gif" + SuiteNavBrandingText = "Suite Bar Text" } Mock -CommandName Get-SPWebApplication -MockWith { return @(@{ - DisplayName = "Test Web App" - Url = "http://sites.sharepoint.com" - SuiteNavBrandingLogoNavigationUrl = "http://anothersite.sharepoint.com" - SuiteNavBrandingLogoTitle = "AnotherLogoTitle" - SuiteNavBrandingLogoUrl = "http://anothersite.sharepoint.com/images/logo.gif" - SuiteNavBrandingText = "Another Suite Bar Text" - })} + DisplayName = "Test Web App" + Url = "http://sites.sharepoint.com" + SuiteNavBrandingLogoNavigationUrl = "http://anothersite.sharepoint.com" + SuiteNavBrandingLogoTitle = "AnotherLogoTitle" + SuiteNavBrandingLogoUrl = "http://anothersite.sharepoint.com/images/logo.gif" + SuiteNavBrandingText = "Another Suite Bar Text" + }) } It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppThrottlingSettings.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppThrottlingSettings.Tests.ps1 index b397e6e83..27964a74e 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppThrottlingSettings.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppThrottlingSettings.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWebAppThrottlingSettings" + -DscResource "SPWebAppThrottlingSettings" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -26,65 +26,65 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ DisableKerberos = $true - AllowAnonymous = $false + AllowAnonymous = $false } } # Test contexts Context -Name "The web appliation exists and has the correct throttling settings" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - ListViewThreshold = 1000 - AllowObjectModelOverride = $true - AdminThreshold = 2000 - ListViewLookupThreshold = 12 - HappyHourEnabled = $true - HappyHour = (New-CimInstance -ClassName MSFT_SPWebApplicationHappyHour -Property @{ - Hour = 2 - Minute = 0 - Duration = 1 - } -ClientOnly) + WebAppUrl = "http://sites.sharepoint.com" + ListViewThreshold = 1000 + AllowObjectModelOverride = $true + AdminThreshold = 2000 + ListViewLookupThreshold = 12 + HappyHourEnabled = $true + HappyHour = (New-CimInstance -ClassName MSFT_SPWebApplicationHappyHour -Property @{ + Hour = 2 + Minute = 0 + Duration = 1 + } -ClientOnly) UniquePermissionThreshold = 100 - RequestThrottling = $true - ChangeLogEnabled = $true - ChangeLogExpiryDays = 30 - EventHandlersEnabled = $true + RequestThrottling = $true + ChangeLogEnabled = $true + ChangeLogExpiryDays = 30 + EventHandlersEnabled = $true } Mock -CommandName Get-SPWebapplication -MockWith { 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.WebAppUrl - 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 - })} + 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.WebAppUrl + 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 "Should return the current data from the get method" { (Get-TargetResource @testParams).ListViewThreshold | Should Be $testParams.ListViewThreshold @@ -97,22 +97,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web appliation exists and uses incorrect throttling settings" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - ListViewThreshold = 1000 - AllowObjectModelOverride = $true - AdminThreshold = 2000 - ListViewLookupThreshold = 12 - HappyHourEnabled = $true - HappyHour = (New-CimInstance -ClassName MSFT_SPWebApplicationHappyHour -Property @{ - Hour = 2 - Minute = 0 - Duration = 1 - } -ClientOnly) + WebAppUrl = "http://sites.sharepoint.com" + ListViewThreshold = 1000 + AllowObjectModelOverride = $true + AdminThreshold = 2000 + ListViewLookupThreshold = 12 + HappyHourEnabled = $true + HappyHour = (New-CimInstance -ClassName MSFT_SPWebApplicationHappyHour -Property @{ + Hour = 2 + Minute = 0 + Duration = 1 + } -ClientOnly) UniquePermissionThreshold = 100 - RequestThrottling = $true - ChangeLogEnabled = $true - ChangeLogExpiryDays = 30 - EventHandlersEnabled = $true + RequestThrottling = $true + ChangeLogEnabled = $true + ChangeLogExpiryDays = 30 + EventHandlersEnabled = $true } Mock -CommandName Get-SPWebapplication -MockWith { @@ -124,36 +124,36 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } -PassThru $webApp = @{ - DisplayName = $testParams.Name - ApplicationPool = @{ - Name = $testParams.ApplicationPool + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool Username = $testParams.ApplicationPoolAccount } - ContentDatabases = @( + ContentDatabases = @( @{ - Name = "SP_Content_01" + Name = "SP_Content_01" Server = "sql.domain.local" } ) - IisSettings = @( + IisSettings = @( @{ Path = "C:\inetpub\wwwroot\something" } ) - Url = $testParams.WebAppUrl - MaxItemsPerThrottledOperation = 1 - AllowOMCodeOverrideThrottleSettings = $testParams.AllowObjectModelOverride - MaxItemsPerThrottledOperationOverride = $testParams.AdminThreshold - MaxQueryLookupFields = $testParams.ListViewLookupThreshold - UnthrottledPrivilegedOperationWindowEnabled = $testParams.HappyHourEnabled - DailyStartUnthrottledPrivilegedOperationsHour = $testParams.HappyHour.Hour + Url = $testParams.WebAppUrl + 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 = $httpThrottle - ChangeLogExpirationEnabled = $testParams.ChangeLogEnabled - ChangeLogRetentionPeriod = @{ + DailyUnthrottledPrivilegedOperationsDuration = $testParams.HappyHour.Duration + MaxUniquePermScopesPerList = $testParams.UniquePermissionThreshold + HttpThrottleSettings = $httpThrottle + ChangeLogExpirationEnabled = $testParams.ChangeLogEnabled + ChangeLogRetentionPeriod = @{ Days = $testParams.ChangeLogExpiryDays } - EventHandlersEnabled = $testParams.EventHandlersEnabled + EventHandlersEnabled = $testParams.EventHandlersEnabled } $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { $Global:SPDscWebApplicationUpdateCalled = $true @@ -179,22 +179,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - ListViewThreshold = 1000 - AllowObjectModelOverride = $true - AdminThreshold = 2000 - ListViewLookupThreshold = 12 - HappyHourEnabled = $true - HappyHour = (New-CimInstance -ClassName MSFT_SPWebApplicationHappyHour -Property @{ - Hour = 5 - Minute = 0 - Duration = 1 - } -ClientOnly) + WebAppUrl = "http://sites.sharepoint.com" + ListViewThreshold = 1000 + AllowObjectModelOverride = $true + AdminThreshold = 2000 + ListViewLookupThreshold = 12 + HappyHourEnabled = $true + HappyHour = (New-CimInstance -ClassName MSFT_SPWebApplicationHappyHour -Property @{ + Hour = 5 + Minute = 0 + Duration = 1 + } -ClientOnly) UniquePermissionThreshold = 100 - RequestThrottling = $true - ChangeLogEnabled = $true - ChangeLogExpiryDays = 30 - EventHandlersEnabled = $true + RequestThrottling = $true + ChangeLogEnabled = $true + ChangeLogExpiryDays = 30 + EventHandlersEnabled = $true } $Global:SPDscWebApplicationUpdateCalled = $false $Global:SPDscWebApplicationUpdateHappyHourCalled = $false @@ -206,53 +206,53 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should throw exceptions where invalid happy hour settings are provided" { $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - AuthenticationMethod = "NTLM" - ThrottlingSettings = (New-CimInstance -ClassName MSFT_SPWebApplicationThrottling -Property @{ - HappyHourEnabled = $true - HappyHour = (New-CimInstance -ClassName MSFT_SPWebApplicationHappyHour -Property @{ - Hour = 100 - Minute = 0 - Duration = 1 + WebAppUrl = "http://sites.sharepoint.com" + AuthenticationMethod = "NTLM" + ThrottlingSettings = (New-CimInstance -ClassName MSFT_SPWebApplicationThrottling -Property @{ + HappyHourEnabled = $true + HappyHour = (New-CimInstance -ClassName MSFT_SPWebApplicationHappyHour -Property @{ + Hour = 100 + Minute = 0 + Duration = 1 + } -ClientOnly) } -ClientOnly) - } -ClientOnly) } { Set-TargetResource @testParams } | Should throw $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - AuthenticationMethod = "NTLM" - ThrottlingSettings = (New-CimInstance -ClassName MSFT_SPWebApplicationThrottling -Property @{ - HappyHourEnabled = $true - HappyHour = (New-CimInstance -ClassName MSFT_SPWebApplicationHappyHour -Property @{ - Hour = 5 - Minute = 100 - Duration = 1 + WebAppUrl = "http://sites.sharepoint.com" + AuthenticationMethod = "NTLM" + ThrottlingSettings = (New-CimInstance -ClassName MSFT_SPWebApplicationThrottling -Property @{ + HappyHourEnabled = $true + HappyHour = (New-CimInstance -ClassName MSFT_SPWebApplicationHappyHour -Property @{ + Hour = 5 + Minute = 100 + Duration = 1 + } -ClientOnly) } -ClientOnly) - } -ClientOnly) } { Set-TargetResource @testParams } | Should throw $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - AuthenticationMethod = "NTLM" - ThrottlingSettings = (New-CimInstance -ClassName MSFT_SPWebApplicationThrottling -Property @{ - HappyHourEnabled = $true - HappyHour = (New-CimInstance -ClassName MSFT_SPWebApplicationHappyHour -Property @{ - Hour = 5 - Minute = 0 - Duration = 100 + WebAppUrl = "http://sites.sharepoint.com" + AuthenticationMethod = "NTLM" + ThrottlingSettings = (New-CimInstance -ClassName MSFT_SPWebApplicationThrottling -Property @{ + HappyHourEnabled = $true + HappyHour = (New-CimInstance -ClassName MSFT_SPWebApplicationHappyHour -Property @{ + Hour = 5 + Minute = 0 + Duration = 100 + } -ClientOnly) } -ClientOnly) - } -ClientOnly) } { Set-TargetResource @testParams } | Should throw } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppWorkflowSettings.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppWorkflowSettings.Tests.ps1 index 72500e6fa..79efbe1a7 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppWorkflowSettings.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebAppWorkflowSettings.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWebAppWorkflowSettings" + -DscResource "SPWebAppWorkflowSettings" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -26,39 +26,39 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ DisableKerberos = $true - AllowAnonymous = $false + AllowAnonymous = $false } } # Test contexts Context -Name "The web appliation exists and has the correct workflow settings" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - ExternalWorkflowParticipantsEnabled = $true - UserDefinedWorkflowsEnabled = $true + WebAppUrl = "http://sites.sharepoint.com" + ExternalWorkflowParticipantsEnabled = $true + UserDefinedWorkflowsEnabled = $true EmailToNoPermissionWorkflowParticipantsEnable = $true } Mock -CommandName Get-SPWebapplication -MockWith { 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.WebAppUrl - UserDefinedWorkflowsEnabled = $true - EmailToNoPermissionWorkflowParticipantsEnabled = $true - ExternalWorkflowParticipantsEnabled = $true - })} + 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.WebAppUrl + UserDefinedWorkflowsEnabled = $true + EmailToNoPermissionWorkflowParticipantsEnabled = $true + ExternalWorkflowParticipantsEnabled = $true + }) } It "Should return the current data from the get method" { Get-TargetResource @testParams | Should Not BeNullOrEmpty @@ -71,35 +71,35 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web appliation exists and uses incorrect workflow settings" -Fixture { $testParams = @{ - WebAppUrl = "http://sites.sharepoint.com" - ExternalWorkflowParticipantsEnabled = $true - UserDefinedWorkflowsEnabled = $true + WebAppUrl = "http://sites.sharepoint.com" + ExternalWorkflowParticipantsEnabled = $true + UserDefinedWorkflowsEnabled = $true EmailToNoPermissionWorkflowParticipantsEnable = $true } Mock -CommandName Get-SPWebapplication -MockWith { $webApp = @{ - DisplayName = $testParams.Name - ApplicationPool = @{ - Name = $testParams.ApplicationPool + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool Username = $testParams.ApplicationPoolAccount } - ContentDatabases = @( + ContentDatabases = @( @{ - Name = "SP_Content_01" + Name = "SP_Content_01" Server = "sql.domain.local" } ) - IisSettings = @( + IisSettings = @( @{ Path = "C:\inetpub\wwwroot\something" } ) - Url = $testParams.WebAppUrl - UserDefinedWorkflowsEnabled = $false + Url = $testParams.WebAppUrl + UserDefinedWorkflowsEnabled = $false EmailToNoPermissionWorkflowParticipantsEnabled = $false - ExternalWorkflowParticipantsEnabled = $false + ExternalWorkflowParticipantsEnabled = $false } - $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value {} -PassThru | - Add-Member -MemberType ScriptMethod -Name UpdateWorkflowConfigurationSettings -Value { + $webApp = $webApp | Add-Member -MemberType ScriptMethod -Name Update -Value { } -PassThru | + Add-Member -MemberType ScriptMethod -Name UpdateWorkflowConfigurationSettings -Value { $Global:SPDscWebApplicationUpdateWorkflowCalled = $true } -PassThru return @($webApp) diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebApplication.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebApplication.Tests.ps1 index 75bc4f69a..6f8aacbe0 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebApplication.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebApplication.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWebApplication" + -DscResource "SPWebApplication" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -24,16 +24,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName New-SPAuthenticationProvider -MockWith { } Mock -CommandName New-SPWebApplication -MockWith { } Mock -CommandName Remove-SPWebApplication -MockWith { } - Mock -CommandName Get-SPManagedAccount -MockWith {} + Mock -CommandName Get-SPManagedAccount -MockWith { } # Test contexts Context -Name "The specified Managed Account does not exist" -Fixture { $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - Ensure = "Present" + WebAppUrl = "http://sites.sharepoint.com" + Ensure = "Present" } Mock -CommandName Get-SPWebapplication -MockWith { return $null } @@ -51,11 +51,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The specified Managed Account does not exist and fails to resolve for unknown reason" -Fixture { $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - Ensure = "Present" + WebAppUrl = "http://sites.sharepoint.com" + Ensure = "Present" } Mock -CommandName Get-SPWebapplication -MockWith { return $null } @@ -67,17 +67,17 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } It "retrieving Managed Account fails in the set method" { - {Set-TargetResource @testParams} | Should Throw "Error occurred. Web application was not created. Error details:" + { Set-TargetResource @testParams } | Should Throw "Error occurred. Web application was not created. Error details:" } } Context -Name "The web application that uses NTLM doesn't exist but should" -Fixture { $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - Ensure = "Present" + WebAppUrl = "http://sites.sharepoint.com" + Ensure = "Present" } Mock -CommandName Get-SPWebapplication -MockWith { return $null } @@ -109,18 +109,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web application that uses Kerberos doesn't exist but should" -Fixture { $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - Ensure = "Present" + WebAppUrl = "http://sites.sharepoint.com" + Ensure = "Present" } Mock -CommandName Get-SPWebapplication -MockWith { return $null } Mock -CommandName Get-SPDscContentService -MockWith { return @{ Name = "PlaceHolder" } } - Mock -CommandName Get-SPManagedAccount -MockWith {} + Mock -CommandName Get-SPManagedAccount -MockWith { } It "Should return absent from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" @@ -139,12 +139,12 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web application does exist and should that uses Classic" -Fixture { $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - UseClassic = $true - Ensure = "Present" + WebAppUrl = "http://sites.sharepoint.com" + UseClassic = $true + Ensure = "Present" } Mock -CommandName Get-SPAuthenticationProvider -MockWith { @@ -152,22 +152,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-SPWebapplication -MockWith { 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.WebAppUrl - })} + 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.WebAppUrl + }) } It "Should return present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" @@ -182,37 +182,37 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web application does exist and should that uses NTLM" -Fixture { $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - Ensure = "Present" + WebAppUrl = "http://sites.sharepoint.com" + Ensure = "Present" } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ DisableKerberos = $true - AllowAnonymous = $false + AllowAnonymous = $false } } Mock -CommandName Get-SPWebapplication -MockWith { 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.WebAppUrl - })} + 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.WebAppUrl + }) } It "Should return present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" @@ -227,37 +227,37 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web application does exist and should that uses Kerberos" -Fixture { $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - Ensure = "Present" + WebAppUrl = "http://sites.sharepoint.com" + Ensure = "Present" } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ DisableKerberos = $false - AllowAnonymous = $false + AllowAnonymous = $false } } Mock -CommandName Get-SPWebapplication -MockWith { 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.WebAppUrl - })} + 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.WebAppUrl + }) } It "Should return present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" @@ -270,38 +270,38 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A web application exists but shouldn't" -Fixture { $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - Ensure = "Absent" + WebAppUrl = "http://sites.sharepoint.com" + Ensure = "Absent" } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $true - AllowAnonymous = $false + AllowAnonymous = $false } } Mock -CommandName Get-SPWebapplication -MockWith { 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.WebAppUrl - })} + 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.WebAppUrl + }) } It "Should return present from the Get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" @@ -319,11 +319,11 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "A web application doesn't exist and shouldn't" -Fixture { $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - Ensure = "Absent" + WebAppUrl = "http://sites.sharepoint.com" + Ensure = "Absent" } Mock -CommandName Get-SPWebapplication -MockWith { return $null } @@ -340,42 +340,42 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web application does exist and should that uses Claims" -Fixture { $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - Ensure = "Present" + WebAppUrl = "http://sites.sharepoint.com" + Ensure = "Present" } - Mock -CommandName Get-SPAuthenticationProvider -MockWith { + Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ - DisplayName = "TestProvider" - LoginProviderName = "TestProvider" - ClaimProviderName = "TestClaimProvider" - AuthenticationRedirectUrl = "/_trust/default.aspx?trust=TestProvider" + DisplayName = "TestProvider" + LoginProviderName = "TestProvider" + ClaimProviderName = "TestClaimProvider" + AuthenticationRedirectUrl = "/_trust/default.aspx?trust=TestProvider" } } Mock -CommandName Get-SPWebApplication -MockWith { return @(@{ - DisplayName = $testParams.Name - ApplicationPool = @{ - Name = $testParams.ApplicationPool - Username = $testParams.ApplicationPoolAccount - } - UseClaimsAuthentication = $true - ContentDatabases = @( - @{ - Name = "SP_Content_01" - Server = "sql.domain.local" + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool + Username = $testParams.ApplicationPoolAccount + } + UseClaimsAuthentication = $true + ContentDatabases = @( + @{ + Name = "SP_Content_01" + Server = "sql.domain.local" + } + ) + IisSettings = @( + @{ Path = "C:\inetpub\wwwroot\something" } + ) + Url = $testParams.WebAppUrl } - ) - IisSettings = @( - @{ Path = "C:\inetpub\wwwroot\something" } - ) - Url = $testParams.WebAppUrl - } - )} + ) } It "Should return present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" @@ -388,42 +388,42 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web application does exist and shouldn't that uses Claims" -Fixture { $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - Ensure = "Absent" + WebAppUrl = "http://sites.sharepoint.com" + Ensure = "Absent" } - Mock -CommandName Get-SPAuthenticationProvider -MockWith { + Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ - DisplayName = "TestProvider" - LoginProviderName = "TestProvider" - ClaimProviderName = "TestClaimProvider" - AuthenticationRedirectUrl = "/_trust/default.aspx?trust=TestProvider" + DisplayName = "TestProvider" + LoginProviderName = "TestProvider" + ClaimProviderName = "TestClaimProvider" + AuthenticationRedirectUrl = "/_trust/default.aspx?trust=TestProvider" } } Mock -CommandName Get-SPWebApplication -MockWith { return @(@{ - DisplayName = $testParams.Name - ApplicationPool = @{ - Name = $testParams.ApplicationPool - Username = $testParams.ApplicationPoolAccount - } - UseClaimsAuthentication = $true - ContentDatabases = @( - @{ - Name = "SP_Content_01" - Server = "sql.domain.local" + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool + Username = $testParams.ApplicationPoolAccount + } + UseClaimsAuthentication = $true + ContentDatabases = @( + @{ + Name = "SP_Content_01" + Server = "sql.domain.local" + } + ) + IisSettings = @( + @{ Path = "C:\inetpub\wwwroot\something" } + ) + Url = $testParams.WebAppUrl } - ) - IisSettings = @( - @{ Path = "C:\inetpub\wwwroot\something" } - ) - Url = $testParams.WebAppUrl - } - )} + ) } It "Should return present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" @@ -436,16 +436,16 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web application doesn't exist and should that uses Claims" -Fixture { $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - Ensure = "Present" - DatabaseServer = "sql.domain.local" - DatabaseName = "SP_Content_01" - HostHeader = "sites.sharepoint.com" - Path = "C:\inetpub\wwwroot\something" - Port = 80 + WebAppUrl = "http://sites.sharepoint.com" + Ensure = "Present" + DatabaseServer = "sql.domain.local" + DatabaseName = "SP_Content_01" + HostHeader = "sites.sharepoint.com" + Path = "C:\inetpub\wwwroot\something" + Port = 80 } Mock -CommandName Get-SPTrustedIdentityTokenIssuer -MockWith { @@ -457,14 +457,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ - DisplayName = $testParams.AuthenticationProvider - LoginProviderName = $testParams.AuthenticationProvider - ClaimProviderName = "TestClaimProvider" - AuthenticationRedirectUrl = "/_trust/default.aspx?trust=$($testParams.AuthenticationProvider)" + DisplayName = $testParams.AuthenticationProvider + LoginProviderName = $testParams.AuthenticationProvider + ClaimProviderName = "TestClaimProvider" + AuthenticationRedirectUrl = "/_trust/default.aspx?trust=$($testParams.AuthenticationProvider)" } } - Mock -CommandName Get-SPDscContentService -MockWith { + Mock -CommandName Get-SPDscContentService -MockWith { @{ ApplicationPools = @( @{ @@ -486,24 +486,24 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName New-SPWebApplication -MockWith { return @(@{ - DisplayName = $testParams.Name - ApplicationPool = @{ - Name = $testParams.ApplicationPool - Username = $testParams.ApplicationPoolAccount - } - USeClaimsAuthentication = $true - ContentDatabases = @( - @{ - Name = "SP_Content_01" - Server = "sql.domain.local" + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool + Username = $testParams.ApplicationPoolAccount + } + USeClaimsAuthentication = $true + ContentDatabases = @( + @{ + Name = "SP_Content_01" + Server = "sql.domain.local" + } + ) + IisSettings = @( + @{ Path = "C:\inetpub\wwwroot\something" } + ) + Url = $testParams.WebAppUrl } ) - IisSettings = @( - @{ Path = "C:\inetpub\wwwroot\something" } - ) - Url = $testParams.WebAppUrl - } - ) } @@ -514,7 +514,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should return false from the test method" { Test-TargetResource @testParams | Should Be $false } - It "Should call the new SPWebApplication cmdlet from the set method" { + It "Should call the new SPWebApplication cmdlet from the set method" { Set-TargetResource @testParams Assert-MockCalled New-SPWebApplication } @@ -525,20 +525,20 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web application doesn't exist and shouldn't that uses Claims" -Fixture { $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - Ensure = "Absent" + WebAppUrl = "http://sites.sharepoint.com" + Ensure = "Absent" } - Mock -CommandName Get-SPAuthenticationProvider -MockWith { + Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ - DisplayName = "TestProvider" - LoginProviderName = "TestProvider" - ClaimProviderName = "TestClaimProvider" - AuthenticationRedirectUrl = "/_trust/default.aspx?trust=TestProvider" + DisplayName = "TestProvider" + LoginProviderName = "TestProvider" + ClaimProviderName = "TestClaimProvider" + AuthenticationRedirectUrl = "/_trust/default.aspx?trust=TestProvider" } } @@ -558,18 +558,18 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web application doesn't exists authentication method is specified with NTLM provider" -Fixture { $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - Ensure = "Present" + WebAppUrl = "http://sites.sharepoint.com" + Ensure = "Present" } - Mock -CommandName Get-SPAuthenticationProvider -MockWith { + Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $true - AllowAnonymous = $false + AllowAnonymous = $false } } @@ -588,42 +588,42 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web application does exist and authentication method is specified with Kerberos provider" -Fixture { $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - Ensure = "Present" + WebAppUrl = "http://sites.sharepoint.com" + Ensure = "Present" } - Mock -CommandName Get-SPAuthenticationProvider -MockWith { + Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $false - AllowAnonymous = $false + AllowAnonymous = $false } } - Mock -CommandName Get-SPWebApplication -MockWith { return @(@{ - DisplayName = $testParams.Name - ApplicationPool = @{ - Name = $testParams.ApplicationPool - Username = $testParams.ApplicationPoolAccount - } - USeClaimsAuthentication = $false - ContentDatabases = @( - @{ - Name = "SP_Content_01" - Server = "sql.domain.local" + Mock -CommandName Get-SPWebApplication -MockWith { return @(@{ + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool + Username = $testParams.ApplicationPoolAccount + } + USeClaimsAuthentication = $false + ContentDatabases = @( + @{ + Name = "SP_Content_01" + Server = "sql.domain.local" + } + ) + IisSettings = @( + @{ Path = "C:\inetpub\wwwroot\something" } + ) + Url = $testParams.WebAppUrl } - ) - IisSettings = @( - @{ Path = "C:\inetpub\wwwroot\something" } - ) - Url = $testParams.WebAppUrl - } - )} + ) } It "Should return present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" @@ -636,22 +636,22 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The web application does not exist and should that uses NTLM" -Fixture { $testParams = @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Web Apps" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" - WebAppUrl = "http://sites.sharepoint.com" - Ensure = "Present" - DatabaseServer = "sql.domain.local" - DatabaseName = "SP_Content_01" - HostHeader = "sites.sharepoint.com" - Path = "C:\inetpub\wwwroot\something" - Port = 80 + WebAppUrl = "http://sites.sharepoint.com" + Ensure = "Present" + DatabaseServer = "sql.domain.local" + DatabaseName = "SP_Content_01" + HostHeader = "sites.sharepoint.com" + Path = "C:\inetpub\wwwroot\something" + Port = 80 } Mock -CommandName Get-SPDscContentService -MockWith { ApplicationPools = @( - @{ + @{ Name = $testParams.ApplicationPool }, @{ @@ -664,9 +664,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $true - AllowAnonymous = $false + AllowAnonymous = $false } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebApplicationAppDomain.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebApplicationAppDomain.Tests.ps1 index 8a4d467e1..c1e4ea293 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebApplicationAppDomain.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebApplicationAppDomain.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWebApplicationAppDomain" + -DscResource "SPWebApplicationAppDomain" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -29,10 +29,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "No app domain settings have been configured for the specified web app and zone" -Fixture { $testParams = @{ AppDomain = "contosointranetapps.com" - WebAppUrl ="http://portal.contoso.com" - Zone = "Default" - Port = 80; - SSL = $false + WebAppUrl = "http://portal.contoso.com" + Zone = "Default" + Port = 80; + SSL = $false } Mock -CommandName Get-SPWebApplicationAppDomain -MockWith { return $null } @@ -54,17 +54,17 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "An app domain has been configured for the specified web app and zone but it's not correct" -Fixture { $testParams = @{ AppDomain = "contosointranetapps.com" - WebAppUrl ="http://portal.contoso.com" - Zone = "Default" - Port = 80; - SSL = $false + WebAppUrl = "http://portal.contoso.com" + Zone = "Default" + Port = 80; + SSL = $false } Mock -CommandName Get-SPWebApplicationAppDomain -MockWith { return @{ - AppDomain = "wrong.domain" - UrlZone = $testParams.Zone - Port = $testParams.Port + AppDomain = "wrong.domain" + UrlZone = $testParams.Zone + Port = $testParams.Port IsSchemeSSL = $testParams.SSL } } @@ -87,17 +87,17 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The correct app domain has been configued for the requested web app and zone" -Fixture { $testParams = @{ AppDomain = "contosointranetapps.com" - WebAppUrl ="http://portal.contoso.com" - Zone = "Default" - Port = 80; - SSL = $false + WebAppUrl = "http://portal.contoso.com" + Zone = "Default" + Port = 80; + SSL = $false } Mock -CommandName Get-SPWebApplicationAppDomain -MockWith { return @{ - AppDomain = $testParams.AppDomain - UrlZone = $testParams.Zone - Port = $testParams.Port + AppDomain = $testParams.AppDomain + UrlZone = $testParams.Zone + Port = $testParams.Port IsSchemeSSL = $testParams.SSL } } @@ -114,15 +114,15 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "The functions operate without optional parameters included" -Fixture { $testParams = @{ AppDomain = "contosointranetapps.com" - WebAppUrl ="http://portal.contoso.com" - Zone = "Default" + WebAppUrl = "http://portal.contoso.com" + Zone = "Default" } Mock -CommandName Get-SPWebApplicationAppDomain -MockWith { return @{ - AppDomain = "invalid.domain" - UrlZone = $testParams.Zone - Port = $testParams.Port + AppDomain = "invalid.domain" + UrlZone = $testParams.Zone + Port = $testParams.Port IsSchemeSSL = $testParams.SSL } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebApplicationExtension.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebApplicationExtension.Tests.ps1 index 4cf5ea354..e717305df 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWebApplicationExtension.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWebApplicationExtension.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWebApplicationExtension" + -DscResource "SPWebApplicationExtension" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -46,10 +46,10 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The parent web application does not exist" -Fixture { $testParams = @{ WebAppUrl = "http://nosuchwebapplication.sharepoint.com" - Name = "Intranet Zone" - Url = "http://intranet.sharepoint.com" - Zone = "Intranet" - Ensure = "Present" + Name = "Intranet Zone" + Url = "http://intranet.sharepoint.com" + Zone = "Intranet" + Ensure = "Present" } Mock -CommandName Get-SPWebapplication -MockWith { return $null } @@ -70,17 +70,17 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The web application extension that uses NTLM authentication doesn't exist but should" -Fixture { $testParams = @{ WebAppUrl = "http://company.sharepoint.com" - Name = "Intranet Zone" - Url = "http://intranet.sharepoint.com" - Zone = "Intranet" - Ensure = "Present" + Name = "Intranet Zone" + Url = "http://intranet.sharepoint.com" + Zone = "Intranet" + Ensure = "Present" } Mock -CommandName Get-SPWebapplication -MockWith { - return @{ - DisplayName = "Company SharePoint" - URL = "http://company.sharepoint.com" - IISSettings = @() + return @{ + DisplayName = "Company SharePoint" + URL = "http://company.sharepoint.com" + IISSettings = @() } } @@ -109,17 +109,17 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The web application extension that uses Kerberos doesn't exist but should" -Fixture { $testParams = @{ WebAppUrl = "http://company.sharepoint.com" - Name = "Intranet Zone" - Url = "http://intranet.sharepoint.com" - Zone = "Intranet" - Ensure = "Present" + Name = "Intranet Zone" + Url = "http://intranet.sharepoint.com" + Zone = "Intranet" + Ensure = "Present" } - Mock -CommandName Get-SPWebapplication -MockWith { - return @{ - DisplayName = "Company SharePoint" - URL = "http://company.sharepoint.com" - IISSettings = @() + Mock -CommandName Get-SPWebapplication -MockWith { + return @{ + DisplayName = "Company SharePoint" + URL = "http://company.sharepoint.com" + IISSettings = @() } } @@ -141,40 +141,40 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The web application extension does exist and should use NTLM without AllowAnonymous" -Fixture { $testParams = @{ - WebAppUrl = "http://company.sharepoint.com" - Name = "Intranet Zone" - Url = "http://intranet.sharepoint.com" + WebAppUrl = "http://company.sharepoint.com" + Name = "Intranet Zone" + Url = "http://intranet.sharepoint.com" HostHeader = "intranet.sharepoint.com" - Zone = "Intranet" - Ensure = "Present" + Zone = "Intranet" + Ensure = "Present" } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $true } } - Mock -CommandName Get-SPWebapplication -MockWith { - $IISSettings = @( - @{} - @{ - SecureBindings = @{} - ServerBindings = @{ - HostHeader = "intranet.sharepoint.com" - Port = 80 - } - AllowAnonymous = $false - }) - - return ( - @{ - DisplayName = "Company SharePoint" - URL = "http://company.sharepoint.com" - IISSettings = $IISSettings - } | add-member ScriptMethod Update { $Global:WebAppUpdateCalled = $true} -PassThru - ) + Mock -CommandName Get-SPWebapplication -MockWith { + $IISSettings = @( + @{ } + @{ + SecureBindings = @{ } + ServerBindings = @{ + HostHeader = "intranet.sharepoint.com" + Port = 80 + } + AllowAnonymous = $false + }) + + return ( + @{ + DisplayName = "Company SharePoint" + URL = "http://company.sharepoint.com" + IISSettings = $IISSettings + } | add-member ScriptMethod Update { $Global:WebAppUpdateCalled = $true } -PassThru + ) } Mock -CommandName Get-SPAlternateUrl -MockWith { @@ -200,41 +200,41 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The web application extension does exist and should use NTLM without AllowAnonymous and with HTTPS" -Fixture { $testParams = @{ - WebAppUrl = "http://company.sharepoint.com" - Name = "Intranet Zone" - Url = "https://intranet.sharepoint.com" + WebAppUrl = "http://company.sharepoint.com" + Name = "Intranet Zone" + Url = "https://intranet.sharepoint.com" HostHeader = "intranet.sharepoint.com" - UseSSL = $true - Zone = "Intranet" - Ensure = "Present" + UseSSL = $true + Zone = "Intranet" + Ensure = "Present" } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $true } } - Mock -CommandName Get-SPWebapplication -MockWith { - $IISSettings = @( - @{} - @{ - SecureBindings = @{ - HostHeader = "intranet.sharepoint.com" - Port = 443 - } - ServerBindings = @{} - AllowAnonymous = $false - }) - - return ( - @{ - DisplayName = "Company SharePoint" - URL = "http://company.sharepoint.com" - IISSettings = $IISSettings - } | add-member ScriptMethod Update { $Global:WebAppUpdateCalled = $true} -PassThru - ) + Mock -CommandName Get-SPWebapplication -MockWith { + $IISSettings = @( + @{ } + @{ + SecureBindings = @{ + HostHeader = "intranet.sharepoint.com" + Port = 443 + } + ServerBindings = @{ } + AllowAnonymous = $false + }) + + return ( + @{ + DisplayName = "Company SharePoint" + URL = "http://company.sharepoint.com" + IISSettings = $IISSettings + } | add-member ScriptMethod Update { $Global:WebAppUpdateCalled = $true } -PassThru + ) } Mock -CommandName Get-SPAlternateUrl -MockWith { @@ -260,41 +260,41 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The web application extension does exist and should use NTLM and AllowAnonymous" -Fixture { $testParams = @{ - WebAppUrl = "http://company.sharepoint.com" - Name = "Intranet Zone" - Url = "http://intranet.sharepoint.com" + WebAppUrl = "http://company.sharepoint.com" + Name = "Intranet Zone" + Url = "http://intranet.sharepoint.com" HostHeader = "intranet.sharepoint.com" - Zone = "Intranet" - Ensure = "Present" + Zone = "Intranet" + Ensure = "Present" } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $true - AllowAnonymous = $true + AllowAnonymous = $true } } - Mock -CommandName Get-SPWebapplication -MockWith { - $IISSettings = @( - @{} - @{ - SecureBindings = @{} - ServerBindings = @{ - HostHeader = "intranet.sharepoint.com" - Port = 80 - } - AllowAnonymous = $true - }) - - return ( - @{ - DisplayName = "Company SharePoint" - URL = "http://company.sharepoint.com" - IISSettings = $IISSettings - } | add-member ScriptMethod Update { $Global:WebAppUpdateCalled = $true} -PassThru - ) + Mock -CommandName Get-SPWebapplication -MockWith { + $IISSettings = @( + @{ } + @{ + SecureBindings = @{ } + ServerBindings = @{ + HostHeader = "intranet.sharepoint.com" + Port = 80 + } + AllowAnonymous = $true + }) + + return ( + @{ + DisplayName = "Company SharePoint" + URL = "http://company.sharepoint.com" + IISSettings = $IISSettings + } | add-member ScriptMethod Update { $Global:WebAppUpdateCalled = $true } -PassThru + ) } Mock -CommandName Get-SPAlternateUrl -MockWith { @@ -320,40 +320,40 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The web application extension does exist and should use Kerberos without AllowAnonymous" -Fixture { $testParams = @{ - WebAppUrl = "http://company.sharepoint.com" - Name = "Intranet Zone" - Url = "http://intranet.sharepoint.com" + WebAppUrl = "http://company.sharepoint.com" + Name = "Intranet Zone" + Url = "http://intranet.sharepoint.com" HostHeader = "intranet.sharepoint.com" - Zone = "Intranet" - Ensure = "Present" + Zone = "Intranet" + Ensure = "Present" } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $false } } - Mock -CommandName Get-SPWebapplication -MockWith { - $IISSettings = @( - @{} - @{ - SecureBindings = @{} - ServerBindings = @{ - HostHeader = "intranet.sharepoint.com" - Port = 80 - } - AllowAnonymous = $false - }) - - return ( - @{ - DisplayName = "Company SharePoint" - URL = "http://company.sharepoint.com" - IISSettings = $IISSettings - } | add-member ScriptMethod Update { $Global:WebAppUpdateCalled = $true} -PassThru - ) + Mock -CommandName Get-SPWebapplication -MockWith { + $IISSettings = @( + @{ } + @{ + SecureBindings = @{ } + ServerBindings = @{ + HostHeader = "intranet.sharepoint.com" + Port = 80 + } + AllowAnonymous = $false + }) + + return ( + @{ + DisplayName = "Company SharePoint" + URL = "http://company.sharepoint.com" + IISSettings = $IISSettings + } | add-member ScriptMethod Update { $Global:WebAppUpdateCalled = $true } -PassThru + ) } Mock -CommandName Get-SPAlternateUrl -MockWith { @@ -379,41 +379,41 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The web application extension does exist and should use Kerberos and AllowAnonymous" -Fixture { $testParams = @{ - WebAppUrl = "http://company.sharepoint.com" - Name = "Intranet Zone" - Url = "http://intranet.sharepoint.com" + WebAppUrl = "http://company.sharepoint.com" + Name = "Intranet Zone" + Url = "http://intranet.sharepoint.com" HostHeader = "intranet.sharepoint.com" - Zone = "Intranet" - Ensure = "Present" + Zone = "Intranet" + Ensure = "Present" } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $false - AllowAnonymous = $true + AllowAnonymous = $true } } - Mock -CommandName Get-SPWebapplication -MockWith { - $IISSettings = @( - @{} - @{ - SecureBindings = @{} - ServerBindings = @{ - HostHeader = "intranet.sharepoint.com" - Port = 80 - } - AllowAnonymous = $true - }) - - return ( - @{ - DisplayName = "Company SharePoint" - URL = "http://company.sharepoint.com" - IISSettings = $IISSettings - } | add-member ScriptMethod Update { $Global:WebAppUpdateCalled = $true} -PassThru - ) + Mock -CommandName Get-SPWebapplication -MockWith { + $IISSettings = @( + @{ } + @{ + SecureBindings = @{ } + ServerBindings = @{ + HostHeader = "intranet.sharepoint.com" + Port = 80 + } + AllowAnonymous = $true + }) + + return ( + @{ + DisplayName = "Company SharePoint" + URL = "http://company.sharepoint.com" + IISSettings = $IISSettings + } | add-member ScriptMethod Update { $Global:WebAppUpdateCalled = $true } -PassThru + ) } Mock -CommandName Get-SPAlternateUrl -MockWith { @@ -438,41 +438,41 @@ namespace Microsoft.SharePoint.Administration { Context -Name "The web application extension does exist and should with mismatched AllowAnonymous" -Fixture { $testParams = @{ - WebAppUrl = "http://company.sharepoint.com" - Name = "Intranet Zone" - Url = "http://intranet.sharepoint.com" - HostHeader = "intranet.sharepoint.com" - Zone = "Intranet" + WebAppUrl = "http://company.sharepoint.com" + Name = "Intranet Zone" + Url = "http://intranet.sharepoint.com" + HostHeader = "intranet.sharepoint.com" + Zone = "Intranet" AllowAnonymous = $true - Ensure = "Present" + Ensure = "Present" } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ - DisplayName = "Windows Authentication" + DisplayName = "Windows Authentication" DisableKerberos = $true } } - Mock -CommandName Get-SPWebapplication -MockWith { - $IISSettings = @( - @{} - @{ - SecureBindings = @{} - ServerBindings = @{ - HostHeader = "intranet.sharepoint.com" - Port = 80 - } - AllowAnonymous = $false - }) - - return ( - @{ - DisplayName = "Company SharePoint" - URL = "http://company.sharepoint.com" - IISSettings = $IISSettings - } | add-member ScriptMethod Update { $Global:WebAppUpdateCalled = $true} -PassThru - ) + Mock -CommandName Get-SPWebapplication -MockWith { + $IISSettings = @( + @{ } + @{ + SecureBindings = @{ } + ServerBindings = @{ + HostHeader = "intranet.sharepoint.com" + Port = 80 + } + AllowAnonymous = $false + }) + + return ( + @{ + DisplayName = "Company SharePoint" + URL = "http://company.sharepoint.com" + IISSettings = $IISSettings + } | add-member ScriptMethod Update { $Global:WebAppUpdateCalled = $true } -PassThru + ) } Mock -CommandName Get-SPAlternateUrl -MockWith { @@ -497,34 +497,34 @@ namespace Microsoft.SharePoint.Administration { It "Should update the web application extension settings in the set method" { $Global:WebAppUpdateCalled = $false Set-TargetResource @testParams - $Global:WebAppUpdateCalled | Should Be $true + $Global:WebAppUpdateCalled | Should Be $true } } Context -Name "The web application extension exists but shouldn't" -Fixture { $testParams = @{ WebAppUrl = "http://company.sharepoint.com" - Name = "Intranet Zone" - Url = "http://intranet.sharepoint.com" - Zone = "Intranet" - Ensure = "Absent" + Name = "Intranet Zone" + Url = "http://intranet.sharepoint.com" + Zone = "Intranet" + Ensure = "Absent" } Mock -CommandName Get-SPWebapplication -MockWith { - $IISSettings = @( - @{} - @{ - SecureBindings = @{} - ServerBindings = @{ - HostHeader = "intranet.sharepoint.com" - Port = 80 - } - }) - - return @{ - DisplayName = "Company SharePoint" - URL = "http://company.sharepoint.com" - IISSettings = $IISSettings + $IISSettings = @( + @{ } + @{ + SecureBindings = @{ } + ServerBindings = @{ + HostHeader = "intranet.sharepoint.com" + Port = 80 + } + }) + + return @{ + DisplayName = "Company SharePoint" + URL = "http://company.sharepoint.com" + IISSettings = $IISSettings } } @@ -546,18 +546,18 @@ namespace Microsoft.SharePoint.Administration { Context -Name "A web application extension doesn't exist and shouldn't" -Fixture { $testParams = @{ WebAppUrl = "http://company.sharepoint.com" - Name = "Intranet Zone" - Url = "http://intranet.sharepoint.com" - Zone = "Intranet" - Ensure = "Absent" + Name = "Intranet Zone" + Url = "http://intranet.sharepoint.com" + Zone = "Intranet" + Ensure = "Absent" } - Mock -CommandName Get-SPWebapplication -MockWith { + Mock -CommandName Get-SPWebapplication -MockWith { - return @{ - DisplayName = "Company SharePoint" - URL = "http://company.sharepoint.com" - IISSettings = @() + return @{ + DisplayName = "Company SharePoint" + URL = "http://company.sharepoint.com" + IISSettings = @() } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWordAutomationServiceApp.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWordAutomationServiceApp.Tests.ps1 index 26dd7009e..f0eaf7c36 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWordAutomationServiceApp.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWordAutomationServiceApp.Tests.ps1 @@ -1,18 +1,18 @@ [CmdletBinding()] param( [Parameter()] - [string] + [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWordAutomationServiceApp" + -DscResource "SPWordAutomationServiceApp" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -21,144 +21,144 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Initialize tests $getTypeFullName = "Microsoft.Office.Word.Server.Service.WordServiceApplication" - # Mocks for all contexts - Mock -CommandName Remove-SPServiceApplication -MockWith {} - Mock -CommandName Set-SPWordConversionServiceApplication -MockWith {} - Mock -CommandName Set-SPTimerJob {} + # Mocks for all contexts + Mock -CommandName Remove-SPServiceApplication -MockWith { } + Mock -CommandName Set-SPWordConversionServiceApplication -MockWith { } + Mock -CommandName Set-SPTimerJob { } # Test contexts Context -Name "When no service applications exist in the current farm and Ensure is set to Present" -Fixture { - $testParams = @{ - Name = "Word Automation Service Application" - Ensure = "Present" - ApplicationPool = "SharePoint Web Services" - DatabaseName = "WordAutomation_DB" - DatabaseServer = "SQLServer" - SupportedFileFormats = "docx", "doc", "mht", "rtf", "xml" - DisableEmbeddedFonts = $false - MaximumMemoryUsage = 100 - RecycleThreshold = 100 - DisableBinaryFileScan = $false - ConversionProcesses = 8 - JobConversionFrequency = 15 - NumberOfConversionsPerProcess = 12 + $testParams = @{ + Name = "Word Automation Service Application" + Ensure = "Present" + ApplicationPool = "SharePoint Web Services" + DatabaseName = "WordAutomation_DB" + DatabaseServer = "SQLServer" + SupportedFileFormats = "docx", "doc", "mht", "rtf", "xml" + DisableEmbeddedFonts = $false + MaximumMemoryUsage = 100 + RecycleThreshold = 100 + DisableBinaryFileScan = $false + ConversionProcesses = 8 + JobConversionFrequency = 15 + NumberOfConversionsPerProcess = 12 TimeBeforeConversionIsMonitored = 5 - MaximumConversionAttempts = 2 - MaximumSyncConversionRequests = 25 - KeepAliveTimeout = 30 - MaximumConversionTime = 300 + MaximumConversionAttempts = 2 + MaximumSyncConversionRequests = 25 + KeepAliveTimeout = 30 + MaximumConversionTime = 300 } Mock -CommandName Get-SPServiceApplication -MockWith { return $null } Mock -CommandName Get-SPServiceApplicationPool -MockWith { - return @(@{ - Name = $testParams.ApplicationPool - }) + return @(@{ + Name = $testParams.ApplicationPool + }) } - + Mock -CommandName New-SPWordConversionServiceApplication -MockWith { $returnval = @(@{ - WordServiceFormats = @{ - OpenXmlDocument = $false - Word972003Document = $true - RichTextFormat = $true - WebPage = $true - Word2003Xml = $true - } - DisableEmbeddedFonts = $false - MaximumMemoryUsage = 100 - RecycleProcessThreshold = 100 - DisableBinaryFileScan = $false - TotalActiveProcesses = 8 - TimerJobFrequency = 15 - ConversionsPerInstance = 12 - ConversionTimeout = 5 - MaximumConversionAttempts = 2 - MaximumSyncConversionRequests = 25 - KeepAliveTimeout = 30 - MaximumConversionTime = 300 - }) + WordServiceFormats = @{ + OpenXmlDocument = $false + Word972003Document = $true + RichTextFormat = $true + WebPage = $true + Word2003Xml = $true + } + DisableEmbeddedFonts = $false + MaximumMemoryUsage = 100 + RecycleProcessThreshold = 100 + DisableBinaryFileScan = $false + TotalActiveProcesses = 8 + TimerJobFrequency = 15 + ConversionsPerInstance = 12 + ConversionTimeout = 5 + MaximumConversionAttempts = 2 + MaximumSyncConversionRequests = 25 + KeepAliveTimeout = 30 + MaximumConversionTime = 300 + }) return $returnval } - It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "absent" - } + It "Should return absent from the Get method" { + (Get-TargetResource @testParams).Ensure | Should Be "absent" + } - It "Should return false when the Test method is called" { - Test-TargetResource @testParams | Should Be $false - } + It "Should return false when the Test method is called" { + Test-TargetResource @testParams | Should Be $false + } - It "Should create a new service application in the set method" { - Set-TargetResource @testParams - Assert-MockCalled New-SPWordConversionServiceApplication + It "Should create a new service application in the set method" { + Set-TargetResource @testParams + Assert-MockCalled New-SPWordConversionServiceApplication } } Context -Name "When no service applications exist in the current farm and Ensure is set to Present, but the Application Pool does not exist" -Fixture { - $testParams = @{ - Name = "Word Automation Service Application" - Ensure = "Present" - ApplicationPool = "SharePoint Web Services" - DatabaseName = "WordAutomation_DB" - DatabaseServer = "SQLServer" - SupportedFileFormats = "docx", "doc", "mht", "rtf", "xml" - DisableEmbeddedFonts = $false - MaximumMemoryUsage = 100 - RecycleThreshold = 100 - DisableBinaryFileScan = $false - ConversionProcesses = 8 - JobConversionFrequency = 15 - NumberOfConversionsPerProcess = 12 + $testParams = @{ + Name = "Word Automation Service Application" + Ensure = "Present" + ApplicationPool = "SharePoint Web Services" + DatabaseName = "WordAutomation_DB" + DatabaseServer = "SQLServer" + SupportedFileFormats = "docx", "doc", "mht", "rtf", "xml" + DisableEmbeddedFonts = $false + MaximumMemoryUsage = 100 + RecycleThreshold = 100 + DisableBinaryFileScan = $false + ConversionProcesses = 8 + JobConversionFrequency = 15 + NumberOfConversionsPerProcess = 12 TimeBeforeConversionIsMonitored = 5 - MaximumConversionAttempts = 2 - MaximumSyncConversionRequests = 25 - KeepAliveTimeout = 30 - MaximumConversionTime = 300 + MaximumConversionAttempts = 2 + MaximumSyncConversionRequests = 25 + KeepAliveTimeout = 30 + MaximumConversionTime = 300 } - - Mock -CommandName Get-SPServiceApplication -MockWith { return $null } + + Mock -CommandName Get-SPServiceApplication -MockWith { return $null } Mock -CommandName Get-SPServiceApplicationPool -MockWith { return $null } - It "fails to create a new service application in the set method because the specified application pool is missing" { + It "fails to create a new service application in the set method because the specified application pool is missing" { { Set-TargetResource @testParams } | Should throw "Specified application pool does not exist" - } + } } - Context -Name "When service applications exist in the current farm but the specific word automation app does not" -Fixture { - $testParams = @{ - Name = "Word Automation Service Application" - Ensure = "Present" - ApplicationPool = "SharePoint Web Services" - DatabaseName = "WordAutomation_DB" - DatabaseServer = "SQLServer" - SupportedFileFormats = "docx", "doc", "mht", "rtf", "xml" - DisableEmbeddedFonts = $false - MaximumMemoryUsage = 100 - RecycleThreshold = 100 - DisableBinaryFileScan = $false - ConversionProcesses = 8 - JobConversionFrequency = 15 - NumberOfConversionsPerProcess = 12 + Context -Name "When service applications exist in the current farm but the specific word automation app does not" -Fixture { + $testParams = @{ + Name = "Word Automation Service Application" + Ensure = "Present" + ApplicationPool = "SharePoint Web Services" + DatabaseName = "WordAutomation_DB" + DatabaseServer = "SQLServer" + SupportedFileFormats = "docx", "doc", "mht", "rtf", "xml" + DisableEmbeddedFonts = $false + MaximumMemoryUsage = 100 + RecycleThreshold = 100 + DisableBinaryFileScan = $false + ConversionProcesses = 8 + JobConversionFrequency = 15 + NumberOfConversionsPerProcess = 12 TimeBeforeConversionIsMonitored = 5 - MaximumConversionAttempts = 2 - MaximumSyncConversionRequests = 25 - KeepAliveTimeout = 30 - MaximumConversionTime = 300 + MaximumConversionAttempts = 2 + MaximumSyncConversionRequests = 25 + KeepAliveTimeout = 30 + MaximumConversionTime = 300 } - + Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [pscustomobject]@{ DisplayName = $testParams.Name } - $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = "Microsoft.Office.UnKnownWebServiceApplication" } + $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = "Microsoft.Office.UnKnownWebServiceApplication" } } -PassThru -Force return $spServiceApp } - + It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } It "Should return false when the Test method is called" { @@ -166,289 +166,289 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { } } - Context -Name "When a service application exists and is configured correctly" -Fixture { - $testParams = @{ - Name = "Word Automation Service Application" - Ensure = "Present" - ApplicationPool = "SharePoint Web Services" - DatabaseName = "WordAutomation_DB" - DatabaseServer = "SQLServer" - SupportedFileFormats = "docx", "doc", "mht", "rtf", "xml" - DisableEmbeddedFonts = $false - MaximumMemoryUsage = 100 - RecycleThreshold = 100 - DisableBinaryFileScan = $false - ConversionProcesses = 8 - JobConversionFrequency = 15 - NumberOfConversionsPerProcess = 12 + Context -Name "When a service application exists and is configured correctly" -Fixture { + $testParams = @{ + Name = "Word Automation Service Application" + Ensure = "Present" + ApplicationPool = "SharePoint Web Services" + DatabaseName = "WordAutomation_DB" + DatabaseServer = "SQLServer" + SupportedFileFormats = "docx", "doc", "mht", "rtf", "xml" + DisableEmbeddedFonts = $false + MaximumMemoryUsage = 100 + RecycleThreshold = 100 + DisableBinaryFileScan = $false + ConversionProcesses = 8 + JobConversionFrequency = 15 + NumberOfConversionsPerProcess = 12 TimeBeforeConversionIsMonitored = 5 - MaximumConversionAttempts = 2 - MaximumSyncConversionRequests = 25 - KeepAliveTimeout = 30 - MaximumConversionTime = 300 + MaximumConversionAttempts = 2 + MaximumSyncConversionRequests = 25 + KeepAliveTimeout = 30 + MaximumConversionTime = 300 } - + Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [pscustomobject]@{ - DisplayName = $testParams.Name - ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName - NormalizedDataSource = $testParams.DatabaseServer + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } + Database = @{ + Name = $testParams.DatabaseName + NormalizedDataSource = $testParams.DatabaseServer } - WordServiceFormats = @{ - OpenXmlDocument = $true + WordServiceFormats = @{ + OpenXmlDocument = $true Word972003Document = $true - RichTextFormat = $true - WebPage = $true - Word2003Xml = $true + RichTextFormat = $true + WebPage = $true + Word2003Xml = $true } - DisableEmbeddedFonts = $false - MaximumMemoryUsage = 100 - RecycleProcessThreshold = 100 - DisableBinaryFileScan = $false - TotalActiveProcesses = 8 - TimerJobFrequency = @{ TotalMinutes = 15 } - ConversionsPerInstance = 12 - ConversionTimeout = @{ TotalMinutes = 5 } - MaximumConversionAttempts = 2 + DisableEmbeddedFonts = $false + MaximumMemoryUsage = 100 + RecycleProcessThreshold = 100 + DisableBinaryFileScan = $false + TotalActiveProcesses = 8 + TimerJobFrequency = @{ TotalMinutes = 15 } + ConversionsPerInstance = 12 + ConversionTimeout = @{ TotalMinutes = 5 } + MaximumConversionAttempts = 2 MaximumSyncConversionRequests = 25 - KeepAliveTimeout = @{ TotalSeconds = 30 } - MaximumConversionTime = @{ TotalSeconds = 300 } + KeepAliveTimeout = @{ TotalSeconds = 30 } + MaximumConversionTime = @{ TotalSeconds = 300 } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } - It "Should return values from the get method" { - Get-TargetResource @testParams | Should Not BeNullOrEmpty - } + It "Should return values from the get method" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + } - It "Should return true when the Test method is called" { - Test-TargetResource @testParams | Should Be $true - } - } + It "Should return true when the Test method is called" { + Test-TargetResource @testParams | Should Be $true + } + } - Context -Name "When a service application exists and incorrect application pool is configured" -Fixture { - $testParams = @{ - Name = "Word Automation Service Application" - Ensure = "Present" - ApplicationPool = "SharePoint Web Services" - DatabaseName = "WordAutomation_DB" - DatabaseServer = "SQLServer" - SupportedFileFormats = "docx", "doc", "mht", "rtf", "xml" - DisableEmbeddedFonts = $false - MaximumMemoryUsage = 100 - RecycleThreshold = 100 - DisableBinaryFileScan = $false - ConversionProcesses = 8 - JobConversionFrequency = 15 - NumberOfConversionsPerProcess = 12 + Context -Name "When a service application exists and incorrect application pool is configured" -Fixture { + $testParams = @{ + Name = "Word Automation Service Application" + Ensure = "Present" + ApplicationPool = "SharePoint Web Services" + DatabaseName = "WordAutomation_DB" + DatabaseServer = "SQLServer" + SupportedFileFormats = "docx", "doc", "mht", "rtf", "xml" + DisableEmbeddedFonts = $false + MaximumMemoryUsage = 100 + RecycleThreshold = 100 + DisableBinaryFileScan = $false + ConversionProcesses = 8 + JobConversionFrequency = 15 + NumberOfConversionsPerProcess = 12 TimeBeforeConversionIsMonitored = 5 - MaximumConversionAttempts = 2 - MaximumSyncConversionRequests = 25 - KeepAliveTimeout = 30 - MaximumConversionTime = 300 + MaximumConversionAttempts = 2 + MaximumSyncConversionRequests = 25 + KeepAliveTimeout = 30 + MaximumConversionTime = 300 } - + Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [pscustomobject]@{ - DisplayName = $testParams.Name - ApplicationPool = @{ Name = "Wrong App Pool Name" } - Database = @{ - Name = $testParams.DatabaseName - NormalizedDataSource = $testParams.DatabaseServer - } - WordServiceFormats = @{ - OpenXmlDocument = $false + DisplayName = $testParams.Name + ApplicationPool = @{ Name = "Wrong App Pool Name" } + Database = @{ + Name = $testParams.DatabaseName + NormalizedDataSource = $testParams.DatabaseServer + } + WordServiceFormats = @{ + OpenXmlDocument = $false Word972003Document = $true - RichTextFormat = $true - WebPage = $true - Word2003Xml = $true + RichTextFormat = $true + WebPage = $true + Word2003Xml = $true } - DisableEmbeddedFonts = $false - MaximumMemoryUsage = 100 - RecycleProcessThreshold = 100 - DisableBinaryFileScan = $false - TotalActiveProcesses = 8 - TimerJobFrequency = 15 - ConversionsPerInstance = 12 - ConversionTimeout = 5 - MaximumConversionAttempts = 2 + DisableEmbeddedFonts = $false + MaximumMemoryUsage = 100 + RecycleProcessThreshold = 100 + DisableBinaryFileScan = $false + TotalActiveProcesses = 8 + TimerJobFrequency = 15 + ConversionsPerInstance = 12 + ConversionTimeout = 5 + MaximumConversionAttempts = 2 MaximumSyncConversionRequests = 25 - KeepAliveTimeout = 30 - MaximumConversionTime = 300 + KeepAliveTimeout = 30 + MaximumConversionTime = 300 } - $spServiceApp = $spServiceApp | Add-Member ScriptMethod Update { - $Global:SPDscSiteUseUpdated = $true + $spServiceApp = $spServiceApp | Add-Member ScriptMethod Update { + $Global:SPDscSiteUseUpdated = $true } -PassThru - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } - Mock -CommandName Get-SPServiceApplicationPool -MockWith { return @{ Name = $testParams.ApplicationPool } } + Mock -CommandName Get-SPServiceApplicationPool -MockWith { return @{ Name = $testParams.ApplicationPool } } Mock -CommandName Get-SPTimerJob { $returnval = @(@{ Name = "Just a name" }) - return ,$returnval + return , $returnval } - It "Should return false when the Test method is called" { - Test-TargetResource @testParams | Should Be $false - } + It "Should return false when the Test method is called" { + Test-TargetResource @testParams | Should Be $false + } $Global:SPDscSiteUseUpdated = $false - It "calls Set-SPWordConversionServiceApplication and update service app cmdlet from the set method" { - Set-TargetResource @testParams + It "calls Set-SPWordConversionServiceApplication and update service app cmdlet from the set method" { + Set-TargetResource @testParams - Assert-MockCalled Get-SPServiceApplicationPool - Assert-MockCalled Set-SPWordConversionServiceApplication + Assert-MockCalled Get-SPServiceApplicationPool + Assert-MockCalled Set-SPWordConversionServiceApplication $Global:SPDscSiteUseUpdated | Should Be $true - } - } + } + } - Context -Name "When a service application exists and incorrect settings are configured" -Fixture { - $testParams = @{ - Name = "Word Automation Service Application" - Ensure = "Present" - ApplicationPool = "SharePoint Web Services" - DatabaseName = "WordAutomation_DB" - DatabaseServer = "SQLServer" - SupportedFileFormats = "docx", "doc", "mht", "rtf", "xml" - DisableEmbeddedFonts = $false - MaximumMemoryUsage = 100 - RecycleThreshold = 100 - DisableBinaryFileScan = $false - ConversionProcesses = 8 - JobConversionFrequency = 15 - NumberOfConversionsPerProcess = 12 + Context -Name "When a service application exists and incorrect settings are configured" -Fixture { + $testParams = @{ + Name = "Word Automation Service Application" + Ensure = "Present" + ApplicationPool = "SharePoint Web Services" + DatabaseName = "WordAutomation_DB" + DatabaseServer = "SQLServer" + SupportedFileFormats = "docx", "doc", "mht", "rtf", "xml" + DisableEmbeddedFonts = $false + MaximumMemoryUsage = 100 + RecycleThreshold = 100 + DisableBinaryFileScan = $false + ConversionProcesses = 8 + JobConversionFrequency = 15 + NumberOfConversionsPerProcess = 12 TimeBeforeConversionIsMonitored = 5 - MaximumConversionAttempts = 2 - MaximumSyncConversionRequests = 25 - KeepAliveTimeout = 30 - MaximumConversionTime = 300 + MaximumConversionAttempts = 2 + MaximumSyncConversionRequests = 25 + KeepAliveTimeout = 30 + MaximumConversionTime = 300 } - + Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [pscustomobject]@{ - DisplayName = $testParams.Name - Database = @{ - Name = $testParams.DatabaseName - NormalizedDataSource = $testParams.DatabaseServer + DisplayName = $testParams.Name + Database = @{ + Name = $testParams.DatabaseName + NormalizedDataSource = $testParams.DatabaseServer } - ApplicationPool = @{ Name = $testParams.ApplicationPool } - WordServiceFormats = @{ - OpenXmlDocument = $false + ApplicationPool = @{ Name = $testParams.ApplicationPool } + WordServiceFormats = @{ + OpenXmlDocument = $false Word972003Document = $true - RichTextFormat = $true - WebPage = $true - Word2003Xml = $true + RichTextFormat = $true + WebPage = $true + Word2003Xml = $true } - DisableEmbeddedFonts = $false - MaximumMemoryUsage = 100 - RecycleProcessThreshold = 100 - DisableBinaryFileScan = $false - TotalActiveProcesses = 8 - TimerJobFrequency = 15 - ConversionsPerInstance = 12 - ConversionTimeout = 5 - MaximumConversionAttempts = 2 + DisableEmbeddedFonts = $false + MaximumMemoryUsage = 100 + RecycleProcessThreshold = 100 + DisableBinaryFileScan = $false + TotalActiveProcesses = 8 + TimerJobFrequency = 15 + ConversionsPerInstance = 12 + ConversionTimeout = 5 + MaximumConversionAttempts = 2 MaximumSyncConversionRequests = 25 - KeepAliveTimeout = 30 - MaximumConversionTime = 300 + KeepAliveTimeout = 30 + MaximumConversionTime = 300 } - $spServiceApp = $spServiceApp | Add-Member ScriptMethod Update { - $Global:SPDscSiteUseUpdated = $true + $spServiceApp = $spServiceApp | Add-Member ScriptMethod Update { + $Global:SPDscSiteUseUpdated = $true } -PassThru - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } - Mock -CommandName Get-SPServiceApplicationPool { return @{ Name = $testParams.ApplicationPool } } + Mock -CommandName Get-SPServiceApplicationPool { return @{ Name = $testParams.ApplicationPool } } Mock -CommandName Get-SPTimerJob { $returnval = @(@{ Name = "Just a name" }) - return ,$returnval + return , $returnval } - It "Should return false when the Test method is called" { - Test-TargetResource @testParams | Should Be $false - } + It "Should return false when the Test method is called" { + Test-TargetResource @testParams | Should Be $false + } $Global:SPDscSiteUseUpdated = $false - It "Should call the update service app cmdlet from the set method" { - Set-TargetResource @testParams - Assert-MockCalled Get-SPServiceApplication + It "Should call the update service app cmdlet from the set method" { + Set-TargetResource @testParams + Assert-MockCalled Get-SPServiceApplication $Global:SPDscSiteUseUpdated | Should Be $true - } + } } Context -Name "When no service application exists and Ensure is set to Absent" -Fixture { - $testParams = @{ - Name = "Word Automation Service Application" + $testParams = @{ + Name = "Word Automation Service Application" Ensure = "Absent" } - Mock -CommandName Get-SPServiceApplication -MockWith { return $null } + Mock -CommandName Get-SPServiceApplication -MockWith { return $null } It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - It "Should return true when the Test method is called" { - Test-TargetResource @testParams | Should Be $true - } + It "Should return true when the Test method is called" { + Test-TargetResource @testParams | Should Be $true + } } Context -Name "When a service application exists and Ensure is set to Absent" -Fixture { - $testParams = @{ - Name = "Word Automation Service Application" + $testParams = @{ + Name = "Word Automation Service Application" Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication -MockWith { $spServiceApp = [pscustomobject]@{ - DisplayName = $testParams.Name - ApplicationPool = @{ Name = $testParams.ApplicationPool } - Database = @{ - Name = $testParams.DatabaseName - NormalizedDataSource = $testParams.DatabaseServer + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } + Database = @{ + Name = $testParams.DatabaseName + NormalizedDataSource = $testParams.DatabaseServer } - WordServiceFormats = @{ - OpenXmlDocument = $true + WordServiceFormats = @{ + OpenXmlDocument = $true Word972003Document = $true - RichTextFormat = $true - WebPage = $true - Word2003Xml = $true + RichTextFormat = $true + WebPage = $true + Word2003Xml = $true } - DisableEmbeddedFonts = $false - MaximumMemoryUsage = 100 - RecycleProcessThreshold = 100 - DisableBinaryFileScan = $false - TotalActiveProcesses = 8 - TimerJobFrequency = @{ TotalMinutes = 15 } - ConversionsPerInstance = 12 - ConversionTimeout = @{ TotalMinutes = 5 } - MaximumConversionAttempts = 2 + DisableEmbeddedFonts = $false + MaximumMemoryUsage = 100 + RecycleProcessThreshold = 100 + DisableBinaryFileScan = $false + TotalActiveProcesses = 8 + TimerJobFrequency = @{ TotalMinutes = 15 } + ConversionsPerInstance = 12 + ConversionTimeout = @{ TotalMinutes = 5 } + MaximumConversionAttempts = 2 MaximumSyncConversionRequests = 25 - KeepAliveTimeout = @{ TotalSeconds = 30 } - MaximumConversionTime = @{ TotalSeconds = 300 } + KeepAliveTimeout = @{ TotalSeconds = 30 } + MaximumConversionTime = @{ TotalSeconds = 300 } } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } } -PassThru -Force return $spServiceApp } It "Should return present from the Get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Present" + (Get-TargetResource @testParams).Ensure | Should Be "Present" } - + It "Should return true when the Test method is called" { Test-TargetResource @testParams | Should Be $false } @@ -461,10 +461,10 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When Ensure is set to Absent, but another parameter is also used" -Fixture { $testParams = @{ - Name = "Word Automation Service Application" - Ensure = "Absent" + Name = "Word Automation Service Application" + Ensure = "Absent" ApplicationPool = "SharePoint Web Services" - } + } It "Should return null from the get method" { { Get-TargetResource @testParams } | Should throw "You cannot use any of the parameters when Ensure is specified as Absent" @@ -477,14 +477,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should throw an exception in the set method" { { Set-TargetResource @testParams } | Should throw "You cannot use any of the parameters when Ensure is specified as Absent" } - } + } Context -Name "When Ensure is set to Present, but the Application Pool or Database parameters are missing" -Fixture { $testParams = @{ - Name = "Word Automation Service Application" - Ensure = "Present" + Name = "Word Automation Service Application" + Ensure = "Present" ApplicationPool = "SharePoint Web Services" - } + } It "Should return null from the get method" { { Get-TargetResource @testParams } | Should throw "An Application Pool and Database Name are required to configure the Word Automation Service Application" diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWorkManagementServiceApp.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWorkManagementServiceApp.Tests.ps1 index b63f59ba2..ea4f89ff1 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWorkManagementServiceApp.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWorkManagementServiceApp.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWorkManagementServiceApp" + -DscResource "SPWorkManagementServiceApp" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -31,13 +31,13 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { Context -Name "When a service application exists and Ensure equals 'Absent'" -Fixture { $testParams = @{ - Name = "Test Work Management App" + Name = "Test Work Management App" Ensure = "Absent" } Mock -CommandName Get-SPServiceApplication { $spServiceApp = [pscustomobject]@{ - DisplayName = $testParams.Name + DisplayName = $testParams.Name ApplicationPool = @{ Name = "Wrong App Pool Name" } } $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { @@ -58,7 +58,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When Ensure=Present and ApplicationPool parameter is missing" -Fixture { $testParams = @{ - Name = "Test Work Management App" + Name = "Test Work Management App" Ensure = "Present" } @@ -71,9 +71,9 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When no service applications exist in the current farm" -Fixture { $testParams = @{ - Name = "Test Work Management App" + Name = "Test Work Management App" ApplicationPool = "Test App Pool" - ProxyName = "Test Work Management App Proxy" + ProxyName = "Test Work Management App Proxy" } Mock -CommandName Get-SPServiceApplication { return $null } @@ -94,7 +94,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When service applications exist in the current farm but the specific Work Management app does not" -Fixture { $testParams = @{ - Name = "Test Work Management App" + Name = "Test Work Management App" ApplicationPool = "Test App Pool" } @@ -124,27 +124,27 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and is configured correctly" -Fixture { $testParams = @{ - Name = "Test Work Management App" - ApplicationPool = "Test App Pool" - MinimumTimeBetweenEwsSyncSubscriptionSearches =10 - MinimumTimeBetweenProviderRefreshes=10 - MinimumTimeBetweenSearchQueries=10 - NumberOfSubscriptionSyncsPerEwsSyncRun=10 - NumberOfUsersEwsSyncWillProcessAtOnce=10 - NumberOfUsersPerEwsSyncBatch=10 + Name = "Test Work Management App" + ApplicationPool = "Test App Pool" + MinimumTimeBetweenEwsSyncSubscriptionSearches = 10 + MinimumTimeBetweenProviderRefreshes = 10 + MinimumTimeBetweenSearchQueries = 10 + NumberOfSubscriptionSyncsPerEwsSyncRun = 10 + NumberOfUsersEwsSyncWillProcessAtOnce = 10 + NumberOfUsersPerEwsSyncBatch = 10 } Mock -CommandName Get-SPServiceApplication { $spServiceApp = [pscustomobject]@{ - DisplayName = $testParams.Name + DisplayName = $testParams.Name ApplicationPool = @{ Name = $testParams.ApplicationPool } - AdminSettings = @{ - MinimumTimeBetweenEwsSyncSubscriptionSearches = (new-timespan -minutes 10) - MinimumTimeBetweenProviderRefreshes= (new-timespan -minutes 10) - MinimumTimeBetweenSearchQueries= (new-timespan -minutes 10) - NumberOfSubscriptionSyncsPerEwsSyncRun=10 - NumberOfUsersEwsSyncWillProcessAtOnce= 10 - NumberOfUsersPerEwsSyncBatch= 10 + AdminSettings = @{ + MinimumTimeBetweenEwsSyncSubscriptionSearches = (new-timespan -minutes 10) + MinimumTimeBetweenProviderRefreshes = (new-timespan -minutes 10) + MinimumTimeBetweenSearchQueries = (new-timespan -minutes 10) + NumberOfSubscriptionSyncsPerEwsSyncRun = 10 + NumberOfUsersEwsSyncWillProcessAtOnce = 10 + NumberOfUsersPerEwsSyncBatch = 10 } } $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { @@ -164,27 +164,27 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "When a service application exists and is not configured correctly" -Fixture { $testParams = @{ - Name = "Test Work Management App" - ApplicationPool = "Test App Pool" - MinimumTimeBetweenEwsSyncSubscriptionSearches =20 - MinimumTimeBetweenProviderRefreshes=20 - MinimumTimeBetweenSearchQueries=20 - NumberOfSubscriptionSyncsPerEwsSyncRun=20 - NumberOfUsersEwsSyncWillProcessAtOnce=20 - NumberOfUsersPerEwsSyncBatch=20 + Name = "Test Work Management App" + ApplicationPool = "Test App Pool" + MinimumTimeBetweenEwsSyncSubscriptionSearches = 20 + MinimumTimeBetweenProviderRefreshes = 20 + MinimumTimeBetweenSearchQueries = 20 + NumberOfSubscriptionSyncsPerEwsSyncRun = 20 + NumberOfUsersEwsSyncWillProcessAtOnce = 20 + NumberOfUsersPerEwsSyncBatch = 20 } Mock -CommandName Get-SPServiceApplication { $spServiceApp = [pscustomobject]@{ - DisplayName = $testParams.Name + DisplayName = $testParams.Name ApplicationPool = @{ Name = "Wrong App Pool Name" } - AdminSettings = @{ - MinimumTimeBetweenEwsSyncSubscriptionSearches = (new-timespan -minutes 10) - MinimumTimeBetweenProviderRefreshes= (new-timespan -minutes 10) - MinimumTimeBetweenSearchQueries= (new-timespan -minutes 10) - NumberOfSubscriptionSyncsPerEwsSyncRun=10 - NumberOfUsersEwsSyncWillProcessAtOnce= 10 - NumberOfUsersPerEwsSyncBatch= 10 + AdminSettings = @{ + MinimumTimeBetweenEwsSyncSubscriptionSearches = (new-timespan -minutes 10) + MinimumTimeBetweenProviderRefreshes = (new-timespan -minutes 10) + MinimumTimeBetweenSearchQueries = (new-timespan -minutes 10) + NumberOfSubscriptionSyncsPerEwsSyncRun = 10 + NumberOfUsersEwsSyncWillProcessAtOnce = 10 + NumberOfUsersPerEwsSyncBatch = 10 } } $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { @@ -214,14 +214,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { Context -Name "Trying to use SPWorkManagementServiceApp in SP2016/SP2019, not available" -Fixture { $testParams = @{ - Name = "Test Work Management App" - ApplicationPool = "Test App Pool" - MinimumTimeBetweenEwsSyncSubscriptionSearches =20 - MinimumTimeBetweenProviderRefreshes=20 - MinimumTimeBetweenSearchQueries=20 - NumberOfSubscriptionSyncsPerEwsSyncRun=20 - NumberOfUsersEwsSyncWillProcessAtOnce=20 - NumberOfUsersPerEwsSyncBatch=20 + Name = "Test Work Management App" + ApplicationPool = "Test App Pool" + MinimumTimeBetweenEwsSyncSubscriptionSearches = 20 + MinimumTimeBetweenProviderRefreshes = 20 + MinimumTimeBetweenSearchQueries = 20 + NumberOfSubscriptionSyncsPerEwsSyncRun = 20 + NumberOfUsersEwsSyncWillProcessAtOnce = 20 + NumberOfUsersPerEwsSyncBatch = 20 } It "Should throw an exception in the Get method" { diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.SPWorkflowService.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.SPWorkflowService.Tests.ps1 index a853d01bc..dc7c4db0a 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.SPWorkflowService.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.SPWorkflowService.Tests.ps1 @@ -3,16 +3,16 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -DscResource "SPWorkflowService" + -DscResource "SPWorkflowService" Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -21,19 +21,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { # Initialize tests # Mocks for all contexts - Mock -CommandName Get-SPWorkflowServiceApplicationProxy -MockWith{ + Mock -CommandName Get-SPWorkflowServiceApplicationProxy -MockWith { return @(@{ - Value = $true - } | Add-Member -MemberType ScriptMethod ` - -Name GetHostname ` - -Value { - return "http://workflow.sharepoint.com" - } -PassThru ` + Value = $true + } | Add-Member -MemberType ScriptMethod ` + -Name GetHostname ` + -Value { + return "http://workflow.sharepoint.com" + } -PassThru ` | Add-Member -MemberType ScriptMethod ` - -Name GetWorkflowScopeName ` - -Value { - return "SharePoint" - } -PassThru) + -Name GetWorkflowScopeName ` + -Value { + return "SharePoint" + } -PassThru) } Mock -CommandName Get-SPSite -MockWith { @@ -44,19 +44,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { ) } - Mock -CommandName Register-SPWorkflowService -MockWith{ } + Mock -CommandName Register-SPWorkflowService -MockWith { } # Test contexts Context -Name "Specified Site Collection does not exist" -Fixture { $testParams = @{ WorkflowHostUri = "http://workflow.sharepoint.com" - SPSiteUrl = "http://sites.sharepoint.com" - AllowOAuthHttp = $true + SPSiteUrl = "http://sites.sharepoint.com" + AllowOAuthHttp = $true } - Mock -CommandName Get-SPSite -MockWith {return @($null)} + Mock -CommandName Get-SPSite -MockWith { return @($null) } - Mock -CommandName Get-SPWorkflowServiceApplicationProxy -MockWith{ + Mock -CommandName Get-SPWorkflowServiceApplicationProxy -MockWith { return $null } @@ -64,14 +64,14 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { { Set-TargetResource @testParams } | Should Throw "Specified site collection could not be found." } - It "return empty workflow service instance"{ + It "return empty workflow service instance" { $result = Get-TargetResource @testParams $result.WorkflowHostUri | Should Be $null $result.SPSiteUrl | Should Be "http://sites.sharepoint.com" $result.ScopeName | Should Be $null } - It "return false from the test method"{ + It "return false from the test method" { Test-TargetResource @testParams | Should Be $false } } @@ -79,19 +79,19 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Context -Name "both the specified Site Collection and Workflow Service exist and are accessible" -Fixture { $testParams = @{ WorkflowHostUri = "http://workflow.sharepoint.com" - SPSiteUrl = "http://sites.sharepoint.com" - AllowOAuthHttp = $true + SPSiteUrl = "http://sites.sharepoint.com" + AllowOAuthHttp = $true } - Mock -CommandName Register-SPWorkflowService -MockWith{ + Mock -CommandName Register-SPWorkflowService -MockWith { return @(@{ - Value = $true - }) + Value = $true + }) } It "properly creates the workflow service proxy" { Set-TargetResource @testParams - Assert-MockCalled Register-SPWorkflowService -ParameterFilter {$ScopeName -eq $null -and $WorkflowHostUri -eq "http://workflow.sharepoint.com"} + Assert-MockCalled Register-SPWorkflowService -ParameterFilter { $ScopeName -eq $null -and $WorkflowHostUri -eq "http://workflow.sharepoint.com" } } It "returns the workflow service instance" { @@ -102,51 +102,51 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Assert-MockCalled Get-SPWorkflowServiceApplicationProxy } - It "return true from the test method"{ - Test-TargetResource @testParams | Should Be $true + It "return true from the test method" { + Test-TargetResource @testParams | Should Be $true } } Context -Name "workflow host URL is incorrect" -Fixture { $testParams = @{ WorkflowHostUri = "http://new-workflow.sharepoint.com" - ScopeName = "SharePoint" - SPSiteUrl = "http://sites.sharepoint.com" - AllowOAuthHttp = $true + ScopeName = "SharePoint" + SPSiteUrl = "http://sites.sharepoint.com" + AllowOAuthHttp = $true } It "properly creates the workflow service proxy" { Set-TargetResource @testParams - Assert-MockCalled Register-SPWorkflowService -ParameterFilter {$ScopeName -eq "SharePoint" -and $WorkflowHostUri -eq "http://new-workflow.sharepoint.com"} + Assert-MockCalled Register-SPWorkflowService -ParameterFilter { $ScopeName -eq "SharePoint" -and $WorkflowHostUri -eq "http://new-workflow.sharepoint.com" } } - It "return false from the test method"{ - Test-TargetResource @testParams | Should Be $false + It "return false from the test method" { + Test-TargetResource @testParams | Should Be $false } } Context -Name "workflow scope name is incorrect" -Fixture { $testParams = @{ WorkflowHostUri = "http://workflow.sharepoint.com" - ScopeName = "AnotherScope" - SPSiteUrl = "http://sites.sharepoint.com" - AllowOAuthHttp = $true + ScopeName = "AnotherScope" + SPSiteUrl = "http://sites.sharepoint.com" + AllowOAuthHttp = $true } - It "return false from the test method"{ - Test-TargetResource @testParams | Should Be $false + It "return false from the test method" { + Test-TargetResource @testParams | Should Be $false } } Context -Name "workflow host URL contains a trailing forward slash" -Fixture { $testParams = @{ WorkflowHostUri = "http://workflow.sharepoint.com/" - SPSiteUrl = "http://sites.sharepoint.com" - AllowOAuthHttp = $true + SPSiteUrl = "http://sites.sharepoint.com" + AllowOAuthHttp = $true } - It "return true from the test method"{ - Test-TargetResource @testParams | Should Be $true + It "return true from the test method" { + Test-TargetResource @testParams | Should Be $true } } } diff --git a/Tests/Unit/SharePointDsc/SharePointDsc.Util.Tests.ps1 b/Tests/Unit/SharePointDsc/SharePointDsc.Util.Tests.ps1 index 38cf57b8c..3ccbdbf92 100644 --- a/Tests/Unit/SharePointDsc/SharePointDsc.Util.Tests.ps1 +++ b/Tests/Unit/SharePointDsc/SharePointDsc.Util.Tests.ps1 @@ -5,17 +5,17 @@ param( [Parameter()] [string] $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` - -Resolve) + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) ) Import-Module -Name (Join-Path -Path $PSScriptRoot ` - -ChildPath "..\UnitTestHelper.psm1" ` - -Resolve) + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` - -SubModulePath "Modules\SharePointDsc.Util\SharePointDsc.Util.psm1" ` - -ExcludeInvokeHelper + -SubModulePath "Modules\SharePointDsc.Util\SharePointDsc.Util.psm1" ` + -ExcludeInvokeHelper Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { @@ -53,21 +53,21 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should execute a command as the local run as user with additional arguments" { Invoke-SPDscCommand -ScriptBlock { return "value" } ` - -Arguments @{ Something = "42" } 4>&1 + -Arguments @{ Something = "42" } 4>&1 } It "Should execute a command as the specified InstallAccount user where it is different to the current user" { $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force $mockCredential = New-Object -TypeName System.Management.Automation.PSCredential ("username", $mockPassword) Invoke-SPDscCommand -ScriptBlock { return "value" } ` - -Credential $mockCredential 4>&1 + -Credential $mockCredential 4>&1 } It "Should throw an exception when the run as user is the same as the InstallAccount user" { $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force $mockCredential = New-Object -TypeName System.Management.Automation.PSCredential ("$($Env:USERDOMAIN)\$($Env:USERNAME)", $mockPassword) { Invoke-SPDscCommand -ScriptBlock { return "value" } ` - -Credential $mockCredential 4>&1 } | Should Throw + -Credential $mockCredential 4>&1 } | Should Throw } It "Should throw normal exceptions when triggered in the script block" { @@ -86,7 +86,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force $mockCredential = New-Object -TypeName System.Management.Automation.PSCredential ("username", $mockPassword) { Invoke-SPDscCommand -ScriptBlock { return "value" } ` - -Credential $mockCredential 4>&1 } | Should Throw + -Credential $mockCredential 4>&1 } | Should Throw } It "Should handle a SharePoint update conflict exception by rebooting the server to retry" { @@ -105,7 +105,7 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force $mockCredential = New-Object -TypeName System.Management.Automation.PSCredential ("username", $mockPassword) { Invoke-SPDscCommand -ScriptBlock { return "value" } ` - -Credential $mockCredential 4>&1 } | Should Not Throw + -Credential $mockCredential 4>&1 } | Should Not Throw } } @@ -113,44 +113,44 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { It "Should return true for two identical tables" { $desired = @{ Example = "test" } Test-SPDscParameterState -CurrentValues $desired ` - -DesiredValues $desired | Should Be $true + -DesiredValues $desired | Should Be $true } It "Should return false when a value is different" { $current = @{ Example = "something" } $desired = @{ Example = "test" } Test-SPDscParameterState -CurrentValues $current ` - -DesiredValues $desired | Should Be $false + -DesiredValues $desired | Should Be $false } It "Should return false when a value is missing" { $current = @{ } $desired = @{ Example = "test" } Test-SPDscParameterState -CurrentValues $current ` - -DesiredValues $desired | Should Be $false + -DesiredValues $desired | Should Be $false } It "Should return true when only a specified value matches, but other non-listed values do not" { $current = @{ Example = "test"; SecondExample = "true" } - $desired = @{ Example = "test"; SecondExample = "false" } + $desired = @{ Example = "test"; SecondExample = "false" } Test-SPDscParameterState -CurrentValues $current ` - -DesiredValues $desired ` - -ValuesToCheck @("Example") | Should Be $true + -DesiredValues $desired ` + -ValuesToCheck @("Example") | Should Be $true } It "Should return false when only specified values do not match, but other non-listed values do " { $current = @{ Example = "test"; SecondExample = "true" } - $desired = @{ Example = "test"; SecondExample = "false" } + $desired = @{ Example = "test"; SecondExample = "false" } Test-SPDscParameterState -CurrentValues $current ` - -DesiredValues $desired ` - -ValuesToCheck @("SecondExample") | Should Be $false + -DesiredValues $desired ` + -ValuesToCheck @("SecondExample") | Should Be $false } It "Should return false when an empty array is used in the current values" { $current = @{ } - $desired = @{ Example = "test"; SecondExample = "false" } + $desired = @{ Example = "test"; SecondExample = "false" } Test-SPDscParameterState -CurrentValues $current ` - -DesiredValues $desired | Should Be $false + -DesiredValues $desired | Should Be $false } } @@ -158,62 +158,62 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName "New-Object" -ParameterFilter { $TypeName -eq "System.DirectoryServices.DirectoryEntry" } -MockWith { return @{ - objectGUID = @{ - Value = (New-Guid) - } - } } + objectGUID = @{ + Value = (New-Guid) + } + } } Mock -CommandName "New-Object" -ParameterFilter { $TypeName -eq "System.DirectoryServices.DirectorySearcher" } -MockWith { $searcher = @{ - SearchRoot = $null - PageSize = $null - Filter = $null - SearchScope = $null + SearchRoot = $null + PageSize = $null + Filter = $null + SearchScope = $null PropertiesToLoad = (New-Object -TypeName "System.Collections.Generic.List[System.String]") } $searcher = $searcher | Add-Member -MemberType ScriptMethod ` - -Name FindOne ` - -Value { - $result = @{} - $result = $result | Add-Member -MemberType ScriptMethod ` - -Name GetDirectoryEntry ` - -Value { - return @{ - objectsid = @("item") - } - } -PassThru -Force - return $result - } -PassThru -Force + -Name FindOne ` + -Value { + $result = @{ } + $result = $result | Add-Member -MemberType ScriptMethod ` + -Name GetDirectoryEntry ` + -Value { + return @{ + objectsid = @("item") + } + } -PassThru -Force + return $result + } -PassThru -Force return $searcher } Mock -CommandName "New-Object" -ParameterFilter { $TypeName -eq "System.Security.Principal.SecurityIdentifier" } -MockWith { - $sid = @{} + $sid = @{ } $sid = $sid | Add-Member -MemberType ScriptMethod ` - -Name Translate ` - -Value { - $returnVal = $global:SPDscGroupsToReturn[$global:SPDscSidCount] - $global:SPDscSidCount++ - return $returnVal - } -PassThru -Force + -Name Translate ` + -Value { + $returnVal = $global:SPDscGroupsToReturn[$global:SPDscSidCount] + $global:SPDscSidCount++ + return $returnVal + } -PassThru -Force return $sid } Mock -CommandName "New-Object" -ParameterFilter { $TypeName -eq "System.Security.Principal.NTAccount" } -MockWith { - $sid = @{} + $sid = @{ } $sid = $sid | Add-Member -MemberType ScriptMethod ` - -Name Translate ` - -Value { - $returnVal = $global:SPDscSidsToReturn[$global:SPDscSidCount] - $global:SPDscSidCount++ - return $returnVal - } -PassThru -Force + -Name Translate ` + -Value { + $returnVal = $global:SPDscSidsToReturn[$global:SPDscSidCount] + $global:SPDscSidCount++ + return $returnVal + } -PassThru -Force return $sid } @@ -228,17 +228,17 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { $TypeName -eq "System.DirectoryServices.DirectorySearcher" } -MockWith { $searcher = @{ - SearchRoot = $null - PageSize = $null - Filter = $null - SearchScope = $null + SearchRoot = $null + PageSize = $null + Filter = $null + SearchScope = $null PropertiesToLoad = (New-Object -TypeName "System.Collections.Generic.List[System.String]") } $searcher = $searcher | Add-Member -MemberType ScriptMethod ` - -Name FindOne ` - -Value { - return $null - } -PassThru -Force + -Name FindOne ` + -Value { + return $null + } -PassThru -Force return $searcher } @@ -254,62 +254,62 @@ Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { Mock -CommandName "New-Object" -ParameterFilter { $TypeName -eq "System.DirectoryServices.DirectoryEntry" } -MockWith { return @{ - objectGUID = @{ - Value = (New-Guid) - } - } } + objectGUID = @{ + Value = (New-Guid) + } + } } Mock -CommandName "New-Object" -ParameterFilter { $TypeName -eq "System.DirectoryServices.DirectorySearcher" } -MockWith { $searcher = @{ - SearchRoot = $null - PageSize = $null - Filter = $null - SearchScope = $null + SearchRoot = $null + PageSize = $null + Filter = $null + SearchScope = $null PropertiesToLoad = (New-Object -TypeName "System.Collections.Generic.List[System.String]") } $searcher = $searcher | Add-Member -MemberType ScriptMethod ` - -Name FindOne ` - -Value { - $result = @{} - $result = $result | Add-Member -MemberType ScriptMethod ` - -Name GetDirectoryEntry ` - -Value { - return @{ - objectsid = @("item") - } - } -PassThru -Force - return $result - } -PassThru -Force + -Name FindOne ` + -Value { + $result = @{ } + $result = $result | Add-Member -MemberType ScriptMethod ` + -Name GetDirectoryEntry ` + -Value { + return @{ + objectsid = @("item") + } + } -PassThru -Force + return $result + } -PassThru -Force return $searcher } Mock -CommandName "New-Object" -ParameterFilter { $TypeName -eq "System.Security.Principal.SecurityIdentifier" } -MockWith { - $sid = @{} + $sid = @{ } $sid = $sid | Add-Member -MemberType ScriptMethod ` - -Name Translate ` - -Value { - $returnVal = $global:SPDscGroupsToReturn[$global:SPDscSidCount] - $global:SPDscSidCount++ - return $returnVal - } -PassThru -Force + -Name Translate ` + -Value { + $returnVal = $global:SPDscGroupsToReturn[$global:SPDscSidCount] + $global:SPDscSidCount++ + return $returnVal + } -PassThru -Force return $sid } Mock -CommandName "New-Object" -ParameterFilter { $TypeName -eq "System.Security.Principal.NTAccount" } -MockWith { - $sid = @{} + $sid = @{ } $sid = $sid | Add-Member -MemberType ScriptMethod ` - -Name Translate ` - -Value { - $returnVal = $global:SPDscSidsToReturn[$global:SPDscSidCount] - $global:SPDscSidCount++ - return $returnVal - } -PassThru -Force + -Name Translate ` + -Value { + $returnVal = $global:SPDscSidsToReturn[$global:SPDscSidCount] + $global:SPDscSidCount++ + return $returnVal + } -PassThru -Force return $sid } diff --git a/Tests/Unit/Stubs/SharePoint/15.0.4805.1000/Microsoft.SharePoint.PowerShell.psm1 b/Tests/Unit/Stubs/SharePoint/15.0.4805.1000/Microsoft.SharePoint.PowerShell.psm1 index bab3be4e5..38bcefa06 100644 --- a/Tests/Unit/Stubs/SharePoint/15.0.4805.1000/Microsoft.SharePoint.PowerShell.psm1 +++ b/Tests/Unit/Stubs/SharePoint/15.0.4805.1000/Microsoft.SharePoint.PowerShell.psm1 @@ -1,4 +1,4 @@ -function Add-DatabaseToAvailabilityGroup { +function Add-DatabaseToAvailabilityGroup { [CmdletBinding(DefaultParameterSetName='Default')] param( [Parameter(Mandatory=$true, Position=0)] @@ -20,11 +20,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Add-SPAppDeniedEndpoint { + +function Add-SPAppDeniedEndpoint { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -36,11 +36,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPClaimTypeMapping { +function Add-SPClaimTypeMapping { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -61,11 +61,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPDiagnosticsPerformanceCounter { +function Add-SPDiagnosticsPerformanceCounter { [CmdletBinding(DefaultParameterSetName='AddCounter', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='AddInstance', Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)] @@ -101,22 +101,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Add-SPDistributedCacheServiceInstance { + +function Add-SPDistributedCacheServiceInstance { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Add-SPEduClassMember { +function Add-SPEduClassMember { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -139,11 +139,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Add-SPEduUser { + +function Add-SPEduUser { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -174,11 +174,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPInfoPathUserAgent { +function Add-SPInfoPathUserAgent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -189,11 +189,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPPluggableSecurityTrimmer { +function Add-SPPluggableSecurityTrimmer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -215,11 +215,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Add-SPProfileLeader { + +function Add-SPProfileLeader { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -241,11 +241,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPProfileSyncConnection { +function Add-SPProfileSyncConnection { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -304,11 +304,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Add-SPRoutingMachineInfo { + +function Add-SPRoutingMachineInfo { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -340,11 +340,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPRoutingMachinePool { +function Add-SPRoutingMachinePool { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -364,11 +364,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPRoutingRule { +function Add-SPRoutingRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -399,11 +399,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Add-SPScaleOutDatabase { + +function Add-SPScaleOutDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -431,11 +431,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPSecureStoreSystemAccount { +function Add-SPSecureStoreSystemAccount { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -447,11 +447,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Add-SPServerScaleOutDatabase { + +function Add-SPServerScaleOutDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -479,11 +479,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPServiceApplicationProxyGroupMember { +function Add-SPServiceApplicationProxyGroupMember { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -501,11 +501,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Add-SPShellAdmin { + +function Add-SPShellAdmin { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -520,11 +520,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPSiteSubscriptionFeaturePackMember { +function Add-SPSiteSubscriptionFeaturePackMember { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -541,11 +541,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Add-SPSiteSubscriptionProfileConfig { + +function Add-SPSiteSubscriptionProfileConfig { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -579,11 +579,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPSolution { +function Add-SPSolution { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -597,11 +597,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPThrottlingRule { +function Add-SPThrottlingRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -630,11 +630,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Add-SPUserLicenseMapping { + +function Add-SPUserLicenseMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true, ValueFromRemainingArguments=$true)] @@ -646,11 +646,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPUserSolution { +function Add-SPUserSolution { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -666,11 +666,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Backup-SPConfigurationDatabase { + +function Backup-SPConfigurationDatabase { [CmdletBinding(DefaultParameterSetName='DefaultSet')] param( [string] @@ -698,11 +698,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Backup-SPEnterpriseSearchServiceApplicationIndex { +function Backup-SPEnterpriseSearchServiceApplicationIndex { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='RunBackup', Mandatory=$true, Position=0)] @@ -733,11 +733,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Backup-SPFarm { +function Backup-SPFarm { [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='DefaultSet', Mandatory=$true)] @@ -775,11 +775,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Backup-SPSite { + +function Backup-SPSite { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -803,22 +803,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Clear-SPAppDeniedEndpointList { +function Clear-SPAppDeniedEndpointList { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Clear-SPBusinessDataCatalogEntityNotificationWeb { + +function Clear-SPBusinessDataCatalogEntityNotificationWeb { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -830,11 +830,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Clear-SPDistributedCacheItem { +function Clear-SPDistributedCacheItem { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -846,11 +846,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Clear-SPLogLevel { +function Clear-SPLogLevel { [CmdletBinding()] param( [string[]] @@ -864,11 +864,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Clear-SPMetadataWebServicePartitionData { + +function Clear-SPMetadataWebServicePartitionData { [CmdletBinding(DefaultParameterSetName='Default')] param( [Parameter(ParameterSetName='Default', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -890,11 +890,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Clear-SPPerformancePointServiceApplicationTrustedLocation { +function Clear-SPPerformancePointServiceApplicationTrustedLocation { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -908,11 +908,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Clear-SPScaleOutDatabaseDeletedDataSubRange { + +function Clear-SPScaleOutDatabaseDeletedDataSubRange { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -933,11 +933,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Clear-SPScaleOutDatabaseLog { +function Clear-SPScaleOutDatabaseLog { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -952,11 +952,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Clear-SPScaleOutDatabaseTenantData { + +function Clear-SPScaleOutDatabaseTenantData { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -971,11 +971,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Clear-SPSecureStoreCredentialMapping { +function Clear-SPSecureStoreCredentialMapping { [CmdletBinding(DefaultParameterSetName='OneApplication', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='AllApplications', Mandatory=$true)] @@ -1001,22 +1001,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Clear-SPSecureStoreDefaultProvider { + +function Clear-SPSecureStoreDefaultProvider { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Clear-SPServerScaleOutDatabaseDeletedDataSubRange { +function Clear-SPServerScaleOutDatabaseDeletedDataSubRange { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -1037,11 +1037,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Clear-SPServerScaleOutDatabaseLog { +function Clear-SPServerScaleOutDatabaseLog { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -1056,11 +1056,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Clear-SPServerScaleOutDatabaseTenantData { + +function Clear-SPServerScaleOutDatabaseTenantData { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -1075,11 +1075,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Clear-SPSiteSubscriptionBusinessDataCatalogConfig { +function Clear-SPSiteSubscriptionBusinessDataCatalogConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -1091,11 +1091,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Connect-SPConfigurationDatabase { + +function Connect-SPConfigurationDatabase { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1123,11 +1123,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Convert-SPWebApplication { +function Convert-SPWebApplication { [CmdletBinding()] param( [Parameter(ParameterSetName='Claims', Mandatory=$true, ValueFromPipeline=$true)] @@ -1184,11 +1184,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Copy-SPAccessServicesDatabaseCredentials { +function Copy-SPAccessServicesDatabaseCredentials { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -1215,11 +1215,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Copy-SPActivitiesToWorkflowService { + +function Copy-SPActivitiesToWorkflowService { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -1238,11 +1238,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Copy-SPBusinessDataCatalogAclToChildren { +function Copy-SPBusinessDataCatalogAclToChildren { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -1254,11 +1254,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Copy-SPSite { + +function Copy-SPSite { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1280,11 +1280,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Disable-SPAppAutoProvision { +function Disable-SPAppAutoProvision { [CmdletBinding()] param( [object] @@ -1294,11 +1294,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Disable-SPBusinessDataCatalogEntity { +function Disable-SPBusinessDataCatalogEntity { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -1310,11 +1310,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Disable-SPFeature { + +function Disable-SPFeature { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1331,11 +1331,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Disable-SPHealthAnalysisRule { +function Disable-SPHealthAnalysisRule { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1346,11 +1346,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Disable-SPInfoPathFormTemplate { + +function Disable-SPInfoPathFormTemplate { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1366,22 +1366,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Disable-SPSessionStateService { +function Disable-SPSessionStateService { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Disable-SPSingleSignOn { + +function Disable-SPSingleSignOn { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -1393,11 +1393,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Disable-SPTimerJob { +function Disable-SPTimerJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1408,22 +1408,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Disable-SPUserLicensing { + +function Disable-SPUserLicensing { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Disable-SPWebApplicationHttpThrottling { +function Disable-SPWebApplicationHttpThrottling { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -1434,22 +1434,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Disconnect-SPConfigurationDatabase { +function Disconnect-SPConfigurationDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Dismount-SPContentDatabase { + +function Dismount-SPContentDatabase { [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1461,11 +1461,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Dismount-SPStateServiceDatabase { +function Dismount-SPStateServiceDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1477,11 +1477,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Enable-SPAppAutoProvision { + +function Enable-SPAppAutoProvision { [CmdletBinding()] param( [object] @@ -1491,11 +1491,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Enable-SPBusinessDataCatalogEntity { +function Enable-SPBusinessDataCatalogEntity { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -1507,11 +1507,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Enable-SPFeature { + +function Enable-SPFeature { [CmdletBinding(DefaultParameterSetName='FarmFeatureDefinition', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1536,11 +1536,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Enable-SPHealthAnalysisRule { +function Enable-SPHealthAnalysisRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1551,11 +1551,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Enable-SPInfoPathFormTemplate { + +function Enable-SPInfoPathFormTemplate { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1571,11 +1571,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Enable-SPSessionStateService { +function Enable-SPSessionStateService { [CmdletBinding(DefaultParameterSetName='AdvancedProvision', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='DefaultProvision', Mandatory=$true)] @@ -1601,11 +1601,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Enable-SPTimerJob { +function Enable-SPTimerJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1616,22 +1616,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Enable-SPUserLicensing { + +function Enable-SPUserLicensing { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Enable-SPWebApplicationHttpThrottling { +function Enable-SPWebApplicationHttpThrottling { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -1642,11 +1642,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Export-SPAppPackage { + +function Export-SPAppPackage { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -1663,11 +1663,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Export-SPBusinessDataCatalogModel { +function Export-SPBusinessDataCatalogModel { [CmdletBinding()] param( [switch] @@ -1705,11 +1705,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Export-SPEnterpriseSearchTopology { + +function Export-SPEnterpriseSearchTopology { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -1724,11 +1724,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Export-SPInfoPathAdministrationFiles { +function Export-SPInfoPathAdministrationFiles { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [object] @@ -1742,11 +1742,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Export-SPMetadataWebServicePartitionData { + +function Export-SPMetadataWebServicePartitionData { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1770,11 +1770,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Export-SPPerformancePointContent { +function Export-SPPerformancePointContent { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -1789,11 +1789,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Export-SPScaleOutDatabaseTenantData { +function Export-SPScaleOutDatabaseTenantData { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -1815,11 +1815,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Export-SPServerScaleOutDatabaseTenantData { + +function Export-SPServerScaleOutDatabaseTenantData { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -1841,11 +1841,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Export-SPSiteSubscriptionBusinessDataCatalogConfig { +function Export-SPSiteSubscriptionBusinessDataCatalogConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -1880,11 +1880,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Export-SPSiteSubscriptionSettings { + +function Export-SPSiteSubscriptionSettings { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1907,11 +1907,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Export-SPWeb { +function Export-SPWeb { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1959,11 +1959,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-AvailabilityGroupStatus { +function Get-AvailabilityGroupStatus { [CmdletBinding()] param( [string] @@ -1973,11 +1973,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPAccessServiceApplication { + +function Get-SPAccessServiceApplication { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -1988,11 +1988,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPAccessServicesApplication { +function Get-SPAccessServicesApplication { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -2003,11 +2003,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPAccessServicesDatabase { + +function Get-SPAccessServicesDatabase { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -2026,11 +2026,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPAccessServicesDatabaseServer { +function Get-SPAccessServicesDatabaseServer { [CmdletBinding(DefaultParameterSetName='GetDatabaseServersParameterSet')] param( [Parameter(ParameterSetName='GetSingleDatabaseServerParamterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -2051,11 +2051,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPAccessServicesDatabaseServerGroup { +function Get-SPAccessServicesDatabaseServerGroup { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -2070,11 +2070,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPAccessServicesDatabaseServerGroupMapping { + +function Get-SPAccessServicesDatabaseServerGroupMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -2085,11 +2085,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPAlternateURL { +function Get-SPAlternateURL { [CmdletBinding(DefaultParameterSetName='Default')] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -2111,11 +2111,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPAppAcquisitionConfiguration { + +function Get-SPAppAcquisitionConfiguration { [CmdletBinding(DefaultParameterSetName='MarketplaceSettingsInWebApplication')] param( [Parameter(ParameterSetName='MarketplaceSettingsInWebApplication', Mandatory=$true, ValueFromPipeline=$true)] @@ -2130,11 +2130,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPAppAutoProvisionConnection { +function Get-SPAppAutoProvisionConnection { [CmdletBinding()] param( [object] @@ -2147,44 +2147,44 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPAppDeniedEndpointList { + +function Get-SPAppDeniedEndpointList { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPAppDisablingConfiguration { +function Get-SPAppDisablingConfiguration { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPAppDomain { + +function Get-SPAppDomain { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPAppHostingQuotaConfiguration { +function Get-SPAppHostingQuotaConfiguration { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -2196,11 +2196,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPAppInstance { +function Get-SPAppInstance { [CmdletBinding()] param( [Parameter(ParameterSetName='IdentityParameterSet', Mandatory=$true, ValueFromPipeline=$true)] @@ -2231,11 +2231,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPAppPrincipal { + +function Get-SPAppPrincipal { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -2252,22 +2252,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPAppScaleProfile { +function Get-SPAppScaleProfile { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPAppSiteSubscriptionName { + +function Get-SPAppSiteSubscriptionName { [CmdletBinding()] param( [object] @@ -2277,44 +2277,44 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPAppStateSyncLastRunTime { +function Get-SPAppStateSyncLastRunTime { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPAppStateUpdateInterval { + +function Get-SPAppStateUpdateInterval { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPAppStoreConfiguration { +function Get-SPAppStoreConfiguration { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPAuthenticationProvider { + +function Get-SPAuthenticationProvider { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -2335,11 +2335,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPAuthenticationRealm { +function Get-SPAuthenticationRealm { [CmdletBinding()] param( [Parameter(Position=0)] @@ -2351,11 +2351,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPBackupHistory { +function Get-SPBackupHistory { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -2372,33 +2372,33 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPBingMapsBlock { + +function Get-SPBingMapsBlock { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPBingMapsKey { +function Get-SPBingMapsKey { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPBrowserCustomerExperienceImprovementProgram { + +function Get-SPBrowserCustomerExperienceImprovementProgram { [CmdletBinding()] param( [Parameter(ParameterSetName='Farm', Mandatory=$true)] @@ -2417,11 +2417,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPBusinessDataCatalogEntityNotificationWeb { +function Get-SPBusinessDataCatalogEntityNotificationWeb { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -2433,11 +2433,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPBusinessDataCatalogMetadataObject { + +function Get-SPBusinessDataCatalogMetadataObject { [CmdletBinding()] param( [string] @@ -2462,11 +2462,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPBusinessDataCatalogThrottleConfig { +function Get-SPBusinessDataCatalogThrottleConfig { [CmdletBinding(DefaultParameterSetName='ProxyProvided')] param( [Parameter(Mandatory=$true)] @@ -2490,22 +2490,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPCertificateAuthority { + +function Get-SPCertificateAuthority { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPClaimProvider { +function Get-SPClaimProvider { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -2516,22 +2516,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPClaimProviderManager { +function Get-SPClaimProviderManager { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPClaimTypeEncoding { + +function Get-SPClaimTypeEncoding { [CmdletBinding()] param( [char] @@ -2545,11 +2545,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPContentDatabase { +function Get-SPContentDatabase { [CmdletBinding(DefaultParameterSetName='DefaultSet')] param( [Parameter(ParameterSetName='DefaultSet', Position=0, ValueFromPipeline=$true)] @@ -2587,11 +2587,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPContentDeploymentJob { + +function Get-SPContentDeploymentJob { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -2606,11 +2606,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPContentDeploymentPath { +function Get-SPContentDeploymentPath { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -2621,11 +2621,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPCustomLayoutsPage { +function Get-SPCustomLayoutsPage { [CmdletBinding()] param( [object] @@ -2643,11 +2643,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPDatabase { + +function Get-SPDatabase { [CmdletBinding(DefaultParameterSetName='DefaultParameterSet')] param( [Parameter(ParameterSetName='DefaultParameterSet', Position=0, ValueFromPipeline=$true)] @@ -2662,11 +2662,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPDataConnectionFile { +function Get-SPDataConnectionFile { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -2677,11 +2677,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPDataConnectionFileDependent { + +function Get-SPDataConnectionFileDependent { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -2692,11 +2692,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPDeletedSite { +function Get-SPDeletedSite { [CmdletBinding(DefaultParameterSetName='AllDeletedSitesInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='AllDeletedSitesInIdentity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -2728,11 +2728,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPDesignerSettings { +function Get-SPDesignerSettings { [CmdletBinding()] param( [Parameter(ParameterSetName='WebApplication', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -2743,22 +2743,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPDiagnosticConfig { + +function Get-SPDiagnosticConfig { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPDiagnosticsPerformanceCounter { +function Get-SPDiagnosticsPerformanceCounter { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] @@ -2773,11 +2773,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPDiagnosticsProvider { + +function Get-SPDiagnosticsProvider { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -2788,11 +2788,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPDistributedCacheClientSetting { +function Get-SPDistributedCacheClientSetting { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -2804,11 +2804,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEduServiceSetting { + +function Get-SPEduServiceSetting { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -2823,11 +2823,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchAdministrationComponent { +function Get-SPEnterpriseSearchAdministrationComponent { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -2838,11 +2838,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchComponent { + +function Get-SPEnterpriseSearchComponent { [CmdletBinding()] param( [Parameter(Position=0)] @@ -2860,11 +2860,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchContentEnrichmentConfiguration { +function Get-SPEnterpriseSearchContentEnrichmentConfiguration { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -2875,11 +2875,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchCrawlContentSource { +function Get-SPEnterpriseSearchCrawlContentSource { [CmdletBinding()] param( [Parameter(Position=0)] @@ -2894,11 +2894,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchCrawlCustomConnector { + +function Get-SPEnterpriseSearchCrawlCustomConnector { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -2913,11 +2913,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchCrawlDatabase { +function Get-SPEnterpriseSearchCrawlDatabase { [CmdletBinding()] param( [Parameter(Position=0)] @@ -2932,11 +2932,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchCrawlExtension { + +function Get-SPEnterpriseSearchCrawlExtension { [CmdletBinding()] param( [Parameter(Position=0)] @@ -2951,11 +2951,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchCrawlLogReadPermission { +function Get-SPEnterpriseSearchCrawlLogReadPermission { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -2970,11 +2970,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchCrawlMapping { + +function Get-SPEnterpriseSearchCrawlMapping { [CmdletBinding()] param( [Parameter(Position=0)] @@ -2989,11 +2989,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchCrawlRule { +function Get-SPEnterpriseSearchCrawlRule { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3008,11 +3008,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchFileFormat { + +function Get-SPEnterpriseSearchFileFormat { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3027,11 +3027,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchHostController { +function Get-SPEnterpriseSearchHostController { [CmdletBinding()] param( [object] @@ -3041,11 +3041,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchLanguageResourcePhrase { +function Get-SPEnterpriseSearchLanguageResourcePhrase { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3077,11 +3077,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchLinguisticComponentsStatus { + +function Get-SPEnterpriseSearchLinguisticComponentsStatus { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -3096,11 +3096,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchLinksDatabase { +function Get-SPEnterpriseSearchLinksDatabase { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3115,11 +3115,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchMetadataCategory { + +function Get-SPEnterpriseSearchMetadataCategory { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3140,11 +3140,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchMetadataCrawledProperty { +function Get-SPEnterpriseSearchMetadataCrawledProperty { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3181,11 +3181,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchMetadataManagedProperty { + +function Get-SPEnterpriseSearchMetadataManagedProperty { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3209,11 +3209,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchMetadataMapping { +function Get-SPEnterpriseSearchMetadataMapping { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -3236,11 +3236,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchOwner { + +function Get-SPEnterpriseSearchOwner { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3259,11 +3259,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchPropertyRule { +function Get-SPEnterpriseSearchPropertyRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -3278,33 +3278,33 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchPropertyRuleCollection { +function Get-SPEnterpriseSearchPropertyRuleCollection { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchQueryAndSiteSettingsService { + +function Get-SPEnterpriseSearchQueryAndSiteSettingsService { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance { +function Get-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3318,22 +3318,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchQueryAndSiteSettingsServiceProxy { + +function Get-SPEnterpriseSearchQueryAndSiteSettingsServiceProxy { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchQueryAuthority { +function Get-SPEnterpriseSearchQueryAuthority { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3353,11 +3353,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchQueryDemoted { +function Get-SPEnterpriseSearchQueryDemoted { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3377,11 +3377,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchQueryKeyword { + +function Get-SPEnterpriseSearchQueryKeyword { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3396,11 +3396,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchQueryScope { +function Get-SPEnterpriseSearchQueryScope { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3419,11 +3419,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchQueryScopeRule { + +function Get-SPEnterpriseSearchQueryScopeRule { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3445,11 +3445,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchQuerySpellingCorrection { +function Get-SPEnterpriseSearchQuerySpellingCorrection { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -3464,11 +3464,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchQuerySuggestionCandidates { +function Get-SPEnterpriseSearchQuerySuggestionCandidates { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -3487,11 +3487,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchRankingModel { + +function Get-SPEnterpriseSearchRankingModel { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3511,11 +3511,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchResultItemType { +function Get-SPEnterpriseSearchResultItemType { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3539,11 +3539,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchResultSource { + +function Get-SPEnterpriseSearchResultSource { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3563,11 +3563,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchSecurityTrimmer { +function Get-SPEnterpriseSearchSecurityTrimmer { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3582,22 +3582,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchService { + +function Get-SPEnterpriseSearchService { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchServiceApplication { +function Get-SPEnterpriseSearchServiceApplication { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3608,11 +3608,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchServiceApplicationBackupStore { + +function Get-SPEnterpriseSearchServiceApplicationBackupStore { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -3639,11 +3639,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchServiceApplicationProxy { +function Get-SPEnterpriseSearchServiceApplicationProxy { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3654,11 +3654,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchServiceInstance { +function Get-SPEnterpriseSearchServiceInstance { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3672,11 +3672,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchSiteHitRule { + +function Get-SPEnterpriseSearchSiteHitRule { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3691,11 +3691,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchStatus { +function Get-SPEnterpriseSearchStatus { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -3730,11 +3730,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchTopology { + +function Get-SPEnterpriseSearchTopology { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3752,22 +3752,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchVssDataPath { +function Get-SPEnterpriseSearchVssDataPath { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPExcelBIServer { + +function Get-SPExcelBIServer { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -3782,11 +3782,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPExcelBlockedFileType { +function Get-SPExcelBlockedFileType { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -3801,11 +3801,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPExcelDataConnectionLibrary { + +function Get-SPExcelDataConnectionLibrary { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -3820,11 +3820,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPExcelDataProvider { +function Get-SPExcelDataProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -3835,11 +3835,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPExcelFileLocation { +function Get-SPExcelFileLocation { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -3854,11 +3854,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPExcelServiceApplication { + +function Get-SPExcelServiceApplication { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -3869,11 +3869,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPExcelUserDefinedFunction { +function Get-SPExcelUserDefinedFunction { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -3888,22 +3888,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPFarm { + +function Get-SPFarm { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPFarmConfig { +function Get-SPFarmConfig { [CmdletBinding()] param( [switch] @@ -3913,11 +3913,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPFeature { + +function Get-SPFeature { [CmdletBinding(DefaultParameterSetName='Default')] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -3955,11 +3955,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPHealthAnalysisRule { +function Get-SPHealthAnalysisRule { [CmdletBinding(DefaultParameterSetName='Default')] param( [Parameter(ParameterSetName='SpecificRule', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -3970,11 +3970,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPHelpCollection { + +function Get-SPHelpCollection { [CmdletBinding()] param( [string] @@ -3984,11 +3984,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPInfoPathFormsService { +function Get-SPInfoPathFormsService { [CmdletBinding()] param( [object] @@ -3998,11 +3998,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPInfoPathFormTemplate { +function Get-SPInfoPathFormTemplate { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -4013,11 +4013,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPInfoPathUserAgent { + +function Get-SPInfoPathUserAgent { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -4028,11 +4028,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPInfoPathWebServiceProxy { +function Get-SPInfoPathWebServiceProxy { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4043,44 +4043,44 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPInternalAppStateSyncLastRunTime { + +function Get-SPInternalAppStateSyncLastRunTime { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPInternalAppStateUpdateInterval { +function Get-SPInternalAppStateUpdateInterval { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPIRMSettings { +function Get-SPIRMSettings { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPLogEvent { + +function Get-SPLogEvent { [CmdletBinding(DefaultParameterSetName='Directory')] param( [Parameter(ParameterSetName='Directory')] @@ -4114,11 +4114,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPLogLevel { +function Get-SPLogLevel { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] @@ -4129,11 +4129,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPManagedAccount { + +function Get-SPManagedAccount { [CmdletBinding(DefaultParameterSetName='Service')] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -4156,11 +4156,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPManagedPath { +function Get-SPManagedPath { [CmdletBinding(DefaultParameterSetName='WebApplication')] param( [Parameter(Position=0)] @@ -4179,11 +4179,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPMetadataServiceApplication { +function Get-SPMetadataServiceApplication { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4194,11 +4194,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPMetadataServiceApplicationProxy { + +function Get-SPMetadataServiceApplicationProxy { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4209,11 +4209,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPMobileMessagingAccount { +function Get-SPMobileMessagingAccount { [CmdletBinding()] param( [Parameter(Position=0)] @@ -4229,22 +4229,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPO365LinkSettings { + +function Get-SPO365LinkSettings { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPODataConnectionSetting { +function Get-SPODataConnectionSetting { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -4261,11 +4261,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPODataConnectionSettingMetadata { + +function Get-SPODataConnectionSettingMetadata { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -4283,11 +4283,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPOfficeStoreAppsDefaultActivation { +function Get-SPOfficeStoreAppsDefaultActivation { [CmdletBinding(DefaultParameterSetName='AppsForOfficeSettingsInWebApplication')] param( [Parameter(ParameterSetName='AppsForOfficeSettingsInWebApplication', Mandatory=$true, ValueFromPipeline=$true)] @@ -4302,11 +4302,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPPendingUpgradeActions { + +function Get-SPPendingUpgradeActions { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4320,11 +4320,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPPerformancePointServiceApplication { +function Get-SPPerformancePointServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -4335,11 +4335,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPPerformancePointServiceApplicationTrustedLocation { +function Get-SPPerformancePointServiceApplicationTrustedLocation { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] @@ -4354,11 +4354,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPPluggableSecurityTrimmer { + +function Get-SPPluggableSecurityTrimmer { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -4370,11 +4370,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPProcessAccount { +function Get-SPProcessAccount { [CmdletBinding(DefaultParameterSetName='NetworkService')] param( [Parameter(ParameterSetName='NetworkService')] @@ -4393,11 +4393,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPProduct { + +function Get-SPProduct { [CmdletBinding(DefaultParameterSetName='Local')] param( [Parameter(ParameterSetName='Server', ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -4412,11 +4412,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPProfileLeader { +function Get-SPProfileLeader { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4433,11 +4433,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPProfileServiceApplicationSecurity { + +function Get-SPProfileServiceApplicationSecurity { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -4457,11 +4457,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPRequestManagementSettings { +function Get-SPRequestManagementSettings { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4473,11 +4473,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPRoutingMachineInfo { + +function Get-SPRoutingMachineInfo { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4497,11 +4497,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPRoutingMachinePool { +function Get-SPRoutingMachinePool { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4517,11 +4517,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPRoutingRule { +function Get-SPRoutingRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4537,11 +4537,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPScaleOutDatabase { + +function Get-SPScaleOutDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -4552,11 +4552,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPScaleOutDatabaseDataState { +function Get-SPScaleOutDatabaseDataState { [CmdletBinding(DefaultParameterSetName='AttachedDatabase', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='AttachedDatabase', Mandatory=$true, ValueFromPipeline=$true)] @@ -4577,11 +4577,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPScaleOutDatabaseInconsistency { + +function Get-SPScaleOutDatabaseInconsistency { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -4592,11 +4592,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPScaleOutDatabaseLogEntry { +function Get-SPScaleOutDatabaseLogEntry { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -4621,11 +4621,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPSecureStoreApplication { + +function Get-SPSecureStoreApplication { [CmdletBinding(DefaultParameterSetName='NameSet')] param( [Parameter(ParameterSetName='AllSet', Mandatory=$true)] @@ -4645,33 +4645,33 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSecureStoreSystemAccount { +function Get-SPSecureStoreSystemAccount { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPSecurityTokenServiceConfig { + +function Get-SPSecurityTokenServiceConfig { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPServer { +function Get-SPServer { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -4683,11 +4683,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPServerScaleOutDatabase { +function Get-SPServerScaleOutDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -4698,11 +4698,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPServerScaleOutDatabaseDataState { + +function Get-SPServerScaleOutDatabaseDataState { [CmdletBinding(DefaultParameterSetName='AttachedDatabase', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='AttachedDatabase', Mandatory=$true, ValueFromPipeline=$true)] @@ -4723,11 +4723,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPServerScaleOutDatabaseInconsistency { +function Get-SPServerScaleOutDatabaseInconsistency { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -4738,11 +4738,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPServerScaleOutDatabaseLogEntry { + +function Get-SPServerScaleOutDatabaseLogEntry { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -4767,11 +4767,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPServiceApplication { +function Get-SPServiceApplication { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -4785,11 +4785,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPServiceApplicationEndpoint { +function Get-SPServiceApplicationEndpoint { [CmdletBinding(DefaultParameterSetName='Identity')] param( [Parameter(ParameterSetName='Identity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4808,11 +4808,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPServiceApplicationPool { + +function Get-SPServiceApplicationPool { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -4823,11 +4823,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPServiceApplicationProxy { +function Get-SPServiceApplicationProxy { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -4838,11 +4838,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPServiceApplicationProxyGroup { + +function Get-SPServiceApplicationProxyGroup { [CmdletBinding(DefaultParameterSetName='Identity')] param( [Parameter(ParameterSetName='Identity', Position=0, ValueFromPipeline=$true)] @@ -4857,11 +4857,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPServiceApplicationSecurity { +function Get-SPServiceApplicationSecurity { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4876,11 +4876,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPServiceContext { +function Get-SPServiceContext { [CmdletBinding()] param( [Parameter(ParameterSetName='Site', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4895,11 +4895,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPServiceHostConfig { + +function Get-SPServiceHostConfig { [CmdletBinding()] param( [switch] @@ -4909,11 +4909,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPServiceInstance { +function Get-SPServiceInstance { [CmdletBinding(DefaultParameterSetName='Identity')] param( [Parameter(ParameterSetName='Identity', Position=0, ValueFromPipeline=$true)] @@ -4931,22 +4931,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPSessionStateService { + +function Get-SPSessionStateService { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPShellAdmin { +function Get-SPShellAdmin { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -4957,11 +4957,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPSite { + +function Get-SPSite { [CmdletBinding(DefaultParameterSetName='AllSitesInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='AllSitesInIdentity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4997,11 +4997,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSiteAdministration { +function Get-SPSiteAdministration { [CmdletBinding(DefaultParameterSetName='AllSitesInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='AllSitesInIdentity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5034,11 +5034,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPSiteSubscription { + +function Get-SPSiteSubscription { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5049,11 +5049,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSiteSubscriptionConfig { +function Get-SPSiteSubscriptionConfig { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5065,11 +5065,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSiteSubscriptionEdiscoveryHub { +function Get-SPSiteSubscriptionEdiscoveryHub { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5080,11 +5080,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPSiteSubscriptionEdiscoverySearchScope { + +function Get-SPSiteSubscriptionEdiscoverySearchScope { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5095,11 +5095,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSiteSubscriptionFeaturePack { +function Get-SPSiteSubscriptionFeaturePack { [CmdletBinding(DefaultParameterSetName='FeaturePack')] param( [Parameter(ParameterSetName='FeaturePack', Position=0, ValueFromPipeline=$true)] @@ -5114,11 +5114,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPSiteSubscriptionIRMConfig { + +function Get-SPSiteSubscriptionIRMConfig { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5130,11 +5130,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSiteSubscriptionMetadataConfig { +function Get-SPSiteSubscriptionMetadataConfig { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5149,11 +5149,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPSiteUpgradeSessionInfo { + +function Get-SPSiteUpgradeSessionInfo { [CmdletBinding(DefaultParameterSetName='ContentDB')] param( [Parameter(ParameterSetName='Site', Mandatory=$true)] @@ -5188,11 +5188,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSiteURL { +function Get-SPSiteURL { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5203,11 +5203,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPSolution { + +function Get-SPSolution { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5218,11 +5218,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPStateServiceApplication { +function Get-SPStateServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -5234,11 +5234,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPStateServiceApplicationProxy { +function Get-SPStateServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -5250,11 +5250,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPStateServiceDatabase { + +function Get-SPStateServiceDatabase { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Default', Position=0, ValueFromPipeline=$true)] @@ -5271,11 +5271,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPTaxonomySession { +function Get-SPTaxonomySession { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -5286,11 +5286,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPThrottlingRule { + +function Get-SPThrottlingRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5306,11 +5306,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPTimerJob { +function Get-SPTimerJob { [CmdletBinding()] param( [Parameter(Position=0)] @@ -5329,11 +5329,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPTopologyServiceApplication { + +function Get-SPTopologyServiceApplication { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5344,11 +5344,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPTopologyServiceApplicationProxy { +function Get-SPTopologyServiceApplicationProxy { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5359,11 +5359,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPTranslationThrottlingSetting { + +function Get-SPTranslationThrottlingSetting { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [object] @@ -5373,11 +5373,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPTrustedIdentityTokenIssuer { +function Get-SPTrustedIdentityTokenIssuer { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5389,11 +5389,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPTrustedRootAuthority { +function Get-SPTrustedRootAuthority { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5405,11 +5405,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPTrustedSecurityTokenIssuer { + +function Get-SPTrustedSecurityTokenIssuer { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5420,11 +5420,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPTrustedServiceTokenIssuer { +function Get-SPTrustedServiceTokenIssuer { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5435,22 +5435,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPUpgradeActions { + +function Get-SPUpgradeActions { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPUsageApplication { +function Get-SPUsageApplication { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5465,11 +5465,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPUsageDefinition { +function Get-SPUsageDefinition { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5480,11 +5480,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPUsageService { + +function Get-SPUsageService { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5495,11 +5495,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPUser { +function Get-SPUser { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5523,22 +5523,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPUserLicense { + +function Get-SPUserLicense { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPUserLicenseMapping { +function Get-SPUserLicenseMapping { [CmdletBinding()] param( [Parameter(ParameterSetName='WebApplication', ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -5550,22 +5550,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPUserLicensing { +function Get-SPUserLicensing { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPUserSettingsProvider { + +function Get-SPUserSettingsProvider { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5576,22 +5576,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPUserSettingsProviderManager { +function Get-SPUserSettingsProviderManager { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPUserSolution { + +function Get-SPUserSolution { [CmdletBinding()] param( [Parameter(Position=0)] @@ -5606,11 +5606,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPVisioExternalData { +function Get-SPVisioExternalData { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -5622,11 +5622,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPVisioPerformance { + +function Get-SPVisioPerformance { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -5638,11 +5638,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPVisioSafeDataProvider { +function Get-SPVisioSafeDataProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -5660,11 +5660,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPVisioServiceApplication { + +function Get-SPVisioServiceApplication { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -5675,11 +5675,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPVisioServiceApplicationProxy { +function Get-SPVisioServiceApplicationProxy { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -5690,11 +5690,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPWeb { +function Get-SPWeb { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0)] @@ -5718,11 +5718,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPWebApplication { + +function Get-SPWebApplication { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5736,11 +5736,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPWebApplicationAppDomain { +function Get-SPWebApplicationAppDomain { [CmdletBinding(DefaultParameterSetName='Default')] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5762,11 +5762,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPWebApplicationHttpThrottlingMonitor { + +function Get-SPWebApplicationHttpThrottlingMonitor { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -5777,11 +5777,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPWebPartPack { +function Get-SPWebPartPack { [CmdletBinding()] param( [Parameter(Position=0)] @@ -5800,11 +5800,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPWebTemplate { + +function Get-SPWebTemplate { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5818,11 +5818,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPWOPIBinding { +function Get-SPWOPIBinding { [CmdletBinding()] param( [ValidateNotNullOrEmpty()] @@ -5854,33 +5854,33 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPWOPISuppressionSetting { + +function Get-SPWOPISuppressionSetting { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPWOPIZone { +function Get-SPWOPIZone { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPWorkflowConfig { +function Get-SPWorkflowConfig { [CmdletBinding()] param( [Parameter(ParameterSetName='WebApplication', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -5895,22 +5895,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPWorkflowServiceApplicationProxy { + +function Get-SPWorkflowServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Grant-SPBusinessDataCatalogMetadataObject { +function Grant-SPBusinessDataCatalogMetadataObject { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -5934,11 +5934,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Grant-SPObjectSecurity { + +function Grant-SPObjectSecurity { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5963,11 +5963,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Import-SPAppPackage { +function Import-SPAppPackage { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -5994,11 +5994,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Import-SPBusinessDataCatalogDotNetAssembly { + +function Import-SPBusinessDataCatalogDotNetAssembly { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -6019,11 +6019,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Import-SPBusinessDataCatalogModel { +function Import-SPBusinessDataCatalogModel { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [switch] @@ -6063,11 +6063,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Import-SPEnterpriseSearchCustomExtractionDictionary { + +function Import-SPEnterpriseSearchCustomExtractionDictionary { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -6087,11 +6087,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Import-SPEnterpriseSearchPopularQueries { +function Import-SPEnterpriseSearchPopularQueries { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -6113,11 +6113,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Import-SPEnterpriseSearchThesaurus { + +function Import-SPEnterpriseSearchThesaurus { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -6132,11 +6132,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Import-SPEnterpriseSearchTopology { +function Import-SPEnterpriseSearchTopology { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -6151,11 +6151,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Import-SPInfoPathAdministrationFiles { + +function Import-SPInfoPathAdministrationFiles { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [object] @@ -6169,11 +6169,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Import-SPMetadataWebServicePartitionData { +function Import-SPMetadataWebServicePartitionData { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -6201,11 +6201,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Import-SPPerformancePointContent { + +function Import-SPPerformancePointContent { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -6232,11 +6232,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Import-SPScaleOutDatabaseTenantData { +function Import-SPScaleOutDatabaseTenantData { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -6255,11 +6255,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Import-SPServerScaleOutDatabaseTenantData { + +function Import-SPServerScaleOutDatabaseTenantData { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -6278,11 +6278,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Import-SPSiteSubscriptionBusinessDataCatalogConfig { +function Import-SPSiteSubscriptionBusinessDataCatalogConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -6314,11 +6314,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Import-SPSiteSubscriptionSettings { + +function Import-SPSiteSubscriptionSettings { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -6341,11 +6341,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Import-SPWeb { +function Import-SPWeb { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -6387,22 +6387,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Initialize-SPResourceSecurity { + +function Initialize-SPResourceSecurity { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Initialize-SPStateServiceDatabase { +function Initialize-SPStateServiceDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -6414,11 +6414,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Install-SPApp { + +function Install-SPApp { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [Parameter(Mandatory=$true)] @@ -6435,22 +6435,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Install-SPApplicationContent { +function Install-SPApplicationContent { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Install-SPDataConnectionFile { + +function Install-SPDataConnectionFile { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -6472,11 +6472,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Install-SPEduSites { +function Install-SPEduSites { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -6495,11 +6495,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Install-SPFeature { + +function Install-SPFeature { [CmdletBinding(DefaultParameterSetName='PathSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='PathSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -6530,11 +6530,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Install-SPHelpCollection { +function Install-SPHelpCollection { [CmdletBinding(DefaultParameterSetName='InstallOne')] param( [Parameter(ParameterSetName='InstallOne', Mandatory=$true)] @@ -6550,11 +6550,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Install-SPInfoPathFormTemplate { + +function Install-SPInfoPathFormTemplate { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -6571,11 +6571,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Install-SPService { +function Install-SPService { [CmdletBinding()] param( [switch] @@ -6585,11 +6585,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Install-SPSolution { + +function Install-SPSolution { [CmdletBinding(DefaultParameterSetName='Deploy', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Synchronize', Position=0, ValueFromPipeline=$true)] @@ -6644,11 +6644,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Install-SPUserSolution { +function Install-SPUserSolution { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -6663,11 +6663,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Install-SPWebPartPack { + +function Install-SPWebPartPack { [CmdletBinding(DefaultParameterSetName='UseFileName', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='UseName', Mandatory=$true, Position=0)] @@ -6701,11 +6701,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Merge-SPLogFile { +function Merge-SPLogFile { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -6755,11 +6755,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Mount-SPContentDatabase { + +function Mount-SPContentDatabase { [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [switch] @@ -6807,11 +6807,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Mount-SPStateServiceDatabase { +function Mount-SPStateServiceDatabase { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -6836,11 +6836,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Move-SPBlobStorageLocation { + +function Move-SPBlobStorageLocation { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -6868,11 +6868,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Move-SPDeletedSite { +function Move-SPDeletedSite { [CmdletBinding(DefaultParameterSetName='DatabaseFromPipebind', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -6899,11 +6899,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Move-SPEnterpriseSearchLinksDatabases { + +function Move-SPEnterpriseSearchLinksDatabases { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -6926,11 +6926,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Move-SPProfileManagedMetadataProperty { +function Move-SPProfileManagedMetadataProperty { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -6953,11 +6953,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Move-SPSite { + +function Move-SPSite { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -6979,11 +6979,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Move-SPSocialComment { +function Move-SPSocialComment { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -7005,11 +7005,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Move-SPUser { + +function Move-SPUser { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -7030,11 +7030,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPAccessServiceApplication { +function New-SPAccessServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -7114,11 +7114,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPAccessServicesApplication { + +function New-SPAccessServicesApplication { [CmdletBinding(DefaultParameterSetName='NoApplicationServerParameterSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='DefaultParameterSet', Mandatory=$true)] @@ -7206,11 +7206,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPAccessServicesApplicationProxy { +function New-SPAccessServicesApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -7221,11 +7221,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPAccessServicesDatabaseServer { + +function New-SPAccessServicesDatabaseServer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -7278,11 +7278,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPAlternateURL { +function New-SPAlternateURL { [CmdletBinding(DefaultParameterSetName='WebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -7307,11 +7307,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPAppManagementServiceApplication { + +function New-SPAppManagementServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -7342,11 +7342,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPAppManagementServiceApplicationProxy { +function New-SPAppManagementServiceApplicationProxy { [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -7368,11 +7368,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPAuthenticationProvider { + +function New-SPAuthenticationProvider { [CmdletBinding(DefaultParameterSetName='Windows')] param( [Parameter(ParameterSetName='Windows')] @@ -7410,11 +7410,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPAzureAccessControlServiceApplicationProxy { +function New-SPAzureAccessControlServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -7435,11 +7435,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPBECWebServiceApplicationProxy { + +function New-SPBECWebServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -7460,11 +7460,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPBusinessDataCatalogServiceApplication { +function New-SPBusinessDataCatalogServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -7503,11 +7503,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPBusinessDataCatalogServiceApplicationProxy { + +function New-SPBusinessDataCatalogServiceApplicationProxy { [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Uri', Mandatory=$true)] @@ -7534,11 +7534,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPCentralAdministration { +function New-SPCentralAdministration { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -7553,11 +7553,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPClaimProvider { + +function New-SPClaimProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -7586,11 +7586,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPClaimsPrincipal { +function New-SPClaimsPrincipal { [CmdletBinding(DefaultParameterSetName='IdentityType')] param( [Parameter(ParameterSetName='IdentityType', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -7641,11 +7641,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPClaimTypeEncoding { + +function New-SPClaimTypeEncoding { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -7664,11 +7664,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPClaimTypeMapping { +function New-SPClaimTypeMapping { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -7694,11 +7694,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPConfigurationDatabase { + +function New-SPConfigurationDatabase { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -7745,11 +7745,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPContentDatabase { +function New-SPContentDatabase { [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -7791,11 +7791,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPContentDeploymentJob { + +function New-SPContentDeploymentJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -7837,11 +7837,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPContentDeploymentPath { +function New-SPContentDeploymentPath { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -7900,11 +7900,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEduClass { + +function New-SPEduClass { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -7955,11 +7955,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchAdminComponent { +function New-SPEnterpriseSearchAdminComponent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -7977,11 +7977,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchAnalyticsProcessingComponent { + +function New-SPEnterpriseSearchAnalyticsProcessingComponent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -7999,22 +7999,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchContentEnrichmentConfiguration { +function New-SPEnterpriseSearchContentEnrichmentConfiguration { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchContentProcessingComponent { + +function New-SPEnterpriseSearchContentProcessingComponent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -8032,11 +8032,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchCrawlComponent { +function New-SPEnterpriseSearchCrawlComponent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -8054,11 +8054,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchCrawlContentSource { + +function New-SPEnterpriseSearchCrawlContentSource { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -8107,11 +8107,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchCrawlCustomConnector { +function New-SPEnterpriseSearchCrawlCustomConnector { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -8134,11 +8134,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchCrawlDatabase { + +function New-SPEnterpriseSearchCrawlDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -8165,11 +8165,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchCrawlExtension { +function New-SPEnterpriseSearchCrawlExtension { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0)] @@ -8184,11 +8184,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchCrawlMapping { + +function New-SPEnterpriseSearchCrawlMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -8208,11 +8208,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchCrawlRule { +function New-SPEnterpriseSearchCrawlRule { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -8262,11 +8262,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchFileFormat { + +function New-SPEnterpriseSearchFileFormat { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -8289,11 +8289,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchIndexComponent { +function New-SPEnterpriseSearchIndexComponent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -8317,11 +8317,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchLanguageResourcePhrase { + +function New-SPEnterpriseSearchLanguageResourcePhrase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -8355,11 +8355,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchLinksDatabase { +function New-SPEnterpriseSearchLinksDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -8386,11 +8386,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchMetadataCategory { + +function New-SPEnterpriseSearchMetadataCategory { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -8421,11 +8421,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchMetadataCrawledProperty { +function New-SPEnterpriseSearchMetadataCrawledProperty { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -8471,11 +8471,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchMetadataManagedProperty { + +function New-SPEnterpriseSearchMetadataManagedProperty { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -8562,11 +8562,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchMetadataMapping { +function New-SPEnterpriseSearchMetadataMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -8591,11 +8591,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchQueryAuthority { + +function New-SPEnterpriseSearchQueryAuthority { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -8620,11 +8620,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchQueryDemoted { +function New-SPEnterpriseSearchQueryDemoted { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -8644,11 +8644,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchQueryKeyword { + +function New-SPEnterpriseSearchQueryKeyword { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -8683,11 +8683,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchQueryProcessingComponent { +function New-SPEnterpriseSearchQueryProcessingComponent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -8705,11 +8705,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchQueryScope { + +function New-SPEnterpriseSearchQueryScope { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -8750,11 +8750,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchQueryScopeRule { +function New-SPEnterpriseSearchQueryScopeRule { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [object] @@ -8799,11 +8799,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchRankingModel { + +function New-SPEnterpriseSearchRankingModel { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -8823,11 +8823,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchResultItemType { +function New-SPEnterpriseSearchResultItemType { [CmdletBinding(DefaultParameterSetName='New', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] @@ -8894,11 +8894,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchResultSource { + +function New-SPEnterpriseSearchResultSource { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -8949,11 +8949,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchSecurityTrimmer { +function New-SPEnterpriseSearchSecurityTrimmer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -8978,11 +8978,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchServiceApplication { + +function New-SPEnterpriseSearchServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0)] @@ -9021,11 +9021,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchServiceApplicationProxy { +function New-SPEnterpriseSearchServiceApplicationProxy { [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='SSA', Mandatory=$true)] @@ -9050,11 +9050,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchSiteHitRule { + +function New-SPEnterpriseSearchSiteHitRule { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -9077,11 +9077,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchTopology { +function New-SPEnterpriseSearchTopology { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -9100,11 +9100,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPExcelBIServer { + +function New-SPExcelBIServer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -9122,11 +9122,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPExcelBlockedFileType { +function New-SPExcelBlockedFileType { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -9141,11 +9141,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPExcelDataConnectionLibrary { + +function New-SPExcelDataConnectionLibrary { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -9163,11 +9163,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPExcelDataProvider { +function New-SPExcelDataProvider { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -9189,11 +9189,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPExcelFileLocation { + +function New-SPExcelFileLocation { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -9271,11 +9271,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPExcelServiceApplication { +function New-SPExcelServiceApplication { [CmdletBinding(DefaultParameterSetName='ExistingTargetApplicationParameterSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [int] @@ -9351,11 +9351,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPExcelUserDefinedFunction { + +function New-SPExcelUserDefinedFunction { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -9379,22 +9379,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPLogFile { +function New-SPLogFile { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function New-SPManagedAccount { + +function New-SPManagedAccount { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -9405,11 +9405,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPManagedPath { +function New-SPManagedPath { [CmdletBinding(DefaultParameterSetName='WebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -9431,11 +9431,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPMarketplaceWebServiceApplicationProxy { + +function New-SPMarketplaceWebServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -9456,11 +9456,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPMetadataServiceApplication { +function New-SPMetadataServiceApplication { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -9545,11 +9545,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPMetadataServiceApplicationProxy { + +function New-SPMetadataServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [switch] @@ -9584,11 +9584,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPODataConnectionSetting { +function New-SPODataConnectionSetting { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -9624,11 +9624,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPOnlineApplicationPrincipalManagementServiceApplicationProxy { + +function New-SPOnlineApplicationPrincipalManagementServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -9649,11 +9649,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPPerformancePointServiceApplication { +function New-SPPerformancePointServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -9759,11 +9759,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPPerformancePointServiceApplicationProxy { + +function New-SPPerformancePointServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -9782,11 +9782,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPPerformancePointServiceApplicationTrustedLocation { +function New-SPPerformancePointServiceApplicationTrustedLocation { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -9813,11 +9813,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPPowerPointConversionServiceApplication { + +function New-SPPowerPointConversionServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -9834,11 +9834,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPPowerPointConversionServiceApplicationProxy { +function New-SPPowerPointConversionServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -9857,11 +9857,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPProfileServiceApplication { + +function New-SPProfileServiceApplication { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [string] @@ -9929,11 +9929,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPProfileServiceApplicationProxy { +function New-SPProfileServiceApplicationProxy { [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [string] @@ -9959,11 +9959,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPRequestManagementRuleCriteria { + +function New-SPRequestManagementRuleCriteria { [CmdletBinding()] param( [Parameter(ParameterSetName='StandardParameterSet', Mandatory=$true, Position=0)] @@ -9995,11 +9995,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPSecureStoreApplication { +function New-SPSecureStoreApplication { [CmdletBinding()] param( [object] @@ -10029,11 +10029,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPSecureStoreApplicationField { + +function New-SPSecureStoreApplicationField { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -10052,11 +10052,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPSecureStoreServiceApplication { +function New-SPSecureStoreServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -10102,11 +10102,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPSecureStoreServiceApplicationProxy { + +function New-SPSecureStoreServiceApplicationProxy { [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [switch] @@ -10128,11 +10128,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPSecureStoreTargetApplication { +function New-SPSecureStoreTargetApplication { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -10161,11 +10161,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPServiceApplicationPool { + +function New-SPServiceApplicationPool { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -10182,11 +10182,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPServiceApplicationProxyGroup { +function New-SPServiceApplicationProxyGroup { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -10200,11 +10200,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPSite { + +function New-SPSite { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -10261,33 +10261,33 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPSiteSubscription { +function New-SPSiteSubscription { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function New-SPSiteSubscriptionFeaturePack { + +function New-SPSiteSubscriptionFeaturePack { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function New-SPStateServiceApplication { +function New-SPStateServiceApplication { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -10302,11 +10302,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPStateServiceApplicationProxy { + +function New-SPStateServiceApplicationProxy { [CmdletBinding()] param( [string] @@ -10323,11 +10323,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPStateServiceDatabase { +function New-SPStateServiceDatabase { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -10352,11 +10352,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPSubscriptionSettingsServiceApplication { + +function New-SPSubscriptionSettingsServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -10387,11 +10387,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPSubscriptionSettingsServiceApplicationProxy { +function New-SPSubscriptionSettingsServiceApplicationProxy { [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Uri', Mandatory=$true)] @@ -10407,11 +10407,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPTranslationServiceApplication { + +function New-SPTranslationServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -10444,11 +10444,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPTranslationServiceApplicationProxy { +function New-SPTranslationServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [switch] @@ -10473,11 +10473,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPTrustedIdentityTokenIssuer { + +function New-SPTrustedIdentityTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] @@ -10568,11 +10568,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPTrustedRootAuthority { +function New-SPTrustedRootAuthority { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0)] @@ -10594,11 +10594,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPTrustedSecurityTokenIssuer { + +function New-SPTrustedSecurityTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0)] @@ -10606,37 +10606,31 @@ param( [string] ${Name}, - [ValidateNotNullOrEmpty()] [string] ${Description}, - [ValidateNotNullOrEmpty()] + [Parameter(ParameterSetName='ManualConfigParameterSet', Mandatory=$true)] [string] ${RegisteredIssuerName}, - [ValidateNotNullOrEmpty()] [switch] ${IsTrustBroker}, - [Parameter(ParameterSetName='ImportCertificateParameterSet', Mandatory=$true)] - [ValidateNotNull()] - [System.Security.Cryptography.X509Certificates.X509Certificate2] + [Parameter(ParameterSetName='ManualConfigParameterSet', Mandatory=$true)] + [Object] ${Certificate}, [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] - [ValidateNotNull()] [uri] ${MetadataEndPoint}, [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - - } + } -function New-SPTrustedServiceTokenIssuer { +function New-SPTrustedServiceTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0)] @@ -10662,11 +10656,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPUsageApplication { + +function New-SPUsageApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0)] @@ -10707,22 +10701,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPUsageLogFile { +function New-SPUsageLogFile { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function New-SPUser { + +function New-SPUser { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -10754,11 +10748,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPUserLicenseMapping { +function New-SPUserLicenseMapping { [CmdletBinding(DefaultParameterSetName='WindowsAuth', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='WindowsAuth', Mandatory=$true, ValueFromPipeline=$true)] @@ -10814,11 +10808,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPUserSettingsProvider { + +function New-SPUserSettingsProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -10837,11 +10831,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPVisioSafeDataProvider { +function New-SPVisioSafeDataProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -10866,11 +10860,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPVisioServiceApplication { + +function New-SPVisioServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -10890,11 +10884,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPVisioServiceApplicationProxy { +function New-SPVisioServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] @@ -10910,11 +10904,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPWeb { + +function New-SPWeb { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -10949,11 +10943,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPWebApplication { +function New-SPWebApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -11021,11 +11015,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPWebApplicationAppDomain { + +function New-SPWebApplicationAppDomain { [CmdletBinding(DefaultParameterSetName='WebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11049,11 +11043,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPWebApplicationExtension { +function New-SPWebApplicationExtension { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11106,11 +11100,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPWOPIBinding { + +function New-SPWOPIBinding { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [ValidateNotNullOrEmpty()] @@ -11145,11 +11139,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPWOPISuppressionSetting { +function New-SPWOPISuppressionSetting { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [ValidateNotNullOrEmpty()] @@ -11168,11 +11162,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPWordConversionServiceApplication { + +function New-SPWordConversionServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -11202,11 +11196,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPWorkflowServiceApplicationProxy { +function New-SPWorkflowServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [switch] @@ -11216,11 +11210,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPWorkManagementServiceApplication { + +function New-SPWorkManagementServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -11238,11 +11232,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPWorkManagementServiceApplicationProxy { +function New-SPWorkManagementServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [switch] @@ -11262,11 +11256,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Publish-SPServiceApplication { + +function Publish-SPServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11287,11 +11281,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Receive-SPServiceApplicationConnectionInfo { +function Receive-SPServiceApplicationConnectionInfo { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -11307,11 +11301,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Register-SPAppPrincipal { + +function Register-SPAppPrincipal { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -11333,11 +11327,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Register-SPWorkflowService { +function Register-SPWorkflowService { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -11365,11 +11359,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-DatabaseFromAvailabilityGroup { + +function Remove-DatabaseFromAvailabilityGroup { [CmdletBinding(DefaultParameterSetName='Default')] param( [Parameter(Mandatory=$true, Position=0)] @@ -11394,11 +11388,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPAccessServicesDatabaseServer { +function Remove-SPAccessServicesDatabaseServer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -11422,11 +11416,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPActivityFeedItems { + +function Remove-SPActivityFeedItems { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -11451,11 +11445,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPAlternateURL { +function Remove-SPAlternateURL { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11466,11 +11460,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPAppDeniedEndpoint { + +function Remove-SPAppDeniedEndpoint { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -11482,11 +11476,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPAppPrincipalPermission { +function Remove-SPAppPrincipalPermission { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -11511,11 +11505,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPBusinessDataCatalogModel { + +function Remove-SPBusinessDataCatalogModel { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -11527,11 +11521,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPClaimProvider { +function Remove-SPClaimProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11543,11 +11537,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPClaimTypeMapping { + +function Remove-SPClaimTypeMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11564,22 +11558,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPConfigurationDatabase { +function Remove-SPConfigurationDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Remove-SPContentDatabase { + +function Remove-SPContentDatabase { [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11594,11 +11588,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPContentDeploymentJob { +function Remove-SPContentDeploymentJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11609,11 +11603,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPContentDeploymentPath { + +function Remove-SPContentDeploymentPath { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11624,11 +11618,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPDeletedSite { +function Remove-SPDeletedSite { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11648,11 +11642,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPDiagnosticsPerformanceCounter { + +function Remove-SPDiagnosticsPerformanceCounter { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)] @@ -11679,22 +11673,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPDistributedCacheServiceInstance { +function Remove-SPDistributedCacheServiceInstance { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Remove-SPEduClassMember { + +function Remove-SPEduClassMember { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -11713,11 +11707,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchComponent { +function Remove-SPEnterpriseSearchComponent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11735,11 +11729,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchContentEnrichmentConfiguration { + +function Remove-SPEnterpriseSearchContentEnrichmentConfiguration { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -11750,11 +11744,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchCrawlContentSource { +function Remove-SPEnterpriseSearchCrawlContentSource { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11768,11 +11762,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchCrawlCustomConnector { + +function Remove-SPEnterpriseSearchCrawlCustomConnector { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -11788,11 +11782,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchCrawlDatabase { +function Remove-SPEnterpriseSearchCrawlDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11806,11 +11800,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchCrawlExtension { + +function Remove-SPEnterpriseSearchCrawlExtension { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11824,11 +11818,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchCrawlLogReadPermission { +function Remove-SPEnterpriseSearchCrawlLogReadPermission { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ValueFromPipeline=$true)] @@ -11850,11 +11844,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchCrawlMapping { + +function Remove-SPEnterpriseSearchCrawlMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11868,11 +11862,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchCrawlRule { +function Remove-SPEnterpriseSearchCrawlRule { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11886,11 +11880,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchFileFormat { + +function Remove-SPEnterpriseSearchFileFormat { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -11905,11 +11899,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchLanguageResourcePhrase { +function Remove-SPEnterpriseSearchLanguageResourcePhrase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11940,11 +11934,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchLinksDatabase { + +function Remove-SPEnterpriseSearchLinksDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11958,11 +11952,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchMetadataCategory { +function Remove-SPEnterpriseSearchMetadataCategory { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11976,11 +11970,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchMetadataManagedProperty { + +function Remove-SPEnterpriseSearchMetadataManagedProperty { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12000,11 +11994,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchMetadataMapping { +function Remove-SPEnterpriseSearchMetadataMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12018,11 +12012,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchQueryAuthority { + +function Remove-SPEnterpriseSearchQueryAuthority { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12041,11 +12035,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchQueryDemoted { +function Remove-SPEnterpriseSearchQueryDemoted { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12064,11 +12058,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchQueryKeyword { + +function Remove-SPEnterpriseSearchQueryKeyword { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12083,11 +12077,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchQueryScope { +function Remove-SPEnterpriseSearchQueryScope { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12105,11 +12099,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchQueryScopeRule { + +function Remove-SPEnterpriseSearchQueryScopeRule { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12132,11 +12126,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchRankingModel { +function Remove-SPEnterpriseSearchRankingModel { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12155,11 +12149,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchResultItemType { + +function Remove-SPEnterpriseSearchResultItemType { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12182,11 +12176,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchResultSource { +function Remove-SPEnterpriseSearchResultSource { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12206,11 +12200,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchSecurityTrimmer { + +function Remove-SPEnterpriseSearchSecurityTrimmer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -12225,11 +12219,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchServiceApplication { +function Remove-SPEnterpriseSearchServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12243,11 +12237,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchServiceApplicationProxy { + +function Remove-SPEnterpriseSearchServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12258,11 +12252,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchServiceApplicationSiteSettings { +function Remove-SPEnterpriseSearchServiceApplicationSiteSettings { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12280,11 +12274,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchSiteHitRule { + +function Remove-SPEnterpriseSearchSiteHitRule { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12298,11 +12292,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchTenantConfiguration { +function Remove-SPEnterpriseSearchTenantConfiguration { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12318,11 +12312,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchTenantSchema { + +function Remove-SPEnterpriseSearchTenantSchema { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12339,11 +12333,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchTopology { +function Remove-SPEnterpriseSearchTopology { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12357,11 +12351,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPExcelBIServer { + +function Remove-SPExcelBIServer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12376,11 +12370,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPExcelBlockedFileType { +function Remove-SPExcelBlockedFileType { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12395,11 +12389,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPExcelDataConnectionLibrary { + +function Remove-SPExcelDataConnectionLibrary { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12414,11 +12408,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPExcelDataProvider { +function Remove-SPExcelDataProvider { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12429,11 +12423,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPExcelFileLocation { + +function Remove-SPExcelFileLocation { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12448,11 +12442,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPExcelUserDefinedFunction { +function Remove-SPExcelUserDefinedFunction { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -12467,11 +12461,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPInfoPathUserAgent { + +function Remove-SPInfoPathUserAgent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12483,11 +12477,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPManagedAccount { +function Remove-SPManagedAccount { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12506,11 +12500,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPManagedPath { + +function Remove-SPManagedPath { [CmdletBinding(DefaultParameterSetName='WebApplication', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12529,11 +12523,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPODataConnectionSetting { +function Remove-SPODataConnectionSetting { [CmdletBinding(DefaultParameterSetName='Name', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -12555,11 +12549,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPPerformancePointServiceApplication { + +function Remove-SPPerformancePointServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -12570,11 +12564,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPPerformancePointServiceApplicationProxy { +function Remove-SPPerformancePointServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -12585,11 +12579,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPPerformancePointServiceApplicationTrustedLocation { + +function Remove-SPPerformancePointServiceApplicationTrustedLocation { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -12600,11 +12594,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPPluggableSecurityTrimmer { +function Remove-SPPluggableSecurityTrimmer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -12620,11 +12614,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPProfileLeader { + +function Remove-SPProfileLeader { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12646,11 +12640,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPProfileSyncConnection { +function Remove-SPProfileSyncConnection { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12688,11 +12682,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPRoutingMachineInfo { + +function Remove-SPRoutingMachineInfo { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12704,11 +12698,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPRoutingMachinePool { +function Remove-SPRoutingMachinePool { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12720,11 +12714,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPRoutingRule { + +function Remove-SPRoutingRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12736,11 +12730,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPScaleOutDatabase { +function Remove-SPScaleOutDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -12758,11 +12752,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPSecureStoreApplication { + +function Remove-SPSecureStoreApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -12774,11 +12768,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPSecureStoreSystemAccount { +function Remove-SPSecureStoreSystemAccount { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12789,11 +12783,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPServerScaleOutDatabase { + +function Remove-SPServerScaleOutDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -12811,11 +12805,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPServiceApplication { +function Remove-SPServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12831,11 +12825,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPServiceApplicationPool { + +function Remove-SPServiceApplicationPool { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12847,11 +12841,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPServiceApplicationProxy { +function Remove-SPServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12867,11 +12861,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPServiceApplicationProxyGroup { + +function Remove-SPServiceApplicationProxyGroup { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12883,11 +12877,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPServiceApplicationProxyGroupMember { +function Remove-SPServiceApplicationProxyGroupMember { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12905,11 +12899,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPShellAdmin { + +function Remove-SPShellAdmin { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0)] @@ -12924,11 +12918,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPSite { +function Remove-SPSite { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12946,11 +12940,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPSiteSubscription { + +function Remove-SPSiteSubscription { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12964,11 +12958,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPSiteSubscriptionBusinessDataCatalogConfig { +function Remove-SPSiteSubscriptionBusinessDataCatalogConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -12980,11 +12974,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPSiteSubscriptionFeaturePack { + +function Remove-SPSiteSubscriptionFeaturePack { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12996,11 +12990,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPSiteSubscriptionFeaturePackMember { +function Remove-SPSiteSubscriptionFeaturePackMember { [CmdletBinding(DefaultParameterSetName='SingleFeatureDefinition', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13021,11 +13015,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPSiteSubscriptionMetadataConfig { + +function Remove-SPSiteSubscriptionMetadataConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13040,11 +13034,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPSiteSubscriptionProfileConfig { +function Remove-SPSiteSubscriptionProfileConfig { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='Default', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13066,11 +13060,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPSiteSubscriptionSettings { + +function Remove-SPSiteSubscriptionSettings { [CmdletBinding(DefaultParameterSetName='SpecifySiteSubscriptions', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13101,11 +13095,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPSiteUpgradeSessionInfo { +function Remove-SPSiteUpgradeSessionInfo { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13116,11 +13110,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPSiteURL { + +function Remove-SPSiteURL { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13131,11 +13125,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPSocialItemByDate { +function Remove-SPSocialItemByDate { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -13166,11 +13160,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPSolution { + +function Remove-SPSolution { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13187,11 +13181,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPSolutionDeploymentLock { +function Remove-SPSolutionDeploymentLock { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Position=0)] @@ -13202,11 +13196,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPStateServiceDatabase { + +function Remove-SPStateServiceDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13218,11 +13212,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPThrottlingRule { +function Remove-SPThrottlingRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13234,11 +13228,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPTranslationServiceJobHistory { + +function Remove-SPTranslationServiceJobHistory { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -13264,11 +13258,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPTrustedIdentityTokenIssuer { +function Remove-SPTrustedIdentityTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13280,11 +13274,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPTrustedRootAuthority { + +function Remove-SPTrustedRootAuthority { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13296,11 +13290,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPTrustedSecurityTokenIssuer { +function Remove-SPTrustedSecurityTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13312,11 +13306,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPTrustedServiceTokenIssuer { + +function Remove-SPTrustedServiceTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13328,11 +13322,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPUsageApplication { +function Remove-SPUsageApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13350,11 +13344,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPUser { + +function Remove-SPUser { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13375,11 +13369,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPUserLicenseMapping { +function Remove-SPUserLicenseMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -13391,11 +13385,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPUserSettingsProvider { + +function Remove-SPUserSettingsProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13407,11 +13401,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPUserSolution { +function Remove-SPUserSolution { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13426,11 +13420,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPVisioSafeDataProvider { + +function Remove-SPVisioSafeDataProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -13452,11 +13446,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPWeb { +function Remove-SPWeb { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13470,11 +13464,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPWebApplication { + +function Remove-SPWebApplication { [CmdletBinding(DefaultParameterSetName='RemoveWebApp', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13496,11 +13490,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPWebApplicationAppDomain { +function Remove-SPWebApplicationAppDomain { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13511,11 +13505,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPWOPIBinding { + +function Remove-SPWOPIBinding { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='Identity', Position=0, ValueFromPipeline=$true)] @@ -13560,11 +13554,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPWOPISuppressionSetting { +function Remove-SPWOPISuppressionSetting { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='DocTypeAndAction')] @@ -13591,11 +13585,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPWordConversionServiceJobHistory { + +function Remove-SPWordConversionServiceJobHistory { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -13618,11 +13612,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Rename-SPServer { +function Rename-SPServer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13640,22 +13634,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Repair-SPManagedAccountDeployment { + +function Repair-SPManagedAccountDeployment { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Repair-SPSite { +function Repair-SPSite { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13672,11 +13666,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Request-SPUpgradeEvaluationSite { + +function Request-SPUpgradeEvaluationSite { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13693,11 +13687,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Reset-SPAccessServicesDatabasePassword { +function Reset-SPAccessServicesDatabasePassword { [CmdletBinding(DefaultParameterSetName='ResetAllApps', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='ResetSingleApp', Mandatory=$true, ValueFromPipeline=$true)] @@ -13713,11 +13707,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Restart-SPAppInstanceJob { + +function Restart-SPAppInstanceJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [Parameter(Mandatory=$true)] @@ -13729,11 +13723,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Restore-SPDeletedSite { +function Restore-SPDeletedSite { [CmdletBinding(DefaultParameterSetName='DatabaseFromPipebind', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13753,11 +13747,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Restore-SPEnterpriseSearchServiceApplication { + +function Restore-SPEnterpriseSearchServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -13804,11 +13798,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Restore-SPEnterpriseSearchServiceApplicationIndex { +function Restore-SPEnterpriseSearchServiceApplicationIndex { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -13843,11 +13837,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Restore-SPFarm { + +function Restore-SPFarm { [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -13897,11 +13891,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Restore-SPSite { +function Restore-SPSite { [CmdletBinding(DefaultParameterSetName='DatabaseFromPipebind', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13940,11 +13934,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Resume-SPEnterpriseSearchServiceApplication { + +function Resume-SPEnterpriseSearchServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13955,11 +13949,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Resume-SPStateServiceDatabase { +function Resume-SPStateServiceDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13971,11 +13965,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Revoke-SPBusinessDataCatalogMetadataObject { + +function Revoke-SPBusinessDataCatalogMetadataObject { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -13999,11 +13993,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Revoke-SPObjectSecurity { +function Revoke-SPObjectSecurity { [CmdletBinding(DefaultParameterSetName='RevokeOne')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14029,11 +14023,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPAccessServiceApplication { + +function Set-SPAccessServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14106,11 +14100,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAccessServicesApplication { +function Set-SPAccessServicesApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14145,11 +14139,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPAccessServicesDatabaseServer { + +function Set-SPAccessServicesDatabaseServer { [CmdletBinding(DefaultParameterSetName='SetCredentialsParameterSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='SetCredentialsParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14226,11 +14220,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAccessServicesDatabaseServerGroupMapping { +function Set-SPAccessServicesDatabaseServerGroupMapping { [CmdletBinding(DefaultParameterSetName='SetDatabaseServerGroupMappingParameter', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='SetDatabaseServerGroupMappingParameter', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14276,11 +14270,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPAlternateURL { + +function Set-SPAlternateURL { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14297,11 +14291,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAppAcquisitionConfiguration { +function Set-SPAppAcquisitionConfiguration { [CmdletBinding(DefaultParameterSetName='MarketplaceSettingsInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -14320,11 +14314,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPAppAutoProvisionConnection { + +function Set-SPAppAutoProvisionConnection { [CmdletBinding()] param( [object] @@ -14359,11 +14353,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAppDisablingConfiguration { +function Set-SPAppDisablingConfiguration { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -14374,11 +14368,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPAppDomain { + +function Set-SPAppDomain { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -14391,11 +14385,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAppHostingQuotaConfiguration { +function Set-SPAppHostingQuotaConfiguration { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -14417,11 +14411,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPAppManagementDeploymentId { + +function Set-SPAppManagementDeploymentId { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -14443,11 +14437,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAppPrincipalPermission { +function Set-SPAppPrincipalPermission { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -14477,11 +14471,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPAppScaleProfile { + +function Set-SPAppScaleProfile { [CmdletBinding()] param( [ValidateNotNullOrEmpty()] @@ -14496,11 +14490,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAppSiteDomain { +function Set-SPAppSiteDomain { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -14512,11 +14506,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPAppSiteSubscriptionName { + +function Set-SPAppSiteSubscriptionName { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -14534,11 +14528,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAppStateUpdateInterval { +function Set-SPAppStateUpdateInterval { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -14555,11 +14549,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPAppStoreConfiguration { + +function Set-SPAppStoreConfiguration { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -14573,11 +14567,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAuthenticationRealm { +function Set-SPAuthenticationRealm { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [ValidateNotNull()] @@ -14591,11 +14585,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPBingMapsBlock { + +function Set-SPBingMapsBlock { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0, HelpMessage='Block Bing Maps in all locales.')] @@ -14606,11 +14600,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPBingMapsKey { +function Set-SPBingMapsKey { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, HelpMessage='Enter the Bing Maps API key.')] @@ -14621,11 +14615,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPBrowserCustomerExperienceImprovementProgram { + +function Set-SPBrowserCustomerExperienceImprovementProgram { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [Parameter(ParameterSetName='Farm', Mandatory=$true)] @@ -14647,11 +14641,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPBusinessDataCatalogEntityNotificationWeb { +function Set-SPBusinessDataCatalogEntityNotificationWeb { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [Parameter(Mandatory=$true)] @@ -14663,11 +14657,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPBusinessDataCatalogMetadataObject { + +function Set-SPBusinessDataCatalogMetadataObject { [CmdletBinding(DefaultParameterSetName='NameValue', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Display')] @@ -14700,11 +14694,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPBusinessDataCatalogServiceApplication { +function Set-SPBusinessDataCatalogServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -14752,11 +14746,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPBusinessDataCatalogThrottleConfig { + +function Set-SPBusinessDataCatalogThrottleConfig { [CmdletBinding(DefaultParameterSetName='MaxDefault', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -14780,11 +14774,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPCentralAdministration { +function Set-SPCentralAdministration { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -14795,11 +14789,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPClaimProvider { + +function Set-SPClaimProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14817,11 +14811,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPContentDatabase { +function Set-SPContentDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14847,11 +14841,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPContentDeploymentJob { + +function Set-SPContentDeploymentJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14894,11 +14888,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPContentDeploymentPath { +function Set-SPContentDeploymentPath { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14944,11 +14938,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPCustomLayoutsPage { + +function Set-SPCustomLayoutsPage { [CmdletBinding(DefaultParameterSetName='CustomPage', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -14977,11 +14971,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPDataConnectionFile { +function Set-SPDataConnectionFile { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15008,11 +15002,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPDesignerSettings { + +function Set-SPDesignerSettings { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='WebApplication', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -15050,11 +15044,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPDiagnosticConfig { +function Set-SPDiagnosticConfig { [CmdletBinding()] param( [Parameter(ValueFromPipelineByPropertyName=$true)] @@ -15150,11 +15144,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPDiagnosticsProvider { + +function Set-SPDiagnosticsProvider { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15176,11 +15170,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPDistributedCacheClientSetting { +function Set-SPDistributedCacheClientSetting { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15197,11 +15191,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEduServiceSetting { + +function Set-SPEduServiceSetting { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -15220,11 +15214,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchAdministrationComponent { +function Set-SPEnterpriseSearchAdministrationComponent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -15247,11 +15241,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchContentEnrichmentConfiguration { + +function Set-SPEnterpriseSearchContentEnrichmentConfiguration { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -15266,11 +15260,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchCrawlContentSource { +function Set-SPEnterpriseSearchCrawlContentSource { [CmdletBinding(DefaultParameterSetName='NoSchedule', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15384,11 +15378,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchCrawlDatabase { + +function Set-SPEnterpriseSearchCrawlDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15417,11 +15411,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchCrawlLogReadPermission { +function Set-SPEnterpriseSearchCrawlLogReadPermission { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] @@ -15442,11 +15436,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchCrawlRule { + +function Set-SPEnterpriseSearchCrawlRule { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15494,11 +15488,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchFileFormatState { +function Set-SPEnterpriseSearchFileFormatState { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -15521,11 +15515,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchLinguisticComponentsStatus { + +function Set-SPEnterpriseSearchLinguisticComponentsStatus { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -15555,11 +15549,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchLinksDatabase { +function Set-SPEnterpriseSearchLinksDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15588,11 +15582,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchMetadataCategory { + +function Set-SPEnterpriseSearchMetadataCategory { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15622,11 +15616,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchMetadataCrawledProperty { +function Set-SPEnterpriseSearchMetadataCrawledProperty { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15642,11 +15636,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchMetadataManagedProperty { + +function Set-SPEnterpriseSearchMetadataManagedProperty { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15727,11 +15721,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchMetadataMapping { +function Set-SPEnterpriseSearchMetadataMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15757,11 +15751,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchPrimaryHostController { + +function Set-SPEnterpriseSearchPrimaryHostController { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15775,11 +15769,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchQueryAuthority { +function Set-SPEnterpriseSearchQueryAuthority { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15802,11 +15796,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchQueryKeyword { + +function Set-SPEnterpriseSearchQueryKeyword { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15845,11 +15839,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchQueryScope { +function Set-SPEnterpriseSearchQueryScope { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15887,11 +15881,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchQueryScopeRule { + +function Set-SPEnterpriseSearchQueryScopeRule { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15934,11 +15928,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchQuerySpellingCorrection { +function Set-SPEnterpriseSearchQuerySpellingCorrection { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -15974,11 +15968,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchRankingModel { + +function Set-SPEnterpriseSearchRankingModel { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16001,11 +15995,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchResultItemType { +function Set-SPEnterpriseSearchResultItemType { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16056,11 +16050,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchResultSource { + +function Set-SPEnterpriseSearchResultSource { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16112,11 +16106,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchService { +function Set-SPEnterpriseSearchService { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -16154,11 +16148,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchServiceApplication { + +function Set-SPEnterpriseSearchServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16205,11 +16199,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchServiceApplicationProxy { +function Set-SPEnterpriseSearchServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16223,11 +16217,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchServiceInstance { + +function Set-SPEnterpriseSearchServiceInstance { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16241,11 +16235,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchTopology { +function Set-SPEnterpriseSearchTopology { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16259,11 +16253,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPExcelBIServer { + +function Set-SPExcelBIServer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -16284,11 +16278,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPExcelDataConnectionLibrary { +function Set-SPExcelDataConnectionLibrary { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -16309,11 +16303,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPExcelDataProvider { + +function Set-SPExcelDataProvider { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -16333,11 +16327,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPExcelFileLocation { +function Set-SPExcelFileLocation { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -16418,11 +16412,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPExcelServiceApplication { + +function Set-SPExcelServiceApplication { [CmdletBinding(DefaultParameterSetName='ExistingTargetApplicationParameterSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [int] @@ -16492,11 +16486,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPExcelUserDefinedFunction { +function Set-SPExcelUserDefinedFunction { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -16523,11 +16517,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPFarmConfig { + +function Set-SPFarmConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipelineByPropertyName=$true)] @@ -16570,11 +16564,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPInfoPathFormsService { +function Set-SPInfoPathFormsService { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [object] @@ -16656,11 +16650,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPInfoPathFormTemplate { + +function Set-SPInfoPathFormTemplate { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16675,11 +16669,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPInfoPathWebServiceProxy { +function Set-SPInfoPathWebServiceProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16698,11 +16692,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPInternalAppStateUpdateInterval { + +function Set-SPInternalAppStateUpdateInterval { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -16714,11 +16708,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPIRMSettings { +function Set-SPIRMSettings { [CmdletBinding(DefaultParameterSetName='UseServiceDiscovery', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -16748,11 +16742,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPLogLevel { + +function Set-SPLogLevel { [CmdletBinding()] param( [string] @@ -16772,11 +16766,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPManagedAccount { +function Set-SPManagedAccount { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16824,11 +16818,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPMetadataServiceApplication { + +function Set-SPMetadataServiceApplication { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [string] @@ -16916,11 +16910,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPMetadataServiceApplicationProxy { +function Set-SPMetadataServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [switch] @@ -16949,11 +16943,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPMobileMessagingAccount { + +function Set-SPMobileMessagingAccount { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -16981,11 +16975,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPO365LinkSettings { +function Set-SPO365LinkSettings { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] @@ -17005,11 +16999,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPODataConnectionSetting { + +function Set-SPODataConnectionSetting { [CmdletBinding(DefaultParameterSetName='Name', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -17048,11 +17042,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPODataConnectionSettingMetadata { +function Set-SPODataConnectionSettingMetadata { [CmdletBinding(DefaultParameterSetName='Name', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -17088,11 +17082,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPOfficeStoreAppsDefaultActivation { + +function Set-SPOfficeStoreAppsDefaultActivation { [CmdletBinding(DefaultParameterSetName='AppsForOfficeSettingsInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -17111,11 +17105,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPPassPhrase { +function Set-SPPassPhrase { [CmdletBinding(DefaultParameterSetName='AcrossFarm', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -17134,11 +17128,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPPerformancePointSecureDataValues { + +function Set-SPPerformancePointSecureDataValues { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -17153,11 +17147,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPPerformancePointServiceApplication { +function Set-SPPerformancePointServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -17268,11 +17262,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPPowerPointConversionServiceApplication { + +function Set-SPPowerPointConversionServiceApplication { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -17299,11 +17293,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPProfileServiceApplication { +function Set-SPProfileServiceApplication { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -17362,11 +17356,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPProfileServiceApplicationProxy { + +function Set-SPProfileServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -17396,11 +17390,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPProfileServiceApplicationSecurity { +function Set-SPProfileServiceApplicationSecurity { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -17425,11 +17419,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPRequestManagementSettings { + +function Set-SPRequestManagementSettings { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -17453,11 +17447,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPRoutingMachineInfo { +function Set-SPRoutingMachineInfo { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -17490,11 +17484,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPRoutingMachinePool { + +function Set-SPRoutingMachinePool { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -17510,11 +17504,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPRoutingRule { +function Set-SPRoutingRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -17541,11 +17535,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPScaleOutDatabaseDataRange { + +function Set-SPScaleOutDatabaseDataRange { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -17567,11 +17561,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPScaleOutDatabaseDataSubRange { +function Set-SPScaleOutDatabaseDataSubRange { [CmdletBinding(DefaultParameterSetName='AttachedDatabase', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='AttachedDatabase', Mandatory=$true, ValueFromPipeline=$true)] @@ -17611,11 +17605,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPSecureStoreApplication { + +function Set-SPSecureStoreApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [object] @@ -17642,11 +17636,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPSecureStoreDefaultProvider { +function Set-SPSecureStoreDefaultProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -17658,11 +17652,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPSecureStoreServiceApplication { + +function Set-SPSecureStoreServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [object] @@ -17704,11 +17698,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPSecurityTokenServiceConfig { +function Set-SPSecurityTokenServiceConfig { [CmdletBinding(DefaultParameterSetName='SigningCertificateImport', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='SigningCertificateImport')] @@ -17778,11 +17772,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPServerScaleOutDatabaseDataRange { + +function Set-SPServerScaleOutDatabaseDataRange { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -17804,11 +17798,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPServerScaleOutDatabaseDataSubRange { +function Set-SPServerScaleOutDatabaseDataSubRange { [CmdletBinding(DefaultParameterSetName='AttachedDatabase', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='AttachedDatabase', Mandatory=$true, ValueFromPipeline=$true)] @@ -17848,11 +17842,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPServiceApplication { + +function Set-SPServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -17876,11 +17870,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPServiceApplicationEndpoint { +function Set-SPServiceApplicationEndpoint { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -17901,11 +17895,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPServiceApplicationPool { + +function Set-SPServiceApplicationPool { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -17921,11 +17915,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPServiceApplicationSecurity { +function Set-SPServiceApplicationSecurity { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -17945,11 +17939,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPServiceHostConfig { + +function Set-SPServiceHostConfig { [CmdletBinding(DefaultParameterSetName='SslCertificateImport', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='SslCertificateImport', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18000,11 +17994,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPSessionStateService { +function Set-SPSessionStateService { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [System.Nullable[int]] @@ -18018,11 +18012,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPSite { + +function Set-SPSite { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18085,11 +18079,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPSiteAdministration { +function Set-SPSiteAdministration { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18136,11 +18130,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPSiteSubscriptionConfig { + +function Set-SPSiteSubscriptionConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18163,11 +18157,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPSiteSubscriptionEdiscoveryHub { +function Set-SPSiteSubscriptionEdiscoveryHub { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -18182,11 +18176,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPSiteSubscriptionIRMConfig { + +function Set-SPSiteSubscriptionIRMConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18209,11 +18203,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPSiteSubscriptionMetadataConfig { +function Set-SPSiteSubscriptionMetadataConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18238,11 +18232,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPSiteSubscriptionProfileConfig { + +function Set-SPSiteSubscriptionProfileConfig { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18276,11 +18270,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPSiteURL { +function Set-SPSiteURL { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18298,11 +18292,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPStateServiceApplication { + +function Set-SPStateServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -18316,11 +18310,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPStateServiceApplicationProxy { +function Set-SPStateServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -18334,11 +18328,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPStateServiceDatabase { + +function Set-SPStateServiceDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18362,11 +18356,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPSubscriptionSettingsServiceApplication { +function Set-SPSubscriptionSettingsServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18394,11 +18388,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPThrottlingRule { + +function Set-SPThrottlingRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18423,11 +18417,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPTimerJob { +function Set-SPTimerJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18442,11 +18436,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPTopologyServiceApplication { + +function Set-SPTopologyServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18462,11 +18456,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPTopologyServiceApplicationProxy { +function Set-SPTopologyServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18481,11 +18475,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPTranslationServiceApplication { + +function Set-SPTranslationServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -18584,11 +18578,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPTranslationServiceApplicationProxy { +function Set-SPTranslationServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -18608,11 +18602,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPTranslationThrottlingSetting { + +function Set-SPTranslationThrottlingSetting { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [System.Nullable[int]] @@ -18625,11 +18619,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPTrustedIdentityTokenIssuer { +function Set-SPTrustedIdentityTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='BasicParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18697,11 +18691,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPTrustedRootAuthority { + +function Set-SPTrustedRootAuthority { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18723,11 +18717,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPTrustedSecurityTokenIssuer { +function Set-SPTrustedSecurityTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18735,36 +18729,33 @@ param( [object] ${Identity}, - [ValidateNotNullOrEmpty()] [string] ${Description}, + [Parameter(ParameterSetName='ManualConfigParameterSet', Mandatory=$true)] [string] ${RegisteredIssuerName}, - [Parameter(ParameterSetName='MetadataEndPointParameterSet')] - [ValidateNotNull()] - [uri] - ${MetadataEndPoint}, + [switch] + ${IsTrustBroker}, - [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [Parameter(ParameterSetName='ManualConfigParameterSet', Mandatory=$true)] [ValidateNotNull()] - [System.Security.Cryptography.X509Certificates.X509Certificate2] + [Object] ${Certificate}, - [ValidateNotNullOrEmpty()] - [switch] - ${IsTrustBroker}, + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - - } + } -function Set-SPTrustedServiceTokenIssuer { +function Set-SPTrustedServiceTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18790,11 +18781,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPUsageApplication { + +function Set-SPUsageApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18834,11 +18825,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPUsageDefinition { +function Set-SPUsageDefinition { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18864,11 +18855,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPUsageService { + +function Set-SPUsageService { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -18903,11 +18894,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPUser { +function Set-SPUser { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18951,11 +18942,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPVisioExternalData { + +function Set-SPVisioExternalData { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -18972,11 +18963,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPVisioPerformance { +function Set-SPVisioPerformance { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -19012,11 +19003,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPVisioSafeDataProvider { + +function Set-SPVisioSafeDataProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -19042,11 +19033,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPVisioServiceApplication { +function Set-SPVisioServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19063,11 +19054,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPWeb { + +function Set-SPWeb { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19091,11 +19082,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPWebApplication { +function Set-SPWebApplication { [CmdletBinding(DefaultParameterSetName='UpdateGeneralSettings', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19159,11 +19150,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPWebApplicationHttpThrottlingMonitor { + +function Set-SPWebApplicationHttpThrottlingMonitor { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -19207,11 +19198,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPWOPIBinding { +function Set-SPWOPIBinding { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19226,11 +19217,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPWOPIZone { + +function Set-SPWOPIZone { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0)] @@ -19242,11 +19233,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPWordConversionServiceApplication { +function Set-SPWordConversionServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -19318,11 +19309,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPWorkflowConfig { + +function Set-SPWorkflowConfig { [CmdletBinding()] param( [Parameter(ParameterSetName='WebApplication', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -19346,11 +19337,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPWorkManagementServiceApplication { +function Set-SPWorkManagementServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ValueFromPipeline=$true)] @@ -19392,11 +19383,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPWorkManagementServiceApplicationProxy { + +function Set-SPWorkManagementServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [switch] @@ -19413,11 +19404,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Split-SPScaleOutDatabase { +function Split-SPScaleOutDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='NewDatabase', Mandatory=$true)] @@ -19463,11 +19454,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Split-SPServerScaleOutDatabase { + +function Split-SPServerScaleOutDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='NewDatabase', Mandatory=$true)] @@ -19513,22 +19504,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Start-SPAdminJob { +function Start-SPAdminJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Start-SPAssignment { + +function Start-SPAssignment { [CmdletBinding()] param( [switch] @@ -19538,11 +19529,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Start-SPContentDeploymentJob { +function Start-SPContentDeploymentJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -19565,11 +19556,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Start-SPDiagnosticsSession { + +function Start-SPDiagnosticsSession { [CmdletBinding()] param( [guid] @@ -19586,11 +19577,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance { +function Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19601,11 +19592,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Start-SPEnterpriseSearchServiceInstance { + +function Start-SPEnterpriseSearchServiceInstance { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19616,11 +19607,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Start-SPInfoPathFormTemplate { +function Start-SPInfoPathFormTemplate { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19631,11 +19622,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Start-SPServiceInstance { + +function Start-SPServiceInstance { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19647,11 +19638,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Start-SPTimerJob { +function Start-SPTimerJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19662,11 +19653,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Stop-SPAssignment { + +function Stop-SPAssignment { [CmdletBinding()] param( [switch] @@ -19680,22 +19671,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Stop-SPDiagnosticsSession { +function Stop-SPDiagnosticsSession { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Stop-SPDistributedCacheServiceInstance { + +function Stop-SPDistributedCacheServiceInstance { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -19706,11 +19697,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Stop-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance { +function Stop-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19721,11 +19712,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Stop-SPEnterpriseSearchServiceInstance { + +function Stop-SPEnterpriseSearchServiceInstance { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19736,11 +19727,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Stop-SPInfoPathFormTemplate { +function Stop-SPInfoPathFormTemplate { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19755,11 +19746,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Stop-SPServiceInstance { + +function Stop-SPServiceInstance { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19771,11 +19762,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Suspend-SPEnterpriseSearchServiceApplication { +function Suspend-SPEnterpriseSearchServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19786,11 +19777,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Suspend-SPStateServiceDatabase { + +function Suspend-SPStateServiceDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19802,11 +19793,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Test-SPContentDatabase { +function Test-SPContentDatabase { [CmdletBinding(DefaultParameterSetName='ContentDatabaseById')] param( [Parameter(ParameterSetName='ContentDatabaseByName', Mandatory=$true)] @@ -19844,11 +19835,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Test-SPO365LinkSettings { + +function Test-SPO365LinkSettings { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] @@ -19859,11 +19850,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Test-SPSite { +function Test-SPSite { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19880,11 +19871,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Uninstall-SPAppInstance { + +function Uninstall-SPAppInstance { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -19896,11 +19887,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Uninstall-SPDataConnectionFile { +function Uninstall-SPDataConnectionFile { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19911,11 +19902,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Uninstall-SPFeature { + +function Uninstall-SPFeature { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19932,11 +19923,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Uninstall-SPHelpCollection { +function Uninstall-SPHelpCollection { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -19948,11 +19939,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Uninstall-SPInfoPathFormTemplate { + +function Uninstall-SPInfoPathFormTemplate { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19963,11 +19954,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Uninstall-SPSolution { +function Uninstall-SPSolution { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19998,11 +19989,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Uninstall-SPUserSolution { + +function Uninstall-SPUserSolution { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20017,11 +20008,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Uninstall-SPWebPartPack { +function Uninstall-SPWebPartPack { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0)] @@ -20043,11 +20034,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Unpublish-SPServiceApplication { + +function Unpublish-SPServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20059,11 +20050,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Update-SPAppCatalogConfiguration { +function Update-SPAppCatalogConfiguration { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20081,11 +20072,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Update-SPAppInstance { + +function Update-SPAppInstance { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -20102,11 +20093,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Update-SPDistributedCacheSize { +function Update-SPDistributedCacheSize { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -20117,11 +20108,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Update-SPFarmEncryptionKey { + +function Update-SPFarmEncryptionKey { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [switch] @@ -20131,11 +20122,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Update-SPHelp { +function Update-SPHelp { [CmdletBinding()] param( [switch] @@ -20145,11 +20136,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Update-SPInfoPathAdminFileUrl { + +function Update-SPInfoPathAdminFileUrl { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -20167,22 +20158,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Update-SPInfoPathFormTemplate { +function Update-SPInfoPathFormTemplate { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Update-SPInfoPathUserFileUrl { + +function Update-SPInfoPathUserFileUrl { [CmdletBinding(DefaultParameterSetName='WebApp', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='WebApp', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20212,11 +20203,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Update-SPProfilePhotoStore { +function Update-SPProfilePhotoStore { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -20240,11 +20231,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Update-SPRepopulateMicroblogFeedCache { + +function Update-SPRepopulateMicroblogFeedCache { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -20269,11 +20260,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Update-SPRepopulateMicroblogLMTCache { +function Update-SPRepopulateMicroblogLMTCache { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -20285,11 +20276,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Update-SPSecureStoreApplicationServerKey { + +function Update-SPSecureStoreApplicationServerKey { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -20306,11 +20297,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Update-SPSecureStoreCredentialMapping { +function Update-SPSecureStoreCredentialMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -20332,11 +20323,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Update-SPSecureStoreGroupCredentialMapping { + +function Update-SPSecureStoreGroupCredentialMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -20353,11 +20344,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Update-SPSecureStoreMasterKey { +function Update-SPSecureStoreMasterKey { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -20374,11 +20365,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Update-SPSolution { + +function Update-SPSolution { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20411,11 +20402,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Update-SPUserSolution { +function Update-SPUserSolution { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20434,11 +20425,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Update-SPWOPIProofKey { + +function Update-SPWOPIProofKey { [CmdletBinding()] param( [ValidateNotNullOrEmpty()] @@ -20449,11 +20440,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Upgrade-SPContentDatabase { +function Upgrade-SPContentDatabase { [CmdletBinding(DefaultParameterSetName='ContentDatabaseById', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='ContentDatabaseByName', Mandatory=$true)] @@ -20491,11 +20482,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Upgrade-SPEnterpriseSearchServiceApplication { + +function Upgrade-SPEnterpriseSearchServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20506,11 +20497,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Upgrade-SPEnterpriseSearchServiceApplicationSiteSettings { +function Upgrade-SPEnterpriseSearchServiceApplicationSiteSettings { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -20521,22 +20512,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Upgrade-SPFarm { + +function Upgrade-SPFarm { [CmdletBinding(DefaultParameterSetName='FarmById', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Upgrade-SPSingleSignOnDatabase { +function Upgrade-SPSingleSignOnDatabase { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -20558,11 +20549,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Upgrade-SPSite { + +function Upgrade-SPSite { [CmdletBinding(DefaultParameterSetName='SPSiteById', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='SPSiteById', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20585,5 +20576,5 @@ param( [object] ${AssignmentCollection}) - - } + + } diff --git a/Tests/Unit/Stubs/SharePoint/16.0.10337.12109/Microsoft.SharePoint.PowerShell.psm1 b/Tests/Unit/Stubs/SharePoint/16.0.10337.12109/Microsoft.SharePoint.PowerShell.psm1 index ce701a8bd..63d64bc56 100644 --- a/Tests/Unit/Stubs/SharePoint/16.0.10337.12109/Microsoft.SharePoint.PowerShell.psm1 +++ b/Tests/Unit/Stubs/SharePoint/16.0.10337.12109/Microsoft.SharePoint.PowerShell.psm1 @@ -11179,7 +11179,7 @@ function Add-DatabaseToAvailabilityGroup { } - function New-SPTrustedSecurityTokenIssuer { + function New-SPTrustedSecurityTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0)] @@ -11187,34 +11187,27 @@ function Add-DatabaseToAvailabilityGroup { [string] ${Name}, - [ValidateNotNullOrEmpty()] [string] ${Description}, - [ValidateNotNullOrEmpty()] + [Parameter(ParameterSetName='ManualConfigParameterSet', Mandatory=$true)] [string] ${RegisteredIssuerName}, - [ValidateNotNullOrEmpty()] [switch] ${IsTrustBroker}, - [Parameter(ParameterSetName='ImportCertificateParameterSet', Mandatory=$true)] - [ValidateNotNull()] - [object] - #[System.Security.Cryptography.X509Certificates.X509Certificate2] + [Parameter(ParameterSetName='ManualConfigParameterSet', Mandatory=$true)] + [Object] ${Certificate}, [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] - [ValidateNotNull()] [uri] ${MetadataEndPoint}, [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } @@ -19582,7 +19575,7 @@ function Add-DatabaseToAvailabilityGroup { } - function Set-SPTrustedSecurityTokenIssuer { + function Set-SPTrustedSecurityTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19590,33 +19583,29 @@ function Add-DatabaseToAvailabilityGroup { [object] ${Identity}, - [ValidateNotNullOrEmpty()] [string] ${Description}, + [Parameter(ParameterSetName='ManualConfigParameterSet', Mandatory=$true)] [string] ${RegisteredIssuerName}, - [Parameter(ParameterSetName='MetadataEndPointParameterSet')] - [ValidateNotNull()] - [uri] - ${MetadataEndPoint}, + [switch] + ${IsTrustBroker}, - [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [Parameter(ParameterSetName='ManualConfigParameterSet', Mandatory=$true)] [ValidateNotNull()] - [object] - #[System.Security.Cryptography.X509Certificates.X509Certificate2] + [Object] ${Certificate}, - [ValidateNotNullOrEmpty()] - [switch] - ${IsTrustBroker}, + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } diff --git a/Tests/Unit/Stubs/SharePoint/16.0.4456.1000/Microsoft.SharePoint.PowerShell.psm1 b/Tests/Unit/Stubs/SharePoint/16.0.4456.1000/Microsoft.SharePoint.PowerShell.psm1 index 62abc9c8d..ffd4037a9 100644 --- a/Tests/Unit/Stubs/SharePoint/16.0.4456.1000/Microsoft.SharePoint.PowerShell.psm1 +++ b/Tests/Unit/Stubs/SharePoint/16.0.4456.1000/Microsoft.SharePoint.PowerShell.psm1 @@ -1,4 +1,4 @@ -function Add-DatabaseToAvailabilityGroup { +function Add-DatabaseToAvailabilityGroup { [CmdletBinding(DefaultParameterSetName='Default')] param( [Parameter(Mandatory=$true, Position=0)] @@ -20,11 +20,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Add-SPAppDeniedEndpoint { + +function Add-SPAppDeniedEndpoint { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -36,11 +36,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPClaimTypeMapping { +function Add-SPClaimTypeMapping { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -61,11 +61,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPDiagnosticsPerformanceCounter { +function Add-SPDiagnosticsPerformanceCounter { [CmdletBinding(DefaultParameterSetName='AddCounter', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='AddMultipleCounters', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] @@ -111,11 +111,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Add-SPDistributedCacheServiceInstance { + +function Add-SPDistributedCacheServiceInstance { [CmdletBinding(DefaultParameterSetName='NoArgumentsDefaultSet')] param( [Parameter(ParameterSetName='LocalServerRoleSet')] @@ -132,11 +132,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPInfoPathUserAgent { +function Add-SPInfoPathUserAgent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -147,11 +147,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPPluggableSecurityTrimmer { +function Add-SPPluggableSecurityTrimmer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -173,11 +173,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Add-SPProfileLeader { + +function Add-SPProfileLeader { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -199,11 +199,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPProfileSyncConnection { +function Add-SPProfileSyncConnection { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -261,11 +261,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPRoutingMachineInfo { +function Add-SPRoutingMachineInfo { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -297,11 +297,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Add-SPRoutingMachinePool { + +function Add-SPRoutingMachinePool { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -321,11 +321,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPRoutingRule { +function Add-SPRoutingRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -356,11 +356,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Add-SPScaleOutDatabase { + +function Add-SPScaleOutDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -391,11 +391,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPSecureStoreSystemAccount { +function Add-SPSecureStoreSystemAccount { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -407,11 +407,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPServerScaleOutDatabase { +function Add-SPServerScaleOutDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -442,11 +442,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Add-SPServiceApplicationProxyGroupMember { + +function Add-SPServiceApplicationProxyGroupMember { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -464,11 +464,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPShellAdmin { +function Add-SPShellAdmin { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -483,11 +483,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPSiteSubscriptionFeaturePackMember { +function Add-SPSiteSubscriptionFeaturePackMember { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -504,11 +504,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Add-SPSiteSubscriptionProfileConfig { + +function Add-SPSiteSubscriptionProfileConfig { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -542,11 +542,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPSolution { +function Add-SPSolution { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -560,11 +560,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPThrottlingRule { +function Add-SPThrottlingRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -593,11 +593,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Add-SPUserLicenseMapping { + +function Add-SPUserLicenseMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true, ValueFromRemainingArguments=$true)] @@ -609,11 +609,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Add-SPUserSolution { +function Add-SPUserSolution { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -629,11 +629,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Backup-SPConfigurationDatabase { + +function Backup-SPConfigurationDatabase { [CmdletBinding(DefaultParameterSetName='DefaultSet')] param( [string] @@ -661,11 +661,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Backup-SPEnterpriseSearchServiceApplicationIndex { +function Backup-SPEnterpriseSearchServiceApplicationIndex { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='RunBackup', Mandatory=$true, Position=0)] @@ -704,11 +704,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Backup-SPFarm { +function Backup-SPFarm { [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='DefaultSet', Mandatory=$true)] @@ -746,11 +746,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Backup-SPSite { + +function Backup-SPSite { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -777,22 +777,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Clear-SPAppDeniedEndpointList { +function Clear-SPAppDeniedEndpointList { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Clear-SPBusinessDataCatalogEntityNotificationWeb { +function Clear-SPBusinessDataCatalogEntityNotificationWeb { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -804,11 +804,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Clear-SPDistributedCacheItem { + +function Clear-SPDistributedCacheItem { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -820,11 +820,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Clear-SPLogLevel { +function Clear-SPLogLevel { [CmdletBinding()] param( [string[]] @@ -838,11 +838,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Clear-SPMetadataWebServicePartitionData { +function Clear-SPMetadataWebServicePartitionData { [CmdletBinding(DefaultParameterSetName='Default')] param( [Parameter(ParameterSetName='Default', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -871,11 +871,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Clear-SPPerformancePointServiceApplicationTrustedLocation { + +function Clear-SPPerformancePointServiceApplicationTrustedLocation { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -889,11 +889,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Clear-SPScaleOutDatabaseDeletedDataSubRange { +function Clear-SPScaleOutDatabaseDeletedDataSubRange { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -914,11 +914,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Clear-SPScaleOutDatabaseLog { + +function Clear-SPScaleOutDatabaseLog { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -933,11 +933,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Clear-SPScaleOutDatabaseTenantData { +function Clear-SPScaleOutDatabaseTenantData { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -952,11 +952,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Clear-SPSecureStoreCredentialMapping { +function Clear-SPSecureStoreCredentialMapping { [CmdletBinding(DefaultParameterSetName='OneApplication', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='AllApplications', Mandatory=$true)] @@ -982,22 +982,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Clear-SPSecureStoreDefaultProvider { + +function Clear-SPSecureStoreDefaultProvider { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Clear-SPServerScaleOutDatabaseDeletedDataSubRange { +function Clear-SPServerScaleOutDatabaseDeletedDataSubRange { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -1018,11 +1018,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Clear-SPServerScaleOutDatabaseLog { +function Clear-SPServerScaleOutDatabaseLog { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -1037,11 +1037,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Clear-SPServerScaleOutDatabaseTenantData { + +function Clear-SPServerScaleOutDatabaseTenantData { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -1056,11 +1056,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Clear-SPSiteSubscriptionBusinessDataCatalogConfig { +function Clear-SPSiteSubscriptionBusinessDataCatalogConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -1072,11 +1072,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Connect-SPConfigurationDatabase { +function Connect-SPConfigurationDatabase { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1111,11 +1111,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Convert-SPWebApplication { + +function Convert-SPWebApplication { [CmdletBinding()] param( [Parameter(ParameterSetName='Claims', Mandatory=$true, ValueFromPipeline=$true)] @@ -1176,11 +1176,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Copy-SPAccessServicesDatabaseCredentials { +function Copy-SPAccessServicesDatabaseCredentials { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -1207,11 +1207,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Copy-SPActivitiesToWorkflowService { + +function Copy-SPActivitiesToWorkflowService { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -1230,11 +1230,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Copy-SPBusinessDataCatalogAclToChildren { +function Copy-SPBusinessDataCatalogAclToChildren { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -1246,11 +1246,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Copy-SPSideBySideFiles { +function Copy-SPSideBySideFiles { [CmdletBinding()] param( [string] @@ -1260,11 +1260,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Copy-SPSite { + +function Copy-SPSite { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1289,11 +1289,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Copy-SPTaxonomyGroups { +function Copy-SPTaxonomyGroups { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -1326,22 +1326,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Disable-ProjectServerLicense { +function Disable-ProjectServerLicense { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Disable-SPAppAutoProvision { + +function Disable-SPAppAutoProvision { [CmdletBinding()] param( [object] @@ -1351,11 +1351,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Disable-SPBusinessDataCatalogEntity { +function Disable-SPBusinessDataCatalogEntity { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -1367,11 +1367,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Disable-SPFeature { +function Disable-SPFeature { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1388,11 +1388,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Disable-SPHealthAnalysisRule { + +function Disable-SPHealthAnalysisRule { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1403,11 +1403,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Disable-SPInfoPathFormTemplate { +function Disable-SPInfoPathFormTemplate { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1423,11 +1423,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Disable-SPProjectActiveDirectoryEnterpriseResourcePoolSync { + +function Disable-SPProjectActiveDirectoryEnterpriseResourcePoolSync { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -1439,11 +1439,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Disable-SPProjectEmailNotification { +function Disable-SPProjectEmailNotification { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -1455,11 +1455,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Disable-SPProjectEnterpriseProjectTaskSync { +function Disable-SPProjectEnterpriseProjectTaskSync { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -1470,33 +1470,33 @@ param( [object] ${AssignmentCollection}) - - } + } -function Disable-SPProjectQueueStatsMonitoring { + +function Disable-SPProjectQueueStatsMonitoring { [CmdletBinding(DefaultParameterSetName='__AllParameterSets')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Disable-SPSessionStateService { +function Disable-SPSessionStateService { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Disable-SPSingleSignOn { +function Disable-SPSingleSignOn { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -1508,11 +1508,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Disable-SPTimerJob { + +function Disable-SPTimerJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1523,33 +1523,33 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Disable-SPUserLicensing { +function Disable-SPUserLicensing { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Disable-SPUserSolutionAllowList { +function Disable-SPUserSolutionAllowList { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Disable-SPWebApplicationHttpThrottling { + +function Disable-SPWebApplicationHttpThrottling { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -1560,11 +1560,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Disable-SPWebTemplateForSiteMaster { +function Disable-SPWebTemplateForSiteMaster { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -1578,22 +1578,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Disconnect-SPConfigurationDatabase { + +function Disconnect-SPConfigurationDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Dismount-SPContentDatabase { +function Dismount-SPContentDatabase { [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1605,11 +1605,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Dismount-SPSiteMapDatabase { +function Dismount-SPSiteMapDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0)] @@ -1621,11 +1621,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Dismount-SPStateServiceDatabase { + +function Dismount-SPStateServiceDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1637,11 +1637,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Enable-ProjectServerLicense { +function Enable-ProjectServerLicense { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -1653,11 +1653,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Enable-SPAppAutoProvision { +function Enable-SPAppAutoProvision { [CmdletBinding()] param( [object] @@ -1667,11 +1667,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Enable-SPBusinessDataCatalogEntity { + +function Enable-SPBusinessDataCatalogEntity { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -1683,11 +1683,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Enable-SPFeature { +function Enable-SPFeature { [CmdletBinding(DefaultParameterSetName='FarmFeatureDefinition', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1712,11 +1712,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Enable-SPHealthAnalysisRule { +function Enable-SPHealthAnalysisRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1727,11 +1727,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Enable-SPInfoPathFormTemplate { + +function Enable-SPInfoPathFormTemplate { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1747,11 +1747,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Enable-SPProjectActiveDirectoryEnterpriseResourcePoolSync { +function Enable-SPProjectActiveDirectoryEnterpriseResourcePoolSync { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -1768,11 +1768,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Enable-SPProjectEmailNotification { + +function Enable-SPProjectEmailNotification { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -1784,11 +1784,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Enable-SPProjectEnterpriseProjectTaskSync { +function Enable-SPProjectEnterpriseProjectTaskSync { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -1799,22 +1799,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Enable-SPProjectQueueStatsMonitoring { +function Enable-SPProjectQueueStatsMonitoring { [CmdletBinding(DefaultParameterSetName='__AllParameterSets')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Enable-SPSessionStateService { + +function Enable-SPSessionStateService { [CmdletBinding(DefaultParameterSetName='AdvancedProvision', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='DefaultProvision', Mandatory=$true)] @@ -1840,11 +1840,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Enable-SPTimerJob { +function Enable-SPTimerJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -1855,33 +1855,33 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Enable-SPUserLicensing { +function Enable-SPUserLicensing { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Enable-SPUserSolutionAllowList { + +function Enable-SPUserSolutionAllowList { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Enable-SPWebApplicationHttpThrottling { +function Enable-SPWebApplicationHttpThrottling { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -1892,11 +1892,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Enable-SPWebTemplateForSiteMaster { +function Enable-SPWebTemplateForSiteMaster { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -1910,11 +1910,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Export-SPAccessServicesDatabase { + +function Export-SPAccessServicesDatabase { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -1931,11 +1931,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Export-SPAppPackage { +function Export-SPAppPackage { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -1952,11 +1952,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Export-SPBusinessDataCatalogModel { + +function Export-SPBusinessDataCatalogModel { [CmdletBinding()] param( [switch] @@ -1994,11 +1994,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Export-SPEnterpriseSearchTopology { +function Export-SPEnterpriseSearchTopology { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -2013,11 +2013,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Export-SPInfoPathAdministrationFiles { +function Export-SPInfoPathAdministrationFiles { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [object] @@ -2031,11 +2031,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Export-SPMetadataWebServicePartitionData { + +function Export-SPMetadataWebServicePartitionData { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -2059,11 +2059,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Export-SPPerformancePointContent { +function Export-SPPerformancePointContent { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -2078,11 +2078,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Export-SPScaleOutDatabaseTenantData { +function Export-SPScaleOutDatabaseTenantData { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -2104,11 +2104,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Export-SPServerScaleOutDatabaseTenantData { + +function Export-SPServerScaleOutDatabaseTenantData { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -2130,11 +2130,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Export-SPSiteSubscriptionBusinessDataCatalogConfig { +function Export-SPSiteSubscriptionBusinessDataCatalogConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -2169,11 +2169,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Export-SPSiteSubscriptionSettings { +function Export-SPSiteSubscriptionSettings { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -2196,11 +2196,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Export-SPTagsAndNotesData { + +function Export-SPTagsAndNotesData { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -2217,11 +2217,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Export-SPWeb { +function Export-SPWeb { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -2272,11 +2272,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-AvailabilityGroupStatus { + +function Get-AvailabilityGroupStatus { [CmdletBinding()] param( [string] @@ -2286,22 +2286,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-ProjectServerLicense { +function Get-ProjectServerLicense { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPAccessServiceApplication { +function Get-SPAccessServiceApplication { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -2312,11 +2312,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPAccessServicesApplication { + +function Get-SPAccessServicesApplication { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -2327,11 +2327,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPAccessServicesDatabase { +function Get-SPAccessServicesDatabase { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -2350,11 +2350,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPAccessServicesDatabaseServer { +function Get-SPAccessServicesDatabaseServer { [CmdletBinding(DefaultParameterSetName='GetDatabaseServersParameterSet')] param( [Parameter(ParameterSetName='GetDatabaseServersParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -2375,11 +2375,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPAccessServicesDatabaseServerGroup { + +function Get-SPAccessServicesDatabaseServerGroup { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -2394,11 +2394,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPAccessServicesDatabaseServerGroupMapping { +function Get-SPAccessServicesDatabaseServerGroupMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -2409,11 +2409,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPAlternateURL { +function Get-SPAlternateURL { [CmdletBinding(DefaultParameterSetName='Default')] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -2435,11 +2435,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPAppAcquisitionConfiguration { + +function Get-SPAppAcquisitionConfiguration { [CmdletBinding(DefaultParameterSetName='MarketplaceSettingsInWebApplication')] param( [Parameter(ParameterSetName='MarketplaceSettingsInWebApplication', Mandatory=$true, ValueFromPipeline=$true)] @@ -2454,11 +2454,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPAppAutoProvisionConnection { +function Get-SPAppAutoProvisionConnection { [CmdletBinding()] param( [object] @@ -2471,44 +2471,44 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPAppDeniedEndpointList { + +function Get-SPAppDeniedEndpointList { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPAppDisablingConfiguration { +function Get-SPAppDisablingConfiguration { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPAppDomain { +function Get-SPAppDomain { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPAppHostingQuotaConfiguration { + +function Get-SPAppHostingQuotaConfiguration { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -2520,11 +2520,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPAppInstance { +function Get-SPAppInstance { [CmdletBinding()] param( [Parameter(ParameterSetName='IdentityParameterSet', Mandatory=$true, ValueFromPipeline=$true)] @@ -2555,11 +2555,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPAppPrincipal { +function Get-SPAppPrincipal { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -2576,22 +2576,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPAppScaleProfile { + +function Get-SPAppScaleProfile { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPAppSiteSubscriptionName { +function Get-SPAppSiteSubscriptionName { [CmdletBinding()] param( [object] @@ -2601,55 +2601,55 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPAppStateSyncLastRunTime { +function Get-SPAppStateSyncLastRunTime { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPAppStateUpdateInterval { + +function Get-SPAppStateUpdateInterval { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPAppStoreConfiguration { +function Get-SPAppStoreConfiguration { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPAppStoreWebServiceConfiguration { + +function Get-SPAppStoreWebServiceConfiguration { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPAuthenticationProvider { +function Get-SPAuthenticationProvider { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -2670,11 +2670,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPAuthenticationRealm { +function Get-SPAuthenticationRealm { [CmdletBinding()] param( [Parameter(Position=0)] @@ -2686,11 +2686,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPBackupHistory { + +function Get-SPBackupHistory { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -2707,33 +2707,33 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPBingMapsBlock { +function Get-SPBingMapsBlock { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPBingMapsKey { +function Get-SPBingMapsKey { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPBrowserCustomerExperienceImprovementProgram { + +function Get-SPBrowserCustomerExperienceImprovementProgram { [CmdletBinding()] param( [Parameter(ParameterSetName='Farm', Mandatory=$true)] @@ -2752,11 +2752,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPBusinessDataCatalogEntityNotificationWeb { +function Get-SPBusinessDataCatalogEntityNotificationWeb { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -2768,11 +2768,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPBusinessDataCatalogMetadataObject { +function Get-SPBusinessDataCatalogMetadataObject { [CmdletBinding()] param( [string] @@ -2797,11 +2797,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPBusinessDataCatalogThrottleConfig { + +function Get-SPBusinessDataCatalogThrottleConfig { [CmdletBinding(DefaultParameterSetName='ProxyProvided')] param( [Parameter(Mandatory=$true)] @@ -2825,22 +2825,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPCertificateAuthority { +function Get-SPCertificateAuthority { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPClaimProvider { + +function Get-SPClaimProvider { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -2851,22 +2851,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPClaimProviderManager { +function Get-SPClaimProviderManager { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPClaimTypeEncoding { +function Get-SPClaimTypeEncoding { [CmdletBinding()] param( [char] @@ -2880,11 +2880,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPConnectedServiceApplicationInformation { + +function Get-SPConnectedServiceApplicationInformation { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -2895,11 +2895,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPContentDatabase { +function Get-SPContentDatabase { [CmdletBinding(DefaultParameterSetName='DefaultSet')] param( [Parameter(ParameterSetName='DefaultSet', Position=0, ValueFromPipeline=$true)] @@ -2942,11 +2942,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPContentDeploymentJob { +function Get-SPContentDeploymentJob { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -2961,11 +2961,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPContentDeploymentPath { + +function Get-SPContentDeploymentPath { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -2976,11 +2976,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPCustomLayoutsPage { +function Get-SPCustomLayoutsPage { [CmdletBinding()] param( [object] @@ -2998,11 +2998,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPDatabase { +function Get-SPDatabase { [CmdletBinding(DefaultParameterSetName='DefaultParameterSet')] param( [Parameter(ParameterSetName='DefaultParameterSet', Position=0, ValueFromPipeline=$true)] @@ -3022,11 +3022,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPDataConnectionFile { + +function Get-SPDataConnectionFile { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -3037,11 +3037,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPDataConnectionFileDependent { +function Get-SPDataConnectionFileDependent { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -3052,11 +3052,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPDeletedSite { + +function Get-SPDeletedSite { [CmdletBinding(DefaultParameterSetName='AllDeletedSitesInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='AllDeletedSitesInIdentity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -3088,11 +3088,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPDesignerSettings { +function Get-SPDesignerSettings { [CmdletBinding()] param( [Parameter(ParameterSetName='WebApplication', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -3103,22 +3103,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPDiagnosticConfig { +function Get-SPDiagnosticConfig { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPDiagnosticsPerformanceCounter { + +function Get-SPDiagnosticsPerformanceCounter { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] @@ -3133,11 +3133,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPDiagnosticsProvider { +function Get-SPDiagnosticsProvider { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -3148,11 +3148,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPDistributedCacheClientSetting { +function Get-SPDistributedCacheClientSetting { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -3164,11 +3164,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchAdministrationComponent { + +function Get-SPEnterpriseSearchAdministrationComponent { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -3179,11 +3179,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchComponent { +function Get-SPEnterpriseSearchComponent { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3201,11 +3201,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchContentEnrichmentConfiguration { +function Get-SPEnterpriseSearchContentEnrichmentConfiguration { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -3216,11 +3216,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchCrawlContentSource { + +function Get-SPEnterpriseSearchCrawlContentSource { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3235,11 +3235,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchCrawlCustomConnector { +function Get-SPEnterpriseSearchCrawlCustomConnector { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -3254,11 +3254,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchCrawlDatabase { + +function Get-SPEnterpriseSearchCrawlDatabase { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3273,11 +3273,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchCrawlExtension { +function Get-SPEnterpriseSearchCrawlExtension { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3292,11 +3292,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchCrawlLogReadPermission { +function Get-SPEnterpriseSearchCrawlLogReadPermission { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -3311,11 +3311,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchCrawlMapping { + +function Get-SPEnterpriseSearchCrawlMapping { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3330,11 +3330,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchCrawlRule { +function Get-SPEnterpriseSearchCrawlRule { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3349,11 +3349,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchFileFormat { +function Get-SPEnterpriseSearchFileFormat { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3368,11 +3368,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchHostController { + +function Get-SPEnterpriseSearchHostController { [CmdletBinding()] param( [object] @@ -3382,11 +3382,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchLanguageResourcePhrase { +function Get-SPEnterpriseSearchLanguageResourcePhrase { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3418,11 +3418,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchLinguisticComponentsStatus { +function Get-SPEnterpriseSearchLinguisticComponentsStatus { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -3437,11 +3437,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchLinksDatabase { + +function Get-SPEnterpriseSearchLinksDatabase { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3456,11 +3456,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchMetadataCategory { +function Get-SPEnterpriseSearchMetadataCategory { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3481,11 +3481,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchMetadataCrawledProperty { + +function Get-SPEnterpriseSearchMetadataCrawledProperty { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3522,11 +3522,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchMetadataManagedProperty { +function Get-SPEnterpriseSearchMetadataManagedProperty { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3550,11 +3550,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchMetadataMapping { +function Get-SPEnterpriseSearchMetadataMapping { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -3577,11 +3577,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchOwner { + +function Get-SPEnterpriseSearchOwner { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3600,11 +3600,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchPropertyRule { +function Get-SPEnterpriseSearchPropertyRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -3619,33 +3619,33 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchPropertyRuleCollection { + +function Get-SPEnterpriseSearchPropertyRuleCollection { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchQueryAndSiteSettingsService { +function Get-SPEnterpriseSearchQueryAndSiteSettingsService { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance { +function Get-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3659,22 +3659,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchQueryAndSiteSettingsServiceProxy { + +function Get-SPEnterpriseSearchQueryAndSiteSettingsServiceProxy { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchQueryAuthority { +function Get-SPEnterpriseSearchQueryAuthority { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3694,11 +3694,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchQueryDemoted { + +function Get-SPEnterpriseSearchQueryDemoted { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3718,11 +3718,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchQueryKeyword { +function Get-SPEnterpriseSearchQueryKeyword { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3737,11 +3737,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchQueryScope { +function Get-SPEnterpriseSearchQueryScope { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3760,11 +3760,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchQueryScopeRule { + +function Get-SPEnterpriseSearchQueryScopeRule { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3786,11 +3786,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchQuerySpellingCorrection { +function Get-SPEnterpriseSearchQuerySpellingCorrection { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -3805,11 +3805,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchQuerySuggestionCandidates { +function Get-SPEnterpriseSearchQuerySuggestionCandidates { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -3828,11 +3828,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchRankingModel { + +function Get-SPEnterpriseSearchRankingModel { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3852,11 +3852,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchResultItemType { +function Get-SPEnterpriseSearchResultItemType { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3880,11 +3880,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchResultSource { +function Get-SPEnterpriseSearchResultSource { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3904,11 +3904,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchSecurityTrimmer { + +function Get-SPEnterpriseSearchSecurityTrimmer { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3923,22 +3923,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchService { +function Get-SPEnterpriseSearchService { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchServiceApplication { + +function Get-SPEnterpriseSearchServiceApplication { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3949,11 +3949,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchServiceApplicationBackupStore { +function Get-SPEnterpriseSearchServiceApplicationBackupStore { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -3980,11 +3980,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchServiceApplicationProxy { +function Get-SPEnterpriseSearchServiceApplicationProxy { [CmdletBinding()] param( [Parameter(Position=0)] @@ -3995,11 +3995,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchServiceInstance { + +function Get-SPEnterpriseSearchServiceInstance { [CmdletBinding()] param( [Parameter(Position=0)] @@ -4013,11 +4013,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchSiteHitRule { +function Get-SPEnterpriseSearchSiteHitRule { [CmdletBinding()] param( [Parameter(Position=0)] @@ -4032,11 +4032,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchStatus { +function Get-SPEnterpriseSearchStatus { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -4071,11 +4071,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPEnterpriseSearchTopology { + +function Get-SPEnterpriseSearchTopology { [CmdletBinding()] param( [Parameter(Position=0)] @@ -4093,33 +4093,33 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPEnterpriseSearchVssDataPath { +function Get-SPEnterpriseSearchVssDataPath { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPFarm { +function Get-SPFarm { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPFarmConfig { + +function Get-SPFarmConfig { [CmdletBinding()] param( [switch] @@ -4129,11 +4129,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPFeature { +function Get-SPFeature { [CmdletBinding(DefaultParameterSetName='Default')] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -4171,11 +4171,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPHealthAnalysisRule { + +function Get-SPHealthAnalysisRule { [CmdletBinding(DefaultParameterSetName='Default')] param( [Parameter(ParameterSetName='SpecificRule', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4186,11 +4186,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPHelpCollection { +function Get-SPHelpCollection { [CmdletBinding()] param( [string] @@ -4200,11 +4200,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPInfoPathFormsService { +function Get-SPInfoPathFormsService { [CmdletBinding()] param( [object] @@ -4214,11 +4214,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPInfoPathFormTemplate { + +function Get-SPInfoPathFormTemplate { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -4229,11 +4229,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPInfoPathUserAgent { +function Get-SPInfoPathUserAgent { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -4244,11 +4244,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPInfoPathWebServiceProxy { +function Get-SPInfoPathWebServiceProxy { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4259,55 +4259,55 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPInsightsConfig { + +function Get-SPInsightsConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPInternalAppStateSyncLastRunTime { +function Get-SPInternalAppStateSyncLastRunTime { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPInternalAppStateUpdateInterval { +function Get-SPInternalAppStateUpdateInterval { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPIRMSettings { + +function Get-SPIRMSettings { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPLogEvent { +function Get-SPLogEvent { [CmdletBinding(DefaultParameterSetName='Directory')] param( [Parameter(ParameterSetName='Directory')] @@ -4341,11 +4341,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPLogLevel { + +function Get-SPLogLevel { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] @@ -4356,11 +4356,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPManagedAccount { +function Get-SPManagedAccount { [CmdletBinding(DefaultParameterSetName='Service')] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -4383,11 +4383,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPManagedPath { +function Get-SPManagedPath { [CmdletBinding(DefaultParameterSetName='WebApplication')] param( [Parameter(Position=0)] @@ -4406,11 +4406,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPMetadataServiceApplication { + +function Get-SPMetadataServiceApplication { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4421,11 +4421,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPMetadataServiceApplicationProxy { +function Get-SPMetadataServiceApplicationProxy { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4436,11 +4436,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPMicrofeedOptions { +function Get-SPMicrofeedOptions { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -4457,11 +4457,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPMobileMessagingAccount { + +function Get-SPMobileMessagingAccount { [CmdletBinding()] param( [Parameter(Position=0)] @@ -4477,22 +4477,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPO365LinkSettings { +function Get-SPO365LinkSettings { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPODataConnectionSetting { +function Get-SPODataConnectionSetting { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -4509,11 +4509,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPODataConnectionSettingMetadata { + +function Get-SPODataConnectionSettingMetadata { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -4531,11 +4531,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPOfficeStoreAppsDefaultActivation { +function Get-SPOfficeStoreAppsDefaultActivation { [CmdletBinding(DefaultParameterSetName='AppsForOfficeSettingsInWebApplication')] param( [Parameter(ParameterSetName='AppsForOfficeSettingsInWebApplication', Mandatory=$true, ValueFromPipeline=$true)] @@ -4550,11 +4550,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPPendingUpgradeActions { + +function Get-SPPendingUpgradeActions { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4571,11 +4571,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPPerformancePointServiceApplication { +function Get-SPPerformancePointServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -4586,11 +4586,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPPerformancePointServiceApplicationTrustedLocation { +function Get-SPPerformancePointServiceApplicationTrustedLocation { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] @@ -4605,11 +4605,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPPluggableSecurityTrimmer { + +function Get-SPPluggableSecurityTrimmer { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -4621,11 +4621,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPProcessAccount { +function Get-SPProcessAccount { [CmdletBinding(DefaultParameterSetName='NetworkService')] param( [Parameter(ParameterSetName='NetworkService')] @@ -4644,11 +4644,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPProduct { +function Get-SPProduct { [CmdletBinding(DefaultParameterSetName='Local')] param( [Parameter(ParameterSetName='Server', ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -4663,11 +4663,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPProfileLeader { + +function Get-SPProfileLeader { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4684,11 +4684,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPProfileServiceApplicationSecurity { +function Get-SPProfileServiceApplicationSecurity { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -4708,11 +4708,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPProjectDatabaseQuota { +function Get-SPProjectDatabaseQuota { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -4724,11 +4724,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPProjectDatabaseUsage { + +function Get-SPProjectDatabaseUsage { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -4740,11 +4740,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPProjectEnterpriseProjectTaskSync { +function Get-SPProjectEnterpriseProjectTaskSync { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -4755,22 +4755,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPProjectEventServiceSettings { + +function Get-SPProjectEventServiceSettings { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPProjectIsEmailNotificationEnabled { +function Get-SPProjectIsEmailNotificationEnabled { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -4782,22 +4782,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPProjectOdataConfiguration { +function Get-SPProjectOdataConfiguration { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPProjectPCSSettings { + +function Get-SPProjectPCSSettings { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] @@ -4809,11 +4809,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPProjectPermissionMode { +function Get-SPProjectPermissionMode { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -4825,11 +4825,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPProjectQueueSettings { +function Get-SPProjectQueueSettings { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] @@ -4841,11 +4841,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPProjectWebInstance { + +function Get-SPProjectWebInstance { [CmdletBinding()] param( [uri] @@ -4860,11 +4860,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPRequestManagementSettings { +function Get-SPRequestManagementSettings { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4876,11 +4876,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPRoutingMachineInfo { +function Get-SPRoutingMachineInfo { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4900,11 +4900,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPRoutingMachinePool { + +function Get-SPRoutingMachinePool { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4920,11 +4920,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPRoutingRule { +function Get-SPRoutingRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -4940,11 +4940,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPScaleOutDatabase { + +function Get-SPScaleOutDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -4955,11 +4955,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPScaleOutDatabaseDataState { +function Get-SPScaleOutDatabaseDataState { [CmdletBinding(DefaultParameterSetName='AttachedDatabase', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='AttachedDatabase', Mandatory=$true, ValueFromPipeline=$true)] @@ -4980,11 +4980,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPScaleOutDatabaseInconsistency { +function Get-SPScaleOutDatabaseInconsistency { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -4995,11 +4995,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPScaleOutDatabaseLogEntry { + +function Get-SPScaleOutDatabaseLogEntry { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -5024,11 +5024,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSecureStoreApplication { +function Get-SPSecureStoreApplication { [CmdletBinding(DefaultParameterSetName='NameSet')] param( [Parameter(ParameterSetName='AllSet', Mandatory=$true)] @@ -5048,33 +5048,33 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSecureStoreSystemAccount { +function Get-SPSecureStoreSystemAccount { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPSecurityTokenServiceConfig { + +function Get-SPSecurityTokenServiceConfig { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPServer { +function Get-SPServer { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5086,11 +5086,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPServerScaleOutDatabase { +function Get-SPServerScaleOutDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -5101,11 +5101,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPServerScaleOutDatabaseDataState { + +function Get-SPServerScaleOutDatabaseDataState { [CmdletBinding(DefaultParameterSetName='AttachedDatabase', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='AttachedDatabase', Mandatory=$true, ValueFromPipeline=$true)] @@ -5126,11 +5126,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPServerScaleOutDatabaseInconsistency { +function Get-SPServerScaleOutDatabaseInconsistency { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -5141,11 +5141,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPServerScaleOutDatabaseLogEntry { + +function Get-SPServerScaleOutDatabaseLogEntry { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -5170,11 +5170,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPService { +function Get-SPService { [CmdletBinding(DefaultParameterSetName='Identity')] param( [Parameter(ParameterSetName='Identity', Position=0, ValueFromPipeline=$true)] @@ -5188,11 +5188,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPServiceApplication { +function Get-SPServiceApplication { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5206,11 +5206,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPServiceApplicationEndpoint { + +function Get-SPServiceApplicationEndpoint { [CmdletBinding(DefaultParameterSetName='Identity')] param( [Parameter(ParameterSetName='Identity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5229,11 +5229,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPServiceApplicationPool { +function Get-SPServiceApplicationPool { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5244,11 +5244,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPServiceApplicationProxy { + +function Get-SPServiceApplicationProxy { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5259,11 +5259,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPServiceApplicationProxyGroup { +function Get-SPServiceApplicationProxyGroup { [CmdletBinding(DefaultParameterSetName='Identity')] param( [Parameter(ParameterSetName='Identity', Position=0, ValueFromPipeline=$true)] @@ -5278,11 +5278,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPServiceApplicationSecurity { +function Get-SPServiceApplicationSecurity { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5297,11 +5297,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPServiceContext { + +function Get-SPServiceContext { [CmdletBinding()] param( [Parameter(ParameterSetName='Site', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5316,11 +5316,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPServiceHostConfig { +function Get-SPServiceHostConfig { [CmdletBinding()] param( [switch] @@ -5330,11 +5330,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPServiceInstance { + +function Get-SPServiceInstance { [CmdletBinding(DefaultParameterSetName='Identity')] param( [Parameter(ParameterSetName='Identity', Position=0, ValueFromPipeline=$true)] @@ -5352,22 +5352,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSessionStateService { +function Get-SPSessionStateService { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPShellAdmin { +function Get-SPShellAdmin { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5378,11 +5378,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPSite { + +function Get-SPSite { [CmdletBinding(DefaultParameterSetName='AllSitesInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='AllSitesInIdentity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5422,11 +5422,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSiteAdministration { +function Get-SPSiteAdministration { [CmdletBinding(DefaultParameterSetName='AllSitesInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='AllSitesInIdentity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5459,22 +5459,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSiteMapDatabase { +function Get-SPSiteMapDatabase { [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPSiteMaster { + +function Get-SPSiteMaster { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5485,11 +5485,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSiteSubscription { +function Get-SPSiteSubscription { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5500,11 +5500,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSiteSubscriptionConfig { +function Get-SPSiteSubscriptionConfig { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5516,11 +5516,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPSiteSubscriptionEdiscoveryHub { + +function Get-SPSiteSubscriptionEdiscoveryHub { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5531,11 +5531,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSiteSubscriptionEdiscoverySearchScope { +function Get-SPSiteSubscriptionEdiscoverySearchScope { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5546,11 +5546,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPSiteSubscriptionFeaturePack { + +function Get-SPSiteSubscriptionFeaturePack { [CmdletBinding(DefaultParameterSetName='FeaturePack')] param( [Parameter(ParameterSetName='FeaturePack', Position=0, ValueFromPipeline=$true)] @@ -5565,11 +5565,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSiteSubscriptionIRMConfig { +function Get-SPSiteSubscriptionIRMConfig { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5581,11 +5581,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSiteSubscriptionMetadataConfig { +function Get-SPSiteSubscriptionMetadataConfig { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5600,11 +5600,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPSiteUpgradeSessionInfo { + +function Get-SPSiteUpgradeSessionInfo { [CmdletBinding(DefaultParameterSetName='ContentDB')] param( [Parameter(ParameterSetName='Site', Mandatory=$true)] @@ -5639,11 +5639,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSiteURL { +function Get-SPSiteURL { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5654,11 +5654,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPSolution { +function Get-SPSolution { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5669,11 +5669,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPStateServiceApplication { + +function Get-SPStateServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -5685,11 +5685,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPStateServiceApplicationProxy { +function Get-SPStateServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -5701,11 +5701,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPStateServiceDatabase { +function Get-SPStateServiceDatabase { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Default', Position=0, ValueFromPipeline=$true)] @@ -5722,11 +5722,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPTaxonomySession { + +function Get-SPTaxonomySession { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -5737,11 +5737,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPThrottlingRule { +function Get-SPThrottlingRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -5757,11 +5757,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPTimerJob { + +function Get-SPTimerJob { [CmdletBinding()] param( [Parameter(Position=0)] @@ -5780,11 +5780,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPTopologyServiceApplication { +function Get-SPTopologyServiceApplication { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5795,11 +5795,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPTopologyServiceApplicationProxy { +function Get-SPTopologyServiceApplicationProxy { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5810,11 +5810,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPTranslationThrottlingSetting { + +function Get-SPTranslationThrottlingSetting { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [object] @@ -5824,11 +5824,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPTrustedIdentityTokenIssuer { +function Get-SPTrustedIdentityTokenIssuer { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5840,11 +5840,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPTrustedRootAuthority { +function Get-SPTrustedRootAuthority { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5856,11 +5856,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPTrustedSecurityTokenIssuer { + +function Get-SPTrustedSecurityTokenIssuer { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5871,11 +5871,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPTrustedServiceTokenIssuer { +function Get-SPTrustedServiceTokenIssuer { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5886,22 +5886,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPUpgradeActions { +function Get-SPUpgradeActions { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPUsageApplication { + +function Get-SPUsageApplication { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5916,11 +5916,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPUsageDefinition { +function Get-SPUsageDefinition { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5931,11 +5931,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPUsageService { + +function Get-SPUsageService { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5946,11 +5946,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPUser { +function Get-SPUser { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -5974,22 +5974,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPUserLicense { +function Get-SPUserLicense { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Get-SPUserLicenseMapping { + +function Get-SPUserLicenseMapping { [CmdletBinding()] param( [Parameter(ParameterSetName='WebApplication', ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -6001,22 +6001,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPUserLicensing { +function Get-SPUserLicensing { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPUserSettingsProvider { +function Get-SPUserSettingsProvider { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -6027,22 +6027,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPUserSettingsProviderManager { + +function Get-SPUserSettingsProviderManager { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPUserSolution { +function Get-SPUserSolution { [CmdletBinding()] param( [Parameter(Position=0)] @@ -6057,11 +6057,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPUserSolutionAllowList { +function Get-SPUserSolutionAllowList { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -6073,11 +6073,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPVisioExternalData { + +function Get-SPVisioExternalData { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -6089,11 +6089,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPVisioPerformance { +function Get-SPVisioPerformance { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -6105,11 +6105,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPVisioSafeDataProvider { + +function Get-SPVisioSafeDataProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -6127,11 +6127,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPVisioServiceApplication { +function Get-SPVisioServiceApplication { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -6142,11 +6142,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPVisioServiceApplicationProxy { +function Get-SPVisioServiceApplicationProxy { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -6157,11 +6157,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPWeb { + +function Get-SPWeb { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0)] @@ -6185,11 +6185,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPWebApplication { +function Get-SPWebApplication { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -6203,11 +6203,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPWebApplicationAppDomain { +function Get-SPWebApplicationAppDomain { [CmdletBinding(DefaultParameterSetName='Default')] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -6229,11 +6229,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPWebApplicationHttpThrottlingMonitor { + +function Get-SPWebApplicationHttpThrottlingMonitor { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -6244,11 +6244,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPWebPartPack { +function Get-SPWebPartPack { [CmdletBinding()] param( [Parameter(Position=0)] @@ -6267,11 +6267,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Get-SPWebTemplate { +function Get-SPWebTemplate { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -6285,22 +6285,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPWebTemplatesEnabledForSiteMaster { + +function Get-SPWebTemplatesEnabledForSiteMaster { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPWOPIBinding { +function Get-SPWOPIBinding { [CmdletBinding()] param( [ValidateNotNullOrEmpty()] @@ -6332,33 +6332,33 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPWOPISuppressionSetting { + +function Get-SPWOPISuppressionSetting { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPWOPIZone { +function Get-SPWOPIZone { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Get-SPWorkflowConfig { +function Get-SPWorkflowConfig { [CmdletBinding()] param( [Parameter(ParameterSetName='WebApplication', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -6373,22 +6373,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Get-SPWorkflowServiceApplicationProxy { + +function Get-SPWorkflowServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Grant-SPBusinessDataCatalogMetadataObject { +function Grant-SPBusinessDataCatalogMetadataObject { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -6412,11 +6412,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Grant-SPObjectSecurity { +function Grant-SPObjectSecurity { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -6441,11 +6441,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Import-SPAccessServicesDatabase { + +function Import-SPAccessServicesDatabase { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -6467,11 +6467,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Import-SPAppPackage { +function Import-SPAppPackage { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -6498,11 +6498,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Import-SPBusinessDataCatalogDotNetAssembly { +function Import-SPBusinessDataCatalogDotNetAssembly { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -6523,11 +6523,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Import-SPBusinessDataCatalogModel { + +function Import-SPBusinessDataCatalogModel { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [switch] @@ -6567,11 +6567,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Import-SPEnterpriseSearchCustomExtractionDictionary { +function Import-SPEnterpriseSearchCustomExtractionDictionary { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -6591,11 +6591,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Import-SPEnterpriseSearchPopularQueries { + +function Import-SPEnterpriseSearchPopularQueries { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -6617,11 +6617,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Import-SPEnterpriseSearchThesaurus { +function Import-SPEnterpriseSearchThesaurus { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -6636,11 +6636,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Import-SPEnterpriseSearchTopology { +function Import-SPEnterpriseSearchTopology { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -6655,11 +6655,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Import-SPInfoPathAdministrationFiles { + +function Import-SPInfoPathAdministrationFiles { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [object] @@ -6673,11 +6673,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Import-SPMetadataWebServicePartitionData { +function Import-SPMetadataWebServicePartitionData { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -6712,11 +6712,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Import-SPPerformancePointContent { +function Import-SPPerformancePointContent { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -6743,11 +6743,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Import-SPScaleOutDatabaseTenantData { + +function Import-SPScaleOutDatabaseTenantData { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -6766,11 +6766,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Import-SPServerScaleOutDatabaseTenantData { +function Import-SPServerScaleOutDatabaseTenantData { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -6789,11 +6789,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Import-SPSiteSubscriptionBusinessDataCatalogConfig { +function Import-SPSiteSubscriptionBusinessDataCatalogConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -6825,11 +6825,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Import-SPSiteSubscriptionSettings { + +function Import-SPSiteSubscriptionSettings { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -6852,11 +6852,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Import-SPWeb { +function Import-SPWeb { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -6898,22 +6898,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Initialize-SPResourceSecurity { + +function Initialize-SPResourceSecurity { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Initialize-SPStateServiceDatabase { +function Initialize-SPStateServiceDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -6925,11 +6925,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Install-SPApp { +function Install-SPApp { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [Parameter(Mandatory=$true)] @@ -6946,22 +6946,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Install-SPApplicationContent { + +function Install-SPApplicationContent { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Install-SPDataConnectionFile { +function Install-SPDataConnectionFile { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -6983,11 +6983,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Install-SPFeature { + +function Install-SPFeature { [CmdletBinding(DefaultParameterSetName='PathSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='PathSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -7018,11 +7018,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Install-SPHelpCollection { +function Install-SPHelpCollection { [CmdletBinding(DefaultParameterSetName='InstallOne')] param( [Parameter(ParameterSetName='InstallOne', Mandatory=$true)] @@ -7038,11 +7038,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Install-SPInfoPathFormTemplate { +function Install-SPInfoPathFormTemplate { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -7059,11 +7059,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Install-SPService { + +function Install-SPService { [CmdletBinding()] param( [switch] @@ -7073,11 +7073,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Install-SPSolution { +function Install-SPSolution { [CmdletBinding(DefaultParameterSetName='Deploy', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Synchronize', Position=0, ValueFromPipeline=$true)] @@ -7132,11 +7132,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Install-SPUserSolution { + +function Install-SPUserSolution { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -7151,11 +7151,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Install-SPWebPartPack { +function Install-SPWebPartPack { [CmdletBinding(DefaultParameterSetName='UseFileName', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='UseName', Mandatory=$true, Position=0)] @@ -7189,11 +7189,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Invoke-SPProjectActiveDirectoryEnterpriseResourcePoolSync { + +function Invoke-SPProjectActiveDirectoryEnterpriseResourcePoolSync { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -7205,11 +7205,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Invoke-SPProjectActiveDirectoryGroupSync { +function Invoke-SPProjectActiveDirectoryGroupSync { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -7221,11 +7221,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Merge-SPLogFile { + +function Merge-SPLogFile { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -7275,11 +7275,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Merge-SPUsageLog { +function Merge-SPUsageLog { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -7305,11 +7305,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Migrate-SPDatabase { + +function Migrate-SPDatabase { [CmdletBinding(DefaultParameterSetName='SiteSubscription', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -7344,11 +7344,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Migrate-SPProjectDatabase { +function Migrate-SPProjectDatabase { [CmdletBinding(DefaultParameterSetName='web', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='web', Mandatory=$true)] @@ -7382,11 +7382,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Migrate-SPProjectResourcePlans { + +function Migrate-SPProjectResourcePlans { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -7398,11 +7398,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Mount-SPContentDatabase { +function Mount-SPContentDatabase { [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [switch] @@ -7461,11 +7461,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Mount-SPSiteMapDatabase { + +function Mount-SPSiteMapDatabase { [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -7489,11 +7489,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Mount-SPStateServiceDatabase { +function Mount-SPStateServiceDatabase { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -7518,11 +7518,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Move-SPAppManagementData { + +function Move-SPAppManagementData { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Default', Mandatory=$true)] @@ -7545,11 +7545,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Move-SPBlobStorageLocation { +function Move-SPBlobStorageLocation { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -7577,11 +7577,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Move-SPDeletedSite { + +function Move-SPDeletedSite { [CmdletBinding(DefaultParameterSetName='DatabaseFromPipebind', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -7608,11 +7608,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Move-SPEnterpriseSearchLinksDatabases { +function Move-SPEnterpriseSearchLinksDatabases { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -7635,11 +7635,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Move-SPProfileManagedMetadataProperty { + +function Move-SPProfileManagedMetadataProperty { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -7662,11 +7662,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Move-SPSite { +function Move-SPSite { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -7688,11 +7688,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Move-SPSocialComment { + +function Move-SPSocialComment { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -7714,11 +7714,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Move-SPUser { +function Move-SPUser { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -7739,11 +7739,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPAccessServiceApplication { + +function New-SPAccessServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -7823,11 +7823,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPAccessServicesApplication { +function New-SPAccessServicesApplication { [CmdletBinding(DefaultParameterSetName='NoApplicationServerParameterSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='DefaultParameterSet', Mandatory=$true)] @@ -7915,11 +7915,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPAccessServicesApplicationProxy { + +function New-SPAccessServicesApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -7930,11 +7930,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPAccessServicesDatabaseServer { +function New-SPAccessServicesDatabaseServer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -7996,11 +7996,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPAlternateURL { + +function New-SPAlternateURL { [CmdletBinding(DefaultParameterSetName='WebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -8025,11 +8025,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPAppManagementServiceApplication { +function New-SPAppManagementServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -8063,11 +8063,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPAppManagementServiceApplicationProxy { + +function New-SPAppManagementServiceApplicationProxy { [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -8089,11 +8089,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPAuthenticationProvider { +function New-SPAuthenticationProvider { [CmdletBinding(DefaultParameterSetName='Windows')] param( [Parameter(ParameterSetName='Windows')] @@ -8131,11 +8131,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPAzureAccessControlServiceApplicationProxy { + +function New-SPAzureAccessControlServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -8156,11 +8156,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPBECWebServiceApplicationProxy { +function New-SPBECWebServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -8181,11 +8181,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPBusinessDataCatalogServiceApplication { + +function New-SPBusinessDataCatalogServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -8227,11 +8227,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPBusinessDataCatalogServiceApplicationProxy { +function New-SPBusinessDataCatalogServiceApplicationProxy { [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Uri', Mandatory=$true)] @@ -8258,11 +8258,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPCentralAdministration { + +function New-SPCentralAdministration { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -8281,11 +8281,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPClaimProvider { +function New-SPClaimProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -8314,11 +8314,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPClaimsPrincipal { + +function New-SPClaimsPrincipal { [CmdletBinding(DefaultParameterSetName='IdentityType')] param( [Parameter(ParameterSetName='TrustIdentity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -8369,11 +8369,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPClaimTypeEncoding { +function New-SPClaimTypeEncoding { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -8392,11 +8392,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPClaimTypeMapping { + +function New-SPClaimTypeMapping { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -8422,11 +8422,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPConfigurationDatabase { +function New-SPConfigurationDatabase { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -8484,11 +8484,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPContentDatabase { + +function New-SPContentDatabase { [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -8537,11 +8537,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPContentDeploymentJob { +function New-SPContentDeploymentJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -8583,11 +8583,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPContentDeploymentPath { + +function New-SPContentDeploymentPath { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -8646,11 +8646,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchAdminComponent { +function New-SPEnterpriseSearchAdminComponent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -8668,11 +8668,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchAnalyticsProcessingComponent { + +function New-SPEnterpriseSearchAnalyticsProcessingComponent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -8690,22 +8690,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchContentEnrichmentConfiguration { +function New-SPEnterpriseSearchContentEnrichmentConfiguration { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchContentProcessingComponent { + +function New-SPEnterpriseSearchContentProcessingComponent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -8723,11 +8723,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchCrawlComponent { +function New-SPEnterpriseSearchCrawlComponent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -8745,11 +8745,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchCrawlContentSource { + +function New-SPEnterpriseSearchCrawlContentSource { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -8798,11 +8798,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchCrawlCustomConnector { +function New-SPEnterpriseSearchCrawlCustomConnector { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -8825,11 +8825,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchCrawlDatabase { + +function New-SPEnterpriseSearchCrawlDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -8856,11 +8856,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchCrawlExtension { +function New-SPEnterpriseSearchCrawlExtension { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0)] @@ -8875,11 +8875,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchCrawlMapping { + +function New-SPEnterpriseSearchCrawlMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -8899,11 +8899,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchCrawlRule { +function New-SPEnterpriseSearchCrawlRule { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -8953,11 +8953,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchFileFormat { + +function New-SPEnterpriseSearchFileFormat { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -8980,11 +8980,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchIndexComponent { +function New-SPEnterpriseSearchIndexComponent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -9008,11 +9008,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchLanguageResourcePhrase { + +function New-SPEnterpriseSearchLanguageResourcePhrase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -9046,11 +9046,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchLinksDatabase { +function New-SPEnterpriseSearchLinksDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -9077,11 +9077,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchMetadataCategory { + +function New-SPEnterpriseSearchMetadataCategory { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -9112,11 +9112,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchMetadataCrawledProperty { +function New-SPEnterpriseSearchMetadataCrawledProperty { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -9162,11 +9162,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchMetadataManagedProperty { + +function New-SPEnterpriseSearchMetadataManagedProperty { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -9253,11 +9253,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchMetadataMapping { +function New-SPEnterpriseSearchMetadataMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -9282,11 +9282,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchQueryAuthority { + +function New-SPEnterpriseSearchQueryAuthority { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -9311,11 +9311,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchQueryDemoted { +function New-SPEnterpriseSearchQueryDemoted { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -9335,11 +9335,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchQueryKeyword { + +function New-SPEnterpriseSearchQueryKeyword { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -9374,11 +9374,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchQueryProcessingComponent { +function New-SPEnterpriseSearchQueryProcessingComponent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -9396,11 +9396,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchQueryScope { + +function New-SPEnterpriseSearchQueryScope { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -9441,11 +9441,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchQueryScopeRule { +function New-SPEnterpriseSearchQueryScopeRule { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [object] @@ -9490,11 +9490,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchRankingModel { + +function New-SPEnterpriseSearchRankingModel { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -9514,11 +9514,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchResultItemType { +function New-SPEnterpriseSearchResultItemType { [CmdletBinding(DefaultParameterSetName='New', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] @@ -9585,11 +9585,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchResultSource { + +function New-SPEnterpriseSearchResultSource { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -9640,11 +9640,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchSecurityTrimmer { +function New-SPEnterpriseSearchSecurityTrimmer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -9669,11 +9669,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchServiceApplication { + +function New-SPEnterpriseSearchServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='DefaultParameterSet', Position=0)] @@ -9720,11 +9720,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchServiceApplicationProxy { +function New-SPEnterpriseSearchServiceApplicationProxy { [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='SSA', Mandatory=$true)] @@ -9749,11 +9749,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPEnterpriseSearchSiteHitRule { + +function New-SPEnterpriseSearchSiteHitRule { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -9776,11 +9776,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPEnterpriseSearchTopology { +function New-SPEnterpriseSearchTopology { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -9799,22 +9799,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPLogFile { + +function New-SPLogFile { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function New-SPManagedAccount { +function New-SPManagedAccount { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -9825,11 +9825,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPManagedPath { + +function New-SPManagedPath { [CmdletBinding(DefaultParameterSetName='WebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -9851,11 +9851,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPMarketplaceWebServiceApplicationProxy { +function New-SPMarketplaceWebServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -9876,11 +9876,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPMetadataServiceApplication { + +function New-SPMetadataServiceApplication { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -9968,11 +9968,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPMetadataServiceApplicationProxy { +function New-SPMetadataServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [switch] @@ -10007,11 +10007,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPODataConnectionSetting { + +function New-SPODataConnectionSetting { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -10047,11 +10047,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPOnlineApplicationPrincipalManagementServiceApplicationProxy { +function New-SPOnlineApplicationPrincipalManagementServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -10072,11 +10072,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPPerformancePointServiceApplication { + +function New-SPPerformancePointServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -10182,11 +10182,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPPerformancePointServiceApplicationProxy { +function New-SPPerformancePointServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -10205,11 +10205,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPPerformancePointServiceApplicationTrustedLocation { + +function New-SPPerformancePointServiceApplicationTrustedLocation { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -10236,11 +10236,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPPowerPointConversionServiceApplication { +function New-SPPowerPointConversionServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -10257,11 +10257,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPPowerPointConversionServiceApplicationProxy { + +function New-SPPowerPointConversionServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -10280,11 +10280,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPProfileServiceApplication { +function New-SPProfileServiceApplication { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [string] @@ -10355,11 +10355,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPProfileServiceApplicationProxy { + +function New-SPProfileServiceApplicationProxy { [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [string] @@ -10385,11 +10385,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPProjectServiceApplication { +function New-SPProjectServiceApplication { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -10408,11 +10408,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPProjectServiceApplicationProxy { + +function New-SPProjectServiceApplicationProxy { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -10428,11 +10428,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPRequestManagementRuleCriteria { +function New-SPRequestManagementRuleCriteria { [CmdletBinding()] param( [Parameter(ParameterSetName='StandardParameterSet', Mandatory=$true, Position=0)] @@ -10464,11 +10464,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPSecureStoreApplication { + +function New-SPSecureStoreApplication { [CmdletBinding()] param( [object] @@ -10498,11 +10498,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPSecureStoreApplicationField { +function New-SPSecureStoreApplicationField { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -10521,11 +10521,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPSecureStoreServiceApplication { + +function New-SPSecureStoreServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -10580,11 +10580,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPSecureStoreServiceApplicationProxy { +function New-SPSecureStoreServiceApplicationProxy { [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [switch] @@ -10606,11 +10606,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPSecureStoreTargetApplication { + +function New-SPSecureStoreTargetApplication { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -10639,11 +10639,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPServiceApplicationPool { +function New-SPServiceApplicationPool { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -10660,11 +10660,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPServiceApplicationProxyGroup { + +function New-SPServiceApplicationProxyGroup { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -10678,11 +10678,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPSite { +function New-SPSite { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -10742,11 +10742,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPSiteMaster { + +function New-SPSiteMaster { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -10767,33 +10767,33 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPSiteSubscription { +function New-SPSiteSubscription { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function New-SPSiteSubscriptionFeaturePack { + +function New-SPSiteSubscriptionFeaturePack { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function New-SPStateServiceApplication { +function New-SPStateServiceApplication { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -10808,11 +10808,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPStateServiceApplicationProxy { + +function New-SPStateServiceApplicationProxy { [CmdletBinding()] param( [string] @@ -10829,11 +10829,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPStateServiceDatabase { +function New-SPStateServiceDatabase { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -10858,11 +10858,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPSubscriptionSettingsServiceApplication { + +function New-SPSubscriptionSettingsServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -10896,11 +10896,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPSubscriptionSettingsServiceApplicationProxy { +function New-SPSubscriptionSettingsServiceApplicationProxy { [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Uri', Mandatory=$true)] @@ -10916,11 +10916,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPTranslationServiceApplication { + +function New-SPTranslationServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -10956,11 +10956,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPTranslationServiceApplicationProxy { +function New-SPTranslationServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [switch] @@ -10985,11 +10985,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPTrustedIdentityTokenIssuer { + +function New-SPTrustedIdentityTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] @@ -11080,11 +11080,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPTrustedRootAuthority { +function New-SPTrustedRootAuthority { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0)] @@ -11106,11 +11106,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPTrustedSecurityTokenIssuer { + + function New-SPTrustedSecurityTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0)] @@ -11118,37 +11118,31 @@ param( [string] ${Name}, - [ValidateNotNullOrEmpty()] [string] ${Description}, - [ValidateNotNullOrEmpty()] + [Parameter(ParameterSetName='ManualConfigParameterSet', Mandatory=$true)] [string] ${RegisteredIssuerName}, - [ValidateNotNullOrEmpty()] [switch] ${IsTrustBroker}, - [Parameter(ParameterSetName='ImportCertificateParameterSet', Mandatory=$true)] - [ValidateNotNull()] - [System.Security.Cryptography.X509Certificates.X509Certificate2] + [Parameter(ParameterSetName='ManualConfigParameterSet', Mandatory=$true)] + [Object] ${Certificate}, [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] - [ValidateNotNull()] [uri] ${MetadataEndPoint}, [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) + } - - } - -function New-SPTrustedServiceTokenIssuer { +function New-SPTrustedServiceTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0)] @@ -11174,11 +11168,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPUsageApplication { +function New-SPUsageApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0)] @@ -11219,22 +11213,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPUsageLogFile { + +function New-SPUsageLogFile { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function New-SPUser { +function New-SPUser { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -11266,11 +11260,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPUserLicenseMapping { + +function New-SPUserLicenseMapping { [CmdletBinding(DefaultParameterSetName='WindowsAuth', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='WindowsAuth', Mandatory=$true, ValueFromPipeline=$true)] @@ -11326,11 +11320,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPUserSettingsProvider { +function New-SPUserSettingsProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -11349,11 +11343,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPUserSolutionAllowList { + +function New-SPUserSolutionAllowList { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -11370,11 +11364,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPVisioSafeDataProvider { +function New-SPVisioSafeDataProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -11399,11 +11393,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPVisioServiceApplication { + +function New-SPVisioServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -11423,11 +11417,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPVisioServiceApplicationProxy { +function New-SPVisioServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] @@ -11443,11 +11437,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPWeb { + +function New-SPWeb { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11482,11 +11476,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPWebApplication { +function New-SPWebApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -11554,11 +11548,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPWebApplicationAppDomain { + +function New-SPWebApplicationAppDomain { [CmdletBinding(DefaultParameterSetName='WebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11582,11 +11576,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPWebApplicationExtension { +function New-SPWebApplicationExtension { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11639,11 +11633,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPWOPIBinding { + +function New-SPWOPIBinding { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [ValidateNotNullOrEmpty()] @@ -11678,11 +11672,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPWOPISuppressionSetting { +function New-SPWOPISuppressionSetting { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [ValidateNotNullOrEmpty()] @@ -11701,11 +11695,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPWordConversionServiceApplication { + +function New-SPWordConversionServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -11735,11 +11729,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPWorkflowServiceApplicationProxy { +function New-SPWorkflowServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [switch] @@ -11749,11 +11743,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function New-SPWorkManagementServiceApplication { + +function New-SPWorkManagementServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -11771,11 +11765,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function New-SPWorkManagementServiceApplicationProxy { +function New-SPWorkManagementServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [switch] @@ -11795,11 +11789,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Pause-SPProjectWebInstance { + +function Pause-SPProjectWebInstance { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11810,11 +11804,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Publish-SPServiceApplication { +function Publish-SPServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -11835,11 +11829,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Receive-SPServiceApplicationConnectionInfo { + +function Receive-SPServiceApplicationConnectionInfo { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -11855,11 +11849,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Register-SPAppPrincipal { +function Register-SPAppPrincipal { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -11881,11 +11875,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Register-SPWorkflowService { + +function Register-SPWorkflowService { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -11913,11 +11907,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-DatabaseFromAvailabilityGroup { +function Remove-DatabaseFromAvailabilityGroup { [CmdletBinding(DefaultParameterSetName='Default')] param( [Parameter(Mandatory=$true, Position=0)] @@ -11942,11 +11936,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPAccessServicesDatabaseServer { + +function Remove-SPAccessServicesDatabaseServer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -11970,11 +11964,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPActivityFeedItems { +function Remove-SPActivityFeedItems { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -11999,11 +11993,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPAlternateURL { + +function Remove-SPAlternateURL { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12014,11 +12008,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPAppDeniedEndpoint { +function Remove-SPAppDeniedEndpoint { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -12030,11 +12024,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPAppPrincipalPermission { + +function Remove-SPAppPrincipalPermission { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -12059,11 +12053,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPBusinessDataCatalogModel { +function Remove-SPBusinessDataCatalogModel { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -12075,22 +12069,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPCentralAdministration { + +function Remove-SPCentralAdministration { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Remove-SPClaimProvider { +function Remove-SPClaimProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12102,11 +12096,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPClaimTypeMapping { + +function Remove-SPClaimTypeMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12123,22 +12117,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPConfigurationDatabase { +function Remove-SPConfigurationDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Remove-SPContentDatabase { + +function Remove-SPContentDatabase { [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12153,11 +12147,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPContentDeploymentJob { +function Remove-SPContentDeploymentJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12168,11 +12162,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPContentDeploymentPath { + +function Remove-SPContentDeploymentPath { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12183,11 +12177,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPDeletedSite { +function Remove-SPDeletedSite { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12207,11 +12201,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPDiagnosticsPerformanceCounter { + +function Remove-SPDiagnosticsPerformanceCounter { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)] @@ -12238,22 +12232,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPDistributedCacheServiceInstance { +function Remove-SPDistributedCacheServiceInstance { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchComponent { + +function Remove-SPEnterpriseSearchComponent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12271,11 +12265,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchContentEnrichmentConfiguration { +function Remove-SPEnterpriseSearchContentEnrichmentConfiguration { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -12286,11 +12280,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchCrawlContentSource { + +function Remove-SPEnterpriseSearchCrawlContentSource { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12304,11 +12298,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchCrawlCustomConnector { +function Remove-SPEnterpriseSearchCrawlCustomConnector { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -12324,11 +12318,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchCrawlDatabase { + +function Remove-SPEnterpriseSearchCrawlDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12342,11 +12336,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchCrawlExtension { +function Remove-SPEnterpriseSearchCrawlExtension { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12360,11 +12354,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchCrawlLogReadPermission { + +function Remove-SPEnterpriseSearchCrawlLogReadPermission { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ValueFromPipeline=$true)] @@ -12386,11 +12380,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchCrawlMapping { +function Remove-SPEnterpriseSearchCrawlMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12404,11 +12398,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchCrawlRule { + +function Remove-SPEnterpriseSearchCrawlRule { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12422,11 +12416,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchFileFormat { +function Remove-SPEnterpriseSearchFileFormat { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -12441,11 +12435,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchLanguageResourcePhrase { + +function Remove-SPEnterpriseSearchLanguageResourcePhrase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12476,11 +12470,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchLinksDatabase { +function Remove-SPEnterpriseSearchLinksDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12494,11 +12488,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchMetadataCategory { + +function Remove-SPEnterpriseSearchMetadataCategory { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12512,11 +12506,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchMetadataManagedProperty { +function Remove-SPEnterpriseSearchMetadataManagedProperty { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12536,11 +12530,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchMetadataMapping { + +function Remove-SPEnterpriseSearchMetadataMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12554,11 +12548,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchQueryAuthority { +function Remove-SPEnterpriseSearchQueryAuthority { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12577,11 +12571,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchQueryDemoted { + +function Remove-SPEnterpriseSearchQueryDemoted { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12600,11 +12594,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchQueryKeyword { +function Remove-SPEnterpriseSearchQueryKeyword { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12619,11 +12613,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchQueryScope { + +function Remove-SPEnterpriseSearchQueryScope { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12641,11 +12635,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchQueryScopeRule { +function Remove-SPEnterpriseSearchQueryScopeRule { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12668,11 +12662,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchRankingModel { + +function Remove-SPEnterpriseSearchRankingModel { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12691,11 +12685,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchResultItemType { +function Remove-SPEnterpriseSearchResultItemType { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12718,11 +12712,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchResultSource { + +function Remove-SPEnterpriseSearchResultSource { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12742,11 +12736,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchSecurityTrimmer { +function Remove-SPEnterpriseSearchSecurityTrimmer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -12761,11 +12755,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchServiceApplication { + +function Remove-SPEnterpriseSearchServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12779,11 +12773,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchServiceApplicationProxy { +function Remove-SPEnterpriseSearchServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12794,11 +12788,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchServiceApplicationSiteSettings { + +function Remove-SPEnterpriseSearchServiceApplicationSiteSettings { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12816,11 +12810,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchSiteHitRule { +function Remove-SPEnterpriseSearchSiteHitRule { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12834,11 +12828,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchTenantConfiguration { + +function Remove-SPEnterpriseSearchTenantConfiguration { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12854,11 +12848,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPEnterpriseSearchTenantSchema { +function Remove-SPEnterpriseSearchTenantSchema { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12875,11 +12869,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPEnterpriseSearchTopology { + +function Remove-SPEnterpriseSearchTopology { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12893,11 +12887,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPInfoPathUserAgent { +function Remove-SPInfoPathUserAgent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12909,11 +12903,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPManagedAccount { + +function Remove-SPManagedAccount { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12932,11 +12926,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPManagedPath { +function Remove-SPManagedPath { [CmdletBinding(DefaultParameterSetName='WebApplication', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -12955,11 +12949,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPODataConnectionSetting { + +function Remove-SPODataConnectionSetting { [CmdletBinding(DefaultParameterSetName='Name', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -12981,11 +12975,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPPerformancePointServiceApplication { +function Remove-SPPerformancePointServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -12996,11 +12990,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPPerformancePointServiceApplicationProxy { + +function Remove-SPPerformancePointServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -13011,11 +13005,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPPerformancePointServiceApplicationTrustedLocation { +function Remove-SPPerformancePointServiceApplicationTrustedLocation { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -13026,11 +13020,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPPluggableSecurityTrimmer { + +function Remove-SPPluggableSecurityTrimmer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -13046,11 +13040,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPProfileLeader { +function Remove-SPProfileLeader { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13072,11 +13066,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPProfileSyncConnection { + +function Remove-SPProfileSyncConnection { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13114,11 +13108,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPProjectWebInstanceData { +function Remove-SPProjectWebInstanceData { [CmdletBinding(DefaultParameterSetName='web', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='web', Mandatory=$true, ValueFromPipeline=$true)] @@ -13129,11 +13123,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPRoutingMachineInfo { + +function Remove-SPRoutingMachineInfo { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13145,11 +13139,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPRoutingMachinePool { +function Remove-SPRoutingMachinePool { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13161,11 +13155,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPRoutingRule { + +function Remove-SPRoutingRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13177,11 +13171,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPScaleOutDatabase { +function Remove-SPScaleOutDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -13199,11 +13193,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPSecureStoreApplication { + +function Remove-SPSecureStoreApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -13215,11 +13209,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPSecureStoreSystemAccount { +function Remove-SPSecureStoreSystemAccount { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13230,11 +13224,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPServerScaleOutDatabase { + +function Remove-SPServerScaleOutDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -13252,11 +13246,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPServiceApplication { +function Remove-SPServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13272,11 +13266,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPServiceApplicationPool { + +function Remove-SPServiceApplicationPool { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13288,11 +13282,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPServiceApplicationProxy { +function Remove-SPServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13308,11 +13302,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPServiceApplicationProxyGroup { + +function Remove-SPServiceApplicationProxyGroup { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13324,11 +13318,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPServiceApplicationProxyGroupMember { +function Remove-SPServiceApplicationProxyGroupMember { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13346,11 +13340,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPShellAdmin { + +function Remove-SPShellAdmin { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0)] @@ -13365,11 +13359,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPSite { +function Remove-SPSite { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13387,11 +13381,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPSiteMaster { + +function Remove-SPSiteMaster { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -13406,11 +13400,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPSiteSubscription { +function Remove-SPSiteSubscription { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13424,11 +13418,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPSiteSubscriptionBusinessDataCatalogConfig { + +function Remove-SPSiteSubscriptionBusinessDataCatalogConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -13440,11 +13434,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPSiteSubscriptionFeaturePack { +function Remove-SPSiteSubscriptionFeaturePack { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13456,11 +13450,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPSiteSubscriptionFeaturePackMember { + +function Remove-SPSiteSubscriptionFeaturePackMember { [CmdletBinding(DefaultParameterSetName='SingleFeatureDefinition', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13481,11 +13475,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPSiteSubscriptionMetadataConfig { +function Remove-SPSiteSubscriptionMetadataConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13500,11 +13494,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPSiteSubscriptionProfileConfig { + +function Remove-SPSiteSubscriptionProfileConfig { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='Default', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13526,11 +13520,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPSiteSubscriptionSettings { +function Remove-SPSiteSubscriptionSettings { [CmdletBinding(DefaultParameterSetName='SpecifySiteSubscriptions', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13561,11 +13555,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPSiteUpgradeSessionInfo { + +function Remove-SPSiteUpgradeSessionInfo { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13576,11 +13570,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPSiteURL { +function Remove-SPSiteURL { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13591,11 +13585,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPSocialItemByDate { + +function Remove-SPSocialItemByDate { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -13626,11 +13620,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPSolution { +function Remove-SPSolution { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13647,11 +13641,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPSolutionDeploymentLock { + +function Remove-SPSolutionDeploymentLock { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Position=0)] @@ -13662,11 +13656,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPStateServiceDatabase { +function Remove-SPStateServiceDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13678,11 +13672,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPThrottlingRule { + +function Remove-SPThrottlingRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13694,11 +13688,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPTranslationServiceJobHistory { +function Remove-SPTranslationServiceJobHistory { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -13724,11 +13718,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPTrustedIdentityTokenIssuer { + +function Remove-SPTrustedIdentityTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13740,11 +13734,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPTrustedRootAuthority { +function Remove-SPTrustedRootAuthority { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13756,11 +13750,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPTrustedSecurityTokenIssuer { + +function Remove-SPTrustedSecurityTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13772,11 +13766,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPTrustedServiceTokenIssuer { +function Remove-SPTrustedServiceTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13788,11 +13782,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPUsageApplication { + +function Remove-SPUsageApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13810,11 +13804,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPUser { +function Remove-SPUser { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13835,11 +13829,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPUserLicenseMapping { + +function Remove-SPUserLicenseMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -13851,11 +13845,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPUserSettingsProvider { +function Remove-SPUserSettingsProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13867,11 +13861,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPUserSolution { + +function Remove-SPUserSolution { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13886,11 +13880,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPVisioSafeDataProvider { +function Remove-SPVisioSafeDataProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -13912,11 +13906,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPWeb { + +function Remove-SPWeb { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13930,11 +13924,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPWebApplication { +function Remove-SPWebApplication { [CmdletBinding(DefaultParameterSetName='RemoveWebApp', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13956,11 +13950,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPWebApplicationAppDomain { + +function Remove-SPWebApplicationAppDomain { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -13971,11 +13965,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPWOPIBinding { +function Remove-SPWOPIBinding { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='Identity', Position=0, ValueFromPipeline=$true)] @@ -14020,11 +14014,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Remove-SPWOPISuppressionSetting { + +function Remove-SPWOPISuppressionSetting { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='DocTypeAndAction')] @@ -14051,11 +14045,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Remove-SPWordConversionServiceJobHistory { +function Remove-SPWordConversionServiceJobHistory { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -14078,11 +14072,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Rename-SPServer { + +function Rename-SPServer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14100,22 +14094,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Repair-SPManagedAccountDeployment { +function Repair-SPManagedAccountDeployment { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Repair-SPProjectWebInstance { + +function Repair-SPProjectWebInstance { [CmdletBinding()] param( [Parameter(ParameterSetName='FindProjectSiteByWebInstance', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14130,11 +14124,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Repair-SPSite { +function Repair-SPSite { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14151,11 +14145,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Request-SPUpgradeEvaluationSite { + +function Request-SPUpgradeEvaluationSite { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14172,11 +14166,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Reset-SPAccessServicesDatabasePassword { +function Reset-SPAccessServicesDatabasePassword { [CmdletBinding(DefaultParameterSetName='ResetAllApps', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='ResetSingleApp', Mandatory=$true, ValueFromPipeline=$true)] @@ -14192,22 +14186,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Reset-SPProjectEventServiceSettings { + +function Reset-SPProjectEventServiceSettings { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Reset-SPProjectPCSSettings { +function Reset-SPProjectPCSSettings { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] @@ -14219,11 +14213,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Reset-SPProjectQueueSettings { + +function Reset-SPProjectQueueSettings { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] @@ -14235,11 +14229,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Reset-SPSites { +function Reset-SPSites { [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14251,11 +14245,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Restart-SPAppInstanceJob { + +function Restart-SPAppInstanceJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [Parameter(Mandatory=$true)] @@ -14267,11 +14261,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Restore-SPDeletedSite { +function Restore-SPDeletedSite { [CmdletBinding(DefaultParameterSetName='DatabaseFromPipebind', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14291,11 +14285,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Restore-SPEnterpriseSearchServiceApplication { + +function Restore-SPEnterpriseSearchServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -14346,11 +14340,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Restore-SPEnterpriseSearchServiceApplicationIndex { +function Restore-SPEnterpriseSearchServiceApplicationIndex { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -14385,11 +14379,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Restore-SPFarm { + +function Restore-SPFarm { [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -14439,11 +14433,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Restore-SPSite { +function Restore-SPSite { [CmdletBinding(DefaultParameterSetName='DatabaseFromPipebind', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14482,11 +14476,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Resume-SPEnterpriseSearchServiceApplication { + +function Resume-SPEnterpriseSearchServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14497,11 +14491,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Resume-SPProjectWebInstance { +function Resume-SPProjectWebInstance { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14512,11 +14506,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Resume-SPStateServiceDatabase { + +function Resume-SPStateServiceDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14528,11 +14522,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Revoke-SPBusinessDataCatalogMetadataObject { +function Revoke-SPBusinessDataCatalogMetadataObject { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -14556,11 +14550,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Revoke-SPObjectSecurity { + +function Revoke-SPObjectSecurity { [CmdletBinding(DefaultParameterSetName='RevokeOne')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14586,11 +14580,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAccessServiceApplication { +function Set-SPAccessServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14663,11 +14657,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPAccessServicesApplication { + +function Set-SPAccessServicesApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14702,11 +14696,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAccessServicesDatabaseServer { +function Set-SPAccessServicesDatabaseServer { [CmdletBinding(DefaultParameterSetName='SetCredentialsParameterSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='SetServerStateParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14794,11 +14788,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPAccessServicesDatabaseServerGroupMapping { + +function Set-SPAccessServicesDatabaseServerGroupMapping { [CmdletBinding(DefaultParameterSetName='SetDatabaseServerGroupMappingParameter', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='SetDatabaseServerGroupMappingParameter', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14844,11 +14838,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAlternateURL { +function Set-SPAlternateURL { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -14865,11 +14859,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPAppAcquisitionConfiguration { + +function Set-SPAppAcquisitionConfiguration { [CmdletBinding(DefaultParameterSetName='MarketplaceSettingsInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -14888,11 +14882,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAppAutoProvisionConnection { +function Set-SPAppAutoProvisionConnection { [CmdletBinding()] param( [object] @@ -14927,11 +14921,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPAppDisablingConfiguration { + +function Set-SPAppDisablingConfiguration { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -14942,11 +14936,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAppDomain { +function Set-SPAppDomain { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0)] @@ -14959,11 +14953,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPAppHostingQuotaConfiguration { + +function Set-SPAppHostingQuotaConfiguration { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -14985,11 +14979,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAppManagementDeploymentId { +function Set-SPAppManagementDeploymentId { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -15011,11 +15005,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPAppPrincipalPermission { + +function Set-SPAppPrincipalPermission { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -15045,11 +15039,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAppScaleProfile { +function Set-SPAppScaleProfile { [CmdletBinding()] param( [ValidateNotNullOrEmpty()] @@ -15064,11 +15058,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPAppSiteDomain { + +function Set-SPAppSiteDomain { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -15080,11 +15074,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAppSiteSubscriptionName { +function Set-SPAppSiteSubscriptionName { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -15102,11 +15096,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPAppStateUpdateInterval { + +function Set-SPAppStateUpdateInterval { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -15123,11 +15117,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAppStoreConfiguration { +function Set-SPAppStoreConfiguration { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [string] @@ -15141,11 +15135,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPAppStoreWebServiceConfiguration { + +function Set-SPAppStoreWebServiceConfiguration { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -15159,11 +15153,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPAuthenticationRealm { +function Set-SPAuthenticationRealm { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [ValidateNotNull()] @@ -15177,11 +15171,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPBingMapsBlock { + +function Set-SPBingMapsBlock { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0, HelpMessage='Block Bing Maps in all locales.')] @@ -15192,11 +15186,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPBingMapsKey { +function Set-SPBingMapsKey { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, HelpMessage='Enter the Bing Maps API key.')] @@ -15207,11 +15201,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPBrowserCustomerExperienceImprovementProgram { + +function Set-SPBrowserCustomerExperienceImprovementProgram { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [Parameter(ParameterSetName='Farm', Mandatory=$true)] @@ -15233,11 +15227,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPBusinessDataCatalogEntityNotificationWeb { +function Set-SPBusinessDataCatalogEntityNotificationWeb { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [Parameter(Mandatory=$true)] @@ -15249,11 +15243,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPBusinessDataCatalogMetadataObject { + +function Set-SPBusinessDataCatalogMetadataObject { [CmdletBinding(DefaultParameterSetName='NameValue', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='Display')] @@ -15286,11 +15280,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPBusinessDataCatalogServiceApplication { +function Set-SPBusinessDataCatalogServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -15338,11 +15332,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPBusinessDataCatalogThrottleConfig { + +function Set-SPBusinessDataCatalogThrottleConfig { [CmdletBinding(DefaultParameterSetName='MaxDefault', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -15366,11 +15360,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPCentralAdministration { +function Set-SPCentralAdministration { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -15384,11 +15378,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPClaimProvider { + +function Set-SPClaimProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15406,11 +15400,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPContentDatabase { +function Set-SPContentDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15440,11 +15434,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPContentDeploymentJob { + +function Set-SPContentDeploymentJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15487,11 +15481,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPContentDeploymentPath { +function Set-SPContentDeploymentPath { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15537,11 +15531,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPCustomLayoutsPage { + +function Set-SPCustomLayoutsPage { [CmdletBinding(DefaultParameterSetName='CustomPage', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -15570,11 +15564,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPDataConnectionFile { +function Set-SPDataConnectionFile { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15601,11 +15595,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPDefaultProfileConfig { + +function Set-SPDefaultProfileConfig { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -15621,11 +15615,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPDesignerSettings { +function Set-SPDesignerSettings { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='WebApplication', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -15663,11 +15657,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPDiagnosticConfig { + +function Set-SPDiagnosticConfig { [CmdletBinding()] param( [Parameter(ValueFromPipelineByPropertyName=$true)] @@ -15763,11 +15757,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPDiagnosticsProvider { +function Set-SPDiagnosticsProvider { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15789,11 +15783,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPDistributedCacheClientSetting { + +function Set-SPDistributedCacheClientSetting { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15810,11 +15804,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchAdministrationComponent { +function Set-SPEnterpriseSearchAdministrationComponent { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -15837,11 +15831,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchContentEnrichmentConfiguration { + +function Set-SPEnterpriseSearchContentEnrichmentConfiguration { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -15856,11 +15850,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchCrawlContentSource { +function Set-SPEnterpriseSearchCrawlContentSource { [CmdletBinding(DefaultParameterSetName='NoSchedule', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -15974,11 +15968,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchCrawlDatabase { + +function Set-SPEnterpriseSearchCrawlDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16007,11 +16001,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchCrawlLogReadPermission { +function Set-SPEnterpriseSearchCrawlLogReadPermission { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] @@ -16032,11 +16026,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchCrawlRule { + +function Set-SPEnterpriseSearchCrawlRule { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16084,11 +16078,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchFileFormatState { +function Set-SPEnterpriseSearchFileFormatState { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -16111,11 +16105,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchLinguisticComponentsStatus { + +function Set-SPEnterpriseSearchLinguisticComponentsStatus { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -16145,11 +16139,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchLinksDatabase { +function Set-SPEnterpriseSearchLinksDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16178,11 +16172,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchMetadataCategory { + +function Set-SPEnterpriseSearchMetadataCategory { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16213,11 +16207,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchMetadataCrawledProperty { +function Set-SPEnterpriseSearchMetadataCrawledProperty { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16233,11 +16227,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchMetadataManagedProperty { + +function Set-SPEnterpriseSearchMetadataManagedProperty { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16318,11 +16312,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchMetadataMapping { +function Set-SPEnterpriseSearchMetadataMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16348,11 +16342,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchPrimaryHostController { + +function Set-SPEnterpriseSearchPrimaryHostController { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16366,11 +16360,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchQueryAuthority { +function Set-SPEnterpriseSearchQueryAuthority { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16393,11 +16387,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchQueryKeyword { + +function Set-SPEnterpriseSearchQueryKeyword { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16436,11 +16430,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchQueryScope { +function Set-SPEnterpriseSearchQueryScope { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16478,11 +16472,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchQueryScopeRule { + +function Set-SPEnterpriseSearchQueryScopeRule { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16525,11 +16519,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchQuerySpellingCorrection { +function Set-SPEnterpriseSearchQuerySpellingCorrection { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -16565,11 +16559,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchRankingModel { + +function Set-SPEnterpriseSearchRankingModel { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16592,11 +16586,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchResultItemType { +function Set-SPEnterpriseSearchResultItemType { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16647,11 +16641,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchResultSource { + +function Set-SPEnterpriseSearchResultSource { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16703,11 +16697,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchService { +function Set-SPEnterpriseSearchService { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -16745,11 +16739,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchServiceApplication { + +function Set-SPEnterpriseSearchServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16796,11 +16790,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchServiceApplicationProxy { +function Set-SPEnterpriseSearchServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16814,11 +16808,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPEnterpriseSearchServiceInstance { + +function Set-SPEnterpriseSearchServiceInstance { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16832,11 +16826,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPEnterpriseSearchTopology { +function Set-SPEnterpriseSearchTopology { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -16850,11 +16844,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPFarmConfig { + +function Set-SPFarmConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipelineByPropertyName=$true)] @@ -16912,11 +16906,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPInfoPathFormsService { +function Set-SPInfoPathFormsService { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [object] @@ -16998,11 +16992,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPInfoPathFormTemplate { + +function Set-SPInfoPathFormTemplate { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -17017,11 +17011,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPInfoPathWebServiceProxy { +function Set-SPInfoPathWebServiceProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -17040,11 +17034,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPInternalAppStateUpdateInterval { + +function Set-SPInternalAppStateUpdateInterval { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -17056,11 +17050,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPIRMSettings { +function Set-SPIRMSettings { [CmdletBinding(DefaultParameterSetName='UseServiceDiscovery', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -17093,11 +17087,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPLogLevel { + +function Set-SPLogLevel { [CmdletBinding()] param( [string] @@ -17117,11 +17111,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPManagedAccount { +function Set-SPManagedAccount { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -17169,11 +17163,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPMetadataServiceApplication { + +function Set-SPMetadataServiceApplication { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [string] @@ -17261,11 +17255,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPMetadataServiceApplicationProxy { +function Set-SPMetadataServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [switch] @@ -17294,11 +17288,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPMicrofeedOptions { + +function Set-SPMicrofeedOptions { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -17335,11 +17329,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPMobileMessagingAccount { +function Set-SPMobileMessagingAccount { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -17367,11 +17361,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPO365LinkSettings { + +function Set-SPO365LinkSettings { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] @@ -17395,11 +17389,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPODataConnectionSetting { +function Set-SPODataConnectionSetting { [CmdletBinding(DefaultParameterSetName='Name', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -17438,11 +17432,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPODataConnectionSettingMetadata { + +function Set-SPODataConnectionSettingMetadata { [CmdletBinding(DefaultParameterSetName='Name', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -17478,11 +17472,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPOfficeStoreAppsDefaultActivation { +function Set-SPOfficeStoreAppsDefaultActivation { [CmdletBinding(DefaultParameterSetName='AppsForOfficeSettingsInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -17501,11 +17495,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPPassPhrase { + +function Set-SPPassPhrase { [CmdletBinding(DefaultParameterSetName='AcrossFarm', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -17524,11 +17518,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPPerformancePointSecureDataValues { +function Set-SPPerformancePointSecureDataValues { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -17543,11 +17537,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPPerformancePointServiceApplication { + +function Set-SPPerformancePointServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -17658,11 +17652,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPPowerPointConversionServiceApplication { +function Set-SPPowerPointConversionServiceApplication { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -17689,11 +17683,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPProfileServiceApplication { + +function Set-SPProfileServiceApplication { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -17752,11 +17746,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPProfileServiceApplicationProxy { +function Set-SPProfileServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -17786,11 +17780,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPProfileServiceApplicationSecurity { + +function Set-SPProfileServiceApplicationSecurity { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -17815,11 +17809,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPProjectDatabaseQuota { +function Set-SPProjectDatabaseQuota { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -17855,11 +17849,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPProjectEventServiceSettings { + +function Set-SPProjectEventServiceSettings { [CmdletBinding()] param( [System.Nullable[int]] @@ -17869,11 +17863,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPProjectOdataConfiguration { +function Set-SPProjectOdataConfiguration { [CmdletBinding()] param( [bool] @@ -17907,11 +17901,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPProjectPCSSettings { + +function Set-SPProjectPCSSettings { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] @@ -17950,11 +17944,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPProjectPermissionMode { +function Set-SPProjectPermissionMode { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0)] @@ -17972,11 +17966,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPProjectQueueSettings { + +function Set-SPProjectQueueSettings { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] @@ -18024,11 +18018,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPProjectServiceApplication { +function Set-SPProjectServiceApplication { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -18042,11 +18036,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPProjectUserSync { + +function Set-SPProjectUserSync { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=1)] @@ -18063,11 +18057,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPProjectUserSyncDisabledSyncThreshold { +function Set-SPProjectUserSyncDisabledSyncThreshold { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=1)] @@ -18084,11 +18078,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPProjectUserSyncFullSyncThreshold { + +function Set-SPProjectUserSyncFullSyncThreshold { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=1)] @@ -18105,11 +18099,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPProjectUserSyncOffPeakSyncThreshold { +function Set-SPProjectUserSyncOffPeakSyncThreshold { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=1)] @@ -18126,11 +18120,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPRequestManagementSettings { + +function Set-SPRequestManagementSettings { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18154,11 +18148,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPRoutingMachineInfo { +function Set-SPRoutingMachineInfo { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18191,11 +18185,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPRoutingMachinePool { + +function Set-SPRoutingMachinePool { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18211,11 +18205,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPRoutingRule { +function Set-SPRoutingRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18242,11 +18236,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPScaleOutDatabaseDataRange { + +function Set-SPScaleOutDatabaseDataRange { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -18268,11 +18262,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPScaleOutDatabaseDataSubRange { +function Set-SPScaleOutDatabaseDataSubRange { [CmdletBinding(DefaultParameterSetName='AttachedDatabase', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='AttachedDatabase', Mandatory=$true, ValueFromPipeline=$true)] @@ -18312,11 +18306,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPSecureStoreApplication { + +function Set-SPSecureStoreApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [object] @@ -18343,11 +18337,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPSecureStoreDefaultProvider { +function Set-SPSecureStoreDefaultProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -18359,11 +18353,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPSecureStoreServiceApplication { + +function Set-SPSecureStoreServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [object] @@ -18411,11 +18405,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPSecurityTokenServiceConfig { +function Set-SPSecurityTokenServiceConfig { [CmdletBinding(DefaultParameterSetName='SigningCertificateImport', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='SigningCertificateImport')] @@ -18481,11 +18475,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPServer { + +function Set-SPServer { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18504,11 +18498,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPServerScaleOutDatabaseDataRange { +function Set-SPServerScaleOutDatabaseDataRange { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -18530,11 +18524,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPServerScaleOutDatabaseDataSubRange { + +function Set-SPServerScaleOutDatabaseDataSubRange { [CmdletBinding(DefaultParameterSetName='AttachedDatabase', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='AttachedDatabase', Mandatory=$true, ValueFromPipeline=$true)] @@ -18574,11 +18568,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPServiceApplication { +function Set-SPServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18602,11 +18596,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPServiceApplicationEndpoint { + +function Set-SPServiceApplicationEndpoint { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18627,11 +18621,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPServiceApplicationPool { +function Set-SPServiceApplicationPool { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18647,11 +18641,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPServiceApplicationSecurity { + +function Set-SPServiceApplicationSecurity { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18671,11 +18665,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPServiceHostConfig { +function Set-SPServiceHostConfig { [CmdletBinding(DefaultParameterSetName='SslCertificateImport', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='SslCertificateReference', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18726,11 +18720,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPSessionStateService { + +function Set-SPSessionStateService { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [System.Nullable[int]] @@ -18744,11 +18738,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPSite { +function Set-SPSite { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18811,11 +18805,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPSiteAdministration { + +function Set-SPSiteAdministration { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18862,11 +18856,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPSiteSubscriptionConfig { +function Set-SPSiteSubscriptionConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18889,11 +18883,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPSiteSubscriptionEdiscoveryHub { + +function Set-SPSiteSubscriptionEdiscoveryHub { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -18908,11 +18902,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPSiteSubscriptionIRMConfig { +function Set-SPSiteSubscriptionIRMConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18935,11 +18929,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPSiteSubscriptionMetadataConfig { + +function Set-SPSiteSubscriptionMetadataConfig { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -18964,11 +18958,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPSiteSubscriptionProfileConfig { +function Set-SPSiteSubscriptionProfileConfig { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19002,11 +18996,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPSiteURL { + +function Set-SPSiteURL { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19024,11 +19018,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPStateServiceApplication { +function Set-SPStateServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -19042,11 +19036,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPStateServiceApplicationProxy { + +function Set-SPStateServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -19060,11 +19054,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPStateServiceDatabase { +function Set-SPStateServiceDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19088,11 +19082,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPSubscriptionSettingsServiceApplication { + +function Set-SPSubscriptionSettingsServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19120,11 +19114,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPThrottlingRule { +function Set-SPThrottlingRule { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19149,11 +19143,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPTimerJob { + +function Set-SPTimerJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19168,11 +19162,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPTopologyServiceApplication { +function Set-SPTopologyServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19188,11 +19182,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPTopologyServiceApplicationProxy { + +function Set-SPTopologyServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19207,11 +19201,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPTranslationServiceApplication { +function Set-SPTranslationServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -19310,11 +19304,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPTranslationServiceApplicationProxy { + +function Set-SPTranslationServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -19334,11 +19328,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPTranslationThrottlingSetting { +function Set-SPTranslationThrottlingSetting { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [System.Nullable[int]] @@ -19351,11 +19345,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPTrustedIdentityTokenIssuer { + +function Set-SPTrustedIdentityTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='BasicParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19423,11 +19417,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPTrustedRootAuthority { +function Set-SPTrustedRootAuthority { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19449,11 +19443,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPTrustedSecurityTokenIssuer { + + function Set-SPTrustedSecurityTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19461,36 +19455,33 @@ param( [object] ${Identity}, - [ValidateNotNullOrEmpty()] [string] ${Description}, + [Parameter(ParameterSetName='ManualConfigParameterSet', Mandatory=$true)] [string] ${RegisteredIssuerName}, - [Parameter(ParameterSetName='MetadataEndPointParameterSet')] - [ValidateNotNull()] - [uri] - ${MetadataEndPoint}, + [switch] + ${IsTrustBroker}, - [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [Parameter(ParameterSetName='ManualConfigParameterSet', Mandatory=$true)] [ValidateNotNull()] - [System.Security.Cryptography.X509Certificates.X509Certificate2] + [Object] ${Certificate}, - [ValidateNotNullOrEmpty()] - [switch] - ${IsTrustBroker}, + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - - } + } -function Set-SPTrustedServiceTokenIssuer { +function Set-SPTrustedServiceTokenIssuer { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19516,11 +19507,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPUsageApplication { + +function Set-SPUsageApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19560,11 +19551,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPUsageDefinition { +function Set-SPUsageDefinition { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19593,11 +19584,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPUsageService { + +function Set-SPUsageService { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0, ValueFromPipeline=$true)] @@ -19632,11 +19623,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPUser { +function Set-SPUser { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19680,11 +19671,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPVisioExternalData { + +function Set-SPVisioExternalData { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -19701,11 +19692,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPVisioPerformance { +function Set-SPVisioPerformance { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -19741,11 +19732,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPVisioSafeDataProvider { + +function Set-SPVisioSafeDataProvider { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -19771,11 +19762,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPVisioServiceApplication { +function Set-SPVisioServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19792,11 +19783,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPWeb { + +function Set-SPWeb { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19820,11 +19811,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPWebApplication { +function Set-SPWebApplication { [CmdletBinding(DefaultParameterSetName='UpdateGeneralSettings', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19899,11 +19890,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPWebApplicationHttpThrottlingMonitor { + +function Set-SPWebApplicationHttpThrottlingMonitor { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -19947,11 +19938,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPWOPIBinding { +function Set-SPWOPIBinding { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -19966,11 +19957,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPWOPIZone { + +function Set-SPWOPIZone { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Position=0)] @@ -19982,11 +19973,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPWordConversionServiceApplication { +function Set-SPWordConversionServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -20058,11 +20049,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPWorkflowConfig { + +function Set-SPWorkflowConfig { [CmdletBinding()] param( [Parameter(ParameterSetName='WebApplication', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -20089,11 +20080,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Set-SPWorkManagementServiceApplication { +function Set-SPWorkManagementServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ValueFromPipeline=$true)] @@ -20135,11 +20126,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Set-SPWorkManagementServiceApplicationProxy { + +function Set-SPWorkManagementServiceApplicationProxy { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [switch] @@ -20156,11 +20147,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Split-SPScaleOutDatabase { +function Split-SPScaleOutDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='NewDatabase', Mandatory=$true)] @@ -20206,11 +20197,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Split-SPServerScaleOutDatabase { + +function Split-SPServerScaleOutDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='NewDatabase', Mandatory=$true)] @@ -20256,22 +20247,22 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Start-SPAdminJob { +function Start-SPAdminJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + } -function Start-SPAssignment { + +function Start-SPAssignment { [CmdletBinding()] param( [switch] @@ -20281,11 +20272,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Start-SPContentDeploymentJob { +function Start-SPContentDeploymentJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -20308,11 +20299,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Start-SPDiagnosticsSession { + +function Start-SPDiagnosticsSession { [CmdletBinding()] param( [guid] @@ -20329,11 +20320,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance { +function Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20344,11 +20335,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Start-SPEnterpriseSearchServiceInstance { + +function Start-SPEnterpriseSearchServiceInstance { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20359,11 +20350,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Start-SPInfoPathFormTemplate { +function Start-SPInfoPathFormTemplate { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20374,11 +20365,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Start-SPService { + +function Start-SPService { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20393,11 +20384,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Start-SPServiceInstance { +function Start-SPServiceInstance { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20409,11 +20400,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Start-SPTimerJob { + +function Start-SPTimerJob { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20424,11 +20415,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Stop-SPAssignment { +function Stop-SPAssignment { [CmdletBinding()] param( [switch] @@ -20442,22 +20433,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Stop-SPDiagnosticsSession { + +function Stop-SPDiagnosticsSession { [CmdletBinding()] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Stop-SPDistributedCacheServiceInstance { +function Stop-SPDistributedCacheServiceInstance { [CmdletBinding()] param( [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -20468,11 +20459,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Stop-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance { + +function Stop-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20483,11 +20474,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Stop-SPEnterpriseSearchServiceInstance { +function Stop-SPEnterpriseSearchServiceInstance { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20498,11 +20489,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Stop-SPInfoPathFormTemplate { + +function Stop-SPInfoPathFormTemplate { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20517,11 +20508,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Stop-SPService { +function Stop-SPService { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20536,11 +20527,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Stop-SPServiceInstance { + +function Stop-SPServiceInstance { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20552,11 +20543,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Stop-SPTaxonomyReplication { +function Stop-SPTaxonomyReplication { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -20567,11 +20558,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Suspend-SPEnterpriseSearchServiceApplication { + +function Suspend-SPEnterpriseSearchServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20582,11 +20573,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Suspend-SPStateServiceDatabase { +function Suspend-SPStateServiceDatabase { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20598,11 +20589,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Sync-SPProjectPermissions { + +function Sync-SPProjectPermissions { [CmdletBinding()] param( [Parameter(ParameterSetName='SPMode', Mandatory=$true, Position=0)] @@ -20633,11 +20624,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Test-SPContentDatabase { +function Test-SPContentDatabase { [CmdletBinding(DefaultParameterSetName='ContentDatabaseById')] param( [Parameter(ParameterSetName='ContentDatabaseByName', Mandatory=$true)] @@ -20675,10 +20666,10 @@ param( [object] ${AssignmentCollection}) - - } -function Test-SPInfoPathFormTemplate { + } + +function Test-SPInfoPathFormTemplate { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20689,11 +20680,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Test-SPO365LinkSettings { +function Test-SPO365LinkSettings { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] @@ -20704,11 +20695,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Test-SPProjectServiceApplication { + +function Test-SPProjectServiceApplication { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20723,11 +20714,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Test-SPProjectWebInstance { +function Test-SPProjectWebInstance { [CmdletBinding()] param( [Parameter(ParameterSetName='FindProjectSiteByWebInstance', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20742,11 +20733,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Test-SPSite { + +function Test-SPSite { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20763,11 +20754,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Uninstall-SPAppInstance { +function Uninstall-SPAppInstance { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -20779,11 +20770,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Uninstall-SPDataConnectionFile { + +function Uninstall-SPDataConnectionFile { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20794,11 +20785,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Uninstall-SPFeature { +function Uninstall-SPFeature { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20815,11 +20806,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Uninstall-SPHelpCollection { + +function Uninstall-SPHelpCollection { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true)] @@ -20831,11 +20822,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Uninstall-SPInfoPathFormTemplate { +function Uninstall-SPInfoPathFormTemplate { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20846,11 +20837,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Uninstall-SPSolution { + +function Uninstall-SPSolution { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20881,11 +20872,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Uninstall-SPUserSolution { +function Uninstall-SPUserSolution { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20900,11 +20891,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Uninstall-SPWebPartPack { + +function Uninstall-SPWebPartPack { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0)] @@ -20926,11 +20917,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Unpublish-SPServiceApplication { +function Unpublish-SPServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20942,11 +20933,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Update-SPAppCatalogConfiguration { + +function Update-SPAppCatalogConfiguration { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -20964,11 +20955,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Update-SPAppInstance { +function Update-SPAppInstance { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -20985,11 +20976,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Update-SPDistributedCacheSize { + +function Update-SPDistributedCacheSize { [CmdletBinding()] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] @@ -21000,11 +20991,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Update-SPFarmEncryptionKey { +function Update-SPFarmEncryptionKey { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [switch] @@ -21014,11 +21005,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Update-SPHelp { + +function Update-SPHelp { [CmdletBinding()] param( [switch] @@ -21028,11 +21019,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Update-SPInfoPathAdminFileUrl { +function Update-SPInfoPathAdminFileUrl { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true)] @@ -21050,22 +21041,22 @@ param( [object] ${AssignmentCollection}) - - } + } -function Update-SPInfoPathFormTemplate { + +function Update-SPInfoPathFormTemplate { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ValueFromPipeline=$true)] [object] ${AssignmentCollection}) - - } + + } -function Update-SPInfoPathUserFileUrl { +function Update-SPInfoPathUserFileUrl { [CmdletBinding(DefaultParameterSetName='WebApp', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='WebApp', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -21095,11 +21086,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Update-SPProfilePhotoStore { + +function Update-SPProfilePhotoStore { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -21123,11 +21114,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Update-SPRepopulateMicroblogFeedCache { +function Update-SPRepopulateMicroblogFeedCache { [CmdletBinding(DefaultParameterSetName='Default')] param( [Parameter(ParameterSetName='Default', Mandatory=$true, ValueFromPipeline=$true)] @@ -21176,11 +21167,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Update-SPRepopulateMicroblogLMTCache { + +function Update-SPRepopulateMicroblogLMTCache { [CmdletBinding()] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -21192,11 +21183,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Update-SPSecureStoreApplicationServerKey { +function Update-SPSecureStoreApplicationServerKey { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -21213,11 +21204,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Update-SPSecureStoreCredentialMapping { + +function Update-SPSecureStoreCredentialMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -21239,11 +21230,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Update-SPSecureStoreGroupCredentialMapping { +function Update-SPSecureStoreGroupCredentialMapping { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -21260,11 +21251,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Update-SPSecureStoreMasterKey { + +function Update-SPSecureStoreMasterKey { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -21281,11 +21272,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Update-SPSolution { +function Update-SPSolution { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -21318,11 +21309,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Update-SPUserSolution { + +function Update-SPUserSolution { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -21341,11 +21332,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Update-SPWOPIProofKey { +function Update-SPWOPIProofKey { [CmdletBinding()] param( [ValidateNotNullOrEmpty()] @@ -21356,11 +21347,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Upgrade-SPAppManagementServiceApplication { + +function Upgrade-SPAppManagementServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='AppManagementSvcAppById', Position=0, ValueFromPipeline=$true)] @@ -21378,11 +21369,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Upgrade-SPContentDatabase { +function Upgrade-SPContentDatabase { [CmdletBinding(DefaultParameterSetName='ContentDatabaseById', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='ContentDatabaseByName', Mandatory=$true)] @@ -21424,11 +21415,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Upgrade-SPEnterpriseSearchServiceApplication { + +function Upgrade-SPEnterpriseSearchServiceApplication { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -21439,11 +21430,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Upgrade-SPEnterpriseSearchServiceApplicationSiteSettings { +function Upgrade-SPEnterpriseSearchServiceApplicationSiteSettings { [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, ValueFromPipeline=$true)] @@ -21454,11 +21445,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Upgrade-SPFarm { + +function Upgrade-SPFarm { [CmdletBinding(DefaultParameterSetName='FarmById', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [switch] @@ -21475,11 +21466,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Upgrade-SPProfileServiceApplication { +function Upgrade-SPProfileServiceApplication { [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] param( [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -21491,11 +21482,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Upgrade-SPSingleSignOnDatabase { + +function Upgrade-SPSingleSignOnDatabase { [CmdletBinding()] param( [Parameter(Mandatory=$true)] @@ -21517,11 +21508,11 @@ param( [object] ${AssignmentCollection}) - - } + + } -function Upgrade-SPSite { +function Upgrade-SPSite { [CmdletBinding(DefaultParameterSetName='SPSiteById', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(ParameterSetName='SPSiteById', Mandatory=$true, Position=0, ValueFromPipeline=$true)] @@ -21547,11 +21538,11 @@ param( [object] ${AssignmentCollection}) - - } + } -function Upgrade-SPSiteMapDatabase { + +function Upgrade-SPSiteMapDatabase { [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='High')] param( [Parameter(Mandatory=$true, Position=0)] @@ -21563,5 +21554,5 @@ param( [object] ${AssignmentCollection}) - - } + + } diff --git a/appveyor.yml b/appveyor.yml index 91d0a738b..c9a432f98 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 3.4.0.{build} +version: 3.6.0.{build} install: