From 76f6fed5966804932734290410cc3ac2f3bc52ba Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sat, 22 Aug 2015 23:32:54 +1000 Subject: [PATCH 001/146] Fixed PS session selection --- .../xSharePoint.Util/xSharePoint.Util.psm1 | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 1dd4c287e..aa0c29416 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -11,12 +11,13 @@ function Get-xSharePointAuthenticatedPSSession() { $ForceNewSession = $false ) + [GC]::Collect() + # Remove existing sessions to keep things clean - Get-PSSession | Where-Object { $_.ComputerName -eq "localhost" -and $_.Runspace.OriginalConnectionInfo.Credential.UserName -eq $Credential.UserName } | Remove-PSSession - [GC]::Collect() - + $session = Get-PSSession -ComputerName localhost -Name "Microsoft.SharePoint.DSC" + if ($ForceNewSession -or $session -eq $null) { Write-Verbose -Message "Creating new PowerShell session" - $session = New-PSSession -ComputerName $env:COMPUTERNAME -Credential $Credential -Authentication CredSSP + $session = New-PSSession -ComputerName $env:COMPUTERNAME -Credential $Credential -Authentication CredSSP -Name "Microsoft.SharePoint.DSC" -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -OperationTimeout 0 -IdleTimeout 60000) Invoke-Command -Session $session -ScriptBlock { if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) { @@ -24,7 +25,11 @@ function Get-xSharePointAuthenticatedPSSession() { } } return $session - } + } else { + Write-Verbose -Message "Using existing new PowerShell session" + return $session[0] + } +} function Rename-xSharePointParamValue() { [CmdletBinding()] From 1822a6b22a3a6ad7166b8a3c822a3c26338467b0 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 23 Aug 2015 19:25:47 +1000 Subject: [PATCH 002/146] Forced session closes to ensure keeping within remote PS limits --- .../MSFT_xSPBCSServiceApp.psm1 | 2 + .../MSFT_xSPCacheAccounts.psm1 | 2 + .../MSFT_xSPClearRemoteSessions.psm1 | 45 --------- .../MSFT_xSPClearRemoteSessions.schema.mof | 7 -- .../MSFT_xSPCreateFarm.psm1 | 38 +++---- .../MSFT_xSPDiagnosticLoggingSettings.psm1 | 4 +- .../MSFT_xSPDistributedCacheService.psm1 | 3 +- .../MSFT_xSPFeature/MSFT_xSPFeature.psm1 | 2 + .../MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 | 99 +++++++------------ .../MSFT_xSPJoinFarm.schema.mof | 23 +++-- .../MSFT_xSPManagedAccount.psm1 | 4 +- .../MSFT_xSPManagedMetaDataServiceApp.psm1 | 2 + .../MSFT_xSPManagedPath.psm1 | 2 + .../MSFT_xSPSearchServiceApp.psm1 | 2 + .../MSFT_xSPSecureStoreServiceApp.psm1 | 2 + .../MSFT_xSPServiceAppPool.psm1 | 2 + .../MSFT_xSPServiceInstance.psm1 | 2 + .../MSFT_xSPSite/MSFT_xSPSite.psm1 | 2 + .../MSFT_xSPStateServiceApp.psm1 | 2 + .../MSFT_xSPUsageApplication.psm1 | 3 + .../MSFT_xSPUserProfileServiceApp.psm1 | 4 +- .../MSFT_xSPUserProfileSyncService.psm1 | 4 +- .../MSFT_xSPWebApplication.psm1 | 2 + .../Examples/Single Server/SharePoint.ps1 | 4 - .../Examples/Small Farm/AppServer.ps1 | 6 -- .../Examples/Small Farm/FirstServer.ps1 | 5 - .../Examples/Small Farm/WFEServer.ps1 | 6 -- .../xSharePoint.Util/xSharePoint.Util.psm1 | 31 +++--- Modules/xSharePoint/xSharePoint.pssproj | 3 - 29 files changed, 116 insertions(+), 197 deletions(-) delete mode 100644 Modules/xSharePoint/DSCResources/MSFT_xSPClearRemoteSessions/MSFT_xSPClearRemoteSessions.psm1 delete mode 100644 Modules/xSharePoint/DSCResources/MSFT_xSPClearRemoteSessions/MSFT_xSPClearRemoteSessions.schema.mof diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 index 9e1190fbe..d262224e2 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 @@ -37,6 +37,7 @@ function Get-TargetResource } } } + Remove-PSSession $session $result } @@ -88,6 +89,7 @@ function Set-TargetResource } } } + Remove-PSSession $session } function Test-TargetResource diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 index 60a1fd945..cc5d3e9f3 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 @@ -46,6 +46,7 @@ function Get-TargetResource return $returnVal } + Remove-PSSession $session $result } @@ -94,6 +95,7 @@ function Set-TargetResource } $wa.Update() } + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPClearRemoteSessions/MSFT_xSPClearRemoteSessions.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPClearRemoteSessions/MSFT_xSPClearRemoteSessions.psm1 deleted file mode 100644 index 8e359b001..000000000 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPClearRemoteSessions/MSFT_xSPClearRemoteSessions.psm1 +++ /dev/null @@ -1,45 +0,0 @@ -function Get-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] - [System.Boolean] - $ClearRemoteSessions - ) - - return Get-PSSession -ComputerName "localhost" -} - - -function Set-TargetResource -{ - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true)] - [System.Boolean] - $ClearRemoteSessions - ) - - Get-PSSession -ComputerName "localhost" | Remove-PSSession -} - - -function Test-TargetResource -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [parameter(Mandatory = $true)] - [System.Boolean] - $ClearRemoteSessions - ) - return !$ClearRemoteSessions -} - - -Export-ModuleMember -Function *-TargetResource - diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPClearRemoteSessions/MSFT_xSPClearRemoteSessions.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPClearRemoteSessions/MSFT_xSPClearRemoteSessions.schema.mof deleted file mode 100644 index ad01bd979..000000000 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPClearRemoteSessions/MSFT_xSPClearRemoteSessions.schema.mof +++ /dev/null @@ -1,7 +0,0 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xSPClearRemoteSessions")] -class MSFT_xSPClearRemoteSessions : OMI_BaseResource -{ - [Key] Boolean ClearRemoteSessions; -}; - diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 index 07133f3d7..f9d79910c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 @@ -50,6 +50,7 @@ function Get-TargetResource } return $returnValue } + Remove-PSSession $session $result } @@ -87,40 +88,39 @@ function Set-TargetResource $CentralAdministrationPort = 9999 ) - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount -ForceNewSession $true + $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + + if ($PSBoundParameters.CentralAdministrationPort -eq $null) { $PSBoundParameters.Add("CentralAdministrationPort", $CentralAdministrationPort) } Write-Verbose -Message "Setting up farm" Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] + $params = Rename-xSharePointParamValue -params $params -oldName "FarmConfigDatabaseName" -newName "DatabaseName" + $params = Rename-xSharePointParamValue -params $params -oldName "FarmAccount" -newName "FarmCredentials" + $params = Rename-xSharePointParamValue -params $params -oldName "AdminContentDatabaseName" -newName "AdministrationContentDatabaseName" + $params.Passphrase = (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) + $params.Remove("InstallAccount") + + $caPort = $params.CentralAdministrationPort + $params.Remove("CentralAdministrationPort") + if (Test-Path -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.dll") { - Write-Verbose -Message "Version: SharePoint 2016" - - New-SPConfigurationDatabase -DatabaseName $params.FarmConfigDatabaseName ` - -DatabaseServer $params.DatabaseServer ` - -Passphrase (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) ` - -FarmCredentials $params.FarmAccount ` - -SkipRegisterAsDistributedCacheHost:$true ` - -LocalServerRole Custom ` - -AdministrationContentDatabaseName $params.AdminContentDatabaseName + Write-Verbose -Message "Detected Version: SharePoint 2016" + $params.Add("LocalServerRole", "Custom") } else { - Write-Verbose -Message "Version: SharePoint 2013" - - New-SPConfigurationDatabase -DatabaseName $params.FarmConfigDatabaseName ` - -DatabaseServer $params.DatabaseServer ` - -Passphrase (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) ` - -FarmCredentials $params.FarmAccount ` - -SkipRegisterAsDistributedCacheHost:$true ` - -AdministrationContentDatabaseName $params.AdminContentDatabaseName + Write-Verbose -Message "Detected Version: SharePoint 2013" } + New-SPConfigurationDatabase @params -SkipRegisterAsDistributedCacheHost:$true Install-SPHelpCollection -All Initialize-SPResourceSecurity Install-SPService Install-SPFeature -AllExistingFeatures -Force - New-SPCentralAdministration -Port 9999 -WindowsAuthProvider NTLM + New-SPCentralAdministration -Port $caPort -WindowsAuthProvider NTLM Install-SPApplicationContent } + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 index e7f14f201..e61686b94 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 @@ -46,6 +46,7 @@ function Get-TargetResource ScriptErrorReportingDelay = $dc.ScriptErrorReportingDelay } } + Remove-PSSession $session $result } @@ -120,7 +121,7 @@ function Set-TargetResource $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $params.Remove("InstallAccount") | Out-Null @@ -129,6 +130,7 @@ function Set-TargetResource Set-SPDiagnosticConfig @params } + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index f71739057..886d59343 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -53,7 +53,7 @@ function Get-TargetResource return @{} } } - + Remove-PSSession $session $result } @@ -138,6 +138,7 @@ function Set-TargetResource } Write-Verbose -Message "Distributed cache removed." } + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 index 8bdcfce1d..ec3855028 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 @@ -55,6 +55,7 @@ function Get-TargetResource Enabled = $enabled } } + Remove-PSSession $session $result } @@ -105,6 +106,7 @@ function Set-TargetResource Disable-SPFeature @runParams } } + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 index 9565e5495..59c27e948 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 @@ -12,10 +12,6 @@ function Get-TargetResource [System.String] $DatabaseServer, - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -27,7 +23,7 @@ function Get-TargetResource Write-Verbose -Message "Checking for local SP Farm" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount -ForceNewSession $true + $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount $result = Invoke-Command -Session $session -ScriptBlock { try { @@ -43,6 +39,7 @@ function Get-TargetResource } return $returnValue } + Remove-PSSession $session $result } @@ -60,10 +57,6 @@ function Set-TargetResource [System.String] $DatabaseServer, - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -80,42 +73,38 @@ function Set-TargetResource ) Write-Verbose -Message "Joining existing farm configuration database" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount -ForceNewSession $true + $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + + if ($PSBoundParameters.WaitTime -eq $null) { $PSBoundParameters.Add("WaitTime", $WaitTime) } + if ($PSBoundParameters.WaitCount -eq $null) { $PSBoundParameters.Add("WaitCount", $WaitCount) } + Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] - - $WaitTime = $PSBoundParameters.WaitTime - if ($WaitTime -lt 1) {$WaitTime = 30} - $WaitCount = $PSBoundParameters.WaitCount - if ($WaitCount -lt 1) {$WaitCount = 30} - $loopCount = 0 - $majorVersion = (Get-xSharePointAssemblyVerion -PathToAssembly "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.dll").Major + $params = Rename-xSharePointParamValue -params $params -oldName "FarmConfigDatabaseName" -newName "DatabaseName" + $params.Passphrase = (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) + $params.Remove("InstallAccount") + + $WaitTime = $params.WaitTime + $params.Remove("WaitTime") + $WaitCount = $params.WaitCount + $params.Remove("WaitCount") + if (Test-Path -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.dll") { + Write-Verbose -Message "Detected Version: SharePoint 2016" + $params.Add("LocalServerRole", "Custom") + } else { + Write-Verbose -Message "Detected Version: SharePoint 2013" + } + + $success = $false while ($loopCount -le $WaitCount) { try { - if ($majorVersion -eq 15) { - Write-Verbose -Message "Version: SharePoint 2013" - - Connect-SPConfigurationDatabase -DatabaseName $params.FarmConfigDatabaseName ` - -DatabaseServer $params.DatabaseServer ` - -Passphrase (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) ` - -SkipRegisterAsDistributedCacheHost:$true - } - if ($majorVersion -eq 16) { - Write-Verbose -Message "Version: SharePoint 2016" - - Connect-SPConfigurationDatabase -DatabaseName $params.FarmConfigDatabaseName ` - -DatabaseServer $params.DatabaseServer ` - -LocalServerRole Custom ` - -Passphrase (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) ` - -SkipRegisterAsDistributedCacheHost:$true - } - - + Connect-SPConfigurationDatabase @params -SkipRegisterAsDistributedCacheHost:$true $loopCount = $WaitCount + 1 + $success = $true } catch { @@ -123,32 +112,16 @@ function Set-TargetResource Start-Sleep -Seconds $WaitTime } } + if ($success) { + Install-SPHelpCollection -All + Initialize-SPResourceSecurity + Install-SPService + Install-SPFeature -AllExistingFeatures -Force + Install-SPApplicationContent + } } - Write-Verbose -Message "Installing help collection" - Invoke-Command -Session $session -ScriptBlock { - Install-SPHelpCollection -All - } - - Write-Verbose -Message "Initialising farm resource security" - Invoke-Command -Session $session -ScriptBlock { - Initialize-SPResourceSecurity - } - - Write-Verbose -Message "Installing farm services" - Invoke-Command -Session $session -ScriptBlock { - Install-SPService - } - - Write-Verbose -Message "Installing farm features" - Invoke-Command -Session $session -ScriptBlock { - Install-SPFeature -AllExistingFeatures -Force - } - - Write-Verbose -Message "Installing application content" - Invoke-Command -Session $session -ScriptBlock { - Install-SPApplicationContent - } + Remove-PSSession $session Write-Verbose -Message "Starting timer service" Start-Service -Name sptimerv4 @@ -175,10 +148,6 @@ function Test-TargetResource [System.String] $DatabaseServer, - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -194,7 +163,7 @@ function Test-TargetResource $WaitCount = 60 ) - $result = Get-TargetResource -FarmConfigDatabaseName $FarmConfigDatabaseName -DatabaseServer $DatabaseServer -FarmAccount $FarmAccount -InstallAccount $InstallAccount -Passphrase $Passphrase + $result = Get-TargetResource -FarmConfigDatabaseName $FarmConfigDatabaseName -DatabaseServer $DatabaseServer -InstallAccount $InstallAccount -Passphrase $Passphrase if ($result.Count -eq 0) { return $false } return $true diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof index e92cf2a99..d75a878b9 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof @@ -1,12 +1,11 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSPJoinFarm")] -class MSFT_xSPJoinFarm : OMI_BaseResource -{ - [Key] string FarmConfigDatabaseName; - [Key] string DatabaseServer; - [Required, EmbeddedInstance("MSFT_Credential")] String FarmAccount; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; - [Required] string Passphrase; - [Write] uint32 WaitTime; - [Write] uint32 WaitCount; -}; - +[ClassVersion("1.0.0.0"), FriendlyName("xSPJoinFarm")] +class MSFT_xSPJoinFarm : OMI_BaseResource +{ + [Key] string FarmConfigDatabaseName; + [Key] string DatabaseServer; + [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; + [Required] string Passphrase; + [Write] uint32 WaitTime; + [Write] uint32 WaitCount; +}; + diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 index 7079f3f5d..a4c6ed957 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 @@ -40,6 +40,7 @@ function Get-TargetResource return @{ } } } + Remove-PSSession $session $result } @@ -75,7 +76,7 @@ function Set-TargetResource $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $ma = Get-SPManagedAccount $params.Account.UserName -ErrorAction SilentlyContinue @@ -89,6 +90,7 @@ function Set-TargetResource Set-SPManagedAccount @params } + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 index 5c7efb7b9..0531a3e4d 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 @@ -37,6 +37,7 @@ function Get-TargetResource } } } + Remove-PSSession $session $result } @@ -92,6 +93,7 @@ function Set-TargetResource } } } + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 index 311add1d8..ef5e333ad 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 @@ -46,6 +46,7 @@ function Get-TargetResource PathType = $path.Type } } + Remove-PSSession $session $result } @@ -105,6 +106,7 @@ function Set-TargetResource New-SPManagedPath @newParams } } + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 index 81fc03b69..31b8cd3a1 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 @@ -37,6 +37,7 @@ function Get-TargetResource } } } + Remove-PSSession $session $result } @@ -93,6 +94,7 @@ function Set-TargetResource } } } + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 index 76efdc33b..c1c5f1d11 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 @@ -41,6 +41,7 @@ function Get-TargetResource } } } + Remove-PSSession $session $result } @@ -124,6 +125,7 @@ function Set-TargetResource } } } + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 index 99b086056..4cce943ef 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 @@ -32,6 +32,7 @@ function Get-TargetResource ProcessAccountName = $sap.ProcessAccountName } } + Remove-PSSession $session $result } @@ -69,6 +70,7 @@ function Set-TargetResource } } } + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 index e64673c24..7b820d095 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 @@ -33,6 +33,7 @@ function Get-TargetResource Status = $si.Status } } + Remove-PSSession $session $result } @@ -79,6 +80,7 @@ function Set-TargetResource Stop-SPServiceInstance $si } } + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 index 0f0210364..6cca74d0f 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 @@ -33,6 +33,7 @@ function Get-TargetResource } } } + Remove-PSSession $session $result } @@ -103,6 +104,7 @@ function Set-TargetResource New-SPSite @params | Out-Null } } + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 index d26270c1d..8d465813c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 @@ -28,6 +28,7 @@ function Get-TargetResource Name = $app.DisplayName } } + Remove-PSSession $session $result } @@ -74,6 +75,7 @@ function Set-TargetResource New-SPStateServiceDatabase @dbParams| New-SPStateServiceApplication -Name $params.Name | New-SPStateServiceApplicationProxy -DefaultProxyGroup } } + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 index 1f726a84d..714a7fb8c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 @@ -37,6 +37,7 @@ function Get-TargetResource } } } + Remove-PSSession $session $result } @@ -116,6 +117,8 @@ function Set-TargetResource if ($params.ContainsKey("UsageLogMaxSpaceGB")) { $setParams.Add("UsageLogMaxSpaceGB", $params.UsageLogMaxSpaceGB) } Set-SPUsageService @setParams } + + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 index d9eb2e607..4b68a6015 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 @@ -39,6 +39,7 @@ function Get-TargetResource } } } + Remove-PSSession $session $result } @@ -102,7 +103,7 @@ function Set-TargetResource ([ADSI]"WinNT://$computerName/Administrators,group").Add("WinNT://$domainName/$userName") | Out-Null } - $session = Get-xSharePointAuthenticatedPSSession -Credential $FarmAccount -ForceNewSession $true + $session = Get-xSharePointAuthenticatedPSSession -Credential $FarmAccount $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $params = Remove-xSharePointNullParamValues -Params $params @@ -127,6 +128,7 @@ function Set-TargetResource Write-Verbose -Message "Removing $domainName\$userName from local admin group" ([ADSI]"WinNT://$computerName/Administrators,group").Remove("WinNT://$domainName/$userName") | Out-Null } + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 index 9c426e7e5..ac0bcc18b 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 @@ -37,6 +37,7 @@ function Get-TargetResource Status = $syncService.Status } } + Remove-PSSession $session $result } @@ -84,7 +85,7 @@ function Set-TargetResource Restart-Service -Name "SPTimerV4" } - $session = Get-xSharePointAuthenticatedPSSession -Credential $FarmAccount -ForceNewSession $true + $session = Get-xSharePointAuthenticatedPSSession -Credential $FarmAccount Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] @@ -128,6 +129,7 @@ function Set-TargetResource { ([ADSI]"WinNT://$computerName/Administrators,group").Remove("WinNT://$domainName/$userName") | Out-Null } + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 index c498c2669..fc07f3624 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 @@ -39,6 +39,7 @@ function Get-TargetResource ApplicationPoolAccount = $wa.ApplicationPool.Username } } + Remove-PSSession $session $result } @@ -118,6 +119,7 @@ function Set-TargetResource New-SPWebApplication @params } } + Remove-PSSession $session } diff --git a/Modules/xSharePoint/Examples/Single Server/SharePoint.ps1 b/Modules/xSharePoint/Examples/Single Server/SharePoint.ps1 index 38bd3d4ec..538871a57 100644 --- a/Modules/xSharePoint/Examples/Single Server/SharePoint.ps1 +++ b/Modules/xSharePoint/Examples/Single Server/SharePoint.ps1 @@ -71,10 +71,6 @@ Configuration SharePointServer # This section triggers installation of both SharePoint # as well as the prerequisites required #********************************************************** - xSPClearRemoteSessions ClearRemotePowerShellSessions - { - ClearRemoteSessions = $true - } xSPInstallPrereqs InstallPrerequisites { InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe" diff --git a/Modules/xSharePoint/Examples/Small Farm/AppServer.ps1 b/Modules/xSharePoint/Examples/Small Farm/AppServer.ps1 index 429abc3c3..72f412617 100644 --- a/Modules/xSharePoint/Examples/Small Farm/AppServer.ps1 +++ b/Modules/xSharePoint/Examples/Small Farm/AppServer.ps1 @@ -71,11 +71,6 @@ Configuration SharePointAppServer # This section triggers installation of both SharePoint # as well as the prerequisites required #********************************************************** - - xSPClearRemoteSessions ClearRemotePowerShellSessions - { - ClearRemoteSessions = $true - } xSPInstallPrereqs InstallPrerequisites { InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe" @@ -129,7 +124,6 @@ Configuration SharePointAppServer DatabaseServer = $DatabaseServer FarmConfigDatabaseName = "SP_Config" Passphrase = $FarmPassPhrase - FarmAccount = $FarmAccount InstallAccount = $InstallAccount DependsOn = "[xSPInstall]InstallBinaries" } diff --git a/Modules/xSharePoint/Examples/Small Farm/FirstServer.ps1 b/Modules/xSharePoint/Examples/Small Farm/FirstServer.ps1 index bf4b122a9..09b5a231e 100644 --- a/Modules/xSharePoint/Examples/Small Farm/FirstServer.ps1 +++ b/Modules/xSharePoint/Examples/Small Farm/FirstServer.ps1 @@ -71,11 +71,6 @@ Configuration SharePointFarmServer # This section triggers installation of both SharePoint # as well as the prerequisites required #********************************************************** - - xSPClearRemoteSessions ClearRemotePowerShellSessions - { - ClearRemoteSessions = $true - } xSPInstallPrereqs InstallPrerequisites { InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe" diff --git a/Modules/xSharePoint/Examples/Small Farm/WFEServer.ps1 b/Modules/xSharePoint/Examples/Small Farm/WFEServer.ps1 index 4f3bdc7db..cfd7b4350 100644 --- a/Modules/xSharePoint/Examples/Small Farm/WFEServer.ps1 +++ b/Modules/xSharePoint/Examples/Small Farm/WFEServer.ps1 @@ -71,11 +71,6 @@ Configuration SharePointWFEServer # This section triggers installation of both SharePoint # as well as the prerequisites required #********************************************************** - - xSPClearRemoteSessions ClearRemotePowerShellSessions - { - ClearRemoteSessions = $true - } xSPInstallPrereqs InstallPrerequisites { InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe" @@ -129,7 +124,6 @@ Configuration SharePointWFEServer DatabaseServer = $DatabaseServer FarmConfigDatabaseName = "SP_Config" Passphrase = $FarmPassPhrase - FarmAccount = $FarmAccount InstallAccount = $InstallAccount DependsOn = "[xSPInstall]InstallBinaries" } diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index aa0c29416..3cf07807f 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -4,31 +4,22 @@ function Get-xSharePointAuthenticatedPSSession() { ( [parameter(Mandatory = $true,Position=1)] [System.Management.Automation.PSCredential] - $Credential, - - [parameter(Mandatory = $false,Position=2)] - [System.Boolean] - $ForceNewSession = $false + $Credential ) + #Running garbage collection to resolve issues related to Azure DSC extention use [GC]::Collect() - # Remove existing sessions to keep things clean - $session = Get-PSSession -ComputerName localhost -Name "Microsoft.SharePoint.DSC" - if ($ForceNewSession -or $session -eq $null) { - Write-Verbose -Message "Creating new PowerShell session" - $session = New-PSSession -ComputerName $env:COMPUTERNAME -Credential $Credential -Authentication CredSSP -Name "Microsoft.SharePoint.DSC" -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -OperationTimeout 0 -IdleTimeout 60000) - Invoke-Command -Session $session -ScriptBlock { - if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) - { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" - } + Write-Verbose -Message "Creating new PowerShell session" + $session = New-PSSession -ComputerName $env:COMPUTERNAME -Credential $Credential -Authentication CredSSP -Name "Microsoft.SharePoint.DSC" -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -OperationTimeout 0 -IdleTimeout 60000) + Invoke-Command -Session $session -ScriptBlock { + if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) + { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" } - return $session - } else { - Write-Verbose -Message "Using existing new PowerShell session" - return $session[0] - } + $VerbosePreference = 'Continue' + } + return $session } function Rename-xSharePointParamValue() { diff --git a/Modules/xSharePoint/xSharePoint.pssproj b/Modules/xSharePoint/xSharePoint.pssproj index 29528d9d9..c4d2f6412 100644 --- a/Modules/xSharePoint/xSharePoint.pssproj +++ b/Modules/xSharePoint/xSharePoint.pssproj @@ -72,7 +72,6 @@ - @@ -129,8 +128,6 @@ - - From 8df0e199036be2adc6abbf30919d040d2047f2a2 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 30 Aug 2015 09:23:47 +1000 Subject: [PATCH 003/146] Fixed CA port in central admin, minor fix to DCache --- .../MSFT_xSPCreateFarm.psm1 | 26 ++++++++++--------- .../MSFT_xSPDistributedCacheService.psm1 | 2 +- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 index f9d79910c..6dd259930 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 @@ -50,7 +50,7 @@ function Get-TargetResource } return $returnValue } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -88,22 +88,24 @@ function Set-TargetResource $CentralAdministrationPort = 9999 ) + $VerbosePreference = 'Continue' $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + + if (-not $PSBoundParameters.ContainsKey("CentralAdministrationPort")) { $PSBoundParameters.Add("CentralAdministrationPort", 9999) } - if ($PSBoundParameters.CentralAdministrationPort -eq $null) { $PSBoundParameters.Add("CentralAdministrationPort", $CentralAdministrationPort) } + Write-Verbose -Message "Setting up new SharePoint farm" - Write-Verbose -Message "Setting up farm" Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] - $params = Rename-xSharePointParamValue -params $params -oldName "FarmConfigDatabaseName" -newName "DatabaseName" - $params = Rename-xSharePointParamValue -params $params -oldName "FarmAccount" -newName "FarmCredentials" - $params = Rename-xSharePointParamValue -params $params -oldName "AdminContentDatabaseName" -newName "AdministrationContentDatabaseName" - $params.Passphrase = (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) - $params.Remove("InstallAccount") + $params = Rename-xSharePointParamValue -params $params -oldName "FarmConfigDatabaseName" -newName "DatabaseName" + $params = Rename-xSharePointParamValue -params $params -oldName "FarmAccount" -newName "FarmCredentials" + $params = Rename-xSharePointParamValue -params $params -oldName "AdminContentDatabaseName" -newName "AdministrationContentDatabaseName" + $params.Passphrase = (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) + $params.Remove("InstallAccount") - $caPort = $params.CentralAdministrationPort - $params.Remove("CentralAdministrationPort") + $caPort = $params.CentralAdministrationPort + $params.Remove("CentralAdministrationPort") if (Test-Path -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.dll") { Write-Verbose -Message "Detected Version: SharePoint 2016" @@ -112,7 +114,7 @@ function Set-TargetResource Write-Verbose -Message "Detected Version: SharePoint 2013" } - New-SPConfigurationDatabase @params -SkipRegisterAsDistributedCacheHost:$true + New-SPConfigurationDatabase @params -SkipRegisterAsDistributedCacheHost:$true Install-SPHelpCollection -All Initialize-SPResourceSecurity Install-SPService @@ -120,7 +122,7 @@ function Set-TargetResource New-SPCentralAdministration -Port $caPort -WindowsAuthProvider NTLM Install-SPApplicationContent } - Remove-PSSession $session + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index 886d59343..6c511af22 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -40,7 +40,7 @@ function Get-TargetResource Use-CacheCluster -ErrorAction SilentlyContinue $cacheHost = Get-CacheHost -ErrorAction SilentlyContinue if ($null -eq $cacheHost) { return @{} } - $cacheHostConfig = Get-AFCacheHostConfiguration -ComputerName $cacheHost.HostName -CachePort $cacheHost.PortNo -ErrorAction SilentlyContinue + $cacheHostConfig = Get-AFCacheHostConfiguration -ComputerName ([System.Net.Dns]::GetHostByName($env:computerName)).HostName -CachePort $cacheHost.PortNo -ErrorAction SilentlyContinue if ($null -eq $cacheHostConfig) { return @{} } return @{ From d6df75400ec7ec9bd404bfcb9998feb564bdac10 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 30 Aug 2015 09:32:41 +1000 Subject: [PATCH 004/146] Fixed files with spaces --- .../MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 | 4 ++-- .../MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 | 4 ++-- .../MSFT_xSPDiagnosticLoggingSettings.psm1 | 4 ++-- .../MSFT_xSPDistributedCacheService.psm1 | 4 ++-- .../DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 | 4 ++-- .../DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 | 4 ++-- .../MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 | 4 ++-- .../MSFT_xSPManagedMetaDataServiceApp.psm1 | 4 ++-- .../DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 | 4 ++-- .../MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 | 4 ++-- .../MSFT_xSPSecureStoreServiceApp.psm1 | 4 ++-- .../MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 | 4 ++-- .../MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 | 4 ++-- .../xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 | 4 ++-- .../MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 | 4 ++-- .../MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 | 4 ++-- .../MSFT_xSPUserProfileServiceApp.psm1 | 4 ++-- .../MSFT_xSPUserProfileSyncService.psm1 | 4 ++-- .../MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 | 4 ++-- 19 files changed, 38 insertions(+), 38 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 index d262224e2..bddba0030 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 @@ -37,7 +37,7 @@ function Get-TargetResource } } } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -89,7 +89,7 @@ function Set-TargetResource } } } - Remove-PSSession $session + Remove-PSSession $session } function Test-TargetResource diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 index cc5d3e9f3..bab0a0760 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 @@ -46,7 +46,7 @@ function Get-TargetResource return $returnVal } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -95,7 +95,7 @@ function Set-TargetResource } $wa.Update() } - Remove-PSSession $session + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 index e61686b94..d60addf01 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 @@ -46,7 +46,7 @@ function Get-TargetResource ScriptErrorReportingDelay = $dc.ScriptErrorReportingDelay } } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -130,7 +130,7 @@ function Set-TargetResource Set-SPDiagnosticConfig @params } - Remove-PSSession $session + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index 6c511af22..6eeaeeb46 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -53,7 +53,7 @@ function Get-TargetResource return @{} } } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -138,7 +138,7 @@ function Set-TargetResource } Write-Verbose -Message "Distributed cache removed." } - Remove-PSSession $session + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 index ec3855028..f606d9eee 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 @@ -55,7 +55,7 @@ function Get-TargetResource Enabled = $enabled } } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -106,7 +106,7 @@ function Set-TargetResource Disable-SPFeature @runParams } } - Remove-PSSession $session + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 index 59c27e948..198178265 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 @@ -39,7 +39,7 @@ function Get-TargetResource } return $returnValue } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -121,7 +121,7 @@ function Set-TargetResource } } - Remove-PSSession $session + Remove-PSSession $session Write-Verbose -Message "Starting timer service" Start-Service -Name sptimerv4 diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 index a4c6ed957..79fb41b03 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 @@ -40,7 +40,7 @@ function Get-TargetResource return @{ } } } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -90,7 +90,7 @@ function Set-TargetResource Set-SPManagedAccount @params } - Remove-PSSession $session + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 index 0531a3e4d..e3cc5d2ca 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 @@ -37,7 +37,7 @@ function Get-TargetResource } } } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -93,7 +93,7 @@ function Set-TargetResource } } } - Remove-PSSession $session + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 index ef5e333ad..238d0d4c1 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 @@ -46,7 +46,7 @@ function Get-TargetResource PathType = $path.Type } } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -106,7 +106,7 @@ function Set-TargetResource New-SPManagedPath @newParams } } - Remove-PSSession $session + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 index 31b8cd3a1..b1643c82c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 @@ -37,7 +37,7 @@ function Get-TargetResource } } } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -94,7 +94,7 @@ function Set-TargetResource } } } - Remove-PSSession $session + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 index c1c5f1d11..20cb9df35 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 @@ -41,7 +41,7 @@ function Get-TargetResource } } } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -125,7 +125,7 @@ function Set-TargetResource } } } - Remove-PSSession $session + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 index 4cce943ef..f0eef4f16 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 @@ -32,7 +32,7 @@ function Get-TargetResource ProcessAccountName = $sap.ProcessAccountName } } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -70,7 +70,7 @@ function Set-TargetResource } } } - Remove-PSSession $session + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 index 7b820d095..4c6eb0f53 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 @@ -33,7 +33,7 @@ function Get-TargetResource Status = $si.Status } } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -80,7 +80,7 @@ function Set-TargetResource Stop-SPServiceInstance $si } } - Remove-PSSession $session + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 index 6cca74d0f..3b731aa52 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 @@ -33,7 +33,7 @@ function Get-TargetResource } } } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -104,7 +104,7 @@ function Set-TargetResource New-SPSite @params | Out-Null } } - Remove-PSSession $session + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 index 8d465813c..f35cbf366 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 @@ -28,7 +28,7 @@ function Get-TargetResource Name = $app.DisplayName } } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -75,7 +75,7 @@ function Set-TargetResource New-SPStateServiceDatabase @dbParams| New-SPStateServiceApplication -Name $params.Name | New-SPStateServiceApplicationProxy -DefaultProxyGroup } } - Remove-PSSession $session + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 index 714a7fb8c..fd48b750d 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 @@ -37,7 +37,7 @@ function Get-TargetResource } } } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -118,7 +118,7 @@ function Set-TargetResource Set-SPUsageService @setParams } - Remove-PSSession $session + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 index 4b68a6015..a746bdb13 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 @@ -39,7 +39,7 @@ function Get-TargetResource } } } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -128,7 +128,7 @@ function Set-TargetResource Write-Verbose -Message "Removing $domainName\$userName from local admin group" ([ADSI]"WinNT://$computerName/Administrators,group").Remove("WinNT://$domainName/$userName") | Out-Null } - Remove-PSSession $session + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 index ac0bcc18b..670836e31 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 @@ -37,7 +37,7 @@ function Get-TargetResource Status = $syncService.Status } } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -129,7 +129,7 @@ function Set-TargetResource { ([ADSI]"WinNT://$computerName/Administrators,group").Remove("WinNT://$domainName/$userName") | Out-Null } - Remove-PSSession $session + Remove-PSSession $session } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 index fc07f3624..573887ac0 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 @@ -39,7 +39,7 @@ function Get-TargetResource ApplicationPoolAccount = $wa.ApplicationPool.Username } } - Remove-PSSession $session + Remove-PSSession $session $result } @@ -119,7 +119,7 @@ function Set-TargetResource New-SPWebApplication @params } } - Remove-PSSession $session + Remove-PSSession $session } From c89edbba85d6a09215efb82505b5fc8b34b5ac40 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 30 Aug 2015 09:35:02 +1000 Subject: [PATCH 005/146] Fixed more files with spaces --- .../MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 | 40 +++++++++---------- .../xSharePoint.Util/xSharePoint.Util.psm1 | 8 ++-- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 index 198178265..07ee69388 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 @@ -75,36 +75,36 @@ function Set-TargetResource Write-Verbose -Message "Joining existing farm configuration database" $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount - if ($PSBoundParameters.WaitTime -eq $null) { $PSBoundParameters.Add("WaitTime", $WaitTime) } - if ($PSBoundParameters.WaitCount -eq $null) { $PSBoundParameters.Add("WaitCount", $WaitCount) } + if ($PSBoundParameters.WaitTime -eq $null) { $PSBoundParameters.Add("WaitTime", $WaitTime) } + if ($PSBoundParameters.WaitCount -eq $null) { $PSBoundParameters.Add("WaitCount", $WaitCount) } Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $loopCount = 0 - $params = Rename-xSharePointParamValue -params $params -oldName "FarmConfigDatabaseName" -newName "DatabaseName" - $params.Passphrase = (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) - $params.Remove("InstallAccount") + $params = Rename-xSharePointParamValue -params $params -oldName "FarmConfigDatabaseName" -newName "DatabaseName" + $params.Passphrase = (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) + $params.Remove("InstallAccount") - $WaitTime = $params.WaitTime - $params.Remove("WaitTime") - $WaitCount = $params.WaitCount - $params.Remove("WaitCount") + $WaitTime = $params.WaitTime + $params.Remove("WaitTime") + $WaitCount = $params.WaitCount + $params.Remove("WaitCount") - if (Test-Path -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.dll") { + if (Test-Path -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.dll") { Write-Verbose -Message "Detected Version: SharePoint 2016" $params.Add("LocalServerRole", "Custom") } else { Write-Verbose -Message "Detected Version: SharePoint 2013" } - $success = $false + $success = $false while ($loopCount -le $WaitCount) { try { - Connect-SPConfigurationDatabase @params -SkipRegisterAsDistributedCacheHost:$true + Connect-SPConfigurationDatabase @params -SkipRegisterAsDistributedCacheHost:$true $loopCount = $WaitCount + 1 - $success = $true + $success = $true } catch { @@ -112,13 +112,13 @@ function Set-TargetResource Start-Sleep -Seconds $WaitTime } } - if ($success) { - Install-SPHelpCollection -All - Initialize-SPResourceSecurity - Install-SPService - Install-SPFeature -AllExistingFeatures -Force - Install-SPApplicationContent - } + if ($success) { + Install-SPHelpCollection -All + Initialize-SPResourceSecurity + Install-SPService + Install-SPFeature -AllExistingFeatures -Force + Install-SPApplicationContent + } } Remove-PSSession $session diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 3cf07807f..7ad790cd1 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -7,17 +7,17 @@ function Get-xSharePointAuthenticatedPSSession() { $Credential ) - #Running garbage collection to resolve issues related to Azure DSC extention use - [GC]::Collect() + #Running garbage collection to resolve issues related to Azure DSC extention use + [GC]::Collect() - Write-Verbose -Message "Creating new PowerShell session" + Write-Verbose -Message "Creating new PowerShell session" $session = New-PSSession -ComputerName $env:COMPUTERNAME -Credential $Credential -Authentication CredSSP -Name "Microsoft.SharePoint.DSC" -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -OperationTimeout 0 -IdleTimeout 60000) Invoke-Command -Session $session -ScriptBlock { if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) { Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" } - $VerbosePreference = 'Continue' + $VerbosePreference = 'Continue' } return $session } From 92d72af2a784ac023e4768e507da674d37bd6fa8 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 30 Aug 2015 09:36:10 +1000 Subject: [PATCH 006/146] Removed now unused farm account from join farm --- Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 index 93eda2d79..34859f37b 100644 --- a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 @@ -19,7 +19,6 @@ Describe "xSPJoinFarm" { $testParams = @{ FarmConfigDatabaseName = "SP_Config" DatabaseServer = "DatabaseServer\Instance" - FarmAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) Passphrase = "passphrase" WaitTime = 60 From 832807c87336d51b0286e6032117cfada6525ca5 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 1 Sep 2015 23:08:44 +1200 Subject: [PATCH 007/146] Global tests now incorporate main DSC tests if they are found nearby --- .../xSharePoint/xSharePoint.Global.Tests.ps1 | 98 ++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-) diff --git a/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 b/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 index 659d96db6..35b8102ec 100644 --- a/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 @@ -36,4 +36,100 @@ Describe 'xSharePoint Global Tests' { $mofFilesWithNoInstallAccount | Should Be 0 } } -} \ No newline at end of file + + Context 'Files have valid text structure' { + It 'Passes test file checks for DSC resources' { + $DSCTestsPath = (Get-Item (Join-Path $RepoRoot "..\**\DSCResource.Tests\TestHelper.psm1" -Resolve)).FullName + if ($null -ne $DSCTestsPath) { + + } + } + } +} + +$DSCTestsPath = (Get-Item (Join-Path $RepoRoot "..\**\DSCResource.Tests\MetaFixers.psm1" -Resolve)).FullName +if ($null -ne $DSCTestsPath) { + Import-Module $DSCTestsPath + + Describe 'Text files formatting' { + $allTextFiles = Get-TextFilesList $RepoRoot + + Context 'Files encoding' { + + It "Doesn't use Unicode encoding" { + $unicodeFilesCount = 0 + $allTextFiles | %{ + if (Test-FileUnicode $_) { + $unicodeFilesCount += 1 + Write-Warning "File $($_.FullName) contains 0x00 bytes. It's probably uses Unicode and need to be converted to UTF-8. Use Fixer 'Get-UnicodeFilesList `$pwd | ConvertTo-UTF8'." + } + } + $unicodeFilesCount | Should Be 0 + } + } + + Context 'Indentations' { + + It "Uses spaces for indentation, not tabs" { + $totalTabsCount = 0 + $allTextFiles | %{ + $fileName = $_.FullName + $tabStrings = (cat $_.FullName -Raw) | Select-String "`t" | % { + Write-Warning "There are tab in $fileName. Use Fixer 'Get-TextFilesList `$pwd | ConvertTo-SpaceIndentation'." + $totalTabsCount++ + } + } + $totalTabsCount | Should Be 0 + } + } + } +} + + +Describe 'PowerShell DSC resource modules' { + + # Force convert to array + $psm1Files = @(ls $RepoRoot -Recurse -Filter "*.psm1" -File | ? { + # Ignore Composite configurations + # They requires additional resources to be installed on the box + ($_.FullName -like "*\DscResources\*") -and (-not ($_.Name -like "*.schema.psm1")) + }) + + if (-not $psm1Files) { + Write-Verbose -Verbose "There are no resource files to analyze" + } else { + + Write-Verbose -Verbose "Analyzing $($psm1Files.Count) files" + + Context 'Correctness' { + + function Get-ParseErrors + { + param( + [Parameter(ValueFromPipeline=$True,Mandatory=$True)] + [string]$fileName + ) + + $tokens = $null + $errors = $null + $ast = [System.Management.Automation.Language.Parser]::ParseFile($fileName, [ref] $tokens, [ref] $errors) + return $errors + } + + + It 'all .psm1 files don''t have parse errors' { + $errors = @() + $psm1Files | %{ + $localErrors = Get-ParseErrors $_.FullName + if ($localErrors) { + Write-Warning "There are parsing errors in $($_.FullName)" + Write-Warning ($localErrors | fl | Out-String) + } + $errors += $localErrors + } + $errors.Count | Should Be 0 + } + } + } +} + From 9ce5af740169deef6b98cec14be2985f82b7a940 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 1 Sep 2015 23:52:27 +1200 Subject: [PATCH 008/146] Modified CreateFarm as test and added wrapper call to support both PS4 and PS5 --- .../MSFT_xSPCreateFarm.psm1 | 21 +++---- .../MSFT_xSPCreateFarm.schema.mof | 2 +- .../xSharePoint.Util/xSharePoint.Util.psm1 | 58 +++++++++++++++++++ 3 files changed, 66 insertions(+), 15 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 index 6dd259930..678081a85 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 @@ -16,7 +16,7 @@ function Get-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -34,9 +34,7 @@ function Get-TargetResource Write-Verbose -Message "Checking for local SP Farm" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount - - $result = Invoke-Command -Session $session -ScriptBlock { + $result = Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { try { $spFarm = Get-SPFarm -ErrorAction SilentlyContinue } catch { @@ -50,8 +48,7 @@ function Get-TargetResource } return $returnValue } - Remove-PSSession $session - $result + return $result } @@ -72,7 +69,7 @@ function Set-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -87,15 +84,12 @@ function Set-TargetResource [System.UInt32] $CentralAdministrationPort = 9999 ) - - $VerbosePreference = 'Continue' - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount - + if (-not $PSBoundParameters.ContainsKey("CentralAdministrationPort")) { $PSBoundParameters.Add("CentralAdministrationPort", 9999) } Write-Verbose -Message "Setting up new SharePoint farm" - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] $params = Rename-xSharePointParamValue -params $params -oldName "FarmConfigDatabaseName" -newName "DatabaseName" @@ -122,7 +116,6 @@ function Set-TargetResource New-SPCentralAdministration -Port $caPort -WindowsAuthProvider NTLM Install-SPApplicationContent } - Remove-PSSession $session } @@ -144,7 +137,7 @@ function Test-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof index 0d04007d6..7d3767e44 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof @@ -5,7 +5,7 @@ class MSFT_xSPCreateFarm : OMI_BaseResource [Key] String FarmConfigDatabaseName; [Key] String DatabaseServer; [Required, EmbeddedInstance("MSFT_Credential")] String FarmAccount; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Required] String Passphrase; [Required] String AdminContentDatabaseName; [Write] uint32 CentralAdministrationPort; diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 7ad790cd1..52a1af694 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -22,6 +22,64 @@ function Get-xSharePointAuthenticatedPSSession() { return $session } +function Invoke-xSharePointCommand() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $false)] + [System.Management.Automation.PSCredential] + $Credential, + + [parameter(Mandatory = $true)] + [string] + $ScriptBlock, + + [parameter(Mandatory = $false)] + [System.Collections.Generic.Dictionary`2[System.String,System.Object]] + $Arguments + ) + + + $invokeParams = @{} + $invokeParams.Add("ScriptBlock", $ScriptBlock) + + $createdSession = $false + + if ($PSBoundParameters.ContainsKey("Arguments")) { + $invokeParams.Add("ArgumentList", $Arguments) + } + + if ($Credential -eq $null) + { + if ($env:USERNAME.Contains("$")) { + throw [Exception] "Either InstallAccount or PsDscRunAsCredential must be specified for the current resource" + return + } + + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $VerbosePreference = 'Continue' + } + else + { + if ($env:USERNAME -eq $Credential.UserName) { + throw [Exception] "Either InstallAccount or PsDscRunAsCredential must be specified for the current resource, and currently both are used" + return + } + + $session = Get-xSharePointAuthenticatedPSSession -Credential $Credential + $invokeParams.Add("Session", $session) + $createdSession = $true + } + + $returnVal = Invoke-Command @invokeParams + + if ($createdSession) { + Remove-PSSession $invokeParams.Session + } + + return $returnVal +} + function Rename-xSharePointParamValue() { [CmdletBinding()] param From 61da49096574d36e115d925e358209a1620eee00 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Wed, 2 Sep 2015 12:17:30 +1200 Subject: [PATCH 009/146] Backing out changes for PS5 as I can't make it work the way I want --- .../MSFT_xSPCreateFarm.psm1 | 21 ++++--- .../MSFT_xSPCreateFarm.schema.mof | 2 +- .../xSharePoint.Util/xSharePoint.Util.psm1 | 58 ------------------- 3 files changed, 15 insertions(+), 66 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 index 678081a85..6dd259930 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 @@ -16,7 +16,7 @@ function Get-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -34,7 +34,9 @@ function Get-TargetResource Write-Verbose -Message "Checking for local SP Farm" - $result = Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { + $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + + $result = Invoke-Command -Session $session -ScriptBlock { try { $spFarm = Get-SPFarm -ErrorAction SilentlyContinue } catch { @@ -48,7 +50,8 @@ function Get-TargetResource } return $returnValue } - return $result + Remove-PSSession $session + $result } @@ -69,7 +72,7 @@ function Set-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -84,12 +87,15 @@ function Set-TargetResource [System.UInt32] $CentralAdministrationPort = 9999 ) - + + $VerbosePreference = 'Continue' + $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + if (-not $PSBoundParameters.ContainsKey("CentralAdministrationPort")) { $PSBoundParameters.Add("CentralAdministrationPort", 9999) } Write-Verbose -Message "Setting up new SharePoint farm" - Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $params = Rename-xSharePointParamValue -params $params -oldName "FarmConfigDatabaseName" -newName "DatabaseName" @@ -116,6 +122,7 @@ function Set-TargetResource New-SPCentralAdministration -Port $caPort -WindowsAuthProvider NTLM Install-SPApplicationContent } + Remove-PSSession $session } @@ -137,7 +144,7 @@ function Test-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $InstallAccount, diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof index 7d3767e44..0d04007d6 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof @@ -5,7 +5,7 @@ class MSFT_xSPCreateFarm : OMI_BaseResource [Key] String FarmConfigDatabaseName; [Key] String DatabaseServer; [Required, EmbeddedInstance("MSFT_Credential")] String FarmAccount; - [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; + [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Required] String Passphrase; [Required] String AdminContentDatabaseName; [Write] uint32 CentralAdministrationPort; diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 52a1af694..7ad790cd1 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -22,64 +22,6 @@ function Get-xSharePointAuthenticatedPSSession() { return $session } -function Invoke-xSharePointCommand() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $Credential, - - [parameter(Mandatory = $true)] - [string] - $ScriptBlock, - - [parameter(Mandatory = $false)] - [System.Collections.Generic.Dictionary`2[System.String,System.Object]] - $Arguments - ) - - - $invokeParams = @{} - $invokeParams.Add("ScriptBlock", $ScriptBlock) - - $createdSession = $false - - if ($PSBoundParameters.ContainsKey("Arguments")) { - $invokeParams.Add("ArgumentList", $Arguments) - } - - if ($Credential -eq $null) - { - if ($env:USERNAME.Contains("$")) { - throw [Exception] "Either InstallAccount or PsDscRunAsCredential must be specified for the current resource" - return - } - - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $VerbosePreference = 'Continue' - } - else - { - if ($env:USERNAME -eq $Credential.UserName) { - throw [Exception] "Either InstallAccount or PsDscRunAsCredential must be specified for the current resource, and currently both are used" - return - } - - $session = Get-xSharePointAuthenticatedPSSession -Credential $Credential - $invokeParams.Add("Session", $session) - $createdSession = $true - } - - $returnVal = Invoke-Command @invokeParams - - if ($createdSession) { - Remove-PSSession $invokeParams.Session - } - - return $returnVal -} - function Rename-xSharePointParamValue() { [CmdletBinding()] param From b4afca6dcda88c7a49bd9b056640222d78c5cccf Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 3 Sep 2015 12:50:36 +1200 Subject: [PATCH 010/146] Added support for PS5 PsDscRunAsCredential --- .../MSFT_xSPBCSServiceApp.psm1 | 22 +++---- .../MSFT_xSPBCSServiceApp.schema.mof | 22 +++---- .../MSFT_xSPCacheAccounts.psm1 | 17 +++--- .../MSFT_xSPCacheAccounts.schema.mof | 20 +++---- .../MSFT_xSPCreateFarm.psm1 | 21 +++---- .../MSFT_xSPCreateFarm.schema.mof | 2 +- .../MSFT_xSPDiagnosticLoggingSettings.psm1 | 17 +++--- ...FT_xSPDiagnosticLoggingSettings.schema.mof | 2 +- .../MSFT_xSPDistributedCacheService.psm1 | 26 ++++---- ...MSFT_xSPDistributedCacheService.schema.mof | 20 +++---- .../MSFT_xSPFeature/MSFT_xSPFeature.psm1 | 16 +++-- .../MSFT_xSPFeature.schema.mof | 20 +++---- .../MSFT_xSPInstallPrereqs.psm1 | 4 +- .../MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 | 18 +++--- .../MSFT_xSPJoinFarm.schema.mof | 2 +- .../MSFT_xSPManagedAccount.psm1 | 16 +++-- .../MSFT_xSPManagedAccount.schema.mof | 20 +++---- .../MSFT_xSPManagedMetaDataServiceApp.psm1 | 22 +++---- ...FT_xSPManagedMetaDataServiceApp.schema.mof | 2 +- .../MSFT_xSPManagedPath.psm1 | 16 +++-- .../MSFT_xSPManagedPath.schema.mof | 18 +++--- .../MSFT_xSPSearchServiceApp.psm1 | 22 +++---- .../MSFT_xSPSearchServiceApp.schema.mof | 20 +++---- .../MSFT_xSPSecureStoreServiceApp.psm1 | 24 ++++---- .../MSFT_xSPSecureStoreServiceApp.schema.mof | 36 +++++------ .../MSFT_xSPServiceAppPool.psm1 | 17 +++--- .../MSFT_xSPServiceAppPool.schema.mof | 16 ++--- .../MSFT_xSPServiceInstance.psm1 | 22 +++---- .../MSFT_xSPServiceInstance.schema.mof | 14 ++--- .../MSFT_xSPSite/MSFT_xSPSite.psm1 | 16 +++-- .../MSFT_xSPSite/MSFT_xSPSite.schema.mof | 38 ++++++------ .../MSFT_xSPStateServiceApp.psm1 | 16 +++-- .../MSFT_xSPStateServiceApp.schema.mof | 18 +++--- .../MSFT_xSPUsageApplication.psm1 | 22 +++---- .../MSFT_xSPUsageApplication.schema.mof | 30 +++++----- .../MSFT_xSPUserProfileServiceApp.psm1 | 17 +++--- .../MSFT_xSPUserProfileServiceApp.schema.mof | 30 +++++----- .../MSFT_xSPUserProfileSyncService.psm1 | 17 +++--- .../MSFT_xSPUserProfileSyncService.schema.mof | 16 ++--- .../MSFT_xSPWebApplication.psm1 | 17 +++--- .../MSFT_xSPWebApplication.schema.mof | 34 +++++------ .../xSharePoint.Util/xSharePoint.Util.psm1 | 59 ++++++++++++++----- Modules/xSharePoint/xSharePoint.psd1 | 4 +- .../xSharePoint/xSharePoint.Global.Tests.ps1 | 2 +- appveyor.yml | 4 +- 45 files changed, 425 insertions(+), 409 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 index bddba0030..1c13f3e6c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 @@ -12,16 +12,16 @@ function Get-TargetResource [System.String] $ApplicationPool, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting BCS service app '$Name'" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | Where-Object { $_.TypeName -eq "Business Data Connectivity Service Application" } @@ -37,7 +37,6 @@ function Get-TargetResource } } } - Remove-PSSession $session $result } @@ -63,16 +62,18 @@ function Set-TargetResource [System.String] $DatabaseServer, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -InstallAccount $InstallAccount - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + if ($result.Count -eq 0) { Write-Verbose -Message "Creating BCS Service Application $Name" - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $params.Remove("InstallAccount") | Out-Null New-SPBusinessDataCatalogServiceApplication @params | Out-Null @@ -81,7 +82,9 @@ function Set-TargetResource else { if ($ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating BCS Service Application $Name" - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | Where-Object { $_.TypeName -eq "Business Data Connectivity Service Application" } @@ -89,7 +92,6 @@ function Set-TargetResource } } } - Remove-PSSession $session } function Test-TargetResource @@ -114,7 +116,7 @@ function Test-TargetResource [System.String] $DatabaseServer, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.schema.mof index b3a14d9dc..08020d3ab 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.schema.mof @@ -1,11 +1,11 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xSPBCSServiceApp")] -class MSFT_xSPBCSServiceApp : OMI_BaseResource -{ - [Key] string Name; - [Required] String ApplicationPool; - [Write] string DatabaseName; - [Write] String DatabaseServer; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - + +[ClassVersion("1.0.0.0"), FriendlyName("xSPBCSServiceApp")] +class MSFT_xSPBCSServiceApp : OMI_BaseResource +{ + [Key] string Name; + [Required] String ApplicationPool; + [Write] string DatabaseName; + [Write] String DatabaseServer; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; +}; + diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 index bab0a0760..bf61fd9f7 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 @@ -16,16 +16,16 @@ function Get-TargetResource [System.String] $SuperReaderAlias, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting cache accounts for $WebAppUrl" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $wa = Get-SPWebApplication $params.WebAppUrl -ErrorAction SilentlyContinue @@ -46,7 +46,6 @@ function Get-TargetResource return $returnVal } - Remove-PSSession $session $result } @@ -68,16 +67,15 @@ function Set-TargetResource [System.String] $SuperReaderAlias, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Setting cache accounts for $WebAppUrl" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount - - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue $params = $args[0] @@ -95,7 +93,6 @@ function Set-TargetResource } $wa.Update() } - Remove-PSSession $session } @@ -117,7 +114,7 @@ function Test-TargetResource [System.String] $SuperReaderAlias, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.schema.mof index b02899b99..9ebdce416 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.schema.mof @@ -1,10 +1,10 @@ - -[ClassVersion("1.0.0.0"), FriendlyName("xSPCacheAccounts")] -class MSFT_xSPCacheAccounts : OMI_BaseResource -{ - [Key] string WebAppUrl; - [Required] string SuperUserAlias; - [Required] string SuperReaderAlias; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - + +[ClassVersion("1.0.0.0"), FriendlyName("xSPCacheAccounts")] +class MSFT_xSPCacheAccounts : OMI_BaseResource +{ + [Key] string WebAppUrl; + [Required] string SuperUserAlias; + [Required] string SuperReaderAlias; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; +}; + diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 index 6dd259930..ccde7368c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 @@ -16,7 +16,7 @@ function Get-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -34,9 +34,9 @@ function Get-TargetResource Write-Verbose -Message "Checking for local SP Farm" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ScriptBlock { try { $spFarm = Get-SPFarm -ErrorAction SilentlyContinue } catch { @@ -50,8 +50,7 @@ function Get-TargetResource } return $returnValue } - Remove-PSSession $session - $result + return $result } @@ -72,7 +71,7 @@ function Set-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -87,15 +86,14 @@ function Set-TargetResource [System.UInt32] $CentralAdministrationPort = 9999 ) - - $VerbosePreference = 'Continue' - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount if (-not $PSBoundParameters.ContainsKey("CentralAdministrationPort")) { $PSBoundParameters.Add("CentralAdministrationPort", 9999) } Write-Verbose -Message "Setting up new SharePoint farm" - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $params = Rename-xSharePointParamValue -params $params -oldName "FarmConfigDatabaseName" -newName "DatabaseName" @@ -122,7 +120,6 @@ function Set-TargetResource New-SPCentralAdministration -Port $caPort -WindowsAuthProvider NTLM Install-SPApplicationContent } - Remove-PSSession $session } @@ -144,7 +141,7 @@ function Test-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof index 0d04007d6..7d3767e44 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof @@ -5,7 +5,7 @@ class MSFT_xSPCreateFarm : OMI_BaseResource [Key] String FarmConfigDatabaseName; [Key] String DatabaseServer; [Required, EmbeddedInstance("MSFT_Credential")] String FarmAccount; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Required] String Passphrase; [Required] String AdminContentDatabaseName; [Write] uint32 CentralAdministrationPort; diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 index d60addf01..d25c0c185 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 @@ -12,15 +12,16 @@ function Get-TargetResource [System.UInt32] $LogSpaceInGB, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting diagnostic configuration settings" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount - $result = Invoke-Command -Session $session -ScriptBlock { + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $dc = Get-SPDiagnosticConfig -ErrorAction SilentlyContinue if ($null -eq $dc) { return @{} } @@ -46,7 +47,6 @@ function Get-TargetResource ScriptErrorReportingDelay = $dc.ScriptErrorReportingDelay } } - Remove-PSSession $session $result } @@ -112,16 +112,16 @@ function Set-TargetResource [System.Boolean] $ScriptErrorReportingRequireAuth = $true, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Setting diagnostic configuration settings" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $params.Remove("InstallAccount") | Out-Null @@ -130,7 +130,6 @@ function Set-TargetResource Set-SPDiagnosticConfig @params } - Remove-PSSession $session } @@ -196,7 +195,7 @@ function Test-TargetResource [System.Boolean] $ScriptErrorReportingRequireAuth = $true, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.schema.mof index 7a2665b76..26731d015 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.schema.mof @@ -20,6 +20,6 @@ class MSFT_xSPDiagnosticLoggingSettings : OMI_BaseResource [Write] uint32 ScriptErrorReportingDelay; [Write] boolean ScriptErrorReportingEnabled; [Write] boolean ScriptErrorReportingRequireAuth; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index 6eeaeeb46..0a241dc52 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -21,7 +21,7 @@ function Get-TargetResource [System.String] $ServiceAccount, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -32,9 +32,9 @@ function Get-TargetResource Write-Verbose -Message "Getting the cache host information" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ScriptBlock { try { Use-CacheCluster -ErrorAction SilentlyContinue @@ -53,7 +53,6 @@ function Get-TargetResource return @{} } } - Remove-PSSession $session $result } @@ -80,7 +79,7 @@ function Set-TargetResource [System.String] $ServiceAccount, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -89,13 +88,11 @@ function Set-TargetResource $CreateFirewallRules ) - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount - if ($Ensure -eq "Present") { Write-Verbose -Message "Adding the distributed cache to the server" if($createFirewallRules) { Write-Verbose -Message "Create a firewall rule for AppFabric" - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] Import-Module -Name NetSecurity @@ -116,13 +113,17 @@ function Set-TargetResource } Write-Verbose -Message "Firewall rule added" } - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] Add-xSharePointDistributedCacheServer -CacheSizeInMB $params.CacheSizeInMB -ServiceAccount $params.ServiceAccount } } else { Write-Verbose -Message "Removing distributed cache to the server" - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] Remove-xSharePointDistributedCacheServer } @@ -130,7 +131,7 @@ function Set-TargetResource $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distribute Cache" -ErrorAction SilentlyContinue if($null -eq $firewallRule) { Write-Verbose -Message "Disabling firewall rules." - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] Import-Module -Name NetSecurity Disable-NetFirewallRule -DisplayName -DisplayName "SharePoint Distribute Cache" @@ -138,7 +139,6 @@ function Set-TargetResource } Write-Verbose -Message "Distributed cache removed." } - Remove-PSSession $session } @@ -165,7 +165,7 @@ function Test-TargetResource [System.String] $ServiceAccount, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.schema.mof index ab0e255f3..eebec204a 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.schema.mof @@ -1,10 +1,10 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSPDistributedCacheService")] -class MSFT_xSPDistributedCacheService : OMI_BaseResource -{ - [Key] String Name; - [Required, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Required] UInt32 CacheSizeInMB; - [Required] String ServiceAccount; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; - [Required] Boolean CreateFirewallRules; -}; +[ClassVersion("1.0.0.0"), FriendlyName("xSPDistributedCacheService")] +class MSFT_xSPDistributedCacheService : OMI_BaseResource +{ + [Key] String Name; + [Required, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; + [Required] UInt32 CacheSizeInMB; + [Required] String ServiceAccount; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; + [Required] Boolean CreateFirewallRules; +}; diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 index f606d9eee..2c464f994 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 @@ -17,7 +17,7 @@ function Get-TargetResource [System.String] $Url, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -29,9 +29,9 @@ function Get-TargetResource Write-Verbose -Message "Getting feature $Name at $FeatureScope scope" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $feature = Get-SPFeature $params.Name -ErrorAction SilentlyContinue @@ -55,7 +55,6 @@ function Get-TargetResource Enabled = $enabled } } - Remove-PSSession $session $result } @@ -78,7 +77,7 @@ function Set-TargetResource [System.String] $Url, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -88,9 +87,9 @@ function Set-TargetResource $Ensure ) - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $runParams = @{} @@ -106,7 +105,6 @@ function Set-TargetResource Disable-SPFeature @runParams } } - Remove-PSSession $session } @@ -129,7 +127,7 @@ function Test-TargetResource [System.String] $Url, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.schema.mof index 51f3a890e..98cea1450 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.schema.mof @@ -1,10 +1,10 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSPFeature")] -class MSFT_xSPFeature : OMI_BaseResource -{ - [Key] string Name; - [Required, ValueMap{"Farm","WebApplication","Site","Web"}, Values{"Farm","WebApplication","Site","Web"}] string FeatureScope; - [Key] string Url; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; - [Required, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; -}; - +[ClassVersion("1.0.0.0"), FriendlyName("xSPFeature")] +class MSFT_xSPFeature : OMI_BaseResource +{ + [Key] string Name; + [Required, ValueMap{"Farm","WebApplication","Site","Web"}, Values{"Farm","WebApplication","Site","Web"}] string FeatureScope; + [Key] string Url; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; + [Required, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; +}; + diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 index 9429e566c..b71da1b4e 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 @@ -11,7 +11,7 @@ function Get-TargetResource $returnValue = @{} Write-Verbose -Message "Detecting SharePoint version from binaries" - $majorVersion = (Get-xSharePointAssemblyVerion -PathToAssembly $InstallerPath).Major + $majorVersion = (Get-xSharePointAssemblyVerion -PathToAssembly $InstallerPath) if ($majorVersion -eq 15) { Write-Verbose -Message "Version: SharePoint 2013" } @@ -99,7 +99,7 @@ function Set-TargetResource ) Write-Verbose -Message "Detecting SharePoint version from binaries" - $majorVersion = (Get-xSharePointAssemblyVerion -PathToAssembly $InstallerPath).Major + $majorVersion = (Get-xSharePointAssemblyVerion -PathToAssembly $InstallerPath) if ($majorVersion -eq 15) { Write-Verbose -Message "Version: SharePoint 2013" $requiredParams = @("SQLNCli","PowerShell","NETFX","IDFX","Sync","AppFabric","IDFX11","MSIPCClient","WCFDataServices","KB2671763","WCFDataServices56") diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 index 07ee69388..5920c0423 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 @@ -12,7 +12,7 @@ function Get-TargetResource [System.String] $DatabaseServer, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -23,9 +23,9 @@ function Get-TargetResource Write-Verbose -Message "Checking for local SP Farm" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ScriptBlock { try { $spFarm = Get-SPFarm -ErrorAction SilentlyContinue } catch { @@ -39,7 +39,6 @@ function Get-TargetResource } return $returnValue } - Remove-PSSession $session $result } @@ -57,7 +56,7 @@ function Set-TargetResource [System.String] $DatabaseServer, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -73,12 +72,13 @@ function Set-TargetResource ) Write-Verbose -Message "Joining existing farm configuration database" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount if ($PSBoundParameters.WaitTime -eq $null) { $PSBoundParameters.Add("WaitTime", $WaitTime) } if ($PSBoundParameters.WaitCount -eq $null) { $PSBoundParameters.Add("WaitCount", $WaitCount) } - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $loopCount = 0 @@ -121,8 +121,6 @@ function Set-TargetResource } } - Remove-PSSession $session - Write-Verbose -Message "Starting timer service" Start-Service -Name sptimerv4 @@ -148,7 +146,7 @@ function Test-TargetResource [System.String] $DatabaseServer, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof index d75a878b9..39c0506a2 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof @@ -3,7 +3,7 @@ class MSFT_xSPJoinFarm : OMI_BaseResource { [Key] string FarmConfigDatabaseName; [Key] string DatabaseServer; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Required] string Passphrase; [Write] uint32 WaitTime; [Write] uint32 WaitCount; diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 index 79fb41b03..c33387c95 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 @@ -8,7 +8,7 @@ function Get-TargetResource [System.Management.Automation.PSCredential] $Account, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -19,9 +19,9 @@ function Get-TargetResource Write-Verbose -Message "Checking for managed account $AccountName" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] try { @@ -40,7 +40,6 @@ function Get-TargetResource return @{ } } } - Remove-PSSession $session $result } @@ -54,7 +53,7 @@ function Set-TargetResource [System.Management.Automation.PSCredential] $Account, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -74,9 +73,9 @@ function Set-TargetResource Write-Verbose -Message "Setting managed account $AccountName" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $ma = Get-SPManagedAccount $params.Account.UserName -ErrorAction SilentlyContinue @@ -90,7 +89,6 @@ function Set-TargetResource Set-SPManagedAccount @params } - Remove-PSSession $session } @@ -104,7 +102,7 @@ function Test-TargetResource [System.Management.Automation.PSCredential] $Account, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.schema.mof index da732c95f..a0258492a 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.schema.mof @@ -1,10 +1,10 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSPManagedAccount")] -class MSFT_xSPManagedAccount : OMI_BaseResource -{ - [Key] string AccountName; - [Required, EmbeddedInstance("MSFT_Credential")] String Account; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; - [Write] Uint32 EmailNotification; - [Write] Uint32 PreExpireDays; - [Write] string Schedule; -}; +[ClassVersion("1.0.0.0"), FriendlyName("xSPManagedAccount")] +class MSFT_xSPManagedAccount : OMI_BaseResource +{ + [Key] string AccountName; + [Required, EmbeddedInstance("MSFT_Credential")] String Account; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; + [Write] Uint32 EmailNotification; + [Write] Uint32 PreExpireDays; + [Write] string Schedule; +}; diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 index e3cc5d2ca..b3cb8caaa 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 @@ -8,7 +8,7 @@ function Get-TargetResource [System.String] $Name, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -19,9 +19,9 @@ function Get-TargetResource Write-Verbose -Message "Getting managed metadata service application $Name" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | Where-Object { $_.TypeName -eq "Managed Metadata Service" } @@ -37,7 +37,6 @@ function Get-TargetResource } } } - Remove-PSSession $session $result } @@ -61,16 +60,18 @@ function Set-TargetResource [System.String] $DatabaseName = $null, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -InstallAccount $InstallAccount - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + if ($result.Count -eq 0) { Write-Verbose -Message "Creating Managed Metadata Service Application $Name" - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $params = Remove-xSharePointNullParamValues -Params $params $params.Remove("InstallAccount") | Out-Null @@ -84,7 +85,9 @@ function Set-TargetResource else { if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating Managed Metadata Service Application $Name" - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $params = Remove-xSharePointNullParamValues -Params $params $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | @@ -93,7 +96,6 @@ function Set-TargetResource } } } - Remove-PSSession $session } @@ -107,7 +109,7 @@ function Test-TargetResource [System.String] $Name, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.schema.mof index 987d9fe10..84f36e3db 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.schema.mof @@ -2,7 +2,7 @@ class MSFT_xSPManagedMetaDataServiceApp : OMI_BaseResource { [Key] string Name; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Required] string ApplicationPool; [Write] string DatabaseServer; [Write] string DatabaseName; diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 index 238d0d4c1..fc701ac82 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 @@ -8,7 +8,7 @@ function Get-TargetResource [System.String] $WebAppUrl, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -27,9 +27,9 @@ function Get-TargetResource Write-Verbose -Message "Looking up the managed path $RelativeUrl in $WebAppUrl" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] if ($params.HostHeader) { @@ -46,7 +46,6 @@ function Get-TargetResource PathType = $path.Type } } - Remove-PSSession $session $result } @@ -60,7 +59,7 @@ function Set-TargetResource [System.String] $WebAppUrl, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -79,9 +78,9 @@ function Set-TargetResource Write-Verbose -Message "Creating the managed path $RelativeUrl in $WebAppUrl" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] if ($params.HostHeader) { @@ -106,7 +105,6 @@ function Set-TargetResource New-SPManagedPath @newParams } } - Remove-PSSession $session } @@ -120,7 +118,7 @@ function Test-TargetResource [System.String] $WebAppUrl, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.schema.mof index ac20759ba..db74c22c0 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.schema.mof @@ -1,9 +1,9 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSPManagedPath")] -class MSFT_xSPManagedPath : OMI_BaseResource -{ - [Key] string WebAppUrl; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; - [Key] string RelativeUrl; - [Required] boolean Explicit; - [Required] boolean HostHeader; -}; +[ClassVersion("1.0.0.0"), FriendlyName("xSPManagedPath")] +class MSFT_xSPManagedPath : OMI_BaseResource +{ + [Key] string WebAppUrl; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; + [Key] string RelativeUrl; + [Required] boolean Explicit; + [Required] boolean HostHeader; +}; diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 index b1643c82c..ee6397fb1 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 @@ -12,16 +12,16 @@ function Get-TargetResource [System.String] $ApplicationPool, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting Search service application '$Name'" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | Where-Object { $_.TypeName -eq "Search Service Application" } @@ -37,7 +37,6 @@ function Get-TargetResource } } } - Remove-PSSession $session $result } @@ -61,16 +60,18 @@ function Set-TargetResource [System.String] $DatabaseName = $null, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -InstallAccount $InstallAccount - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + if ($result.Count -eq 0) { Write-Verbose -Message "Creating Search Service Application $Name" - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $params = Remove-xSharePointNullParamValues -Params $params $params.Remove("InstallAccount") | Out-Null @@ -85,7 +86,9 @@ function Set-TargetResource else { if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating Search Service Application $Name" - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $params = Remove-xSharePointNullParamValues -Params $params $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | @@ -94,7 +97,6 @@ function Set-TargetResource } } } - Remove-PSSession $session } @@ -118,7 +120,7 @@ function Test-TargetResource [System.String] $DatabaseName = $null, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.schema.mof index ac3ca476f..09d9cd3da 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.schema.mof @@ -1,10 +1,10 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSPSearchServiceApp")] -class MSFT_xSPSearchServiceApp : OMI_BaseResource -{ - [Key] string Name; - [Required] string ApplicationPool; - [Write] string DatabaseName; - [Write] string DatabaseServer; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - +[ClassVersion("1.0.0.0"), FriendlyName("xSPSearchServiceApp")] +class MSFT_xSPSearchServiceApp : OMI_BaseResource +{ + [Key] string Name; + [Required] string ApplicationPool; + [Write] string DatabaseName; + [Write] string DatabaseServer; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; +}; + diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 index 20cb9df35..e4a3761b0 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 @@ -16,16 +16,16 @@ function Get-TargetResource [System.Boolean] $AuditingEnabled, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting secure store service application '$Name'" - - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | Where-Object { $_.TypeName -eq "Secure Store Service Application" } @@ -41,7 +41,6 @@ function Get-TargetResource } } } - Remove-PSSession $session $result } @@ -90,16 +89,18 @@ function Set-TargetResource [System.Boolean] $Sharing = $true, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -AuditingEnabled $AuditingEnabled -InstallAccount $InstallAccount - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + if ($result.Count -eq 0) { Write-Verbose -Message "Creating Secure Store Service Application $Name" - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $params = Remove-xSharePointNullParamValues -Params $params $params.Remove("InstallAccount") | Out-Null @@ -113,7 +114,9 @@ function Set-TargetResource else { if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating Secure Store Service Application $Name" - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $params = Remove-xSharePointNullParamValues -Params $params $params.Remove("Name") | Out-Null @@ -125,7 +128,6 @@ function Set-TargetResource } } } - Remove-PSSession $session } @@ -174,7 +176,7 @@ function Test-TargetResource [System.Boolean] $Sharing = $true, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.schema.mof index c97a6ee2e..8b4bc052d 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.schema.mof @@ -1,18 +1,18 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSPSecureStoreServiceApp")] -class MSFT_xSPSecureStoreServiceApp : OMI_BaseResource -{ - [Key] string Name; - [Required] string ApplicationPool; - [Required] boolean AuditingEnabled; - [Write] uint32 AuditlogMaxSize; - [Write, EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; - [Write] string DatabaseName; - [Write] string DatabasePassword; - [Write] string DatabaseServer; - [Write] string DatabaseUsername; - [Write] string FailoverDatabaseServer; - [Write] boolean PartitionMode; - [Write] boolean Sharing; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - +[ClassVersion("1.0.0.0"), FriendlyName("xSPSecureStoreServiceApp")] +class MSFT_xSPSecureStoreServiceApp : OMI_BaseResource +{ + [Key] string Name; + [Required] string ApplicationPool; + [Required] boolean AuditingEnabled; + [Write] uint32 AuditlogMaxSize; + [Write, EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; + [Write] string DatabaseName; + [Write] string DatabasePassword; + [Write] string DatabaseServer; + [Write] string DatabaseUsername; + [Write] string FailoverDatabaseServer; + [Write] boolean PartitionMode; + [Write] boolean Sharing; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; +}; + diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 index f0eef4f16..2e4bc2d0e 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 @@ -12,16 +12,16 @@ function Get-TargetResource [System.String] $ServiceAccount, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting service application pool '$Name'" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $sap = Get-SPServiceApplicationPool $params.Name -ErrorAction SilentlyContinue @@ -32,7 +32,6 @@ function Get-TargetResource ProcessAccountName = $sap.ProcessAccountName } } - Remove-PSSession $session $result } @@ -50,15 +49,16 @@ function Set-TargetResource [System.String] $ServiceAccount, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Creating service application pool '$Name'" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $sap = Get-SPServiceApplicationPool $params.Name -ErrorAction SilentlyContinue @@ -70,7 +70,6 @@ function Set-TargetResource } } } - Remove-PSSession $session } @@ -88,7 +87,7 @@ function Test-TargetResource [System.String] $ServiceAccount, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.schema.mof index 14502fd96..6db5884ac 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.schema.mof @@ -1,8 +1,8 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSPServiceAppPool")] -class MSFT_xSPServiceAppPool : OMI_BaseResource -{ - [Key] string Name; - [Required] string ServiceAccount; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - +[ClassVersion("1.0.0.0"), FriendlyName("xSPServiceAppPool")] +class MSFT_xSPServiceAppPool : OMI_BaseResource +{ + [Key] string Name; + [Required] string ServiceAccount; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; +}; + diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 index 4c6eb0f53..35f9cef92 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 @@ -8,7 +8,7 @@ function Get-TargetResource [System.String] $Name, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -20,9 +20,9 @@ function Get-TargetResource Write-Verbose -Message "Getting service instance '$Name'" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq $params.Name } @@ -33,7 +33,6 @@ function Get-TargetResource Status = $si.Status } } - Remove-PSSession $session $result } @@ -47,7 +46,7 @@ function Set-TargetResource [System.String] $Name, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -57,12 +56,12 @@ function Set-TargetResource $Ensure ) - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount - if ($Ensure -eq "Present") { Write-Verbose -Message "Provisioning service instance '$Name'" - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq $params.Name } @@ -72,7 +71,9 @@ function Set-TargetResource } else { Write-Verbose -Message "Deprovioning service instance '$Name'" - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq $params.Name } @@ -80,7 +81,6 @@ function Set-TargetResource Stop-SPServiceInstance $si } } - Remove-PSSession $session } @@ -94,7 +94,7 @@ function Test-TargetResource [System.String] $Name, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.schema.mof index a590835ee..04d098e42 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.schema.mof @@ -1,7 +1,7 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSPServiceInstance")] -class MSFT_xSPServiceInstance : OMI_BaseResource -{ - [Key] string Name; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; - [Required, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; -}; +[ClassVersion("1.0.0.0"), FriendlyName("xSPServiceInstance")] +class MSFT_xSPServiceInstance : OMI_BaseResource +{ + [Key] string Name; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; + [Required, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; +}; diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 index 3b731aa52..ebfdda707 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 @@ -12,16 +12,16 @@ function Get-TargetResource [System.String] $OwnerAlias, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting site collection $Url" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $site = Get-SPSite $params.Url -ErrorAction SilentlyContinue @@ -33,7 +33,6 @@ function Get-TargetResource } } } - Remove-PSSession $session $result } @@ -84,16 +83,16 @@ function Set-TargetResource [System.String] $Template = $null, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Creating site collection $Url" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $params = Remove-xSharePointNullParamValues -Params $params $params.Remove("InstallAccount") | Out-Null @@ -104,7 +103,6 @@ function Set-TargetResource New-SPSite @params | Out-Null } } - Remove-PSSession $session } @@ -155,7 +153,7 @@ function Test-TargetResource [System.String] $Template = $null, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.schema.mof index 8ff98bf54..57f943d3a 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.schema.mof @@ -1,19 +1,19 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSPSite")] -class MSFT_xSPSite : OMI_BaseResource -{ - [Key] string Url; - [Required] string OwnerAlias; - [Write] uint32 CompatibilityLevel; - [Write] string ContentDatabase; - [Write] string Description; - [Write] string HostHeaderWebApplication; - [Write] uint32 Language; - [Write] string Name; - [Write] string OwnerEmail; - [Write] string QuotaTemplate; - [Write] string SecondaryEmail; - [Write] string SecondaryOwnerAlias; - [Write] string Template; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - +[ClassVersion("1.0.0.0"), FriendlyName("xSPSite")] +class MSFT_xSPSite : OMI_BaseResource +{ + [Key] string Url; + [Required] string OwnerAlias; + [Write] uint32 CompatibilityLevel; + [Write] string ContentDatabase; + [Write] string Description; + [Write] string HostHeaderWebApplication; + [Write] uint32 Language; + [Write] string Name; + [Write] string OwnerEmail; + [Write] string QuotaTemplate; + [Write] string SecondaryEmail; + [Write] string SecondaryOwnerAlias; + [Write] string Template; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; +}; + diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 index f35cbf366..da7439bd5 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 @@ -8,16 +8,16 @@ function Get-TargetResource [System.String] $Name, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting state service application '$Name'" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $app = Get-SPStateServiceApplication -Identity $params.Name -ErrorAction SilentlyContinue @@ -28,7 +28,6 @@ function Get-TargetResource Name = $app.DisplayName } } - Remove-PSSession $session $result } @@ -51,16 +50,16 @@ function Set-TargetResource [System.String] $DatabaseServer = $null, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Creating state service application $Name" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $params = Remove-xSharePointNullParamValues -Params $params @@ -75,7 +74,6 @@ function Set-TargetResource New-SPStateServiceDatabase @dbParams| New-SPStateServiceApplication -Name $params.Name | New-SPStateServiceApplicationProxy -DefaultProxyGroup } } - Remove-PSSession $session } @@ -98,7 +96,7 @@ function Test-TargetResource [System.String] $DatabaseServer = $null, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.schema.mof index 59710b578..83324d67e 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.schema.mof @@ -1,9 +1,9 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSPStateServiceApp")] -class MSFT_xSPStateServiceApp : OMI_BaseResource -{ - [Key] string Name; - [Write, EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; - [Write] string DatabaseName; - [Write] string DatabaseServer; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; +[ClassVersion("1.0.0.0"), FriendlyName("xSPStateServiceApp")] +class MSFT_xSPStateServiceApp : OMI_BaseResource +{ + [Key] string Name; + [Write, EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; + [Write] string DatabaseName; + [Write] string DatabaseServer; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; +}; diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 index fd48b750d..15f658b3b 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 @@ -8,16 +8,16 @@ function Get-TargetResource [System.String] $Name, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting usage application '$Name'" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | Where-Object { $_.TypeName -eq "Usage and Health Data Collection Service Application" } @@ -37,7 +37,6 @@ function Get-TargetResource } } } - Remove-PSSession $session $result } @@ -51,7 +50,7 @@ function Set-TargetResource [System.String] $Name, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, @@ -85,8 +84,9 @@ function Set-TargetResource Write-Verbose -Message "Setting usage application $Name" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $app = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue @@ -105,7 +105,9 @@ function Set-TargetResource } Write-Verbose -Message "Configuring usage application $Name" - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $params = Remove-xSharePointNullParamValues -Params $params @@ -117,8 +119,6 @@ function Set-TargetResource if ($params.ContainsKey("UsageLogMaxSpaceGB")) { $setParams.Add("UsageLogMaxSpaceGB", $params.UsageLogMaxSpaceGB) } Set-SPUsageService @setParams } - - Remove-PSSession $session } @@ -132,7 +132,7 @@ function Test-TargetResource [System.String] $Name, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.schema.mof index 06dcdb4f9..81c7bdd83 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.schema.mof @@ -1,15 +1,15 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSPUsageApplication")] -class MSFT_xSPUsageApplication : OMI_BaseResource -{ - [Key] string Name; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; - [Write] string DatabaseName; - [Write] string DatabasePassword; - [Write] string DatabaseServer; - [Write] string DatabaseUsername; - [Write] string FailoverDatabaseServer; - [Write] uint32 UsageLogCutTime; - [Write] string UsageLogLocation; - [Write] uint32 UsageLogMaxFileSizeKB; - [Write] uint32 UsageLogMaxSpaceGB; -}; +[ClassVersion("1.0.0.0"), FriendlyName("xSPUsageApplication")] +class MSFT_xSPUsageApplication : OMI_BaseResource +{ + [Key] string Name; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; + [Write] string DatabaseName; + [Write] string DatabasePassword; + [Write] string DatabaseServer; + [Write] string DatabaseUsername; + [Write] string FailoverDatabaseServer; + [Write] uint32 UsageLogCutTime; + [Write] string UsageLogLocation; + [Write] uint32 UsageLogMaxFileSizeKB; + [Write] uint32 UsageLogMaxSpaceGB; +}; diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 index a746bdb13..bc8c40f4c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 @@ -16,14 +16,14 @@ function Get-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting user profile service application $Name" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | Where-Object { $_.TypeName -eq "User Profile Service Application" } @@ -39,7 +39,6 @@ function Get-TargetResource } } } - Remove-PSSession $session $result } @@ -82,7 +81,7 @@ function Set-TargetResource [System.String] $SyncDBServer = $null, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) @@ -103,8 +102,9 @@ function Set-TargetResource ([ADSI]"WinNT://$computerName/Administrators,group").Add("WinNT://$domainName/$userName") | Out-Null } - $session = Get-xSharePointAuthenticatedPSSession -Credential $FarmAccount - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $params = Remove-xSharePointNullParamValues -Params $params $params.Remove("InstallAccount") | Out-Null @@ -128,7 +128,6 @@ function Set-TargetResource Write-Verbose -Message "Removing $domainName\$userName from local admin group" ([ADSI]"WinNT://$computerName/Administrators,group").Remove("WinNT://$domainName/$userName") | Out-Null } - Remove-PSSession $session } @@ -171,7 +170,7 @@ function Test-TargetResource [System.String] $SyncDBServer = $null, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.schema.mof index 213fbc484..6e5592696 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.schema.mof @@ -1,15 +1,15 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSPUserProfileServiceApp")] -class MSFT_xSPUserProfileServiceApp : OMI_BaseResource -{ - [Key] string Name; - [Required] string ApplicationPool; - [Required, EmbeddedInstance("MSFT_Credential")] String FarmAccount; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; - [Write] string MySiteHostLocation; - [Write] string ProfileDBName; - [Write] string ProfileDBServer; - [Write] string SocialDBName; - [Write] string SocialDBServer; - [Write] string SyncDBName; - [Write] string SyncDBServer; -}; +[ClassVersion("1.0.0.0"), FriendlyName("xSPUserProfileServiceApp")] +class MSFT_xSPUserProfileServiceApp : OMI_BaseResource +{ + [Key] string Name; + [Required] string ApplicationPool; + [Required, EmbeddedInstance("MSFT_Credential")] String FarmAccount; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; + [Write] string MySiteHostLocation; + [Write] string ProfileDBName; + [Write] string ProfileDBServer; + [Write] string SocialDBName; + [Write] string SocialDBServer; + [Write] string SyncDBName; + [Write] string SyncDBServer; +}; diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 index 670836e31..dcd5a2789 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 @@ -17,14 +17,15 @@ function Get-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting the local user profile sync service instance" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $computerName = $env:COMPUTERNAME @@ -37,7 +38,6 @@ function Get-TargetResource Status = $syncService.Status } } - Remove-PSSession $session $result } @@ -60,7 +60,7 @@ function Set-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) @@ -85,9 +85,9 @@ function Set-TargetResource Restart-Service -Name "SPTimerV4" } - $session = Get-xSharePointAuthenticatedPSSession -Credential $FarmAccount + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] $computerName = $env:COMPUTERNAME @@ -129,7 +129,6 @@ function Set-TargetResource { ([ADSI]"WinNT://$computerName/Administrators,group").Remove("WinNT://$domainName/$userName") | Out-Null } - Remove-PSSession $session } @@ -152,7 +151,7 @@ function Test-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.schema.mof index 7d198eb54..eef2f3df5 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.schema.mof @@ -1,8 +1,8 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSPUserProfileSyncService")] -class MSFT_xSPUserProfileSyncService : OMI_BaseResource -{ - [Key] string UserProfileServiceAppName; - [Required, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Required, EmbeddedInstance("MSFT_Credential")] String FarmAccount; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; +[ClassVersion("1.0.0.0"), FriendlyName("xSPUserProfileSyncService")] +class MSFT_xSPUserProfileSyncService : OMI_BaseResource +{ + [Key] string UserProfileServiceAppName; + [Required, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; + [Required, EmbeddedInstance("MSFT_Credential")] String FarmAccount; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; +}; diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 index 573887ac0..bac760aaa 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 @@ -20,15 +20,16 @@ function Get-TargetResource [System.String] $Url, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting web application '$Name'" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $wa = Get-SPWebApplication $params.Name -ErrorAction SilentlyContinue if ($null -eq $wa) { return @{} } @@ -39,7 +40,6 @@ function Get-TargetResource ApplicationPoolAccount = $wa.ApplicationPool.Username } } - Remove-PSSession $session $result } @@ -87,16 +87,16 @@ function Set-TargetResource [System.String] $Port = $null, - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Creating web application '$Name'" - $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock { $params = $args[0] if ($AuthenticationMethod -eq "NTLM") { @@ -119,7 +119,6 @@ function Set-TargetResource New-SPWebApplication @params } } - Remove-PSSession $session } @@ -168,7 +167,7 @@ function Test-TargetResource $Port = $null, [System.Management.Automation.PSCredential] - [parameter(Mandatory = $true)] + [parameter(Mandatory = $false)] $InstallAccount ) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.schema.mof index c2e0de5da..fc82bdb44 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.schema.mof @@ -1,17 +1,17 @@ -[ClassVersion("1.0.0.0"), FriendlyName("xSPWebApplication")] -class MSFT_xSPWebApplication : OMI_BaseResource -{ - [Key] string Name; - [Required] string ApplicationPool; - [Required] string ApplicationPoolAccount; - [Required] string Url; - [Write] boolean AllowAnonymous; - [Write, ValueMap{"NTLM","Kerberos"}, Values{"NTLM","Kerberos"}] string AuthenticationMethod; - [Write] string DatabaseName; - [Write] string DatabaseServer; - [Write] string HostHeader; - [Write] string Path; - [Write] string Port; - [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount; -}; - +[ClassVersion("1.0.0.0"), FriendlyName("xSPWebApplication")] +class MSFT_xSPWebApplication : OMI_BaseResource +{ + [Key] string Name; + [Required] string ApplicationPool; + [Required] string ApplicationPoolAccount; + [Required] string Url; + [Write] boolean AllowAnonymous; + [Write, ValueMap{"NTLM","Kerberos"}, Values{"NTLM","Kerberos"}] string AuthenticationMethod; + [Write] string DatabaseName; + [Write] string DatabaseServer; + [Write] string HostHeader; + [Write] string Path; + [Write] string Port; + [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; +}; + diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 7ad790cd1..fbf427624 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -1,25 +1,56 @@ -function Get-xSharePointAuthenticatedPSSession() { +function Invoke-xSharePointCommand() { [CmdletBinding()] param ( - [parameter(Mandatory = $true,Position=1)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] - $Credential + $Credential, + + [parameter(Mandatory = $false)] + [System.Collections.Generic.Dictionary`2[System.String,System.Object]] + $Arguments, + + [parameter(Mandatory = $true)] + [ScriptBlock] + $ScriptBlock ) - #Running garbage collection to resolve issues related to Azure DSC extention use - [GC]::Collect() + $VerbosePreference = 'Continue' - Write-Verbose -Message "Creating new PowerShell session" - $session = New-PSSession -ComputerName $env:COMPUTERNAME -Credential $Credential -Authentication CredSSP -Name "Microsoft.SharePoint.DSC" -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -OperationTimeout 0 -IdleTimeout 60000) - Invoke-Command -Session $session -ScriptBlock { - if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) - { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" + $invokeArgs = @{ + ScriptBlock = $ScriptBlock + } + if ($null -ne $Arguments) { + $invokeArgs.Add("ArgumentList", $Arguments) + } + + if ($null -eq $Credential) { + if ($Env:USERNAME.Contains("$")) { + throw [Exception] "You need to specify a value for either InstallAccount or PsDscRunAsCredential." + return + } + Write-Verbose "Executing as the local run as user $($Env:USERDOMAIN)\$($Env:USERNAME)" + } else { + if (-not $Env:USERNAME.Contains("$")) { + throw [Exception] "Unable to use both InstallAccount and PsDscRunAsCredential in a single resource. Remove one and try again." + return } - $VerbosePreference = 'Continue' + Write-Verbose "Executing using a provided credential and local PSSession as user $($Credential.UserName)" + + #Running garbage collection to resolve issues related to Azure DSC extention use + [GC]::Collect() + + $session = New-PSSession -ComputerName $env:COMPUTERNAME -Credential $Credential -Authentication CredSSP -Name "Microsoft.SharePoint.DSC" -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -OperationTimeout 0 -IdleTimeout 60000) + $invokeArgs.Add("Session", $session) + } + + $result = Invoke-Command @invokeArgs + + return $result + + if ($invokeArgs.ContainsKey("Session")) { + Remove-PSSession $invokeArgs.Session } - return $session } function Rename-xSharePointParamValue() { @@ -66,7 +97,7 @@ function Get-xSharePointAssemblyVerion() { [parameter(Mandatory = $true,Position=1)] $PathToAssembly ) - return (Get-Command $PathToAssembly).Version + return (Get-Command $PathToAssembly).FileVersionInfo.FileMajorPart } Export-ModuleMember -Function * diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1 index 618fdd2df..3e8205fc9 100644 --- a/Modules/xSharePoint/xSharePoint.psd1 +++ b/Modules/xSharePoint/xSharePoint.psd1 @@ -12,7 +12,7 @@ # RootModule = '' # Version number of this module. -ModuleVersion = '0.5.0' +ModuleVersion = '0.6.0' # ID used to uniquely identify this module GUID = '6c1176a0-4fac-4134-8ca2-3fa8a21a7b90' @@ -72,7 +72,7 @@ FunctionsToExport = '*' # Cmdlets to export from this module CmdletsToExport = @("Add-xSharePointDistributedCacheServer", "Remove-xSharePointDistributedCacheServer", - "Get-xSharePointAuthenticatedPSSession", + "Invoke-xSharePointCommand", "Rename-xSharePointParamValue", "Remove-xSharePointNullParamValues") diff --git a/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 b/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 index 35b8102ec..4c6b4fe5c 100644 --- a/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 @@ -24,7 +24,7 @@ Describe 'xSharePoint Global Tests' { $mofFiles | % { $fileHasInstallAccount = $false Get-Content $_.FullName | % { - if ($_.IndexOf("[Required, EmbeddedInstance(`"MSFT_Credential`")] String InstallAccount;") -gt 0) { $fileHasInstallAccount = $true } + if ($_.IndexOf("[Write, EmbeddedInstance(`"MSFT_Credential`")] String InstallAccount;") -gt 0) { $fileHasInstallAccount = $true } } if (-not $fileHasInstallAccount -and $_.Name -ne "MSFT_xSPInstall.schema.mof" ` -and $_.Name -ne "MSFT_xSPClearRemoteSessions.schema.mof" ` diff --git a/appveyor.yml b/appveyor.yml index 3abd1fc50..9874fd9fb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 0.5.0.{build} +version: 0.6.0.{build} install: - cinst -y pester @@ -25,7 +25,7 @@ after_test: Remove-Item (Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.pssproj") $manifest = Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.psd1" - (Get-Content $manifest -Raw).Replace("0.5.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest + (Get-Content $manifest -Raw).Replace("0.6.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest Add-Type -assemblyname System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::CreateFromDirectory("$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint", "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip") Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } From f082458d0f3f021dd20026a834009fc063cf5e72 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 4 Sep 2015 09:19:21 +1200 Subject: [PATCH 011/146] Added support for PsDscRunAsCredential in PowerShell 5 --- .../MSFT_xSPUserProfileServiceApp.psm1 | 2 ++ .../xSharePoint.Util/xSharePoint.Util.psm1 | 15 +++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 index bc8c40f4c..5b7b891ef 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 @@ -24,6 +24,8 @@ function Get-TargetResource Write-Verbose -Message "Getting user profile service application $Name" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue + $params = $args[0] $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | Where-Object { $_.TypeName -eq "User Profile Service Application" } diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index fbf427624..b06ebfa3a 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -30,6 +30,9 @@ function Invoke-xSharePointCommand() { return } Write-Verbose "Executing as the local run as user $($Env:USERDOMAIN)\$($Env:USERNAME)" + + $result = Invoke-Command @invokeArgs + return $result } else { if (-not $Env:USERNAME.Contains("$")) { throw [Exception] "Unable to use both InstallAccount and PsDscRunAsCredential in a single resource. Remove one and try again." @@ -41,15 +44,11 @@ function Invoke-xSharePointCommand() { [GC]::Collect() $session = New-PSSession -ComputerName $env:COMPUTERNAME -Credential $Credential -Authentication CredSSP -Name "Microsoft.SharePoint.DSC" -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -OperationTimeout 0 -IdleTimeout 60000) - $invokeArgs.Add("Session", $session) - } - - $result = Invoke-Command @invokeArgs - - return $result + + $result = Invoke-Command @invokeArgs -Session $session - if ($invokeArgs.ContainsKey("Session")) { - Remove-PSSession $invokeArgs.Session + Remove-PSSession $session + return $result } } From 0d6ef779971ebbb7f26aaa94826acc89fbdd587f Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 4 Sep 2015 10:30:30 +1200 Subject: [PATCH 012/146] Updated ignore file --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f230d84b7..e032e3d9e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.suo -*.user \ No newline at end of file +*.user +*.coverage \ No newline at end of file From d954f7ef733352a0685132284694b6549ee26899 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 4 Sep 2015 10:41:57 +1200 Subject: [PATCH 013/146] Switching build number forward in the version number --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 9874fd9fb..8c4e7d947 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 0.6.0.{build} +version: 0.6.{build}.0 install: - cinst -y pester From 47951d72417ffd22dac4d8a5ed4cda9d5f4f70fb Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 4 Sep 2015 22:41:24 +1000 Subject: [PATCH 014/146] Created util functions and updated create farm for testing --- .../MSFT_xSPBCSServiceApp.psm1 | 66 +++++++++------ .../MSFT_xSPCreateFarm.psm1 | 68 +++++++-------- .../xSharePoint.ServiceApplications.psm1 | 33 ++++++++ .../xSharePoint.Util/xSharePoint.Util.psm1 | 49 ++++++++++- Modules/xSharePoint/xSharePoint.psd1 | 7 +- Modules/xSharePoint/xSharePoint.pssproj | 2 + .../xSharePoint.xSPCreateFarm.Tests.ps1 | 83 ++++++++++++++++++- 7 files changed, 247 insertions(+), 61 deletions(-) create mode 100644 Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 index 1c13f3e6c..6cb09cf2b 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 @@ -12,6 +12,14 @@ function Get-TargetResource [System.String] $ApplicationPool, + [parameter(Mandatory = $true)] + [System.String] + $DatabaseName, + + [parameter(Mandatory = $true)] + [System.String] + $DatabaseServer, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount @@ -20,24 +28,29 @@ function Get-TargetResource Write-Verbose -Message "Getting BCS service app '$Name'" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | - Where-Object { $_.TypeName -eq "Business Data Connectivity Service Application" } - If ($null -eq $serviceApp) + try { - return @{} - } - else - { - return @{ - Name = $serviceApp.DisplayName - ApplicationPool = $serviceApp.ApplicationPool.Name + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName BCS + + If ($null -eq $serviceApp) + { + return @{} + } + else + { + return @{ + Name = $serviceApp.DisplayName + ApplicationPool = $serviceApp.ApplicationPool.Name + } } + } + catch + { + return @{ } } } - $result + return $result } @@ -67,28 +80,33 @@ function Set-TargetResource $InstallAccount ) - $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -InstallAccount $InstallAccount + $result = Get-TargetResource @PSBoundParameters if ($result.Count -eq 0) { Write-Verbose -Message "Creating BCS Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $params.Remove("InstallAccount") | Out-Null - New-SPBusinessDataCatalogServiceApplication @params | Out-Null + Invoke-xSharePointSPCmdlet -CmdletName "New-SPBusinessDataCatalogServiceApplication" -Arguments @{ + Name = $params.Name + ApplicationPool = $params.ApplicationPool + DatabaseName = $params.DatabaseName + DatabaseServer = $params.DatabaseServer + } } } else { if ($ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating BCS Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | - Where-Object { $_.TypeName -eq "Business Data Connectivity Service Application" } - $serviceApp | Set-SPBusinessDataCatalogServiceApplication -ApplicationPool (Get-SPServiceApplicationPool $params.ApplicationPool) + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName BCS + $appPool = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" @{ + Identity = $params.ApplicationPool + } + Invoke-xSharePointSPCmdlet -CmdletName "Set-SPBusinessDataCatalogServiceApplication" -Arguments @{ + Identity = $serviceApp + ApplicationPool = $appPool + } } } } @@ -120,7 +138,7 @@ function Test-TargetResource [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -InstallAccount $InstallAccount + $result = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for BCS Service Application '$Name'" if ($result.Count -eq 0) { return $false } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 index ccde7368c..41ac9c1ea 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 @@ -28,6 +28,7 @@ function Get-TargetResource [System.String] $AdminContentDatabaseName, + [parameter(Mandatory = $false)] [System.UInt32] $CentralAdministrationPort ) @@ -35,10 +36,8 @@ function Get-TargetResource Write-Verbose -Message "Checking for local SP Farm" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - try { - $spFarm = Get-SPFarm -ErrorAction SilentlyContinue + $spFarm = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFarm" } catch { Write-Verbose -Message "Unable to detect local farm." } @@ -53,7 +52,6 @@ function Get-TargetResource return $result } - function Set-TargetResource { [CmdletBinding()] @@ -83,46 +81,48 @@ function Set-TargetResource [System.String] $AdminContentDatabaseName, + [parameter(Mandatory = $false)] [System.UInt32] - $CentralAdministrationPort = 9999 + $CentralAdministrationPort ) if (-not $PSBoundParameters.ContainsKey("CentralAdministrationPort")) { $PSBoundParameters.Add("CentralAdministrationPort", 9999) } - Write-Verbose -Message "Setting up new SharePoint farm" - $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $params = Rename-xSharePointParamValue -params $params -oldName "FarmConfigDatabaseName" -newName "DatabaseName" - $params = Rename-xSharePointParamValue -params $params -oldName "FarmAccount" -newName "FarmCredentials" - $params = Rename-xSharePointParamValue -params $params -oldName "AdminContentDatabaseName" -newName "AdministrationContentDatabaseName" - $params.Passphrase = (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) - $params.Remove("InstallAccount") - - $caPort = $params.CentralAdministrationPort - $params.Remove("CentralAdministrationPort") - - if (Test-Path -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.dll") { - Write-Verbose -Message "Detected Version: SharePoint 2016" - $params.Add("LocalServerRole", "Custom") - } else { - Write-Verbose -Message "Detected Version: SharePoint 2013" + $newFarmArgs = @{ + DatabaseServer = $params.DatabaseServer + DatabaseName = $params.FarmConfigDatabaseName + FarmCredentials = $params.FarmAccount + AdministrationContentDatabaseName = $params.AdminContentDatabaseName + Passphrase = (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) + SkipRegisterAsDistributedCacheHost = $true + } + + switch((Get-xSharePointInstalledProductVersion).FileMajorPart) { + 15 { + Write-Verbose -Message "Detected Version: SharePoint 2013" + } + 16 { + Write-Verbose -Message "Detected Version: SharePoint 2016" + $newFarmArgs.Add("LocalServerRole", "Custom") + } + Default { + throw [Exception] "An unknown version of SharePoint (Major version $_) was detected. Only versions 15 (SharePoint 2013) or 16 (SharePoint 2016) are supported." + } } - New-SPConfigurationDatabase @params -SkipRegisterAsDistributedCacheHost:$true - Install-SPHelpCollection -All - Initialize-SPResourceSecurity - Install-SPService - Install-SPFeature -AllExistingFeatures -Force - New-SPCentralAdministration -Port $caPort -WindowsAuthProvider NTLM - Install-SPApplicationContent + Invoke-xSharePointSPCmdlet -CmdletName "New-SPConfigurationDatabase" -Arguments $newFarmArgs + Invoke-xSharePointSPCmdlet -CmdletName "Install-SPHelpCollection" -Arguments @{ All = $true } + Invoke-xSharePointSPCmdlet -CmdletName "Initialize-SPResourceSecurity" + Invoke-xSharePointSPCmdlet -CmdletName "Install-SPService" + Invoke-xSharePointSPCmdlet -CmdletName "Install-SPFeature" -Arguments @{ AllExistingFeatures = $true; Force = $true } + Invoke-xSharePointSPCmdlet -CmdletName "New-SPCentralAdministration" -Arguments @{ Port = $params.CentralAdministrationPort; WindowsAuthProvider = "NTLM" } + Invoke-xSharePointSPCmdlet -CmdletName "Install-SPApplicationContent" } } - function Test-TargetResource { [CmdletBinding()] @@ -153,15 +153,15 @@ function Test-TargetResource [System.String] $AdminContentDatabaseName, + [parameter(Mandatory = $false)] [System.UInt32] - $CentralAdministrationPort = 9999 + $CentralAdministrationPort ) - $result = Get-TargetResource -FarmConfigDatabaseName $FarmConfigDatabaseName -DatabaseServer $DatabaseServer -FarmAccount $FarmAccount -InstallAccount $InstallAccount -Passphrase $Passphrase -AdminContentDatabaseName $AdminContentDatabaseName -CentralAdministrationPort $CentralAdministrationPort + $result = Get-TargetResource @PSBoundParameters if ($result.Count -eq 0) { return $false } return $true } - Export-ModuleMember -Function *-TargetResource diff --git a/Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 b/Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 new file mode 100644 index 000000000..e21ea9fa5 --- /dev/null +++ b/Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 @@ -0,0 +1,33 @@ +function Get-xSharePointServiceApplication() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + [string] + $Name, + + [parameter(Mandatory = $true,Position=2)] + [ValidateSet("BCS")] + [string] + $TypeName + ) + + $serviceApps = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplication" -Arguments @{ Name = $Name } + $serviceApp = $serviceApps | Where-Object { $_.TypeName -eq (Get-xSharePointServiceApplicationName -Name $TypeName) } + return $serviceApp +} + +function Get-xSharePointServiceApplicationName() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + [string] + $Name + ) + Switch($Name) { + "BCS" { return "Business Data Connectivity Service Application" } + } +} + +Export-ModuleMember -Function * diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index b06ebfa3a..b1219ae09 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -7,7 +7,7 @@ function Invoke-xSharePointCommand() { $Credential, [parameter(Mandatory = $false)] - [System.Collections.Generic.Dictionary`2[System.String,System.Object]] + [HashTable] $Arguments, [parameter(Mandatory = $true)] @@ -52,6 +52,46 @@ function Invoke-xSharePointCommand() { } } +function Invoke-xSharePointSPCmdlet() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + [string] + $CmdletName, + + [parameter(Mandatory = $false,Position=2)] + [HashTable] + $Arguments + ) + + Write-Verbose "Preparing to execute SharePoint command - $CmdletName" + + if ($null -ne $Arguments) { + $argumentsString = "" + $Arguments.Keys | ForEach-Object { + $argumentsString += "$($_): $($Arguments.$_); " + } + Write-Verbose "Arguments for $CmdletName - $argumentsString" + } + + $script = ([scriptblock]::Create("Ensure-xSharePointSnapinLoaded; `$params = `$args[0]; $CmdletName @params; `$params = `$null")) + if ($null -eq $Arguments) { + $result = Invoke-Command -ScriptBlock $script -NoNewScope + } else { + $result = Invoke-Command -ScriptBlock $script -ArgumentList $Arguments -NoNewScope + } + return $result +} + +function Ensure-xSharePointSnapinLoaded() { + if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) + { + Write-Verbose "Loading SharePoint PowerShell snapin" + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" + } +} + function Rename-xSharePointParamValue() { [CmdletBinding()] param @@ -89,11 +129,18 @@ function Remove-xSharePointNullParamValues() { return $Params } +function Get-xSharePointInstalledProductVersion() { + $pathToSearch = "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\*\ISAPI\Microsoft.SharePoint.dll" + $fullPath = Get-Item $pathToSearch | Sort-Object { $_.Directory } -Descending | Select-Object -First 1 + return (Get-Command $fullPath).FileVersionInfo +} + function Get-xSharePointAssemblyVerion() { [CmdletBinding()] param ( [parameter(Mandatory = $true,Position=1)] + [string] $PathToAssembly ) return (Get-Command $PathToAssembly).FileVersionInfo.FileMajorPart diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1 index 3e8205fc9..00ae74f2d 100644 --- a/Modules/xSharePoint/xSharePoint.psd1 +++ b/Modules/xSharePoint/xSharePoint.psd1 @@ -64,6 +64,7 @@ Description = 'This DSC module is used to deploy and configure SharePoint Server # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess NestedModules = @("modules\xSharePoint.DistributedCache\xSharePoint.DistributedCache.psm1", + "modules\xSharePoint.ServiceApplications\xSharePoint.ServiceApplications.psm1", "modules\xSharePoint.Util\xSharePoint.Util.psm1") # Functions to export from this module @@ -73,8 +74,12 @@ FunctionsToExport = '*' CmdletsToExport = @("Add-xSharePointDistributedCacheServer", "Remove-xSharePointDistributedCacheServer", "Invoke-xSharePointCommand", + "Ensure-xSharePointSnapinLoaded", + "Get-xSharePointInstalledProductVersion", + "Invoke-xSharePointSPCmdlet", "Rename-xSharePointParamValue", - "Remove-xSharePointNullParamValues") + "Remove-xSharePointNullParamValues", + "Get-xSharePointServiceApplication") # Variables to export from this module VariablesToExport = '*' diff --git a/Modules/xSharePoint/xSharePoint.pssproj b/Modules/xSharePoint/xSharePoint.pssproj index c4d2f6412..4725d3a3f 100644 --- a/Modules/xSharePoint/xSharePoint.pssproj +++ b/Modules/xSharePoint/xSharePoint.pssproj @@ -75,6 +75,7 @@ + @@ -124,6 +125,7 @@ + diff --git a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 index 530206fdf..d16c78866 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 @@ -20,11 +20,19 @@ Describe "xSPCreateFarm" { FarmConfigDatabaseName = "SP_Config" DatabaseServer = "DatabaseServer\Instance" FarmAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) Passphrase = "passphrase" AdminContentDatabaseName = "Admin_Content" } + Context "Validate get method" { + It "Calls SP Farm to find the local environment settings" { + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter {$CmdletName -eq "Get-SPFarm"} + $results = Get-TargetResource @testParams + $results.Count | Should Be 0 + Assert-VerifiableMocks + } + } + Context "Validate test method" { It "Fails when local server is not in a farm" { Mock -ModuleName $ModuleName Get-TargetResource { return @{} } @@ -39,5 +47,78 @@ Describe "xSPCreateFarm" { Test-TargetResource @testParams | Should Be $true } } + + Context "Validate set method" { + It "Creates a new SharePoint 2016 farm" { + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPConfigurationDatabase" -and $Arguments.ContainsKey("LocalServerRole") } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPHelpCollection" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Initialize-SPResourceSecurity" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPService" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPFeature" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPCentralAdministration" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPApplicationContent" } + + Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 16 } } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + + It "Creates a new SharePoint 2013 farm" { + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPConfigurationDatabase" -and (-not $Arguments.ContainsKey("LocalServerRole")) } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPHelpCollection" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Initialize-SPResourceSecurity" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPService" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPFeature" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPCentralAdministration" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPApplicationContent" } + + Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 15 } } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + + It "Throws an exception for unsupported SharePoint versions" { + Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 1 } } + + { Set-TargetResource @testParams } | Should throw + } + + It "Uses a default port for central admin when none is provided" { + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPConfigurationDatabase" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPHelpCollection" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Initialize-SPResourceSecurity" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPService" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPFeature" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPCentralAdministration" -and $Arguments.Port -eq 9999 } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPApplicationContent" } + + Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 15 } } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + + $testParams.Add("CentralAdministrationPort", 1234) + It "Uses a the specified port for central admin when it is provided" { + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPConfigurationDatabase" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPHelpCollection" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Initialize-SPResourceSecurity" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPService" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPFeature" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPCentralAdministration" -and $Arguments.Port -eq 1234 } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPApplicationContent" } + + Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 15 } } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + } } } \ No newline at end of file From 8ba984e7efe94b399a1092ce8f79290c8d3d3be0 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 4 Sep 2015 22:48:43 +1000 Subject: [PATCH 015/146] Testing fix for module discovery on build server --- Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 index d16c78866..a3895bd50 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 @@ -12,6 +12,7 @@ Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path $ModuleName = "MSFT_xSPCreateFarm" +Import-Module (Join-Path $RepoRoot "Modules\xSharePoint") Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") Describe "xSPCreateFarm" { @@ -81,7 +82,7 @@ Describe "xSPCreateFarm" { Assert-VerifiableMocks } - It "Throws an exception for unsupported SharePoint versions" { + It "Throws an exception for unsupported SharePoint versions" { Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 1 } } { Set-TargetResource @testParams } | Should throw From d7056d4e6222fde4a69e21a65aeacf0b1ab87ce6 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 4 Sep 2015 22:52:48 +1000 Subject: [PATCH 016/146] Renamed verb on cmdlet to set up PS snapin --- .../Modules/xSharePoint.Util/xSharePoint.Util.psm1 | 4 ++-- Modules/xSharePoint/xSharePoint.psd1 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index b1219ae09..150dad8e2 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -75,7 +75,7 @@ function Invoke-xSharePointSPCmdlet() { Write-Verbose "Arguments for $CmdletName - $argumentsString" } - $script = ([scriptblock]::Create("Ensure-xSharePointSnapinLoaded; `$params = `$args[0]; $CmdletName @params; `$params = `$null")) + $script = ([scriptblock]::Create("Initialize-xSharePointPSSnapin; `$params = `$args[0]; $CmdletName @params; `$params = `$null")) if ($null -eq $Arguments) { $result = Invoke-Command -ScriptBlock $script -NoNewScope } else { @@ -84,7 +84,7 @@ function Invoke-xSharePointSPCmdlet() { return $result } -function Ensure-xSharePointSnapinLoaded() { +function Initialize-xSharePointPSSnapin() { if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) { Write-Verbose "Loading SharePoint PowerShell snapin" diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1 index 00ae74f2d..5c93201c8 100644 --- a/Modules/xSharePoint/xSharePoint.psd1 +++ b/Modules/xSharePoint/xSharePoint.psd1 @@ -74,7 +74,7 @@ FunctionsToExport = '*' CmdletsToExport = @("Add-xSharePointDistributedCacheServer", "Remove-xSharePointDistributedCacheServer", "Invoke-xSharePointCommand", - "Ensure-xSharePointSnapinLoaded", + "Initialize-xSharePointPSSnapin", "Get-xSharePointInstalledProductVersion", "Invoke-xSharePointSPCmdlet", "Rename-xSharePointParamValue", From 841009155251b78b73f19aee890aca0d760251ab Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 4 Sep 2015 23:35:26 +1000 Subject: [PATCH 017/146] Updated BCS service app and tests --- .../MSFT_xSPBCSServiceApp.psm1 | 2 +- .../xSharePoint.xSPBCSServiceApp.Tests.ps1 | 43 ++++++++++++++++++- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 index 6cb09cf2b..7070c92d8 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 @@ -99,7 +99,7 @@ function Set-TargetResource Write-Verbose -Message "Updating BCS Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName BCS + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName "BCS" $appPool = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" @{ Identity = $params.ApplicationPool } diff --git a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 index dbf2952ac..29c46995f 100644 --- a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 @@ -12,6 +12,7 @@ Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path $ModuleName = "MSFT_xSPBCSServiceApp" +Import-Module (Join-Path $RepoRoot "Modules\xSharePoint") Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") Describe "xSPBCSServiceApp" { @@ -21,7 +22,20 @@ Describe "xSPBCSServiceApp" { ApplicationPool = "Test App Pool" DatabaseName = "Test_DB" DatabaseServer = "TestServer\Instance" - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) + } + + Context "Validate get method" { + It "Calls the service application picker with the appropriate type name" { + Mock Get-xSharePointServiceApplication { return @{ + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } + } } -Verifiable -ParameterFilter {$Name -eq $testParams.Name -and $TypeName -eq "BCS"} + + $results = Get-TargetResource @testParams + $results.Count | Should Be 2 + + Assert-VerifiableMocks + } } Context "Validate test method" { @@ -48,5 +62,30 @@ Describe "xSPBCSServiceApp" { Test-TargetResource @testParams | Should Be $false } } + + Context "Validate set method" { + It "Creates a new service application" { + Mock Get-TargetResource { return @{} } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPBusinessDataCatalogServiceApplication" } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + + It "Updates an existing service application" { + Mock Get-TargetResource { return @{ Name = $testParams.Name; ApplicationPool = "Wrong app pool" } } + Mock Get-xSharePointServiceApplication { return @{ + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } + } } -Verifiable -ParameterFilter {$Name -eq $testParams.Name -and $TypeName -eq "BCS"} + Mock Invoke-xSharePointSPCmdlet { return @{ Name = $testParams.ApplicationPool } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplicationPool" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPBusinessDataCatalogServiceApplication" } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + } } -} \ No newline at end of file +} From 8801db5d02a5633b6c193b7549d50ba40d45cc44 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 4 Sep 2015 23:45:33 +1000 Subject: [PATCH 018/146] Fix to call SP cmdlets without arguments --- .../Modules/xSharePoint.Util/xSharePoint.Util.psm1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 150dad8e2..e0469bb23 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -67,7 +67,7 @@ function Invoke-xSharePointSPCmdlet() { Write-Verbose "Preparing to execute SharePoint command - $CmdletName" - if ($null -ne $Arguments) { + if ($null -ne $Arguments -and $Arguments.Count -gt 0) { $argumentsString = "" $Arguments.Keys | ForEach-Object { $argumentsString += "$($_): $($Arguments.$_); " @@ -75,10 +75,11 @@ function Invoke-xSharePointSPCmdlet() { Write-Verbose "Arguments for $CmdletName - $argumentsString" } - $script = ([scriptblock]::Create("Initialize-xSharePointPSSnapin; `$params = `$args[0]; $CmdletName @params; `$params = `$null")) if ($null -eq $Arguments) { + $script = ([scriptblock]::Create("Initialize-xSharePointPSSnapin; $CmdletName; `$params = `$null")) $result = Invoke-Command -ScriptBlock $script -NoNewScope } else { + $script = ([scriptblock]::Create("Initialize-xSharePointPSSnapin; `$params = `$args[0]; $CmdletName @params; `$params = `$null")) $result = Invoke-Command -ScriptBlock $script -ArgumentList $Arguments -NoNewScope } return $result From 50af069d497ca8dca7ecbfe746330ae404f300a0 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sat, 5 Sep 2015 01:35:01 +1000 Subject: [PATCH 019/146] Updated managed account resource and tests to new model --- .../MSFT_xSPManagedAccount.psm1 | 65 ++++++++++++------- .../xSharePoint.xSPManagedAccount.Tests.ps1 | 36 +++++++++- 2 files changed, 75 insertions(+), 26 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 index c33387c95..cefda9762 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 @@ -11,7 +11,19 @@ function Get-TargetResource [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, - + + [parameter(Mandatory = $false)] + [System.UInt32] + $EmailNotification, + + [parameter(Mandatory = $false)] + [System.UInt32] + $PreExpireDays, + + [parameter(Mandatory = $false)] + [System.String] + $Schedule, + [parameter(Mandatory = $true)] [System.String] $AccountName @@ -20,27 +32,23 @@ function Get-TargetResource Write-Verbose -Message "Checking for managed account $AccountName" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] try { - $ma = Get-SPManagedAccount $params.AccountName -ErrorAction SilentlyContinue + $ma = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPManagedAccount" -Arguments @{ Identity = $params.Account.UserName } if ($null -eq $ma) { return @{ } } return @{ AccountName = $ma.Userame AutomaticChange = $ma.AutomaticChange DaysBeforeChangeToEmail = $ma.DaysBeforeChangeToEmail DaysBeforeExpiryToChange = $ma.DaysBeforeExpiryToChange - PasswordLastChanged = $ma.PasswordLastChanged - PasswordExpiration = $ma.PasswordExpiration ChangeSchedule = $ma.ChangeSchedule } } catch { return @{ } } } - $result + return $result } @@ -57,14 +65,17 @@ function Set-TargetResource [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $false)] [System.UInt32] - $EmailNotification = 5, + $EmailNotification, + [parameter(Mandatory = $false)] [System.UInt32] - $PreExpireDays = 2, + $PreExpireDays, + [parameter(Mandatory = $false)] [System.String] - $Schedule = [System.String]::Empty, + $Schedule, [parameter(Mandatory = $true)] [System.String] @@ -74,20 +85,21 @@ function Set-TargetResource Write-Verbose -Message "Setting managed account $AccountName" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $ma = Get-SPManagedAccount $params.Account.UserName -ErrorAction SilentlyContinue - if ($null -eq $ma) { - $ma = New-SPManagedAccount $params.Account - } - $params.Add("Identity", $params.Account.UserName) - $params.Remove("Account") | Out-Null - $params.Remove("AccountName") | Out-Null - $params.Remove("InstallAccount") | Out-Null + $current = Get-TargetResource @params + if ($current.Count -eq 0) { + Invoke-xSharePointSPCmdlet -CmdletName "New-SPManagedAccount" -Arguments @{ Credential = $params.Account } + } + + $updateParams = @{ + Identity = $params.Account.UserName + } + if ($params.ContainsKey("EmailNotification")) { $updateParams.Add("EmailNotification", $params.EmailNotification) } + if ($params.ContainsKey("PreExpireDays")) { $updateParams.Add("PreExpireDays", $params.PreExpireDays) } + if ($params.ContainsKey("Schedule")) { $updateParams.Add("Schedule", $params.Schedule) } - Set-SPManagedAccount @params + Invoke-xSharePointSPCmdlet -CmdletName "Set-SPManagedAccount" -Arguments $updateParams } } @@ -106,21 +118,24 @@ function Test-TargetResource [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $false)] [System.UInt32] - $EmailNotification = 5, + $EmailNotification, + [parameter(Mandatory = $false)] [System.UInt32] - $PreExpireDays = 2, + $PreExpireDays, + [parameter(Mandatory = $false)] [System.String] - $Schedule = [System.String]::Empty, + $Schedule, [parameter(Mandatory = $true)] [System.String] $AccountName ) - $result = Get-TargetResource -Account $Account -InstallAccount $InstallAccount -AccountName $AccountName + $result = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing managed account $AccountName" if ($result.Count -eq 0) { return $false } else { diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 index d3a6d379e..0409bc006 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 @@ -12,19 +12,30 @@ Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path $ModuleName = "MSFT_xSPManagedAccount" +Import-Module (Join-Path $RepoRoot "Modules\xSharePoint") Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") Describe "xSPManagedAccount" { InModuleScope $ModuleName { $testParams = @{ Account = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) EmailNotification = 7 PreExpireDays = 7 Schedule = "" AccountName = "username" } + Context "Validate get method" { + It "Calls the service application picker with the appropriate type name" { + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPManagedAccount" -and $Arguments.Identity -eq $testParams.Account.UserName } + + $results = Get-TargetResource @testParams + $results.Count | Should Be 0 + + Assert-VerifiableMocks + } + } + Context "Validate test method" { It "Fails when managed account does not exist in the farm" { Mock -ModuleName $ModuleName Get-TargetResource { return @{} } @@ -67,5 +78,28 @@ Describe "xSPManagedAccount" { Test-TargetResource @testParams | Should Be $false } } + + Context "Validate set method" { + It "Creates a new account when none exists" { + Mock Get-TargetResource { return @{} } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPManagedAccount" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPManagedAccount" } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + It "Modifies an existing account where it already exists" { + Mock Get-TargetResource { return @{} + AccountName = $testParams.Account.UserName + ChangeSchedule = $testParams.Schedule + } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPManagedAccount" } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + } } } \ No newline at end of file From 17f81c3aa773dff0d2b561ddb2e4e232f8ac866c Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sat, 5 Sep 2015 01:36:46 +1000 Subject: [PATCH 020/146] Fixed spaces in files --- .../MSFT_xSPManagedAccount.psm1 | 40 +++++++++---------- .../xSharePoint.xSPManagedAccount.Tests.ps1 | 28 ++++++------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 index cefda9762..7f78ea54d 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 @@ -12,15 +12,15 @@ function Get-TargetResource [System.Management.Automation.PSCredential] $InstallAccount, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $EmailNotification, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $PreExpireDays, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $Schedule, @@ -65,15 +65,15 @@ function Set-TargetResource [System.Management.Automation.PSCredential] $InstallAccount, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $EmailNotification, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $PreExpireDays, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $Schedule, @@ -87,19 +87,19 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $current = Get-TargetResource @params - if ($current.Count -eq 0) { - Invoke-xSharePointSPCmdlet -CmdletName "New-SPManagedAccount" -Arguments @{ Credential = $params.Account } - } + $current = Get-TargetResource @params + if ($current.Count -eq 0) { + Invoke-xSharePointSPCmdlet -CmdletName "New-SPManagedAccount" -Arguments @{ Credential = $params.Account } + } - $updateParams = @{ - Identity = $params.Account.UserName - } - if ($params.ContainsKey("EmailNotification")) { $updateParams.Add("EmailNotification", $params.EmailNotification) } - if ($params.ContainsKey("PreExpireDays")) { $updateParams.Add("PreExpireDays", $params.PreExpireDays) } - if ($params.ContainsKey("Schedule")) { $updateParams.Add("Schedule", $params.Schedule) } + $updateParams = @{ + Identity = $params.Account.UserName + } + if ($params.ContainsKey("EmailNotification")) { $updateParams.Add("EmailNotification", $params.EmailNotification) } + if ($params.ContainsKey("PreExpireDays")) { $updateParams.Add("PreExpireDays", $params.PreExpireDays) } + if ($params.ContainsKey("Schedule")) { $updateParams.Add("Schedule", $params.Schedule) } - Invoke-xSharePointSPCmdlet -CmdletName "Set-SPManagedAccount" -Arguments $updateParams + Invoke-xSharePointSPCmdlet -CmdletName "Set-SPManagedAccount" -Arguments $updateParams } } @@ -118,15 +118,15 @@ function Test-TargetResource [System.Management.Automation.PSCredential] $InstallAccount, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $EmailNotification, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $PreExpireDays, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $Schedule, diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 index 0409bc006..42f4d2dd0 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 @@ -34,7 +34,7 @@ Describe "xSPManagedAccount" { Assert-VerifiableMocks } - } + } Context "Validate test method" { It "Fails when managed account does not exist in the farm" { @@ -79,27 +79,27 @@ Describe "xSPManagedAccount" { } } - Context "Validate set method" { - It "Creates a new account when none exists" { - Mock Get-TargetResource { return @{} } + Context "Validate set method" { + It "Creates a new account when none exists" { + Mock Get-TargetResource { return @{} } Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPManagedAccount" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPManagedAccount" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPManagedAccount" } Set-TargetResource @testParams Assert-VerifiableMocks - } - It "Modifies an existing account where it already exists" { - Mock Get-TargetResource { return @{} - AccountName = $testParams.Account.UserName - ChangeSchedule = $testParams.Schedule - } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPManagedAccount" } + } + It "Modifies an existing account where it already exists" { + Mock Get-TargetResource { return @{} + AccountName = $testParams.Account.UserName + ChangeSchedule = $testParams.Schedule + } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPManagedAccount" } Set-TargetResource @testParams Assert-VerifiableMocks - } - } + } + } } } \ No newline at end of file From 29beba4db208790df2a8edea6aeb82a4c4fa454d Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Wed, 9 Sep 2015 20:19:14 +1000 Subject: [PATCH 021/146] Updated remaining resources to use new wrapper call to SP cmdlets --- .../MSFT_xSPCacheAccounts.psm1 | 18 +- .../MSFT_xSPDiagnosticLoggingSettings.psm1 | 178 +++++++++++++----- .../MSFT_xSPDistributedCacheService.psm1 | 18 +- .../MSFT_xSPFeature/MSFT_xSPFeature.psm1 | 17 +- .../MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 | 57 +++--- .../MSFT_xSPManagedAccount.psm1 | 3 +- .../MSFT_xSPManagedMetaDataServiceApp.psm1 | 96 ++++++---- .../MSFT_xSPManagedPath.psm1 | 29 +-- .../MSFT_xSPSearchServiceApp.psm1 | 60 +++--- .../MSFT_xSPSecureStoreServiceApp.psm1 | 130 ++++++++++--- .../MSFT_xSPServiceAppPool.psm1 | 22 ++- .../MSFT_xSPServiceInstance.psm1 | 18 +- .../MSFT_xSPSite/MSFT_xSPSite.psm1 | 162 +++++++++++----- .../MSFT_xSPStateServiceApp.psm1 | 43 +++-- .../MSFT_xSPUsageApplication.psm1 | 119 ++++++++---- .../MSFT_xSPUserProfileServiceApp.psm1 | 98 +++++++--- .../MSFT_xSPUserProfileSyncService.psm1 | 32 ++-- .../MSFT_xSPWebApplication.psm1 | 132 ++++++++----- .../xSharePoint.CacheAccounts.psm1 | 33 ++++ .../xSharePoint.DistributedCache.psm1 | 11 +- .../xSharePoint.ServiceApplications.psm1 | 8 +- .../xSharePoint.Util/xSharePoint.Util.psm1 | 2 +- Modules/xSharePoint/xSharePoint.psd1 | 4 +- Modules/xSharePoint/xSharePoint.pssproj | 2 + 24 files changed, 856 insertions(+), 436 deletions(-) create mode 100644 Modules/xSharePoint/Modules/xSharePoint.CacheAccounts/xSharePoint.CacheAccounts.psm1 diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 index bf61fd9f7..dd6e180c6 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 @@ -24,10 +24,8 @@ function Get-TargetResource Write-Verbose -Message "Getting cache accounts for $WebAppUrl" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $wa = Get-SPWebApplication $params.WebAppUrl -ErrorAction SilentlyContinue + $wa = Invoke-xSharePointSPCmdlet "Get-SPWebApplication" -Arguments @{ Identity = $params.WebAppUrl } -ErrorAction SilentlyContinue if ($null -eq $wa) { return @{} } @@ -46,7 +44,7 @@ function Get-TargetResource return $returnVal } - $result + return $result } @@ -75,11 +73,9 @@ function Set-TargetResource Write-Verbose -Message "Setting cache accounts for $WebAppUrl" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $wa = Get-SPWebApplication $params.WebAppUrl + $wa = Invoke-xSharePointSPCmdlet "Get-SPWebApplication" -Arguments @{ Identity = $params.WebAppUrl } if ($wa.Properties.ContainsKey("portalsuperuseraccount")) { $wa.Properties["portalsuperuseraccount"] = $params.SuperUserAlias @@ -91,7 +87,11 @@ function Set-TargetResource } else { $wa.Properties.Add("portalsuperreaderaccount", $params.SuperReaderAlias) } - $wa.Update() + + Set-xSharePointCacheReaderPolicy -WebApplication $wa -UserName $params.SuperReaderAlias + Set-xSharePointCacheOwnerPolicy -WebApplication $wa -UserName $params.SuperUserAlias + + $wa.Update() } } @@ -119,7 +119,7 @@ function Test-TargetResource $InstallAccount ) - $result = Get-TargetResource -WebAppUrl $WebAppUrl -SuperUserAlias $SuperUserAlias -SuperReaderAlias $SuperReaderAlias -InstallAccount $InstallAccount + $result = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing cache accounts for $WebAppUrl" if ($result.Count -eq 0) { return $false } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 index d25c0c185..77689398c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 @@ -12,6 +12,70 @@ function Get-TargetResource [System.UInt32] $LogSpaceInGB, + [parameter(Mandatory = $false)] + [System.Boolean] + $AppAnalyticsAutomaticUploadEnabled, + + [parameter(Mandatory = $false)] + [System.Boolean] + $CustomerExperienceImprovementProgramEnabled, + + [parameter(Mandatory = $false)] + [System.UInt32] + $DaysToKeepLogs, + + [parameter(Mandatory = $false)] + [System.Boolean] + $DownloadErrorReportingUpdatesEnabled, + + [parameter(Mandatory = $false)] + [System.Boolean] + $ErrorReportingAutomaticUploadEnabled, + + [parameter(Mandatory = $false)] + [System.Boolean] + $ErrorReportingEnabled, + + [parameter(Mandatory = $false)] + [System.Boolean] + $EventLogFloodProtectionEnabled, + + [parameter(Mandatory = $false)] + [System.UInt32] + $EventLogFloodProtectionNotifyInterval, + + [parameter(Mandatory = $false)] + [System.UInt32] + $EventLogFloodProtectionQuietPeriod, + + [parameter(Mandatory = $false)] + [System.UInt32] + $EventLogFloodProtectionThreshold, + + [parameter(Mandatory = $false)] + [System.UInt32] + $EventLogFloodProtectionTriggerPeriod, + + [parameter(Mandatory = $false)] + [System.UInt32] + $LogCutInterval, + + [parameter(Mandatory = $false)] + [System.Boolean] + $LogMaxDiskSpaceUsageEnabled, + + [parameter(Mandatory = $false)] + [System.UInt32] + $ScriptErrorReportingDelay, + + [parameter(Mandatory = $false)] + [System.Boolean] + $ScriptErrorReportingEnabled, + + [parameter(Mandatory = $false)] + [System.Boolean] + $ScriptErrorReportingRequireAuth, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount @@ -20,9 +84,8 @@ function Get-TargetResource Write-Verbose -Message "Getting diagnostic configuration settings" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $dc = Get-SPDiagnosticConfig -ErrorAction SilentlyContinue + $dc = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPDiagnosticConfig" -ErrorAction SilentlyContinue if ($null -eq $dc) { return @{} } return @{ @@ -47,7 +110,7 @@ function Get-TargetResource ScriptErrorReportingDelay = $dc.ScriptErrorReportingDelay } } - $result + return $result } @@ -64,53 +127,69 @@ function Set-TargetResource [System.UInt32] $LogSpaceInGB, + [parameter(Mandatory = $false)] [System.Boolean] - $AppAnalyticsAutomaticUploadEnabled = $true, + $AppAnalyticsAutomaticUploadEnabled, + [parameter(Mandatory = $false)] [System.Boolean] - $CustomerExperienceImprovementProgramEnabled = $true, + $CustomerExperienceImprovementProgramEnabled, + [parameter(Mandatory = $false)] [System.UInt32] - $DaysToKeepLogs = 14, + $DaysToKeepLogs, + [parameter(Mandatory = $false)] [System.Boolean] - $DownloadErrorReportingUpdatesEnabled = $true, + $DownloadErrorReportingUpdatesEnabled, + [parameter(Mandatory = $false)] [System.Boolean] - $ErrorReportingAutomaticUploadEnabled = $true, + $ErrorReportingAutomaticUploadEnabled, + [parameter(Mandatory = $false)] [System.Boolean] - $ErrorReportingEnabled = $true, + $ErrorReportingEnabled, + [parameter(Mandatory = $false)] [System.Boolean] - $EventLogFloodProtectionEnabled = $true, + $EventLogFloodProtectionEnabled, + [parameter(Mandatory = $false)] [System.UInt32] - $EventLogFloodProtectionNotifyInterval = 5, + $EventLogFloodProtectionNotifyInterval, + [parameter(Mandatory = $false)] [System.UInt32] - $EventLogFloodProtectionQuietPeriod = 2, + $EventLogFloodProtectionQuietPeriod, + [parameter(Mandatory = $false)] [System.UInt32] - $EventLogFloodProtectionThreshold = 5, + $EventLogFloodProtectionThreshold, + [parameter(Mandatory = $false)] [System.UInt32] - $EventLogFloodProtectionTriggerPeriod = 2, + $EventLogFloodProtectionTriggerPeriod, + [parameter(Mandatory = $false)] [System.UInt32] - $LogCutInterval = 30, + $LogCutInterval, + [parameter(Mandatory = $false)] [System.Boolean] - $LogMaxDiskSpaceUsageEnabled = $true, + $LogMaxDiskSpaceUsageEnabled, + [parameter(Mandatory = $false)] [System.UInt32] - $ScriptErrorReportingDelay = 30, + $ScriptErrorReportingDelay, + [parameter(Mandatory = $false)] [System.Boolean] - $ScriptErrorReportingEnabled = $true, + $ScriptErrorReportingEnabled, + [parameter(Mandatory = $false)] [System.Boolean] - $ScriptErrorReportingRequireAuth = $true, + $ScriptErrorReportingRequireAuth, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] @@ -120,15 +199,13 @@ function Set-TargetResource Write-Verbose -Message "Setting diagnostic configuration settings" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $params.Remove("InstallAccount") | Out-Null - $params = Rename-xSharePointParamValue -params $params -oldName "LogPath" -newName "LogLocation" - $params = Rename-xSharePointParamValue -params $params -oldName "LogSpaceInGB" -newName "LogDiskSpaceUsageGB" + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } + $params = $params | Rename-xSharePointParamValue -oldName "LogPath" -newName "LogLocation" ` + | Rename-xSharePointParamValue -oldName "LogSpaceInGB" -newName "LogDiskSpaceUsageGB" - Set-SPDiagnosticConfig @params + Invoke-xSharePointSPCmdlet -CmdletName "Set-SPDiagnosticConfig" -Arguments $params } } @@ -147,53 +224,69 @@ function Test-TargetResource [System.UInt32] $LogSpaceInGB, + [parameter(Mandatory = $false)] [System.Boolean] - $AppAnalyticsAutomaticUploadEnabled = $true, + $AppAnalyticsAutomaticUploadEnabled, + [parameter(Mandatory = $false)] [System.Boolean] - $CustomerExperienceImprovementProgramEnabled = $true, + $CustomerExperienceImprovementProgramEnabled, + [parameter(Mandatory = $false)] [System.UInt32] - $DaysToKeepLogs = 14, + $DaysToKeepLogs, + [parameter(Mandatory = $false)] [System.Boolean] - $DownloadErrorReportingUpdatesEnabled = $true, + $DownloadErrorReportingUpdatesEnabled, + [parameter(Mandatory = $false)] [System.Boolean] - $ErrorReportingAutomaticUploadEnabled = $true, + $ErrorReportingAutomaticUploadEnabled, + [parameter(Mandatory = $false)] [System.Boolean] - $ErrorReportingEnabled = $true, + $ErrorReportingEnabled, + [parameter(Mandatory = $false)] [System.Boolean] - $EventLogFloodProtectionEnabled = $true, + $EventLogFloodProtectionEnabled, + [parameter(Mandatory = $false)] [System.UInt32] - $EventLogFloodProtectionNotifyInterval = 5, + $EventLogFloodProtectionNotifyInterval, + [parameter(Mandatory = $false)] [System.UInt32] - $EventLogFloodProtectionQuietPeriod = 2, + $EventLogFloodProtectionQuietPeriod, + [parameter(Mandatory = $false)] [System.UInt32] - $EventLogFloodProtectionThreshold = 5, + $EventLogFloodProtectionThreshold, + [parameter(Mandatory = $false)] [System.UInt32] - $EventLogFloodProtectionTriggerPeriod = 2, + $EventLogFloodProtectionTriggerPeriod, + [parameter(Mandatory = $false)] [System.UInt32] - $LogCutInterval = 30, + $LogCutInterval, + [parameter(Mandatory = $false)] [System.Boolean] - $LogMaxDiskSpaceUsageEnabled = $true, + $LogMaxDiskSpaceUsageEnabled, + [parameter(Mandatory = $false)] [System.UInt32] - $ScriptErrorReportingDelay = 30, + $ScriptErrorReportingDelay, + [parameter(Mandatory = $false)] [System.Boolean] - $ScriptErrorReportingEnabled = $true, + $ScriptErrorReportingEnabled, + [parameter(Mandatory = $false)] [System.Boolean] - $ScriptErrorReportingRequireAuth = $true, + $ScriptErrorReportingRequireAuth, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] @@ -202,7 +295,7 @@ function Test-TargetResource Write-Verbose -Message "Getting diagnostic configuration settings" - $result = Get-TargetResource -LogPath $LogPath -LogSpaceInGB $LogSpaceInGB -InstallAccount $InstallAccount + $result = Get-TargetResource @PSBoundParameters if ($LogPath -ne $result.LogLocation) { return $false } if ($LogSpaceInGB -ne $result.LogDiskSpaceUsageGB) { return $false } @@ -227,4 +320,3 @@ function Test-TargetResource Export-ModuleMember -Function *-TargetResource - diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index 0a241dc52..8d858ab74 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -32,9 +32,7 @@ function Get-TargetResource Write-Verbose -Message "Getting the cache host information" - $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - + $result = Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { try { Use-CacheCluster -ErrorAction SilentlyContinue @@ -92,7 +90,7 @@ function Set-TargetResource Write-Verbose -Message "Adding the distributed cache to the server" if($createFirewallRules) { Write-Verbose -Message "Create a firewall rule for AppFabric" - Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { $params = $args[0] Import-Module -Name NetSecurity @@ -114,25 +112,19 @@ function Set-TargetResource Write-Verbose -Message "Firewall rule added" } Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] Add-xSharePointDistributedCacheServer -CacheSizeInMB $params.CacheSizeInMB -ServiceAccount $params.ServiceAccount } } else { Write-Verbose -Message "Removing distributed cache to the server" - Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - - $params = $args[0] + Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { Remove-xSharePointDistributedCacheServer } $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distribute Cache" -ErrorAction SilentlyContinue if($null -eq $firewallRule) { Write-Verbose -Message "Disabling firewall rules." - Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - $params = $args[0] + Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { Import-Module -Name NetSecurity Disable-NetFirewallRule -DisplayName -DisplayName "SharePoint Distribute Cache" } @@ -174,7 +166,7 @@ function Test-TargetResource $createFirewallRules ) - $result = Get-TargetResource -Name $Name -Ensure $Ensure -CacheSizeInMB $CacheSizeInMB -ServiceAccount $ServiceAccount -InstallAccount $InstallAccount -CreateFirewallRules $createFirewallRules + $result = Get-TargetResource @PSBoundParameters if ($Ensure -eq "Present") { if ($result.Count -eq 0) { return $false } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 index 2c464f994..33c52d561 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 @@ -30,10 +30,9 @@ function Get-TargetResource Write-Verbose -Message "Getting feature $Name at $FeatureScope scope" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $feature = Get-SPFeature $params.Name -ErrorAction SilentlyContinue + + $feature = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFeature" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue if ($null -eq $feature) { return @{} } @@ -45,7 +44,7 @@ function Get-TargetResource $checkParams.Add($params.FeatureScope, $params.Url) } $checkParams.Add("ErrorAction", "SilentlyContinue") - $featureAtScope = Get-SPFeature @checkParams + $featureAtScope = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFeature" -Arguments $checkParams $enabled = ($null -ne $featureAtScope) return @{ @@ -55,7 +54,7 @@ function Get-TargetResource Enabled = $enabled } } - $result + return $result } @@ -88,8 +87,6 @@ function Set-TargetResource ) $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] $runParams = @{} @@ -99,10 +96,10 @@ function Set-TargetResource } if ($params.Ensure -eq "Present") { - Enable-SPFeature @runParams + Invoke-xSharePointSPCmdlet -CmdletName "Enable-SPFeature" -Arguments $runParams } else { $runParams.Add("Confirm", $false) - Disable-SPFeature @runParams + Invoke-xSharePointSPCmdlet -CmdletName "Disable-SPFeature" -Arguments $runParams } } } @@ -137,7 +134,7 @@ function Test-TargetResource $Ensure ) - $result = Get-TargetResource -Name $Name -FeatureScope $FeatureScope -Url $Url -InstallAccount $InstallAccount -Ensure $Ensure + $result = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for feature $Name at $FeatureScope scope" if ($result.Count -eq 0) { diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 index 5920c0423..9b7c89f0f 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 @@ -23,11 +23,9 @@ function Get-TargetResource Write-Verbose -Message "Checking for local SP Farm" - $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - + $result = Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { try { - $spFarm = Get-SPFarm -ErrorAction SilentlyContinue + $spFarm = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFarm" -ErrorAction SilentlyContinue } catch { Write-Verbose -Message "Unable to detect local farm." } @@ -39,7 +37,7 @@ function Get-TargetResource } return $returnValue } - $result + return $result } @@ -77,32 +75,37 @@ function Set-TargetResource if ($PSBoundParameters.WaitCount -eq $null) { $PSBoundParameters.Add("WaitCount", $WaitCount) } Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] $loopCount = 0 - $params = Rename-xSharePointParamValue -params $params -oldName "FarmConfigDatabaseName" -newName "DatabaseName" - $params.Passphrase = (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) - $params.Remove("InstallAccount") + $joinFarmArgs = @{ + DatabaseServer = $params.DatabaseServer + DatabaseName = $params.FarmConfigDatabaseName + Passphrase = (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) + SkipRegisterAsDistributedCacheHost = $true + } + + switch((Get-xSharePointInstalledProductVersion).FileMajorPart) { + 15 { + Write-Verbose -Message "Detected Version: SharePoint 2013" + } + 16 { + Write-Verbose -Message "Detected Version: SharePoint 2016" + $joinFarmArgs.Add("LocalServerRole", "Custom") + } + Default { + throw [Exception] "An unknown version of SharePoint (Major version $_) was detected. Only versions 15 (SharePoint 2013) or 16 (SharePoint 2016) are supported." + } + } $WaitTime = $params.WaitTime - $params.Remove("WaitTime") $WaitCount = $params.WaitCount - $params.Remove("WaitCount") - - if (Test-Path -Path "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.dll") { - Write-Verbose -Message "Detected Version: SharePoint 2016" - $params.Add("LocalServerRole", "Custom") - } else { - Write-Verbose -Message "Detected Version: SharePoint 2013" - } - + $success = $false while ($loopCount -le $WaitCount) { try { - Connect-SPConfigurationDatabase @params -SkipRegisterAsDistributedCacheHost:$true + Invoke-xSharePointSPCmdlet -CmdletName "Connect-SPConfigurationDatabase" -Arguments $joinFarmArgs $loopCount = $WaitCount + 1 $success = $true } @@ -113,11 +116,11 @@ function Set-TargetResource } } if ($success) { - Install-SPHelpCollection -All - Initialize-SPResourceSecurity - Install-SPService - Install-SPFeature -AllExistingFeatures -Force - Install-SPApplicationContent + Invoke-xSharePointSPCmdlet -CmdletName "Install-SPHelpCollection" -Arguments @{ All = $true } + Invoke-xSharePointSPCmdlet -CmdletName "Initialize-SPResourceSecurity" + Invoke-xSharePointSPCmdlet -CmdletName "Install-SPService" + Invoke-xSharePointSPCmdlet -CmdletName "Install-SPFeature" -Arguments @{ AllExistingFeatures = $true; Force = $true } + Invoke-xSharePointSPCmdlet -CmdletName "Install-SPApplicationContent" } } @@ -161,7 +164,7 @@ function Test-TargetResource $WaitCount = 60 ) - $result = Get-TargetResource -FarmConfigDatabaseName $FarmConfigDatabaseName -DatabaseServer $DatabaseServer -InstallAccount $InstallAccount -Passphrase $Passphrase + $result = Get-TargetResource @PSBoundParameters if ($result.Count -eq 0) { return $false } return $true diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 index 7f78ea54d..e499c772d 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 @@ -35,7 +35,7 @@ function Get-TargetResource $params = $args[0] try { - $ma = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPManagedAccount" -Arguments @{ Identity = $params.Account.UserName } + $ma = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPManagedAccount" -Arguments @{ Identity = $params.Account.UserName } -ErrorAction SilentlyContinue if ($null -eq $ma) { return @{ } } return @{ AccountName = $ma.Userame @@ -51,7 +51,6 @@ function Get-TargetResource return $result } - function Set-TargetResource { [CmdletBinding()] diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 index b3cb8caaa..e5f6041ee 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 @@ -8,36 +8,50 @@ function Get-TargetResource [System.String] $Name, - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - [parameter(Mandatory = $true)] [System.String] - $ApplicationPool + $ApplicationPool, + + [parameter(Mandatory = $false)] + [System.String] + $DatabaseServer, + + [parameter(Mandatory = $false)] + [System.String] + $DatabaseName, + + [parameter(Mandatory = $false)] + [System.Management.Automation.PSCredential] + $InstallAccount ) Write-Verbose -Message "Getting managed metadata service application $Name" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | - Where-Object { $_.TypeName -eq "Managed Metadata Service" } - If ($null -eq $serviceApp) - { - return @{} - } - else + + try { - return @{ - Name = $serviceApp.DisplayName - ApplicationPool = $serviceApp.ApplicationPool.Name + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName MMS + + If ($null -eq $serviceApp) + { + return @{} + } + else + { + return @{ + Name = $serviceApp.DisplayName + ApplicationPool = $serviceApp.ApplicationPool.Name + } } + } + catch + { + return @{ } } } - $result + return $result } @@ -54,31 +68,39 @@ function Set-TargetResource [System.String] $ApplicationPool, + [parameter(Mandatory = $false)] [System.String] - $DatabaseServer = $null, + $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] - $DatabaseName = $null, + $DatabaseName, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -InstallAccount $InstallAccount + $result = Get-TargetResource @PSBoundParameters if ($result.Count -eq 0) { Write-Verbose -Message "Creating Managed Metadata Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $params = Remove-xSharePointNullParamValues -Params $params - $params.Remove("InstallAccount") | Out-Null - $app = New-SPMetadataServiceApplication @params + + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } + + $app = Invoke-xSharePointSPCmdlet -CmdletName "New-SPMetadataServiceApplication" -Arguments $params if ($null -ne $app) { - New-SPMetadataServiceApplicationProxy -Name ($params.Name + " Proxy") -ServiceApplication $app -DefaultProxyGroup -ContentTypePushdownEnabled -DefaultKeywordTaxonomy -DefaultSiteCollectionTaxonomy + Invoke-xSharePointSPCmdlet -CmdletName "New-SPMetadataServiceApplicationProxy" -Arguments @{ + Name = ($params.Name + " Proxy") + ServiceApplication = $app + DefaultProxyGroup = $true + ContentTypePushdownEnabled = $true + DefaultKeywordTaxonomy = $true + DefaultSiteCollectionTaxonomy = $true + } } } } @@ -86,13 +108,13 @@ function Set-TargetResource if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating Managed Metadata Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $params = Remove-xSharePointNullParamValues -Params $params - $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | - Where-Object { $_.TypeName -eq "Managed Metadata Service" } - $serviceApp | Set-SPMetadataServiceApplication -ApplicationPool (Get-SPServiceApplicationPool $params.ApplicationPool) + + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName MMS + Invoke-xSharePointSPCmdlet -CmdletName "Set-SPMetadataServiceApplication" -Arguments @{ + Identity = $serviceApp + ApplicationPool = (Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" -Arguments @{ Identity = $params.ApplicationPool } ) + } } } } @@ -117,14 +139,16 @@ function Test-TargetResource [System.String] $ApplicationPool, + [parameter(Mandatory = $false)] [System.String] - $DatabaseServer = $null, + $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] - $DatabaseName = $null + $DatabaseName ) - $result = Get-TargetResource -Name $Name -InstallAccount $InstallAccount -ApplicationPool $ApplicationPool + $result = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for Managed Metadata Service Application '$Name'" if ($result.Count -eq 0) { return $false } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 index fc701ac82..9fc0439ec 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 @@ -28,17 +28,14 @@ function Get-TargetResource Write-Verbose -Message "Looking up the managed path $RelativeUrl in $WebAppUrl" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - + $getParams = @{ + Identity = $params.RelativeUrl + } if ($params.HostHeader) { - $path = Get-SPManagedPath -Identity $params.RelativeUrl -HostHeader -ErrorAction SilentlyContinue - } - else { - $path = Get-SPManagedPath -WebApplication $params.WebAppUrl -Identity $params.RelativeUrl -ErrorAction SilentlyContinue + $getParams.Add("HostHeader", $true) } - + $path = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPManagedPath" -Arguments $getParams -ErrorAction SilentlyContinue if ($null -eq $path) { return @{} } return @{ @@ -46,7 +43,7 @@ function Get-TargetResource PathType = $path.Type } } - $result + return $result } @@ -79,17 +76,9 @@ function Set-TargetResource Write-Verbose -Message "Creating the managed path $RelativeUrl in $WebAppUrl" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - if ($params.HostHeader) { - $path = Get-SPManagedPath -Identity $params.RelativeUrl -HostHeader -ErrorAction SilentlyContinue - } - else { - $path = Get-SPManagedPath -WebApplication $params.WebAppUrl -Identity $params.RelativeUrl -ErrorAction SilentlyContinue - } - + $path = Get-TargetResource @params if ($null -eq $path) { $newParams = @{} @@ -102,7 +91,7 @@ function Set-TargetResource $newParams.Add("RelativeURL", $params.RelativeUrl) $newParams.Add("Explicit", $params.Explicit) - New-SPManagedPath @newParams + Invoke-xSharePointSPCmdlet -CmdletName "New-SPManagedPath" -Arguements $newParams } } } @@ -135,7 +124,7 @@ function Test-TargetResource $HostHeader ) - $result = Get-TargetResource -WebAppUrl $WebAppUrl -InstallAccount $InstallAccount -RelativeUrl $RelativeUrl -Explicit $Explicit -HostHeader $HostHeader + $result = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Looking up the managed path $RelativeUrl in $WebAppUrl" if ($result.Count -eq 0) { return $false } else { diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 index ee6397fb1..6a96063d2 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 @@ -12,6 +12,14 @@ function Get-TargetResource [System.String] $ApplicationPool, + [parameter(Mandatory = $false)] + [System.String] + $DatabaseServer, + + [parameter(Mandatory = $false)] + [System.String] + $DatabaseName, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount @@ -20,11 +28,10 @@ function Get-TargetResource Write-Verbose -Message "Getting Search service application '$Name'" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | - Where-Object { $_.TypeName -eq "Search Service Application" } + + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName Search + If ($null -eq $serviceApp) { return @{} @@ -37,7 +44,7 @@ function Get-TargetResource } } } - $result + return $result } @@ -54,32 +61,35 @@ function Set-TargetResource [System.String] $ApplicationPool, + [parameter(Mandatory = $false)] [System.String] - $DatabaseServer = $null, + $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] - $DatabaseName = $null, + $DatabaseName, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -InstallAccount $InstallAccount + $result = Get-TargetResource @PSBoundParameters if ($result.Count -eq 0) { Write-Verbose -Message "Creating Search Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $params = Remove-xSharePointNullParamValues -Params $params - $params.Remove("InstallAccount") | Out-Null + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } - Get-SPEnterpriseSearchServiceInstance -Local | Start-SPEnterpriseSearchServiceInstance -ErrorAction SilentlyContinue - $app = New-SPEnterpriseSearchServiceApplication @params + $serviceInstance = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPEnterpriseSearchServiceInstance" -Arguments @{ Local = $true } + $serviceInstance | Invoke-xSharePointSPCmdlet -CmdletName "Start-SPEnterpriseSearchServiceInstance" -ErrorAction SilentlyContinue + $app = Invoke-xSharePointSPCmdlet -CmdletName "New-SPEnterpriseSearchServiceApplication" -Arguments $params if ($app) { - New-SPEnterpriseSearchServiceApplicationProxy -Name ($params.Name + " Proxy") -SearchApplication $app + Invoke-xSharePointSPCmdlet -CmdletName "New-SPEnterpriseSearchServiceApplicationProxy" -Arguments @{ + Name = "$($params.Name) Proxy" + SearchApplication = $app + } } } } @@ -87,13 +97,13 @@ function Set-TargetResource if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating Search Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $params = Remove-xSharePointNullParamValues -Params $params - $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | - Where-Object { $_.TypeName -eq "Search Service Application" } - $serviceApp | Set-SPEnterpriseSearchServiceApplication -ApplicationPool (Get-SPServiceApplicationPool $params.ApplicationPool) + + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName Search + Invoke-xSharePointSPCmdlet -CmdletName "Set-SPEnterpriseSearchServiceApplication" -Arguments @{ + Identity = $serviceApp + ApplicationPool = (Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" -Arguments @{ Identity = $params.ApplicationPool } ) + } } } } @@ -114,18 +124,20 @@ function Test-TargetResource [System.String] $ApplicationPool, + [parameter(Mandatory = $false)] [System.String] - $DatabaseServer = $null, + $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] - $DatabaseName = $null, + $DatabaseName, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -InstallAccount $InstallAccount + $result = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing Search service application '$Name'" if ($result.Count -eq 0) { return $false } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 index e4a3761b0..b837145b9 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 @@ -16,6 +16,42 @@ function Get-TargetResource [System.Boolean] $AuditingEnabled, + [parameter(Mandatory = $false)] + [System.UInt32] + $AuditlogMaxSize, + + [parameter(Mandatory = $false)] + [System.Management.Automation.PSCredential] + $DatabaseCredentials, + + [parameter(Mandatory = $false)] + [System.String] + $DatabaseName, + + [parameter(Mandatory = $false)] + [System.String] + $DatabasePassword, + + [parameter(Mandatory = $false)] + [System.String] + $DatabaseServer, + + [parameter(Mandatory = $false)] + [System.String] + $DatabaseUsername, + + [parameter(Mandatory = $false)] + [System.String] + $FailoverDatabaseServer, + + [parameter(Mandatory = $false)] + [System.Boolean] + $PartitionMode, + + [parameter(Mandatory = $false)] + [System.Boolean] + $Sharing = $true, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount @@ -24,11 +60,10 @@ function Get-TargetResource Write-Verbose -Message "Getting secure store service application '$Name'" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | - Where-Object { $_.TypeName -eq "Secure Store Service Application" } + + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName SecureStore + If ($null -eq $serviceApp) { return @{} @@ -41,7 +76,7 @@ function Get-TargetResource } } } - $result + return $result } @@ -62,30 +97,39 @@ function Set-TargetResource [System.Boolean] $AuditingEnabled, + [parameter(Mandatory = $false)] [System.UInt32] - $AuditlogMaxSize = 30, + $AuditlogMaxSize, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] - $DatabaseCredentials = $null, + $DatabaseCredentials, + [parameter(Mandatory = $false)] [System.String] - $DatabaseName = $null, + $DatabaseName, + [parameter(Mandatory = $false)] [System.String] - $DatabasePassword = $null, + $DatabasePassword, + [parameter(Mandatory = $false)] [System.String] - $DatabaseServer = $null, + $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] - $DatabaseUsername = $null, + $DatabaseUsername, + [parameter(Mandatory = $false)] [System.String] - $FailoverDatabaseServer = $null, + $FailoverDatabaseServer, + [parameter(Mandatory = $false)] [System.Boolean] - $PartitionMode = $false, + $PartitionMode, + [parameter(Mandatory = $false)] [System.Boolean] $Sharing = $true, @@ -94,23 +138,40 @@ function Set-TargetResource $InstallAccount ) - $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -AuditingEnabled $AuditingEnabled -InstallAccount $InstallAccount + $result = Get-TargetResource @PSBoundParameters if ($result.Count -eq 0) { Write-Verbose -Message "Creating Secure Store Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $params = Remove-xSharePointNullParamValues -Params $params - $params.Remove("InstallAccount") | Out-Null + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } + + $app = Invoke-xSharePointSPCmdlet -CmdletName "New-SPSecureStoreServiceApplication" -Arguments $params + if ($app) { + Invoke-xSharePointSPCmdlet -CmdletName "New-SPSecureStoreServiceApplicationProxy" -Arguments @{ + Name = "$($params.Name) Proxy" + SearchApplication = $app + } + } + } + } + else { + if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) { + Write-Verbose -Message "Updating Secure Store Service Application $Name" + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + $params = $args[0] - $app = New-SPSecureStoreServiceApplication @params - if ($null -ne $app) { - New-SPSecureStoreServiceApplicationProxy -Name ($params.Name + " Proxy") -ServiceApplication $app + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName SecureStore + Invoke-xSharePointSPCmdlet -CmdletName "Set-SPSecureStoreServiceApplication" -Arguments @{ + Identity = $serviceApp + ApplicationPool = (Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" -Arguments @{ Identity = $params.ApplicationPool } ) + } } } } + + + else { if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating Secure Store Service Application $Name" @@ -149,30 +210,39 @@ function Test-TargetResource [System.Boolean] $AuditingEnabled, + [parameter(Mandatory = $false)] [System.UInt32] - $AuditlogMaxSize = 30, + $AuditlogMaxSize, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] - $DatabaseCredentials = $null, + $DatabaseCredentials, + [parameter(Mandatory = $false)] [System.String] - $DatabaseName = $null, + $DatabaseName, + [parameter(Mandatory = $false)] [System.String] - $DatabasePassword = $null, + $DatabasePassword, + [parameter(Mandatory = $false)] [System.String] - $DatabaseServer = $null, + $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] - $DatabaseUsername = $null, + $DatabaseUsername, + [parameter(Mandatory = $false)] [System.String] - $FailoverDatabaseServer = $null, + $FailoverDatabaseServer, + [parameter(Mandatory = $false)] [System.Boolean] - $PartitionMode = $false, + $PartitionMode, + [parameter(Mandatory = $false)] [System.Boolean] $Sharing = $true, @@ -181,7 +251,7 @@ function Test-TargetResource $InstallAccount ) - $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -AuditingEnabled $AuditingEnabled -InstallAccount $InstallAccount + $result = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing secure store service application $Name" if ($result.Count -eq 0) { return $false } else { diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 index 2e4bc2d0e..e39f97458 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 @@ -20,11 +20,9 @@ function Get-TargetResource Write-Verbose -Message "Getting service application pool '$Name'" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $sap = Get-SPServiceApplicationPool $params.Name -ErrorAction SilentlyContinue + $sap = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue if ($null -eq $sap) { return @{} } return @{ @@ -32,7 +30,7 @@ function Get-TargetResource ProcessAccountName = $sap.ProcessAccountName } } - $result + return $result } @@ -57,16 +55,20 @@ function Set-TargetResource Write-Verbose -Message "Creating service application pool '$Name'" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $sap = Get-SPServiceApplicationPool $params.Name -ErrorAction SilentlyContinue + $sap = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue if ($null -eq $sap) { - New-SPServiceApplicationPool -Name $params.Name -Account $params.ServiceAccount + Invoke-xSharePointSPCmdlet -CmdletName "New-SPServiceApplicationPool" -Arguments @{ + Name = $params.Name + Account = $params.ServiceAccount + } } else { if ($sap.ProcessAccountName -ne $params.ServiceAccount) { - Set-SPServiceApplicationPool -Identity $params.Name -Account $params.ServiceAccount + Invoke-xSharePointSPCmdlet -CmdletName "Set-SPServiceApplicationPool" -Arguments @{ + Identity = $params.Name + Account = $params.ServiceAccount + } } } } @@ -92,7 +94,7 @@ function Test-TargetResource $InstallAccount ) - $result = Get-TargetResource -Name $Name -ServiceAccount $ServiceAccount -InstallAccount $InstallAccount + $result = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing service application pool '$Name'" if ($result.Count -eq 0) { return $false } else { diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 index 35f9cef92..937984f8c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 @@ -21,11 +21,9 @@ function Get-TargetResource Write-Verbose -Message "Getting service instance '$Name'" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq $params.Name } + $si = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Server = $env:COMPUTERNAME } | Where-Object { $_.TypeName -eq $params.Name } if ($null -eq $si) { return @{} } return @{ @@ -60,25 +58,21 @@ function Set-TargetResource Write-Verbose -Message "Provisioning service instance '$Name'" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq $params.Name } + $si = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Server = $env:COMPUTERNAME } | Where-Object { $_.TypeName -eq $params.Name } if ($null -eq $si) { return $false } - Start-SPServiceInstance $si + Invoke-xSharePointSPCmdlet -CmdletName "Start-SPServiceInstance" -Arguments @{ Identity = $si } } } else { Write-Verbose -Message "Deprovioning service instance '$Name'" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq $params.Name } + $si = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Server = $env:COMPUTERNAME } | Where-Object { $_.TypeName -eq $params.Name } if ($null -eq $si) { return $false } - Stop-SPServiceInstance $si + Invoke-xSharePointSPCmdlet -CmdletName "Stop-SPServiceInstance" -Arguments @{ Identity = $si } } } } @@ -104,7 +98,7 @@ function Test-TargetResource $Ensure ) - $result = Get-TargetResource -Name $Name -InstallAccount $InstallAccount -Ensure $Ensure + $result = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Getting service instance '$Name'" if ($result.Count -eq 0) { return $false } else { diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 index ebfdda707..4ff678758 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 @@ -11,6 +11,50 @@ function Get-TargetResource [parameter(Mandatory = $true)] [System.String] $OwnerAlias, + + [parameter(Mandatory = $false)] + [System.UInt32] + $CompatibilityLevel, + + [parameter(Mandatory = $false)] + [System.String] + $ContentDatabase, + + [parameter(Mandatory = $false)] + [System.String] + $Description, + + [parameter(Mandatory = $false)] + [System.String] + $HostHeaderWebApplication, + + [parameter(Mandatory = $false)] + [System.UInt32] + $Language, + + [parameter(Mandatory = $false)] + [System.String] + $Name, + + [parameter(Mandatory = $false)] + [System.String] + $OwnerEmail, + + [parameter(Mandatory = $false)] + [System.String] + $QuotaTemplate, + + [parameter(Mandatory = $false)] + [System.String] + $SecondaryEmail, + + [parameter(Mandatory = $false)] + [System.String] + $SecondaryOwnerAlias, + + [parameter(Mandatory = $false)] + [System.String] + $Template, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] @@ -20,10 +64,8 @@ function Get-TargetResource Write-Verbose -Message "Getting site collection $Url" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $site = Get-SPSite $params.Url -ErrorAction SilentlyContinue + $site = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPSite" -Arguments @{ Identity = $params.Url } -ErrorAction SilentlyContinue if ($null -eq $site) { return @{} } else { @@ -49,39 +91,50 @@ function Set-TargetResource [parameter(Mandatory = $true)] [System.String] $OwnerAlias, - + + [parameter(Mandatory = $false)] [System.UInt32] - $CompatibilityLevel = $null, - + $CompatibilityLevel, + + [parameter(Mandatory = $false)] [System.String] - $ContentDatabase = $null, - + $ContentDatabase, + + [parameter(Mandatory = $false)] [System.String] - $Description = $null, - + $Description, + + [parameter(Mandatory = $false)] [System.String] - $HostHeaderWebApplication = $null, - + $HostHeaderWebApplication, + + [parameter(Mandatory = $false)] [System.UInt32] - $Language = $null, - + $Language, + + [parameter(Mandatory = $false)] [System.String] - $Name = $null, - + $Name, + + [parameter(Mandatory = $false)] [System.String] - $OwnerEmail = $null, - + $OwnerEmail, + + [parameter(Mandatory = $false)] [System.String] - $QuotaTemplate = $null, - + $QuotaTemplate, + + [parameter(Mandatory = $false)] [System.String] - $SecondaryEmail = $null, - + $SecondaryEmail, + + [parameter(Mandatory = $false)] [System.String] - $SecondaryOwnerAlias = $null, + $SecondaryOwnerAlias, + [parameter(Mandatory = $false)] [System.String] - $Template = $null, + $Template, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] @@ -91,16 +144,14 @@ function Set-TargetResource Write-Verbose -Message "Creating site collection $Url" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] $params = Remove-xSharePointNullParamValues -Params $params $params.Remove("InstallAccount") | Out-Null - $site = Get-SPSite $params.Url -ErrorAction SilentlyContinue + $site = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPSite" -Arguments @{ Identity = $params.Url } -ErrorAction SilentlyContinue if ($null -eq $site) { - New-SPSite @params | Out-Null + Invoke-xSharePointSPCmdlet -CmdletName "New-SPSite" -Arguments $params | Out-Null } } } @@ -119,46 +170,57 @@ function Test-TargetResource [parameter(Mandatory = $true)] [System.String] $OwnerAlias, - + + [parameter(Mandatory = $false)] [System.UInt32] - $CompatibilityLevel = $null, - + $CompatibilityLevel, + + [parameter(Mandatory = $false)] [System.String] - $ContentDatabase = $null, - + $ContentDatabase, + + [parameter(Mandatory = $false)] [System.String] - $Description = $null, - + $Description, + + [parameter(Mandatory = $false)] [System.String] - $HostHeaderWebApplication = $null, - + $HostHeaderWebApplication, + + [parameter(Mandatory = $false)] [System.UInt32] - $Language = $null, - + $Language, + + [parameter(Mandatory = $false)] [System.String] - $Name = $null, - + $Name, + + [parameter(Mandatory = $false)] [System.String] - $OwnerEmail = $null, - + $OwnerEmail, + + [parameter(Mandatory = $false)] [System.String] - $QuotaTemplate = $null, - + $QuotaTemplate, + + [parameter(Mandatory = $false)] [System.String] - $SecondaryEmail = $null, - + $SecondaryEmail, + + [parameter(Mandatory = $false)] [System.String] - $SecondaryOwnerAlias = $null, + $SecondaryOwnerAlias, + [parameter(Mandatory = $false)] [System.String] - $Template = $null, + $Template, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource -Url $Url -OwnerAlias $OwnerAlias -InstallAccount $InstallAccount + $result = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing site collection $Url" if ($result.Count -eq 0) { return $false } else { diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 index da7439bd5..190e9902b 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 @@ -8,6 +8,18 @@ function Get-TargetResource [System.String] $Name, + [parameter(Mandatory = $false)] + [System.Management.Automation.PSCredential] + $DatabaseCredentials, + + [parameter(Mandatory = $false)] + [System.String] + $DatabaseName, + + [parameter(Mandatory = $false)] + [System.String] + $DatabaseServer, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount @@ -16,11 +28,9 @@ function Get-TargetResource Write-Verbose -Message "Getting state service application '$Name'" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $app = Get-SPStateServiceApplication -Identity $params.Name -ErrorAction SilentlyContinue + $app = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPStateServiceApplication" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue if ($null -eq $app) { return @{} } @@ -41,14 +51,17 @@ function Set-TargetResource [System.String] $Name, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] - $DatabaseCredentials = $null, + $DatabaseCredentials, + [parameter(Mandatory = $false)] [System.String] - $DatabaseName = $null, + $DatabaseName, + [parameter(Mandatory = $false)] [System.String] - $DatabaseServer = $null, + $DatabaseServer, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] @@ -58,12 +71,9 @@ function Set-TargetResource Write-Verbose -Message "Creating state service application $Name" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $params = Remove-xSharePointNullParamValues -Params $params - $app = Get-SPStateServiceApplication -Identity $params.Name -ErrorAction SilentlyContinue + $app = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPStateServiceApplication" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue if ($null -eq $app) { $dbParams = @{} @@ -71,7 +81,9 @@ function Set-TargetResource if ($params.ContainsKey("DatabaseServer")) { $dbParams.Add("DatabaseServer", $params.DatabaseServer) } if ($params.ContainsKey("DatabaseCredentials")) { $dbParams.Add("DatabaseCredentials", $params.DatabaseCredentials) } - New-SPStateServiceDatabase @dbParams| New-SPStateServiceApplication -Name $params.Name | New-SPStateServiceApplicationProxy -DefaultProxyGroup + Invoke-xSharePointSPCmdlet -CmdletName "New-SPStateServiceDatabase" -Arguments $dbParams | ` + Invoke-xSharePointSPCmdlet -CmdletName "New-SPStateServiceApplication" -Arguments @{ Name = $params.Name } | ` + Invoke-xSharePointSPCmdlet -CmdletName "New-SPStateServiceApplicationProxy" -Arguments @{ DefaultProxyGroup = $true } } } } @@ -87,14 +99,17 @@ function Test-TargetResource [System.String] $Name, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] - $DatabaseCredentials = $null, + $DatabaseCredentials, + [parameter(Mandatory = $false)] [System.String] - $DatabaseName = $null, + $DatabaseName, + [parameter(Mandatory = $false)] [System.String] - $DatabaseServer = $null, + $DatabaseServer, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 index 15f658b3b..23f05dcc4 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 @@ -10,24 +10,59 @@ function Get-TargetResource [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] - $InstallAccount + $InstallAccount, + + [parameter(Mandatory = $false)] + [System.String] + $DatabaseName, + + [parameter(Mandatory = $false)] + [System.String] + $DatabasePassword, + + [parameter(Mandatory = $false)] + [System.String] + $DatabaseServer, + + [parameter(Mandatory = $false)] + [System.String] + $DatabaseUsername, + + [parameter(Mandatory = $false)] + [System.String] + $FailoverDatabaseServer, + + [parameter(Mandatory = $false)] + [System.UInt32] + $UsageLogCutTime, + + [parameter(Mandatory = $false)] + [System.String] + $UsageLogLocation, + + [parameter(Mandatory = $false)] + [System.UInt32] + $UsageLogMaxFileSizeKB, + + [parameter(Mandatory = $false)] + [System.UInt32] + $UsageLogMaxSpaceGB ) Write-Verbose -Message "Getting usage application '$Name'" - $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | - Where-Object { $_.TypeName -eq "Usage and Health Data Collection Service Application" } + + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName Usage + If ($null -eq $serviceApp) { return @{} } else { - $service = Get-SPUsageService + $service = Invoke-xSharePointCommand -CmdletName "Get-SPUsageService" return @{ Name = $serviceApp.DisplayName UsageLogCutTime = $service.UsageLogCutTime @@ -37,7 +72,7 @@ function Get-TargetResource } } } - $result + return $result } @@ -54,42 +89,49 @@ function Set-TargetResource [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $false)] [System.String] - $DatabaseName = $null, + $DatabaseName, + [parameter(Mandatory = $false)] [System.String] - $DatabasePassword = $null, + $DatabasePassword, + [parameter(Mandatory = $false)] [System.String] - $DatabaseServer = $null, + $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] - $DatabaseUsername = $null, + $DatabaseUsername, + [parameter(Mandatory = $false)] [System.String] - $FailoverDatabaseServer = $null, + $FailoverDatabaseServer, + [parameter(Mandatory = $false)] [System.UInt32] - $UsageLogCutTime = 5, + $UsageLogCutTime, + [parameter(Mandatory = $false)] [System.String] - $UsageLogLocation = $null, + $UsageLogLocation, + [parameter(Mandatory = $false)] [System.UInt32] - $UsageLogMaxFileSizeKB = 1024, + $UsageLogMaxFileSizeKB, + [parameter(Mandatory = $false)] [System.UInt32] - $UsageLogMaxSpaceGB = $null + $UsageLogMaxSpaceGB ) Write-Verbose -Message "Setting usage application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $app = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue + $app = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplication" -Arguments @{ Name = $params.Name } -ErrorAction SilentlyContinue if ($null -eq $app) { $newParams = @{} @@ -100,24 +142,20 @@ function Set-TargetResource if ($params.ContainsKey("DatabaseUsername")) { $newParams.Add("DatabaseUsername", $params.DatabaseUsername) } if ($params.ContainsKey("FailoverDatabaseServer")) { $newParams.Add("FailoverDatabaseServer", $params.FailoverDatabaseServer) } - New-SPUsageApplication @newParams + Invoke-xSharePointSPCmdlet -CmdletName "New-SPUsageApplication" -Arguments $newParams } } Write-Verbose -Message "Configuring usage application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $params = Remove-xSharePointNullParamValues -Params $params - $setParams = @{} $setParams.Add("LoggingEnabled", $true) if ($params.ContainsKey("UsageLogCutTime")) { $setParams.Add("UsageLogCutTime", $params.UsageLogCutTime) } if ($params.ContainsKey("UsageLogLocation")) { $setParams.Add("UsageLogLocation", $params.UsageLogLocation) } if ($params.ContainsKey("UsageLogMaxFileSizeKB")) { $setParams.Add("UsageLogMaxFileSizeKB", $params.UsageLogMaxFileSizeKB) } if ($params.ContainsKey("UsageLogMaxSpaceGB")) { $setParams.Add("UsageLogMaxSpaceGB", $params.UsageLogMaxSpaceGB) } - Set-SPUsageService @setParams + Invoke-xSharePointSPCmdlet -CmdletName "Set-SPUsageService" -Arguments $setParams } } @@ -136,35 +174,44 @@ function Test-TargetResource [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $false)] [System.String] - $DatabaseName = $null, + $DatabaseName, + [parameter(Mandatory = $false)] [System.String] - $DatabasePassword = $null, + $DatabasePassword, + [parameter(Mandatory = $false)] [System.String] - $DatabaseServer = $null, + $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] - $DatabaseUsername = $null, + $DatabaseUsername, + [parameter(Mandatory = $false)] [System.String] - $FailoverDatabaseServer = $null, + $FailoverDatabaseServer, + [parameter(Mandatory = $false)] [System.UInt32] - $UsageLogCutTime = 5, + $UsageLogCutTime, + [parameter(Mandatory = $false)] [System.String] - $UsageLogLocation = $null, + $UsageLogLocation, + [parameter(Mandatory = $false)] [System.UInt32] - $UsageLogMaxFileSizeKB = 1024, + $UsageLogMaxFileSizeKB, + [parameter(Mandatory = $false)] [System.UInt32] - $UsageLogMaxSpaceGB = $null + $UsageLogMaxSpaceGB ) - $result = Get-TargetResource -Name $Name -InstallAccount $InstallAccount + $result = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for usage application '$Name'" if ($result.Count -eq 0) { return $false } else { diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 index 5b7b891ef..43ffc2f1b 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 @@ -16,6 +16,34 @@ function Get-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, + [parameter(Mandatory = $false)] + [System.String] + $MySiteHostLocation, + + [parameter(Mandatory = $false)] + [System.String] + $ProfileDBName, + + [parameter(Mandatory = $false)] + [System.String] + $ProfileDBServer, + + [parameter(Mandatory = $false)] + [System.String] + $SocialDBName, + + [parameter(Mandatory = $false)] + [System.String] + $SocialDBServer, + + [parameter(Mandatory = $false)] + [System.String] + $SyncDBName, + + [parameter(Mandatory = $false)] + [System.String] + $SyncDBServer, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount @@ -24,11 +52,10 @@ function Get-TargetResource Write-Verbose -Message "Getting user profile service application $Name" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | - Where-Object { $_.TypeName -eq "User Profile Service Application" } + + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName UserProfile + If ($null -eq $serviceApp) { return @{} @@ -41,7 +68,7 @@ function Get-TargetResource } } } - $result + return $result } @@ -62,26 +89,33 @@ function Set-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, + [parameter(Mandatory = $false)] [System.String] - $MySiteHostLocation = $null, + $MySiteHostLocation, + [parameter(Mandatory = $false)] [System.String] - $ProfileDBName = $null, + $ProfileDBName, + [parameter(Mandatory = $false)] [System.String] - $ProfileDBServer = $null, + $ProfileDBServer, + [parameter(Mandatory = $false)] [System.String] - $SocialDBName = $null, + $SocialDBName, + [parameter(Mandatory = $false)] [System.String] - $SocialDBServer = $null, + $SocialDBServer, + [parameter(Mandatory = $false)] [System.String] - $SyncDBName = $null, + $SyncDBName, + [parameter(Mandatory = $false)] [System.String] - $SyncDBServer = $null, + $SyncDBServer, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] @@ -104,22 +138,23 @@ function Set-TargetResource ([ADSI]"WinNT://$computerName/Administrators,group").Add("WinNT://$domainName/$userName") | Out-Null } - $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - + $result = Invoke-xSharePointCommand -Credential $FarmAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $params = Remove-xSharePointNullParamValues -Params $params - $params.Remove("InstallAccount") | Out-Null + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } $params.Remove("FarmAccount") | Out-Null $params = Rename-xSharePointParamValue -params $params -oldName "SyncDBName" -newName "ProfileSyncDBName" $params = Rename-xSharePointParamValue -params $params -oldName "SyncDBServer" -newName "ProfileSyncDBServer" - $app = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName UserProfile if ($null -eq $app) { - $app = New-SPProfileServiceApplication @params + $app = Invoke-xSharePointSPCmdlet -CmdletName "New-SPProfileServiceApplication" -Arguments $params if ($null -ne $app) { - New-SPProfileServiceApplicationProxy -Name ($params.Name + " Proxy") -ServiceApplication $app -DefaultProxyGroup + Invoke-xSharePointSPCmdlet -CmdletName "New-SPProfileServiceApplicationProxy" -Arguments @{ + Name = "$($params.Name) Proxy" + ServiceApplication = $app + DefaultProxyGroup = $true + } } } } @@ -151,33 +186,40 @@ function Test-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, + [parameter(Mandatory = $false)] [System.String] - $MySiteHostLocation = $null, + $MySiteHostLocation, + [parameter(Mandatory = $false)] [System.String] - $ProfileDBName = $null, + $ProfileDBName, + [parameter(Mandatory = $false)] [System.String] - $ProfileDBServer = $null, + $ProfileDBServer, + [parameter(Mandatory = $false)] [System.String] - $SocialDBName = $null, + $SocialDBName, + [parameter(Mandatory = $false)] [System.String] - $SocialDBServer = $null, + $SocialDBServer, + [parameter(Mandatory = $false)] [System.String] - $SyncDBName = $null, + $SyncDBName, + [parameter(Mandatory = $false)] [System.String] - $SyncDBServer = $null, + $SyncDBServer, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -FarmAccount $FarmAccount -InstallAccount $InstallAccount + $result = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for user profile service application $Name" if ($result.Count -eq 0) { return $false } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 index dcd5a2789..571b9faba 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 @@ -24,13 +24,9 @@ function Get-TargetResource Write-Verbose -Message "Getting the local user profile sync service instance" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $computerName = $env:COMPUTERNAME - $syncService = Get-SPServiceInstance | - Where-Object {$_.TypeName -match "User Profile Synchronization Service" -and $_.Server -match "SPServer Name=$computerName" } + $syncService = Get-xSharePointServiceApplication -Name $params.Name -TypeName UserProfileSync if ($null -eq $syncService) { return @{} } @@ -38,7 +34,7 @@ function Get-TargetResource Status = $syncService.Status } } - $result + return $result } @@ -85,25 +81,23 @@ function Set-TargetResource Restart-Service -Name "SPTimerV4" } - Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - + Invoke-xSharePointCommand -Credential $FarmAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $computerName = $env:COMPUTERNAME - $syncService = Get-SPServiceInstance | - Where-Object {$_.TypeName -match "User Profile Synchronization Service" -and $_.Server -match "SPServer Name=$computerName" } + $syncService = Get-xSharePointServiceApplication -Name $params.Name -TypeName UserProfileSync # Start the Sync service if it should be running on this server if (($Ensure -eq "Present") -and ($syncService.Status -ne "Online")) { - $ups = Get-SPServiceApplication -Name $params.UserProfileServiceAppName - $ups.SetSynchronizationMachine("$computerName", $syncService.ID, $params.FarmAccount.UserName, $params.FarmAccount.GetNetworkCredential().Password) - Start-SPServiceInstance -Identity $syncService.ID - $desiredState = "Online" + $ups = Get-xSharePointServiceApplication -Name $params.UserProfileServiceAppName -TypeName UserProfile + $ups.SetSynchronizationMachine($env:COMPUTERNAME, $syncService.ID, $params.FarmAccount.UserName, $params.FarmAccount.GetNetworkCredential().Password) + + Invoke-xSharePointSPCmdlet -CmdletName "Start-SPServiceInstance" -Arguments @{ Identity = $syncService.ID } + + $desiredState = "Online" } # Stop the Sync service in all other cases else { - Stop-SPServiceInstance -Identity $syncService.ID -Confirm:$false + Invoke-xSharePointSPCmdlet -CmdletName "Stop-SPServiceInstance" -Arguments @{ Identity = $syncService.ID; Confirm = $false } $desiredState = "Disabled" } @@ -114,9 +108,7 @@ function Set-TargetResource Start-Sleep -Seconds 60 # Get the current status of the Sync service - $syncService = $(Get-SPServiceInstance | - Where-Object {$_.TypeName -match "User Profile Synchronization Service" } | - Where-Object {$_.Server -match "SPServer Name=$computerName"}) + $syncService = Get-xSharePointServiceApplication -Name $params.Name -TypeName UserProfileSync # Continue to wait if haven't reached $maxCount or $desiredState $wait = (($count -lt $maxCount) -and ($syncService.Status -ne $desiredState)) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 index bac760aaa..e41a71bf9 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 @@ -19,8 +19,37 @@ function Get-TargetResource [parameter(Mandatory = $true)] [System.String] $Url, + + [parameter(Mandatory = $false)] + [System.Boolean] + $AllowAnonymous, + + [parameter(Mandatory = $false)] + [ValidateSet("NTLM","Kerberos")] + [System.String] + $AuthenticationMethod, + + [parameter(Mandatory = $false)] + [System.String] + $DatabaseName, + + [parameter(Mandatory = $false)] + [System.String] + $DatabaseServer, + + [parameter(Mandatory = $false)] + [System.String] + $HostHeader, + + [parameter(Mandatory = $false)] + [System.String] + $Path, + + [parameter(Mandatory = $false)] + [System.String] + $Port, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) @@ -28,10 +57,9 @@ function Get-TargetResource Write-Verbose -Message "Getting web application '$Name'" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] - $wa = Get-SPWebApplication $params.Name -ErrorAction SilentlyContinue + + $wa = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue if ($null -eq $wa) { return @{} } return @{ @@ -40,7 +68,7 @@ function Get-TargetResource ApplicationPoolAccount = $wa.ApplicationPool.Username } } - $result + return $result } @@ -64,30 +92,37 @@ function Set-TargetResource [parameter(Mandatory = $true)] [System.String] $Url, - + + [parameter(Mandatory = $false)] [System.Boolean] - $AllowAnonymous = $false, - + $AllowAnonymous, + + [parameter(Mandatory = $false)] [ValidateSet("NTLM","Kerberos")] [System.String] - $AuthenticationMethod = "NTLM", - + $AuthenticationMethod, + + [parameter(Mandatory = $false)] [System.String] - $DatabaseName = $null, - + $DatabaseName, + + [parameter(Mandatory = $false)] [System.String] - $DatabaseServer = $null, - + $DatabaseServer, + + [parameter(Mandatory = $false)] [System.String] - $HostHeader = $null, - + $HostHeader, + + [parameter(Mandatory = $false)] [System.String] - $Path = $null, - + $Path, + + [parameter(Mandatory = $false)] [System.String] - $Port = $null, + $Port, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) @@ -95,28 +130,30 @@ function Set-TargetResource Write-Verbose -Message "Creating web application '$Name'" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - $params = $args[0] if ($AuthenticationMethod -eq "NTLM") { - $ap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication -DisableKerberos - $params.Add("AuthenticationProvider", $ap) + $ap = Invoke-xSharePointSPCmdlet -CmdletName "New-SPAuthenticationProvider" -Arguments @{ + UseWindowsIntegratedAuthentication = $true + DisableKerberos = $true + } } else { - $ap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication - $params.Add("AuthenticationProvider", $ap) + $ap = Invoke-xSharePointSPCmdlet -CmdletName "New-SPAuthenticationProvider" -Arguments @{ + UseWindowsIntegratedAuthentication = $true + } } + $params.Add("AuthenticationProvider", $ap) - $wa = Get-SPWebApplication $params.Name -ErrorAction SilentlyContinue + $wa = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue if ($null -eq $wa) { - $params.Remove("InstallAccount") | Out-Null + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } if ($params.ContainsKey("AuthenticationMethod")) { $params.Remove("AuthenticationMethod") | Out-Null } if ($params.ContainsKey("AllowAnonymous")) { $params.Remove("AllowAnonymous") | Out-Null $params.Add("AllowAnonymousAccess", $true) } - New-SPWebApplication @params + Invoke-xSharePointSPCmdlet -CmdletName "New-SPWebApplication" -Arguments $params } } } @@ -143,31 +180,38 @@ function Test-TargetResource [parameter(Mandatory = $true)] [System.String] $Url, - + + [parameter(Mandatory = $false)] [System.Boolean] - $AllowAnonymous = $false, - + $AllowAnonymous, + + [parameter(Mandatory = $false)] [ValidateSet("NTLM","Kerberos")] [System.String] - $AuthenticationMethod = "NTLM", - + $AuthenticationMethod, + + [parameter(Mandatory = $false)] [System.String] - $DatabaseName = $null, - + $DatabaseName, + + [parameter(Mandatory = $false)] [System.String] - $DatabaseServer = $null, - + $DatabaseServer, + + [parameter(Mandatory = $false)] [System.String] - $HostHeader = $null, - + $HostHeader, + + [parameter(Mandatory = $false)] [System.String] - $Path = $null, - + $Path, + + [parameter(Mandatory = $false)] [System.String] - $Port = $null, + $Port, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] - [parameter(Mandatory = $false)] $InstallAccount ) diff --git a/Modules/xSharePoint/Modules/xSharePoint.CacheAccounts/xSharePoint.CacheAccounts.psm1 b/Modules/xSharePoint/Modules/xSharePoint.CacheAccounts/xSharePoint.CacheAccounts.psm1 new file mode 100644 index 000000000..3ba4186d5 --- /dev/null +++ b/Modules/xSharePoint/Modules/xSharePoint.CacheAccounts/xSharePoint.CacheAccounts.psm1 @@ -0,0 +1,33 @@ +function Set-xSharePointCacheReaderPolicy() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + $WebApplication, + + [parameter(Mandatory = $true,Position=2)] + [string] + $UserName + ) + $policy = $WebApplication.Policies.Add($UserName, $UserName) + $policyRole = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullRead) + $policy.PolicyRoleBindings.Add($policyRole) +} + +function Set-xSharePointCacheOwnerPolicy() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + $WebApplication, + + [parameter(Mandatory = $true,Position=2)] + [string] + $UserName + ) + $policy = $WebApplication.Policies.Add($UserName, $UserName) + $policyRole = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullControl) + $policy.PolicyRoleBindings.Add($policyRole) +} + +Export-ModuleMember -Function * \ No newline at end of file diff --git a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 index ca3e3ba63..1415a166f 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 @@ -11,9 +11,10 @@ function Add-xSharePointDistributedCacheServer() { $ServiceAccount ) - Add-SPDistributedCacheServiceInstance - Update-SPDistributedCacheSize -CacheSizeInMB $CacheSizeInMB - $farm = Get-SPFarm + Invoke-xSharePointSPCmdlet -CmdletName "Add-SPDistributedCacheServiceInstance" + Invoke-xSharePointSPCmdlet -CmdletName "Update-SPDistributedCacheSize" -Arguments @{ CacheSizeInMB = $CacheSizeInMB } + + $farm = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFarm" $cacheService = $farm.Services | Where-Object {$_.Name -eq "AppFabricCachingService"} $cacheService.ProcessIdentity.CurrentIdentityType = "SpecificUser" $cacheService.ProcessIdentity.ManagedAccount = (Get-SPManagedAccount -Identity $ServiceAccount) @@ -23,9 +24,9 @@ function Add-xSharePointDistributedCacheServer() { function Remove-xSharePointDistributedCacheServer() { $instanceName ="SPDistributedCacheService Name=AppFabricCachingService" - $serviceInstance = Get-SPServiceInstance | Where-Object {($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq $env:computername} + $serviceInstance = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" | Where-Object {($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq $env:computername} $serviceInstance.Delete() - Remove-SPDistributedCacheServiceInstance + Invoke-xSharePointSPCmdlet -CmdletName "Remove-SPDistributedCacheServiceInstance" } Export-ModuleMember -Function * diff --git a/Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 b/Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 index e21ea9fa5..e5b53f9d3 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 @@ -7,7 +7,7 @@ function Get-xSharePointServiceApplication() { $Name, [parameter(Mandatory = $true,Position=2)] - [ValidateSet("BCS")] + [ValidateSet("BCS", "MMS", "Search", "SecureStore", "Usage", "UserProfile", "UserProfileSync")] [string] $TypeName ) @@ -27,6 +27,12 @@ function Get-xSharePointServiceApplicationName() { ) Switch($Name) { "BCS" { return "Business Data Connectivity Service Application" } + "MMS" { return "Managed Metadata Service" } + "Search" { return "Search Service Application" } + "SecureStore" { return "Secure Store Service Application" } + "Usage" { return "Usage and Health Data Collection Service Application" } + "UserProfile" { return "User Profile Service Application" } + "UserProfileSync" { return "User Profile Synchronization Service" } } } diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index e0469bb23..98d4742a7 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -97,7 +97,7 @@ function Rename-xSharePointParamValue() { [CmdletBinding()] param ( - [parameter(Mandatory = $true,Position=1)] + [parameter(Mandatory = $true,Position=1,ValueFromPipeline=$true)] $params, [parameter(Mandatory = $true,Position=2)] diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1 index 5c93201c8..e9477521f 100644 --- a/Modules/xSharePoint/xSharePoint.psd1 +++ b/Modules/xSharePoint/xSharePoint.psd1 @@ -79,7 +79,9 @@ CmdletsToExport = @("Add-xSharePointDistributedCacheServer", "Invoke-xSharePointSPCmdlet", "Rename-xSharePointParamValue", "Remove-xSharePointNullParamValues", - "Get-xSharePointServiceApplication") + "Get-xSharePointServiceApplication", + "Set-xSharePointCacheReaderPolicy", + "Set-xSharePointCacheOwnerPolicy") # Variables to export from this module VariablesToExport = '*' diff --git a/Modules/xSharePoint/xSharePoint.pssproj b/Modules/xSharePoint/xSharePoint.pssproj index 4725d3a3f..561ee6f50 100644 --- a/Modules/xSharePoint/xSharePoint.pssproj +++ b/Modules/xSharePoint/xSharePoint.pssproj @@ -75,6 +75,7 @@ + @@ -125,6 +126,7 @@ + From b1ddb0e65513f314ff537987946b75d45ae9600b Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Wed, 9 Sep 2015 20:50:29 +1000 Subject: [PATCH 022/146] Removed looping from join farm in favour of WaitFor options in PS5 --- .../MSFT_xSPDiagnosticLoggingSettings.psm1 | 100 +++++++------- .../MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 | 53 ++------ .../MSFT_xSPJoinFarm.schema.mof | 2 - .../MSFT_xSPManagedMetaDataServiceApp.psm1 | 36 ++--- .../MSFT_xSPManagedPath.psm1 | 8 +- .../MSFT_xSPSearchServiceApp.psm1 | 34 ++--- .../MSFT_xSPSecureStoreServiceApp.psm1 | 76 +++++------ .../MSFT_xSPServiceAppPool.psm1 | 12 +- .../MSFT_xSPServiceInstance.psm1 | 2 +- .../MSFT_xSPSite/MSFT_xSPSite.psm1 | 126 +++++++++--------- .../MSFT_xSPStateServiceApp.psm1 | 22 +-- .../MSFT_xSPUsageApplication.psm1 | 60 ++++----- .../MSFT_xSPUserProfileServiceApp.psm1 | 52 ++++---- .../MSFT_xSPUserProfileSyncService.psm1 | 6 +- .../MSFT_xSPWebApplication.psm1 | 104 +++++++-------- .../xSharePoint.ServiceApplications.psm1 | 12 +- 16 files changed, 335 insertions(+), 370 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 index 77689398c..22a1c0297 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 @@ -12,67 +12,67 @@ function Get-TargetResource [System.UInt32] $LogSpaceInGB, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $AppAnalyticsAutomaticUploadEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $CustomerExperienceImprovementProgramEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $DaysToKeepLogs, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $DownloadErrorReportingUpdatesEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $ErrorReportingAutomaticUploadEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $ErrorReportingEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $EventLogFloodProtectionEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionNotifyInterval, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionQuietPeriod, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionThreshold, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionTriggerPeriod, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $LogCutInterval, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $LogMaxDiskSpaceUsageEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $ScriptErrorReportingDelay, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $ScriptErrorReportingEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $ScriptErrorReportingRequireAuth, @@ -127,67 +127,67 @@ function Set-TargetResource [System.UInt32] $LogSpaceInGB, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $AppAnalyticsAutomaticUploadEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $CustomerExperienceImprovementProgramEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $DaysToKeepLogs, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $DownloadErrorReportingUpdatesEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $ErrorReportingAutomaticUploadEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $ErrorReportingEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $EventLogFloodProtectionEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionNotifyInterval, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionQuietPeriod, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionThreshold, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionTriggerPeriod, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $LogCutInterval, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $LogMaxDiskSpaceUsageEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $ScriptErrorReportingDelay, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $ScriptErrorReportingEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $ScriptErrorReportingRequireAuth, @@ -203,9 +203,9 @@ function Set-TargetResource if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } $params = $params | Rename-xSharePointParamValue -oldName "LogPath" -newName "LogLocation" ` - | Rename-xSharePointParamValue -oldName "LogSpaceInGB" -newName "LogDiskSpaceUsageGB" + | Rename-xSharePointParamValue -oldName "LogSpaceInGB" -newName "LogDiskSpaceUsageGB" - Invoke-xSharePointSPCmdlet -CmdletName "Set-SPDiagnosticConfig" -Arguments $params + Invoke-xSharePointSPCmdlet -CmdletName "Set-SPDiagnosticConfig" -Arguments $params } } @@ -224,67 +224,67 @@ function Test-TargetResource [System.UInt32] $LogSpaceInGB, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $AppAnalyticsAutomaticUploadEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $CustomerExperienceImprovementProgramEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $DaysToKeepLogs, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $DownloadErrorReportingUpdatesEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $ErrorReportingAutomaticUploadEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $ErrorReportingEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $EventLogFloodProtectionEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionNotifyInterval, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionQuietPeriod, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionThreshold, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionTriggerPeriod, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $LogCutInterval, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $LogMaxDiskSpaceUsageEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $ScriptErrorReportingDelay, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $ScriptErrorReportingEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $ScriptErrorReportingRequireAuth, diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 index 9b7c89f0f..8f8883045 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 @@ -60,32 +60,23 @@ function Set-TargetResource [parameter(Mandatory = $true)] [System.String] - $Passphrase, - - [System.UInt32] - $WaitTime = 30, - - [System.UInt32] - $WaitCount = 60 + $Passphrase ) Write-Verbose -Message "Joining existing farm configuration database" - if ($PSBoundParameters.WaitTime -eq $null) { $PSBoundParameters.Add("WaitTime", $WaitTime) } - if ($PSBoundParameters.WaitCount -eq $null) { $PSBoundParameters.Add("WaitCount", $WaitCount) } - Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] $loopCount = 0 - $joinFarmArgs = @{ + $joinFarmArgs = @{ DatabaseServer = $params.DatabaseServer DatabaseName = $params.FarmConfigDatabaseName Passphrase = (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) SkipRegisterAsDistributedCacheHost = $true } - switch((Get-xSharePointInstalledProductVersion).FileMajorPart) { + switch((Get-xSharePointInstalledProductVersion).FileMajorPart) { 15 { Write-Verbose -Message "Detected Version: SharePoint 2013" } @@ -98,30 +89,12 @@ function Set-TargetResource } } - $WaitTime = $params.WaitTime - $WaitCount = $params.WaitCount - - $success = $false - while ($loopCount -le $WaitCount) { - try - { - Invoke-xSharePointSPCmdlet -CmdletName "Connect-SPConfigurationDatabase" -Arguments $joinFarmArgs - $loopCount = $WaitCount + 1 - $success = $true - } - catch - { - $loopCount = $loopCount + 1 - Start-Sleep -Seconds $WaitTime - } - } - if ($success) { - Invoke-xSharePointSPCmdlet -CmdletName "Install-SPHelpCollection" -Arguments @{ All = $true } - Invoke-xSharePointSPCmdlet -CmdletName "Initialize-SPResourceSecurity" - Invoke-xSharePointSPCmdlet -CmdletName "Install-SPService" - Invoke-xSharePointSPCmdlet -CmdletName "Install-SPFeature" -Arguments @{ AllExistingFeatures = $true; Force = $true } - Invoke-xSharePointSPCmdlet -CmdletName "Install-SPApplicationContent" - } + Invoke-xSharePointSPCmdlet -CmdletName "Connect-SPConfigurationDatabase" -Arguments $joinFarmArgs + Invoke-xSharePointSPCmdlet -CmdletName "Install-SPHelpCollection" -Arguments @{ All = $true } + Invoke-xSharePointSPCmdlet -CmdletName "Initialize-SPResourceSecurity" + Invoke-xSharePointSPCmdlet -CmdletName "Install-SPService" + Invoke-xSharePointSPCmdlet -CmdletName "Install-SPFeature" -Arguments @{ AllExistingFeatures = $true; Force = $true } + Invoke-xSharePointSPCmdlet -CmdletName "Install-SPApplicationContent" } Write-Verbose -Message "Starting timer service" @@ -155,13 +128,7 @@ function Test-TargetResource [parameter(Mandatory = $true)] [System.String] - $Passphrase, - - [System.UInt32] - $WaitTime = 30, - - [System.UInt32] - $WaitCount = 60 + $Passphrase ) $result = Get-TargetResource @PSBoundParameters diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof index 39c0506a2..da712b9ea 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof @@ -5,7 +5,5 @@ class MSFT_xSPJoinFarm : OMI_BaseResource [Key] string DatabaseServer; [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Required] string Passphrase; - [Write] uint32 WaitTime; - [Write] uint32 WaitCount; }; diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 index e5f6041ee..5db30c1a6 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 @@ -12,11 +12,11 @@ function Get-TargetResource [System.String] $ApplicationPool, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseName, @@ -68,11 +68,11 @@ function Set-TargetResource [System.String] $ApplicationPool, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseName, @@ -94,13 +94,13 @@ function Set-TargetResource if ($null -ne $app) { Invoke-xSharePointSPCmdlet -CmdletName "New-SPMetadataServiceApplicationProxy" -Arguments @{ - Name = ($params.Name + " Proxy") - ServiceApplication = $app - DefaultProxyGroup = $true - ContentTypePushdownEnabled = $true - DefaultKeywordTaxonomy = $true - DefaultSiteCollectionTaxonomy = $true - } + Name = ($params.Name + " Proxy") + ServiceApplication = $app + DefaultProxyGroup = $true + ContentTypePushdownEnabled = $true + DefaultKeywordTaxonomy = $true + DefaultSiteCollectionTaxonomy = $true + } } } } @@ -110,11 +110,11 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName MMS - Invoke-xSharePointSPCmdlet -CmdletName "Set-SPMetadataServiceApplication" -Arguments @{ - Identity = $serviceApp - ApplicationPool = (Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" -Arguments @{ Identity = $params.ApplicationPool } ) - } + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName MMS + Invoke-xSharePointSPCmdlet -CmdletName "Set-SPMetadataServiceApplication" -Arguments @{ + Identity = $serviceApp + ApplicationPool = (Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" -Arguments @{ Identity = $params.ApplicationPool } ) + } } } } @@ -139,11 +139,11 @@ function Test-TargetResource [System.String] $ApplicationPool, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseName ) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 index 9fc0439ec..0732296bd 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 @@ -29,13 +29,13 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $getParams = @{ - Identity = $params.RelativeUrl - } + $getParams = @{ + Identity = $params.RelativeUrl + } if ($params.HostHeader) { $getParams.Add("HostHeader", $true) } - $path = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPManagedPath" -Arguments $getParams -ErrorAction SilentlyContinue + $path = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPManagedPath" -Arguments $getParams -ErrorAction SilentlyContinue if ($null -eq $path) { return @{} } return @{ diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 index 6a96063d2..82d9a3aba 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 @@ -12,11 +12,11 @@ function Get-TargetResource [System.String] $ApplicationPool, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseName, @@ -30,7 +30,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName Search + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName Search If ($null -eq $serviceApp) { @@ -61,11 +61,11 @@ function Set-TargetResource [System.String] $ApplicationPool, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseName, @@ -80,16 +80,16 @@ function Set-TargetResource Write-Verbose -Message "Creating Search Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } - $serviceInstance = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPEnterpriseSearchServiceInstance" -Arguments @{ Local = $true } + $serviceInstance = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPEnterpriseSearchServiceInstance" -Arguments @{ Local = $true } $serviceInstance | Invoke-xSharePointSPCmdlet -CmdletName "Start-SPEnterpriseSearchServiceInstance" -ErrorAction SilentlyContinue $app = Invoke-xSharePointSPCmdlet -CmdletName "New-SPEnterpriseSearchServiceApplication" -Arguments $params if ($app) { Invoke-xSharePointSPCmdlet -CmdletName "New-SPEnterpriseSearchServiceApplicationProxy" -Arguments @{ - Name = "$($params.Name) Proxy" - SearchApplication = $app - } + Name = "$($params.Name) Proxy" + SearchApplication = $app + } } } } @@ -99,11 +99,11 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName Search - Invoke-xSharePointSPCmdlet -CmdletName "Set-SPEnterpriseSearchServiceApplication" -Arguments @{ - Identity = $serviceApp - ApplicationPool = (Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" -Arguments @{ Identity = $params.ApplicationPool } ) - } + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName Search + Invoke-xSharePointSPCmdlet -CmdletName "Set-SPEnterpriseSearchServiceApplication" -Arguments @{ + Identity = $serviceApp + ApplicationPool = (Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" -Arguments @{ Identity = $params.ApplicationPool } ) + } } } } @@ -124,11 +124,11 @@ function Test-TargetResource [System.String] $ApplicationPool, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseName, diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 index b837145b9..784c427ea 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 @@ -16,39 +16,39 @@ function Get-TargetResource [System.Boolean] $AuditingEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $AuditlogMaxSize, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseName, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabasePassword, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseUsername, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $FailoverDatabaseServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $PartitionMode, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $Sharing = $true, @@ -62,7 +62,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName SecureStore + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName SecureStore If ($null -eq $serviceApp) { @@ -97,39 +97,39 @@ function Set-TargetResource [System.Boolean] $AuditingEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $AuditlogMaxSize, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseName, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabasePassword, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseUsername, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $FailoverDatabaseServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $PartitionMode, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $Sharing = $true, @@ -138,20 +138,20 @@ function Set-TargetResource $InstallAccount ) - $result = Get-TargetResource @PSBoundParameters + $result = Get-TargetResource @PSBoundParameters if ($result.Count -eq 0) { Write-Verbose -Message "Creating Secure Store Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } $app = Invoke-xSharePointSPCmdlet -CmdletName "New-SPSecureStoreServiceApplication" -Arguments $params if ($app) { Invoke-xSharePointSPCmdlet -CmdletName "New-SPSecureStoreServiceApplicationProxy" -Arguments @{ - Name = "$($params.Name) Proxy" - SearchApplication = $app - } + Name = "$($params.Name) Proxy" + SearchApplication = $app + } } } } @@ -161,11 +161,11 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName SecureStore - Invoke-xSharePointSPCmdlet -CmdletName "Set-SPSecureStoreServiceApplication" -Arguments @{ - Identity = $serviceApp - ApplicationPool = (Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" -Arguments @{ Identity = $params.ApplicationPool } ) - } + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName SecureStore + Invoke-xSharePointSPCmdlet -CmdletName "Set-SPSecureStoreServiceApplication" -Arguments @{ + Identity = $serviceApp + ApplicationPool = (Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" -Arguments @{ Identity = $params.ApplicationPool } ) + } } } } @@ -210,39 +210,39 @@ function Test-TargetResource [System.Boolean] $AuditingEnabled, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $AuditlogMaxSize, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseName, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabasePassword, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseUsername, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $FailoverDatabaseServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $PartitionMode, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Boolean] $Sharing = $true, diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 index e39f97458..a6be54868 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 @@ -60,15 +60,15 @@ function Set-TargetResource $sap = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue if ($null -eq $sap) { Invoke-xSharePointSPCmdlet -CmdletName "New-SPServiceApplicationPool" -Arguments @{ - Name = $params.Name - Account = $params.ServiceAccount - } + Name = $params.Name + Account = $params.ServiceAccount + } } else { if ($sap.ProcessAccountName -ne $params.ServiceAccount) { Invoke-xSharePointSPCmdlet -CmdletName "Set-SPServiceApplicationPool" -Arguments @{ - Identity = $params.Name - Account = $params.ServiceAccount - } + Identity = $params.Name + Account = $params.ServiceAccount + } } } } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 index 937984f8c..afb70bb9e 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 @@ -72,7 +72,7 @@ function Set-TargetResource $si = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Server = $env:COMPUTERNAME } | Where-Object { $_.TypeName -eq $params.Name } if ($null -eq $si) { return $false } - Invoke-xSharePointSPCmdlet -CmdletName "Stop-SPServiceInstance" -Arguments @{ Identity = $si } + Invoke-xSharePointSPCmdlet -CmdletName "Stop-SPServiceInstance" -Arguments @{ Identity = $si } } } } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 index 4ff678758..aa6b8d1d4 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 @@ -11,48 +11,48 @@ function Get-TargetResource [parameter(Mandatory = $true)] [System.String] $OwnerAlias, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.UInt32] $CompatibilityLevel, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $ContentDatabase, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $Description, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $HostHeaderWebApplication, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.UInt32] $Language, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $Name, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $OwnerEmail, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $QuotaTemplate, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $SecondaryEmail, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $SecondaryOwnerAlias, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $Template, @@ -91,48 +91,48 @@ function Set-TargetResource [parameter(Mandatory = $true)] [System.String] $OwnerAlias, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.UInt32] $CompatibilityLevel, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $ContentDatabase, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $Description, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $HostHeaderWebApplication, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.UInt32] $Language, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $Name, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $OwnerEmail, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $QuotaTemplate, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $SecondaryEmail, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $SecondaryOwnerAlias, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $Template, @@ -170,48 +170,48 @@ function Test-TargetResource [parameter(Mandatory = $true)] [System.String] $OwnerAlias, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.UInt32] $CompatibilityLevel, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $ContentDatabase, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $Description, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $HostHeaderWebApplication, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.UInt32] $Language, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $Name, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $OwnerEmail, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $QuotaTemplate, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $SecondaryEmail, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $SecondaryOwnerAlias, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $Template, diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 index 190e9902b..95a599c65 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 @@ -8,15 +8,15 @@ function Get-TargetResource [System.String] $Name, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseName, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, @@ -51,15 +51,15 @@ function Set-TargetResource [System.String] $Name, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseName, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, @@ -82,8 +82,8 @@ function Set-TargetResource if ($params.ContainsKey("DatabaseCredentials")) { $dbParams.Add("DatabaseCredentials", $params.DatabaseCredentials) } Invoke-xSharePointSPCmdlet -CmdletName "New-SPStateServiceDatabase" -Arguments $dbParams | ` - Invoke-xSharePointSPCmdlet -CmdletName "New-SPStateServiceApplication" -Arguments @{ Name = $params.Name } | ` - Invoke-xSharePointSPCmdlet -CmdletName "New-SPStateServiceApplicationProxy" -Arguments @{ DefaultProxyGroup = $true } + Invoke-xSharePointSPCmdlet -CmdletName "New-SPStateServiceApplication" -Arguments @{ Name = $params.Name } | ` + Invoke-xSharePointSPCmdlet -CmdletName "New-SPStateServiceApplicationProxy" -Arguments @{ DefaultProxyGroup = $true } } } } @@ -99,15 +99,15 @@ function Test-TargetResource [System.String] $Name, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseName, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 index 23f05dcc4..0ac0293a0 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 @@ -12,49 +12,49 @@ function Get-TargetResource [System.Management.Automation.PSCredential] $InstallAccount, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseName, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabasePassword, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseUsername, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $FailoverDatabaseServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $UsageLogCutTime, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $UsageLogLocation, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $UsageLogMaxFileSizeKB, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $UsageLogMaxSpaceGB ) Write-Verbose -Message "Getting usage application '$Name'" - $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName Usage + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName Usage If ($null -eq $serviceApp) { @@ -89,39 +89,39 @@ function Set-TargetResource [System.Management.Automation.PSCredential] $InstallAccount, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseName, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabasePassword, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseUsername, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $FailoverDatabaseServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $UsageLogCutTime, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $UsageLogLocation, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $UsageLogMaxFileSizeKB, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $UsageLogMaxSpaceGB ) @@ -155,7 +155,7 @@ function Set-TargetResource if ($params.ContainsKey("UsageLogLocation")) { $setParams.Add("UsageLogLocation", $params.UsageLogLocation) } if ($params.ContainsKey("UsageLogMaxFileSizeKB")) { $setParams.Add("UsageLogMaxFileSizeKB", $params.UsageLogMaxFileSizeKB) } if ($params.ContainsKey("UsageLogMaxSpaceGB")) { $setParams.Add("UsageLogMaxSpaceGB", $params.UsageLogMaxSpaceGB) } - Invoke-xSharePointSPCmdlet -CmdletName "Set-SPUsageService" -Arguments $setParams + Invoke-xSharePointSPCmdlet -CmdletName "Set-SPUsageService" -Arguments $setParams } } @@ -174,39 +174,39 @@ function Test-TargetResource [System.Management.Automation.PSCredential] $InstallAccount, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseName, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabasePassword, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $DatabaseUsername, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $FailoverDatabaseServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $UsageLogCutTime, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $UsageLogLocation, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $UsageLogMaxFileSizeKB, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.UInt32] $UsageLogMaxSpaceGB ) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 index 43ffc2f1b..6595bbfe8 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 @@ -16,31 +16,31 @@ function Get-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $MySiteHostLocation, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $ProfileDBName, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $ProfileDBServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $SocialDBName, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $SocialDBServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $SyncDBName, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $SyncDBServer, @@ -54,7 +54,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName UserProfile + $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName UserProfile If ($null -eq $serviceApp) { @@ -89,31 +89,31 @@ function Set-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $MySiteHostLocation, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $ProfileDBName, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $ProfileDBServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $SocialDBName, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $SocialDBServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $SyncDBName, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $SyncDBServer, @@ -151,10 +151,10 @@ function Set-TargetResource $app = Invoke-xSharePointSPCmdlet -CmdletName "New-SPProfileServiceApplication" -Arguments $params if ($null -ne $app) { Invoke-xSharePointSPCmdlet -CmdletName "New-SPProfileServiceApplicationProxy" -Arguments @{ - Name = "$($params.Name) Proxy" - ServiceApplication = $app - DefaultProxyGroup = $true - } + Name = "$($params.Name) Proxy" + ServiceApplication = $app + DefaultProxyGroup = $true + } } } } @@ -186,31 +186,31 @@ function Test-TargetResource [System.Management.Automation.PSCredential] $FarmAccount, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $MySiteHostLocation, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $ProfileDBName, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $ProfileDBServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $SocialDBName, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $SocialDBServer, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $SyncDBName, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.String] $SyncDBServer, diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 index 571b9faba..c3a17d0bb 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 @@ -88,12 +88,12 @@ function Set-TargetResource # Start the Sync service if it should be running on this server if (($Ensure -eq "Present") -and ($syncService.Status -ne "Online")) { - $ups = Get-xSharePointServiceApplication -Name $params.UserProfileServiceAppName -TypeName UserProfile + $ups = Get-xSharePointServiceApplication -Name $params.UserProfileServiceAppName -TypeName UserProfile $ups.SetSynchronizationMachine($env:COMPUTERNAME, $syncService.ID, $params.FarmAccount.UserName, $params.FarmAccount.GetNetworkCredential().Password) - Invoke-xSharePointSPCmdlet -CmdletName "Start-SPServiceInstance" -Arguments @{ Identity = $syncService.ID } + Invoke-xSharePointSPCmdlet -CmdletName "Start-SPServiceInstance" -Arguments @{ Identity = $syncService.ID } - $desiredState = "Online" + $desiredState = "Online" } # Stop the Sync service in all other cases else { diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 index e41a71bf9..a1c608417 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 @@ -19,37 +19,37 @@ function Get-TargetResource [parameter(Mandatory = $true)] [System.String] $Url, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.Boolean] $AllowAnonymous, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [ValidateSet("NTLM","Kerberos")] [System.String] $AuthenticationMethod, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $DatabaseName, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $HostHeader, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $Path, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $Port, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) @@ -59,7 +59,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $wa = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue + $wa = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue if ($null -eq $wa) { return @{} } return @{ @@ -92,37 +92,37 @@ function Set-TargetResource [parameter(Mandatory = $true)] [System.String] $Url, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.Boolean] $AllowAnonymous, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [ValidateSet("NTLM","Kerberos")] [System.String] $AuthenticationMethod, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $DatabaseName, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $HostHeader, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $Path, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $Port, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) @@ -134,15 +134,15 @@ function Set-TargetResource if ($AuthenticationMethod -eq "NTLM") { $ap = Invoke-xSharePointSPCmdlet -CmdletName "New-SPAuthenticationProvider" -Arguments @{ - UseWindowsIntegratedAuthentication = $true - DisableKerberos = $true - } + UseWindowsIntegratedAuthentication = $true + DisableKerberos = $true + } } else { $ap = Invoke-xSharePointSPCmdlet -CmdletName "New-SPAuthenticationProvider" -Arguments @{ - UseWindowsIntegratedAuthentication = $true - } + UseWindowsIntegratedAuthentication = $true + } } - $params.Add("AuthenticationProvider", $ap) + $params.Add("AuthenticationProvider", $ap) $wa = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue if ($null -eq $wa) { @@ -180,37 +180,37 @@ function Test-TargetResource [parameter(Mandatory = $true)] [System.String] $Url, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.Boolean] $AllowAnonymous, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [ValidateSet("NTLM","Kerberos")] [System.String] $AuthenticationMethod, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $DatabaseName, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $HostHeader, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $Path, - - [parameter(Mandatory = $false)] + + [parameter(Mandatory = $false)] [System.String] $Port, - [parameter(Mandatory = $false)] + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) diff --git a/Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 b/Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 index e5b53f9d3..45276286a 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 @@ -27,12 +27,12 @@ function Get-xSharePointServiceApplicationName() { ) Switch($Name) { "BCS" { return "Business Data Connectivity Service Application" } - "MMS" { return "Managed Metadata Service" } - "Search" { return "Search Service Application" } - "SecureStore" { return "Secure Store Service Application" } - "Usage" { return "Usage and Health Data Collection Service Application" } - "UserProfile" { return "User Profile Service Application" } - "UserProfileSync" { return "User Profile Synchronization Service" } + "MMS" { return "Managed Metadata Service" } + "Search" { return "Search Service Application" } + "SecureStore" { return "Secure Store Service Application" } + "Usage" { return "Usage and Health Data Collection Service Application" } + "UserProfile" { return "User Profile Service Application" } + "UserProfileSync" { return "User Profile Synchronization Service" } } } From a8991ac9d91854b06ba1ab39bbeb39efa36e023f Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 10 Sep 2015 22:41:30 +1000 Subject: [PATCH 023/146] Added first group of test methods with new mocking approach --- .../MSFT_xSPCacheAccounts.psm1 | 8 +- .../MSFT_xSPDistributedCacheService.psm1 | 43 ++--- .../MSFT_xSPFeature/MSFT_xSPFeature.psm1 | 3 +- .../MSFT_xSPInstall/MSFT_xSPInstall.psm1 | 2 +- .../MSFT_xSPInstallPrereqs.psm1 | 181 ++++++++++++++---- .../MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 | 2 +- .../xSharePoint.CacheAccounts.psm1 | 3 + .../xSharePoint.DistributedCache.psm1 | 63 ++++++ .../xSharePoint.Util/xSharePoint.Util.psm1 | 13 +- Modules/xSharePoint/xSharePoint.psd1 | 7 +- .../xSharePoint/xSharePoint.Global.Tests.ps1 | 18 +- .../xSharePoint.xSPCacheAccounts.Tests.ps1 | 50 ++++- ...int.xSPDiagnosticLoggingSettings.Tests.ps1 | 17 +- ...Point.xSPDistributedCacheService.Tests.ps1 | 75 +++++++- .../xSharePoint.xSPFeature.Tests.ps1 | 76 +++++++- .../xSharePoint.xSPInstall.Tests.ps1 | 36 ++++ .../xSharePoint.xSPInstallPrereqs.Tests.ps1 | 56 +++++- .../xSharePoint.xSPJoinFarm.Tests.ps1 | 54 +++++- 18 files changed, 608 insertions(+), 99 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 index dd6e180c6..aa898a748 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 @@ -25,7 +25,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $wa = Invoke-xSharePointSPCmdlet "Get-SPWebApplication" -Arguments @{ Identity = $params.WebAppUrl } -ErrorAction SilentlyContinue + $wa = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" -Arguments @{ Identity = $params.WebAppUrl } -ErrorAction SilentlyContinue if ($null -eq $wa) { return @{} } @@ -75,7 +75,7 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $wa = Invoke-xSharePointSPCmdlet "Get-SPWebApplication" -Arguments @{ Identity = $params.WebAppUrl } + $wa = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" -Arguments @{ Identity = $params.WebAppUrl } if ($wa.Properties.ContainsKey("portalsuperuseraccount")) { $wa.Properties["portalsuperuseraccount"] = $params.SuperUserAlias @@ -87,11 +87,11 @@ function Set-TargetResource } else { $wa.Properties.Add("portalsuperreaderaccount", $params.SuperReaderAlias) } - + Set-xSharePointCacheReaderPolicy -WebApplication $wa -UserName $params.SuperReaderAlias Set-xSharePointCacheOwnerPolicy -WebApplication $wa -UserName $params.SuperUserAlias - $wa.Update() + Update-xSharePointObject -InputObject $wa } } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index 8d858ab74..e2ae57b3e 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -35,14 +35,18 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { try { - Use-CacheCluster -ErrorAction SilentlyContinue - $cacheHost = Get-CacheHost -ErrorAction SilentlyContinue + Invoke-xSharePointDCCmdlet -CmdletName "Use-CacheCluster" -ErrorAction SilentlyContinue + $cacheHost = Invoke-xSharePointDCCmdlet -CmdletName "Get-CacheHost" -ErrorAction SilentlyContinue if ($null -eq $cacheHost) { return @{} } - $cacheHostConfig = Get-AFCacheHostConfiguration -ComputerName ([System.Net.Dns]::GetHostByName($env:computerName)).HostName -CachePort $cacheHost.PortNo -ErrorAction SilentlyContinue + $computerName = ([System.Net.Dns]::GetHostByName($env:computerName)).HostName + $cacheHostConfig = Invoke-xSharePointDCCmdlet -CmdletName "Get-AFCacheHostConfiguration" -Arguments @{ + ComputerName = $computerName + CachePort = $cacheHost.PortNo + } -ErrorAction SilentlyContinue if ($null -eq $cacheHostConfig) { return @{} } return @{ - HostName = $cacheHost.HostName + HostName = $computerName Port = $cacheHost.PortNo CacheSizeInMB = $cacheHostConfig.Size } @@ -91,23 +95,8 @@ function Set-TargetResource if($createFirewallRules) { Write-Verbose -Message "Create a firewall rule for AppFabric" Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { - $params = $args[0] - Import-Module -Name NetSecurity - - $icmpRuleName = "File and Printer Sharing (Echo Request - ICMPv4-In)" - $icmpPingFirewallRule = Get-NetFirewallRule -DisplayName $icmpRuleName -ErrorAction SilentlyContinue - if($icmpPingFirewallRule) { - Enable-NetFirewallRule -DisplayName $icmpRuleName - } - else { - New-NetFirewallRule -Name Allow_Ping -DisplayName $icmpRuleName -Description "Allow ICMPv4 ping" -Protocol ICMPv4 -IcmpType 8 -Enabled True -Profile Any -Action Allow - } - - $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distribute Cache" -ErrorAction SilentlyContinue - if($null -eq $firewallRule) { - New-NetFirewallRule -Name "SPDistCache" -DisplayName "SharePoint Distribute Cache" -Protocol TCP -LocalPort 22233-22236 - } - Enable-NetFirewallRule -DisplayName "SharePoint Distribute Cache" + Enable-xSharePointDCIcmpFireWallRule + Enable-xSharePointDCFireWallRule } Write-Verbose -Message "Firewall rule added" } @@ -120,15 +109,9 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { Remove-xSharePointDistributedCacheServer } - - $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distribute Cache" -ErrorAction SilentlyContinue - if($null -eq $firewallRule) { - Write-Verbose -Message "Disabling firewall rules." - Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { - Import-Module -Name NetSecurity - Disable-NetFirewallRule -DisplayName -DisplayName "SharePoint Distribute Cache" - } - } + Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { + Disable-xSharePointDCFireWallRule + } Write-Verbose -Message "Distributed cache removed." } } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 index 33c52d561..79740efbd 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 @@ -43,8 +43,7 @@ function Get-TargetResource } else { $checkParams.Add($params.FeatureScope, $params.Url) } - $checkParams.Add("ErrorAction", "SilentlyContinue") - $featureAtScope = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFeature" -Arguments $checkParams + $featureAtScope = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFeature" -Arguments $checkParams -ErrorAction SilentlyContinue $enabled = ($null -ne $featureAtScope) return @{ diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1 index 9371292ef..2aeb45701 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1 @@ -21,7 +21,7 @@ function Get-TargetResource SharePointInstalled = $result } - $returnValue + return $returnValue } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 index b71da1b4e..83c5b109e 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 @@ -6,12 +6,68 @@ function Get-TargetResource ( [parameter(Mandatory = $true)] [System.String] - $InstallerPath + $InstallerPath, + + [parameter(Mandatory = $false)] + [System.Boolean] + $OnlineMode = $true, + + [parameter(Mandatory = $false)] + [System.String] + $SQLNCli, + + [parameter(Mandatory = $false)] + [System.String] + $PowerShell, + + [parameter(Mandatory = $false)] + [System.String] + $NETFX, + + [parameter(Mandatory = $false)] + [System.String] + $IDFX, + + [parameter(Mandatory = $false)] + [System.String] + $Sync, + + [parameter(Mandatory = $false)] + [System.String] + $AppFabric, + + [parameter(Mandatory = $false)] + [System.String] + $IDFX11, + + [parameter(Mandatory = $false)] + [System.String] + $MSIPCClient, + + [parameter(Mandatory = $false)] + [System.String] + $WCFDataServices, + + [parameter(Mandatory = $false)] + [System.String] + $KB2671763, + + [parameter(Mandatory = $false)] + [System.String] + $WCFDataServices56, + + [parameter(Mandatory = $false)] + [System.String] + $KB2898850, + + [parameter(Mandatory = $false)] + [System.String] + $MSVCRT12 ) $returnValue = @{} Write-Verbose -Message "Detecting SharePoint version from binaries" - $majorVersion = (Get-xSharePointAssemblyVerion -PathToAssembly $InstallerPath) + $majorVersion = (Get-xSharePointAssemblyVersion -PathToAssembly $InstallerPath) if ($majorVersion -eq 15) { Write-Verbose -Message "Version: SharePoint 2013" } @@ -22,11 +78,12 @@ function Get-TargetResource Write-Verbose -Message "Getting installed windows features" if ($majorVersion -eq 15) { - $WindowsFeatures = Get-WindowsFeature -Name Net-Framework-Features,Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Security,Web-Basic-Auth,Web-Windows-Auth,Web-Filtering,Web-Digest-Auth,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Application-Server,AS-Web-Support,AS-TCP-Port-Sharing,AS-WAS-Support, AS-HTTP-Activation,AS-TCP-Activation,AS-Named-Pipes,AS-Net-Framework,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Web-Lgcy-Scripting,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer + $WindowsFeatures = Invoke-Command -ScriptBlock { Get-WindowsFeature -Name Net-Framework-Features,Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Security,Web-Basic-Auth,Web-Windows-Auth,Web-Filtering,Web-Digest-Auth,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Application-Server,AS-Web-Support,AS-TCP-Port-Sharing,AS-WAS-Support, AS-HTTP-Activation,AS-TCP-Activation,AS-Named-Pipes,AS-Net-Framework,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Web-Lgcy-Scripting,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer } -NoNewScope } if ($majorVersion -eq 16) { - $WindowsFeatures = Get-WindowsFeature -Name Application-Server,AS-NET-Framework,AS-Web-Support,Web-Server,Web-WebServer,Web-Common-Http,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-Static-Content,Web-Http-Redirect,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Security,Web-Filtering,Web-Basic-Auth,Web-Client-Auth,Web-Digest-Auth,Web-Cert-Auth,Web-IP-Security,Web-Url-Auth,Web-Windows-Auth,Web-App-Dev,Web-Net-Ext,Web-Net-Ext45,Web-Asp-Net45,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Web-Lgcy-Mgmt-Console,Web-Lgcy-Scripting,Web-WMI,Web-Scripting-Tools,NET-Framework-Features,NET-Framework-Core,NET-HTTP-Activation,NET-Non-HTTP-Activ,NET-Framework-45-ASPNET,NET-WCF-HTTP-Activation45,Windows-Identity-Foundation,PowerShell-V2,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs - } + $WindowsFeatures = Invoke-Command -ScriptBlock { Get-WindowsFeature -Name Application-Server,AS-NET-Framework,AS-Web-Support,Web-Server,Web-WebServer,Web-Common-Http,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-Static-Content,Web-Http-Redirect,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Security,Web-Filtering,Web-Basic-Auth,Web-Client-Auth,Web-Digest-Auth,Web-Cert-Auth,Web-IP-Security,Web-Url-Auth,Web-Windows-Auth,Web-App-Dev,Web-Net-Ext,Web-Net-Ext45,Web-Asp-Net45,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Web-Lgcy-Mgmt-Console,Web-Lgcy-Scripting,Web-WMI,Web-Scripting-Tools,NET-Framework-Features,NET-Framework-Core,NET-HTTP-Activation,NET-Non-HTTP-Activ,NET-Framework-45-ASPNET,NET-WCF-HTTP-Activation45,Windows-Identity-Foundation,PowerShell-V2,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs } -NoNewScope + } + foreach ($feature in $WindowsFeatures) { $returnValue.Add($feature.Name, $feature.Installed) } @@ -53,7 +110,7 @@ function Get-TargetResource $returnValue.Add("Microsoft ODBC Driver 11 for SQL Server", (($installedItems | ? {$_.Name -eq "Microsoft ODBC Driver 11 for SQL Server"}) -ne $null)) $returnValue.Add("Microsoft Visual C++ 2013 x64 Minimum Runtime - 12.0.21005", (($installedItems | ? {$_.Name -eq "Microsoft Visual C++ 2013 x64 Minimum Runtime - 12.0.21005"}) -ne $null)) $returnValue.Add("Microsoft Visual C++ 2013 x64 Additional Runtime - 12.0.21005", (($installedItems | ? {$_.Name -eq "Microsoft Visual C++ 2013 x64 Additional Runtime - 12.0.21005"}) -ne $null)) - $returnValue.Add("Microsoft SQL Server 2012 Native Client", (($installedItems | ? {$_.Name.Trim() -eq "Microsoft SQL Server 2012 Native Client"}) -ne $null)) + $returnValue.Add("Microsoft SQL Server 2012 Native Client", (($installedItems | ? {$_.Name -ne $null -and $_.Name.Trim() -eq "Microsoft SQL Server 2012 Native Client"}) -ne $null)) $returnValue.Add("Active Directory Rights Management Services Client 2.1", (($installedItems | ? {$_.Name -eq "Active Directory Rights Management Services Client 2.1"}) -ne $null)) } $returnValue @@ -68,38 +125,66 @@ function Set-TargetResource [parameter(Mandatory = $true)] [System.String] $InstallerPath, + + [parameter(Mandatory = $false)] [System.Boolean] $OnlineMode = $true, + + [parameter(Mandatory = $false)] [System.String] - $SQLNCli = [System.String]::Empty, + $SQLNCli, + + [parameter(Mandatory = $false)] [System.String] - $PowerShell = [System.String]::Empty, + $PowerShell, + + [parameter(Mandatory = $false)] [System.String] - $NETFX = [System.String]::Empty, + $NETFX, + + [parameter(Mandatory = $false)] [System.String] - $IDFX = [System.String]::Empty, + $IDFX, + + [parameter(Mandatory = $false)] [System.String] - $Sync = [System.String]::Empty, + $Sync, + + [parameter(Mandatory = $false)] [System.String] - $AppFabric = [System.String]::Empty, + $AppFabric, + + [parameter(Mandatory = $false)] [System.String] - $IDFX11 = [System.String]::Empty, + $IDFX11, + + [parameter(Mandatory = $false)] [System.String] - $MSIPCClient = [System.String]::Empty, + $MSIPCClient, + + [parameter(Mandatory = $false)] [System.String] - $WCFDataServices = [System.String]::Empty, + $WCFDataServices, + + [parameter(Mandatory = $false)] [System.String] - $KB2671763 = [System.String]::Empty, + $KB2671763, + + [parameter(Mandatory = $false)] [System.String] - $WCFDataServices56 = [System.String]::Empty, + $WCFDataServices56, + + [parameter(Mandatory = $false)] [System.String] - $KB2898850 = [System.String]::Empty, + $KB2898850, + + [parameter(Mandatory = $false)] [System.String] - $MSVCRT12 = [System.String]::Empty + $MSVCRT12 ) Write-Verbose -Message "Detecting SharePoint version from binaries" - $majorVersion = (Get-xSharePointAssemblyVerion -PathToAssembly $InstallerPath) + $majorVersion = (Get-xSharePointAssemblyVersion -PathToAssembly $InstallerPath) if ($majorVersion -eq 15) { Write-Verbose -Message "Version: SharePoint 2013" $requiredParams = @("SQLNCli","PowerShell","NETFX","IDFX","Sync","AppFabric","IDFX11","MSIPCClient","WCFDataServices","KB2671763","WCFDataServices56") @@ -112,7 +197,7 @@ function Set-TargetResource $prereqArgs = "/unattended" if ($OnlineMode -eq $false) { $requiredParams | ForEach-Object { - if($PSBoundParameters.ContainsKey($_) -and [string]::IsNullOrEmpty($PSBoundParameters.$_)) { + if (($PSBoundParameters.ContainsKey($_) -and [string]::IsNullOrEmpty($PSBoundParameters.$_)) -or (-not $PSBoundParameters.ContainsKey($_))) { throw "In offline mode for version $majorVersion parameter $_ is required" } } @@ -160,34 +245,62 @@ function Test-TargetResource [parameter(Mandatory = $true)] [System.String] $InstallerPath, + + [parameter(Mandatory = $false)] [System.Boolean] $OnlineMode = $true, + + [parameter(Mandatory = $false)] [System.String] - $SQLNCli = [System.String]::Empty, + $SQLNCli, + + [parameter(Mandatory = $false)] [System.String] - $PowerShell = [System.String]::Empty, + $PowerShell, + + [parameter(Mandatory = $false)] [System.String] - $NETFX = [System.String]::Empty, + $NETFX, + + [parameter(Mandatory = $false)] [System.String] - $IDFX = [System.String]::Empty, + $IDFX, + + [parameter(Mandatory = $false)] [System.String] - $Sync = [System.String]::Empty, + $Sync, + + [parameter(Mandatory = $false)] [System.String] - $AppFabric = [System.String]::Empty, + $AppFabric, + + [parameter(Mandatory = $false)] [System.String] - $IDFX11 = [System.String]::Empty, + $IDFX11, + + [parameter(Mandatory = $false)] [System.String] - $MSIPCClient = [System.String]::Empty, + $MSIPCClient, + + [parameter(Mandatory = $false)] [System.String] - $WCFDataServices = [System.String]::Empty, + $WCFDataServices, + + [parameter(Mandatory = $false)] [System.String] - $KB2671763 = [System.String]::Empty, + $KB2671763, + + [parameter(Mandatory = $false)] [System.String] - $WCFDataServices56 = [System.String]::Empty, + $WCFDataServices56, + + [parameter(Mandatory = $false)] [System.String] - $KB2898850 = [System.String]::Empty, + $KB2898850, + + [parameter(Mandatory = $false)] [System.String] - $MSVCRT12 = [System.String]::Empty + $MSVCRT12 ) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 index 8f8883045..fb21af151 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 @@ -101,7 +101,7 @@ function Set-TargetResource Start-Service -Name sptimerv4 Write-Verbose -Message "Pausing for 5 minutes to allow the timer service to fully provision the server" - Start-Sleep -Seconds 300 + Invoke-Command -ScriptBlock { Start-Sleep -Seconds 300 } -NoNewScope Write-Verbose -Message "Join farm complete. Restarting computer to allow configuration to continue" $global:DSCMachineStatus = 1 diff --git a/Modules/xSharePoint/Modules/xSharePoint.CacheAccounts/xSharePoint.CacheAccounts.psm1 b/Modules/xSharePoint/Modules/xSharePoint.CacheAccounts/xSharePoint.CacheAccounts.psm1 index 3ba4186d5..a8d5fd4af 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.CacheAccounts/xSharePoint.CacheAccounts.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.CacheAccounts/xSharePoint.CacheAccounts.psm1 @@ -9,6 +9,9 @@ function Set-xSharePointCacheReaderPolicy() { [string] $UserName ) + $VerbosePreference = "Continue" + Write-Verbose "WHY NO MOCK!" + $policy = $WebApplication.Policies.Add($UserName, $UserName) $policyRole = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullRead) $policy.PolicyRoleBindings.Add($policyRole) diff --git a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 index 1415a166f..807df69e6 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 @@ -29,4 +29,67 @@ function Remove-xSharePointDistributedCacheServer() { Invoke-xSharePointSPCmdlet -CmdletName "Remove-SPDistributedCacheServiceInstance" } +function Invoke-xSharePointDCCmdlet() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + [string] + $CmdletName, + + [parameter(Mandatory = $false,Position=2)] + [HashTable] + $Arguments + ) + + Write-Verbose "Preparing to execute SharePoint command - $CmdletName" + + if ($null -ne $Arguments -and $Arguments.Count -gt 0) { + $argumentsString = "" + $Arguments.Keys | ForEach-Object { + $argumentsString += "$($_): $($Arguments.$_); " + } + Write-Verbose "Arguments for $CmdletName - $argumentsString" + } + + if ($null -eq $Arguments) { + $script = ([scriptblock]::Create("$CmdletName; `$params = `$null")) + $result = Invoke-Command -ScriptBlock $script -NoNewScope + } else { + $script = ([scriptblock]::Create("`$params = `$args[0]; $CmdletName @params; `$params = `$null")) + $result = Invoke-Command -ScriptBlock $script -ArgumentList $Arguments -NoNewScope + } + return $result +} + +function Enable-xSharePointDCIcmpFireWallRule() { + Import-Module -Name NetSecurity + + $firewallRule = Get-NetFirewallRule -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-In)" -ErrorAction SilentlyContinue + if($null -eq $firewallRule) { + New-NetFirewallRule -Name Allow_Ping -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-In)" -Description "Allow ICMPv4 ping" -Protocol ICMPv4 -IcmpType 8 -Enabled True -Profile Any -Action Allow + } + Enable-NetFirewallRule -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-In)" +} + +function Enable-xSharePointDCFireWallRule() { + Import-Module -Name NetSecurity + + $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distributed Cache" -ErrorAction SilentlyContinue + if($null -eq $firewallRule) { + New-NetFirewallRule -Name "SPDistCache" -DisplayName "SharePoint Distributed Cache" -Protocol TCP -LocalPort 22233-22236 + } + Enable-NetFirewallRule -DisplayName "SharePoint Distributed Cache" +} + +function Disable-xSharePointDCFireWallRule() { + Import-Module -Name NetSecurity + + $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distribute Cache" -ErrorAction SilentlyContinue + if($null -eq $firewallRule) { + Write-Verbose -Message "Disabling firewall rules." + Disable-NetFirewallRule -DisplayName -DisplayName "SharePoint Distribute Cache" + } +} + Export-ModuleMember -Function * diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 98d4742a7..6aa827d68 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -136,7 +136,7 @@ function Get-xSharePointInstalledProductVersion() { return (Get-Command $fullPath).FileVersionInfo } -function Get-xSharePointAssemblyVerion() { +function Get-xSharePointAssemblyVersion() { [CmdletBinding()] param ( @@ -147,4 +147,15 @@ function Get-xSharePointAssemblyVerion() { return (Get-Command $PathToAssembly).FileVersionInfo.FileMajorPart } +function Update-xSharePointObject() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + [object] + $InputObject + ) + $InputObject.Update() +} + Export-ModuleMember -Function * diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1 index e9477521f..cf2fcd3a8 100644 --- a/Modules/xSharePoint/xSharePoint.psd1 +++ b/Modules/xSharePoint/xSharePoint.psd1 @@ -77,11 +77,16 @@ CmdletsToExport = @("Add-xSharePointDistributedCacheServer", "Initialize-xSharePointPSSnapin", "Get-xSharePointInstalledProductVersion", "Invoke-xSharePointSPCmdlet", + "Invoke-xSharePointDCCmdlet", "Rename-xSharePointParamValue", "Remove-xSharePointNullParamValues", + "Update-xSharePointObject", "Get-xSharePointServiceApplication", "Set-xSharePointCacheReaderPolicy", - "Set-xSharePointCacheOwnerPolicy") + "Set-xSharePointCacheOwnerPolicy", + "Enable-xSharePointDCIcmpFireWallRule", + "Enable-xSharePointDCFireWallRule", + "Disable-xSharePointDCFireWallRule") # Variables to export from this module VariablesToExport = '*' diff --git a/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 b/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 index 4c6b4fe5c..b94f1b0c7 100644 --- a/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 @@ -19,7 +19,7 @@ Describe 'xSharePoint Global Tests' { Context 'MOF schemas use InstallAccount' { - It "Doesn't have an InstallAccount required parameter" { + It "Doesn't have InstallAccount as a required parameter" { $mofFilesWithNoInstallAccount = 0 $mofFiles | % { $fileHasInstallAccount = $false @@ -36,15 +36,6 @@ Describe 'xSharePoint Global Tests' { $mofFilesWithNoInstallAccount | Should Be 0 } } - - Context 'Files have valid text structure' { - It 'Passes test file checks for DSC resources' { - $DSCTestsPath = (Get-Item (Join-Path $RepoRoot "..\**\DSCResource.Tests\TestHelper.psm1" -Resolve)).FullName - if ($null -ne $DSCTestsPath) { - - } - } - } } $DSCTestsPath = (Get-Item (Join-Path $RepoRoot "..\**\DSCResource.Tests\MetaFixers.psm1" -Resolve)).FullName @@ -88,10 +79,7 @@ if ($null -ne $DSCTestsPath) { Describe 'PowerShell DSC resource modules' { - # Force convert to array $psm1Files = @(ls $RepoRoot -Recurse -Filter "*.psm1" -File | ? { - # Ignore Composite configurations - # They requires additional resources to be installed on the box ($_.FullName -like "*\DscResources\*") -and (-not ($_.Name -like "*.schema.psm1")) }) @@ -119,11 +107,11 @@ Describe 'PowerShell DSC resource modules' { It 'all .psm1 files don''t have parse errors' { $errors = @() - $psm1Files | %{ + $psm1Files | ForEach-Object { $localErrors = Get-ParseErrors $_.FullName if ($localErrors) { Write-Warning "There are parsing errors in $($_.FullName)" - Write-Warning ($localErrors | fl | Out-String) + Write-Warning ($localErrors | Format-List | Out-String) } $errors += $localErrors } diff --git a/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 index a7fd48be8..ceea381d7 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 @@ -12,7 +12,9 @@ Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path $ModuleName = "MSFT_xSPCacheAccounts" +Import-Module (Join-Path $RepoRoot "Modules\xSharePoint") Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") +Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\Modules\xSharePoint.CacheAccounts\xSharePoint.CacheAccounts.psm1") Describe "xSPCacheAccounts" { InModuleScope $ModuleName { @@ -20,7 +22,22 @@ Describe "xSPCacheAccounts" { WebAppUrl = "http://test.sharepoint.com" SuperUserAlias = "DEMO\SuperUser" SuperReaderAlias = "DEMO\SuperReader" - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) + } + + Context "Validate get method" { + It "Calls the service application picker with the appropriate type name" { + Mock Invoke-xSharePointSPCmdlet { return @{ + Properties = @{ + portalsuperuseraccount = $testParams.SuperUserAlias + portalsuperreaderaccount = $testParams.SuperReaderAlias + } + }} -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPWebApplication" } + + $results = Get-TargetResource @testParams + $results.Count | Should Be 3 + + Assert-VerifiableMocks + } } Context "Validate test method" { @@ -56,5 +73,36 @@ Describe "xSPCacheAccounts" { Test-TargetResource @testParams | Should Be $false } } + + Context "Validate set method" { + It "Sets accounts when no existing account is set" { + Mock Invoke-xSharePointSPCmdlet { return @{ + Properties = @{} + } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPWebApplication" } + Mock Set-xSharePointCacheReaderPolicy { return $null } -Verifiable + Mock Set-xSharePointCacheOwnerPolicy { return $null } -Verifiable + Mock Update-xSharePointObject { return $null } -Verifiable + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + + It "Sets accounts when existing accounts are set" { + Mock Invoke-xSharePointSPCmdlet { return @{ + Properties = @{ + portalsuperuseraccount = $testParams.SuperUserAlias + portalsuperreaderaccount = $testParams.SuperReaderAlias + } + } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPWebApplication" } + Mock Set-xSharePointCacheReaderPolicy { return $null } -Verifiable + Mock Set-xSharePointCacheOwnerPolicy { return $null } -Verifiable + Mock Update-xSharePointObject { return $null } -Verifiable + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 index 4d1569206..380fc1715 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 @@ -35,7 +35,14 @@ Describe "xSPDiagnosticLoggingSettings" { ScriptErrorReportingEnabled = $true ScriptErrorReportingRequireAuth = $true ScriptErrorReportingDelay = 5 - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) + } + + Context "Validate get method" { + It "Calls the correct function to retrieve settings" { + Mock Invoke-xSharePointSPCmdlet { return @{}} -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPDiagnosticConfig" } + Get-TargetResource @testParams + Assert-VerifiableMocks + } } Context "Validate test method" { @@ -119,5 +126,13 @@ Describe "xSPDiagnosticLoggingSettings" { Test-TargetResource @testParams | Should Be $false } } + + Context "Validate set method" { + It "Calls the correct function to retrieve settings" { + Mock Invoke-xSharePointSPCmdlet { return @{}} -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPDiagnosticConfig" -and $Arguments.ContainsKey("InstallAccount") -eq $false } + Set-TargetResource @testParams + Assert-VerifiableMocks + } + } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 index 6fa0f575b..27f880cc3 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 @@ -12,6 +12,7 @@ Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path $ModuleName = "MSFT_xSPDistributedCacheService" +Import-Module (Join-Path $RepoRoot "Modules\xSharePoint") Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") Describe "xSPDistributedCacheService" { @@ -21,8 +22,39 @@ Describe "xSPDistributedCacheService" { Ensure = "Present" CacheSizeInMB = 1024 ServiceAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) - createFirewallRules = $true + CreateFirewallRules = $true + } + + Context "Validate get method" { + It "Returns local cache settings correctly when it exists" { + Mock Invoke-xSharePointDCCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Use-CacheCluster" } + Mock Invoke-xSharePointDCCmdlet { return @{ + PortNo = 22233 + } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-CacheHost" } + Mock Invoke-xSharePointDCCmdlet { return @{ + HostName = $env:COMPUTERNAME + Port = 22233 + Size = $testParams.CacheSizeInMB + } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-AFCacheHostConfiguration" } + + $result = Get-TargetResource @testParams + + $result.HostName | Should Be ([System.Net.Dns]::GetHostByName($env:computerName)).HostName + $result.Port | Should Be 22233 + $result.CacheSizeInMB | Should Be $testParams.CacheSizeInMB + + Assert-VerifiableMocks + } + + It "Returns local cache settings correctly when it does not exist" { + Mock Invoke-xSharePointDCCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Use-CacheCluster" } + Mock Invoke-xSharePointDCCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-CacheHost" } + $result = Get-TargetResource @testParams + + $result | Should BeNullOrEmpty + + Assert-VerifiableMocks + } } Context "Validate test method" { @@ -51,7 +83,7 @@ Describe "xSPDistributedCacheService" { Test-TargetResource @testParams | Should Be $false } - $testParams.ENsure = "Absent" + $testParams.Ensure = "Absent" It "Fails when cache is present but not should be" { Mock -ModuleName $ModuleName Get-TargetResource { @@ -70,5 +102,42 @@ Describe "xSPDistributedCacheService" { Test-TargetResource @testParams | Should Be $true } } + + Context "Validate set method" { + + $testParams.Ensure = "Present" + + It "Provisions distributed cache locally when is should be present, installing firewall when asked for" { + Mock Enable-xSharePointDCIcmpFireWallRule { return $null } -Verifiable + Mock Enable-xSharePointDCFireWallRule { return $null } -Verifiable + + Mock Add-xSharePointDistributedCacheServer { return $null } -Verifiable -ParameterFilter { $CacheSizeInMB -eq $testParams.CacheSizeInMB } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + + $testParams.CreateFirewallRules = $false + + It "Provisions distributed cache locally when is should be present, not installing firewall" { + Mock Add-xSharePointDistributedCacheServer { return $null } -Verifiable -ParameterFilter { $CacheSizeInMB -eq $testParams.CacheSizeInMB } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + + $testParams.Ensure = "Absent" + + It "Removes distributed cache locally when is should not be present" { + Mock Remove-xSharePointDistributedCacheServer { return $null } -Verifiable -ParameterFilter { $CacheSizeInMB -eq $testParams.CacheSizeInMB } + Mock Disable-xSharePointDCFireWallRule { return $null } -Verifiable + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 index 08fe3b5b0..826569e6b 100644 --- a/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 @@ -20,10 +20,61 @@ Describe "xSPFeature" { Name = "DemoFeature" FeatureScope = "Farm" Url = "http://site.sharepoint.com" - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) Ensure = "Present" } + Context "Validate get method" { + It "Returns as empty where a feature is not installed in the farm" { + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPFeature" -and $Arguments.Count -eq 1 } + + Get-TargetResource @testParams + + Assert-VerifiableMocks + } + It "Returns a disabled state when an installed feature is not found at a farm scope" { + Mock Invoke-xSharePointSPCmdlet { return @{ Name = $testParams.Name } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPFeature" -and $Arguments.Count -eq 1 } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPFeature" -and $Arguments.Count -eq 2 } + + $result = Get-TargetResource @testParams + + $result.Enabled | Should be $false + + Assert-VerifiableMocks + } + $testParams.FeatureScope = "Site" + It "Returns a disabled state when an installed feature is not found at a site scope" { + Mock Invoke-xSharePointSPCmdlet { return @{ Name = $testParams.Name } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPFeature" -and $Arguments.Count -eq 1 } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPFeature" -and $Arguments.Count -eq 2 } + + $result = Get-TargetResource @testParams + + $result.Enabled | Should be $false + + Assert-VerifiableMocks + } + It "Returns an enabled state when an installed feature is found at a site scope" { + Mock Invoke-xSharePointSPCmdlet { return @{ Name = $testParams.Name } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPFeature" -and $Arguments.Count -eq 1 } + Mock Invoke-xSharePointSPCmdlet { return @{ Name = $testParams.Name } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPFeature" -and $Arguments.Count -eq 2 } + + $result = Get-TargetResource @testParams + + $result.Enabled | Should be $true + + Assert-VerifiableMocks + } + $testParams.FeatureScope = "Farm" + It "Returns an enabled state when an installed feature is found at a farm scope" { + Mock Invoke-xSharePointSPCmdlet { return @{ Name = $testParams.Name } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPFeature" -and $Arguments.Count -eq 1 } + Mock Invoke-xSharePointSPCmdlet { return @{ Name = $testParams.Name } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPFeature" -and $Arguments.Count -eq 2 } + + $result = Get-TargetResource @testParams + + $result.Enabled | Should be $true + + Assert-VerifiableMocks + } + } + Context "Validate test method" { It "Throws when a feature is not installed in the farm" { Mock -ModuleName $ModuleName Get-TargetResource { return @{} } @@ -128,5 +179,28 @@ Describe "xSPFeature" { Test-TargetResource @testParams | Should Be $false } } + + Context "Validate set method" { + + $testParams.Ensure = "Present" + + It "Enables a feature that should be on" { + Mock Invoke-xSharePointSPCmdlet { return $false } -Verifiable -ParameterFilter { $CmdletName -eq "Enable-SPFeature" } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + + $testParams.Ensure = "Absent" + + It "Disables a feature that should be turned off" { + Mock Invoke-xSharePointSPCmdlet { return $false } -Verifiable -ParameterFilter { $CmdletName -eq "Disable-SPFeature" } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 index 42b4f5b6e..487244dea 100644 --- a/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 @@ -21,6 +21,23 @@ Describe "xSPInstall" { ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" } + Context "Validate get method" { + + It "Returns false when SharePoint is not detected" { + Mock Get-CimInstance { return $null } -Verifiable + $result = Get-TargetResource @testParams + $result.SharePointInstalled | Should Be $false + Assert-VerifiableMocks + } + + It "Returns true when SharePoint is detected" { + Mock Get-CimInstance { return @{} } -Verifiable + $result = Get-TargetResource @testParams + $result.SharePointInstalled | Should Be $true + Assert-VerifiableMocks + } + } + Context "Validate test method" { It "Passes when SharePoint is installed" { Mock -ModuleName $ModuleName Get-TargetResource { @@ -39,5 +56,24 @@ Describe "xSPInstall" { Test-TargetResource @testParams | Should Be $false } } + + Context "Validate set method" { + It "Reboots the server after a successful install" { + Mock Start-Process { @{ ExitCode = 0 }} -Verifiable + + Set-TargetResource @testParams + + $global:DSCMachineStatus | Should Be 1 + + Assert-VerifiableMocks + } + It "Throws an error on unknown exit code" { + Mock Start-Process { @{ ExitCode = -1 }} -Verifiable + + { Set-TargetResource @testParams } | Should Throw + + Assert-VerifiableMocks + } + } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 index 6c458ae4e..6548a240e 100644 --- a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 @@ -13,7 +13,7 @@ $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path $ModuleName = "MSFT_xSPInstallPrereqs" Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") - + Describe "xSPInstallPrereqs" { InModuleScope $ModuleName { $testParams = @{ @@ -21,6 +21,18 @@ Describe "xSPInstallPrereqs" { OnlineMode = $true } + Context "Validate get method" { + It "Checks windows features as well as installed products" { + Mock Get-xSharePointAssemblyVersion { return 16 } -Verifiable + Mock Invoke-Command { return $null } -Verifiable -ParameterFilter { $ScriptBlock.ToString().Contains("Get-WindowsFeature") -eq $true } + Mock Get-CimInstance { return @{} } -Verifiable + + Get-TargetResource @testParams + + Assert-VerifiableMocks + } + } + Context "Validate test method" { It "Passes when all Prereqs are installed" { Mock -ModuleName $ModuleName Get-TargetResource { @@ -77,5 +89,47 @@ Describe "xSPInstallPrereqs" { Test-TargetResource @testParams | Should Be $false } } + + Context "Validate set method" { + It "Runs the installer and exists after success" { + Mock Get-xSharePointAssemblyVersion { return 15 } + Mock Start-Process { return @{ ExitCode = 0 } } -Verifiable + Set-TargetResource @testParams + Assert-VerifiableMocks + } + + It "Detects errors in the installer" { + Mock Get-xSharePointAssemblyVersion { return 15 } + Mock Start-Process { return @{ ExitCode = 1 } } + { Set-TargetResource @testParams } | Should throw "already running" + + Mock Start-Process { return @{ ExitCode = 2 } } + { Set-TargetResource @testParams } | Should throw "Invalid command line parameters" + + Mock Start-Process { return @{ ExitCode = -1 } } + { Set-TargetResource @testParams } | Should throw "unknown exit code" + } + + It "Detects reboot conditions in the installer" { + Mock Get-xSharePointAssemblyVersion { return 15 } + + $global:DSCMachineStatus = 0 + Mock Start-Process { return @{ ExitCode = 1001 } } + Set-TargetResource @testParams + $global:DSCMachineStatus | Should Be 1 + + $global:DSCMachineStatus = 0 + Mock Start-Process { return @{ ExitCode = 3010 } } + Set-TargetResource @testParams + $global:DSCMachineStatus | Should Be 1 + } + + $testParams.OnlineMode = $false + It "Throws an error if offline mode is run without prerequisite location parameters" { + Mock Get-xSharePointAssemblyVersion { return 15 } + + { Set-TargetResource @testParams } | Should throw "offline mode" + } + } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 index 34859f37b..a75ab3e2f 100644 --- a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 @@ -19,10 +19,16 @@ Describe "xSPJoinFarm" { $testParams = @{ FarmConfigDatabaseName = "SP_Config" DatabaseServer = "DatabaseServer\Instance" - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) Passphrase = "passphrase" - WaitTime = 60 - WaitCount = 60 + } + + Context "Validate get method" { + It "Calls SP Farm to find the local environment settings" { + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter {$CmdletName -eq "Get-SPFarm"} + $results = Get-TargetResource @testParams + $results.Count | Should Be 0 + Assert-VerifiableMocks + } } Context "Validate test method" { @@ -39,5 +45,47 @@ Describe "xSPJoinFarm" { Test-TargetResource @testParams | Should Be $true } } + + Context "Validate set method" { + It "Joins a new SharePoint 2016 farm" { + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Connect-SPConfigurationDatabase" -and $Arguments.ContainsKey("LocalServerRole") } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPHelpCollection" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Initialize-SPResourceSecurity" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPService" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPFeature" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPApplicationContent" } + + Mock Invoke-Command { return $null } + + Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 16 } } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + + It "Joins a new SharePoint 2013 farm" { + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Connect-SPConfigurationDatabase" -and (-not $Arguments.ContainsKey("LocalServerRole")) } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPHelpCollection" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Initialize-SPResourceSecurity" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPService" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPFeature" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPApplicationContent" } + + Mock Invoke-Command { return $null } + + Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 15 } } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + + It "Throws an exception for unsupported SharePoint versions" { + Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 1 } } + + { Set-TargetResource @testParams } | Should throw + } + } } } \ No newline at end of file From 03db295bb26ea03d43d2f76a7cd2dab14dacc6b6 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 10 Sep 2015 22:50:22 +1000 Subject: [PATCH 024/146] Fixed bug where start-service was not mocked --- Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 index a75ab3e2f..b5b00ac27 100644 --- a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 @@ -56,6 +56,7 @@ Describe "xSPJoinFarm" { Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPApplicationContent" } Mock Invoke-Command { return $null } + Mock Start-Service { return $null } -Verifiable Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 16 } } @@ -73,6 +74,7 @@ Describe "xSPJoinFarm" { Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPApplicationContent" } Mock Invoke-Command { return $null } + Mock Start-Service { return $null } -Verifiable Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 15 } } From a0cfba1bf6212398ad1b231c38622aab674a560a Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 13 Sep 2015 17:01:02 +1000 Subject: [PATCH 025/146] Finalised changes to mocking and unit testing --- .../MSFT_xSPManagedPath.psm1 | 2 +- .../MSFT_xSPSearchServiceApp.psm1 | 2 +- .../MSFT_xSPSecureStoreServiceApp.psm1 | 29 +------ .../MSFT_xSPStateServiceApp.psm1 | 6 +- .../MSFT_xSPUsageApplication.psm1 | 2 +- .../MSFT_xSPUserProfileServiceApp.psm1 | 15 +--- .../MSFT_xSPUserProfileSyncService.psm1 | 34 +++----- .../xSharePoint.UserProfileService.psm1 | 70 ++++++++++++++++ .../xSharePoint.Util/xSharePoint.Util.psm1 | 16 ++-- Modules/xSharePoint/xSharePoint.psd1 | 10 ++- Modules/xSharePoint/xSharePoint.pssproj | 2 + Tests/Tests.pssproj | 3 + ...int.xSPManagedMetadataServiceApp.Tests.ps1 | 33 +++++++- .../xSharePoint.xSPManagedPath.Tests.ps1 | 27 ++++++- .../xSharePoint.xSPSearchServiceApp.Tests.ps1 | 34 +++++++- ...rePoint.xSPSecureStoreServiceApp.Tests.ps1 | 81 +++++++++++++++++++ .../xSharePoint.xSPServiceAppPool.Tests.ps1 | 27 ++++++- .../xSharePoint.xSPServiceInstance.Tests.ps1 | 32 +++++++- .../xSharePoint/xSharePoint.xSPSite.Tests.ps1 | 18 ++++- .../xSharePoint.xSPStateServiceApp.Tests.ps1 | 21 ++++- ...rePoint.xSPUserProfileServiceApp.Tests.ps1 | 45 ++++++++++- ...ePoint.xSPUserProfileSyncService.Tests.ps1 | 65 ++++++++++++++- .../xSharePoint.xSPWebApplication.Tests.ps1 | 19 ++++- .../xSharePoint.xSPusageApplication.Tests.ps1 | 24 +++++- 24 files changed, 529 insertions(+), 88 deletions(-) create mode 100644 Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 create mode 100644 Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 index 0732296bd..a7ecc7ff8 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 @@ -91,7 +91,7 @@ function Set-TargetResource $newParams.Add("RelativeURL", $params.RelativeUrl) $newParams.Add("Explicit", $params.Explicit) - Invoke-xSharePointSPCmdlet -CmdletName "New-SPManagedPath" -Arguements $newParams + Invoke-xSharePointSPCmdlet -CmdletName "New-SPManagedPath" -Arguments $newParams } } } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 index 82d9a3aba..9cb559df7 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 @@ -83,7 +83,7 @@ function Set-TargetResource if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } $serviceInstance = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPEnterpriseSearchServiceInstance" -Arguments @{ Local = $true } - $serviceInstance | Invoke-xSharePointSPCmdlet -CmdletName "Start-SPEnterpriseSearchServiceInstance" -ErrorAction SilentlyContinue + Invoke-xSharePointSPCmdlet -CmdletName "Start-SPEnterpriseSearchServiceInstance" -Arguments @{ Identity = $serviceInstance } -ErrorAction SilentlyContinue $app = Invoke-xSharePointSPCmdlet -CmdletName "New-SPEnterpriseSearchServiceApplication" -Arguments $params if ($app) { Invoke-xSharePointSPCmdlet -CmdletName "New-SPEnterpriseSearchServiceApplicationProxy" -Arguments @{ diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 index 784c427ea..3f033b628 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 @@ -50,7 +50,7 @@ function Get-TargetResource [parameter(Mandatory = $false)] [System.Boolean] - $Sharing = $true, + $Sharing, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] @@ -131,7 +131,7 @@ function Set-TargetResource [parameter(Mandatory = $false)] [System.Boolean] - $Sharing = $true, + $Sharing, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] @@ -154,8 +154,7 @@ function Set-TargetResource } } } - } - else { + } else { if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating Secure Store Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { @@ -169,26 +168,6 @@ function Set-TargetResource } } } - - - - else { - if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) { - Write-Verbose -Message "Updating Secure Store Service Application $Name" - Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue - - $params = $args[0] - $params = Remove-xSharePointNullParamValues -Params $params - $params.Remove("Name") | Out-Null - if ($params.ContainsKey("PartitionMode")) { $params.Remove("PartitionMode") | Out-Null } - - $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue | - Where-Object { $_.TypeName -eq "Secure Store Service Application" } - $serviceApp | Set-SPSecureStoreServiceApplication @params - } - } - } } @@ -244,7 +223,7 @@ function Test-TargetResource [parameter(Mandatory = $false)] [System.Boolean] - $Sharing = $true, + $Sharing, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 index 95a599c65..afaa8bcd8 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 @@ -81,9 +81,9 @@ function Set-TargetResource if ($params.ContainsKey("DatabaseServer")) { $dbParams.Add("DatabaseServer", $params.DatabaseServer) } if ($params.ContainsKey("DatabaseCredentials")) { $dbParams.Add("DatabaseCredentials", $params.DatabaseCredentials) } - Invoke-xSharePointSPCmdlet -CmdletName "New-SPStateServiceDatabase" -Arguments $dbParams | ` - Invoke-xSharePointSPCmdlet -CmdletName "New-SPStateServiceApplication" -Arguments @{ Name = $params.Name } | ` - Invoke-xSharePointSPCmdlet -CmdletName "New-SPStateServiceApplicationProxy" -Arguments @{ DefaultProxyGroup = $true } + $database = Invoke-xSharePointSPCmdlet -CmdletName "New-SPStateServiceDatabase" -Arguments $dbParams + $app = Invoke-xSharePointSPCmdlet -CmdletName "New-SPStateServiceApplication" -Arguments @{ Name = $params.Name; Database = $database } + Invoke-xSharePointSPCmdlet -CmdletName "New-SPStateServiceApplicationProxy" -Arguments @{ ServiceApplication = $app; DefaultProxyGroup = $true } } } } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 index 0ac0293a0..8c690384f 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 @@ -62,7 +62,7 @@ function Get-TargetResource } else { - $service = Invoke-xSharePointCommand -CmdletName "Get-SPUsageService" + $service = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPUsageService" return @{ Name = $serviceApp.DisplayName UsageLogCutTime = $service.UsageLogCutTime diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 index 6595bbfe8..a4cfd47f8 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 @@ -123,19 +123,13 @@ function Set-TargetResource ) Write-Verbose -Message "Creating user profile service application $Name" - $domainName = $FarmAccount.UserName.Split('\')[0] - $userName = $FarmAccount.UserName.Split('\')[1] - $computerName = "$env:computername" # Add the FarmAccount to the local Administrators group, if it's not already there - $isLocalAdmin = ([ADSI]"WinNT://$computerName/Administrators,group").PSBase.Invoke("Members") | - ForEach-Object {$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)} | - Where-Object { $_ -eq $userName } + $isLocalAdmin = Test-xSharePointUserIsLocalAdmin -UserName $FarmAccount.UserName if (!$isLocalAdmin) { - Write-Verbose -Message "Adding $domainName\$userName to local admin group" - ([ADSI]"WinNT://$computerName/Administrators,group").Add("WinNT://$domainName/$userName") | Out-Null + Add-xSharePointUserToLocalAdmin -UserName $FarmAccount.UserName } $result = Invoke-xSharePointCommand -Credential $FarmAccount -Arguments $PSBoundParameters -ScriptBlock { @@ -147,7 +141,7 @@ function Set-TargetResource $params = Rename-xSharePointParamValue -params $params -oldName "SyncDBServer" -newName "ProfileSyncDBServer" $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName UserProfile - if ($null -eq $app) { + if ($null -eq $serviceApp) { $app = Invoke-xSharePointSPCmdlet -CmdletName "New-SPProfileServiceApplication" -Arguments $params if ($null -ne $app) { Invoke-xSharePointSPCmdlet -CmdletName "New-SPProfileServiceApplicationProxy" -Arguments @{ @@ -162,8 +156,7 @@ function Set-TargetResource # Remove the FarmAccount from the local Administrators group, if it was added above if (!$isLocalAdmin) { - Write-Verbose -Message "Removing $domainName\$userName from local admin group" - ([ADSI]"WinNT://$computerName/Administrators,group").Remove("WinNT://$domainName/$userName") | Out-Null + Remove-xSharePointUserToLocalAdmin -UserName $FarmAccount.UserName } } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 index c3a17d0bb..e4ab6ef91 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 @@ -26,7 +26,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $syncService = Get-xSharePointServiceApplication -Name $params.Name -TypeName UserProfileSync + $syncService = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Server = $env:COMPUTERNAME } | Where-Object { $_.TypeName -eq (Get-xSharePointServiceApplicationName -Name UserProfileSync) } if ($null -eq $syncService) { return @{} } @@ -62,20 +62,13 @@ function Set-TargetResource ) Write-Verbose -Message "Setting User Profile Synchronization Service" - - - $domainName = $FarmAccount.UserName.Split('\')[0] - $userName = $FarmAccount.UserName.Split('\')[1] - $computerName = "$env:computername" # Add the FarmAccount to the local Admins group, if it's not already there - $isLocalAdmin = ([ADSI]"WinNT://$computerName/Administrators,group").PSBase.Invoke("Members") | - ForEach-Object {$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)} | - Where-Object { $_ -eq $userName } + $isLocalAdmin = Test-xSharePointUserIsLocalAdmin -UserName $FarmAccount.UserName if (!$isLocalAdmin) { - ([ADSI]"WinNT://$computerName/Administrators,group").Add("WinNT://$domainName/$userName") | Out-Null + Add-xSharePointUserToLocalAdmin -UserName $FarmAccount.UserName # Cycle the Timer Service so that it picks up the local Admin token Restart-Service -Name "SPTimerV4" @@ -84,13 +77,12 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $FarmAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $syncService = Get-xSharePointServiceApplication -Name $params.Name -TypeName UserProfileSync + $syncService = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Server = $env:COMPUTERNAME } | Where-Object { $_.TypeName -eq (Get-xSharePointServiceApplicationName -Name UserProfileSync) } # Start the Sync service if it should be running on this server if (($Ensure -eq "Present") -and ($syncService.Status -ne "Online")) { - $ups = Get-xSharePointServiceApplication -Name $params.UserProfileServiceAppName -TypeName UserProfile - $ups.SetSynchronizationMachine($env:COMPUTERNAME, $syncService.ID, $params.FarmAccount.UserName, $params.FarmAccount.GetNetworkCredential().Password) - + + Set-xSharePointUserProfileSyncMachine -UserProfileServiceAppName $params.UserProfileServiceAppName -SyncServiceId $syncService.ID -FarmAccount $params.FarmAccount Invoke-xSharePointSPCmdlet -CmdletName "Start-SPServiceInstance" -Arguments @{ Identity = $syncService.ID } $desiredState = "Online" @@ -104,22 +96,20 @@ function Set-TargetResource $wait = $true $count = 0 $maxCount = 10 - while ($wait) { - Start-Sleep -Seconds 60 + while (($count -lt $maxCount) -and ($syncService.Status -ne $desiredState)) { # Get the current status of the Sync service - $syncService = Get-xSharePointServiceApplication -Name $params.Name -TypeName UserProfileSync + $syncService = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Server = $env:COMPUTERNAME } | Where-Object { $_.TypeName -eq (Get-xSharePointServiceApplicationName -Name UserProfileSync) } - # Continue to wait if haven't reached $maxCount or $desiredState - $wait = (($count -lt $maxCount) -and ($syncService.Status -ne $desiredState)) - $count++ + if ($syncService.Status -ne $desiredState) { Start-Sleep -Seconds 60 } + $count++ } } # Remove the FarmAccount from the local Admins group, if it was added above if (!$isLocalAdmin) { - ([ADSI]"WinNT://$computerName/Administrators,group").Remove("WinNT://$domainName/$userName") | Out-Null + Remove-xSharePointUserToLocalAdmin -UserName $FarmAccount.UserName } } @@ -148,7 +138,7 @@ function Test-TargetResource $InstallAccount ) - $result = Get-TargetResource -UserProfileServiceAppName $UserProfileServiceAppName -Ensure $Ensure -FarmAccount $FarmAccount -InstallAccount $InstallAccount + $result = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for User Profile Synchronization Service" if ($result.Count -eq 0) { return $false } else { diff --git a/Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 b/Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 new file mode 100644 index 000000000..db26e77f7 --- /dev/null +++ b/Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 @@ -0,0 +1,70 @@ +function Test-xSharePointUserIsLocalAdmin() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + [string] + $UserName + ) + + $domainName = $UserName.Split('\')[0] + $accountName = $UserName.Split('\')[1] + + return ([ADSI]"WinNT://$($env:computername)/Administrators,group").PSBase.Invoke("Members") | + ForEach-Object {$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)} | + Where-Object { $_ -eq $accountName } +} + +function Add-xSharePointUserToLocalAdmin() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + [string] + $UserName + ) + + $domainName = $UserName.Split('\')[0] + $accountName = $UserName.Split('\')[1] + + Write-Verbose -Message "Adding $domainName\$userName to local admin group" + ([ADSI]"WinNT://$($env:computername)/Administrators,group").Add("WinNT://$domainName/$accountName") | Out-Null +} + +function Remove-xSharePointUserToLocalAdmin() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + [string] + $UserName + ) + + $domainName = $UserName.Split('\')[0] + $accountName = $UserName.Split('\')[1] + + Write-Verbose -Message "Removing $domainName\$userName from local admin group" + ([ADSI]"WinNT://$($env:computername)/Administrators,group").Remove("WinNT://$domainName/$accountName") | Out-Null +} + +function Set-xSharePointUserProfileSyncMachine() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + [string] + $UserProfileServiceAppName, + + [parameter(Mandatory = $true,Position=2)] + [Guid] + $SyncServiceId, + + [parameter(Mandatory = $true,Position=3)] + [PSCredential] + $FarmAccount + ) + $ups = Get-xSharePointServiceApplication -Name $UserProfileServiceAppName -TypeName UserProfile + $ups.SetSynchronizationMachine($env:COMPUTERNAME, $SyncServiceId, $FarmAccount.UserName, $FarmAccount.GetNetworkCredential().Password) +} + +Export-ModuleMember -Function * diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 6aa827d68..725b5a4b0 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -34,20 +34,24 @@ function Invoke-xSharePointCommand() { $result = Invoke-Command @invokeArgs return $result } else { - if (-not $Env:USERNAME.Contains("$")) { - throw [Exception] "Unable to use both InstallAccount and PsDscRunAsCredential in a single resource. Remove one and try again." - return + if ($Credential.UserName.Split("\")[1] -eq $Env:USERNAME) { + if (-not $Env:USERNAME.Contains("$")) { + throw [Exception] "Unable to use both InstallAccount and PsDscRunAsCredential in a single resource. Remove one and try again." + return + } } Write-Verbose "Executing using a provided credential and local PSSession as user $($Credential.UserName)" #Running garbage collection to resolve issues related to Azure DSC extention use [GC]::Collect() - $session = New-PSSession -ComputerName $env:COMPUTERNAME -Credential $Credential -Authentication CredSSP -Name "Microsoft.SharePoint.DSC" -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -OperationTimeout 0 -IdleTimeout 60000) + $session = New-PSSession -ComputerName $env:COMPUTERNAME -Credential $Credential -Authentication CredSSP -Name "Microsoft.SharePoint.DSC" -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -OperationTimeout 0 -IdleTimeout 60000) -ErrorAction Continue - $result = Invoke-Command @invokeArgs -Session $session + if ($session) { $invokeArgs.Add("Session", $session) } + + $result = Invoke-Command @invokeArgs - Remove-PSSession $session + if ($session) { Remove-PSSession $session } return $result } } diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1 index cf2fcd3a8..292f10665 100644 --- a/Modules/xSharePoint/xSharePoint.psd1 +++ b/Modules/xSharePoint/xSharePoint.psd1 @@ -63,8 +63,10 @@ Description = 'This DSC module is used to deploy and configure SharePoint Server # FormatsToProcess = @() # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -NestedModules = @("modules\xSharePoint.DistributedCache\xSharePoint.DistributedCache.psm1", +NestedModules = @("modules\xSharePoint.CacheAccounts\xSharePoint.CacheAccounts.psm1", + "modules\xSharePoint.DistributedCache\xSharePoint.DistributedCache.psm1", "modules\xSharePoint.ServiceApplications\xSharePoint.ServiceApplications.psm1", + "modules\xSharePoint.UserProfileService\xSharePoint.UserProfileService.psm1", "modules\xSharePoint.Util\xSharePoint.Util.psm1") # Functions to export from this module @@ -86,7 +88,11 @@ CmdletsToExport = @("Add-xSharePointDistributedCacheServer", "Set-xSharePointCacheOwnerPolicy", "Enable-xSharePointDCIcmpFireWallRule", "Enable-xSharePointDCFireWallRule", - "Disable-xSharePointDCFireWallRule") + "Disable-xSharePointDCFireWallRule", + "Add-xSharePointUserToLocalAdmin", + "Remove-xSharePointUserToLocalAdmin", + "Test-xSharePointUserIsLocalAdmin", + "Set-xSharePointUserProfileSyncMachine") # Variables to export from this module VariablesToExport = '*' diff --git a/Modules/xSharePoint/xSharePoint.pssproj b/Modules/xSharePoint/xSharePoint.pssproj index 561ee6f50..b4031619c 100644 --- a/Modules/xSharePoint/xSharePoint.pssproj +++ b/Modules/xSharePoint/xSharePoint.pssproj @@ -75,6 +75,7 @@ + @@ -128,6 +129,7 @@ + diff --git a/Tests/Tests.pssproj b/Tests/Tests.pssproj index 7693ddab6..cd3f7e6aa 100644 --- a/Tests/Tests.pssproj +++ b/Tests/Tests.pssproj @@ -53,6 +53,9 @@ + + + \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 index f45ba8368..099bfa164 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 @@ -12,18 +12,26 @@ Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path $ModuleName = "MSFT_xSPManagedMetaDataServiceApp" +Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\Modules\xSharePoint.Util\xSharePoint.Util.psm1") Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") Describe "xSPManagedMetaDataServiceApp" { InModuleScope $ModuleName { $testParams = @{ Name = "Managed Metadata Service App" - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) ApplicationPool = "SharePoint Service Applications" DatabaseServer = "databaseserver\instance" DatabaseName = "SP_MMS" } + Context "Validate get method" { + It "Retrieves the data from SharePoint" { + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" + Get-TargetResource @testParams + Assert-VerifiableMocks + } + } + Context "Validate test method" { It "Fails when MMS service app doesn't exist" { Mock -ModuleName $ModuleName Get-TargetResource { return @{} } @@ -48,5 +56,28 @@ Describe "xSPManagedMetaDataServiceApp" { Test-TargetResource @testParams | Should Be $false } } + + Context "Validate set method" { + It "Creates a new service app where none exists" { + Mock Get-TargetResource { return @{} } -Verifiable + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPMetadataServiceApplication" } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPMetadataServiceApplicationProxy" } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + + It "Updates an existing service app" { + Mock Get-TargetResource { return @{ ApplicationPool = "Invalid"} } -Verifiable + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPMetadataServiceApplication" } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplicationPool" } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 index 2e55533e3..2006f5b35 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 @@ -18,12 +18,19 @@ Describe "xSPManagedPath" { InModuleScope $ModuleName { $testParams = @{ WebAppUrl = "http://sites.sharepoint.com" - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) RelativeUrl = "teams" Explicit = $false HostHeader = $false } + Context "Validate get method" { + It "Calls the data from SharePoint" { + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPManagedPath" } + Get-TargetResource @testParams + Assert-VerifiableMocks + } + } + Context "Validate test method" { It "Fails when path is not found" { Mock -ModuleName $ModuleName Get-TargetResource { return @{} } @@ -48,5 +55,23 @@ Describe "xSPManagedPath" { Test-TargetResource @testParams | Should Be $false } } + + Context "Validate set method" { + It "Creates a new web application managed path" { + Mock Get-TargetResource { return $null } -Verifiable + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPManagedPath" -and $Arguments.WebApplication -eq $testParams.WebAppUrl } + Set-TargetResource @testParams + Assert-VerifiableMocks + } + + $testParams.HostHeader = $true + + It "Creates a new host header managed path" { + Mock Get-TargetResource { return $null } -Verifiable + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPManagedPath" -and $Arguments.HostHeader -eq $true } + Set-TargetResource @testParams + Assert-VerifiableMocks + } + } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 index b965d9f8b..d0368a2b6 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 @@ -18,10 +18,17 @@ Describe "xSPSearchServiceApp" { InModuleScope $ModuleName { $testParams = @{ Name = "Search Service Application" - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) ApplicationPool = "SharePoint Search Services" } + Context "Validate get method" { + It "Retrieves the data from SharePoint" { + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" + Get-TargetResource @testParams + Assert-VerifiableMocks + } + } + Context "Validate test method" { It "Fails when service app is not found" { Mock -ModuleName $ModuleName Get-TargetResource { return @{} } @@ -46,5 +53,30 @@ Describe "xSPSearchServiceApp" { Test-TargetResource @testParams | Should Be $false } } + + Context "Validate set method" { + It "Creates a new service app where none exists" { + Mock Get-TargetResource { return @{} } -Verifiable + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPEnterpriseSearchServiceInstance" } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Start-SPEnterpriseSearchServiceInstance" } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPEnterpriseSearchServiceApplication" } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPEnterpriseSearchServiceApplicationProxy" } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + + It "Updates an existing service app" { + Mock Get-TargetResource { return @{ ApplicationPool = "Invalid"} } -Verifiable + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPEnterpriseSearchServiceApplication" } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplicationPool" } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 new file mode 100644 index 000000000..284fe5657 --- /dev/null +++ b/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 @@ -0,0 +1,81 @@ +[CmdletBinding()] +param() + +if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 +{ + $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) +} + +$ErrorActionPreference = 'stop' +Set-StrictMode -Version latest + +$RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path + +$ModuleName = "MSFT_xSPSecureStoreServiceApp" +Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") + +Describe "xSPSecureStoreServiceApp" { + InModuleScope $ModuleName { + $testParams = @{ + Name = "Secure Store Service Application" + ApplicationPool = "SharePoint Search Services" + AuditingEnabled = $false + } + + Context "Validate get method" { + It "Retrieves the data from SharePoint" { + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" + Get-TargetResource @testParams + Assert-VerifiableMocks + } + } + + Context "Validate test method" { + It "Fails when service app is not found" { + Mock -ModuleName $ModuleName Get-TargetResource { return @{} } + Test-TargetResource @testParams | Should Be $false + } + It "Passes when the path is found and is the correct type" { + Mock -ModuleName $ModuleName Get-TargetResource { + return @{ + Name = $testParams.Name + ApplicationPool = $testParams.ApplicationPool + } + } + Test-TargetResource @testParams | Should Be $true + } + It "Fails when the service app is found but uses the wrong app pool" { + Mock -ModuleName $ModuleName Get-TargetResource { + return @{ + Name = $testParams.Name + ApplicationPool = "Wrong App Pool" + } + } + Test-TargetResource @testParams | Should Be $false + } + } + + Context "Validate set method" { + It "Creates a new service app where none exists" { + Mock Get-TargetResource { return @{} } -Verifiable + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPSecureStoreServiceApplication" } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPSecureStoreServiceApplicationProxy" } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + + It "Updates an existing service app" { + Mock Get-TargetResource { return @{ ApplicationPool = "Invalid"} } -Verifiable + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPSecureStoreServiceApplication" } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplicationPool" } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + } + } +} \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 index 015d24025..2a7a61138 100644 --- a/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 @@ -18,10 +18,17 @@ Describe "xSPServiceAppPool" { InModuleScope $ModuleName { $testParams = @{ Name = "Service pool" - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) ServiceAccount = "DEMO\svcSPServiceApps" } + Context "Validate get method" { + It "Calls the right functions to retrieve SharePoint data" { + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplicationPool" -and $Arguments.Identity -eq $testParams.Name } + Get-TargetResource @testParams + Assert-VerifiableMocks + } + } + Context "Validate test method" { It "Fails when service app pool is not found" { Mock -ModuleName $ModuleName Get-TargetResource { return @{} } @@ -46,5 +53,23 @@ Describe "xSPServiceAppPool" { Test-TargetResource @testParams | Should Be $false } } + + Context "Validate set method" { + It "Creates a new service app pool when none exists" { + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplicationPool" -and $Arguments.Identity -eq $testParams.Name } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPServiceApplicationPool" -and $Arguments.Name -eq $testParams.Name } + + Set-TargetResource @testParams + Assert-VerifiableMocks + } + + It "Updates the service account of the pool when it is wrong" { + Mock Invoke-xSharePointSPCmdlet { return @{ ProcessAccountName = "wrong name" } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplicationPool" -and $Arguments.Identity -eq $testParams.Name } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPServiceApplicationPool" } + + Set-TargetResource @testParams + Assert-VerifiableMocks + } + } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 index 9d4816d92..ecd03de99 100644 --- a/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 @@ -18,10 +18,17 @@ Describe "xSPServiceInstance" { InModuleScope $ModuleName { $testParams = @{ Name = "Service pool" - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) Ensure = "Present" } + Context "Validate get method" { + It "Calls the right functions to retrieve SharePoint data" { + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceInstance" } + Get-TargetResource @testParams + Assert-VerifiableMocks + } + } + Context "Validate test method" { It "Fails when service instance is not found at all" { Mock -ModuleName $ModuleName Get-TargetResource { return @{} } @@ -67,5 +74,28 @@ Describe "xSPServiceInstance" { Test-TargetResource @testParams | Should Be $true } } + + Context "Validate set method" { + + $testParams.Ensure = "Present" + + It "Starts a service that should be running" { + Mock Invoke-xSharePointSPCmdlet { return @( @{ TypeName = $testParams.Name } ) } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceInstance" } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Start-SPServiceInstance" } + + Set-TargetResource @testParams + Assert-VerifiableMocks + } + + $testParams.Ensure = "Absent" + + It "Stops a service that should be stopped" { + Mock Invoke-xSharePointSPCmdlet { return @( @{ TypeName = $testParams.Name } ) } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceInstance" } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Stop-SPServiceInstance" } + + Set-TargetResource @testParams + Assert-VerifiableMocks + } + } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 index ef8aaaccc..b678bccf3 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 @@ -18,10 +18,17 @@ Describe "xSPSite" { InModuleScope $ModuleName { $testParams = @{ Url = "http://site.sharepoint.com" - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) OwnerAlias = "DEMO\User" } + Context "Validate get method" { + It "Calls the right functions to retrieve SharePoint data" { + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPSite" } + Get-TargetResource @testParams + Assert-VerifiableMocks + } + } + Context "Validate test method" { It "Fails when site collection isn't found" { Mock -ModuleName $ModuleName Get-TargetResource { return @{} } @@ -37,5 +44,14 @@ Describe "xSPSite" { Test-TargetResource @testParams | Should Be $true } } + + Context "Validate set method" { + It "Creates a new site when none exists" { + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPSite" } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPSite" } + Set-TargetResource @testParams + Assert-VerifiableMocks + } + } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 index 6a8979e8e..d3d862acf 100644 --- a/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 @@ -18,7 +18,14 @@ Describe "xSPStateServiceApp" { InModuleScope $ModuleName { $testParams = @{ Name = "State Service App" - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) + } + + Context "Validate get method" { + It "Calls the right functions to retrieve SharePoint data" { + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPStateServiceApplication" } + Get-TargetResource @testParams + Assert-VerifiableMocks + } } Context "Validate test method" { @@ -35,5 +42,17 @@ Describe "xSPStateServiceApp" { Test-TargetResource @testParams | Should Be $true } } + + Context "Validate set method" { + It "Creates a new service app where none exists" { + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPStateServiceApplication" } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPStateServiceDatabase" } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPStateServiceApplication" } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPStateServiceApplicationProxy" } + + Set-TargetResource @testParams + Assert-VerifiableMocks + } + } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 index 4eda24896..888990102 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 @@ -17,10 +17,17 @@ Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName Describe "xSPUserProfileServiceApp" { InModuleScope $ModuleName { $testParams = @{ - Name = "Managed Metadata Service App" - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) + Name = "User Profile Service App" ApplicationPool = "SharePoint Service Applications" - FarmAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) + FarmAccount = New-Object System.Management.Automation.PSCredential ("domain\username", (ConvertTo-SecureString "password" -AsPlainText -Force)) + } + + Context "Validate get method" { + It "Retrieves the data from SharePoint" { + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" + Get-TargetResource @testParams + Assert-VerifiableMocks + } } Context "Validate test method" { @@ -47,5 +54,37 @@ Describe "xSPUserProfileServiceApp" { Test-TargetResource @testParams | Should Be $false } } + + Context "Validate set method" { + It "Creates a new service app where none exists, adding user to the local admin group" { + Mock Test-xSharePointUserIsLocalAdmin { return $false } -Verifiable + Mock Add-xSharePointUserToLocalAdmin -Verifiable + Mock Remove-xSharePointUserToLocalAdmin -Verifiable + + Mock New-PSSession { return $null } -ModuleName "xSharePoint.Util" + + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPProfileServiceApplication" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPProfileServiceApplicationProxy" } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + + It "Creates a new service app where none exists, without adding user to the local admin group" { + Mock Test-xSharePointUserIsLocalAdmin { return $true } -Verifiable + + Mock New-PSSession { return $null } -ModuleName "xSharePoint.Util" + + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPProfileServiceApplication" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPProfileServiceApplicationProxy" } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 index 9f65a2153..9ae580108 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 @@ -17,12 +17,19 @@ Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName Describe "xSPUserProfileSyncService" { InModuleScope $ModuleName { $testParams = @{ - UserProfileServiceAppName = "Managed Metadata Service App" - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) + UserProfileServiceAppName = "User Profile Service Service App" FarmAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) Ensure = "Present" } + Context "Validate get method" { + It "Retrieves the data from SharePoint" { + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceInstance" } + Get-TargetResource @testParams + Assert-VerifiableMocks + } + } + Context "Validate test method" { It "Fails when user profile sync service doesn't exist" { Mock -ModuleName $ModuleName Get-TargetResource { return @{} } @@ -63,7 +70,59 @@ Describe "xSPUserProfileSyncService" { } Test-TargetResource @testParams | Should Be $true } - + } + + $testParams.Ensure = "Present" + $Global:xSharePointUPACheck = $false + + Context "Validate set method" { + It "Povisions the user profile sync service where it should be running" { + Mock Test-xSharePointUserIsLocalAdmin { return $false } -Verifiable + Mock Add-xSharePointUserToLocalAdmin -Verifiable + Mock Remove-xSharePointUserToLocalAdmin -Verifiable + + Mock New-PSSession { return $null } -ModuleName "xSharePoint.Util" + Mock Restart-Service { return $null } + + Mock Set-xSharePointUserProfileSyncMachine { return $null } -Verifiable + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Start-SPServiceInstance" } + Mock Invoke-xSharePointSPCmdlet { if ($Global:xSharePointUPACheck -eq $false) { + $Global:xSharePointUPACheck = $true + return @( @{ Status = "Offline"; ID = [Guid]::NewGuid(); TypeName = "User Profile Synchronization Service" }) + } else { + return @( @{ Status = "Online"; ID = [Guid]::NewGuid(); TypeName = "User Profile Synchronization Service" }) + } + } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceInstance" } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + + $testParams.Ensure = "Absent" + $Global:xSharePointUPACheck = $false + + It "Stops the user profile sync service where it should not be running" { + Mock Test-xSharePointUserIsLocalAdmin { return $false } -Verifiable + Mock Add-xSharePointUserToLocalAdmin -Verifiable + Mock Remove-xSharePointUserToLocalAdmin -Verifiable + + Mock New-PSSession { return $null } -ModuleName "xSharePoint.Util" + Mock Restart-Service { return $null } + + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Stop-SPServiceInstance" } + Mock Invoke-xSharePointSPCmdlet { if ($Global:xSharePointUPACheck -eq $false) { + $Global:xSharePointUPACheck = $true + return @( @{ Status = "Online"; ID = [Guid]::NewGuid(); TypeName = "User Profile Synchronization Service" }) + } else { + return @( @{ Status = "Disabled"; ID = [Guid]::NewGuid(); TypeName = "User Profile Synchronization Service" }) + } + } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceInstance" } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 index 0fbc8ea68..a1db18553 100644 --- a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 @@ -18,12 +18,19 @@ Describe "xSPWebApplication" { InModuleScope $ModuleName { $testParams = @{ Name = "Managed Metadata Service App" - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" Url = "http://sites.sharepoint.com" } + Context "Validate get method" { + It "Calls the right functions to retrieve SharePoint data" { + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPWebApplication" } + Get-TargetResource @testParams + Assert-VerifiableMocks + } + } + Context "Validate test method" { It "Fails when web app doesn't exist" { Mock -ModuleName $ModuleName Get-TargetResource { return @{} } @@ -50,5 +57,15 @@ Describe "xSPWebApplication" { Test-TargetResource @testParams | Should Be $false } } + + Context "Validate set method" { + It "Creates a new site when none exists" { + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPAuthenticationProvider" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPWebApplication" } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPWebApplication" } + Set-TargetResource @testParams + Assert-VerifiableMocks + } + } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 index b5767a52a..e726d1614 100644 --- a/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 @@ -17,14 +17,22 @@ Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName Describe "xSPUsageApplication" { InModuleScope $ModuleName { $testParams = @{ - Name = "Managed Metadata Service App" - InstallAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) + Name = "Usage Service App" UsageLogCutTime = 60 UsageLogLocation = "L:\UsageLogs" UsageLogMaxFileSize = 1024 UsageLogMaxSpaceGB = 10 } + Context "Validate get method" { + It "Calls the right functions to retrieve SharePoint data" { + Mock Invoke-xSharePointSPCmdlet { return @(@{ TypeName = "Usage and Health Data Collection Service Application" }) } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPUsageService" } + Get-TargetResource @testParams + Assert-VerifiableMocks + } + } + Context "Validate test method" { It "Fails when state service app doesn't exist" { Mock -ModuleName $ModuleName Get-TargetResource { return @{} } @@ -85,5 +93,17 @@ Describe "xSPUsageApplication" { Test-TargetResource @testParams | Should Be $false } } + + Context "Validate set method" { + It "Sets the usage values correctly" { + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPUsageApplication" } + Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPUsageService" } + + Set-TargetResource @testParams + + Assert-VerifiableMocks + } + } } } \ No newline at end of file From f6a91d3e1aa6d1ac158a549a136500c0401fe626 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 13 Sep 2015 20:36:50 +1000 Subject: [PATCH 026/146] Updated readme for v0.6 --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index de99166ce..815c14934 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,12 @@ Additional detailed documentation is included on the wiki on GitHub. ## Version History +### 0.6.0.0 + + * Added support for PsDscRunAsCredential in PowerShell 5 resource use + * Expanded automated unit testing + * Removed timeout loop in xSPJoinFarm in favour of WaitForAll resource in PowerShell 5 + ### 0.5.0.0 * Fixed bug with detection of version in create farm From d09f6abe4305b7f122dc37cc83030098b7bd57a8 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 09:08:54 +1000 Subject: [PATCH 027/146] Fixed incorrect variable name --- .../xSharePoint.CacheAccounts/xSharePoint.CacheAccounts.psm1 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Modules/xSharePoint/Modules/xSharePoint.CacheAccounts/xSharePoint.CacheAccounts.psm1 b/Modules/xSharePoint/Modules/xSharePoint.CacheAccounts/xSharePoint.CacheAccounts.psm1 index a8d5fd4af..a97057976 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.CacheAccounts/xSharePoint.CacheAccounts.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.CacheAccounts/xSharePoint.CacheAccounts.psm1 @@ -10,10 +10,9 @@ function Set-xSharePointCacheReaderPolicy() { $UserName ) $VerbosePreference = "Continue" - Write-Verbose "WHY NO MOCK!" $policy = $WebApplication.Policies.Add($UserName, $UserName) - $policyRole = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullRead) + $policyRole = $WebApplication.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullRead) $policy.PolicyRoleBindings.Add($policyRole) } @@ -29,7 +28,7 @@ function Set-xSharePointCacheOwnerPolicy() { $UserName ) $policy = $WebApplication.Policies.Add($UserName, $UserName) - $policyRole = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullControl) + $policyRole = $WebApplication.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullControl) $policy.PolicyRoleBindings.Add($policyRole) } From d16a572a9707a6f2386974eee9eff8b55b974b28 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 09:13:25 +1000 Subject: [PATCH 028/146] Fix call to managed account cmdlet --- .../xSharePoint.DistributedCache.psm1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 index 807df69e6..58a45ca21 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 @@ -17,7 +17,8 @@ function Add-xSharePointDistributedCacheServer() { $farm = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFarm" $cacheService = $farm.Services | Where-Object {$_.Name -eq "AppFabricCachingService"} $cacheService.ProcessIdentity.CurrentIdentityType = "SpecificUser" - $cacheService.ProcessIdentity.ManagedAccount = (Get-SPManagedAccount -Identity $ServiceAccount) + $account = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPManagedAccount" -Arguments @{ Identity = $ServiceAccount } + $cacheService.ProcessIdentity.ManagedAccount = $account $cacheService.ProcessIdentity.Update() $cacheService.ProcessIdentity.Deploy() } From 9639aacd1e2b7fc85c205f2378c04d455d2caffc Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 09:15:37 +1000 Subject: [PATCH 029/146] Fixed formatting --- .../xSharePoint.DistributedCache.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 index 58a45ca21..1b8064326 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 @@ -17,7 +17,7 @@ function Add-xSharePointDistributedCacheServer() { $farm = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFarm" $cacheService = $farm.Services | Where-Object {$_.Name -eq "AppFabricCachingService"} $cacheService.ProcessIdentity.CurrentIdentityType = "SpecificUser" - $account = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPManagedAccount" -Arguments @{ Identity = $ServiceAccount } + $account = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPManagedAccount" -Arguments @{ Identity = $ServiceAccount } $cacheService.ProcessIdentity.ManagedAccount = $account $cacheService.ProcessIdentity.Update() $cacheService.ProcessIdentity.Deploy() From 1831cc375e4b11654b528e2b23e6a4821910f3cc Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 10:28:30 +1000 Subject: [PATCH 030/146] Added test to ensure that SP cmdlets aren't called directly --- .../xSharePoint/xSharePoint.Global.Tests.ps1 | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 b/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 index b94f1b0c7..e50251f85 100644 --- a/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 @@ -77,10 +77,10 @@ if ($null -ne $DSCTestsPath) { } -Describe 'PowerShell DSC resource modules' { +Describe 'PowerShell Modules' { $psm1Files = @(ls $RepoRoot -Recurse -Filter "*.psm1" -File | ? { - ($_.FullName -like "*\DscResources\*") -and (-not ($_.Name -like "*.schema.psm1")) + ($_.FullName -like "*\DscResources\*" -or $_.FullName -like "*\Modules\xSharePoint.*") -and (-not ($_.Name -like "*.schema.psm1")) }) if (-not $psm1Files) { @@ -118,6 +118,34 @@ Describe 'PowerShell DSC resource modules' { $errors.Count | Should Be 0 } } + + Context "SharePoint Cmdlet use" { + function Get-SPCmdletCalls + { + param( + [Parameter(ValueFromPipeline=$True,Mandatory=$True)] + [string]$fileName + ) + + $tokens = $null + $errors = $null + $ast = [System.Management.Automation.Language.Parser]::ParseFile($fileName, [ref] $tokens, [ref] $errors) + return $tokens | Where-Object { $_.TokenFlags -contains "CommandName" -and $_.Value -like "*-SP*"} | ft + } + + It "doesn't call SharePoint PowerShell cmdlets directly" { + $tokens = @() + $psm1Files | ForEach-Object { + $localCmdletCalls = Get-SPCmdletCalls $_.FullName + if ($localCmdletCalls) { + Write-Warning "There are calls to SharePoint cmdlets in $($_.FullName) - use Invoke-xSharePointSPCmdlet instead to mock and test these calls" + Write-Warning ($localCmdletCalls | Format-List | Out-String) + } + $tokens += $localCmdletCalls + } + $tokens.Count | Should Be 0 + } + } } } From 1109b9cb22ede4fd6dfef654fd7d42679035e056 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 10:42:02 +1000 Subject: [PATCH 031/146] Fixed issue around detected service apps that don't exist --- .../xSharePoint.ServiceApplications.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 b/Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 index 45276286a..20ece3aa5 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 @@ -12,7 +12,7 @@ function Get-xSharePointServiceApplication() { $TypeName ) - $serviceApps = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplication" -Arguments @{ Name = $Name } + $serviceApps = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplication" -Arguments @{ Name = $Name } -ErrorAction SilentlyContinue $serviceApp = $serviceApps | Where-Object { $_.TypeName -eq (Get-xSharePointServiceApplicationName -Name $TypeName) } return $serviceApp } From e618fc5279d11655ce186334efe946bddcd08c30 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 10:53:06 +1000 Subject: [PATCH 032/146] Fixed incorrect parameter name in set method for proxy object --- .../MSFT_xSPSecureStoreServiceApp.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 index 3f033b628..ade2522b2 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 @@ -150,7 +150,7 @@ function Set-TargetResource if ($app) { Invoke-xSharePointSPCmdlet -CmdletName "New-SPSecureStoreServiceApplicationProxy" -Arguments @{ Name = "$($params.Name) Proxy" - SearchApplication = $app + ServiceApplication = $app } } } From 9a394da566910c2e84578b12109731a04e3dfacf Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 13:59:07 +1000 Subject: [PATCH 033/146] Fixed get method of xSPInstall --- .../MSFT_xSPInstall/MSFT_xSPInstall.psm1 | 21 +++++--- .../MSFT_xSPSite/MSFT_xSPSite.psm1 | 1 - .../xSharePoint.Util/xSharePoint.Util.psm1 | 49 +++++++++++++------ Modules/xSharePoint/xSharePoint.psd1 | 4 +- Tests/Tests.pssproj | 1 + Tests/xSharePoint/xSharePoint.Util.Tests.ps1 | 48 ++++++++++++++++++ .../xSharePoint.xSPInstall.Tests.ps1 | 10 ++-- 7 files changed, 104 insertions(+), 30 deletions(-) create mode 100644 Tests/xSharePoint/xSharePoint.Util.Tests.ps1 diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1 index 2aeb45701..3c43b2a99 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1 @@ -16,12 +16,17 @@ function Get-TargetResource Write-Verbose -Message "Getting install status of SP binaries" $spInstall = Get-CimInstance -ClassName Win32_Product -Filter "Name like 'Microsoft SharePoint Server%'" - $result = ($null -ne $spInstall) - $returnValue = @{ - SharePointInstalled = $result + if ($spInstall) { + return @{ + BinaryDir = $BinaryDir + ProductKey = $ProductKey + } + } else { + return @{ + BinaryDir = $null + ProductKey = $ProductKey + } } - - return $returnValue } @@ -94,9 +99,11 @@ function Test-TargetResource $ProductKey ) - $result = Get-TargetResource -BinaryDir $BinaryDir -ProductKey $ProductKey + $CurrentValues = Get-TargetResource @PSBoundParameters + Write-Verbose -Message "Testing for installation of SharePoint" - $result.SharePointInstalled + + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 index aa6b8d1d4..ca07f0035 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 @@ -145,7 +145,6 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $params = Remove-xSharePointNullParamValues -Params $params $params.Remove("InstallAccount") | Out-Null $site = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPSite" -Arguments @{ Identity = $params.Url } -ErrorAction SilentlyContinue diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 725b5a4b0..b721234eb 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -118,22 +118,6 @@ function Rename-xSharePointParamValue() { return $params } -function Remove-xSharePointNullParamValues() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - $Params - ) - $keys = $Params.Keys - ForEach ($key in $keys) { - if ($null -eq $Params.$key) { - $Params.Remove($key) | Out-Null - } - } - return $Params -} - function Get-xSharePointInstalledProductVersion() { $pathToSearch = "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\*\ISAPI\Microsoft.SharePoint.dll" $fullPath = Get-Item $pathToSearch | Sort-Object { $_.Directory } -Descending | Select-Object -First 1 @@ -162,4 +146,37 @@ function Update-xSharePointObject() { $InputObject.Update() } +function Test-xSharePointSpecificParameters() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + [HashTable] + $CurrentValues, + + [parameter(Mandatory = $true,Position=2)] + [HashTable] + $DesiredValues, + + [parameter(Mandatory = $false,Position=3)] + [Array] + $ValuesToCheck + ) + + $returnValue = $true + + if (($ValuesToCheck -eq $null) -or ($ValuesToCheck.Count -lt 1)) { + $KeyList = $DesiredValues.Keys + } else { + $KeyList = $ValuesToCheck + } + + $KeyList | ForEach-Object { + if ((-not $CurrentValues.ContainsKey($_)) -or ($CurrentValues.$_ -ne $DesiredValues.$_)) { + $returnValue = $false + } + } + return $returnValue +} + Export-ModuleMember -Function * diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1 index dd8446f3c..2f600eaad 100644 --- a/Modules/xSharePoint/xSharePoint.psd1 +++ b/Modules/xSharePoint/xSharePoint.psd1 @@ -81,7 +81,6 @@ CmdletsToExport = @("Add-xSharePointDistributedCacheServer", "Invoke-xSharePointSPCmdlet", "Invoke-xSharePointDCCmdlet", "Rename-xSharePointParamValue", - "Remove-xSharePointNullParamValues", "Update-xSharePointObject", "Get-xSharePointServiceApplication", "Set-xSharePointCacheReaderPolicy", @@ -92,7 +91,8 @@ CmdletsToExport = @("Add-xSharePointDistributedCacheServer", "Add-xSharePointUserToLocalAdmin", "Remove-xSharePointUserToLocalAdmin", "Test-xSharePointUserIsLocalAdmin", - "Set-xSharePointUserProfileSyncMachine") + "Set-xSharePointUserProfileSyncMachine", + "Test-xSharePointSpecificParameters") # Variables to export from this module VariablesToExport = '*' diff --git a/Tests/Tests.pssproj b/Tests/Tests.pssproj index cd3f7e6aa..b21b06b52 100644 --- a/Tests/Tests.pssproj +++ b/Tests/Tests.pssproj @@ -54,6 +54,7 @@ + diff --git a/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 b/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 new file mode 100644 index 000000000..4d117ae6f --- /dev/null +++ b/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 @@ -0,0 +1,48 @@ +[CmdletBinding()] +param() + +if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 +{ + $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) +} + +$ErrorActionPreference = 'stop' +Set-StrictMode -Version latest + +$RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path + +$ModuleName = "xSharePoint.Util" +Import-Module (Join-Path $RepoRoot "Modules\xSharePoint") + +Describe "xSharePoint.Util" { + Context "Validate Test-xSharePointSpecificParameters" { + It "Returns true for two identical tables" { + $desired = @{ Example = "test" } + Test-xSharePointSpecificParameters -CurrentValues $desired -DesiredValues $desired | Should Be $true + } + + It "Returns false when a value is different" { + $current = @{ Example = "something" } + $desired = @{ Example = "test" } + Test-xSharePointSpecificParameters -CurrentValues $current -DesiredValues $desired | Should Be $false + } + + It "Returns false when a value is missing" { + $current = @{ } + $desired = @{ Example = "test" } + Test-xSharePointSpecificParameters -CurrentValues $current -DesiredValues $desired | Should Be $false + } + + It "Returns true when only a specified value matches, but other non-listed values do not" { + $current = @{ Example = "test"; SecondExample = "true" } + $desired = @{ Example = "test"; SecondExample = "false" } + Test-xSharePointSpecificParameters -CurrentValues $current -DesiredValues $desired -ValuesToCheck @("Example") | Should Be $true + } + + It "Returns false when only specified values do not match, but other non-listed values do " { + $current = @{ Example = "test"; SecondExample = "true" } + $desired = @{ Example = "test"; SecondExample = "false" } + Test-xSharePointSpecificParameters -CurrentValues $current -DesiredValues $desired -ValuesToCheck @("SecondExample") | Should Be $false + } + } +} \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 index 487244dea..6e18c555c 100644 --- a/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 @@ -26,14 +26,14 @@ Describe "xSPInstall" { It "Returns false when SharePoint is not detected" { Mock Get-CimInstance { return $null } -Verifiable $result = Get-TargetResource @testParams - $result.SharePointInstalled | Should Be $false + $result.BinaryDir | Should BeNullOrEmpty Assert-VerifiableMocks } It "Returns true when SharePoint is detected" { Mock Get-CimInstance { return @{} } -Verifiable $result = Get-TargetResource @testParams - $result.SharePointInstalled | Should Be $true + $result.BinaryDir | Should Not BeNullOrEmpty Assert-VerifiableMocks } } @@ -42,7 +42,8 @@ Describe "xSPInstall" { It "Passes when SharePoint is installed" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ - SharePointInstalled = $true + BinaryDir = $testParams.BinaryDir + ProductKey = $testParams.ProductKey } } Test-TargetResource @testParams | Should Be $true @@ -50,7 +51,8 @@ Describe "xSPInstall" { It "Fails when SharePoint is not installed" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ - SharePointInstalled = $false + BinaryDir = $null + ProductKey = $testParams.ProductKey } } Test-TargetResource @testParams | Should Be $false From 90e051647cd1af04accfa55b7bc5aa7efd09b437 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 14:21:51 +1000 Subject: [PATCH 034/146] Added Ensure parameter to xSPInstall --- .../MSFT_xSPInstall/MSFT_xSPInstall.psm1 | 44 +++++++++---------- .../MSFT_xSPInstall.schema.mof | 1 + .../Examples/Single Server/SharePoint.ps1 | 1 + .../Examples/Small Farm/AppServer.ps1 | 1 + .../Examples/Small Farm/FirstServer.ps1 | 1 + .../Examples/Small Farm/WFEServer.ps1 | 1 + .../xSharePoint.xSPInstall.Tests.ps1 | 23 +++++++++- 7 files changed, 48 insertions(+), 24 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1 index 3c43b2a99..c3f503845 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1 @@ -4,13 +4,9 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $BinaryDir, - - [parameter(Mandatory = $true)] - [System.String] - $ProductKey + [parameter(Mandatory = $true)] [System.String] $BinaryDir, + [parameter(Mandatory = $true)] [System.String] $ProductKey, + [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure ) Write-Verbose -Message "Getting install status of SP binaries" @@ -20,11 +16,13 @@ function Get-TargetResource return @{ BinaryDir = $BinaryDir ProductKey = $ProductKey + Ensure = "Present" } } else { return @{ - BinaryDir = $null + BinaryDir = $BinaryDir ProductKey = $ProductKey + Ensure = "Absent" } } } @@ -35,15 +33,16 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $BinaryDir, - - [parameter(Mandatory = $true)] - [System.String] - $ProductKey + [parameter(Mandatory = $true)] [System.String] $BinaryDir, + [parameter(Mandatory = $true)] [System.String] $ProductKey, + [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure ) + if ($Ensure -eq "Absent") { + throw [Exception] "xSharePoint does not support uninstalling SharePoint. Please remove this manually." + return + } + Write-Verbose -Message "Writing install config file" $configPath = "$env:temp\SPInstallConfig.xml" @@ -90,15 +89,16 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $BinaryDir, - - [parameter(Mandatory = $true)] - [System.String] - $ProductKey + [parameter(Mandatory = $true)] [System.String] $BinaryDir, + [parameter(Mandatory = $true)] [System.String] $ProductKey, + [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure ) + if ($Ensure -eq "Absent") { + throw [Exception] "xSharePoint does not support uninstalling SharePoint. Please remove this manually." + return + } + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for installation of SharePoint" diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.schema.mof index eb1894f59..fea52d9f5 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.schema.mof @@ -3,5 +3,6 @@ class MSFT_xSPInstall : OMI_BaseResource { [Key] String BinaryDir; [Required] String ProductKey; + [Required, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; }; diff --git a/Modules/xSharePoint/Examples/Single Server/SharePoint.ps1 b/Modules/xSharePoint/Examples/Single Server/SharePoint.ps1 index 538871a57..bdd56999e 100644 --- a/Modules/xSharePoint/Examples/Single Server/SharePoint.ps1 +++ b/Modules/xSharePoint/Examples/Single Server/SharePoint.ps1 @@ -92,6 +92,7 @@ Configuration SharePointServer { BinaryDir = "C:\SPInstall" ProductKey = $ProductKey + Ensure = "Present" DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" } diff --git a/Modules/xSharePoint/Examples/Small Farm/AppServer.ps1 b/Modules/xSharePoint/Examples/Small Farm/AppServer.ps1 index cee01c84a..0578e3cb5 100644 --- a/Modules/xSharePoint/Examples/Small Farm/AppServer.ps1 +++ b/Modules/xSharePoint/Examples/Small Farm/AppServer.ps1 @@ -92,6 +92,7 @@ Configuration SharePointAppServer { BinaryDir = "C:\SPInstall" ProductKey = $ProductKey + Ensure = "Present" DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" } diff --git a/Modules/xSharePoint/Examples/Small Farm/FirstServer.ps1 b/Modules/xSharePoint/Examples/Small Farm/FirstServer.ps1 index 09b5a231e..776d54b37 100644 --- a/Modules/xSharePoint/Examples/Small Farm/FirstServer.ps1 +++ b/Modules/xSharePoint/Examples/Small Farm/FirstServer.ps1 @@ -92,6 +92,7 @@ Configuration SharePointFarmServer { BinaryDir = "C:\SPInstall" ProductKey = $ProductKey + Ensure = "Present" DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" } diff --git a/Modules/xSharePoint/Examples/Small Farm/WFEServer.ps1 b/Modules/xSharePoint/Examples/Small Farm/WFEServer.ps1 index cfd7b4350..7461de9ea 100644 --- a/Modules/xSharePoint/Examples/Small Farm/WFEServer.ps1 +++ b/Modules/xSharePoint/Examples/Small Farm/WFEServer.ps1 @@ -92,6 +92,7 @@ Configuration SharePointWFEServer { BinaryDir = "C:\SPInstall" ProductKey = $ProductKey + Ensure = "Present" DependsOn = "[xSPInstallPrereqs]InstallPrerequisites" } diff --git a/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 index 6e18c555c..ce92b8fbf 100644 --- a/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 @@ -19,6 +19,7 @@ Describe "xSPInstall" { $testParams = @{ BinaryDir = "C:\SPInstall" ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" + Ensure = "Present" } Context "Validate get method" { @@ -26,14 +27,12 @@ Describe "xSPInstall" { It "Returns false when SharePoint is not detected" { Mock Get-CimInstance { return $null } -Verifiable $result = Get-TargetResource @testParams - $result.BinaryDir | Should BeNullOrEmpty Assert-VerifiableMocks } It "Returns true when SharePoint is detected" { Mock Get-CimInstance { return @{} } -Verifiable $result = Get-TargetResource @testParams - $result.BinaryDir | Should Not BeNullOrEmpty Assert-VerifiableMocks } } @@ -44,6 +43,7 @@ Describe "xSPInstall" { return @{ BinaryDir = $testParams.BinaryDir ProductKey = $testParams.ProductKey + Ensure = "Present" } } Test-TargetResource @testParams | Should Be $true @@ -53,10 +53,24 @@ Describe "xSPInstall" { return @{ BinaryDir = $null ProductKey = $testParams.ProductKey + Ensure = "Absent" } } Test-TargetResource @testParams | Should Be $false } + + $testParams.Ensure = "Absent" + It "Throws an error if SharePoint should be absent" { + Mock -ModuleName $ModuleName Get-TargetResource { + return @{ + BinaryDir = $null + ProductKey = $testParams.ProductKey + Ensure = "Absent" + } + } + { Test-TargetResource @testParams } | Should Throw + } + $testParams.Ensure = "Present" } Context "Validate set method" { @@ -76,6 +90,11 @@ Describe "xSPInstall" { Assert-VerifiableMocks } + $testParams.Ensure = "Absent" + It "Throws an error when SharePoint should be absent" { + { Set-TargetResource @testParams } | Should Throw + } + $testParams.Ensure = "Present" } } } \ No newline at end of file From 7da3a7ca1a37e9812324ff521a5cb74ee5ae3c7c Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 14:39:10 +1000 Subject: [PATCH 035/146] Updated get method of xSPInstallPrereqs --- .../MSFT_xSPInstall/MSFT_xSPInstall.psm1 | 6 +- .../MSFT_xSPInstallPrereqs.psm1 | 253 +++++------------- .../MSFT_xSPInstallPrereqs.schema.mof | 3 +- .../xSharePoint.xSPInstall.Tests.ps1 | 14 +- .../xSharePoint.xSPInstallPrereqs.Tests.ps1 | 62 ++--- 5 files changed, 101 insertions(+), 237 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1 index c3f503845..5ec9e13ed 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1 @@ -39,7 +39,7 @@ function Set-TargetResource ) if ($Ensure -eq "Absent") { - throw [Exception] "xSharePoint does not support uninstalling SharePoint. Please remove this manually." + throw [Exception] "xSharePoint does not support uninstalling SharePoint or its prerequisites. Please remove this manually." return } @@ -95,7 +95,7 @@ function Test-TargetResource ) if ($Ensure -eq "Absent") { - throw [Exception] "xSharePoint does not support uninstalling SharePoint. Please remove this manually." + throw [Exception] "xSharePoint does not support uninstalling SharePoint or its prerequisites. Please remove this manually." return } @@ -103,7 +103,7 @@ function Test-TargetResource Write-Verbose -Message "Testing for installation of SharePoint" - return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 index 83c5b109e..67eea7012 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 @@ -4,65 +4,22 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $InstallerPath, - - [parameter(Mandatory = $false)] - [System.Boolean] - $OnlineMode = $true, - - [parameter(Mandatory = $false)] - [System.String] - $SQLNCli, - - [parameter(Mandatory = $false)] - [System.String] - $PowerShell, - - [parameter(Mandatory = $false)] - [System.String] - $NETFX, - - [parameter(Mandatory = $false)] - [System.String] - $IDFX, - - [parameter(Mandatory = $false)] - [System.String] - $Sync, - - [parameter(Mandatory = $false)] - [System.String] - $AppFabric, - - [parameter(Mandatory = $false)] - [System.String] - $IDFX11, - - [parameter(Mandatory = $false)] - [System.String] - $MSIPCClient, - - [parameter(Mandatory = $false)] - [System.String] - $WCFDataServices, - - [parameter(Mandatory = $false)] - [System.String] - $KB2671763, - - [parameter(Mandatory = $false)] - [System.String] - $WCFDataServices56, - - [parameter(Mandatory = $false)] - [System.String] - $KB2898850, - - [parameter(Mandatory = $false)] - [System.String] - $MSVCRT12 + [parameter(Mandatory = $true)] [System.String] $InstallerPath, + [parameter(Mandatory = $true)] [System.Boolean] $OnlineMode, + [parameter(Mandatory = $false)] [System.String] $SQLNCli, + [parameter(Mandatory = $false)] [System.String] $PowerShell, + [parameter(Mandatory = $false)] [System.String] $NETFX, + [parameter(Mandatory = $false)] [System.String] $IDFX, + [parameter(Mandatory = $false)] [System.String] $Sync, + [parameter(Mandatory = $false)] [System.String] $AppFabric, + [parameter(Mandatory = $false)] [System.String] $IDFX11, + [parameter(Mandatory = $false)] [System.String] $MSIPCClient, + [parameter(Mandatory = $false)] [System.String] $WCFDataServices, + [parameter(Mandatory = $false)] [System.String] $KB2671763, + [parameter(Mandatory = $false)] [System.String] $WCFDataServices56, + [parameter(Mandatory = $false)] [System.String] $KB2898850, + [parameter(Mandatory = $false)] [System.String] $MSVCRT12, + [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure ) $returnValue = @{} @@ -113,7 +70,15 @@ function Get-TargetResource $returnValue.Add("Microsoft SQL Server 2012 Native Client", (($installedItems | ? {$_.Name -ne $null -and $_.Name.Trim() -eq "Microsoft SQL Server 2012 Native Client"}) -ne $null)) $returnValue.Add("Active Directory Rights Management Services Client 2.1", (($installedItems | ? {$_.Name -eq "Active Directory Rights Management Services Client 2.1"}) -ne $null)) } - $returnValue + + $results = $PSBoundParameters + if (($returnValue.Values | Where-Object { $_ -eq $false }).Count -gt 0) { + $results.Ensure = "Absent" + } else { + $results.Ensure = "Present" + } + + return $results } @@ -122,67 +87,29 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $InstallerPath, - - [parameter(Mandatory = $false)] - [System.Boolean] - $OnlineMode = $true, - - [parameter(Mandatory = $false)] - [System.String] - $SQLNCli, - - [parameter(Mandatory = $false)] - [System.String] - $PowerShell, - - [parameter(Mandatory = $false)] - [System.String] - $NETFX, - - [parameter(Mandatory = $false)] - [System.String] - $IDFX, - - [parameter(Mandatory = $false)] - [System.String] - $Sync, - - [parameter(Mandatory = $false)] - [System.String] - $AppFabric, - - [parameter(Mandatory = $false)] - [System.String] - $IDFX11, - - [parameter(Mandatory = $false)] - [System.String] - $MSIPCClient, - - [parameter(Mandatory = $false)] - [System.String] - $WCFDataServices, - - [parameter(Mandatory = $false)] - [System.String] - $KB2671763, - - [parameter(Mandatory = $false)] - [System.String] - $WCFDataServices56, - - [parameter(Mandatory = $false)] - [System.String] - $KB2898850, - - [parameter(Mandatory = $false)] - [System.String] - $MSVCRT12 + [parameter(Mandatory = $true)] [System.String] $InstallerPath, + [parameter(Mandatory = $true)] [System.Boolean] $OnlineMode, + [parameter(Mandatory = $false)] [System.String] $SQLNCli, + [parameter(Mandatory = $false)] [System.String] $PowerShell, + [parameter(Mandatory = $false)] [System.String] $NETFX, + [parameter(Mandatory = $false)] [System.String] $IDFX, + [parameter(Mandatory = $false)] [System.String] $Sync, + [parameter(Mandatory = $false)] [System.String] $AppFabric, + [parameter(Mandatory = $false)] [System.String] $IDFX11, + [parameter(Mandatory = $false)] [System.String] $MSIPCClient, + [parameter(Mandatory = $false)] [System.String] $WCFDataServices, + [parameter(Mandatory = $false)] [System.String] $KB2671763, + [parameter(Mandatory = $false)] [System.String] $WCFDataServices56, + [parameter(Mandatory = $false)] [System.String] $KB2898850, + [parameter(Mandatory = $false)] [System.String] $MSVCRT12, + [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure ) + if ($Ensure -eq "Absent") { + throw [Exception] "xSharePoint does not support uninstalling SharePoint or its prerequisites. Please remove this manually." + return + } + Write-Verbose -Message "Detecting SharePoint version from binaries" $majorVersion = (Get-xSharePointAssemblyVersion -PathToAssembly $InstallerPath) if ($majorVersion -eq 15) { @@ -242,76 +169,34 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $InstallerPath, - - [parameter(Mandatory = $false)] - [System.Boolean] - $OnlineMode = $true, - - [parameter(Mandatory = $false)] - [System.String] - $SQLNCli, - - [parameter(Mandatory = $false)] - [System.String] - $PowerShell, - - [parameter(Mandatory = $false)] - [System.String] - $NETFX, - - [parameter(Mandatory = $false)] - [System.String] - $IDFX, - - [parameter(Mandatory = $false)] - [System.String] - $Sync, - - [parameter(Mandatory = $false)] - [System.String] - $AppFabric, - - [parameter(Mandatory = $false)] - [System.String] - $IDFX11, - - [parameter(Mandatory = $false)] - [System.String] - $MSIPCClient, - - [parameter(Mandatory = $false)] - [System.String] - $WCFDataServices, - - [parameter(Mandatory = $false)] - [System.String] - $KB2671763, - - [parameter(Mandatory = $false)] - [System.String] - $WCFDataServices56, - - [parameter(Mandatory = $false)] - [System.String] - $KB2898850, - - [parameter(Mandatory = $false)] - [System.String] - $MSVCRT12 + [parameter(Mandatory = $true)] [System.String] $InstallerPath, + [parameter(Mandatory = $true)] [System.Boolean] $OnlineMode, + [parameter(Mandatory = $false)] [System.String] $SQLNCli, + [parameter(Mandatory = $false)] [System.String] $PowerShell, + [parameter(Mandatory = $false)] [System.String] $NETFX, + [parameter(Mandatory = $false)] [System.String] $IDFX, + [parameter(Mandatory = $false)] [System.String] $Sync, + [parameter(Mandatory = $false)] [System.String] $AppFabric, + [parameter(Mandatory = $false)] [System.String] $IDFX11, + [parameter(Mandatory = $false)] [System.String] $MSIPCClient, + [parameter(Mandatory = $false)] [System.String] $WCFDataServices, + [parameter(Mandatory = $false)] [System.String] $KB2671763, + [parameter(Mandatory = $false)] [System.String] $WCFDataServices56, + [parameter(Mandatory = $false)] [System.String] $KB2898850, + [parameter(Mandatory = $false)] [System.String] $MSVCRT12, + [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure ) + if ($Ensure -eq "Absent") { + throw [Exception] "xSharePoint does not support uninstalling SharePoint or its prerequisites. Please remove this manually." + return + } + + $CurrentValues = Get-TargetResource @PSBoundParameters - $result = Get-TargetResource -InstallerPath $InstallerPath Write-Verbose -Message "Checking installation of SharePoint prerequisites" - if (($result.Values | Where-Object { $_ -eq $false }).Count -gt 0) { - Write-Verbose -Message "Prerequisites were detected as missing." - return $false - } - return $true + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof index 3a446088b..94c9b902c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof @@ -2,7 +2,7 @@ class MSFT_xSPInstallPrereqs : OMI_BaseResource { [Key] String InstallerPath; - [Write] Boolean OnlineMode; + [Required] Boolean OnlineMode; [Write] String SQLNCli; [Write] String PowerShell; [Write] String NETFX; @@ -16,5 +16,6 @@ class MSFT_xSPInstallPrereqs : OMI_BaseResource [Write] String WCFDataServices56; [Write] String KB2898850; [Write] String MSVCRT12; + [Required, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; }; diff --git a/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 index ce92b8fbf..dff6e1289 100644 --- a/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 @@ -59,8 +59,8 @@ Describe "xSPInstall" { Test-TargetResource @testParams | Should Be $false } - $testParams.Ensure = "Absent" - It "Throws an error if SharePoint should be absent" { + $testParams.Ensure = "Absent" + It "Throws an error if SharePoint should be absent" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ BinaryDir = $null @@ -70,7 +70,7 @@ Describe "xSPInstall" { } { Test-TargetResource @testParams } | Should Throw } - $testParams.Ensure = "Present" + $testParams.Ensure = "Present" } Context "Validate set method" { @@ -90,11 +90,11 @@ Describe "xSPInstall" { Assert-VerifiableMocks } - $testParams.Ensure = "Absent" - It "Throws an error when SharePoint should be absent" { + $testParams.Ensure = "Absent" + It "Throws an error when SharePoint should be absent" { { Set-TargetResource @testParams } | Should Throw - } - $testParams.Ensure = "Present" + } + $testParams.Ensure = "Present" } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 index 6548a240e..ca9511ac6 100644 --- a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 @@ -19,6 +19,7 @@ Describe "xSPInstallPrereqs" { $testParams = @{ InstallerPath = "C:\SPInstall" OnlineMode = $true + Ensure = "Present" } Context "Validate get method" { @@ -36,58 +37,29 @@ Describe "xSPInstallPrereqs" { Context "Validate test method" { It "Passes when all Prereqs are installed" { Mock -ModuleName $ModuleName Get-TargetResource { - $returnValue = @{} - foreach($feature in "Net-Framework-Features,Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Security,Web-Basic-Auth,Web-Windows-Auth,Web-Filtering,Web-Digest-Auth,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Application-Server,AS-Web-Support,AS-TCP-Port-Sharing,AS-WAS-Support, AS-HTTP-Activation,AS-TCP-Activation,AS-Named-Pipes,AS-Net-Framework,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Web-Lgcy-Scripting,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer".Split(",")) { - $returnValue.Add($feature, $true) + return @{ + InstallerPath = "C:\SPInstall" + OnlineMode = $true + Ensure = "Present" } - $returnValue.Add("Microsoft SQL Server 2008 R2 Native Client", $true) - $returnValue.Add("Microsoft Sync Framework Runtime v1.0 SP1 (x64)", $true) - $returnValue.Add("AppFabric 1.1 for Windows Server", $true) - $returnValue.Add("Microsoft Identity Extensions", $true) - $returnValue.Add("Active Directory Rights Management Services Client 2.0", $true) - $returnValue.Add("WCF Data Services 5.0 (for OData v3) Primary Components", $true) - $returnValue.Add("WCF Data Services 5.6.0 Runtime", $true) - $returnValue.Add("Microsoft CCR and DSS Runtime 2008 R3", $true) - return $returnValue } Test-TargetResource @testParams | Should Be $true } - It "Fails when there are Windows Features missing" { + It "Fails when there are Prereqs missing" { Mock -ModuleName $ModuleName Get-TargetResource { - $returnValue = @{} - foreach($feature in "Net-Framework-Features,Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Security,Web-Basic-Auth,Web-Windows-Auth,Web-Filtering,Web-Digest-Auth,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Application-Server,AS-Web-Support,AS-TCP-Port-Sharing,AS-WAS-Support, AS-HTTP-Activation,AS-TCP-Activation,AS-Named-Pipes,AS-Net-Framework,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Web-Lgcy-Scripting,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer".Split(",")) { - $returnValue.Add($feature, $false) + return @{ + InstallerPath = "C:\SPInstall" + OnlineMode = $true + Ensure = "Absent" } - $returnValue.Add("Microsoft SQL Server 2008 R2 Native Client", $true) - $returnValue.Add("Microsoft Sync Framework Runtime v1.0 SP1 (x64)", $true) - $returnValue.Add("AppFabric 1.1 for Windows Server", $true) - $returnValue.Add("Microsoft Identity Extensions", $true) - $returnValue.Add("Active Directory Rights Management Services Client 2.0", $true) - $returnValue.Add("WCF Data Services 5.0 (for OData v3) Primary Components", $true) - $returnValue.Add("WCF Data Services 5.6.0 Runtime", $true) - $returnValue.Add("Microsoft CCR and DSS Runtime 2008 R3", $true) - return $returnValue } Test-TargetResource @testParams | Should Be $false } - It "Fails when there are software prereqs missing" { - Mock -ModuleName $ModuleName Get-TargetResource { - $returnValue = @{} - foreach($feature in "Net-Framework-Features,Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Security,Web-Basic-Auth,Web-Windows-Auth,Web-Filtering,Web-Digest-Auth,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Application-Server,AS-Web-Support,AS-TCP-Port-Sharing,AS-WAS-Support, AS-HTTP-Activation,AS-TCP-Activation,AS-Named-Pipes,AS-Net-Framework,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Web-Lgcy-Scripting,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer".Split(",")) { - $returnValue.Add($feature, $false) - } - $returnValue.Add("Microsoft SQL Server 2008 R2 Native Client", $false) - $returnValue.Add("Microsoft Sync Framework Runtime v1.0 SP1 (x64)", $false) - $returnValue.Add("AppFabric 1.1 for Windows Server", $false) - $returnValue.Add("Microsoft Identity Extensions", $false) - $returnValue.Add("Active Directory Rights Management Services Client 2.0", $false) - $returnValue.Add("WCF Data Services 5.0 (for OData v3) Primary Components", $false) - $returnValue.Add("WCF Data Services 5.6.0 Runtime", $false) - $returnValue.Add("Microsoft CCR and DSS Runtime 2008 R3", $false) - return $returnValue - } - Test-TargetResource @testParams | Should Be $false + $testParams.Ensure = "Absent" + It "Throws an error if SharePoint prereqs should be absent" { + { Test-TargetResource @testParams } | Should Throw } + $testParams.Ensure = "Present" } Context "Validate set method" { @@ -130,6 +102,12 @@ Describe "xSPInstallPrereqs" { { Set-TargetResource @testParams } | Should throw "offline mode" } + + $testParams.Ensure = "Absent" + It "Throws an error if SharePoint prereqs should be absent" { + { Set-TargetResource @testParams } | Should Throw + } + $testParams.Ensure = "Present" } } } \ No newline at end of file From 1fb54073fd16a3551352b0f8221ce215abe39be7 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 14:58:26 +1000 Subject: [PATCH 036/146] Updated get for xSPBCSServiceApp --- .../MSFT_xSPBCSServiceApp.psm1 | 84 +++++-------------- Tests/xSharePoint/xSharePoint.Util.Tests.ps1 | 6 ++ .../xSharePoint.xSPBCSServiceApp.Tests.ps1 | 3 +- 3 files changed, 28 insertions(+), 65 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 index 7070c92d8..35d627fd8 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 @@ -4,25 +4,11 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ApplicationPool, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting BCS service app '$Name'" @@ -42,6 +28,9 @@ function Get-TargetResource return @{ Name = $serviceApp.DisplayName ApplicationPool = $serviceApp.ApplicationPool.Name + DatabaseName = $serviceApp.Database.Name + DatabaseServer = $serviceApp.Database.Server.Name + InstallAccount = $params.InstallAccount } } } @@ -59,25 +48,11 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ApplicationPool, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) $result = Get-TargetResource @PSBoundParameters @@ -118,34 +93,17 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ApplicationPool, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource @PSBoundParameters + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for BCS Service Application '$Name'" - if ($result.Count -eq 0) { return $false } - else { - if ($ApplicationPool -ne $result.ApplicationPool) { return $false } - } - return $true + + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("ApplicationPool") } Export-ModuleMember -Function *-TargetResource diff --git a/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 b/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 index 4d117ae6f..9176d93fe 100644 --- a/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 @@ -44,5 +44,11 @@ Describe "xSharePoint.Util" { $desired = @{ Example = "test"; SecondExample = "false" } Test-xSharePointSpecificParameters -CurrentValues $current -DesiredValues $desired -ValuesToCheck @("SecondExample") | Should Be $false } + + It "Returns false when an empty array is used in the current values " { + $current = @{ } + $desired = @{ Example = "test"; SecondExample = "false" } + Test-xSharePointSpecificParameters -CurrentValues $current -DesiredValues $desired | Should Be $false + } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 index 29c46995f..37697f927 100644 --- a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 @@ -12,7 +12,6 @@ Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path $ModuleName = "MSFT_xSPBCSServiceApp" -Import-Module (Join-Path $RepoRoot "Modules\xSharePoint") Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") Describe "xSPBCSServiceApp" { @@ -32,7 +31,7 @@ Describe "xSPBCSServiceApp" { } } -Verifiable -ParameterFilter {$Name -eq $testParams.Name -and $TypeName -eq "BCS"} $results = Get-TargetResource @testParams - $results.Count | Should Be 2 + $results | Should Not BeNullOrEmpty Assert-VerifiableMocks } From c84765a2f404a6b3db3b13bf2c29794279b0f10b Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 15:11:41 +1000 Subject: [PATCH 037/146] Updated get method of xSPCacheAccounts --- .../MSFT_xSPCacheAccounts.psm1 | 20 ++++++----------- .../xSharePoint.xSPCacheAccounts.Tests.ps1 | 22 +++++++++---------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 index aa898a748..e7b4ccd22 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 @@ -32,16 +32,16 @@ function Get-TargetResource $returnVal = @{} $returnVal.Add("WebAppUrl", $params.WebAppUrl) if ($wa.Properties.ContainsKey("portalsuperuseraccount")) { - $returnVal.Add("portalsuperuseraccount", $wa.Properties["portalsuperuseraccount"]) + $returnVal.Add("SuperUserAlias", $wa.Properties["portalsuperuseraccount"]) } else { - $returnVal.Add("portalsuperuseraccount", "") + $returnVal.Add("SuperUserAlias", "") } if ($wa.Properties.ContainsKey("portalsuperreaderaccount")) { - $returnVal.Add("portalsuperreaderaccount", $wa.Properties["portalsuperreaderaccount"]) + $returnVal.Add("SuperReaderAlias", $wa.Properties["portalsuperreaderaccount"]) } else { - $returnVal.Add("portalsuperreaderaccount", "") + $returnVal.Add("SuperReaderAlias", "") } - + $returnVal.Add("InstallAccount", $params.InstallAccount) return $returnVal } return $result @@ -119,15 +119,9 @@ function Test-TargetResource $InstallAccount ) - $result = Get-TargetResource @PSBoundParameters + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing cache accounts for $WebAppUrl" - - if ($result.Count -eq 0) { return $false } - else { - if ($SuperUserAlias -ne $result.portalsuperuseraccount) { return $false } - if ($SuperReaderAlias -ne $result.portalsuperreaderaccount) { return $false } - } - return $true + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("SuperUserAlias", "SuperReaderAlias") } Export-ModuleMember -Function *-TargetResource diff --git a/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 index ceea381d7..b90843f9e 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 @@ -28,13 +28,13 @@ Describe "xSPCacheAccounts" { It "Calls the service application picker with the appropriate type name" { Mock Invoke-xSharePointSPCmdlet { return @{ Properties = @{ - portalsuperuseraccount = $testParams.SuperUserAlias - portalsuperreaderaccount = $testParams.SuperReaderAlias + SuperUserAlias = $testParams.SuperUserAlias + SuperReaderAlias = $testParams.SuperReaderAlias } }} -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPWebApplication" } $results = Get-TargetResource @testParams - $results.Count | Should Be 3 + $results.Count | Should Not BeNullOrEmpty Assert-VerifiableMocks } @@ -48,8 +48,8 @@ Describe "xSPCacheAccounts" { It "Passes when the correct accounts are assigned" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ - portalsuperuseraccount = $testParams.SuperUserAlias - portalsuperreaderaccount = $testParams.SuperReaderAlias + SuperUserAlias = $testParams.SuperUserAlias + SuperReaderAlias = $testParams.SuperReaderAlias } } Test-TargetResource @testParams | Should Be $true @@ -57,8 +57,8 @@ Describe "xSPCacheAccounts" { It "Fails when the wrong super reader is defined" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ - portalsuperuseraccount = $testParams.SuperUserAlias - portalsuperreaderaccount = "DEMO\WrongUser" + SuperUserAlias = $testParams.SuperUserAlias + SuperReaderAlias = "DEMO\WrongUser" } } Test-TargetResource @testParams | Should Be $false @@ -66,8 +66,8 @@ Describe "xSPCacheAccounts" { It "Fails when the wrong super user is defined" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ - portalsuperuseraccount = "DEMO\WrongUser" - portalsuperreaderaccount = $testParams.SuperReaderAlias + SuperUserAlias = "DEMO\WrongUser" + SuperReaderAlias = $testParams.SuperReaderAlias } } Test-TargetResource @testParams | Should Be $false @@ -91,8 +91,8 @@ Describe "xSPCacheAccounts" { It "Sets accounts when existing accounts are set" { Mock Invoke-xSharePointSPCmdlet { return @{ Properties = @{ - portalsuperuseraccount = $testParams.SuperUserAlias - portalsuperreaderaccount = $testParams.SuperReaderAlias + SuperUserAlias = $testParams.SuperUserAlias + SuperReaderAlias = $testParams.SuperReaderAlias } } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPWebApplication" } Mock Set-xSharePointCacheReaderPolicy { return $null } -Verifiable From 447f4d330848d8efdd2f40ded2433be794bf461d Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 15:37:18 +1000 Subject: [PATCH 038/146] Updated get method for xSPCreateFarm --- .../MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 | 18 +++++++++++++----- .../xSharePoint.xSPCreateFarm.Tests.ps1 | 3 +-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 index 41ac9c1ea..93cb21078 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 @@ -44,8 +44,17 @@ function Get-TargetResource if ($null -eq $spFarm) {return @{ }} + $configDb = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPDatabase" -Arguments @{ IncludeCentralAdministration = $true } | Where-Object { $_.Name -eq $spFarm.Name -and $_.Type -eq "Configuration Database" } + $centralAdminSite = (Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" | Where-Object { $_.IsAdministrationWebApplication })[0] + $returnValue = @{ - FarmName = $spFarm.Name + FarmConfigDatabaseName = $spFarm.Name + DatabaseServer = $configDb.Server.Name + FarmAccount = $spFarm.DefaultServiceAccount.Name + InstallAccount = $params.InstallAccount + Passphrase = $params.Passphrase + AdminContentDatabaseName = $centralAdminSite.ContentDatabases[0].Server + CentralAdministrationPort = [Uri]::new($centralAdminSite.Url).Port } return $returnValue } @@ -158,10 +167,9 @@ function Test-TargetResource $CentralAdministrationPort ) - $result = Get-TargetResource @PSBoundParameters - - if ($result.Count -eq 0) { return $false } - return $true + $CurrentValues = Get-TargetResource @PSBoundParameters + Write-Verbose "Checking for local farm presence" + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("FarmConfigDatabaseName") } Export-ModuleMember -Function *-TargetResource diff --git a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 index a3895bd50..5653127e7 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 @@ -29,7 +29,6 @@ Describe "xSPCreateFarm" { It "Calls SP Farm to find the local environment settings" { Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter {$CmdletName -eq "Get-SPFarm"} $results = Get-TargetResource @testParams - $results.Count | Should Be 0 Assert-VerifiableMocks } } @@ -42,7 +41,7 @@ Describe "xSPCreateFarm" { It "Passes when local server is in a farm" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ - FarmName = "SP_Config" + FarmConfigDatabaseName = "SP_Config" } } Test-TargetResource @testParams | Should Be $true From 1c8afe8e2a3fa97be91401f73499ac8e5241ec58 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 15:41:59 +1000 Subject: [PATCH 039/146] Fixed parameter formatting --- .../MSFT_xSPCacheAccounts.psm1 | 57 +++------- .../MSFT_xSPCreateFarm.psm1 | 102 ++++-------------- 2 files changed, 33 insertions(+), 126 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 index e7b4ccd22..55019b467 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 @@ -4,21 +4,10 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [System.String] - $SuperUserAlias, - - [parameter(Mandatory = $true)] - [System.String] - $SuperReaderAlias, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $WebAppUrl, + [parameter(Mandatory = $true)] [System.String] $SuperUserAlias, + [parameter(Mandatory = $true)] [System.String] $SuperReaderAlias, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting cache accounts for $WebAppUrl" @@ -53,21 +42,10 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [System.String] - $SuperUserAlias, - - [parameter(Mandatory = $true)] - [System.String] - $SuperReaderAlias, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $WebAppUrl, + [parameter(Mandatory = $true)] [System.String] $SuperUserAlias, + [parameter(Mandatory = $true)] [System.String] $SuperReaderAlias, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Setting cache accounts for $WebAppUrl" @@ -102,21 +80,10 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $true)] - [System.String] - $SuperUserAlias, - - [parameter(Mandatory = $true)] - [System.String] - $SuperReaderAlias, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $WebAppUrl, + [parameter(Mandatory = $true)] [System.String] $SuperUserAlias, + [parameter(Mandatory = $true)] [System.String] $SuperReaderAlias, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) $CurrentValues = Get-TargetResource @PSBoundParameters diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 index 93cb21078..2e74e4235 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 @@ -4,33 +4,13 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $FarmConfigDatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.String] - $Passphrase, - - [parameter(Mandatory = $true)] - [System.String] - $AdminContentDatabaseName, - - [parameter(Mandatory = $false)] - [System.UInt32] - $CentralAdministrationPort + [parameter(Mandatory = $true)] [System.String] $FarmConfigDatabaseName, + [parameter(Mandatory = $true)] [System.String] $DatabaseServer, + [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $FarmAccount, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $true)] [System.String] $Passphrase, + [parameter(Mandatory = $true)] [System.String] $AdminContentDatabaseName, + [parameter(Mandatory = $false)] [System.UInt32] $CentralAdministrationPort ) Write-Verbose -Message "Checking for local SP Farm" @@ -66,33 +46,13 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $FarmConfigDatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.String] - $Passphrase, - - [parameter(Mandatory = $true)] - [System.String] - $AdminContentDatabaseName, - - [parameter(Mandatory = $false)] - [System.UInt32] - $CentralAdministrationPort + [parameter(Mandatory = $true)] [System.String] $FarmConfigDatabaseName, + [parameter(Mandatory = $true)] [System.String] $DatabaseServer, + [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $FarmAccount, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $true)] [System.String] $Passphrase, + [parameter(Mandatory = $true)] [System.String] $AdminContentDatabaseName, + [parameter(Mandatory = $false)] [System.UInt32] $CentralAdministrationPort ) if (-not $PSBoundParameters.ContainsKey("CentralAdministrationPort")) { $PSBoundParameters.Add("CentralAdministrationPort", 9999) } @@ -138,33 +98,13 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $FarmConfigDatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.String] - $Passphrase, - - [parameter(Mandatory = $true)] - [System.String] - $AdminContentDatabaseName, - - [parameter(Mandatory = $false)] - [System.UInt32] - $CentralAdministrationPort + [parameter(Mandatory = $true)] [System.String] $FarmConfigDatabaseName, + [parameter(Mandatory = $true)] [System.String] $DatabaseServer, + [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $FarmAccount, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $true)] [System.String] $Passphrase, + [parameter(Mandatory = $true)] [System.String] $AdminContentDatabaseName, + [parameter(Mandatory = $false)] [System.UInt32] $CentralAdministrationPort ) $CurrentValues = Get-TargetResource @PSBoundParameters From fb4a7cd652640d7165568438e43e074f4add36ee Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 15:56:20 +1000 Subject: [PATCH 040/146] Updated get method for xSPDiagnosticLoggingSettings --- .../MSFT_xSPDiagnosticLoggingSettings.psm1 | 309 ++++-------------- ...int.xSPDiagnosticLoggingSettings.Tests.ps1 | 23 +- 2 files changed, 69 insertions(+), 263 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 index 22a1c0297..9b552f8b8 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 @@ -4,81 +4,25 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $LogPath, - - [parameter(Mandatory = $true)] - [System.UInt32] - $LogSpaceInGB, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AppAnalyticsAutomaticUploadEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $CustomerExperienceImprovementProgramEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $DaysToKeepLogs, - - [parameter(Mandatory = $false)] - [System.Boolean] - $DownloadErrorReportingUpdatesEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ErrorReportingAutomaticUploadEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ErrorReportingEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $EventLogFloodProtectionEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionNotifyInterval, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionQuietPeriod, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionThreshold, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionTriggerPeriod, - - [parameter(Mandatory = $false)] - [System.UInt32] - $LogCutInterval, - - [parameter(Mandatory = $false)] - [System.Boolean] - $LogMaxDiskSpaceUsageEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ScriptErrorReportingDelay, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ScriptErrorReportingEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ScriptErrorReportingRequireAuth, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $LogPath, + [parameter(Mandatory = $true)] [System.UInt32] $LogSpaceInGB, + [parameter(Mandatory = $false)] [System.Boolean] $AppAnalyticsAutomaticUploadEnabled, + [parameter(Mandatory = $false)] [System.Boolean] $CustomerExperienceImprovementProgramEnabled, + [parameter(Mandatory = $false)] [System.UInt32] $DaysToKeepLogs, + [parameter(Mandatory = $false)] [System.Boolean] $DownloadErrorReportingUpdatesEnabled, + [parameter(Mandatory = $false)] [System.Boolean] $ErrorReportingAutomaticUploadEnabled, + [parameter(Mandatory = $false)] [System.Boolean] $ErrorReportingEnabled, + [parameter(Mandatory = $false)] [System.Boolean] $EventLogFloodProtectionEnabled, + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionNotifyInterval, + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionQuietPeriod, + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionThreshold, + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionTriggerPeriod, + [parameter(Mandatory = $false)] [System.UInt32] $LogCutInterval, + [parameter(Mandatory = $false)] [System.Boolean] $LogMaxDiskSpaceUsageEnabled, + [parameter(Mandatory = $false)] [System.UInt32] $ScriptErrorReportingDelay, + [parameter(Mandatory = $false)] [System.Boolean] $ScriptErrorReportingEnabled, + [parameter(Mandatory = $false)] [System.Boolean] $ScriptErrorReportingRequireAuth, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting diagnostic configuration settings" @@ -97,8 +41,8 @@ function Get-TargetResource DownloadErrorReportingUpdatesEnabled = $dc.DownloadErrorReportingUpdatesEnabled DaysToKeepLogs = $dc.DaysToKeepLogs LogMaxDiskSpaceUsageEnabled = $dc.LogMaxDiskSpaceUsageEnabled - LogDiskSpaceUsageGB = $dc.LogDiskSpaceUsageGB - LogLocation = $dc.LogLocation + LogSpaceInGB = $dc.LogDiskSpaceUsageGB + LogPath = $dc.LogLocation LogCutInterval = $dc.LogCutInterval EventLogFloodProtectionEnabled = $dc.EventLogFloodProtectionEnabled EventLogFloodProtectionThreshold = $dc.EventLogFloodProtectionThreshold @@ -110,6 +54,7 @@ function Get-TargetResource ScriptErrorReportingDelay = $dc.ScriptErrorReportingDelay } } + $result.Add("InstallAccount", $InstallAccount) return $result } @@ -119,81 +64,25 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $LogPath, - - [parameter(Mandatory = $true)] - [System.UInt32] - $LogSpaceInGB, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AppAnalyticsAutomaticUploadEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $CustomerExperienceImprovementProgramEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $DaysToKeepLogs, - - [parameter(Mandatory = $false)] - [System.Boolean] - $DownloadErrorReportingUpdatesEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ErrorReportingAutomaticUploadEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ErrorReportingEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $EventLogFloodProtectionEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionNotifyInterval, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionQuietPeriod, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionThreshold, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionTriggerPeriod, - - [parameter(Mandatory = $false)] - [System.UInt32] - $LogCutInterval, - - [parameter(Mandatory = $false)] - [System.Boolean] - $LogMaxDiskSpaceUsageEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ScriptErrorReportingDelay, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ScriptErrorReportingEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ScriptErrorReportingRequireAuth, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $LogPath, + [parameter(Mandatory = $true)] [System.UInt32] $LogSpaceInGB, + [parameter(Mandatory = $false)] [System.Boolean] $AppAnalyticsAutomaticUploadEnabled, + [parameter(Mandatory = $false)] [System.Boolean] $CustomerExperienceImprovementProgramEnabled, + [parameter(Mandatory = $false)] [System.UInt32] $DaysToKeepLogs, + [parameter(Mandatory = $false)] [System.Boolean] $DownloadErrorReportingUpdatesEnabled, + [parameter(Mandatory = $false)] [System.Boolean] $ErrorReportingAutomaticUploadEnabled, + [parameter(Mandatory = $false)] [System.Boolean] $ErrorReportingEnabled, + [parameter(Mandatory = $false)] [System.Boolean] $EventLogFloodProtectionEnabled, + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionNotifyInterval, + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionQuietPeriod, + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionThreshold, + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionTriggerPeriod, + [parameter(Mandatory = $false)] [System.UInt32] $LogCutInterval, + [parameter(Mandatory = $false)] [System.Boolean] $LogMaxDiskSpaceUsageEnabled, + [parameter(Mandatory = $false)] [System.UInt32] $ScriptErrorReportingDelay, + [parameter(Mandatory = $false)] [System.Boolean] $ScriptErrorReportingEnabled, + [parameter(Mandatory = $false)] [System.Boolean] $ScriptErrorReportingRequireAuth, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Setting diagnostic configuration settings" @@ -216,106 +105,32 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $LogPath, - - [parameter(Mandatory = $true)] - [System.UInt32] - $LogSpaceInGB, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AppAnalyticsAutomaticUploadEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $CustomerExperienceImprovementProgramEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $DaysToKeepLogs, - - [parameter(Mandatory = $false)] - [System.Boolean] - $DownloadErrorReportingUpdatesEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ErrorReportingAutomaticUploadEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ErrorReportingEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $EventLogFloodProtectionEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionNotifyInterval, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionQuietPeriod, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionThreshold, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EventLogFloodProtectionTriggerPeriod, - - [parameter(Mandatory = $false)] - [System.UInt32] - $LogCutInterval, - - [parameter(Mandatory = $false)] - [System.Boolean] - $LogMaxDiskSpaceUsageEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $ScriptErrorReportingDelay, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ScriptErrorReportingEnabled, - - [parameter(Mandatory = $false)] - [System.Boolean] - $ScriptErrorReportingRequireAuth, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $LogPath, + [parameter(Mandatory = $true)] [System.UInt32] $LogSpaceInGB, + [parameter(Mandatory = $false)] [System.Boolean] $AppAnalyticsAutomaticUploadEnabled, + [parameter(Mandatory = $false)] [System.Boolean] $CustomerExperienceImprovementProgramEnabled, + [parameter(Mandatory = $false)] [System.UInt32] $DaysToKeepLogs, + [parameter(Mandatory = $false)] [System.Boolean] $DownloadErrorReportingUpdatesEnabled, + [parameter(Mandatory = $false)] [System.Boolean] $ErrorReportingAutomaticUploadEnabled, + [parameter(Mandatory = $false)] [System.Boolean] $ErrorReportingEnabled, + [parameter(Mandatory = $false)] [System.Boolean] $EventLogFloodProtectionEnabled, + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionNotifyInterval, + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionQuietPeriod, + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionThreshold, + [parameter(Mandatory = $false)] [System.UInt32] $EventLogFloodProtectionTriggerPeriod, + [parameter(Mandatory = $false)] [System.UInt32] $LogCutInterval, + [parameter(Mandatory = $false)] [System.Boolean] $LogMaxDiskSpaceUsageEnabled, + [parameter(Mandatory = $false)] [System.UInt32] $ScriptErrorReportingDelay, + [parameter(Mandatory = $false)] [System.Boolean] $ScriptErrorReportingEnabled, + [parameter(Mandatory = $false)] [System.Boolean] $ScriptErrorReportingRequireAuth, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting diagnostic configuration settings" - $result = Get-TargetResource @PSBoundParameters - if ($LogPath -ne $result.LogLocation) { return $false } - if ($LogSpaceInGB -ne $result.LogDiskSpaceUsageGB) { return $false } + $CurrentValues = Get-TargetResource @PSBoundParameters - if ($AppAnalyticsAutomaticUploadEnabled -ne $result.AppAnalyticsAutomaticUploadEnabled) { return $false } - if ($CustomerExperienceImprovementProgramEnabled -ne $result.CustomerExperienceImprovementProgramEnabled) { return $false } - if ($DaysToKeepLogs -ne $result.DaysToKeepLogs) { return $false } - if ($DownloadErrorReportingUpdatesEnabled -ne $result.DownloadErrorReportingUpdatesEnabled) { return $false } - if ($ErrorReportingAutomaticUploadEnabled -ne $result.ErrorReportingAutomaticUploadEnabled) { return $false } - if ($ErrorReportingEnabled -ne $result.ErrorReportingEnabled) { return $false } - if ($EventLogFloodProtectionEnabled -ne $result.EventLogFloodProtectionEnabled) { return $false } - if ($EventLogFloodProtectionNotifyInterval -ne $result.EventLogFloodProtectionNotifyInterval) { return $false } - if ($EventLogFloodProtectionQuietPeriod -ne $result.EventLogFloodProtectionQuietPeriod) { return $false } - if ($EventLogFloodProtectionThreshold -ne $result.EventLogFloodProtectionThreshold) { return $false } - if ($EventLogFloodProtectionTriggerPeriod -ne $result.EventLogFloodProtectionTriggerPeriod) { return $false } - if ($LogCutInterval -ne $result.LogCutInterval) { return $false } - if ($LogMaxDiskSpaceUsageEnabled -ne $result.LogMaxDiskSpaceUsageEnabled) { return $false } - if ($ScriptErrorReportingDelay -ne $result.ScriptErrorReportingDelay) { return $false } - if ($ScriptErrorReportingEnabled -ne $result.ScriptErrorReportingEnabled) { return $false } - if ($ScriptErrorReportingRequireAuth -ne $result.ScriptErrorReportingRequireAuth) { return $false } - return $true + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters } diff --git a/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 index 380fc1715..775cb20b5 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 @@ -27,11 +27,6 @@ Describe "xSPDiagnosticLoggingSettings" { DaysToKeepLogs = 7 LogMaxDiskSpaceUsageEnabled = $true LogCutInterval = 30 - EventLogFloodProtectionEnabled = $true - EventLogFloodProtectionThreshold = 10 - EventLogFloodProtectionTriggerPeriod = 10 - EventLogFloodProtectionQuietPeriod = 10 - EventLogFloodProtectionNotifyInterval = 10 ScriptErrorReportingEnabled = $true ScriptErrorReportingRequireAuth = $true ScriptErrorReportingDelay = 5 @@ -60,17 +55,13 @@ Describe "xSPDiagnosticLoggingSettings" { DownloadErrorReportingUpdatesEnabled = $testParams.DownloadErrorReportingUpdatesEnabled DaysToKeepLogs = $testParams.DaysToKeepLogs LogMaxDiskSpaceUsageEnabled = $testParams.LogMaxDiskSpaceUsageEnabled - LogDiskSpaceUsageGB = $testParams.LogSpaceInGB - LogLocation = $testParams.LogPath + LogSpaceInGB = $testParams.LogSpaceInGB + LogPath = $testParams.LogPath LogCutInterval = $testParams.LogCutInterval - EventLogFloodProtectionEnabled = $testParams.EventLogFloodProtectionEnabled - EventLogFloodProtectionThreshold = $testParams.EventLogFloodProtectionThreshold - EventLogFloodProtectionTriggerPeriod = $testParams.EventLogFloodProtectionTriggerPeriod - EventLogFloodProtectionQuietPeriod = $testParams.EventLogFloodProtectionQuietPeriod - EventLogFloodProtectionNotifyInterval = $testParams.EventLogFloodProtectionNotifyInterval ScriptErrorReportingEnabled = $testParams.ScriptErrorReportingEnabled ScriptErrorReportingRequireAuth = $testParams.ScriptErrorReportingRequireAuth ScriptErrorReportingDelay = $testParams.ScriptErrorReportingDelay + InstallAccount = $null } } Test-TargetResource @testParams | Should Be $true @@ -85,8 +76,8 @@ Describe "xSPDiagnosticLoggingSettings" { DownloadErrorReportingUpdatesEnabled = $testParams.DownloadErrorReportingUpdatesEnabled DaysToKeepLogs = $testParams.DaysToKeepLogs LogMaxDiskSpaceUsageEnabled = $testParams.LogMaxDiskSpaceUsageEnabled - LogDiskSpaceUsageGB = $testParams.LogSpaceInGB - LogLocation = "C:\logs" + LogSpaceInGB = $testParams.LogSpaceInGB + LogPath = "C:\logs" LogCutInterval = $testParams.LogCutInterval EventLogFloodProtectionEnabled = $testParams.EventLogFloodProtectionEnabled EventLogFloodProtectionThreshold = $testParams.EventLogFloodProtectionThreshold @@ -110,8 +101,8 @@ Describe "xSPDiagnosticLoggingSettings" { DownloadErrorReportingUpdatesEnabled = $testParams.DownloadErrorReportingUpdatesEnabled DaysToKeepLogs = $testParams.DaysToKeepLogs LogMaxDiskSpaceUsageEnabled = $testParams.LogMaxDiskSpaceUsageEnabled - LogDiskSpaceUsageGB = 1 - LogLocation = $testParams.LogPath + LogSpaceInGB = 1 + LogPath = $testParams.LogPath LogCutInterval = $testParams.LogCutInterval EventLogFloodProtectionEnabled = $testParams.EventLogFloodProtectionEnabled EventLogFloodProtectionThreshold = $testParams.EventLogFloodProtectionThreshold From 6ff58e4128d1216fc2476c93830446ce9b1a1ebb Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 19:18:59 +1000 Subject: [PATCH 041/146] Updated get method for xSPDistributedCacheService --- .../MSFT_xSPDistributedCacheService.psm1 | 144 ++++++------------ ...Point.xSPDistributedCacheService.Tests.ps1 | 35 +++-- 2 files changed, 71 insertions(+), 108 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index e2ae57b3e..3ebee75ce 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -4,35 +4,18 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.UInt32] - $CacheSizeInMB, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.Boolean] - $CreateFirewallRules + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.UInt32] $CacheSizeInMB, + [parameter(Mandatory = $true)] [System.String] $ServiceAccount, + [parameter(Mandatory = $true)] [System.Boolean] $CreateFirewallRules, + [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting the cache host information" - $result = Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + $params = $args[0] try { Invoke-xSharePointDCCmdlet -CmdletName "Use-CacheCluster" -ErrorAction SilentlyContinue @@ -43,19 +26,33 @@ function Get-TargetResource ComputerName = $computerName CachePort = $cacheHost.PortNo } -ErrorAction SilentlyContinue - if ($null -eq $cacheHostConfig) { return @{} } - + if ($null -eq $cacheHostConfig) { return @{ + Name = $params.Name + Ensure = "Absent" + InstallAccount = $params.InstallAccount + } } + + $windowsService = Get-WmiObject "win32_service" -Filter "Name='AppFabricCachingService'" + $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distributed Cache" -ErrorAction SilentlyContinue + return @{ - HostName = $computerName - Port = $cacheHost.PortNo + Name = $params.Name CacheSizeInMB = $cacheHostConfig.Size + ServiceAccount = $windowsService.StartName + CreateFirewallRules = (-not $firewallRule) + Ensure = "Present" + InstallAccount = $params.InstallAccount } } catch{ - return @{} + return @{ + Name = $params.Name + Ensure = "Absent" + InstallAccount = $params.InstallAccount + } } } - $result + return $result } @@ -64,32 +61,16 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.UInt32] - $CacheSizeInMB, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.Boolean] - $CreateFirewallRules + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.UInt32] $CacheSizeInMB, + [parameter(Mandatory = $true)] [System.String] $ServiceAccount, + [parameter(Mandatory = $true)] [System.Boolean] $CreateFirewallRules, + [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) + $CurrentState = Get-TargetResource @PSBoundParameters + if ($Ensure -eq "Present") { Write-Verbose -Message "Adding the distributed cache to the server" if($createFirewallRules) { @@ -100,9 +81,11 @@ function Set-TargetResource } Write-Verbose -Message "Firewall rule added" } - Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - $params = $args[0] - Add-xSharePointDistributedCacheServer -CacheSizeInMB $params.CacheSizeInMB -ServiceAccount $params.ServiceAccount + if ($CurrentState.Ensure -ne $Ensure) { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + $params = $args[0] + Add-xSharePointDistributedCacheServer -CacheSizeInMB $params.CacheSizeInMB -ServiceAccount $params.ServiceAccount + } } } else { Write-Verbose -Message "Removing distributed cache to the server" @@ -123,44 +106,17 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.UInt32] - $CacheSizeInMB, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.Boolean] - $createFirewallRules + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.UInt32] $CacheSizeInMB, + [parameter(Mandatory = $true)] [System.String] $ServiceAccount, + [parameter(Mandatory = $true)] [System.Boolean] $CreateFirewallRules, + [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource @PSBoundParameters - - if ($Ensure -eq "Present") { - if ($result.Count -eq 0) { return $false } - else { - if ($result.CacheSizeInMB -ne $CacheSizeInMB) { return $false } - } - return $true - } else { - if ($result.Count -eq 0) { return $true } - return $false - } + $CurrentValues = Get-TargetResource @PSBoundParameters + Write-Verbose -Message "Testing for distributed cache configuration" + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("CacheSizeInMB", "Ensure", "CreateFirewallRules") } diff --git a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 index 27f880cc3..668432a07 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 @@ -37,12 +37,11 @@ Describe "xSPDistributedCacheService" { Size = $testParams.CacheSizeInMB } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-AFCacheHostConfiguration" } + Mock Get-WmiObject { @{ StartName = $testParams.ServiceAccount.UserName } } -Verifiable + Mock Get-NetFirewallRule { @{} } -Verifiable + $result = Get-TargetResource @testParams - $result.HostName | Should Be ([System.Net.Dns]::GetHostByName($env:computerName)).HostName - $result.Port | Should Be 22233 - $result.CacheSizeInMB | Should Be $testParams.CacheSizeInMB - Assert-VerifiableMocks } @@ -65,9 +64,10 @@ Describe "xSPDistributedCacheService" { It "Passes when cache is present and size is correct" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ - HostName = $env:COMPUTERNAME - Port = 22233 CacheSizeInMB = $testParams.CacheSizeInMB + ServiceAccount = $testParams.ServiceAccount.UserName + CreateFirewallRules = $testParams.CreateFirewallRules + Ensure = "Present" } } Test-TargetResource @testParams | Should Be $true @@ -75,10 +75,11 @@ Describe "xSPDistributedCacheService" { It "Fails when cache is present but size is not correct" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ - HostName = $env:COMPUTERNAME - Port = 22233 CacheSizeInMB = 1 - } + ServiceAccount = $testParams.ServiceAccount.UserName + CreateFirewallRules = $testParams.CreateFirewallRules + Ensure = "Present" + } } Test-TargetResource @testParams | Should Be $false } @@ -88,16 +89,22 @@ Describe "xSPDistributedCacheService" { It "Fails when cache is present but not should be" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ - HostName = $env:COMPUTERNAME - Port = 22233 - CacheSizeInMB = 1 - } + CacheSizeInMB = $testParams.CacheSizeInMB + ServiceAccount = $testParams.ServiceAccount.UserName + CreateFirewallRules = $testParams.CreateFirewallRules + Ensure = "Present" + } } Test-TargetResource @testParams | Should Be $false } It "Passes when cache is not present and should not be" { Mock -ModuleName $ModuleName Get-TargetResource { - return @{ } + return @{ + CacheSizeInMB = $testParams.CacheSizeInMB + ServiceAccount = $testParams.ServiceAccount.UserName + CreateFirewallRules = $testParams.CreateFirewallRules + Ensure = "Absent" + } } Test-TargetResource @testParams | Should Be $true } From 1ef78ef62299a6918737ddc9b93ad44b7876405c Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 19:38:28 +1000 Subject: [PATCH 042/146] Updated get method for xSPFeature --- .../MSFT_xSPFeature/MSFT_xSPFeature.psm1 | 27 ++++++------ .../xSharePoint.xSPFeature.Tests.ps1 | 44 +++++-------------- 2 files changed, 26 insertions(+), 45 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 index 79740efbd..0c9e1c34d 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 @@ -34,7 +34,13 @@ function Get-TargetResource $feature = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFeature" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue - if ($null -eq $feature) { return @{} } + if ($null -eq $feature) { return @{ + Name = $params.Name + FeatureScope = $params.FeatureScope + Url = $params.Url + InstalAcount = $params.InstallAccount + Ensure = "Absent" + } } $checkParams = @{} $checkParams.Add("Identity", $params.Name) @@ -45,12 +51,14 @@ function Get-TargetResource } $featureAtScope = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFeature" -Arguments $checkParams -ErrorAction SilentlyContinue $enabled = ($null -ne $featureAtScope) + if ($enabled) { $currentState = "Present" } else { $currentState = "Absent" } return @{ Name = $params.Name - Id = $feature.Id - Version = $feature.Version - Enabled = $enabled + FeatureScope = $params.FeatureScope + Url = $params.Url + InstalAcount = $params.InstallAccount + Ensure = $currentState } } return $result @@ -133,15 +141,8 @@ function Test-TargetResource $Ensure ) - $result = Get-TargetResource @PSBoundParameters + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for feature $Name at $FeatureScope scope" - - if ($result.Count -eq 0) { - throw "Unable to locate feature '$Name' in the current SharePoint farm, check that the name is correct and that the feature has been deployed to the file system." - } else { - if ($Ensure -eq "Present" -and $result.Enabled -eq $false) { return $false } - if ($Ensure -eq "Absent" -and $result.Enabled -eq $true) { return $false } - } - return $true + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("Ensure") } Export-ModuleMember -Function *-TargetResource diff --git a/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 index 826569e6b..ce4a166b3 100644 --- a/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 @@ -37,7 +37,7 @@ Describe "xSPFeature" { $result = Get-TargetResource @testParams - $result.Enabled | Should be $false + $result.Ensure | Should be "Absent" Assert-VerifiableMocks } @@ -48,7 +48,7 @@ Describe "xSPFeature" { $result = Get-TargetResource @testParams - $result.Enabled | Should be $false + $result.Ensure | Should be "Absent" Assert-VerifiableMocks } @@ -58,7 +58,7 @@ Describe "xSPFeature" { $result = Get-TargetResource @testParams - $result.Enabled | Should be $true + $result.Ensure | Should be "Present" Assert-VerifiableMocks } @@ -69,24 +69,18 @@ Describe "xSPFeature" { $result = Get-TargetResource @testParams - $result.Enabled | Should be $true + $result.Ensure | Should be "Present" Assert-VerifiableMocks } } Context "Validate test method" { - It "Throws when a feature is not installed in the farm" { - Mock -ModuleName $ModuleName Get-TargetResource { return @{} } - { Test-TargetResource @testParams } | Should Throw "Unable to locate feature" - } It "Passes when a farm feature is enabaled and should be" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ Name = $testParams.Name - Id = [Guid]::NewGuid() - Version = "1.0" - Enabled = $true + Ensure = "Present" } } Test-TargetResource @testParams | Should Be $true @@ -95,9 +89,7 @@ Describe "xSPFeature" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ Name = $testParams.Name - Id = [Guid]::NewGuid() - Version = "1.0" - Enabled = $false + Ensure = "Absent" } } Test-TargetResource @testParams | Should Be $false @@ -109,9 +101,7 @@ Describe "xSPFeature" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ Name = $testParams.Name - Id = [Guid]::NewGuid() - Version = "1.0" - Enabled = $false + Ensure = "Absent" } } Test-TargetResource @testParams | Should Be $true @@ -120,9 +110,7 @@ Describe "xSPFeature" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ Name = $testParams.Name - Id = [Guid]::NewGuid() - Version = "1.0" - Enabled = $true + Ensure = "Present" } } Test-TargetResource @testParams | Should Be $false @@ -135,9 +123,7 @@ Describe "xSPFeature" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ Name = $testParams.Name - Id = [Guid]::NewGuid() - Version = "1.0" - Enabled = $true + Ensure = "Present" } } Test-TargetResource @testParams | Should Be $true @@ -146,9 +132,7 @@ Describe "xSPFeature" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ Name = $testParams.Name - Id = [Guid]::NewGuid() - Version = "1.0" - Enabled = $false + Ensure = "Absent" } } Test-TargetResource @testParams | Should Be $false @@ -160,9 +144,7 @@ Describe "xSPFeature" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ Name = $testParams.Name - Id = [Guid]::NewGuid() - Version = "1.0" - Enabled = $false + Ensure = "Absent" } } Test-TargetResource @testParams | Should Be $true @@ -171,9 +153,7 @@ Describe "xSPFeature" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ Name = $testParams.Name - Id = [Guid]::NewGuid() - Version = "1.0" - Enabled = $true + Ensure = "Present" } } Test-TargetResource @testParams | Should Be $false From ad672541cad6d069cf669fb55042712d546dfb82 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 19:52:01 +1000 Subject: [PATCH 043/146] Updated get method for xSPJoinFarm module --- .../MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 | 77 ++++++------------- .../xSharePoint.xSPJoinFarm.Tests.ps1 | 3 +- 2 files changed, 25 insertions(+), 55 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 index fb21af151..f331e358b 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 @@ -4,26 +4,16 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $FarmConfigDatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.String] - $Passphrase + [parameter(Mandatory = $true)] [System.String] $FarmConfigDatabaseName, + [parameter(Mandatory = $true)] [System.String] $DatabaseServer, + [parameter(Mandatory = $true)] [System.String] $Passphrase, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Checking for local SP Farm" - $result = Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + $params = $args[0] try { $spFarm = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFarm" -ErrorAction SilentlyContinue } catch { @@ -32,10 +22,14 @@ function Get-TargetResource if ($null -eq $spFarm) {return @{ }} - $returnValue = @{ - FarmName = $spFarm.Name + $configDb = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPDatabase" -Arguments @{ IncludeCentralAdministration = $true } | Where-Object { $_.Name -eq $spFarm.Name -and $_.Type -eq "Configuration Database" } + + return @{ + FarmConfigDatabaseName = $spFarm.Name + DatabaseServer = $configDb.Server.Name + InstallAccount = $params.InstallAccount + Passphrase = $params.Passphrase } - return $returnValue } return $result } @@ -46,21 +40,10 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $FarmConfigDatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.String] - $Passphrase + [parameter(Mandatory = $true)] [System.String] $FarmConfigDatabaseName, + [parameter(Mandatory = $true)] [System.String] $DatabaseServer, + [parameter(Mandatory = $true)] [System.String] $Passphrase, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Joining existing farm configuration database" @@ -114,27 +97,15 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $FarmConfigDatabaseName, - - [parameter(Mandatory = $true)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.String] - $Passphrase + [parameter(Mandatory = $true)] [System.String] $FarmConfigDatabaseName, + [parameter(Mandatory = $true)] [System.String] $DatabaseServer, + [parameter(Mandatory = $true)] [System.String] $Passphrase, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource @PSBoundParameters - - if ($result.Count -eq 0) { return $false } - return $true + $CurrentValues = Get-TargetResource @PSBoundParameters + Write-Verbose "Checking for local farm presence" + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("FarmConfigDatabaseName") } diff --git a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 index b5b00ac27..2600e602c 100644 --- a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 @@ -26,7 +26,6 @@ Describe "xSPJoinFarm" { It "Calls SP Farm to find the local environment settings" { Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter {$CmdletName -eq "Get-SPFarm"} $results = Get-TargetResource @testParams - $results.Count | Should Be 0 Assert-VerifiableMocks } } @@ -39,7 +38,7 @@ Describe "xSPJoinFarm" { It "Passes when local server is in a farm" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ - FarmName = "SP_Config" + FarmConfigDatabaseName = "SP_Config" } } Test-TargetResource @testParams | Should Be $true From 555cfa29b800e1f75a17521f060a26dbe9f335f7 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 19:54:55 +1000 Subject: [PATCH 044/146] Formatted parameter list --- .../MSFT_xSPFeature/MSFT_xSPFeature.psm1 | 78 ++++--------------- 1 file changed, 15 insertions(+), 63 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 index 0c9e1c34d..270e98904 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 @@ -4,27 +4,11 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [ValidateSet("Farm","WebApplication","Site","Web")] - [System.String] - $FeatureScope, - - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $Url, + [parameter(Mandatory = $true)] [ValidateSet("Farm","WebApplication","Site","Web")] [System.String] $FeatureScope, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure ) Write-Verbose -Message "Getting feature $Name at $FeatureScope scope" @@ -70,27 +54,11 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [ValidateSet("Farm","WebApplication","Site","Web")] - [System.String] - $FeatureScope, - - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $Url, + [parameter(Mandatory = $true)] [ValidateSet("Farm","WebApplication","Site","Web")] [System.String] $FeatureScope, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure ) $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { @@ -118,27 +86,11 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [ValidateSet("Farm","WebApplication","Site","Web")] - [System.String] - $FeatureScope, - - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $Url, + [parameter(Mandatory = $true)] [ValidateSet("Farm","WebApplication","Site","Web")] [System.String] $FeatureScope, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure ) $CurrentValues = Get-TargetResource @PSBoundParameters From 1ad5ede7f501d631cb28b844c8e2e1a2cb210a02 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 20:20:16 +1000 Subject: [PATCH 045/146] Updated get method for xSPFeature --- .../MSFT_xSPFeature/MSFT_xSPFeature.psm1 | 6 +- .../MSFT_xSPManagedAccount.psm1 | 108 ++++-------------- .../xSharePoint.xSPManagedAccount.Tests.ps1 | 24 ++-- 3 files changed, 38 insertions(+), 100 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 index 270e98904..19216abd2 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 @@ -5,7 +5,7 @@ function Get-TargetResource param ( [parameter(Mandatory = $true)] [System.String] $Name, - [parameter(Mandatory = $true)] [System.String] $Url, + [parameter(Mandatory = $true)] [System.String] $Url, [parameter(Mandatory = $true)] [ValidateSet("Farm","WebApplication","Site","Web")] [System.String] $FeatureScope, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure @@ -55,7 +55,7 @@ function Set-TargetResource param ( [parameter(Mandatory = $true)] [System.String] $Name, - [parameter(Mandatory = $true)] [System.String] $Url, + [parameter(Mandatory = $true)] [System.String] $Url, [parameter(Mandatory = $true)] [ValidateSet("Farm","WebApplication","Site","Web")] [System.String] $FeatureScope, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure @@ -87,7 +87,7 @@ function Test-TargetResource param ( [parameter(Mandatory = $true)] [System.String] $Name, - [parameter(Mandatory = $true)] [System.String] $Url, + [parameter(Mandatory = $true)] [System.String] $Url, [parameter(Mandatory = $true)] [ValidateSet("Farm","WebApplication","Site","Web")] [System.String] $FeatureScope, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 index e499c772d..72491d946 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 @@ -4,29 +4,12 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $Account, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EmailNotification, - - [parameter(Mandatory = $false)] - [System.UInt32] - $PreExpireDays, - - [parameter(Mandatory = $false)] - [System.String] - $Schedule, - - [parameter(Mandatory = $true)] - [System.String] - $AccountName + [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $Account, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $false)] [System.UInt32] $EmailNotification, + [parameter(Mandatory = $false)] [System.UInt32] $PreExpireDays, + [parameter(Mandatory = $false)] [System.String] $Schedule, + [parameter(Mandatory = $true)] [System.String] $AccountName ) Write-Verbose -Message "Checking for managed account $AccountName" @@ -39,10 +22,11 @@ function Get-TargetResource if ($null -eq $ma) { return @{ } } return @{ AccountName = $ma.Userame - AutomaticChange = $ma.AutomaticChange - DaysBeforeChangeToEmail = $ma.DaysBeforeChangeToEmail - DaysBeforeExpiryToChange = $ma.DaysBeforeExpiryToChange - ChangeSchedule = $ma.ChangeSchedule + EmailNotification = $ma.DaysBeforeChangeToEmail + PreExpireDays = $ma.DaysBeforeExpiryToChange + Schedule = $ma.ChangeSchedule + Account = $params.Account + InstallAccount = $params.InstallAccount } } catch { return @{ } @@ -56,29 +40,12 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $Account, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EmailNotification, - - [parameter(Mandatory = $false)] - [System.UInt32] - $PreExpireDays, - - [parameter(Mandatory = $false)] - [System.String] - $Schedule, - - [parameter(Mandatory = $true)] - [System.String] - $AccountName + [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $Account, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $false)] [System.UInt32] $EmailNotification, + [parameter(Mandatory = $false)] [System.UInt32] $PreExpireDays, + [parameter(Mandatory = $false)] [System.String] $Schedule, + [parameter(Mandatory = $true)] [System.String] $AccountName ) Write-Verbose -Message "Setting managed account $AccountName" @@ -109,42 +76,17 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $Account, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [System.UInt32] - $EmailNotification, - - [parameter(Mandatory = $false)] - [System.UInt32] - $PreExpireDays, - - [parameter(Mandatory = $false)] - [System.String] - $Schedule, - - [parameter(Mandatory = $true)] - [System.String] - $AccountName + [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $Account, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $false)] [System.UInt32] $EmailNotification, + [parameter(Mandatory = $false)] [System.UInt32] $PreExpireDays, + [parameter(Mandatory = $false)] [System.String] $Schedule, + [parameter(Mandatory = $true)] [System.String] $AccountName ) - $result = Get-TargetResource @PSBoundParameters + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing managed account $AccountName" - if ($result.Count -eq 0) { return $false } - else { - if($result.AutomaticChange -eq $true) { - if($result.ChangeSchedule -ne $Schedule) { return $false } - if($result.DaysBeforeExpiryToChange -ne $PreExpireDays) { return $false } - if($result.DaysBeforeChangeToEmail -ne $EmailNotification) { return $false } - } - } - return $true + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("Schedule","PreExpireDays","EmailNotification") } diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 index 42f4d2dd0..350029685 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 @@ -30,7 +30,6 @@ Describe "xSPManagedAccount" { Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPManagedAccount" -and $Arguments.Identity -eq $testParams.Account.UserName } $results = Get-TargetResource @testParams - $results.Count | Should Be 0 Assert-VerifiableMocks } @@ -45,10 +44,9 @@ Describe "xSPManagedAccount" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ AccountName = $testParams.AccountName - AutomaticChange = $false - DaysBeforeChangeToEmail = $testParams.EmailNotification - DaysBeforeExpiryToChange = $testParams.PreExpireDays - ChangeSchedule = $testParams.Schedule + EmailNotification = $testParams.EmailNotification + PreExpireDays = $testParams.PreExpireDays + Schedule = $testParams.Schedule } } Test-TargetResource @testParams | Should Be $true @@ -57,10 +55,9 @@ Describe "xSPManagedAccount" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ AccountName = $testParams.AccountName - AutomaticChange = $true - DaysBeforeChangeToEmail = $testParams.EmailNotification - DaysBeforeExpiryToChange = $testParams.PreExpireDays - ChangeSchedule = "Weekly Friday between 01:00 and 02:00" + EmailNotification = $testParams.EmailNotification + PreExpireDays = $testParams.PreExpireDays + Schedule = "Weekly Friday between 01:00 and 02:00" } } Test-TargetResource @testParams | Should Be $false @@ -69,10 +66,9 @@ Describe "xSPManagedAccount" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ AccountName = $testParams.AccountName - AutomaticChange = $true - DaysBeforeChangeToEmail = 0 - DaysBeforeExpiryToChange = 0 - ChangeSchedule = $testParams.Schedule + EmailNotification = 0 + PreExpireDays = 0 + Schedule = $testParams.Schedule } } Test-TargetResource @testParams | Should Be $false @@ -92,7 +88,7 @@ Describe "xSPManagedAccount" { It "Modifies an existing account where it already exists" { Mock Get-TargetResource { return @{} AccountName = $testParams.Account.UserName - ChangeSchedule = $testParams.Schedule + Schedule = $testParams.Schedule } Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPManagedAccount" } From 60108a3ad886d00e4aac22aaad44b33b9048205f Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 20:40:39 +1000 Subject: [PATCH 046/146] Updated get method in xSPManagedMetaDataServiceApp --- .../MSFT_xSPManagedMetaDataServiceApp.psm1 | 86 +++++-------------- 1 file changed, 20 insertions(+), 66 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 index 5db30c1a6..f43e09460 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 @@ -4,32 +4,17 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ApplicationPool, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting managed metadata service application $Name" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - try { $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName MMS @@ -43,6 +28,9 @@ function Get-TargetResource return @{ Name = $serviceApp.DisplayName ApplicationPool = $serviceApp.ApplicationPool.Name + DatabaseName = $serviceApp.Database.Name + DatabaseServer = $serviceApp.Database.Server.Name + InstallAccount = $params.InstallAccount } } } @@ -60,25 +48,11 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ApplicationPool, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) $result = Get-TargetResource @PSBoundParameters @@ -127,36 +101,16 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ApplicationPool, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource @PSBoundParameters - + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for Managed Metadata Service Application '$Name'" - if ($result.Count -eq 0) { return $false } - else { - if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) { return $false } - } - return $true - + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("ApplicationPool") } From 182e1acb6108d10f92d4f84ac123d7e06d48bccd Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 21:10:40 +1000 Subject: [PATCH 047/146] Updated get method of xSPManagedPath resource --- .../MSFT_xSPManagedPath.psm1 | 92 +++++-------------- .../xSharePoint.xSPManagedPath.Tests.ps1 | 12 ++- 2 files changed, 30 insertions(+), 74 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 index a7ecc7ff8..c7312d2bb 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 @@ -4,25 +4,11 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.String] - $RelativeUrl, - - [parameter(Mandatory = $true)] - [System.Boolean] - $Explicit, - - [parameter(Mandatory = $true)] - [System.Boolean] - $HostHeader + [parameter(Mandatory = $true)] [System.String] $WebAppUrl, + [parameter(Mandatory = $true)] [System.String] $RelativeUrl, + [parameter(Mandatory = $true)] [System.Boolean] $Explicit, + [parameter(Mandatory = $true)] [System.Boolean] $HostHeader, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Looking up the managed path $RelativeUrl in $WebAppUrl" @@ -39,8 +25,11 @@ function Get-TargetResource if ($null -eq $path) { return @{} } return @{ - Name = $path.Name - PathType = $path.Type + RelativeUrl = $path.Name + Explicit = ($path.Type -eq "ExplicitInclusion") + WebAppUrl = $params.WebAppUrl + HostHeader = $params.HostHeader + InstallAccount = $params.InstallAccount } } return $result @@ -52,25 +41,11 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.String] - $RelativeUrl, - - [parameter(Mandatory = $true)] - [System.Boolean] - $Explicit, - - [parameter(Mandatory = $true)] - [System.Boolean] - $HostHeader + [parameter(Mandatory = $true)] [System.String] $WebAppUrl, + [parameter(Mandatory = $true)] [System.String] $RelativeUrl, + [parameter(Mandatory = $true)] [System.Boolean] $Explicit, + [parameter(Mandatory = $true)] [System.Boolean] $HostHeader, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Creating the managed path $RelativeUrl in $WebAppUrl" @@ -103,39 +78,16 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $WebAppUrl, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [System.String] - $RelativeUrl, - - [parameter(Mandatory = $true)] - [System.Boolean] - $Explicit, - - [parameter(Mandatory = $true)] - [System.Boolean] - $HostHeader + [parameter(Mandatory = $true)] [System.String] $WebAppUrl, + [parameter(Mandatory = $true)] [System.String] $RelativeUrl, + [parameter(Mandatory = $true)] [System.Boolean] $Explicit, + [parameter(Mandatory = $true)] [System.Boolean] $HostHeader, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource @PSBoundParameters + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Looking up the managed path $RelativeUrl in $WebAppUrl" - if ($result.Count -eq 0) { return $false } - else { - if ($Explicit) { - if ($result.PathType -ne "ExplicitInclusion") { return $false } - } - else { - if ($result.PathType -ne "WildcardInclusion") { return $false } - } - } - return $true + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("WebAppUrl","RelativeUrl","Explicit","HostHeader") } diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 index 2006f5b35..a73f3f4bc 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 @@ -39,8 +39,10 @@ Describe "xSPManagedPath" { It "Passes when the path is found and is the correct type" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ - Name = $testParams.RelativeUrl - PathType = "WildcardInclusion" + RelativeUrl = $testParams.RelativeUrl + Explicit = $testParams.Explicit + HostHeader = $testParams.HostHeader + WebAppUrl = $testParams.WebAppUrl } } Test-TargetResource @testParams | Should Be $true @@ -48,8 +50,10 @@ Describe "xSPManagedPath" { It "Fails when the path is found and is not the correct type" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ - Name = $testParams.RelativeUrl - PathType = "ExplicitInclusion" + RelativeUrl = $testParams.RelativeUrl + Explicit = (-not $testParams.Explicit) + HostHeader = $testParams.HostHeader + WebAppUrl = $testParams.WebAppUrl } } Test-TargetResource @testParams | Should Be $false From 1fe19fea60d5f7f7cd47ea95ccdbbe842326ced3 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 21:31:27 +1000 Subject: [PATCH 048/146] Updated get method for xSPSearchServivceApp --- .../MSFT_xSPSearchServiceApp.psm1 | 84 +++++-------------- 1 file changed, 20 insertions(+), 64 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 index 9cb559df7..04a63ca48 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 @@ -4,25 +4,11 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ApplicationPool, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting Search service application '$Name'" @@ -41,6 +27,9 @@ function Get-TargetResource return @{ Name = $serviceApp.DisplayName ApplicationPool = $serviceApp.ApplicationPool.Name + DatabaseName = $serviceApp.Database.Name + DatabaseServer = $serviceApp.Database.Server.Name + InstallAccount = $params.InstallAccount } } } @@ -53,25 +42,11 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ApplicationPool, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) $result = Get-TargetResource @PSBoundParameters @@ -116,35 +91,16 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ApplicationPool, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource @PSBoundParameters + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing Search service application '$Name'" - - if ($result.Count -eq 0) { return $false } - else { - if ($ApplicationPool -ne $result.ApplicationPool) { return $false } - } - return $true + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("ApplicationPool") } Export-ModuleMember -Function *-TargetResource From b0cf7fa83eba8af73b3dd23259242d5cb2db3df7 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 22:27:08 +1000 Subject: [PATCH 049/146] Fixed get method for xSPSecureStoreServiceApp --- .../MSFT_xSPSecureStoreServiceApp.psm1 | 203 ++++-------------- 1 file changed, 44 insertions(+), 159 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 index ade2522b2..66c43cf81 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 @@ -4,57 +4,19 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.Boolean] - $AuditingEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $AuditlogMaxSize, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabasePassword, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseUsername, - - [parameter(Mandatory = $false)] - [System.String] - $FailoverDatabaseServer, - - [parameter(Mandatory = $false)] - [System.Boolean] - $PartitionMode, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Sharing, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ApplicationPool, + [parameter(Mandatory = $true)] [System.Boolean] $AuditingEnabled, + [parameter(Mandatory = $false)] [System.UInt32] $AuditlogMaxSize, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.String] $DatabasePassword, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] $DatabaseUsername, + [parameter(Mandatory = $false)] [System.String] $FailoverDatabaseServer, + [parameter(Mandatory = $false)] [System.Boolean] $PartitionMode, + [parameter(Mandatory = $false)] [System.Boolean] $Sharing, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting secure store service application '$Name'" @@ -73,6 +35,9 @@ function Get-TargetResource return @{ Name = $serviceApp.DisplayName ApplicationPool = $serviceApp.ApplicationPool.Name + DatabaseName = $serviceApp.Database.Name + DatabaseServer = $serviceApp.Database.Server.Name + InstallAccount = $params.InstallAccount } } } @@ -85,57 +50,19 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.Boolean] - $AuditingEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $AuditlogMaxSize, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabasePassword, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseUsername, - - [parameter(Mandatory = $false)] - [System.String] - $FailoverDatabaseServer, - - [parameter(Mandatory = $false)] - [System.Boolean] - $PartitionMode, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Sharing, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ApplicationPool, + [parameter(Mandatory = $true)] [System.Boolean] $AuditingEnabled, + [parameter(Mandatory = $false)] [System.UInt32] $AuditlogMaxSize, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.String] $DatabasePassword, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] $DatabaseUsername, + [parameter(Mandatory = $false)] [System.String] $FailoverDatabaseServer, + [parameter(Mandatory = $false)] [System.Boolean] $PartitionMode, + [parameter(Mandatory = $false)] [System.Boolean] $Sharing, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) $result = Get-TargetResource @PSBoundParameters @@ -177,66 +104,24 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.Boolean] - $AuditingEnabled, - - [parameter(Mandatory = $false)] - [System.UInt32] - $AuditlogMaxSize, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabasePassword, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseUsername, - - [parameter(Mandatory = $false)] - [System.String] - $FailoverDatabaseServer, - - [parameter(Mandatory = $false)] - [System.Boolean] - $PartitionMode, - - [parameter(Mandatory = $false)] - [System.Boolean] - $Sharing, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ApplicationPool, + [parameter(Mandatory = $true)] [System.Boolean] $AuditingEnabled, + [parameter(Mandatory = $false)] [System.UInt32] $AuditlogMaxSize, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.String] $DatabasePassword, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] $DatabaseUsername, + [parameter(Mandatory = $false)] [System.String] $FailoverDatabaseServer, + [parameter(Mandatory = $false)] [System.Boolean] $PartitionMode, + [parameter(Mandatory = $false)] [System.Boolean] $Sharing, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource @PSBoundParameters + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing secure store service application $Name" - if ($result.Count -eq 0) { return $false } - else { - if ($ApplicationPool -ne $result.ApplicationPool) { return $false } - } - return $true + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("ApplicationPool") } From bb94cab9b1636a468e8b99ea4ddf35370891f878 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 22:38:02 +1000 Subject: [PATCH 050/146] Fixed get method for xSPServiceAppPool --- .../MSFT_xSPServiceAppPool.psm1 | 53 +++++-------------- .../xSharePoint.xSPServiceAppPool.Tests.ps1 | 4 +- 2 files changed, 15 insertions(+), 42 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 index a6be54868..6144d43ff 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 @@ -4,17 +4,9 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ServiceAccount, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting service application pool '$Name'" @@ -27,7 +19,8 @@ function Get-TargetResource return @{ Name = $sap.Name - ProcessAccountName = $sap.ProcessAccountName + ServiceAccount = $sap.ProcessAccountName + InstallAccount = $params.InstallAccount } } return $result @@ -39,17 +32,9 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ServiceAccount, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Creating service application pool '$Name'" @@ -81,26 +66,14 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ServiceAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ServiceAccount, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource @PSBoundParameters + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing service application pool '$Name'" - if ($result.Count -eq 0) { return $false } - else { - if ($ServiceAccount -ne $result.ProcessAccountName) { return $false } - } - return $true + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("ServiceAccount") } diff --git a/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 index 2a7a61138..e15a63fd9 100644 --- a/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 @@ -38,7 +38,7 @@ Describe "xSPServiceAppPool" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ Name = $testParams.Name - ProcessAccountName = $testParams.ServiceAccount + ServiceAccount = $testParams.ServiceAccount } } Test-TargetResource @testParams | Should Be $true @@ -47,7 +47,7 @@ Describe "xSPServiceAppPool" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ Name = $testParams.Name - ProcessAccountName = "Wrong account name" + ServiceAccount = "Wrong account name" } } Test-TargetResource @testParams | Should Be $false From 96e43a6007a68cb38646ce4e0b5dd20259bf6dde Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 22:56:49 +1000 Subject: [PATCH 051/146] Fixed get method of xSPServiceInstance --- .../MSFT_xSPServiceInstance.psm1 | 64 +++++-------------- .../xSharePoint.xSPServiceInstance.Tests.ps1 | 8 +-- 2 files changed, 19 insertions(+), 53 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 index afb70bb9e..0ac188d47 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 @@ -4,18 +4,9 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure ) Write-Verbose -Message "Getting service instance '$Name'" @@ -25,13 +16,15 @@ function Get-TargetResource $si = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Server = $env:COMPUTERNAME } | Where-Object { $_.TypeName -eq $params.Name } if ($null -eq $si) { return @{} } + if ($si.Status) { $localEnsure = "Present" } else { $localEnsure = "Absent" } return @{ Name = $params.Name - Status = $si.Status + Ensure = $localEnsure + InstallAccount = $params.InstallAccount } } - $result + return $result } @@ -40,18 +33,9 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure ) if ($Ensure -eq "Present") { @@ -84,32 +68,14 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure ) - $result = Get-TargetResource @PSBoundParameters + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Getting service instance '$Name'" - if ($result.Count -eq 0) { return $false } - else { - if ($Ensure -eq "Present" -and $result.Status -eq "Disabled") { - return $false - } - if ($Ensure -eq "Absent" -and $result.Status -eq "Online") { - return $false - } - } - return $true + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("Name", "Ensure") } diff --git a/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 index ecd03de99..612c9b64b 100644 --- a/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 @@ -38,7 +38,7 @@ Describe "xSPServiceInstance" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ Name = $testParams.Name - Status = "Online" + Ensure = "Present" } } Test-TargetResource @testParams | Should Be $true @@ -47,7 +47,7 @@ Describe "xSPServiceInstance" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ Name = $testParams.Name - Status = "Disabled" + Ensure = "Absent" } } Test-TargetResource @testParams | Should Be $false @@ -59,7 +59,7 @@ Describe "xSPServiceInstance" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ Name = $testParams.Name - Status = "Online" + Ensure = "Present" } } Test-TargetResource @testParams | Should Be $false @@ -68,7 +68,7 @@ Describe "xSPServiceInstance" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ Name = $testParams.Name - Status = "Disabled" + Ensure = "Absent" } } Test-TargetResource @testParams | Should Be $true From 6b0eaf2a180f3893ff9c644f3d6e30d33c409dbe Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 14 Sep 2015 23:50:00 +1000 Subject: [PATCH 052/146] Fixed get method in xSPSite --- .../MSFT_xSPSite/MSFT_xSPSite.psm1 | 255 ++++++------------ .../xSharePoint/xSharePoint.xSPSite.Tests.ps1 | 2 +- 2 files changed, 82 insertions(+), 175 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 index ca07f0035..38172102e 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 @@ -4,61 +4,20 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $true)] - [System.String] - $OwnerAlias, - - [parameter(Mandatory = $false)] - [System.UInt32] - $CompatibilityLevel, - - [parameter(Mandatory = $false)] - [System.String] - $ContentDatabase, - - [parameter(Mandatory = $false)] - [System.String] - $Description, - - [parameter(Mandatory = $false)] - [System.String] - $HostHeaderWebApplication, - - [parameter(Mandatory = $false)] - [System.UInt32] - $Language, - - [parameter(Mandatory = $false)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $OwnerEmail, - - [parameter(Mandatory = $false)] - [System.String] - $QuotaTemplate, - - [parameter(Mandatory = $false)] - [System.String] - $SecondaryEmail, - - [parameter(Mandatory = $false)] - [System.String] - $SecondaryOwnerAlias, - - [parameter(Mandatory = $false)] - [System.String] - $Template, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Url, + [parameter(Mandatory = $true)] [System.String] $OwnerAlias, + [parameter(Mandatory = $false)] [System.UInt32] $CompatibilityLevel, + [parameter(Mandatory = $false)] [System.String] $ContentDatabase, + [parameter(Mandatory = $false)] [System.String] $Description, + [parameter(Mandatory = $false)] [System.String] $HostHeaderWebApplication, + [parameter(Mandatory = $false)] [System.UInt32] $Language, + [parameter(Mandatory = $false)] [System.String] $Name, + [parameter(Mandatory = $false)] [System.String] $OwnerEmail, + [parameter(Mandatory = $false)] [System.String] $QuotaTemplate, + [parameter(Mandatory = $false)] [System.String] $SecondaryEmail, + [parameter(Mandatory = $false)] [System.String] $SecondaryOwnerAlias, + [parameter(Mandatory = $false)] [System.String] $Template, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting site collection $Url" @@ -66,16 +25,50 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] $site = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPSite" -Arguments @{ Identity = $params.Url } -ErrorAction SilentlyContinue - + if ($null -eq $site) { return @{} } else { + if ($site.HostHeaderIsSiteName) { $HostHeaderWebApplication = $site.Url } + + if ($site.Owner.UserLogin.Contains("#")) { + # Claims based authentication user + $owner = Invoke-xSharePointSPCmdlet -CmdletName "New-SPClaimsPrincipal" -Arguments @{ Identity = $site.Owner.UserLogin; IdentityType = "EncodedClaim" } + } else { + # Classic authentication user + $owner = $site.Owner.UserLogin + } + + if ($null -eq $site.SecondaryContact) { + $secondaryOwner = $null + } else { + if ($site.SecondaryContact.UserLogin.Contains("#")) { + # Claims based authentication user + $secondaryOwner = Invoke-xSharePointSPCmdlet -CmdletName "New-SPClaimsPrincipal" -Arguments @{ Identity = $site.SecondaryContact.UserLogin; IdentityType = "EncodedClaim" } + } else { + # Classic authentication user + $secondaryOwner = $site.SecondaryContact.UserLogin + } + } + return @{ Url = $site.Url - OwnerAlias = $site.OwnerAlias + OwnerAlias = $owner + CompatibilityLevel = $site.CompatibilityLevel + ContentDatabase = $site.ContentDatabase.Name + Description = $site.RootWeb.Description + HostHeaderWebApplication = $HostHeaderWebApplication + Language = $site.RootWeb.Language + Name = $site.RootWeb.Name + OwnerEmail = $site.Owner.Email + QuotaTemplate = $site.Quota + SecondaryEmail = $site.SecondaryContact.Email + SecondaryOwnerAlias = $secondaryOwner + Template = "$($site.RootWeb.WebTemplate)#$($site.RootWeb.WebTemplateId)" + InstallAccount = $params.InstallAccount } } } - $result + return $result } @@ -84,61 +77,20 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $true)] - [System.String] - $OwnerAlias, - - [parameter(Mandatory = $false)] - [System.UInt32] - $CompatibilityLevel, - - [parameter(Mandatory = $false)] - [System.String] - $ContentDatabase, - - [parameter(Mandatory = $false)] - [System.String] - $Description, - - [parameter(Mandatory = $false)] - [System.String] - $HostHeaderWebApplication, - - [parameter(Mandatory = $false)] - [System.UInt32] - $Language, - - [parameter(Mandatory = $false)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $OwnerEmail, - - [parameter(Mandatory = $false)] - [System.String] - $QuotaTemplate, - - [parameter(Mandatory = $false)] - [System.String] - $SecondaryEmail, - - [parameter(Mandatory = $false)] - [System.String] - $SecondaryOwnerAlias, - - [parameter(Mandatory = $false)] - [System.String] - $Template, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Url, + [parameter(Mandatory = $true)] [System.String] $OwnerAlias, + [parameter(Mandatory = $false)] [System.UInt32] $CompatibilityLevel, + [parameter(Mandatory = $false)] [System.String] $ContentDatabase, + [parameter(Mandatory = $false)] [System.String] $Description, + [parameter(Mandatory = $false)] [System.String] $HostHeaderWebApplication, + [parameter(Mandatory = $false)] [System.UInt32] $Language, + [parameter(Mandatory = $false)] [System.String] $Name, + [parameter(Mandatory = $false)] [System.String] $OwnerEmail, + [parameter(Mandatory = $false)] [System.String] $QuotaTemplate, + [parameter(Mandatory = $false)] [System.String] $SecondaryEmail, + [parameter(Mandatory = $false)] [System.String] $SecondaryOwnerAlias, + [parameter(Mandatory = $false)] [System.String] $Template, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Creating site collection $Url" @@ -162,70 +114,25 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $true)] - [System.String] - $OwnerAlias, - - [parameter(Mandatory = $false)] - [System.UInt32] - $CompatibilityLevel, - - [parameter(Mandatory = $false)] - [System.String] - $ContentDatabase, - - [parameter(Mandatory = $false)] - [System.String] - $Description, - - [parameter(Mandatory = $false)] - [System.String] - $HostHeaderWebApplication, - - [parameter(Mandatory = $false)] - [System.UInt32] - $Language, - - [parameter(Mandatory = $false)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.String] - $OwnerEmail, - - [parameter(Mandatory = $false)] - [System.String] - $QuotaTemplate, - - [parameter(Mandatory = $false)] - [System.String] - $SecondaryEmail, - - [parameter(Mandatory = $false)] - [System.String] - $SecondaryOwnerAlias, - - [parameter(Mandatory = $false)] - [System.String] - $Template, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Url, + [parameter(Mandatory = $true)] [System.String] $OwnerAlias, + [parameter(Mandatory = $false)] [System.UInt32] $CompatibilityLevel, + [parameter(Mandatory = $false)] [System.String] $ContentDatabase, + [parameter(Mandatory = $false)] [System.String] $Description, + [parameter(Mandatory = $false)] [System.String] $HostHeaderWebApplication, + [parameter(Mandatory = $false)] [System.UInt32] $Language, + [parameter(Mandatory = $false)] [System.String] $Name, + [parameter(Mandatory = $false)] [System.String] $OwnerEmail, + [parameter(Mandatory = $false)] [System.String] $QuotaTemplate, + [parameter(Mandatory = $false)] [System.String] $SecondaryEmail, + [parameter(Mandatory = $false)] [System.String] $SecondaryOwnerAlias, + [parameter(Mandatory = $false)] [System.String] $Template, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource @PSBoundParameters + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing site collection $Url" - if ($result.Count -eq 0) { return $false } - else { - - } - return $true + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("Url") } diff --git a/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 index b678bccf3..88a5af60d 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 @@ -23,7 +23,7 @@ Describe "xSPSite" { Context "Validate get method" { It "Calls the right functions to retrieve SharePoint data" { - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPSite" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPSite" } Get-TargetResource @testParams Assert-VerifiableMocks } From 391f8d01be6aac87ba2f57db9d18494d730dbc72 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 15 Sep 2015 00:03:13 +1000 Subject: [PATCH 053/146] Fixed get method in xSPStateServiceApp --- .../MSFT_xSPStateServiceApp.psm1 | 84 +++++-------------- 1 file changed, 22 insertions(+), 62 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 index afaa8bcd8..c51a3abc8 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 @@ -4,25 +4,11 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting state service application '$Name'" @@ -35,10 +21,13 @@ function Get-TargetResource if ($null -eq $app) { return @{} } return @{ - Name = $app.DisplayName + Name = $serviceApp.DisplayName + DatabaseName = $serviceApp.Database.Name + DatabaseServer = $serviceApp.Database.Server.Name + InstallAccount = $params.InstallAccount } } - $result + return $result } @@ -47,25 +36,11 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Creating state service application $Name" @@ -95,31 +70,16 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource -Name $Name -InstallAccount $InstallAccount + $CurrentValues = Get-TargetResource -Name $Name -InstallAccount $InstallAccount Write-Verbose -Message "Testing for state service application $Name" - if ($result.Count -eq 0) { return $false } - return $true + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("Name") } From cd1a749aae52d80da136d6bc7a05718af0cd7641 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 15 Sep 2015 00:23:36 +1000 Subject: [PATCH 054/146] Fixed get method in xSPUsageApplication --- .../MSFT_xSPUsageApplication.psm1 | 183 ++++-------------- .../xSharePoint.xSPusageApplication.Tests.ps1 | 22 +-- 2 files changed, 54 insertions(+), 151 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 index 8c690384f..9b69fe7ca 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 @@ -4,49 +4,17 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabasePassword, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseUsername, - - [parameter(Mandatory = $false)] - [System.String] - $FailoverDatabaseServer, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UsageLogCutTime, - - [parameter(Mandatory = $false)] - [System.String] - $UsageLogLocation, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UsageLogMaxFileSizeKB, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UsageLogMaxSpaceGB + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.String] $DatabasePassword, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] $DatabaseUsername, + [parameter(Mandatory = $false)] [System.String] $FailoverDatabaseServer, + [parameter(Mandatory = $false)] [System.UInt32] $UsageLogCutTime, + [parameter(Mandatory = $false)] [System.String] $UsageLogLocation, + [parameter(Mandatory = $false)] [System.UInt32] $UsageLogMaxFileSizeKB, + [parameter(Mandatory = $false)] [System.UInt32] $UsageLogMaxSpaceGB ) Write-Verbose -Message "Getting usage application '$Name'" @@ -65,9 +33,15 @@ function Get-TargetResource $service = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPUsageService" return @{ Name = $serviceApp.DisplayName + InstallAccount = $params.InstallAccount + DatabaseName = $serviceApp.Applications.UsageDatabase.Name + DatabaseServer = $serviceApp.Applications.UsageDatabase.Server.Name + DatabasePassword = $serviceApp.Applications.UsageDatabase.Password + DatabaseUsername = $serviceApp.Applications.UsageDatabase.Username + FailoverDatabaseServer = $serviceApp.Applications.UsageDatabase.FailoverServer UsageLogCutTime = $service.UsageLogCutTime - UsageLogDir = $service.UsageLogDir - UsageLogMaxFileSize = $service.UsageLogMaxFileSize + UsageLogLocation = $service.UsageLogDir + UsageLogMaxFileSizeKB = $service.UsageLogMaxFileSize UsageLogMaxSpaceGB = $service.UsageLogMaxSpaceGB } } @@ -81,49 +55,17 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabasePassword, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseUsername, - - [parameter(Mandatory = $false)] - [System.String] - $FailoverDatabaseServer, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UsageLogCutTime, - - [parameter(Mandatory = $false)] - [System.String] - $UsageLogLocation, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UsageLogMaxFileSizeKB, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UsageLogMaxSpaceGB + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.String] $DatabasePassword, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] $DatabaseUsername, + [parameter(Mandatory = $false)] [System.String] $FailoverDatabaseServer, + [parameter(Mandatory = $false)] [System.UInt32] $UsageLogCutTime, + [parameter(Mandatory = $false)] [System.String] $UsageLogLocation, + [parameter(Mandatory = $false)] [System.UInt32] $UsageLogMaxFileSizeKB, + [parameter(Mandatory = $false)] [System.UInt32] $UsageLogMaxSpaceGB ) Write-Verbose -Message "Setting usage application $Name" @@ -166,61 +108,22 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabasePassword, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseUsername, - - [parameter(Mandatory = $false)] - [System.String] - $FailoverDatabaseServer, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UsageLogCutTime, - - [parameter(Mandatory = $false)] - [System.String] - $UsageLogLocation, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UsageLogMaxFileSizeKB, - - [parameter(Mandatory = $false)] - [System.UInt32] - $UsageLogMaxSpaceGB + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.String] $DatabasePassword, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] $DatabaseUsername, + [parameter(Mandatory = $false)] [System.String] $FailoverDatabaseServer, + [parameter(Mandatory = $false)] [System.UInt32] $UsageLogCutTime, + [parameter(Mandatory = $false)] [System.String] $UsageLogLocation, + [parameter(Mandatory = $false)] [System.UInt32] $UsageLogMaxFileSizeKB, + [parameter(Mandatory = $false)] [System.UInt32] $UsageLogMaxSpaceGB ) - $result = Get-TargetResource @PSBoundParameters + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for usage application '$Name'" - if ($result.Count -eq 0) { return $false } - else { - if ($PSBoundParameters.ContainsKey("UsageLogCutTime") -and $result.UsageLogCutTime -ne $UsageLogCutTime) { return $false } - if ($PSBoundParameters.ContainsKey("UsageLogLocation") -and $result.UsageLogDir -ne $UsageLogLocation) { return $false } - if ($PSBoundParameters.ContainsKey("UsageLogMaxFileSizeKB") -and $result.UsageLogMaxFileSize -ne $UsageLogMaxFileSizeKB) { return $false } - if ($PSBoundParameters.ContainsKey("UsageLogMaxSpaceGB") -and $result.UsageLogMaxSpaceGB -ne $UsageLogMaxSpaceGB) { return $false } - } - return $true + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("UsageLogCutTime", "UsageLogLocation", "UsageLogMaxFileSizeKB", "UsageLogMaxSpaceGB") } diff --git a/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 index e726d1614..b9affd5e6 100644 --- a/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 @@ -20,7 +20,7 @@ Describe "xSPUsageApplication" { Name = "Usage Service App" UsageLogCutTime = 60 UsageLogLocation = "L:\UsageLogs" - UsageLogMaxFileSize = 1024 + UsageLogMaxFileSizeKB = 1024 UsageLogMaxSpaceGB = 10 } @@ -43,8 +43,8 @@ Describe "xSPUsageApplication" { return @{ Name = $testParams.Name UsageLogCutTime = $testParams.UsageLogCutTime - UsageLogDir = $testParams.UsageLogLocation - UsageLogMaxFileSize = $testParams.UsageLogMaxFileSize + UsageLogLocation = $testParams.UsageLogLocation + UsageLogMaxFileSizeKB = $testParams.UsageLogMaxFileSizeKB UsageLogMaxSpaceGB = $testParams.UsageLogMaxSpaceGB } } @@ -55,8 +55,8 @@ Describe "xSPUsageApplication" { return @{ Name = $testParams.Name UsageLogCutTime = $testParams.UsageLogCutTime - UsageLogDir = "C:\WrongPath" - UsageLogMaxFileSize = $testParams.UsageLogMaxFileSize + UsageLogLocation = "C:\WrongPath" + UsageLogMaxFileSizeKB = $testParams.UsageLogMaxFileSizeKB UsageLogMaxSpaceGB = $testParams.UsageLogMaxSpaceGB } } @@ -65,8 +65,8 @@ Describe "xSPUsageApplication" { return @{ Name = $testParams.Name UsageLogCutTime = 0 - UsageLogDir = $testParams.UsageLogLocation - UsageLogMaxFileSize = $testParams.UsageLogMaxFileSize + UsageLogLocation = $testParams.UsageLogLocation + UsageLogMaxFileSizeKB = $testParams.UsageLogMaxFileSizeKB UsageLogMaxSpaceGB = $testParams.UsageLogMaxSpaceGB } } @@ -75,8 +75,8 @@ Describe "xSPUsageApplication" { return @{ Name = $testParams.Name UsageLogCutTime = $testParams.UsageLogCutTime - UsageLogDir = $testParams.UsageLogLocation - UsageLogMaxFileSize = 0 + UsageLogLocation = $testParams.UsageLogLocation + UsageLogMaxFileSizeKB = 0 UsageLogMaxSpaceGB = $testParams.UsageLogMaxSpaceGB } } @@ -85,8 +85,8 @@ Describe "xSPUsageApplication" { return @{ Name = $testParams.Name UsageLogCutTime = $testParams.UsageLogCutTime - UsageLogDir = $testParams.UsageLogLocation - UsageLogMaxFileSize = $testParams.UsageLogMaxFileSize + UsageLogLocation = $testParams.UsageLogLocation + UsageLogMaxFileSizeKB = $testParams.UsageLogMaxFileSizeKB UsageLogMaxSpaceGB = 0 } } From 98d40eab9133af2d34deeffd11a49a3d61b81957 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 15 Sep 2015 09:03:42 +1000 Subject: [PATCH 055/146] Fixed get method of xSPUserProfileService and bug fix in xSPCreateFarm --- .../MSFT_xSPCreateFarm.psm1 | 10 +- .../MSFT_xSPUserProfileServiceApp.psm1 | 199 ++++++------------ 2 files changed, 72 insertions(+), 137 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 index 2e74e4235..fbe46269b 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 @@ -16,6 +16,8 @@ function Get-TargetResource Write-Verbose -Message "Checking for local SP Farm" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + $params = $args[0] + try { $spFarm = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFarm" } catch { @@ -27,10 +29,16 @@ function Get-TargetResource $configDb = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPDatabase" -Arguments @{ IncludeCentralAdministration = $true } | Where-Object { $_.Name -eq $spFarm.Name -and $_.Type -eq "Configuration Database" } $centralAdminSite = (Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" | Where-Object { $_.IsAdministrationWebApplication })[0] + if ($params.FarmAccount.UserName -eq $spFarm.DefaultServiceAccount.Name) { + $farmAccount = $params.FarmAccount + } else { + $farmAccount = $spFarm.DefaultServiceAccount.Name + } + $returnValue = @{ FarmConfigDatabaseName = $spFarm.Name DatabaseServer = $configDb.Server.Name - FarmAccount = $spFarm.DefaultServiceAccount.Name + FarmAccount = $farmAccount InstallAccount = $params.InstallAccount Passphrase = $params.Passphrase AdminContentDatabaseName = $centralAdminSite.ContentDatabases[0].Server diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 index a4cfd47f8..516eae2ac 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 @@ -4,49 +4,17 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.String] - $MySiteHostLocation, - - [parameter(Mandatory = $false)] - [System.String] - $ProfileDBName, - - [parameter(Mandatory = $false)] - [System.String] - $ProfileDBServer, - - [parameter(Mandatory = $false)] - [System.String] - $SocialDBName, - - [parameter(Mandatory = $false)] - [System.String] - $SocialDBServer, - - [parameter(Mandatory = $false)] - [System.String] - $SyncDBName, - - [parameter(Mandatory = $false)] - [System.String] - $SyncDBServer, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ApplicationPool, + [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $FarmAccount, + [parameter(Mandatory = $false)] [System.String] $MySiteHostLocation, + [parameter(Mandatory = $false)] [System.String] $ProfileDBName, + [parameter(Mandatory = $false)] [System.String] $ProfileDBServer, + [parameter(Mandatory = $false)] [System.String] $SocialDBName, + [parameter(Mandatory = $false)] [System.String] $SocialDBServer, + [parameter(Mandatory = $false)] [System.String] $SyncDBName, + [parameter(Mandatory = $false)] [System.String] $SyncDBServer, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting user profile service application $Name" @@ -62,9 +30,37 @@ function Get-TargetResource } else { + $propData = $serviceApp.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic) + + $socialProp = $propData | Where-Object {$_.Name -eq "SocialDatabase"} + $socialDB = $socialProp.GetValue($serviceApp) + + $profileProp = $propData | Where-Object {$_.Name -eq "ProfileDatabase"} + $profileDB = $profileProp.GetValue($serviceApp) + + $syncProp = $propData | Where-Object {$_.Name -eq "SynchronizationDatabase"} + $syncDB = $syncProp.GetValue($serviceApp) + + $spFarm = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFarm" + + if ($params.FarmAccount.UserName -eq $spFarm.DefaultServiceAccount.Name) { + $farmAccount = $params.FarmAccount + } else { + $farmAccount = $spFarm.DefaultServiceAccount.Name + } + return @{ Name = $serviceApp.DisplayName ApplicationPool = $serviceApp.ApplicationPool.Name + FarmAccount = $farmAccount + MySiteHostLocation = $params.MySiteHostLocation + ProfileDBName = $profileProp.Name + ProfileDBServer = $profileProp.Server.Name + SocialDBName = $socialDB.Name + SocialDBServer = $socialDB.Server.Name + SyncDBName = $syncDB.Name + SyncDBServer = $syncDB.Server.Name + InstallAccount = $params.InstallAccount } } } @@ -77,49 +73,17 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.String] - $MySiteHostLocation, - - [parameter(Mandatory = $false)] - [System.String] - $ProfileDBName, - - [parameter(Mandatory = $false)] - [System.String] - $ProfileDBServer, - - [parameter(Mandatory = $false)] - [System.String] - $SocialDBName, - - [parameter(Mandatory = $false)] - [System.String] - $SocialDBServer, - - [parameter(Mandatory = $false)] - [System.String] - $SyncDBName, - - [parameter(Mandatory = $false)] - [System.String] - $SyncDBServer, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ApplicationPool, + [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $FarmAccount, + [parameter(Mandatory = $false)] [System.String] $MySiteHostLocation, + [parameter(Mandatory = $false)] [System.String] $ProfileDBName, + [parameter(Mandatory = $false)] [System.String] $ProfileDBServer, + [parameter(Mandatory = $false)] [System.String] $SocialDBName, + [parameter(Mandatory = $false)] [System.String] $SocialDBServer, + [parameter(Mandatory = $false)] [System.String] $SyncDBName, + [parameter(Mandatory = $false)] [System.String] $SyncDBServer, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Creating user profile service application $Name" @@ -167,59 +131,22 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.String] - $MySiteHostLocation, - - [parameter(Mandatory = $false)] - [System.String] - $ProfileDBName, - - [parameter(Mandatory = $false)] - [System.String] - $ProfileDBServer, - - [parameter(Mandatory = $false)] - [System.String] - $SocialDBName, - - [parameter(Mandatory = $false)] - [System.String] - $SocialDBServer, - - [parameter(Mandatory = $false)] - [System.String] - $SyncDBName, - - [parameter(Mandatory = $false)] - [System.String] - $SyncDBServer, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ApplicationPool, + [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $FarmAccount, + [parameter(Mandatory = $false)] [System.String] $MySiteHostLocation, + [parameter(Mandatory = $false)] [System.String] $ProfileDBName, + [parameter(Mandatory = $false)] [System.String] $ProfileDBServer, + [parameter(Mandatory = $false)] [System.String] $SocialDBName, + [parameter(Mandatory = $false)] [System.String] $SocialDBServer, + [parameter(Mandatory = $false)] [System.String] $SyncDBName, + [parameter(Mandatory = $false)] [System.String] $SyncDBServer, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource @PSBoundParameters + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for user profile service application $Name" - - if ($result.Count -eq 0) { return $false } - else { - if ($ApplicationPool -ne $result.ApplicationPool) { return $false } - } - return $true + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("ApplicationPool") } Export-ModuleMember -Function *-TargetResource From 8e6382f2ce58bade5f5e0a08b03cd6b311d27714 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 15 Sep 2015 09:39:07 +1000 Subject: [PATCH 056/146] Fixed get method in xSPUserProfileSyncService --- .../MSFT_xSPUserProfileSyncService.psm1 | 88 +++++++------------ ...ePoint.xSPUserProfileSyncService.Tests.ps1 | 8 +- 2 files changed, 36 insertions(+), 60 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 index e4ab6ef91..226aafcf7 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 @@ -4,22 +4,10 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $UserProfileServiceAppName, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $UserProfileServiceAppName, + [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure, + [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $FarmAccount, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting the local user profile sync service instance" @@ -27,10 +15,27 @@ function Get-TargetResource $params = $args[0] $syncService = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Server = $env:COMPUTERNAME } | Where-Object { $_.TypeName -eq (Get-xSharePointServiceApplicationName -Name UserProfileSync) } - + + if ($syncService.UserProfileApplicationGuid -ne [Guid]::Empty) { + $upa = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Identity = $syncService.UserProfileApplicationGuid } -ErrorAction SilentlyContinue + } if ($null -eq $syncService) { return @{} } + if ($syncService.Status -eq "Online") { $localEnsure = "Present" } else { $localEnsure = "Absent" } + + $spFarm = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFarm" + + if ($params.FarmAccount.UserName -eq $spFarm.DefaultServiceAccount.Name) { + $farmAccount = $params.FarmAccount + } else { + $farmAccount = $spFarm.DefaultServiceAccount.Name + } + return @{ + UserProfileServiceAppName = $upa.Name + Ensure = $localEnsure + FarmAccount = $farmAccount + InstallAccount = $params.InstallAccount Status = $syncService.Status } } @@ -43,22 +48,10 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $UserProfileServiceAppName, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $UserProfileServiceAppName, + [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure, + [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $FarmAccount, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Setting User Profile Synchronization Service" @@ -120,32 +113,15 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $UserProfileServiceAppName, - - [parameter(Mandatory = $true)] - [ValidateSet("Present","Absent")] - [System.String] - $Ensure, - - [parameter(Mandatory = $true)] - [System.Management.Automation.PSCredential] - $FarmAccount, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $UserProfileServiceAppName, + [parameter(Mandatory = $true)] [ValidateSet("Present","Absent")] [System.String] $Ensure, + [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $FarmAccount, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource @PSBoundParameters + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for User Profile Synchronization Service" - if ($result.Count -eq 0) { return $false } - else { - if (($result.Status -eq "Online") -and ($Ensure -ne "Present")) { return $false } - if (($result.Status -eq "Disabled") -and ($Ensure -ne "Absent")) { return $false } - } - return $true + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("Ensure") } diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 index 9ae580108..340653a36 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 @@ -38,7 +38,7 @@ Describe "xSPUserProfileSyncService" { It "Passes when the user profile sync service is running and should be" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ - Status = "Online" + Ensure = "Present" } } Test-TargetResource @testParams | Should Be $true @@ -46,7 +46,7 @@ Describe "xSPUserProfileSyncService" { It "Fails when the user profile sync service is not running and should be" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ - Status = "Disabled" + Ensure = "Absent" } } Test-TargetResource @testParams | Should Be $false @@ -57,7 +57,7 @@ Describe "xSPUserProfileSyncService" { It "Fails when the user profile sync service is running and should not be" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ - Status = "Online" + Ensure = "Present" } } Test-TargetResource @testParams | Should Be $false @@ -65,7 +65,7 @@ Describe "xSPUserProfileSyncService" { It "Passes when the user profile sync service is not running and should not be" { Mock -ModuleName $ModuleName Get-TargetResource { return @{ - Status = "Disabled" + Ensure = "Absent" } } Test-TargetResource @testParams | Should Be $true From c4fe53f2d92fba66a05cfef141a7ef7f8c6c1868 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 15 Sep 2015 09:47:34 +1000 Subject: [PATCH 057/146] Fixed claims auth detection in xSPSite --- .../DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 index 38172102e..14d294051 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 @@ -30,22 +30,18 @@ function Get-TargetResource else { if ($site.HostHeaderIsSiteName) { $HostHeaderWebApplication = $site.Url } - if ($site.Owner.UserLogin.Contains("#")) { - # Claims based authentication user + if ($site.WebApplication.UseClaimsAuthentication) { $owner = Invoke-xSharePointSPCmdlet -CmdletName "New-SPClaimsPrincipal" -Arguments @{ Identity = $site.Owner.UserLogin; IdentityType = "EncodedClaim" } } else { - # Classic authentication user $owner = $site.Owner.UserLogin } if ($null -eq $site.SecondaryContact) { $secondaryOwner = $null } else { - if ($site.SecondaryContact.UserLogin.Contains("#")) { - # Claims based authentication user + if ($site.WebApplication.UseClaimsAuthentication) { $secondaryOwner = Invoke-xSharePointSPCmdlet -CmdletName "New-SPClaimsPrincipal" -Arguments @{ Identity = $site.SecondaryContact.UserLogin; IdentityType = "EncodedClaim" } } else { - # Classic authentication user $secondaryOwner = $site.SecondaryContact.UserLogin } } From 37edae73540835c086ed29627d3ee7a1db298287 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 15 Sep 2015 11:07:17 +1000 Subject: [PATCH 058/146] Fixed get methof of xSPWebApplication --- .../MSFT_xSPWebApplication.psm1 | 204 +++++------------- .../xSharePoint/xSharePoint.Global.Tests.ps1 | 2 +- .../xSharePoint.xSPWebApplication.Tests.ps1 | 2 +- 3 files changed, 54 insertions(+), 154 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 index a1c608417..106c6a652 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 @@ -4,54 +4,18 @@ function Get-TargetResource [OutputType([System.Collections.Hashtable])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPoolAccount, - - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowAnonymous, - - [parameter(Mandatory = $false)] - [ValidateSet("NTLM","Kerberos")] - [System.String] - $AuthenticationMethod, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $HostHeader, - - [parameter(Mandatory = $false)] - [System.String] - $Path, - - [parameter(Mandatory = $false)] - [System.String] - $Port, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ApplicationPool, + [parameter(Mandatory = $true)] [System.String] $ApplicationPoolAccount, + [parameter(Mandatory = $true)] [System.String] $Url, + [parameter(Mandatory = $false)] [System.Boolean] $AllowAnonymous, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] $HostHeader, + [parameter(Mandatory = $false)] [System.String] $Path, + [parameter(Mandatory = $false)] [System.String] $Port, + [parameter(Mandatory = $false)] [ValidateSet("NTLM","Kerberos")] [System.String] $AuthenticationMethod, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Getting web application '$Name'" @@ -61,11 +25,24 @@ function Get-TargetResource $wa = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue if ($null -eq $wa) { return @{} } - + + $authProvider = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" -Arguments @{ WebApplication = $wa.Url; Zone = "Default" } + + if ($authProvider.DisableKerberos -eq $true) { $localAuthMode = "NTLM" } else { $localAuthMode = "Kerberos" } + return @{ Name = $wa.DisplayName ApplicationPool = $wa.ApplicationPool.Name ApplicationPoolAccount = $wa.ApplicationPool.Username + Url = $wa.Url + AllowAnonymous = $authProvider.AllowAnonymous + DatabaseName = $wa.ContentDatabases[0].Name + DatabaseServer = $wa.ContentDatabases[0].Server + HostHeader = [Uri]::New($wa.Url).Host + Path = $wa.IisSettings[0].Path + Port = [Uri]::New($wa.Url).Port + AuthenticationMethod = $localAuthMode + InstallAccount = $params.InstallAccount } } return $result @@ -77,54 +54,18 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPoolAccount, - - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowAnonymous, - - [parameter(Mandatory = $false)] - [ValidateSet("NTLM","Kerberos")] - [System.String] - $AuthenticationMethod, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $HostHeader, - - [parameter(Mandatory = $false)] - [System.String] - $Path, - - [parameter(Mandatory = $false)] - [System.String] - $Port, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ApplicationPool, + [parameter(Mandatory = $true)] [System.String] $ApplicationPoolAccount, + [parameter(Mandatory = $true)] [System.String] $Url, + [parameter(Mandatory = $false)] [System.Boolean] $AllowAnonymous, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] $HostHeader, + [parameter(Mandatory = $false)] [System.String] $Path, + [parameter(Mandatory = $false)] [System.String] $Port, + [parameter(Mandatory = $false)] [ValidateSet("NTLM","Kerberos")] [System.String] $AuthenticationMethod, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) Write-Verbose -Message "Creating web application '$Name'" @@ -165,64 +106,23 @@ function Test-TargetResource [OutputType([System.Boolean])] param ( - [parameter(Mandatory = $true)] - [System.String] - $Name, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPool, - - [parameter(Mandatory = $true)] - [System.String] - $ApplicationPoolAccount, - - [parameter(Mandatory = $true)] - [System.String] - $Url, - - [parameter(Mandatory = $false)] - [System.Boolean] - $AllowAnonymous, - - [parameter(Mandatory = $false)] - [ValidateSet("NTLM","Kerberos")] - [System.String] - $AuthenticationMethod, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseName, - - [parameter(Mandatory = $false)] - [System.String] - $DatabaseServer, - - [parameter(Mandatory = $false)] - [System.String] - $HostHeader, - - [parameter(Mandatory = $false)] - [System.String] - $Path, - - [parameter(Mandatory = $false)] - [System.String] - $Port, - - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $InstallAccount + [parameter(Mandatory = $true)] [System.String] $Name, + [parameter(Mandatory = $true)] [System.String] $ApplicationPool, + [parameter(Mandatory = $true)] [System.String] $ApplicationPoolAccount, + [parameter(Mandatory = $true)] [System.String] $Url, + [parameter(Mandatory = $false)] [System.Boolean] $AllowAnonymous, + [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $false)] [System.String] $DatabaseServer, + [parameter(Mandatory = $false)] [System.String] $HostHeader, + [parameter(Mandatory = $false)] [System.String] $Path, + [parameter(Mandatory = $false)] [System.String] $Port, + [parameter(Mandatory = $false)] [ValidateSet("NTLM","Kerberos")] [System.String] $AuthenticationMethod, + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -ApplicationPoolAccount $ApplicationPoolAccount -Url $Url -InstallAccount $InstallAccount + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for web application '$Name'" - if ($result.Count -eq 0) { return $false } - else { - if ($result.ApplicationPool -ne $ApplicationPool) { return $false } - if ($result.ApplicationPoolAccount -ne $ApplicationPoolAccount) { return $false } - } - return $true + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("ApplicationPool") } diff --git a/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 b/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 index e50251f85..a6b145bc7 100644 --- a/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 @@ -130,7 +130,7 @@ Describe 'PowerShell Modules' { $tokens = $null $errors = $null $ast = [System.Management.Automation.Language.Parser]::ParseFile($fileName, [ref] $tokens, [ref] $errors) - return $tokens | Where-Object { $_.TokenFlags -contains "CommandName" -and $_.Value -like "*-SP*"} | ft + return $tokens | Where-Object { $_.TokenFlags -contains "CommandName" -and $_.Text -like "*-SP*"} | ft } It "doesn't call SharePoint PowerShell cmdlets directly" { diff --git a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 index a1db18553..df4bc81f0 100644 --- a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 @@ -25,7 +25,7 @@ Describe "xSPWebApplication" { Context "Validate get method" { It "Calls the right functions to retrieve SharePoint data" { - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPWebApplication" } + Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPWebApplication" } Get-TargetResource @testParams Assert-VerifiableMocks } From f84f07481a9f936ca8ef94876eb9e0ee0d0ea7ea Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 15 Sep 2015 12:56:18 +1000 Subject: [PATCH 059/146] Fix issue with state detection in xSPServiceInstance --- .../MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 index 0ac188d47..b11621860 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 @@ -16,7 +16,7 @@ function Get-TargetResource $si = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Server = $env:COMPUTERNAME } | Where-Object { $_.TypeName -eq $params.Name } if ($null -eq $si) { return @{} } - if ($si.Status) { $localEnsure = "Present" } else { $localEnsure = "Absent" } + if ($si.Status -eq "Online") { $localEnsure = "Present" } else { $localEnsure = "Absent" } return @{ Name = $params.Name From 05b512fe04946710c8779ca67120b3b80290503e Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 15 Sep 2015 20:05:02 +1000 Subject: [PATCH 060/146] Added test for MOF schema checking --- Tests/Tests.pssproj | 1 + .../xSharePoint/xSharePoint.Global.Tests.ps1 | 16 +- .../xSharePoint/xSharePoint.TestHelpers.psm1 | 179 ++++++++++++++++++ 3 files changed, 194 insertions(+), 2 deletions(-) create mode 100644 Tests/xSharePoint/xSharePoint.TestHelpers.psm1 diff --git a/Tests/Tests.pssproj b/Tests/Tests.pssproj index b21b06b52..597acb246 100644 --- a/Tests/Tests.pssproj +++ b/Tests/Tests.pssproj @@ -54,6 +54,7 @@ + diff --git a/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 b/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 index a6b145bc7..d150ecd1c 100644 --- a/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 @@ -10,6 +10,7 @@ $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +Import-Module "$PSScriptRoot\xSharePoint.TestHelpers.psm1" Describe 'xSharePoint Global Tests' { @@ -17,9 +18,9 @@ Describe 'xSharePoint Global Tests' { ($_.FullName -like "*\DscResources\*") }) - Context 'MOF schemas use InstallAccount' { + Context 'MOF schemas' { - It "Doesn't have InstallAccount as a required parameter" { + It "Don't have InstallAccount as a required parameter" { $mofFilesWithNoInstallAccount = 0 $mofFiles | % { $fileHasInstallAccount = $false @@ -35,6 +36,17 @@ Describe 'xSharePoint Global Tests' { } $mofFilesWithNoInstallAccount | Should Be 0 } + + + + It "Has MOF schemas that match properties on PowerShell functions" { + $filesWithErrors = 0 + $WarningPreference = "Continue" + $mofFiles | % { + if ((Assert-MofSchemaScriptParameters $_.FullName) -eq $false) { $filesWithErrors++ } + } + $filesWithErrors | Should Be 0 + } } } diff --git a/Tests/xSharePoint/xSharePoint.TestHelpers.psm1 b/Tests/xSharePoint/xSharePoint.TestHelpers.psm1 new file mode 100644 index 000000000..b8cafe9db --- /dev/null +++ b/Tests/xSharePoint/xSharePoint.TestHelpers.psm1 @@ -0,0 +1,179 @@ +function Get-MofSchemaObject() { + param( + [Parameter(Mandatory=$True)] + [string]$fileName + ) + $contents = Get-Content $fileName + + $results = @{ + ClassVersion = $null + FriendlyName = $null + ClassName = $null + Attributes = @() + } + + foreach($textLine in $contents) { + if ($textLine.Contains("ClassVersion") -or $textLine.Contains("ClassVersion")) { + if ($textLine -match "ClassVersion(`"*.`")") { + $start = $textLine.IndexOf("ClassVersion(`"") + 14 + $end = $textLine.IndexOf("`")", $start) + $results.ClassVersion = $textLine.Substring($start, $end - $start) + } + + if ($textLine -match "FriendlyName(`"*.`")") { + $start = $textLine.IndexOf("FriendlyName(`"") + 14 + $end = $textLine.IndexOf("`")", $start) + $results.FriendlyName = $textLine.Substring($start, $end - $start) + } + } elseif ($textLine.Contains("class ")) { + $start = $textLine.IndexOf("class ") + 6 + $end = $textLine.IndexOf(" ", $start) + $results.ClassName = $textLine.Substring($start, $end - $start) + } elseif ($textLine.Trim() -eq "{" -or $textLine.Trim() -eq "};" -or [string]::IsNullOrEmpty($textLine)) { + } else { + $attributeValue = @{ + State = $null + EmbeddedInstance = $null + ValueMap = $null + DataType = $null + Name = $null + } + + $start = $textLine.IndexOf("[") + 1 + $end = $textLine.IndexOf("]", $start) + $metadataEnd = $end + $metadata = $textLine.Substring($start, $end - $start) + $metadataObjects = $metadata.Split(",") + $attributeValue.State = $metadataObjects[0] + + $metadataObjects | ForEach-Object { + if ($_.Trim().StartsWith("EmbeddedInstance")) { + $start = $textLine.IndexOf("EmbeddedInstance(`"") + 18 + $end = $textLine.IndexOf("`")", $start) + $attributeValue.EmbeddedInstance = $textLine.Substring($start, $end - $start) + } + if ($_.Trim().StartsWith("ValueMap")) { + $start = $textLine.IndexOf("ValueMap{") + 9 + $end = $textLine.IndexOf("}", $start) + $valueMap = $textLine.Substring($start, $end - $start) + $attributeValue.ValueMap = $valueMap.Replace("`"", "").Split(",") + } + } + + $nonMetadata = $textLine.Replace(";","").Substring($metadataEnd + 1) + + $nonMetadataObjects = $nonMetadata.Split(" ") + $attributeValue.DataType = $nonMetadataObjects[1] + $attributeValue.Name = $nonMetadataObjects[2] + + $results.Attributes += $attributeValue + } + } + return $results +} + +function Assert-MofSchemaScriptParameters() { + param( + [Parameter(Mandatory=$True)] + [string]$mofFileName + ) + $hasErrors = $false + $mofData = Get-MofSchemaObject -fileName $mofFileName + $psFile = $mofFileName.Replace(".schema.mof", ".psm1") + + $tokens = $null + $errors = $null + $ast = [System.Management.Automation.Language.Parser]::ParseFile($psFile, [ref] $tokens, [ref] $errors) + $functions = $ast.FindAll( {$args[0] -is [System.Management.Automation.Language.FunctionDefinitionAst]}, $true) + + $functions | ForEach-Object { + $function = $_ + $astTokens = $null + $astErrors = $null + $functionAst = [System.Management.Automation.Language.Parser]::ParseInput($_.Body, [ref] $astTokens, [ref] $astErrors) + + $parameters = $functionAst.FindAll( {$args[0] -is [System.Management.Automation.Language.ParameterAst]}, $true) + + foreach ($mofParameter in $mofData.Attributes) { + # Check the parameter exists + $paramToCheck = $parameters | Where-Object { $_.Name.ToString() -eq "`$$($mofParameter.Name)" } + + if ($null -eq $paramToCheck) { + $hasErrors = $true + Write-Warning "File $psFile is missing parameter $($mofParameter.Name) from the $($_.Name) method" + } + + $parameterAttribute = $paramToCheck.Attributes | ? { $_.TypeName.ToString() -eq "parameter" } -ErrorAction SilentlyContinue + + if (($mofParameter.State -eq "Key" -or $mofParameter.State -eq "Required")) { + + if (-not $parameterAttribute) { + $hasErrors = $true + Write-Warning "File $psFile has parameter $($mofParameter.Name) that is not marked as mandatory (has no parameter attribute) in the $($function.Name) method" + } else { + $isMandatoryInScript = [bool]::Parse(($parameterAttribute.NamedArguments | ? { $_.ArgumentName -eq "Mandatory" }).Argument.VariablePath.ToString()) + + if ($isMandatoryInScript -eq $false) { + $hasErrors = $true + Write-Warning "File $psFile has parameter $($mofParameter.Name) that is not marked as mandatory in the $($function.Name) method" + } + } + } + + if ($mofParameter.State -eq "Write") { + if ($null -ne $parameterAttribute) { + $isMandatoryInScript = [bool]::Parse(($parameterAttribute.NamedArguments | ? { $_.ArgumentName -eq "Mandatory" }).Argument.VariablePath.ToString()) + if ($isMandatoryInScript -eq $true) { + $hasErrors = $true + Write-Warning "File $psFile has parameter $($mofParameter.Name) that is marked as mandatory in the $($function.Name) method and it should not be" + } + } + } + + if ($null -ne $mofParameter.ValueMap) { + $validateSetAttribute = ($paramToCheck.Attributes | ? { $_.TypeName.ToString() -eq "ValidateSet" }) + + if (-not $validateSetAttribute) { + $hasErrors = $true + Write-Warning "File $psFile has parameter $($mofParameter.Name) that is missing a ValidateSet attribute in the $($function.Name) method" + } + + $psValidateSetParams = $validateSetAttribute.PositionalArguments | % { $_.Value.ToString() } + + $mofParameter.ValueMap | ForEach-Object { + if ($psValidateSetParams -notcontains $_) { + $hasErrors = $true + Write-Warning "File $psFile has parameter $($mofParameter.Name) that does not have '$_' in its validateset parameter for $($function.Name) method" + } + } + + $psValidateSetParams | ForEach-Object { + if ($mofParameter.ValueMap -notcontains $_) { + $hasErrors = $true + Write-Warning "File $psFile has parameter $($mofParameter.Name) that contains '$_' in the $($function.Name) function which is not in the valuemap in the schema" + } + } + } + + if ($mofParameter.EmbeddedInstance -eq $null) { + if (($paramToCheck.Attributes | ? { $_.TypeName.ToString() -match $mofParameter.DataType }) -eq $null) { + $hasErrors = $true + Write-Warning "File $psFile has parameter $($mofParameter.Name) in function $($function.Name) that does not match the data type of the schema" + } + } else { + switch ($mofParameter.EmbeddedInstance) { + "MSFT_Credential" { + if (($paramToCheck.Attributes | ? { $_.TypeName.ToString() -match "PSCredential" }) -eq $null) { + $hasErrors = $true + Write-Warning "File $psFile has parameter $($mofParameter.Name) in function $($function.Name) that does not match the data type of the schema" + } + } + } + } + } + } + + return (!$hasErrors) +} + +Export-ModuleMember * \ No newline at end of file From 8f4959b9c76be226241f59a7ac0c30ef05555bf6 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 15 Sep 2015 21:10:44 +1000 Subject: [PATCH 061/146] Fixed but stoping provisioning of UPS sync --- .../MSFT_xSPUserProfileSyncService.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 index 226aafcf7..24bbf1415 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 @@ -73,7 +73,7 @@ function Set-TargetResource $syncService = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Server = $env:COMPUTERNAME } | Where-Object { $_.TypeName -eq (Get-xSharePointServiceApplicationName -Name UserProfileSync) } # Start the Sync service if it should be running on this server - if (($Ensure -eq "Present") -and ($syncService.Status -ne "Online")) { + if (($params.Ensure -eq "Present") -and ($syncService.Status -ne "Online")) { Set-xSharePointUserProfileSyncMachine -UserProfileServiceAppName $params.UserProfileServiceAppName -SyncServiceId $syncService.ID -FarmAccount $params.FarmAccount Invoke-xSharePointSPCmdlet -CmdletName "Start-SPServiceInstance" -Arguments @{ Identity = $syncService.ID } From e6a61ae545d301d1b7657dd8e32f200157e6d745 Mon Sep 17 00:00:00 2001 From: KarolKaczmarek Date: Tue, 15 Sep 2015 10:57:17 -0700 Subject: [PATCH 062/146] Fixing redundant assignment --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 0ae1dbfea..1ba1302e7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -32,7 +32,7 @@ after_test: New-Nuspec -packageName $env:APPVEYOR_PROJECT_NAME -version $env:APPVEYOR_BUILD_VERSION -author "Microsoft" -owners "Microsoft" -licenseUrl "https://github.com/PowerShell/DscResources/blob/master/LICENSE" -projectUrl "https://github.com/$($env:APPVEYOR_REPO_NAME)" -packageDescription $env:APPVEYOR_PROJECT_NAME -tags "DesiredStateConfiguration DSC DSCResourceKit" -destinationPath . nuget pack ".\$($env:APPVEYOR_PROJECT_NAME).nuspec" -outputdirectory $env:APPVEYOR_BUILD_FOLDER - $nuGetPackageName = $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" + $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\$nuGetPackageName" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } From 9524cfe6fab49c277e89d9ec46411da565ca6b50 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Wed, 16 Sep 2015 09:07:45 +1000 Subject: [PATCH 063/146] Added code coverage to AppVeyor output --- appveyor.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 0ae1dbfea..d9a05c8f2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,7 +12,9 @@ build: off test_script: - ps: | $testResultsFile = ".\TestsResults.xml" - $res = Invoke-Pester -OutputFormat NUnitXml -OutputFile $testResultsFile -PassThru + $testCoverageFiles = @() + Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint\**\*.psm1" -Recurse | ForEach-Object { $testCoverageFiles += $_.FullName } + $res = Invoke-Pester -OutputFormat NUnitXml -OutputFile $testResultsFile -PassThru -CodeCoverage $testCoverageFiles (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFile)) if ($res.FailedCount -gt 0) { throw "$($res.FailedCount) tests failed." @@ -20,9 +22,6 @@ test_script: after_test: - ps: | - - - Remove-Item (Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.pssproj") $manifest = Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.psd1" (Get-Content $manifest -Raw).Replace("0.6.0.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest @@ -34,5 +33,3 @@ after_test: nuget pack ".\$($env:APPVEYOR_PROJECT_NAME).nuspec" -outputdirectory $env:APPVEYOR_BUILD_FOLDER $nuGetPackageName = $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\$nuGetPackageName" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } - - From 6b2e3c3a43b7b5ef333c8709b993d5da25322bf1 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Wed, 16 Sep 2015 09:59:16 +1000 Subject: [PATCH 064/146] Fixed issue with arguments in xSPCreateFarm --- .../DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 index fbe46269b..8b5cb0c82 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 @@ -26,8 +26,8 @@ function Get-TargetResource if ($null -eq $spFarm) {return @{ }} - $configDb = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPDatabase" -Arguments @{ IncludeCentralAdministration = $true } | Where-Object { $_.Name -eq $spFarm.Name -and $_.Type -eq "Configuration Database" } - $centralAdminSite = (Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" | Where-Object { $_.IsAdministrationWebApplication })[0] + $configDb = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPDatabase" | Where-Object { $_.Name -eq $spFarm.Name -and $_.Type -eq "Configuration Database" } + $centralAdminSite = (Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" -Arguments @{ IncludeCentralAdministration = $true } | Where-Object { $_.IsAdministrationWebApplication })[0] if ($params.FarmAccount.UserName -eq $spFarm.DefaultServiceAccount.Name) { $farmAccount = $params.FarmAccount From e29a898c60f948ba7274c39937cec930fa0f7f6a Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Wed, 16 Sep 2015 10:07:19 +1000 Subject: [PATCH 065/146] Fix incorrect cmdlet name in xSPWebApplication --- .../MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 index 106c6a652..26d68d859 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 @@ -26,7 +26,7 @@ function Get-TargetResource $wa = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue if ($null -eq $wa) { return @{} } - $authProvider = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" -Arguments @{ WebApplication = $wa.Url; Zone = "Default" } + $authProvider = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPAuthenticationProvider" -Arguments @{ WebApplication = $wa.Url; Zone = "Default" } if ($authProvider.DisableKerberos -eq $true) { $localAuthMode = "NTLM" } else { $localAuthMode = "Kerberos" } From 5044f5af3816e02e3b249e5d6baa7e45d8f2fd79 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Wed, 16 Sep 2015 10:58:54 +1000 Subject: [PATCH 066/146] Fixed issue where owner could be null in get for xSPSite --- .../MSFT_xSPSite/MSFT_xSPSite.psm1 | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 index 14d294051..071f3ba30 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 @@ -26,21 +26,26 @@ function Get-TargetResource $params = $args[0] $site = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPSite" -Arguments @{ Identity = $params.Url } -ErrorAction SilentlyContinue - if ($null -eq $site) { return @{} } - else { - if ($site.HostHeaderIsSiteName) { $HostHeaderWebApplication = $site.Url } + if ($null -eq $site) { + return @{} + } else { + if ($site.HostHeaderIsSiteName) { $HostHeaderWebApplication = $site.WebApplication.Url } - if ($site.WebApplication.UseClaimsAuthentication) { - $owner = Invoke-xSharePointSPCmdlet -CmdletName "New-SPClaimsPrincipal" -Arguments @{ Identity = $site.Owner.UserLogin; IdentityType = "EncodedClaim" } + if ($null -eq $site.Owner) { + $owner = $null } else { - $owner = $site.Owner.UserLogin + if ($site.WebApplication.UseClaimsAuthentication) { + $owner = (Invoke-xSharePointSPCmdlet -CmdletName "New-SPClaimsPrincipal" -Arguments @{ Identity = $site.Owner.UserLogin; IdentityType = "EncodedClaim" }).Value + } else { + $owner = $site.Owner.UserLogin + } } - + if ($null -eq $site.SecondaryContact) { $secondaryOwner = $null } else { if ($site.WebApplication.UseClaimsAuthentication) { - $secondaryOwner = Invoke-xSharePointSPCmdlet -CmdletName "New-SPClaimsPrincipal" -Arguments @{ Identity = $site.SecondaryContact.UserLogin; IdentityType = "EncodedClaim" } + $secondaryOwner = (Invoke-xSharePointSPCmdlet -CmdletName "New-SPClaimsPrincipal" -Arguments @{ Identity = $site.SecondaryContact.UserLogin; IdentityType = "EncodedClaim" }).Value } else { $secondaryOwner = $site.SecondaryContact.UserLogin } From 644413616b3230a474e7bbe4a7161860271c4c7e Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Wed, 16 Sep 2015 11:32:42 +1000 Subject: [PATCH 067/146] Fix for detection of value types in Test-xSharePointSpecificParameters util method --- .../xSharePoint.Util/xSharePoint.Util.psm1 | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index b721234eb..617f228c2 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -173,7 +173,24 @@ function Test-xSharePointSpecificParameters() { $KeyList | ForEach-Object { if ((-not $CurrentValues.ContainsKey($_)) -or ($CurrentValues.$_ -ne $DesiredValues.$_)) { - $returnValue = $false + if ($DesiredValues.ContainsKey($_)) { + $desiredType = $DesiredValues.$_.GetType() + switch ($desiredType.Name) { + "String" { + if ([string]::IsNullOrEmpty($CurrentValues.$_) -ne [string]::IsNullOrEmpty($DesiredValues.$_)) { + $returnValue = $false + } + } + "Int32" { + if (($DesiredValues.$_ -eq 0) -and ($CurrentValues.$_ -eq $null)) {} else { + $returnValue = $false + } + } + default { + $returnValue = $false + } + } + } } } return $returnValue From 127898c0b91923a89d878252f28ad41565beb3c2 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Wed, 16 Sep 2015 12:45:39 +1000 Subject: [PATCH 068/146] Fixed issue with local variable use in Test-xSharePointSpecificParameters --- .../Modules/xSharePoint.Util/xSharePoint.Util.psm1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 617f228c2..d66aa74f4 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -175,14 +175,15 @@ function Test-xSharePointSpecificParameters() { if ((-not $CurrentValues.ContainsKey($_)) -or ($CurrentValues.$_ -ne $DesiredValues.$_)) { if ($DesiredValues.ContainsKey($_)) { $desiredType = $DesiredValues.$_.GetType() + $fieldName = $_ switch ($desiredType.Name) { "String" { - if ([string]::IsNullOrEmpty($CurrentValues.$_) -ne [string]::IsNullOrEmpty($DesiredValues.$_)) { + if ([string]::IsNullOrEmpty($CurrentValues.$fieldName) -and [string]::IsNullOrEmpty($DesiredValues.$fieldName)) {} else { $returnValue = $false } } "Int32" { - if (($DesiredValues.$_ -eq 0) -and ($CurrentValues.$_ -eq $null)) {} else { + if (($DesiredValues.$fieldName -eq 0) -and ($CurrentValues.$fieldName -eq $null)) {} else { $returnValue = $false } } From 8dd2ad0ecfd007e943651b756f6a1bd2a8a24ec6 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Wed, 16 Sep 2015 13:02:54 +1000 Subject: [PATCH 069/146] Fixed bug with database details and log size in get method --- .../MSFT_xSPUsageApplication.psm1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 index 9b69fe7ca..9bffe3612 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 @@ -34,11 +34,11 @@ function Get-TargetResource return @{ Name = $serviceApp.DisplayName InstallAccount = $params.InstallAccount - DatabaseName = $serviceApp.Applications.UsageDatabase.Name - DatabaseServer = $serviceApp.Applications.UsageDatabase.Server.Name - DatabasePassword = $serviceApp.Applications.UsageDatabase.Password - DatabaseUsername = $serviceApp.Applications.UsageDatabase.Username - FailoverDatabaseServer = $serviceApp.Applications.UsageDatabase.FailoverServer + DatabaseName = $serviceApp.UsageDatabase.Name + DatabaseServer = $serviceApp.UsageDatabase.Server.Name + DatabasePassword = $serviceApp.UsageDatabase.Password + DatabaseUsername = $serviceApp.UsageDatabase.Username + FailoverDatabaseServer = $serviceApp.UsageDatabase.FailoverServer UsageLogCutTime = $service.UsageLogCutTime UsageLogLocation = $service.UsageLogDir UsageLogMaxFileSizeKB = $service.UsageLogMaxFileSize From 90b7f19fe68183c5878d3e4bb2914352c150097b Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Wed, 16 Sep 2015 13:20:02 +1000 Subject: [PATCH 070/146] Fixed wrong variable names in get for xSPStateServiceApp --- .../MSFT_xSPStateServiceApp.psm1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 index c51a3abc8..d8a211046 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 @@ -16,14 +16,14 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $app = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPStateServiceApplication" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue + $serviceApp = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPStateServiceApplication" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue - if ($null -eq $app) { return @{} } + if ($null -eq $serviceApp) { return @{} } return @{ Name = $serviceApp.DisplayName - DatabaseName = $serviceApp.Database.Name - DatabaseServer = $serviceApp.Database.Server.Name + DatabaseName = $serviceApp.Databases.Name + DatabaseServer = $serviceApp.Databases.Server.Name InstallAccount = $params.InstallAccount } } @@ -77,7 +77,7 @@ function Test-TargetResource [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $CurrentValues = Get-TargetResource -Name $Name -InstallAccount $InstallAccount + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for state service application $Name" return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("Name") } From 59808bd48a8f8dd8ec628bdccbba96917d360e1f Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Wed, 16 Sep 2015 13:27:43 +1000 Subject: [PATCH 071/146] Fixed firewall detection for xSPDistribuedCacheService --- .../MSFT_xSPDistributedCacheService.psm1 | 2 +- .../xSharePoint.DistributedCache.psm1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index 3ebee75ce..dd771d523 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -39,7 +39,7 @@ function Get-TargetResource Name = $params.Name CacheSizeInMB = $cacheHostConfig.Size ServiceAccount = $windowsService.StartName - CreateFirewallRules = (-not $firewallRule) + CreateFirewallRules = ($firewallRule -ne $null) Ensure = "Present" InstallAccount = $params.InstallAccount } diff --git a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 index 1b8064326..7bb49b1da 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 @@ -78,7 +78,7 @@ function Enable-xSharePointDCFireWallRule() { $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distributed Cache" -ErrorAction SilentlyContinue if($null -eq $firewallRule) { - New-NetFirewallRule -Name "SPDistCache" -DisplayName "SharePoint Distributed Cache" -Protocol TCP -LocalPort 22233-22236 + New-NetFirewallRule -Name "SPDistCache" -DisplayName "SharePoint Distributed Cache" -Protocol TCP -LocalPort 22233-22236 -Group "SharePoint" } Enable-NetFirewallRule -DisplayName "SharePoint Distributed Cache" } From 30743050393c24ffd739ebe6efb14f6c50b6e388 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Wed, 16 Sep 2015 13:34:32 +1000 Subject: [PATCH 072/146] Fixed bug in set for xSPManagedPath --- .../MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 index c7312d2bb..a722a44d1 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 @@ -50,10 +50,11 @@ function Set-TargetResource Write-Verbose -Message "Creating the managed path $RelativeUrl in $WebAppUrl" - $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } - $path = Get-TargetResource @params + $path = Get-TargetResource @params -ErrorAction SilentlyContinue if ($null -eq $path) { $newParams = @{} From 4542b923d77cc38f70932893893df2ee7622b2d8 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Wed, 16 Sep 2015 22:56:53 +1000 Subject: [PATCH 073/146] Fixed issue with test in xSPManagedAccount --- .../MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 index 72491d946..7341dfb52 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 @@ -86,7 +86,7 @@ function Test-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing managed account $AccountName" - return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("Schedule","PreExpireDays","EmailNotification") + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("AccountName", "Schedule","PreExpireDays","EmailNotification") } From 8c3ea7d12b3badd83cb5e1f82bb92f57e4e9ebc3 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 17 Sep 2015 09:02:30 +1000 Subject: [PATCH 074/146] Fixed typo in get method for xSPManagedAccount --- .../MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 index 7341dfb52..6a841c0dc 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 @@ -21,7 +21,7 @@ function Get-TargetResource $ma = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPManagedAccount" -Arguments @{ Identity = $params.Account.UserName } -ErrorAction SilentlyContinue if ($null -eq $ma) { return @{ } } return @{ - AccountName = $ma.Userame + AccountName = $ma.Username EmailNotification = $ma.DaysBeforeChangeToEmail PreExpireDays = $ma.DaysBeforeExpiryToChange Schedule = $ma.ChangeSchedule From 813d68d3839ed4b4503b2e4c52712cc2f4efe05a Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 17 Sep 2015 09:15:18 +1000 Subject: [PATCH 075/146] Fixed bug with log file size detection in xSPUsageApplication --- .../MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 index 9bffe3612..6ceb37fc5 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 @@ -41,7 +41,7 @@ function Get-TargetResource FailoverDatabaseServer = $serviceApp.UsageDatabase.FailoverServer UsageLogCutTime = $service.UsageLogCutTime UsageLogLocation = $service.UsageLogDir - UsageLogMaxFileSizeKB = $service.UsageLogMaxFileSize + UsageLogMaxFileSizeKB = $service.UsageLogMaxFileSize / 1024 UsageLogMaxSpaceGB = $service.UsageLogMaxSpaceGB } } From 7a642ab66229d26a02fd1a8378a1afb131d609a5 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 17 Sep 2015 09:47:49 +1000 Subject: [PATCH 076/146] Fixed bug that prevented creation of managed paths --- .../MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 index a722a44d1..2c1073fbc 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 @@ -22,7 +22,7 @@ function Get-TargetResource $getParams.Add("HostHeader", $true) } $path = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPManagedPath" -Arguments $getParams -ErrorAction SilentlyContinue - if ($null -eq $path) { return @{} } + if ($null -eq $path) { return $null } return @{ RelativeUrl = $path.Name @@ -52,9 +52,11 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } $path = Get-TargetResource @params -ErrorAction SilentlyContinue + + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } + if ($null -eq $path) { $newParams = @{} @@ -88,6 +90,7 @@ function Test-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Looking up the managed path $RelativeUrl in $WebAppUrl" + if ($CurrentValues -eq $null) { return $false } return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("WebAppUrl","RelativeUrl","Explicit","HostHeader") } From bdff26267ff80957e1736a484046ad7eeb69d39e Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 17 Sep 2015 10:57:35 +1000 Subject: [PATCH 077/146] Fixed issue with verbose parameter being passed for comparison --- .../MSFT_xSPManagedPath.psm1 | 2 +- .../xSharePoint.Util/xSharePoint.Util.psm1 | 35 ++++++++++--------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 index 2c1073fbc..c685475ef 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 @@ -90,7 +90,7 @@ function Test-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Looking up the managed path $RelativeUrl in $WebAppUrl" - if ($CurrentValues -eq $null) { return $false } + if ($CurrentValues -eq $null) { return $false } return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("WebAppUrl","RelativeUrl","Explicit","HostHeader") } diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index d66aa74f4..956b6b43d 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -172,27 +172,30 @@ function Test-xSharePointSpecificParameters() { } $KeyList | ForEach-Object { - if ((-not $CurrentValues.ContainsKey($_)) -or ($CurrentValues.$_ -ne $DesiredValues.$_)) { - if ($DesiredValues.ContainsKey($_)) { - $desiredType = $DesiredValues.$_.GetType() - $fieldName = $_ - switch ($desiredType.Name) { - "String" { - if ([string]::IsNullOrEmpty($CurrentValues.$fieldName) -and [string]::IsNullOrEmpty($DesiredValues.$fieldName)) {} else { - $returnValue = $false + if ($_ -ne "Verbose") { + if (($CurrentValues.ContainsKey($_) -eq $false) -or ($CurrentValues.$_ -ne $DesiredValues.$_)) { + if ($DesiredValues.ContainsKey($_)) { + $desiredType = $DesiredValues.$_.GetType() + $fieldName = $_ + switch ($desiredType.Name) { + "String" { + if ([string]::IsNullOrEmpty($CurrentValues.$fieldName) -and [string]::IsNullOrEmpty($DesiredValues.$fieldName)) {} else { + $returnValue = $false + } } - } - "Int32" { - if (($DesiredValues.$fieldName -eq 0) -and ($CurrentValues.$fieldName -eq $null)) {} else { + "Int32" { + if (($DesiredValues.$fieldName -eq 0) -and ($CurrentValues.$fieldName -eq $null)) {} else { + $returnValue = $false + } + } + default { $returnValue = $false } } - default { - $returnValue = $false - } - } - } + } + } } + } return $returnValue } From 5f0c0841da2defd8048d2d259d471a35ba22d3dd Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 24 Sep 2015 00:23:26 +1000 Subject: [PATCH 078/146] Refactored full test suite to new stubs model --- .../MSFT_xSPBCSServiceApp.psm1 | 70 +- .../MSFT_xSPCacheAccounts.psm1 | 17 +- .../MSFT_xSPCreateFarm.psm1 | 27 +- .../MSFT_xSPDiagnosticLoggingSettings.psm1 | 17 +- .../MSFT_xSPDistributedCacheService.psm1 | 53 +- .../MSFT_xSPFeature/MSFT_xSPFeature.psm1 | 11 +- .../MSFT_xSPInstallPrereqs.psm1 | 13 +- .../MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 | 20 +- .../MSFT_xSPManagedAccount.psm1 | 13 +- .../MSFT_xSPManagedMetaDataServiceApp.psm1 | 39 +- .../MSFT_xSPManagedPath.psm1 | 9 +- .../MSFT_xSPSearchServiceApp.psm1 | 48 +- .../MSFT_xSPSecureStoreServiceApp.psm1 | 58 +- .../MSFT_xSPServiceAppPool.psm1 | 19 +- .../MSFT_xSPServiceInstance.psm1 | 27 +- .../MSFT_xSPSite/MSFT_xSPSite.psm1 | 17 +- .../MSFT_xSPStateServiceApp.psm1 | 21 +- .../MSFT_xSPStateServiceApp.schema.mof | 2 +- .../MSFT_xSPUsageApplication.psm1 | 29 +- .../MSFT_xSPUserProfileServiceApp.psm1 | 73 +- .../MSFT_xSPUserProfileSyncService.psm1 | 39 +- .../MSFT_xSPWebApplication.psm1 | 38 +- .../xSharePoint.DistributedCache.psm1 | 67 +- .../xSharePoint.ServiceApplications.psm1 | 39 - .../xSharePoint.UserProfileService.psm1 | 6 +- .../xSharePoint.Util/xSharePoint.Util.psm1 | 4 +- Modules/xSharePoint/xSharePoint.psd1 | 3 - Modules/xSharePoint/xSharePoint.pssproj | 2 - .../DistributedCache/DistributedCache.psm1 | 18 + .../Microsoft.SharePoint.PowerShell.psm1 | 20554 ++++++++++++++ .../Microsoft.SharePoint.PowerShell.psm1 | 22281 ++++++++++++++++ Tests/Tests.pssproj | 9 + Tests/xSharePoint.TestHarness.psm1 | 82 + .../xSharePoint/xSharePoint.Global.Tests.ps1 | 138 +- .../xSharePoint/xSharePoint.TestHelpers.psm1 | 134 +- Tests/xSharePoint/xSharePoint.Util.Tests.ps1 | 9 +- .../xSharePoint.xSPBCSServiceApp.Tests.ps1 | 104 +- .../xSharePoint.xSPCacheAccounts.Tests.ps1 | 152 +- .../xSharePoint.xSPCreateFarm.Tests.ps1 | 150 +- ...int.xSPDiagnosticLoggingSettings.Tests.ps1 | 188 +- ...Point.xSPDistributedCacheService.Tests.ps1 | 176 +- .../xSharePoint.xSPFeature.Tests.ps1 | 194 +- .../xSharePoint.xSPInstall.Tests.ps1 | 93 +- .../xSharePoint.xSPInstallPrereqs.Tests.ps1 | 152 +- .../xSharePoint.xSPJoinFarm.Tests.ps1 | 120 +- .../xSharePoint.xSPManagedAccount.Tests.ps1 | 119 +- ...int.xSPManagedMetadataServiceApp.Tests.ps1 | 106 +- .../xSharePoint.xSPManagedPath.Tests.ps1 | 93 +- .../xSharePoint.xSPSearchServiceApp.Tests.ps1 | 110 +- ...rePoint.xSPSecureStoreServiceApp.Tests.ps1 | 109 +- .../xSharePoint.xSPServiceAppPool.Tests.ps1 | 87 +- .../xSharePoint.xSPServiceInstance.Tests.ps1 | 142 +- .../xSharePoint/xSharePoint.xSPSite.Tests.ps1 | 104 +- .../xSharePoint.xSPStateServiceApp.Tests.ps1 | 60 +- ...rePoint.xSPUserProfileServiceApp.Tests.ps1 | 111 +- ...ePoint.xSPUserProfileSyncService.Tests.ps1 | 200 +- .../xSharePoint.xSPWebApplication.Tests.ps1 | 105 +- .../xSharePoint.xSPusageApplication.Tests.ps1 | 170 +- 58 files changed, 44964 insertions(+), 1887 deletions(-) delete mode 100644 Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 create mode 100644 Tests/Stubs/DistributedCache/DistributedCache.psm1 create mode 100644 Tests/Stubs/SharePoint/15.0.4693.1000/Microsoft.SharePoint.PowerShell.psm1 create mode 100644 Tests/Stubs/SharePoint/16.0.4316.1217/Microsoft.SharePoint.PowerShell.psm1 create mode 100644 Tests/xSharePoint.TestHarness.psm1 diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 index 35d627fd8..00a4c102e 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 @@ -10,33 +10,29 @@ function Get-TargetResource [parameter(Mandatory = $false)] [System.String] $DatabaseServer, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - Write-Verbose -Message "Getting BCS service app '$Name'" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - try - { - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName BCS + Initialize-xSharePointPSSnapin - If ($null -eq $serviceApp) - { - return @{} - } - else - { - return @{ - Name = $serviceApp.DisplayName - ApplicationPool = $serviceApp.ApplicationPool.Name - DatabaseName = $serviceApp.Database.Name - DatabaseServer = $serviceApp.Database.Server.Name - InstallAccount = $params.InstallAccount - } + $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue + if ($null -eq $serviceApps) { + return $null + } + $serviceApp = $serviceApps | Where-Object { $_.TypeName -eq "Business Data Connectivity Service Application" } + + If ($null -eq $serviceApp) { + return $null + } else { + $returnVal = @{ + Name = $serviceApp.DisplayName + ApplicationPool = $serviceApp.ApplicationPool.Name + DatabaseName = $serviceApp.Database.Name + DatabaseServer = $serviceApp.Database.Server.Name + InstallAccount = $params.InstallAccount } - } - catch - { - return @{ } + return $returnVal } } return $result @@ -61,12 +57,12 @@ function Set-TargetResource Write-Verbose -Message "Creating BCS Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Invoke-xSharePointSPCmdlet -CmdletName "New-SPBusinessDataCatalogServiceApplication" -Arguments @{ - Name = $params.Name - ApplicationPool = $params.ApplicationPool - DatabaseName = $params.DatabaseName - DatabaseServer = $params.DatabaseServer - } + Initialize-xSharePointPSSnapin + + New-SPBusinessDataCatalogServiceApplication -Name $params.Name ` + -ApplicationPool $params.ApplicationPool ` + -DatabaseName $params.DatabaseName ` + -DatabaseServer $params.DatabaseServer } } else { @@ -74,14 +70,13 @@ function Set-TargetResource Write-Verbose -Message "Updating BCS Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName "BCS" - $appPool = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" @{ - Identity = $params.ApplicationPool - } - Invoke-xSharePointSPCmdlet -CmdletName "Set-SPBusinessDataCatalogServiceApplication" -Arguments @{ - Identity = $serviceApp - ApplicationPool = $appPool - } + Initialize-xSharePointPSSnapin + + $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool + + Get-SPServiceApplication -Name $params.Name ` + | Where-Object { $_.TypeName -eq "Business Data Connectivity Service Application" } ` + | Set-SPBusinessDataCatalogServiceApplication -ApplicationPool $appPool } } } @@ -99,10 +94,11 @@ function Test-TargetResource [parameter(Mandatory = $false)] [System.String] $DatabaseServer, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for BCS Service Application '$Name'" - + $CurrentValues = Get-TargetResource @PSBoundParameters + + if ($null -eq $CurrentValues) { return $false } return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("ApplicationPool") } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 index 55019b467..098b24ed4 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 @@ -14,7 +14,9 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $wa = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" -Arguments @{ Identity = $params.WebAppUrl } -ErrorAction SilentlyContinue + Initialize-xSharePointPSSnapin + + $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue if ($null -eq $wa) { return @{} } @@ -42,9 +44,9 @@ function Set-TargetResource [CmdletBinding()] param ( - [parameter(Mandatory = $true)] [System.String] $WebAppUrl, - [parameter(Mandatory = $true)] [System.String] $SuperUserAlias, - [parameter(Mandatory = $true)] [System.String] $SuperReaderAlias, + [parameter(Mandatory = $true)] [System.String] $WebAppUrl, + [parameter(Mandatory = $true)] [System.String] $SuperUserAlias, + [parameter(Mandatory = $true)] [System.String] $SuperReaderAlias, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) @@ -52,8 +54,12 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin - $wa = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" -Arguments @{ Identity = $params.WebAppUrl } + $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue + if ($null -eq $wa) { + throw [Exception] "The web applications $($params.WebAppUrl) can not be found to set cache accounts" + } if ($wa.Properties.ContainsKey("portalsuperuseraccount")) { $wa.Properties["portalsuperuseraccount"] = $params.SuperUserAlias @@ -88,6 +94,7 @@ function Test-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing cache accounts for $WebAppUrl" + if ($null -eq $CurrentValues) {return $false } return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("SuperUserAlias", "SuperReaderAlias") } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 index 8b5cb0c82..2914acc59 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 @@ -17,17 +17,18 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin try { - $spFarm = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFarm" + $spFarm = Get-SPFarm } catch { Write-Verbose -Message "Unable to detect local farm." } - if ($null -eq $spFarm) {return @{ }} + if ($null -eq $spFarm) { return $null } - $configDb = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPDatabase" | Where-Object { $_.Name -eq $spFarm.Name -and $_.Type -eq "Configuration Database" } - $centralAdminSite = (Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" -Arguments @{ IncludeCentralAdministration = $true } | Where-Object { $_.IsAdministrationWebApplication })[0] + $configDb = Get-SPDatabase | Where-Object { $_.Name -eq $spFarm.Name -and $_.Type -eq "Configuration Database" } + $centralAdminSite = Get-SPWebApplication -IncludeCentralAdministration | Where-Object { $_.IsAdministrationWebApplication -eq $true } if ($params.FarmAccount.UserName -eq $spFarm.DefaultServiceAccount.Name) { $farmAccount = $params.FarmAccount @@ -41,7 +42,7 @@ function Get-TargetResource FarmAccount = $farmAccount InstallAccount = $params.InstallAccount Passphrase = $params.Passphrase - AdminContentDatabaseName = $centralAdminSite.ContentDatabases[0].Server + AdminContentDatabaseName = $centralAdminSite.ContentDatabases[0].Name CentralAdministrationPort = [Uri]::new($centralAdminSite.Url).Port } return $returnValue @@ -67,6 +68,7 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin $newFarmArgs = @{ DatabaseServer = $params.DatabaseServer @@ -90,13 +92,13 @@ function Set-TargetResource } } - Invoke-xSharePointSPCmdlet -CmdletName "New-SPConfigurationDatabase" -Arguments $newFarmArgs - Invoke-xSharePointSPCmdlet -CmdletName "Install-SPHelpCollection" -Arguments @{ All = $true } - Invoke-xSharePointSPCmdlet -CmdletName "Initialize-SPResourceSecurity" - Invoke-xSharePointSPCmdlet -CmdletName "Install-SPService" - Invoke-xSharePointSPCmdlet -CmdletName "Install-SPFeature" -Arguments @{ AllExistingFeatures = $true; Force = $true } - Invoke-xSharePointSPCmdlet -CmdletName "New-SPCentralAdministration" -Arguments @{ Port = $params.CentralAdministrationPort; WindowsAuthProvider = "NTLM" } - Invoke-xSharePointSPCmdlet -CmdletName "Install-SPApplicationContent" + New-SPConfigurationDatabase @newFarmArgs + Install-SPHelpCollection -All + Initialize-SPResourceSecurity + Install-SPService + Install-SPFeature -AllExistingFeatures -Force + New-SPCentralAdministration -Port $params.CentralAdministrationPort -WindowsAuthProvider "NTLM" + Install-SPApplicationContent } } @@ -117,6 +119,7 @@ function Test-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose "Checking for local farm presence" + if ($null -eq $CurrentValues) { return $false } return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("FarmConfigDatabaseName") } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 index 9b552f8b8..c18d2e1ef 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 @@ -28,12 +28,13 @@ function Get-TargetResource Write-Verbose -Message "Getting diagnostic configuration settings" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + $params = $args[0] + Initialize-xSharePointPSSnapin - $dc = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPDiagnosticConfig" -ErrorAction SilentlyContinue - if ($null -eq $dc) { return @{} } + $dc = Get-SPDiagnosticConfig -ErrorAction SilentlyContinue + if ($null -eq $dc) { return $null } return @{ - AllowLegacyTraceProviders = $dc.AllowLegacyTraceProviders AppAnalyticsAutomaticUploadEnabled = $dc.AppAnalyticsAutomaticUploadEnabled CustomerExperienceImprovementProgramEnabled = $dc.CustomerExperienceImprovementProgramEnabled ErrorReportingEnabled = $dc.ErrorReportingEnabled @@ -52,9 +53,9 @@ function Get-TargetResource ScriptErrorReportingEnabled = $dc.ScriptErrorReportingEnabled ScriptErrorReportingRequireAuth = $dc.ScriptErrorReportingRequireAuth ScriptErrorReportingDelay = $dc.ScriptErrorReportingDelay + InstallAccount = $params.InstallAccount } } - $result.Add("InstallAccount", $InstallAccount) return $result } @@ -89,12 +90,13 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } $params = $params | Rename-xSharePointParamValue -oldName "LogPath" -newName "LogLocation" ` | Rename-xSharePointParamValue -oldName "LogSpaceInGB" -newName "LogDiskSpaceUsageGB" - Invoke-xSharePointSPCmdlet -CmdletName "Set-SPDiagnosticConfig" -Arguments $params + Set-SPDiagnosticConfig @params } } @@ -126,10 +128,9 @@ function Test-TargetResource [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - Write-Verbose -Message "Getting diagnostic configuration settings" - + Write-Verbose -Message "Testing diagnostic configuration settings" $CurrentValues = Get-TargetResource @PSBoundParameters - + if ($null -eq $CurrentValues) { return $false } return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index dd771d523..2eafd31f2 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -16,21 +16,23 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + $nullReturnValue = @{ + Name = $params.Name + Ensure = "Absent" + InstallAccount = $params.InstallAccount + } try { - Invoke-xSharePointDCCmdlet -CmdletName "Use-CacheCluster" -ErrorAction SilentlyContinue - $cacheHost = Invoke-xSharePointDCCmdlet -CmdletName "Get-CacheHost" -ErrorAction SilentlyContinue - if ($null -eq $cacheHost) { return @{} } + Initialize-xSharePointPSSnapin + + Use-CacheCluster -ErrorAction SilentlyContinue + $cacheHost = Get-CacheHost -ErrorAction SilentlyContinue + + if ($null -eq $cacheHost) { return $nullReturnValue } $computerName = ([System.Net.Dns]::GetHostByName($env:computerName)).HostName - $cacheHostConfig = Invoke-xSharePointDCCmdlet -CmdletName "Get-AFCacheHostConfiguration" -Arguments @{ - ComputerName = $computerName - CachePort = $cacheHost.PortNo - } -ErrorAction SilentlyContinue - if ($null -eq $cacheHostConfig) { return @{ - Name = $params.Name - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } } + $cacheHostConfig = Get-AFCacheHostConfiguration -ComputerName $computerName -CachePort $cacheHost.PortNo -ErrorAction SilentlyContinue + + if ($null -eq $cacheHostConfig) { return $nullReturnValue } $windowsService = Get-WmiObject "win32_service" -Filter "Name='AppFabricCachingService'" $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distributed Cache" -ErrorAction SilentlyContinue @@ -45,11 +47,7 @@ function Get-TargetResource } } catch{ - return @{ - Name = $params.Name - Ensure = "Absent" - InstallAccount = $params.InstallAccount - } + return $nullReturnValue } } return $result @@ -70,10 +68,10 @@ function Set-TargetResource ) $CurrentState = Get-TargetResource @PSBoundParameters - + if ($Ensure -eq "Present") { Write-Verbose -Message "Adding the distributed cache to the server" - if($createFirewallRules) { + if($createFirewallRules -eq $true) { Write-Verbose -Message "Create a firewall rule for AppFabric" Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { Enable-xSharePointDCIcmpFireWallRule @@ -81,20 +79,26 @@ function Set-TargetResource } Write-Verbose -Message "Firewall rule added" } + Write-Verbose "Current state is '$($CurrentState.Ensure)' and desired state is '$Ensure'" if ($CurrentState.Ensure -ne $Ensure) { - Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Write-Verbose -Message "Enabling distributed cache service" + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin Add-xSharePointDistributedCacheServer -CacheSizeInMB $params.CacheSizeInMB -ServiceAccount $params.ServiceAccount } } } else { Write-Verbose -Message "Removing distributed cache to the server" Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { + Initialize-xSharePointPSSnapin Remove-xSharePointDistributedCacheServer } - Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { - Disable-xSharePointDCFireWallRule - } + if ($CreateFirewallRules -eq $true) { + Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { + Disable-xSharePointDCFireWallRule + } + } Write-Verbose -Message "Distributed cache removed." } } @@ -116,7 +120,8 @@ function Test-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for distributed cache configuration" - return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("CacheSizeInMB", "Ensure", "CreateFirewallRules") + if ($null -eq $CurrentValues) { return $false } + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("Ensure", "CreateFirewallRules") } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 index 19216abd2..872610d40 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 @@ -15,8 +15,9 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin - $feature = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFeature" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue + $feature = Get-SPFeature -Identity $params.Name -ErrorAction SilentlyContinue if ($null -eq $feature) { return @{ Name = $params.Name @@ -33,7 +34,7 @@ function Get-TargetResource } else { $checkParams.Add($params.FeatureScope, $params.Url) } - $featureAtScope = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFeature" -Arguments $checkParams -ErrorAction SilentlyContinue + $featureAtScope = Get-SPFeature @checkParams -ErrorAction SilentlyContinue $enabled = ($null -ne $featureAtScope) if ($enabled) { $currentState = "Present" } else { $currentState = "Absent" } @@ -63,6 +64,7 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin $runParams = @{} $runParams.Add("Identity", $params.Name) @@ -71,10 +73,10 @@ function Set-TargetResource } if ($params.Ensure -eq "Present") { - Invoke-xSharePointSPCmdlet -CmdletName "Enable-SPFeature" -Arguments $runParams + Enable-SPFeature @runParams } else { $runParams.Add("Confirm", $false) - Invoke-xSharePointSPCmdlet -CmdletName "Disable-SPFeature" -Arguments $runParams + Disable-SPFeature @runParams } } } @@ -97,4 +99,5 @@ function Test-TargetResource Write-Verbose -Message "Testing for feature $Name at $FeatureScope scope" return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("Ensure") } + Export-ModuleMember -Function *-TargetResource diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 index 67eea7012..58c81bda8 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 @@ -49,7 +49,7 @@ function Get-TargetResource $installedItems = Get-CimInstance -ClassName Win32_Product #Common prereqs - $returnValue.Add("Microsoft Identity Extensions", (@(Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\ -Recurse | ? {$_.GetValue("DisplayName") -eq "Microsoft Identity Extensions" }).Count -gt 0)) + $returnValue.Add("Microsoft Identity Extensions", (Check-xSharePointInstalledProductRegistryKey -RegKeysCollection (Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\ -Recurse) -ProductName "Microsoft Identity Extensions").Count -gt 0) $returnValue.Add("Microsoft CCR and DSS Runtime 2008 R3", (($installedItems | ? {$_.Name -eq "Microsoft CCR and DSS Runtime 2008 R3"}) -ne $null)) $returnValue.Add("Microsoft Sync Framework Runtime v1.0 SP1 (x64)", (($installedItems | ? {$_.Name -eq "Microsoft Sync Framework Runtime v1.0 SP1 (x64)"}) -ne $null)) $returnValue.Add("AppFabric 1.1 for Windows Server", (($installedItems | ? {$_.Name -eq "AppFabric 1.1 for Windows Server"}) -ne $null)) @@ -81,6 +81,17 @@ function Get-TargetResource return $results } +function Check-xSharePointInstalledProductRegistryKey() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $false)] [object] $RegKeysCollection, + [parameter(Mandatory = $true)] [string] $ProductName + ) + if ($RegKeysCollection -eq $null) { return $null } + return @($RegKeysCollection | ? {$_.GetValue("DisplayName") -eq $ProductName }) +} + function Set-TargetResource { diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 index f331e358b..693b31a9e 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 @@ -14,15 +14,17 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin + try { - $spFarm = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFarm" -ErrorAction SilentlyContinue + $spFarm = Get-SPFarm -ErrorAction SilentlyContinue } catch { Write-Verbose -Message "Unable to detect local farm." } if ($null -eq $spFarm) {return @{ }} - $configDb = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPDatabase" -Arguments @{ IncludeCentralAdministration = $true } | Where-Object { $_.Name -eq $spFarm.Name -and $_.Type -eq "Configuration Database" } + $configDb = Get-SPDatabase | Where-Object { $_.Name -eq $spFarm.Name -and $_.Type -eq "Configuration Database" } return @{ FarmConfigDatabaseName = $spFarm.Name @@ -50,7 +52,7 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $loopCount = 0 + Initialize-xSharePointPSSnapin $joinFarmArgs = @{ DatabaseServer = $params.DatabaseServer @@ -72,12 +74,12 @@ function Set-TargetResource } } - Invoke-xSharePointSPCmdlet -CmdletName "Connect-SPConfigurationDatabase" -Arguments $joinFarmArgs - Invoke-xSharePointSPCmdlet -CmdletName "Install-SPHelpCollection" -Arguments @{ All = $true } - Invoke-xSharePointSPCmdlet -CmdletName "Initialize-SPResourceSecurity" - Invoke-xSharePointSPCmdlet -CmdletName "Install-SPService" - Invoke-xSharePointSPCmdlet -CmdletName "Install-SPFeature" -Arguments @{ AllExistingFeatures = $true; Force = $true } - Invoke-xSharePointSPCmdlet -CmdletName "Install-SPApplicationContent" + Connect-SPConfigurationDatabase @joinFarmArgs + Install-SPHelpCollection -All + Initialize-SPResourceSecurity + Install-SPService + Install-SPFeature -AllExistingFeatures -Force + Install-SPApplicationContent } Write-Verbose -Message "Starting timer service" diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 index 6a841c0dc..89158a88c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 @@ -16,10 +16,11 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin try { - $ma = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPManagedAccount" -Arguments @{ Identity = $params.Account.UserName } -ErrorAction SilentlyContinue - if ($null -eq $ma) { return @{ } } + $ma = Get-SPManagedAccount -Identity $params.Account.UserName -ErrorAction SilentlyContinue + if ($null -eq $ma) { return $null } return @{ AccountName = $ma.Username EmailNotification = $ma.DaysBeforeChangeToEmail @@ -29,7 +30,7 @@ function Get-TargetResource InstallAccount = $params.InstallAccount } } catch { - return @{ } + return $null } } return $result @@ -52,10 +53,11 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin $current = Get-TargetResource @params if ($current.Count -eq 0) { - Invoke-xSharePointSPCmdlet -CmdletName "New-SPManagedAccount" -Arguments @{ Credential = $params.Account } + New-SPManagedAccount -Credential $params.Account } $updateParams = @{ @@ -65,7 +67,7 @@ function Set-TargetResource if ($params.ContainsKey("PreExpireDays")) { $updateParams.Add("PreExpireDays", $params.PreExpireDays) } if ($params.ContainsKey("Schedule")) { $updateParams.Add("Schedule", $params.Schedule) } - Invoke-xSharePointSPCmdlet -CmdletName "Set-SPManagedAccount" -Arguments $updateParams + Set-SPManagedAccount @updateParams } } @@ -86,6 +88,7 @@ function Test-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing managed account $AccountName" + if ($null -eq $CurrentValues) { return $false } return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("AccountName", "Schedule","PreExpireDays","EmailNotification") } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 index f43e09460..52d25f9b2 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 @@ -15,13 +15,19 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin + try { - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName MMS + $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue + if ($null -eq $serviceApps) { + return $null + } + $serviceApp = $serviceApps | Where-Object { $_.TypeName -eq "Managed Metadata Service" } If ($null -eq $serviceApp) { - return @{} + return $null } else { @@ -36,7 +42,7 @@ function Get-TargetResource } catch { - return @{ } + return $null } } return $result @@ -61,20 +67,19 @@ function Set-TargetResource Write-Verbose -Message "Creating Managed Metadata Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } - $app = Invoke-xSharePointSPCmdlet -CmdletName "New-SPMetadataServiceApplication" -Arguments $params + $app = New-SPMetadataServiceApplication @params if ($null -ne $app) { - Invoke-xSharePointSPCmdlet -CmdletName "New-SPMetadataServiceApplicationProxy" -Arguments @{ - Name = ($params.Name + " Proxy") - ServiceApplication = $app - DefaultProxyGroup = $true - ContentTypePushdownEnabled = $true - DefaultKeywordTaxonomy = $true - DefaultSiteCollectionTaxonomy = $true - } + New-SPMetadataServiceApplicationProxy -Name ($params.Name + " Proxy") ` + -ServiceApplication $app ` + -DefaultProxyGroup $true ` + -ContentTypePushdownEnabled $true ` + -DefaultKeywordTaxonomy = $true ` + -DefaultSiteCollectionTaxonomy = $true } } } @@ -83,12 +88,11 @@ function Set-TargetResource Write-Verbose -Message "Updating Managed Metadata Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName MMS - Invoke-xSharePointSPCmdlet -CmdletName "Set-SPMetadataServiceApplication" -Arguments @{ - Identity = $serviceApp - ApplicationPool = (Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" -Arguments @{ Identity = $params.ApplicationPool } ) - } + $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object { $_.TypeName -eq "Managed Metadata Service" } + $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool + Set-SPMetadataServiceApplication -Identity $serviceApp -ApplicationPool $appPool } } } @@ -110,6 +114,7 @@ function Test-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for Managed Metadata Service Application '$Name'" + if ($null -eq $CurrentValues) { return $false } return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("ApplicationPool") } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 index c685475ef..f9f51a59e 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 @@ -15,13 +15,17 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin + $getParams = @{ Identity = $params.RelativeUrl } if ($params.HostHeader) { $getParams.Add("HostHeader", $true) + } else { + $getParams.Add("WebApplication", $params.WebAppUrl) } - $path = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPManagedPath" -Arguments $getParams -ErrorAction SilentlyContinue + $path = Get-SPManagedPath @getParams -ErrorAction SilentlyContinue if ($null -eq $path) { return $null } return @{ @@ -52,6 +56,7 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin $path = Get-TargetResource @params -ErrorAction SilentlyContinue @@ -69,7 +74,7 @@ function Set-TargetResource $newParams.Add("RelativeURL", $params.RelativeUrl) $newParams.Add("Explicit", $params.Explicit) - Invoke-xSharePointSPCmdlet -CmdletName "New-SPManagedPath" -Arguments $newParams + New-SPManagedPath @newParams } } } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 index 04a63ca48..43af1b72c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 @@ -15,22 +15,25 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName Search - - If ($null -eq $serviceApp) - { - return @{} + $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue + if ($null -eq $serviceApps) { + return $null } - else - { - return @{ + $serviceApp = $serviceApps | Where-Object { $_.TypeName -eq "Search Service Application" } + + If ($null -eq $serviceApp) { + return $null + } else { + $returnVal = @{ Name = $serviceApp.DisplayName ApplicationPool = $serviceApp.ApplicationPool.Name DatabaseName = $serviceApp.Database.Name DatabaseServer = $serviceApp.Database.Server.Name InstallAccount = $params.InstallAccount } + return $returnVal } } return $result @@ -48,37 +51,33 @@ function Set-TargetResource [parameter(Mandatory = $false)] [System.String] $DatabaseName, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) - $result = Get-TargetResource @PSBoundParameters - if ($result.Count -eq 0) { + if ($result -eq $null) { Write-Verbose -Message "Creating Search Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } - $serviceInstance = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPEnterpriseSearchServiceInstance" -Arguments @{ Local = $true } - Invoke-xSharePointSPCmdlet -CmdletName "Start-SPEnterpriseSearchServiceInstance" -Arguments @{ Identity = $serviceInstance } -ErrorAction SilentlyContinue - $app = Invoke-xSharePointSPCmdlet -CmdletName "New-SPEnterpriseSearchServiceApplication" -Arguments $params + $serviceInstance = Get-SPEnterpriseSearchServiceInstance -Local + Start-SPEnterpriseSearchServiceInstance -Identity $serviceInstance -ErrorAction SilentlyContinue + $app = New-SPEnterpriseSearchServiceApplication @params if ($app) { - Invoke-xSharePointSPCmdlet -CmdletName "New-SPEnterpriseSearchServiceApplicationProxy" -Arguments @{ - Name = "$($params.Name) Proxy" - SearchApplication = $app - } + New-SPEnterpriseSearchServiceApplicationProxy -Name "$($params.Name) Proxy" -SearchApplication $app } } - } - else { + } else { if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating Search Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName Search - Invoke-xSharePointSPCmdlet -CmdletName "Set-SPEnterpriseSearchServiceApplication" -Arguments @{ - Identity = $serviceApp - ApplicationPool = (Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" -Arguments @{ Identity = $params.ApplicationPool } ) - } + $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object { $_.TypeName -eq "Search Service Application" } + $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool + Set-SPEnterpriseSearchServiceApplication -Identity $serviceApp -ApplicationPool $appPool } } } @@ -100,6 +99,7 @@ function Test-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing Search service application '$Name'" + If ($null -eq $CurrentValues) { return $false } return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("ApplicationPool") } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 index 66c43cf81..26e402f6b 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 @@ -23,22 +23,25 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName SecureStore - - If ($null -eq $serviceApp) - { - return @{} + $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue + if ($null -eq $serviceApps) { + return $null } - else - { - return @{ + $serviceApp = $serviceApps | Where-Object { $_.TypeName -eq "Secure Store Service Application" } + + If ($null -eq $serviceApp) { + return $null + } else { + $returnVal = @{ Name = $serviceApp.DisplayName ApplicationPool = $serviceApp.ApplicationPool.Name DatabaseName = $serviceApp.Database.Name DatabaseServer = $serviceApp.Database.Server.Name InstallAccount = $params.InstallAccount } + return $returnVal } } return $result @@ -71,14 +74,23 @@ function Set-TargetResource Write-Verbose -Message "Creating Secure Store Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } - $app = Invoke-xSharePointSPCmdlet -CmdletName "New-SPSecureStoreServiceApplication" -Arguments $params - if ($app) { - Invoke-xSharePointSPCmdlet -CmdletName "New-SPSecureStoreServiceApplicationProxy" -Arguments @{ - Name = "$($params.Name) Proxy" - ServiceApplication = $app + switch((Get-xSharePointInstalledProductVersion).FileMajorPart) { + 15 { + $app = New-SPSecureStoreServiceApplication @params + } + 16 { + $app = New-SPSecureStoreServiceApplication @params -EnableMinDB:$false } + Default { + throw [Exception] "An unknown version of SharePoint (Major version $_) was detected. Only versions 15 (SharePoint 2013) or 16 (SharePoint 2016) are supported." + } + } + if ($app) { + New-SPSecureStoreServiceApplicationProxy -Name "$($params.Name) Proxy" -ServiceApplication $app } } } else { @@ -86,11 +98,20 @@ function Set-TargetResource Write-Verbose -Message "Updating Secure Store Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName SecureStore - Invoke-xSharePointSPCmdlet -CmdletName "Set-SPSecureStoreServiceApplication" -Arguments @{ - Identity = $serviceApp - ApplicationPool = (Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" -Arguments @{ Identity = $params.ApplicationPool } ) + Initialize-xSharePointPSSnapin + + $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object { $_.TypeName -eq "Secure Store Service Application" } + $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool + switch((Get-xSharePointInstalledProductVersion).FileMajorPart) { + 15 { + Set-SPSecureStoreServiceApplication -Identity $serviceApp -ApplicationPool $appPool + } + 16 { + Set-SPSecureStoreServiceApplication -Identity $serviceApp -ApplicationPool $appPool -EnableMinDB:$false + } + Default { + throw [Exception] "An unknown version of SharePoint (Major version $_) was detected. Only versions 15 (SharePoint 2013) or 16 (SharePoint 2016) are supported." + } } } } @@ -121,6 +142,7 @@ function Test-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing secure store service application $Name" + if ($null -eq $CurrentValues) { return $false } return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("ApplicationPool") } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 index 6144d43ff..cf028547e 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 @@ -13,9 +13,10 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin - $sap = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue - if ($null -eq $sap) { return @{} } + $sap = Get-SPServiceApplicationPool -Identity $params.Name -ErrorAction SilentlyContinue + if ($null -eq $sap) { return $null } return @{ Name = $sap.Name @@ -41,19 +42,14 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin - $sap = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplicationPool" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue + $sap = Get-SPServiceApplicationPool -Identity $params.Name -ErrorAction SilentlyContinue if ($null -eq $sap) { - Invoke-xSharePointSPCmdlet -CmdletName "New-SPServiceApplicationPool" -Arguments @{ - Name = $params.Name - Account = $params.ServiceAccount - } + New-SPServiceApplicationPool -Name $params.Name -Account $params.ServiceAccount } else { if ($sap.ProcessAccountName -ne $params.ServiceAccount) { - Invoke-xSharePointSPCmdlet -CmdletName "Set-SPServiceApplicationPool" -Arguments @{ - Identity = $params.Name - Account = $params.ServiceAccount - } + Set-SPServiceApplicationPool -Identity $params.Name -Account $params.ServiceAccount } } } @@ -73,6 +69,7 @@ function Test-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing service application pool '$Name'" + if ($null -eq $CurrentValues) { return $false } return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("ServiceAccount") } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 index b11621860..024b0b74b 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 @@ -13,9 +13,14 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin - $si = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Server = $env:COMPUTERNAME } | Where-Object { $_.TypeName -eq $params.Name } - if ($null -eq $si) { return @{} } + $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq $params.Name } + if ($null -eq $si) { return @{ + Name = $params.Name + Ensure = "Absent" + InstallAccount = $params.InstallAccount + } } if ($si.Status -eq "Online") { $localEnsure = "Present" } else { $localEnsure = "Absent" } return @{ @@ -43,20 +48,26 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin - $si = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Server = $env:COMPUTERNAME } | Where-Object { $_.TypeName -eq $params.Name } - if ($null -eq $si) { return $false } - Invoke-xSharePointSPCmdlet -CmdletName "Start-SPServiceInstance" -Arguments @{ Identity = $si } + $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq $params.Name } + if ($null -eq $si) { + throw [Exception] "Unable to locate service application '$($params.Name)'" + } + Start-SPServiceInstance -Identity $si } } else { Write-Verbose -Message "Deprovioning service instance '$Name'" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin - $si = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Server = $env:COMPUTERNAME } | Where-Object { $_.TypeName -eq $params.Name } - if ($null -eq $si) { return $false } - Invoke-xSharePointSPCmdlet -CmdletName "Stop-SPServiceInstance" -Arguments @{ Identity = $si } + $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq $params.Name } + if ($null -eq $si) { + throw [Exception] "Unable to locate service application '$($params.Name)'" + } + Stop-SPServiceInstance -Identity $si } } } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 index 071f3ba30..c4ccb2ae8 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 @@ -24,10 +24,12 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $site = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPSite" -Arguments @{ Identity = $params.Url } -ErrorAction SilentlyContinue + Initialize-xSharePointPSSnapin + + $site = Get-SPSite -Identity $params.Url -ErrorAction SilentlyContinue if ($null -eq $site) { - return @{} + return $null } else { if ($site.HostHeaderIsSiteName) { $HostHeaderWebApplication = $site.WebApplication.Url } @@ -35,7 +37,7 @@ function Get-TargetResource $owner = $null } else { if ($site.WebApplication.UseClaimsAuthentication) { - $owner = (Invoke-xSharePointSPCmdlet -CmdletName "New-SPClaimsPrincipal" -Arguments @{ Identity = $site.Owner.UserLogin; IdentityType = "EncodedClaim" }).Value + $owner = (New-SPClaimsPrincipal -Identity $site.Owner.UserLogin -IdentityType "EncodedClaim").Value } else { $owner = $site.Owner.UserLogin } @@ -45,7 +47,7 @@ function Get-TargetResource $secondaryOwner = $null } else { if ($site.WebApplication.UseClaimsAuthentication) { - $secondaryOwner = (Invoke-xSharePointSPCmdlet -CmdletName "New-SPClaimsPrincipal" -Arguments @{ Identity = $site.SecondaryContact.UserLogin; IdentityType = "EncodedClaim" }).Value + $secondaryOwner = (New-SPClaimsPrincipal -Identity $site.SecondaryContact.UserLogin -IdentityType "EncodedClaim").Value } else { $secondaryOwner = $site.SecondaryContact.UserLogin } @@ -98,12 +100,14 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin + $params.Remove("InstallAccount") | Out-Null - $site = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPSite" -Arguments @{ Identity = $params.Url } -ErrorAction SilentlyContinue + $site = Get-SPSite -Identity $params.Url -ErrorAction SilentlyContinue if ($null -eq $site) { - Invoke-xSharePointSPCmdlet -CmdletName "New-SPSite" -Arguments $params | Out-Null + New-SPSite @params | Out-Null } } } @@ -133,6 +137,7 @@ function Test-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing site collection $Url" + if ($null -eq $CurrentValues) { return $false } return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("Url") } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 index d8a211046..b33990c45 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 @@ -5,7 +5,7 @@ function Get-TargetResource param ( [parameter(Mandatory = $true)] [System.String] $Name, - [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $true)] [System.String] $DatabaseName, [parameter(Mandatory = $false)] [System.String] $DatabaseServer, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount @@ -15,10 +15,11 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin - $serviceApp = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPStateServiceApplication" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue + $serviceApp = Get-SPStateServiceApplication -Identity $params.Name -ErrorAction SilentlyContinue - if ($null -eq $serviceApp) { return @{} } + if ($null -eq $serviceApp) { return $null } return @{ Name = $serviceApp.DisplayName @@ -37,7 +38,7 @@ function Set-TargetResource param ( [parameter(Mandatory = $true)] [System.String] $Name, - [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $true)] [System.String] $DatabaseName, [parameter(Mandatory = $false)] [System.String] $DatabaseServer, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount @@ -47,8 +48,9 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin - $app = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPStateServiceApplication" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue + $app = Get-SPStateServiceApplication -Identity $params.Name -ErrorAction SilentlyContinue if ($null -eq $app) { $dbParams = @{} @@ -56,9 +58,9 @@ function Set-TargetResource if ($params.ContainsKey("DatabaseServer")) { $dbParams.Add("DatabaseServer", $params.DatabaseServer) } if ($params.ContainsKey("DatabaseCredentials")) { $dbParams.Add("DatabaseCredentials", $params.DatabaseCredentials) } - $database = Invoke-xSharePointSPCmdlet -CmdletName "New-SPStateServiceDatabase" -Arguments $dbParams - $app = Invoke-xSharePointSPCmdlet -CmdletName "New-SPStateServiceApplication" -Arguments @{ Name = $params.Name; Database = $database } - Invoke-xSharePointSPCmdlet -CmdletName "New-SPStateServiceApplicationProxy" -Arguments @{ ServiceApplication = $app; DefaultProxyGroup = $true } + $database = New-SPStateServiceDatabase @dbParams + $app = New-SPStateServiceApplication -Name $params.Name -Database $database + New-SPStateServiceApplicationProxy -ServiceApplication $app -DefaultProxyGroup | Out-Null } } } @@ -71,7 +73,7 @@ function Test-TargetResource param ( [parameter(Mandatory = $true)] [System.String] $Name, - [parameter(Mandatory = $false)] [System.String] $DatabaseName, + [parameter(Mandatory = $true)] [System.String] $DatabaseName, [parameter(Mandatory = $false)] [System.String] $DatabaseServer, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $DatabaseCredentials, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount @@ -79,6 +81,7 @@ function Test-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for state service application $Name" + if ($null -eq $CurrentValues) { return $false } return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("Name") } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.schema.mof index 83324d67e..c068a9051 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.schema.mof @@ -3,7 +3,7 @@ class MSFT_xSPStateServiceApp : OMI_BaseResource { [Key] string Name; [Write, EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; - [Write] string DatabaseName; + [Required] string DatabaseName; [Write] string DatabaseServer; [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 index 6ceb37fc5..e9ea867a5 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 @@ -21,16 +21,21 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName Usage + $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue + if ($null -eq $serviceApps) { + return $null + } + $serviceApp = $serviceApps | Where-Object { $_.TypeName -eq "Usage and Health Data Collection Service Application" } If ($null -eq $serviceApp) { - return @{} + return $null } else { - $service = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPUsageService" + $service = Get-SPUsageService return @{ Name = $serviceApp.DisplayName InstallAccount = $params.InstallAccount @@ -70,12 +75,13 @@ function Set-TargetResource Write-Verbose -Message "Setting usage application $Name" - Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - $params = $args[0] - - $app = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplication" -Arguments @{ Name = $params.Name } -ErrorAction SilentlyContinue + $CurrentState = Get-TargetResource @PSBoundParameters - if ($null -eq $app) { + if ($null -eq $CurrentState) { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + $params = $args[0] + Initialize-xSharePointPSSnapin + $newParams = @{} $newParams.Add("Name", $params.Name) if ($params.ContainsKey("DatabaseName")) { $newParams.Add("DatabaseName", $params.DatabaseName) } @@ -84,20 +90,22 @@ function Set-TargetResource if ($params.ContainsKey("DatabaseUsername")) { $newParams.Add("DatabaseUsername", $params.DatabaseUsername) } if ($params.ContainsKey("FailoverDatabaseServer")) { $newParams.Add("FailoverDatabaseServer", $params.FailoverDatabaseServer) } - Invoke-xSharePointSPCmdlet -CmdletName "New-SPUsageApplication" -Arguments $newParams + New-SPUsageApplication @newParams } } Write-Verbose -Message "Configuring usage application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin + $setParams = @{} $setParams.Add("LoggingEnabled", $true) if ($params.ContainsKey("UsageLogCutTime")) { $setParams.Add("UsageLogCutTime", $params.UsageLogCutTime) } if ($params.ContainsKey("UsageLogLocation")) { $setParams.Add("UsageLogLocation", $params.UsageLogLocation) } if ($params.ContainsKey("UsageLogMaxFileSizeKB")) { $setParams.Add("UsageLogMaxFileSizeKB", $params.UsageLogMaxFileSizeKB) } if ($params.ContainsKey("UsageLogMaxSpaceGB")) { $setParams.Add("UsageLogMaxSpaceGB", $params.UsageLogMaxSpaceGB) } - Invoke-xSharePointSPCmdlet -CmdletName "Set-SPUsageService" -Arguments $setParams + Set-SPUsageService @setParams } } @@ -123,6 +131,7 @@ function Test-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for usage application '$Name'" + if ($null -eq $CurrentValues) { return $false } return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("UsageLogCutTime", "UsageLogLocation", "UsageLogMaxFileSizeKB", "UsageLogMaxSpaceGB") } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 index 516eae2ac..296834a8c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 @@ -21,27 +21,22 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName UserProfile + $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue + if ($null -eq $serviceApps) { + return $null + } + $serviceApp = $serviceApps | Where-Object { $_.TypeName -eq "User Profile Service Application" } If ($null -eq $serviceApp) { - return @{} + return $null } else { - $propData = $serviceApp.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic) - - $socialProp = $propData | Where-Object {$_.Name -eq "SocialDatabase"} - $socialDB = $socialProp.GetValue($serviceApp) - - $profileProp = $propData | Where-Object {$_.Name -eq "ProfileDatabase"} - $profileDB = $profileProp.GetValue($serviceApp) - - $syncProp = $propData | Where-Object {$_.Name -eq "SynchronizationDatabase"} - $syncDB = $syncProp.GetValue($serviceApp) - - $spFarm = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFarm" + $databases = Get-UserProfileServiceProperties $serviceApp + $spFarm = Get-SPFarm if ($params.FarmAccount.UserName -eq $spFarm.DefaultServiceAccount.Name) { $farmAccount = $params.FarmAccount @@ -54,12 +49,12 @@ function Get-TargetResource ApplicationPool = $serviceApp.ApplicationPool.Name FarmAccount = $farmAccount MySiteHostLocation = $params.MySiteHostLocation - ProfileDBName = $profileProp.Name - ProfileDBServer = $profileProp.Server.Name - SocialDBName = $socialDB.Name - SocialDBServer = $socialDB.Server.Name - SyncDBName = $syncDB.Name - SyncDBServer = $syncDB.Server.Name + ProfileDBName = $databases.ProfileDatabase.Name + ProfileDBServer = $databases.ProfileDatabase.Server.Name + SocialDBName = $databases.SocialDatabase.Name + SocialDBServer = $databases.SocialDatabase.Server.Name + SyncDBName = $databases.SynchronizationDatabase.Name + SyncDBServer = $databases.SynchronizationDatabase.Server.Name InstallAccount = $params.InstallAccount } } @@ -67,6 +62,27 @@ function Get-TargetResource return $result } +function Get-UserProfileServiceProperties() { + [CmdletBinding()] + [OutputType([System.Collections.Hashtable])] + param + ( + [parameter(Mandatory = $true)] [System.String] $serviceApp + ) + $results = @{} + $propData = $serviceApp.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic) + + $socialProp = $propData | Where-Object {$_.Name -eq "SocialDatabase"} + $results.Add("SocialDatabase", $socialProp.GetValue($serviceApp)) + + $profileProp = $propData | Where-Object {$_.Name -eq "ProfileDatabase"} + $results.Add("ProfileDatabase", $profileProp.GetValue($serviceApp)) + + $syncProp = $propData | Where-Object {$_.Name -eq "SynchronizationDatabase"} + $results.Add("SynchronizationDatabase", $syncProp.GetValue($serviceApp)) + + return $results +} function Set-TargetResource { @@ -98,21 +114,19 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $FarmAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } $params.Remove("FarmAccount") | Out-Null $params = Rename-xSharePointParamValue -params $params -oldName "SyncDBName" -newName "ProfileSyncDBName" $params = Rename-xSharePointParamValue -params $params -oldName "SyncDBServer" -newName "ProfileSyncDBServer" - $serviceApp = Get-xSharePointServiceApplication -Name $params.Name -TypeName UserProfile - if ($null -eq $serviceApp) { - $app = Invoke-xSharePointSPCmdlet -CmdletName "New-SPProfileServiceApplication" -Arguments $params + $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue + if ($null -eq $serviceApps) { + $app = New-SPProfileServiceApplication @params if ($null -ne $app) { - Invoke-xSharePointSPCmdlet -CmdletName "New-SPProfileServiceApplicationProxy" -Arguments @{ - Name = "$($params.Name) Proxy" - ServiceApplication = $app - DefaultProxyGroup = $true - } + New-SPProfileServiceApplicationProxy -Name "$($params.Name) Proxy" -ServiceApplication $app -DefaultProxyGroup } } } @@ -146,7 +160,8 @@ function Test-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for user profile service application $Name" - return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("ApplicationPool") + if ($null -eq $CurrentValues) { return $false } + return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("Name") } Export-ModuleMember -Function *-TargetResource diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 index 24bbf1415..00ecf09a5 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 @@ -13,23 +13,28 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin - $syncService = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Server = $env:COMPUTERNAME } | Where-Object { $_.TypeName -eq (Get-xSharePointServiceApplicationName -Name UserProfileSync) } - - if ($syncService.UserProfileApplicationGuid -ne [Guid]::Empty) { - $upa = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Identity = $syncService.UserProfileApplicationGuid } -ErrorAction SilentlyContinue - } - if ($null -eq $syncService) { return @{} } + $syncService = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq "User Profile Synchronization Service" } + if ($null -eq $syncService) { return @{ + UserProfileServiceAppName = $params.UserProfileServiceAppName + Ensure = "Absent" + FarmAccount = $params.FarmAccount + InstallAccount = $params.InstallAccount + } } + if ($syncService.UserProfileApplicationGuid -ne $null -and $syncService.UserProfileApplicationGuid -ne [Guid]::Empty) { + $upa = Get-SPServiceInstance -Identity $syncService.UserProfileApplicationGuid -ErrorAction SilentlyContinue + } if ($syncService.Status -eq "Online") { $localEnsure = "Present" } else { $localEnsure = "Absent" } - $spFarm = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFarm" + $spFarm = Get-SPFarm - if ($params.FarmAccount.UserName -eq $spFarm.DefaultServiceAccount.Name) { - $farmAccount = $params.FarmAccount - } else { - $farmAccount = $spFarm.DefaultServiceAccount.Name - } + if ($params.FarmAccount.UserName -eq $spFarm.DefaultServiceAccount.Name) { + $farmAccount = $params.FarmAccount + } else { + $farmAccount = $spFarm.DefaultServiceAccount.Name + } return @{ UserProfileServiceAppName = $upa.Name @@ -69,20 +74,20 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $FarmAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin - $syncService = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Server = $env:COMPUTERNAME } | Where-Object { $_.TypeName -eq (Get-xSharePointServiceApplicationName -Name UserProfileSync) } + $syncService = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq "User Profile Synchronization Service" } # Start the Sync service if it should be running on this server if (($params.Ensure -eq "Present") -and ($syncService.Status -ne "Online")) { - Set-xSharePointUserProfileSyncMachine -UserProfileServiceAppName $params.UserProfileServiceAppName -SyncServiceId $syncService.ID -FarmAccount $params.FarmAccount - Invoke-xSharePointSPCmdlet -CmdletName "Start-SPServiceInstance" -Arguments @{ Identity = $syncService.ID } + Start-SPServiceInstance -Identity $syncService.ID $desiredState = "Online" } # Stop the Sync service in all other cases else { - Invoke-xSharePointSPCmdlet -CmdletName "Stop-SPServiceInstance" -Arguments @{ Identity = $syncService.ID; Confirm = $false } + Stop-SPServiceInstance -Identity $syncService.ID -Confirm:$false $desiredState = "Disabled" } @@ -92,7 +97,7 @@ function Set-TargetResource while (($count -lt $maxCount) -and ($syncService.Status -ne $desiredState)) { # Get the current status of the Sync service - $syncService = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" -Arguments @{ Server = $env:COMPUTERNAME } | Where-Object { $_.TypeName -eq (Get-xSharePointServiceApplicationName -Name UserProfileSync) } + $syncService = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq "User Profile Synchronization Service" } if ($syncService.Status -ne $desiredState) { Start-Sleep -Seconds 60 } $count++ diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 index 26d68d859..e61dc48a5 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 @@ -22,11 +22,12 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + Initialize-xSharePointPSSnapin - $wa = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue - if ($null -eq $wa) { return @{} } + $wa = Get-SPWebApplication -Identity $params.Name -ErrorAction SilentlyContinue + if ($null -eq $wa) { return $null } - $authProvider = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPAuthenticationProvider" -Arguments @{ WebApplication = $wa.Url; Zone = "Default" } + $authProvider = Get-SPAuthenticationProvider -WebApplication $wa.Url -Zone "Default" if ($authProvider.DisableKerberos -eq $true) { $localAuthMode = "NTLM" } else { $localAuthMode = "Kerberos" } @@ -72,29 +73,27 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - - if ($AuthenticationMethod -eq "NTLM") { - $ap = Invoke-xSharePointSPCmdlet -CmdletName "New-SPAuthenticationProvider" -Arguments @{ - UseWindowsIntegratedAuthentication = $true - DisableKerberos = $true - } - } else { - $ap = Invoke-xSharePointSPCmdlet -CmdletName "New-SPAuthenticationProvider" -Arguments @{ - UseWindowsIntegratedAuthentication = $true + Initialize-xSharePointPSSnapin + + $wa = Get-SPWebApplication -Identity $params.Name -ErrorAction SilentlyContinue + if ($null -eq $wa) { + if ($params.ContainsKey("AuthenticationMethod") -eq $true) { + if ($params.AuthenticationMethod -eq "NTLM") { + $ap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication -DisableKerberos + } else { + $ap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication + } + $params.Remove("AuthenticationMethod") + $params.Add("AuthenticationProvider", $ap) } - } - $params.Add("AuthenticationProvider", $ap) - - $wa = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPWebApplication" -Arguments @{ Identity = $params.Name } -ErrorAction SilentlyContinue - if ($null -eq $wa) { + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } - if ($params.ContainsKey("AuthenticationMethod")) { $params.Remove("AuthenticationMethod") | Out-Null } if ($params.ContainsKey("AllowAnonymous")) { $params.Remove("AllowAnonymous") | Out-Null $params.Add("AllowAnonymousAccess", $true) } - Invoke-xSharePointSPCmdlet -CmdletName "New-SPWebApplication" -Arguments $params + New-SPWebApplication @params } } } @@ -122,6 +121,7 @@ function Test-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for web application '$Name'" + if ($null -eq $CurrentValues) { return $false } return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("ApplicationPool") } diff --git a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 index 7bb49b1da..c77b28fee 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 @@ -10,62 +10,41 @@ function Add-xSharePointDistributedCacheServer() { [System.String] $ServiceAccount ) + Initialize-xSharePointPSSnapin - Invoke-xSharePointSPCmdlet -CmdletName "Add-SPDistributedCacheServiceInstance" - Invoke-xSharePointSPCmdlet -CmdletName "Update-SPDistributedCacheSize" -Arguments @{ CacheSizeInMB = $CacheSizeInMB } + Add-SPDistributedCacheServiceInstance + Update-SPDistributedCacheSize -CacheSizeInMB $CacheSizeInMB - $farm = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPFarm" - $cacheService = $farm.Services | Where-Object {$_.Name -eq "AppFabricCachingService"} + $farm = Get-SPFarm + $cacheService = $farm.Services | Where-Object { $_.Name -eq "AppFabricCachingService" } $cacheService.ProcessIdentity.CurrentIdentityType = "SpecificUser" - $account = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPManagedAccount" -Arguments @{ Identity = $ServiceAccount } + + $account = Get-SPManagedAccount -Identity $ServiceAccount $cacheService.ProcessIdentity.ManagedAccount = $account - $cacheService.ProcessIdentity.Update() - $cacheService.ProcessIdentity.Deploy() -} -function Remove-xSharePointDistributedCacheServer() { - $instanceName ="SPDistributedCacheService Name=AppFabricCachingService" - $serviceInstance = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceInstance" | Where-Object {($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq $env:computername} - $serviceInstance.Delete() - Invoke-xSharePointSPCmdlet -CmdletName "Remove-SPDistributedCacheServiceInstance" + Update-xSharePointDistributedCacheService -CacheService $cacheService } -function Invoke-xSharePointDCCmdlet() { +function Update-xSharePointDistributedCacheService() { [CmdletBinding()] param ( [parameter(Mandatory = $true,Position=1)] - [string] - $CmdletName, - - [parameter(Mandatory = $false,Position=2)] - [HashTable] - $Arguments + [object] + $CacheService ) + $CacheService.ProcessIdentity.Update() + $CacheService.ProcessIdentity.Deploy() +} - Write-Verbose "Preparing to execute SharePoint command - $CmdletName" - - if ($null -ne $Arguments -and $Arguments.Count -gt 0) { - $argumentsString = "" - $Arguments.Keys | ForEach-Object { - $argumentsString += "$($_): $($Arguments.$_); " - } - Write-Verbose "Arguments for $CmdletName - $argumentsString" - } - - if ($null -eq $Arguments) { - $script = ([scriptblock]::Create("$CmdletName; `$params = `$null")) - $result = Invoke-Command -ScriptBlock $script -NoNewScope - } else { - $script = ([scriptblock]::Create("`$params = `$args[0]; $CmdletName @params; `$params = `$null")) - $result = Invoke-Command -ScriptBlock $script -ArgumentList $Arguments -NoNewScope - } - return $result +function Remove-xSharePointDistributedCacheServer() { + $instanceName ="SPDistributedCacheService Name=AppFabricCachingService" + $serviceInstance = Get-SPServiceInstance | Where-Object { ($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq $env:computername } + $serviceInstance.Delete() + Remove-SPDistributedCacheServiceInstance } function Enable-xSharePointDCIcmpFireWallRule() { - Import-Module -Name NetSecurity - $firewallRule = Get-NetFirewallRule -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-In)" -ErrorAction SilentlyContinue if($null -eq $firewallRule) { New-NetFirewallRule -Name Allow_Ping -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-In)" -Description "Allow ICMPv4 ping" -Protocol ICMPv4 -IcmpType 8 -Enabled True -Profile Any -Action Allow @@ -74,8 +53,6 @@ function Enable-xSharePointDCIcmpFireWallRule() { } function Enable-xSharePointDCFireWallRule() { - Import-Module -Name NetSecurity - $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distributed Cache" -ErrorAction SilentlyContinue if($null -eq $firewallRule) { New-NetFirewallRule -Name "SPDistCache" -DisplayName "SharePoint Distributed Cache" -Protocol TCP -LocalPort 22233-22236 -Group "SharePoint" @@ -84,12 +61,10 @@ function Enable-xSharePointDCFireWallRule() { } function Disable-xSharePointDCFireWallRule() { - Import-Module -Name NetSecurity - $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distribute Cache" -ErrorAction SilentlyContinue - if($null -eq $firewallRule) { + if($null -ne $firewallRule) { Write-Verbose -Message "Disabling firewall rules." - Disable-NetFirewallRule -DisplayName -DisplayName "SharePoint Distribute Cache" + Disable-NetFirewallRule -DisplayName "SharePoint Distribute Cache" } } diff --git a/Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 b/Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 deleted file mode 100644 index 20ece3aa5..000000000 --- a/Modules/xSharePoint/Modules/xSharePoint.ServiceApplications/xSharePoint.ServiceApplications.psm1 +++ /dev/null @@ -1,39 +0,0 @@ -function Get-xSharePointServiceApplication() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - [string] - $Name, - - [parameter(Mandatory = $true,Position=2)] - [ValidateSet("BCS", "MMS", "Search", "SecureStore", "Usage", "UserProfile", "UserProfileSync")] - [string] - $TypeName - ) - - $serviceApps = Invoke-xSharePointSPCmdlet -CmdletName "Get-SPServiceApplication" -Arguments @{ Name = $Name } -ErrorAction SilentlyContinue - $serviceApp = $serviceApps | Where-Object { $_.TypeName -eq (Get-xSharePointServiceApplicationName -Name $TypeName) } - return $serviceApp -} - -function Get-xSharePointServiceApplicationName() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - [string] - $Name - ) - Switch($Name) { - "BCS" { return "Business Data Connectivity Service Application" } - "MMS" { return "Managed Metadata Service" } - "Search" { return "Search Service Application" } - "SecureStore" { return "Secure Store Service Application" } - "Usage" { return "Usage and Health Data Collection Service Application" } - "UserProfile" { return "User Profile Service Application" } - "UserProfileSync" { return "User Profile Synchronization Service" } - } -} - -Export-ModuleMember -Function * diff --git a/Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 b/Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 index db26e77f7..d052d5188 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 @@ -63,7 +63,11 @@ function Set-xSharePointUserProfileSyncMachine() { [PSCredential] $FarmAccount ) - $ups = Get-xSharePointServiceApplication -Name $UserProfileServiceAppName -TypeName UserProfile + $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue + if ($null -eq $serviceApps) { + return $null + } + $ups = $serviceApps | Where-Object { $_.TypeName -eq "User Profile Service Application" } $ups.SetSynchronizationMachine($env:COMPUTERNAME, $SyncServiceId, $FarmAccount.UserName, $FarmAccount.GetNetworkCredential().Password) } diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 956b6b43d..8be3d0114 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -31,7 +31,7 @@ function Invoke-xSharePointCommand() { } Write-Verbose "Executing as the local run as user $($Env:USERDOMAIN)\$($Env:USERNAME)" - $result = Invoke-Command @invokeArgs + $result = Invoke-Command @invokeArgs -Verbose return $result } else { if ($Credential.UserName.Split("\")[1] -eq $Env:USERNAME) { @@ -49,7 +49,7 @@ function Invoke-xSharePointCommand() { if ($session) { $invokeArgs.Add("Session", $session) } - $result = Invoke-Command @invokeArgs + $result = Invoke-Command @invokeArgs -Verbose if ($session) { Remove-PSSession $session } return $result diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1 index 2f600eaad..800950a2a 100644 --- a/Modules/xSharePoint/xSharePoint.psd1 +++ b/Modules/xSharePoint/xSharePoint.psd1 @@ -65,7 +65,6 @@ Description = 'This DSC module is used to deploy and configure SharePoint Server # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess NestedModules = @("modules\xSharePoint.CacheAccounts\xSharePoint.CacheAccounts.psm1", "modules\xSharePoint.DistributedCache\xSharePoint.DistributedCache.psm1", - "modules\xSharePoint.ServiceApplications\xSharePoint.ServiceApplications.psm1", "modules\xSharePoint.UserProfileService\xSharePoint.UserProfileService.psm1", "modules\xSharePoint.Util\xSharePoint.Util.psm1") @@ -79,10 +78,8 @@ CmdletsToExport = @("Add-xSharePointDistributedCacheServer", "Initialize-xSharePointPSSnapin", "Get-xSharePointInstalledProductVersion", "Invoke-xSharePointSPCmdlet", - "Invoke-xSharePointDCCmdlet", "Rename-xSharePointParamValue", "Update-xSharePointObject", - "Get-xSharePointServiceApplication", "Set-xSharePointCacheReaderPolicy", "Set-xSharePointCacheOwnerPolicy", "Enable-xSharePointDCIcmpFireWallRule", diff --git a/Modules/xSharePoint/xSharePoint.pssproj b/Modules/xSharePoint/xSharePoint.pssproj index b4031619c..f246942c2 100644 --- a/Modules/xSharePoint/xSharePoint.pssproj +++ b/Modules/xSharePoint/xSharePoint.pssproj @@ -77,7 +77,6 @@ - @@ -128,7 +127,6 @@ - diff --git a/Tests/Stubs/DistributedCache/DistributedCache.psm1 b/Tests/Stubs/DistributedCache/DistributedCache.psm1 new file mode 100644 index 000000000..48ff644a8 --- /dev/null +++ b/Tests/Stubs/DistributedCache/DistributedCache.psm1 @@ -0,0 +1,18 @@ +function Use-CacheCluster() { + +} + +function Get-CacheHost() { + +} + +function Get-AFCacheHostConfiguration() { +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${ComputerName}, + + [Parameter(ParameterSetName='Default', Mandatory=$true)] + [uint32] + ${CachePort}) +} \ No newline at end of file diff --git a/Tests/Stubs/SharePoint/15.0.4693.1000/Microsoft.SharePoint.PowerShell.psm1 b/Tests/Stubs/SharePoint/15.0.4693.1000/Microsoft.SharePoint.PowerShell.psm1 new file mode 100644 index 000000000..e9b7bbe93 --- /dev/null +++ b/Tests/Stubs/SharePoint/15.0.4693.1000/Microsoft.SharePoint.PowerShell.psm1 @@ -0,0 +1,20554 @@ +function Add-DatabaseToAvailabilityGroup { + [CmdletBinding(DefaultParameterSetName='Default')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${AGName}, + + [Parameter(ParameterSetName='Default', Mandatory=$true)] + [string] + ${DatabaseName}, + + [Parameter(ParameterSetName='AllDatabases', Mandatory=$true)] + [switch] + ${ProcessAllDatabases}, + + [string] + ${FileShare}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPAppDeniedEndpoint { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${Endpoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPClaimTypeMapping { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${TrustedIdentityTokenIssuer}, + + [ValidateNotNull()] + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPDiagnosticsPerformanceCounter { + [CmdletBinding(DefaultParameterSetName='AddCounter', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='AddInstance', Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='AddCounter', Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)] + [string] + ${Category}, + + [Parameter(ParameterSetName='AddInstance', ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='AddCounter', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Counter}, + + [Parameter(ParameterSetName='AddInstance', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Instance}, + + [Parameter(ParameterSetName='AddCounter', ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='AddInstance', ValueFromPipelineByPropertyName=$true)] + [switch] + ${WebFrontEnd}, + + [Parameter(ParameterSetName='AddInstance', ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='AddCounter', ValueFromPipelineByPropertyName=$true)] + [switch] + ${DatabaseServer}, + + [Parameter(ParameterSetName='AddInstance', ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='AddCounter', ValueFromPipelineByPropertyName=$true)] + [switch] + ${AllInstances}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPDistributedCacheServiceInstance { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPEduClassMember { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${UserAlias}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${ClassId}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Role}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPEduUser { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${UserAlias}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Site}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Role}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${FirstName}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${LastName}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${UserEmail}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPInfoPathUserAgent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPPluggableSecurityTrimmer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNull()] + [guid] + ${UserProfileApplicationProxyId}, + + [Parameter(Mandatory=$true)] + [int] + ${PlugInId}, + + [string] + ${QualifiedTypeName}, + + [System.Collections.Specialized.NameValueCollection] + ${CustomProperties}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPProfileLeader { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SiteSubscription}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPProfileSyncConnection { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplication}, + + [Parameter(Mandatory=$true)] + [string] + ${ConnectionForestName}, + + [Parameter(Mandatory=$true)] + [string] + ${ConnectionDomain}, + + [Parameter(Mandatory=$true)] + [string] + ${ConnectionUserName}, + + [Parameter(Mandatory=$true)] + [securestring] + ${ConnectionPassword}, + + [string] + ${ConnectionServerName}, + + [int] + ${ConnectionPort}, + + [bool] + ${ConnectionUseSSL}, + + [bool] + ${ConnectionUseDisabledFilter}, + + [string] + ${ConnectionNamingContext}, + + [Parameter(Mandatory=$true)] + [string] + ${ConnectionSynchronizationOU}, + + [string] + ${ConnectionClaimProviderTypeValue}, + + [string] + ${ConnectionClaimProviderIdValue}, + + [string] + ${ConnectionClaimIDMapAttribute}, + + [bool] + ${ConnectionFilterOutUnlicensed}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPRoutingMachineInfo { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${RequestManagementSettings}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [ValidateNotNull()] + [object] + ${Availability}, + + [ValidateNotNull()] + [object] + ${OutgoingScheme}, + + [System.Nullable[int]] + ${OutgoingPort}, + + [ValidateNotNull()] + [System.Nullable[double]] + ${StaticWeight}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPRoutingMachinePool { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${RequestManagementSettings}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [ValidateNotNull()] + [object] + ${MachineTargets}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPRoutingRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${RequestManagementSettings}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [ValidateNotNull()] + [object] + ${Criteria}, + + [object] + ${MachinePool}, + + [ValidateNotNull()] + [System.Nullable[int]] + ${ExecutionGroup}, + + [ValidateNotNull()] + [System.Nullable[datetime]] + ${Expiration}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPScaleOutDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseName}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseFailoverServer}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPSecureStoreSystemAccount { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${AccountName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPServerScaleOutDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseName}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseFailoverServer}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPServiceApplicationProxyGroupMember { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1)] + [Alias('Proxy')] + [ValidateNotNull()] + [object] + ${Member}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPShellAdmin { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${UserName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${database}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPSiteSubscriptionFeaturePackMember { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${FeatureDefinition}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPSiteSubscriptionProfileConfig { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ParameterSetName='MySiteSettings', Mandatory=$true, ValueFromPipeline=$true)] + [Parameter(ValueFromPipeline=$true)] + [object] + ${MySiteHostLocation}, + + [Parameter(ParameterSetName='MySiteSettings', ValueFromPipeline=$true)] + [object] + ${MySiteManagedPath}, + + [Parameter(ParameterSetName='MySiteSettings')] + [ValidateSet('None','Resolve','Block')] + [string] + ${SiteNamingConflictResolution}, + + [string] + ${SynchronizationOU}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPSolution { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${LiteralPath}, + + [uint32] + ${Language}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPThrottlingRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${RequestManagementSettings}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [ValidateNotNull()] + [object] + ${Criteria}, + + [ValidateNotNull()] + [ValidateRange(0, 10)] + [System.Nullable[int]] + ${Threshold}, + + [ValidateNotNull()] + [System.Nullable[datetime]] + ${Expiration}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPUserLicenseMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true, ValueFromRemainingArguments=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${Mapping}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPUserSolution { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${LiteralPath}, + + [Parameter(Mandatory=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Backup-SPConfigurationDatabase { + [CmdletBinding(DefaultParameterSetName='DefaultSet')] +param( + [string] + ${DatabaseName}, + + [string] + ${DatabaseServer}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ParameterSetName='DefaultSet', Mandatory=$true)] + [string] + ${Directory}, + + [string] + ${Item}, + + [Parameter(ParameterSetName='ShowTree', Mandatory=$true)] + [switch] + ${ShowTree}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Backup-SPEnterpriseSearchServiceApplicationIndex { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='RunBackup', Mandatory=$true, Position=0)] + [int] + ${Phase}, + + [Parameter(ParameterSetName='AbortBackup', Mandatory=$true, Position=0)] + [switch] + ${Abort}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ParameterSetName='RunBackup', Mandatory=$true, Position=2)] + [string] + ${BackupFolder}, + + [Parameter(Mandatory=$true, Position=3)] + [string] + ${BackupHandleFile}, + + [Parameter(Position=4)] + [int] + ${Retries}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Backup-SPFarm { + [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='DefaultSet', Mandatory=$true)] + [string] + ${Directory}, + + [Parameter(ParameterSetName='DefaultSet', Mandatory=$true)] + [ValidateSet('Full','Differential','None')] + [string] + ${BackupMethod}, + + [Parameter(ParameterSetName='DefaultSet')] + [int] + ${BackupThreads}, + + [Parameter(ParameterSetName='DefaultSet')] + [switch] + ${Force}, + + [string] + ${Item}, + + [Parameter(ParameterSetName='ShowTree', Mandatory=$true)] + [switch] + ${ShowTree}, + + [switch] + ${ConfigurationOnly}, + + [Parameter(ParameterSetName='DefaultSet')] + [int] + ${Percentage}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Backup-SPSite { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [string] + ${Path}, + + [switch] + ${Force}, + + [switch] + ${UseSqlSnapshot}, + + [switch] + ${NoSiteLock}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPAppDeniedEndpointList { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPBusinessDataCatalogEntityNotificationWeb { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPDistributedCacheItem { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ContainerType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPLogLevel { + [CmdletBinding()] +param( + [string[]] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [psobject] + ${InputObject}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPMetadataWebServicePartitionData { + [CmdletBinding(DefaultParameterSetName='Default')] +param( + [Parameter(ParameterSetName='Default', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ServiceProxy}, + + [Parameter(ParameterSetName='ServiceContext', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPPerformancePointServiceApplicationTrustedLocation { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [object] + ${TrustedLocationType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPScaleOutDatabaseDeletedDataSubRange { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Range}, + + [Parameter(Mandatory=$true)] + [bool] + ${IsUpperSubRange}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPScaleOutDatabaseLog { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [int] + ${LogEntryTimeout}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPScaleOutDatabaseTenantData { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true)] + [guid] + ${SiteSubscriptionId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPSecureStoreCredentialMapping { + [CmdletBinding(DefaultParameterSetName='OneApplication', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='AllApplications', Mandatory=$true)] + [switch] + ${All}, + + [Parameter(ParameterSetName='OneApplication', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Principal}, + + [Parameter(ParameterSetName='AllApplications', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPSecureStoreDefaultProvider { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPServerScaleOutDatabaseDeletedDataSubRange { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Range}, + + [Parameter(Mandatory=$true)] + [bool] + ${IsUpperSubRange}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPServerScaleOutDatabaseLog { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [int] + ${LogEntryTimeout}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPServerScaleOutDatabaseTenantData { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true)] + [guid] + ${SiteSubscriptionId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPSiteSubscriptionBusinessDataCatalogConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Connect-SPConfigurationDatabase { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${DatabaseName}, + + [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(Mandatory=$true, Position=8, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [securestring] + ${Passphrase}, + + [Parameter(Position=9, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [switch] + ${SkipRegisterAsDistributedCacheHost}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Convert-SPWebApplication { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='Claims', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Claims', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateSet('LEGACY','CLAIMS-WINDOWS','CLAIMS-TRUSTED-DEFAULT')] + [string] + ${From}, + + [Parameter(ParameterSetName='Claims', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateSet('CLAIMS','CLAIMS-WINDOWS','CLAIMS-TRUSTED-DEFAULT','CLAIMS-SHAREPOINT-ONLINE')] + [string] + ${To}, + + [Parameter(ParameterSetName='Claims')] + [switch] + ${Force}, + + [Parameter(ParameterSetName='Claims')] + [switch] + ${RetainPermissions}, + + [Parameter(ParameterSetName='Claims')] + [string] + ${SourceSkipList}, + + [Parameter(ParameterSetName='Claims')] + [string] + ${MapList}, + + [Parameter(ParameterSetName='Claims')] + [switch] + ${SkipSites}, + + [Parameter(ParameterSetName='Claims')] + [switch] + ${SkipPolicies}, + + [Parameter(ParameterSetName='Claims')] + [object] + ${Database}, + + [Parameter(ParameterSetName='Claims')] + [object] + ${TrustedProvider}, + + [Parameter(ParameterSetName='Claims')] + [guid] + ${SiteSubsriptionId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Copy-SPAccessServicesDatabaseCredentials { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${AppUrl}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServiceContext}, + + [Parameter(Mandatory=$true)] + [string] + ${SourceServer}, + + [Parameter(Mandatory=$true)] + [string] + ${TargetServer}, + + [Parameter(Mandatory=$true)] + [System.Net.NetworkCredential] + ${ServerCredential}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Copy-SPActivitiesToWorkflowService { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${WorkflowServiceAddress}, + + [string] + ${ActivityName}, + + [System.Net.ICredentials] + ${Credential}, + + [bool] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Copy-SPBusinessDataCatalogAclToChildren { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${MetadataObject}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Copy-SPSite { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${Identity}, + + [object] + ${DestinationDatabase}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true)] + [string] + ${TargetUrl}, + + [string] + ${HostHeaderWebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPAppAutoProvision { + [CmdletBinding()] +param( + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPBusinessDataCatalogEntity { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPFeature { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Url}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPHealthAnalysisRule { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPInfoPathFormTemplate { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] + [Alias('Url')] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPSessionStateService { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPSingleSignOn { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ServerName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPTimerJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPUserLicensing { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPWebApplicationHttpThrottling { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disconnect-SPConfigurationDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Dismount-SPContentDatabase { + [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Dismount-SPStateServiceDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPAppAutoProvision { + [CmdletBinding()] +param( + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPBusinessDataCatalogEntity { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPFeature { + [CmdletBinding(DefaultParameterSetName='FarmFeatureDefinition', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='SiteFeature')] + [string] + ${Url}, + + [switch] + ${PassThru}, + + [switch] + ${Force}, + + [Parameter(ParameterSetName='FarmFeatureDefinition')] + [int] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPHealthAnalysisRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPInfoPathFormTemplate { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] + [Alias('url')] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPSessionStateService { + [CmdletBinding(DefaultParameterSetName='AdvancedProvision', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='DefaultProvision', Mandatory=$true)] + [switch] + ${DefaultProvision}, + + [Parameter(ParameterSetName='AdvancedProvision')] + [string] + ${DatabaseServer}, + + [Parameter(ParameterSetName='AdvancedProvision', Mandatory=$true)] + [string] + ${DatabaseName}, + + [System.Nullable[int]] + ${SessionTimeout}, + + [Parameter(ParameterSetName='AdvancedProvision')] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPTimerJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPUserLicensing { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPWebApplicationHttpThrottling { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPAppPackage { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${App}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPBusinessDataCatalogModel { + [CmdletBinding()] +param( + [switch] + ${ModelsIncluded}, + + [switch] + ${LocalizedNamesIncluded}, + + [switch] + ${PropertiesIncluded}, + + [switch] + ${ProxiesIncluded}, + + [switch] + ${PermissionsIncluded}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [string] + ${SettingId}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPEnterpriseSearchTopology { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [string] + ${Filename}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPInfoPathAdministrationFiles { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Path}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPMetadataWebServicePartitionData { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceProxy}, + + [switch] + ${NoCompression}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPPerformancePointContent { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [string] + ${ExportFileUrl}, + + [Parameter(Mandatory=$true)] + [array] + ${ItemUrls}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPScaleOutDatabaseTenantData { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${FilePath}, + + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true)] + [guid] + ${SiteSubscriptionId}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPServerScaleOutDatabaseTenantData { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${FilePath}, + + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true)] + [guid] + ${SiteSubscriptionId}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPSiteSubscriptionBusinessDataCatalogConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [switch] + ${Force}, + + [switch] + ${ModelsIncluded}, + + [switch] + ${LocalizedNamesIncluded}, + + [switch] + ${PropertiesIncluded}, + + [switch] + ${ProxiesIncluded}, + + [switch] + ${PermissionsIncluded}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPSiteSubscriptionSettings { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [switch] + ${AdminProperties}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPWeb { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${IncludeVersions}, + + [int] + ${CompressionSize}, + + [switch] + ${UseSqlSnapshot}, + + [string] + ${AppLogFilePath}, + + [string] + ${ItemUrl}, + + [Parameter(Mandatory=$true)] + [string] + ${Path}, + + [switch] + ${Force}, + + [switch] + ${IncludeUserSecurity}, + + [switch] + ${HaltOnWarning}, + + [switch] + ${HaltOnError}, + + [switch] + ${NoLogFile}, + + [switch] + ${NoFileCompression}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-AvailabilityGroupStatus { + [CmdletBinding()] +param( + [string] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAccessServiceApplication { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAccessServicesApplication { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAccessServicesDatabase { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Position=1, ValueFromPipeline=$true)] + [object] + ${ContentDb}, + + [Parameter(Position=2, ValueFromPipeline=$true)] + [bool] + ${AccessAppsOnly}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAccessServicesDatabaseServer { + [CmdletBinding(DefaultParameterSetName='GetDatabaseServersParameterSet')] +param( + [Parameter(ParameterSetName='GetSingleDatabaseServerParamterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='GetDatabaseServersParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceContext}, + + [Parameter(ParameterSetName='GetDatabaseServersParameterSet')] + [Parameter(ParameterSetName='GetSingleDatabaseServerParamterSet', Mandatory=$true)] + [object] + ${DatabaseServerGroup}, + + [Parameter(ParameterSetName='GetSingleDatabaseServerParamterSet', Mandatory=$true)] + [object] + ${DatabaseServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAccessServicesDatabaseServerGroup { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceContext}, + + [Parameter(Position=1, ValueFromPipeline=$true)] + [object] + ${DatabaseServerGroup}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAccessServicesDatabaseServerGroupMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAlternateURL { + [CmdletBinding(DefaultParameterSetName='Default')] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='WebApplication', Mandatory=$true)] + [object] + ${WebApplication}, + + [object] + ${Zone}, + + [Parameter(ParameterSetName='ResourceName', Mandatory=$true)] + [string] + ${ResourceName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppAcquisitionConfiguration { + [CmdletBinding(DefaultParameterSetName='MarketplaceSettingsInWebApplication')] +param( + [Parameter(ParameterSetName='MarketplaceSettingsInWebApplication', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='MarketplaceSettingsInSiteSubscription', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppAutoProvisionConnection { + [CmdletBinding()] +param( + [object] + ${SiteSubscription}, + + [object] + ${ConnectionType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppDeniedEndpointList { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppDisablingConfiguration { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppDomain { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppHostingQuotaConfiguration { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppInstance { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='IdentityParameterSet', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='WebParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Web}, + + [Parameter(ParameterSetName='WebParameterSet')] + [ValidateNotNull()] + [object] + ${App}, + + [Parameter(ParameterSetName='SiteAndIdParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [Parameter(ParameterSetName='SiteAndIdParameterSet', Mandatory=$true)] + [guid] + ${AppInstanceId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppPrincipal { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${NameIdentifier}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppScaleProfile { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppSiteSubscriptionName { + [CmdletBinding()] +param( + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppStateSyncLastRunTime { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppStateUpdateInterval { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppStoreConfiguration { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAuthenticationProvider { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(Mandatory=$true, Position=2)] + [object] + ${Zone}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAuthenticationRealm { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPBackupHistory { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [string] + ${Directory}, + + [switch] + ${ShowBackup}, + + [switch] + ${ShowRestore}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPBingMapsBlock { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPBingMapsKey { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPBrowserCustomerExperienceImprovementProgram { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='Farm', Mandatory=$true)] + [switch] + ${Farm}, + + [Parameter(ParameterSetName='WebApplication', Mandatory=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='SiteSubscription', Mandatory=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPBusinessDataCatalogEntityNotificationWeb { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPBusinessDataCatalogMetadataObject { + [CmdletBinding()] +param( + [string] + ${Namespace}, + + [string] + ${Name}, + + [string] + ${ContainingLobSystem}, + + [Parameter(Mandatory=$true)] + [object] + ${BdcObjectType}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPBusinessDataCatalogThrottleConfig { + [CmdletBinding(DefaultParameterSetName='ProxyProvided')] +param( + [Parameter(Mandatory=$true)] + [object] + ${Scope}, + + [Parameter(Mandatory=$true)] + [object] + ${ThrottleType}, + + [Parameter(ParameterSetName='ProxyProvided', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceApplicationProxy}, + + [Parameter(ParameterSetName='FileBackedProvided', Mandatory=$true)] + [switch] + ${FileBacked}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPCertificateAuthority { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPClaimProvider { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPClaimProviderManager { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPClaimTypeEncoding { + [CmdletBinding()] +param( + [char] + ${EncodingCharacter}, + + [ValidateNotNullOrEmpty()] + [string] + ${ClaimType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPContentDatabase { + [CmdletBinding(DefaultParameterSetName='DefaultSet')] +param( + [Parameter(ParameterSetName='DefaultSet', Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='AllContentDatabasesInWebApplication', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='ContentDatabasesOfSite', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [Parameter(ParameterSetName='Unattached', Mandatory=$true)] + [switch] + ${ConnectAsUnattachedDatabase}, + + [Parameter(ParameterSetName='Unattached')] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ParameterSetName='Unattached', Mandatory=$true)] + [string] + ${DatabaseServer}, + + [Parameter(ParameterSetName='Unattached', Mandatory=$true)] + [string] + ${DatabaseName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPContentDeploymentJob { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [object] + ${Path}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPContentDeploymentPath { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPCustomLayoutsPage { + [CmdletBinding()] +param( + [object] + ${Identity}, + + [ValidateRange(14, 15)] + [int] + ${CompatibilityLevel}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPDatabase { + [CmdletBinding(DefaultParameterSetName='DefaultParameterSet')] +param( + [Parameter(ParameterSetName='DefaultParameterSet', Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='ServerParameterSet', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServerInstance}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPDataConnectionFile { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPDataConnectionFileDependent { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPDeletedSite { + [CmdletBinding(DefaultParameterSetName='AllDeletedSitesInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='AllDeletedSitesInIdentity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Limit}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [string] + ${DateTimeFrom}, + + [string] + ${DateTimeTo}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPDesignerSettings { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='WebApplication', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPDiagnosticConfig { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPDiagnosticsPerformanceCounter { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [switch] + ${WebFrontEnd}, + + [Parameter(ValueFromPipeline=$true)] + [switch] + ${DatabaseServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPDiagnosticsProvider { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPDistributedCacheClientSetting { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ContainerType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEduServiceSetting { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [object] + ${Service}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchAdministrationComponent { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchComponent { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchTopology}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchContentEnrichmentConfiguration { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchCrawlContentSource { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchCrawlCustomConnector { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SearchApplication}, + + [string] + ${Protocol}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchCrawlDatabase { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchCrawlExtension { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchCrawlLogReadPermission { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SearchApplication}, + + [guid] + ${Tenant}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchCrawlMapping { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchCrawlRule { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchFileFormat { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchHostController { + [CmdletBinding()] +param( + [object] + ${SearchServiceInstance}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchLanguageResourcePhrase { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [object] + ${Type}, + + [string] + ${Language}, + + [string] + ${Mapping}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [guid] + ${SourceId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchLinguisticComponentsStatus { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchLinksDatabase { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchMetadataCategory { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchMetadataCrawledProperty { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Alias('p')] + [System.Nullable[guid]] + ${PropSet}, + + [Alias('vt')] + [Obsolete()] + [System.Nullable[int]] + ${VariantType}, + + [Alias('c')] + [object] + ${Category}, + + [string] + ${Limit}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchMetadataManagedProperty { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [string] + ${Limit}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchMetadataMapping { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [object] + ${ManagedProperty}, + + [object] + ${CrawledProperty}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchOwner { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [Alias('l')] + [object] + ${Level}, + + [object] + ${SPWeb}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchPropertyRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${PropertyName}, + + [Parameter(Mandatory=$true, Position=1)] + [object] + ${Operator}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchPropertyRuleCollection { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQueryAndSiteSettingsService { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [switch] + ${Local}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQueryAndSiteSettingsServiceProxy { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQueryAuthority { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQueryDemoted { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQueryKeyword { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQueryScope { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Alias('u')] + [uri] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQueryScopeRule { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [uri] + ${Url}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [Alias('n')] + [object] + ${Scope}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQuerySpellingCorrection { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQuerySuggestionCandidates { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [guid] + ${SourceId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchRankingModel { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchResultItemType { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchApplicationProxy}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchResultSource { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchSecurityTrimmer { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchService { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchServiceApplication { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchServiceApplicationBackupStore { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${BackupFolder}, + + [Parameter(Mandatory=$true, Position=1)] + [string] + ${Name}, + + [Parameter(Position=3, ValueFromPipeline=$true)] + [string] + ${BackupId}, + + [Parameter(Position=4)] + [switch] + ${UseMostRecent}, + + [Parameter(Position=5)] + [switch] + ${IsVerbose}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchServiceApplicationProxy { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchServiceInstance { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [switch] + ${Local}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchSiteHitRule { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchService}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchStatus { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [switch] + ${Primary}, + + [switch] + ${Text}, + + [switch] + ${Detailed}, + + [switch] + ${Constellation}, + + [switch] + ${JobStatus}, + + [switch] + ${HealthReport}, + + [switch] + ${DetailSearchRuntime}, + + [string] + ${Component}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchTopology { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [switch] + ${Active}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchVssDataPath { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPExcelBIServer { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPExcelBlockedFileType { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPExcelDataConnectionLibrary { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPExcelDataProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPExcelFileLocation { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPExcelServiceApplication { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPExcelUserDefinedFunction { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPFarm { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPFarmConfig { + [CmdletBinding()] +param( + [switch] + ${ServiceConnectionPoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPFeature { + [CmdletBinding(DefaultParameterSetName='Default')] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='FarmFeatures')] + [switch] + ${Farm}, + + [Parameter(ParameterSetName='SiteFeatures')] + [object] + ${Site}, + + [Parameter(ParameterSetName='WebFeatures')] + [object] + ${Web}, + + [Parameter(ParameterSetName='WebApplicationFeatures')] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='SiteFeatures')] + [switch] + ${Sandboxed}, + + [string] + ${Limit}, + + [Parameter(ParameterSetName='FarmFeatureDefinitions')] + [int] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPHealthAnalysisRule { + [CmdletBinding(DefaultParameterSetName='Default')] +param( + [Parameter(ParameterSetName='SpecificRule', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPHelpCollection { + [CmdletBinding()] +param( + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPInfoPathFormsService { + [CmdletBinding()] +param( + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPInfoPathFormTemplate { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPInfoPathUserAgent { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPInfoPathWebServiceProxy { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPInternalAppStateSyncLastRunTime { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPInternalAppStateUpdateInterval { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPIRMSettings { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPLogEvent { + [CmdletBinding(DefaultParameterSetName='Directory')] +param( + [Parameter(ParameterSetName='Directory')] + [ValidateNotNullOrEmpty()] + [string] + ${Directory}, + + [Parameter(ParameterSetName='File')] + [ValidateNotNullOrEmpty()] + [string] + ${File}, + + [switch] + ${AsString}, + + [ValidateNotNullOrEmpty()] + [string[]] + ${ContextKey}, + + [datetime] + ${StartTime}, + + [datetime] + ${EndTime}, + + [ValidateNotNullOrEmpty()] + [string] + ${MinimumLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPLogLevel { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [string[]] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPManagedAccount { + [CmdletBinding(DefaultParameterSetName='Service')] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Service', ValueFromPipeline=$true)] + [object] + ${Service}, + + [Parameter(ParameterSetName='WebApplication', ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='Server', ValueFromPipeline=$true)] + [object] + ${Server}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPManagedPath { + [CmdletBinding(DefaultParameterSetName='WebApplication')] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='WebApplication', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='HostHeader', Mandatory=$true)] + [switch] + ${HostHeader}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPMetadataServiceApplication { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPMetadataServiceApplicationProxy { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPMobileMessagingAccount { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [Alias('ServiceType','AccountType')] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPODataConnectionSetting { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [ValidateNotNull()] + [ValidateLength(0, 246)] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPODataConnectionSettingMetadata { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [ValidateLength(0, 255)] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPOfficeStoreAppsDefaultActivation { + [CmdletBinding(DefaultParameterSetName='AppsForOfficeSettingsInWebApplication')] +param( + [Parameter(ParameterSetName='AppsForOfficeSettingsInWebApplication', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='AppsForOfficeSettingsInSiteSubscription', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPPendingUpgradeActions { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${RootObject}, + + [switch] + ${Recursive}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPPerformancePointServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPPerformancePointServiceApplicationTrustedLocation { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPPluggableSecurityTrimmer { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNull()] + [guid] + ${UserProfileApplicationProxyId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPProcessAccount { + [CmdletBinding(DefaultParameterSetName='NetworkService')] +param( + [Parameter(ParameterSetName='NetworkService')] + [switch] + ${NetworkService}, + + [Parameter(ParameterSetName='LocalSystem')] + [switch] + ${LocalSystem}, + + [Parameter(ParameterSetName='LocalService')] + [switch] + ${LocalService}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPProduct { + [CmdletBinding(DefaultParameterSetName='Local')] +param( + [Parameter(ParameterSetName='Server', ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Server}, + + [Parameter(ParameterSetName='Local')] + [switch] + ${Local}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPProfileLeader { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPProfileServiceApplicationSecurity { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [ValidateSet('UserACL','MySiteReaderACL')] + [string] + ${Type}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPRequestManagementSettings { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPRoutingMachineInfo { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${RequestManagementSettings}, + + [ValidateNotNull()] + [string] + ${Name}, + + [ValidateNotNull()] + [object] + ${Availability}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPRoutingMachinePool { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${RequestManagementSettings}, + + [ValidateNotNull()] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPRoutingRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${RequestManagementSettings}, + + [ValidateNotNull()] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPScaleOutDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPScaleOutDatabaseDataState { + [CmdletBinding(DefaultParameterSetName='AttachedDatabase', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='AttachedDatabase', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [Parameter(ParameterSetName='UnattachedDatabase', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ConnectionString}, + + [Parameter(ParameterSetName='UnattachedDatabase')] + [switch] + ${IsAzureDatabase}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPScaleOutDatabaseInconsistency { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPScaleOutDatabaseLogEntry { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [Parameter(Mandatory=$true)] + [int] + ${Count}, + + [object] + ${MajorAction}, + + [System.Nullable[guid]] + ${CorrelationId}, + + [byte[]] + ${RangeLimitPoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSecureStoreApplication { + [CmdletBinding(DefaultParameterSetName='NameSet')] +param( + [Parameter(ParameterSetName='AllSet', Mandatory=$true)] + [switch] + ${All}, + + [Parameter(ParameterSetName='NameSet', Mandatory=$true)] + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSecureStoreSystemAccount { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSecurityTokenServiceConfig { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServer { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [Alias('Address')] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServerScaleOutDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServerScaleOutDatabaseDataState { + [CmdletBinding(DefaultParameterSetName='AttachedDatabase', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='AttachedDatabase', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [Parameter(ParameterSetName='UnattachedDatabase', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ConnectionString}, + + [Parameter(ParameterSetName='UnattachedDatabase')] + [switch] + ${IsAzureDatabase}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServerScaleOutDatabaseInconsistency { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServerScaleOutDatabaseLogEntry { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [Parameter(Mandatory=$true)] + [int] + ${Count}, + + [object] + ${MajorAction}, + + [System.Nullable[guid]] + ${CorrelationId}, + + [byte[]] + ${RangeLimitPoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServiceApplication { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServiceApplicationEndpoint { + [CmdletBinding(DefaultParameterSetName='Identity')] +param( + [Parameter(ParameterSetName='Identity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Name', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ParameterSetName='Name')] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServiceApplicationPool { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServiceApplicationProxy { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServiceApplicationProxyGroup { + [CmdletBinding(DefaultParameterSetName='Identity')] +param( + [Parameter(ParameterSetName='Identity', Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Default identity', Mandatory=$true)] + [switch] + ${Default}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServiceApplicationSecurity { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [switch] + ${Admin}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServiceContext { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='Site', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Site}, + + [Parameter(ParameterSetName='SiteSubscription', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServiceHostConfig { + [CmdletBinding()] +param( + [switch] + ${Default}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServiceInstance { + [CmdletBinding(DefaultParameterSetName='Identity')] +param( + [Parameter(ParameterSetName='Identity', Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Server', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Server}, + + [switch] + ${All}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSessionStateService { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPShellAdmin { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${database}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSite { + [CmdletBinding(DefaultParameterSetName='AllSitesInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='AllSitesInIdentity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Limit}, + + [Parameter(ParameterSetName='AllSitesInContentDB', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(ParameterSetName='AllSitesInWebApplication', ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='AllSitesInSiteSubscription', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ParameterSetName='AllSitesInIdentity')] + [switch] + ${Regex}, + + [scriptblock] + ${Filter}, + + [int] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteAdministration { + [CmdletBinding(DefaultParameterSetName='AllSitesInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='AllSitesInIdentity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Limit}, + + [Parameter(ParameterSetName='AllSitesInContentDB', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(ParameterSetName='AllSitesInWebApplication', ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='AllSitesInSiteSubscription', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ParameterSetName='AllSitesInIdentity')] + [switch] + ${Regex}, + + [scriptblock] + ${Filter}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteSubscription { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteSubscriptionConfig { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteSubscriptionEdiscoveryHub { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteSubscriptionEdiscoverySearchScope { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteSubscriptionFeaturePack { + [CmdletBinding(DefaultParameterSetName='FeaturePack')] +param( + [Parameter(ParameterSetName='FeaturePack', Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='SiteSubscription', ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteSubscriptionIRMConfig { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteSubscriptionMetadataConfig { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteUpgradeSessionInfo { + [CmdletBinding(DefaultParameterSetName='ContentDB')] +param( + [Parameter(ParameterSetName='Site', Mandatory=$true)] + [object] + ${Site}, + + [Parameter(ParameterSetName='ContentDB', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(ParameterSetName='ContentDB')] + [object] + ${SiteSubscription}, + + [Parameter(ParameterSetName='ContentDB')] + [switch] + ${HideWaiting}, + + [Parameter(ParameterSetName='ContentDB')] + [switch] + ${ShowInProgress}, + + [Parameter(ParameterSetName='ContentDB')] + [switch] + ${ShowCompleted}, + + [Parameter(ParameterSetName='ContentDB')] + [switch] + ${ShowFailed}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteURL { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSolution { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPStateServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPStateServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPStateServiceDatabase { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Default', Position=0, ValueFromPipeline=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(ParameterSetName='ServiceApplication', Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [Alias('Application')] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPTaxonomySession { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPThrottlingRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${RequestManagementSettings}, + + [ValidateNotNull()] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPTimerJob { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [ValidateNotNullOrEmpty()] + [string] + ${Type}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPTopologyServiceApplication { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPTopologyServiceApplicationProxy { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPTranslationThrottlingSetting { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [object] + ${Farm}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPTrustedIdentityTokenIssuer { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPTrustedRootAuthority { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPTrustedSecurityTokenIssuer { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPTrustedServiceTokenIssuer { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUpgradeActions { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUsageApplication { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${UsageService}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUsageDefinition { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUsageService { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUser { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [Alias('UserAlias')] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Web}, + + [object] + ${Group}, + + [string] + ${Limit}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUserLicense { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUserLicenseMapping { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='WebApplication', ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUserLicensing { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUserSettingsProvider { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUserSettingsProviderManager { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUserSolution { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPVisioExternalData { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${VisioServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPVisioPerformance { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${VisioServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPVisioSafeDataProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${VisioServiceApplication}, + + [string] + ${DataProviderId}, + + [int] + ${DataProviderType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPVisioServiceApplication { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPVisioServiceApplicationProxy { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWeb { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${Site}, + + [string] + ${Limit}, + + [switch] + ${Regex}, + + [scriptblock] + ${Filter}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWebApplication { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${IncludeCentralAdministration}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWebApplicationAppDomain { + [CmdletBinding(DefaultParameterSetName='Default')] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='WebApplication', Mandatory=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='ResourceName', Mandatory=$true)] + [string] + ${AppDomain}, + + [object] + ${Zone}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWebApplicationHttpThrottlingMonitor { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWebPartPack { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [switch] + ${GlobalOnly}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWebTemplate { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [uint32] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWOPIBinding { + [CmdletBinding()] +param( + [ValidateNotNullOrEmpty()] + [string] + ${Application}, + + [ValidateNotNullOrEmpty()] + [string] + ${Action}, + + [ValidateNotNullOrEmpty()] + [string] + ${Extension}, + + [ValidateNotNullOrEmpty()] + [string] + ${ProgId}, + + [ValidateNotNullOrEmpty()] + [string] + ${Server}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${WOPIZone}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWOPISuppressionSetting { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWOPIZone { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWorkflowConfig { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='WebApplication', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='SiteCollection', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWorkflowServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Grant-SPBusinessDataCatalogMetadataObject { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Principal}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${Right}, + + [string] + ${SettingId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Grant-SPObjectSecurity { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${Principal}, + + [Parameter(Mandatory=$true, Position=2)] + [ValidateNotNull()] + [string[]] + ${Rights}, + + [switch] + ${Replace}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPAppPackage { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [Parameter(Mandatory=$true)] + [object] + ${Source}, + + [string] + ${AssetId}, + + [string] + ${ContentMarket}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPBusinessDataCatalogDotNetAssembly { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [ValidateNotNullOrEmpty()] + [string[]] + ${DependentAssemblyPaths}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${LobSystem}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPBusinessDataCatalogModel { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [switch] + ${ModelsIncluded}, + + [switch] + ${LocalizedNamesIncluded}, + + [switch] + ${PropertiesIncluded}, + + [switch] + ${PermissionsIncluded}, + + [Parameter(ParameterSetName='Catalog', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='ServiceContext', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [switch] + ${Force}, + + [string] + ${SettingId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPEnterpriseSearchCustomExtractionDictionary { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true, HelpMessage='Specify the UNC path to the CSV file.')] + [string] + ${FileName}, + + [Parameter(Mandatory=$true, HelpMessage='Specify the fully qualified name of the target dictionary to be deployed.')] + [ValidateSet('Microsoft.UserDictionaries.EntityExtraction.Custom.Word.1','Microsoft.UserDictionaries.EntityExtraction.Custom.Word.2','Microsoft.UserDictionaries.EntityExtraction.Custom.Word.3','Microsoft.UserDictionaries.EntityExtraction.Custom.Word.4','Microsoft.UserDictionaries.EntityExtraction.Custom.Word.5','Microsoft.UserDictionaries.EntityExtraction.Custom.ExactWord.1','Microsoft.UserDictionaries.EntityExtraction.Custom.WordPart.1','Microsoft.UserDictionaries.EntityExtraction.Custom.WordPart.2','Microsoft.UserDictionaries.EntityExtraction.Custom.WordPart.3','Microsoft.UserDictionaries.EntityExtraction.Custom.WordPart.4','Microsoft.UserDictionaries.EntityExtraction.Custom.WordPart.5','Microsoft.UserDictionaries.EntityExtraction.Custom.ExactWordPart.1')] + [string] + ${DictionaryName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPEnterpriseSearchPopularQueries { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplicationProxy}, + + [Parameter(Mandatory=$true)] + [object] + ${ResultSource}, + + [Parameter(Mandatory=$true)] + [object] + ${Web}, + + [string] + ${Filename}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPEnterpriseSearchThesaurus { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true, HelpMessage='Specify the UNC path to the CSV file.')] + [string] + ${FileName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPEnterpriseSearchTopology { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [string] + ${Filename}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPInfoPathAdministrationFiles { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Path}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPMetadataWebServicePartitionData { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceProxy}, + + [switch] + ${NoCompression}, + + [ValidateSet('true','false')] + [switch] + ${OverwriteExisting}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPPerformancePointContent { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [string] + ${ImportFileUrl}, + + [Parameter(Mandatory=$true)] + [string] + ${MasterPageUrl}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${SiteDestination}, + + [Parameter(Mandatory=$true)] + [hashtable] + ${LocationMap}, + + [Parameter(Mandatory=$true)] + [hashtable] + ${DatasourceMap}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPScaleOutDatabaseTenantData { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${FilePath}, + + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true)] + [guid] + ${SiteSubscriptionId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPServerScaleOutDatabaseTenantData { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${FilePath}, + + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true)] + [guid] + ${SiteSubscriptionId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPSiteSubscriptionBusinessDataCatalogConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [switch] + ${ModelsIncluded}, + + [switch] + ${LocalizedNamesIncluded}, + + [switch] + ${PropertiesIncluded}, + + [switch] + ${ProxiesIncluded}, + + [switch] + ${PermissionsIncluded}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPSiteSubscriptionSettings { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [switch] + ${AdminProperties}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPWeb { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${IncludeUserCustomAction}, + + [switch] + ${ActivateSolutions}, + + [object] + ${UpdateVersions}, + + [Parameter(Mandatory=$true)] + [string] + ${Path}, + + [switch] + ${Force}, + + [switch] + ${IncludeUserSecurity}, + + [switch] + ${HaltOnWarning}, + + [switch] + ${HaltOnError}, + + [switch] + ${NoLogFile}, + + [switch] + ${NoFileCompression}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Initialize-SPResourceSecurity { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Initialize-SPStateServiceDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPApp { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Web}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPApplicationContent { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPDataConnectionFile { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Path}, + + [ValidateLength(0, 255)] + [string] + ${Category}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${WebAccessible}, + + [switch] + ${Overwrite}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPEduSites { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${WebApplication}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${MySiteHost}, + + [Parameter(Mandatory=$true, Position=2, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${SearchCenter}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPFeature { + [CmdletBinding(DefaultParameterSetName='PathSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='PathSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Path}, + + [Parameter(ParameterSetName='AllExistingFeatures', Mandatory=$true)] + [switch] + ${AllExistingFeatures}, + + [Parameter(ParameterSetName='ScanForFeatures', Mandatory=$true)] + [switch] + ${ScanForFeatures}, + + [switch] + ${Force}, + + [Parameter(ParameterSetName='ScanForFeatures')] + [Parameter(ParameterSetName='AllExistingFeatures')] + [string] + ${SolutionId}, + + [Parameter(ParameterSetName='PathSet')] + [int] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPHelpCollection { + [CmdletBinding(DefaultParameterSetName='InstallOne')] +param( + [Parameter(ParameterSetName='InstallOne', Mandatory=$true)] + [ValidateNotNull()] + [string] + ${LiteralPath}, + + [Parameter(ParameterSetName='InstallAll', Mandatory=$true)] + [switch] + ${All}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPInfoPathFormTemplate { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Path}, + + [switch] + ${EnableGradualUpgrade}, + + [switch] + ${NoWait}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPService { + [CmdletBinding()] +param( + [switch] + ${Provision}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPSolution { + [CmdletBinding(DefaultParameterSetName='Deploy', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Synchronize', Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='Deploy', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Deploy')] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='Deploy')] + [string] + ${Time}, + + [Parameter(ParameterSetName='Deploy')] + [switch] + ${CASPolicies}, + + [Parameter(ParameterSetName='Deploy')] + [switch] + ${GACDeployment}, + + [Parameter(ParameterSetName='Deploy')] + [switch] + ${FullTrustBinDeployment}, + + [Parameter(ParameterSetName='Deploy')] + [switch] + ${Local}, + + [uint32] + ${Language}, + + [Parameter(ParameterSetName='Deploy')] + [switch] + ${Force}, + + [Parameter(ParameterSetName='Deploy')] + [switch] + ${AllWebApplications}, + + [Parameter(ParameterSetName='Deploy')] + [string] + ${CompatibilityLevel}, + + [Parameter(ParameterSetName='Synchronize', Mandatory=$true)] + [switch] + ${Synchronize}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPUserSolution { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPWebPartPack { + [CmdletBinding(DefaultParameterSetName='UseFileName', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='UseName', Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(ParameterSetName='UseFileName', Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${LiteralPath}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [switch] + ${GlobalInstall}, + + [uint32] + ${Language}, + + [switch] + ${Force}, + + [string] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Merge-SPLogFile { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [string] + ${Path}, + + [switch] + ${Overwrite}, + + [datetime] + ${StartTime}, + + [datetime] + ${EndTime}, + + [string[]] + ${Process}, + + [uint32[]] + ${ThreadID}, + + [string[]] + ${Area}, + + [string[]] + ${Category}, + + [string[]] + ${EventID}, + + [string] + ${Level}, + + [string[]] + ${Message}, + + [guid[]] + ${Correlation}, + + [string[]] + ${ContextFilter}, + + [switch] + ${ExcludeNestedCorrelation}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Mount-SPContentDatabase { + [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [switch] + ${SkipIntegrityChecks}, + + [switch] + ${NoB2BSiteUpgrade}, + + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNull()] + [string] + ${Name}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [ValidateRange(1, 2147483647)] + [int] + ${MaxSiteCount}, + + [ValidateRange(0, 2147483647)] + [int] + ${WarningSiteCount}, + + [switch] + ${ClearChangeLog}, + + [switch] + ${ChangeSyncKnowledge}, + + [switch] + ${AssignNewDatabaseId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Mount-SPStateServiceDatabase { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [string] + ${DatabaseServer}, + + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [ValidateRange(0, 10)] + [System.Nullable[int]] + ${Weight}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Move-SPBlobStorageLocation { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${SourceDatabase}, + + [ValidateNotNullOrEmpty()] + [string] + ${DestinationDataSourceInstance}, + + [ValidateNotNullOrEmpty()] + [string] + ${DestinationDatabase}, + + [ValidateNotNullOrEmpty()] + [string] + ${Dir}, + + [ValidateNotNullOrEmpty()] + [bool] + ${VerboseMod}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Move-SPDeletedSite { + [CmdletBinding(DefaultParameterSetName='DatabaseFromPipebind', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(Mandatory=$true)] + [object] + ${DestinationDatabase}, + + [hashtable] + ${RbsProviderMapping}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Move-SPEnterpriseSearchLinksDatabases { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Position=1)] + [System.Nullable[guid]] + ${RepartitioningId}, + + [Parameter(Position=2)] + [object] + ${SourceStores}, + + [Parameter(Position=3)] + [object] + ${TargetStores}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Move-SPProfileManagedMetadataProperty { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [string] + ${Identity}, + + [string] + ${TermSetName}, + + [switch] + ${AvailableForTagging}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Move-SPSite { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${DestinationDatabase}, + + [hashtable] + ${RbsProviderMapping}, + + [bool] + ${CopyEvents}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Move-SPSocialComment { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [string] + ${OldUrl}, + + [string] + ${NewUrl}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Move-SPUser { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('UserAlias')] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${NewAlias}, + + [switch] + ${IgnoreSID}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAccessServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ApplicationPool}, + + [string] + ${Name}, + + [switch] + ${Default}, + + [ValidateRange(1, 255)] + [int] + ${ColumnsMax}, + + [ValidateRange(1, 200000)] + [int] + ${RowsMax}, + + [ValidateRange(1, 20)] + [int] + ${SourcesMax}, + + [ValidateRange(0, 32)] + [int] + ${OutputCalculatedColumnsMax}, + + [ValidateRange(0, 8)] + [int] + ${OrderByMax}, + + [switch] + ${OuterJoinsAllowed}, + + [switch] + ${NonRemotableQueriesAllowed}, + + [ValidateRange(-1, 2147483647)] + [int] + ${RecordsInTableMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${ApplicationLogSizeMax}, + + [ValidateRange(-1, 2073600)] + [int] + ${RequestDurationMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${SessionsPerUserMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${SessionsPerAnonymousUserMax}, + + [ValidateRange(-1, 2073600)] + [int] + ${CacheTimeout}, + + [ValidateRange(0, 4096)] + [int] + ${SessionMemoryMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${PrivateBytesMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${TemplateSizeMax}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAccessServicesApplication { + [CmdletBinding(DefaultParameterSetName='NoApplicationServerParameterSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='DefaultParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [ValidateNotNull()] + [pscredential] + ${DatabaseServerCredentials}, + + [Parameter(ParameterSetName='DefaultParameterSet', Mandatory=$true, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='NoApplicationServerParameterSet', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ApplicationPool}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [string] + ${Name}, + + [Parameter(ParameterSetName='DefaultParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [switch] + ${Default}, + + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [Parameter(ParameterSetName='DefaultParameterSet')] + [ValidateRange(-1, 2073600)] + [int] + ${RequestDurationMax}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [ValidateRange(-1, 2147483647)] + [int] + ${SessionsPerUserMax}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [ValidateRange(-1, 2147483647)] + [int] + ${SessionsPerAnonymousUserMax}, + + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [Parameter(ParameterSetName='DefaultParameterSet')] + [ValidateRange(-1, 2073600)] + [int] + ${CacheTimeout}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [ValidateRange(-1, 2147483647)] + [int] + ${PrivateBytesMax}, + + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [Parameter(ParameterSetName='DefaultParameterSet')] + [ValidateRange(-1, 2073600)] + [int] + ${QueryTimeout}, + + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [Parameter(ParameterSetName='DefaultParameterSet')] + [ValidateRange(-1, 1440)] + [int] + ${RecoveryPointObjective}, + + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [Parameter(ParameterSetName='DefaultParameterSet')] + [bool] + ${Hosted}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [bool] + ${Encrypt}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [bool] + ${TrustServerCertificate}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAccessServicesApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${application}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAccessServicesDatabaseServer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceContext}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServerName}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServerGroupName}, + + [ValidateNotNullOrEmpty()] + [guid] + ${ServerReferenceId}, + + [ValidateNotNullOrEmpty()] + [pscredential] + ${DatabaseServerCredentials}, + + [ValidateNotNullOrEmpty()] + [bool] + ${AvailableForCreate}, + + [ValidateNotNullOrEmpty()] + [bool] + ${Exclusive}, + + [bool] + ${Encrypt}, + + [bool] + ${TrustServerCertificate}, + + [bool] + ${ValidateServer}, + + [ValidateNotNullOrEmpty()] + [string] + ${SecondaryDatabaseServerName}, + + [ValidateNotNullOrEmpty()] + [string] + ${UserDomain}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAlternateURL { + [CmdletBinding(DefaultParameterSetName='WebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Url}, + + [object] + ${Zone}, + + [switch] + ${Internal}, + + [Parameter(ParameterSetName='WebApplication', Mandatory=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='ResourceName', Mandatory=$true)] + [string] + ${ResourceName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAppManagementServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${Name}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseName}, + + [ValidateNotNullOrEmpty()] + [string] + ${FailoverDatabaseServer}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ApplicationPool}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAppManagementServiceApplicationProxy { + [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${Name}, + + [switch] + ${UseDefaultProxyGroup}, + + [Parameter(ParameterSetName='Uri', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Uri}, + + [Parameter(ParameterSetName='ServiceApplication', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAuthenticationProvider { + [CmdletBinding(DefaultParameterSetName='Windows')] +param( + [Parameter(ParameterSetName='Windows')] + [switch] + ${AllowAnonymous}, + + [Parameter(ParameterSetName='Windows')] + [switch] + ${UseBasicAuthentication}, + + [Parameter(ParameterSetName='Windows')] + [switch] + ${DisableKerberos}, + + [Parameter(ParameterSetName='Windows')] + [switch] + ${UseWindowsIntegratedAuthentication}, + + [Parameter(ParameterSetName='Forms', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ASPNETMembershipProvider}, + + [Parameter(ParameterSetName='Forms', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ASPNETRoleProviderName}, + + [Parameter(ParameterSetName='Trusted', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${TrustedIdentityTokenIssuer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAzureAccessControlServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${MetadataServiceEndpointUri}, + + [ValidateNotNull()] + [switch] + ${DefaultProxyGroup}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPBECWebServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ServiceEndpointUri}, + + [ValidateNotNull()] + [switch] + ${DefaultProxyGroup}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPBusinessDataCatalogServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${Name}, + + [switch] + ${PartitionMode}, + + [switch] + ${Sharing}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [string] + ${DatabaseName}, + + [string] + ${FailoverDatabaseServer}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [pscredential] + ${DatabaseCredentials}, + + [string] + ${DatabaseUsername}, + + [securestring] + ${DatabasePassword}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPBusinessDataCatalogServiceApplicationProxy { + [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Uri', Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${Uri}, + + [switch] + ${DefaultProxyGroup}, + + [string] + ${Name}, + + [Parameter(ParameterSetName='PipeBind', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ServiceApplication}, + + [Parameter(ParameterSetName='Uri')] + [switch] + ${PartitionMode}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPCentralAdministration { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [int] + ${Port}, + + [Parameter(Position=1, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${WindowsAuthProvider}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPClaimProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [string] + ${DisplayName}, + + [Parameter(Mandatory=$true)] + [string] + ${Description}, + + [Parameter(Mandatory=$true)] + [string] + ${AssemblyName}, + + [Parameter(Mandatory=$true)] + [string] + ${Type}, + + [switch] + ${Enabled}, + + [switch] + ${Default}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPClaimsPrincipal { + [CmdletBinding(DefaultParameterSetName='IdentityType')] +param( + [Parameter(ParameterSetName='IdentityType', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='TrustIdentity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Identity}, + + [Parameter(ParameterSetName='TrustIdentity', Mandatory=$true, Position=1)] + [Parameter(ParameterSetName='STSIdentity', Mandatory=$true, Position=2)] + [ValidateNotNullOrEmpty()] + [object] + ${TrustedIdentityTokenIssuer}, + + [Parameter(ParameterSetName='IdentityType', Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${IdentityType}, + + [Parameter(ParameterSetName='BasicClaim', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${EncodedClaim}, + + [Parameter(ParameterSetName='ClaimProvider', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='STSIdentity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ClaimValue}, + + [Parameter(ParameterSetName='ClaimProvider', Mandatory=$true, Position=1)] + [Parameter(ParameterSetName='STSIdentity', Position=1)] + [ValidateNotNullOrEmpty()] + [string] + ${ClaimType}, + + [Parameter(ParameterSetName='ClaimProvider', Mandatory=$true, Position=2)] + [ValidateNotNull()] + [object] + ${ClaimProvider}, + + [Parameter(ParameterSetName='STSIdentity', Position=3)] + [ValidateNotNull()] + [switch] + ${IdentifierClaim}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPClaimTypeEncoding { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [char] + ${EncodingCharacter}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ClaimType}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPClaimTypeMapping { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${IncomingClaimType}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNullOrEmpty()] + [string] + ${IncomingClaimTypeDisplayName}, + + [Parameter(Position=2)] + [ValidateNotNullOrEmpty()] + [string] + ${LocalClaimType}, + + [ValidateNotNull()] + [switch] + ${SameAsIncoming}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPConfigurationDatabase { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${DatabaseName}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [Parameter(Position=2, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DirectoryDomain}, + + [Parameter(Position=3, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DirectoryOrganizationUnit}, + + [Parameter(Position=4, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${AdministrationContentDatabaseName}, + + [Parameter(Position=5, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(Mandatory=$true, Position=6, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [pscredential] + ${FarmCredentials}, + + [Parameter(Mandatory=$true, Position=7, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [securestring] + ${Passphrase}, + + [Parameter(Position=8, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [switch] + ${SkipRegisterAsDistributedCacheHost}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPContentDatabase { + [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNull()] + [string] + ${Name}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [ValidateRange(1, 2147483647)] + [int] + ${MaxSiteCount}, + + [ValidateRange(0, 2147483647)] + [int] + ${WarningSiteCount}, + + [switch] + ${ClearChangeLog}, + + [switch] + ${ChangeSyncKnowledge}, + + [switch] + ${AssignNewDatabaseId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPContentDeploymentJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [string] + ${Description}, + + [Parameter(Mandatory=$true)] + [object] + ${SPContentDeploymentPath}, + + [object] + ${Scope}, + + [string] + ${Schedule}, + + [switch] + ${ScheduleEnabled}, + + [switch] + ${IncrementalEnabled}, + + [object] + ${SqlSnapshotSetting}, + + [switch] + ${HostingSupportEnabled}, + + [object] + ${EmailNotifications}, + + [string[]] + ${EmailAddresses}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPContentDeploymentPath { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [string] + ${Description}, + + [Parameter(Mandatory=$true)] + [object] + ${SourceSPWebApplication}, + + [Parameter(Mandatory=$true)] + [object] + ${SourceSPSite}, + + [Parameter(Mandatory=$true)] + [uri] + ${DestinationCentralAdministrationURL}, + + [Parameter(Mandatory=$true)] + [uri] + ${DestinationSPWebApplication}, + + [Parameter(Mandatory=$true)] + [string] + ${DestinationSPSite}, + + [object] + ${Authentication}, + + [Parameter(Mandatory=$true)] + [pscredential] + ${PathAccount}, + + [switch] + ${DeployUserNamesEnabled}, + + [object] + ${DeploySecurityInformation}, + + [switch] + ${EventReceiversEnabled}, + + [switch] + ${CompressionEnabled}, + + [switch] + ${PathEnabled}, + + [object] + ${KeepTemporaryFilesOptions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEduClass { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${ClassId}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${ClassName}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [System.Nullable[datetime]] + ${StartDate}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [System.Nullable[datetime]] + ${EndDate}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Year}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${DayOfWeek}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${StartTime}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${EndTime}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Building}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Room}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchAdminComponent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchTopology}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchServiceInstance}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchAnalyticsProcessingComponent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchTopology}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchServiceInstance}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchContentEnrichmentConfiguration { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchContentProcessingComponent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchTopology}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchServiceInstance}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchCrawlComponent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchTopology}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchServiceInstance}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchCrawlContentSource { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('t')] + [object] + ${Type}, + + [string] + ${Tag}, + + [Alias('s')] + [string] + ${StartAddresses}, + + [Alias('p')] + [object] + ${CrawlPriority}, + + [System.Nullable[int]] + ${MaxPageEnumerationDepth}, + + [System.Nullable[int]] + ${MaxSiteEnumerationDepth}, + + [object] + ${SharePointCrawlBehavior}, + + [object] + ${BDCApplicationProxyGroup}, + + [string[]] + ${LOBSystemSet}, + + [string] + ${CustomProtocol}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchCrawlCustomConnector { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [string] + ${Protocol}, + + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [string] + ${ModelFilePath}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchCrawlDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [string] + ${DatabaseName}, + + [string] + ${DatabaseServer}, + + [string] + ${DatabaseUsername}, + + [securestring] + ${DatabasePassword}, + + [string] + ${FailoverDatabaseServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchCrawlExtension { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchCrawlMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Url}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('t')] + [string] + ${Target}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchCrawlRule { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Path}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('t')] + [object] + ${Type}, + + [System.Nullable[bool]] + ${IsAdvancedRegularExpression}, + + [System.Nullable[bool]] + ${CrawlAsHttp}, + + [System.Nullable[bool]] + ${FollowComplexUrls}, + + [System.Nullable[int]] + ${PluggableSecurityTimmerId}, + + [System.Nullable[bool]] + ${SuppressIndexing}, + + [System.Nullable[int]] + ${Priority}, + + [string] + ${ContentClass}, + + [object] + ${AuthenticationType}, + + [string] + ${AccountName}, + + [securestring] + ${AccountPassword}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchFileFormat { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true, Position=0)] + [string] + ${FormatId}, + + [Parameter(Mandatory=$true, Position=1)] + [string] + ${FormatName}, + + [Parameter(Mandatory=$true, Position=2)] + [string] + ${MimeType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchIndexComponent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchTopology}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchServiceInstance}, + + [object] + ${SearchApplication}, + + [uint32] + ${IndexPartition}, + + [string] + ${RootDirectory}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchLanguageResourcePhrase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [object] + ${Type}, + + [Parameter(Mandatory=$true)] + [string] + ${Language}, + + [string] + ${Mapping}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [guid] + ${SourceId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchLinksDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [string] + ${DatabaseName}, + + [string] + ${DatabaseServer}, + + [string] + ${DatabaseUsername}, + + [securestring] + ${DatabasePassword}, + + [string] + ${FailoverDatabaseServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchMetadataCategory { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Alias('p')] + [System.Nullable[guid]] + ${PropSet}, + + [Alias('d')] + [System.Nullable[bool]] + ${DiscoverNewProperties}, + + [Alias('m')] + [System.Nullable[bool]] + ${MapToContents}, + + [Alias('auto')] + [System.Nullable[bool]] + ${AutoCreateNewManagedProperties}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchMetadataCrawledProperty { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('c')] + [object] + ${Category}, + + [Parameter(Mandatory=$true)] + [Alias('ie')] + [bool] + ${IsNameEnum}, + + [Parameter(Mandatory=$true)] + [Alias('vt')] + [Obsolete()] + [int] + ${VariantType}, + + [Parameter(Mandatory=$true)] + [Alias('p')] + [guid] + ${PropSet}, + + [Alias('im')] + [System.Nullable[bool]] + ${IsMappedToContents}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchMetadataManagedProperty { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('t')] + [int] + ${Type}, + + [Alias('d')] + [string] + ${Description}, + + [Alias('f')] + [System.Nullable[bool]] + ${FullTextQueriable}, + + [Alias('r')] + [System.Nullable[bool]] + ${Retrievable}, + + [Alias('q')] + [System.Nullable[bool]] + ${Queryable}, + + [Alias('e')] + [System.Nullable[bool]] + ${EnabledForScoping}, + + [Alias('nn')] + [System.Nullable[bool]] + ${NameNormalized}, + + [Alias('rp')] + [System.Nullable[bool]] + ${RespectPriority}, + + [Alias('rd')] + [System.Nullable[bool]] + ${RemoveDuplicates}, + + [Alias('im5')] + [Obsolete('This property is replaced by IncludeInAlertSignature.')] + [System.Nullable[bool]] + ${IncludeInMd5}, + + [Alias('sfa')] + [System.Nullable[bool]] + ${SafeForAnonymous}, + + [Alias('ia')] + [System.Nullable[bool]] + ${IncludeInAlertSignature}, + + [Alias('nw')] + [System.Nullable[bool]] + ${NoWordBreaker}, + + [Alias('u')] + [System.Nullable[int16]] + ${UserFlags}, + + [Alias('qir')] + [System.Nullable[bool]] + ${EnabledForQueryIndependentRank}, + + [Alias('def')] + [System.Nullable[uint32]] + ${DefaultForQueryIndependentRank}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchMetadataMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [object] + ${ManagedProperty}, + + [Parameter(Mandatory=$true)] + [object] + ${CrawledProperty}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchQueryAuthority { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Url}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('l')] + [float] + ${Level}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchQueryDemoted { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Url}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchQueryKeyword { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Term}, + + [Parameter(Mandatory=$true)] + [object] + ${Site}, + + [Alias('d')] + [string] + ${Definition}, + + [Alias('c')] + [string] + ${Contact}, + + [Alias('s')] + [System.Nullable[datetime]] + ${StartDate}, + + [Alias('e')] + [System.Nullable[datetime]] + ${EndDate}, + + [Alias('r')] + [System.Nullable[datetime]] + ${ReviewDate}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchQueryProcessingComponent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchTopology}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchServiceInstance}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchQueryScope { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('d')] + [string] + ${Description}, + + [Alias('o')] + [uri] + ${OwningSiteUrl}, + + [Alias('a')] + [string] + ${AlternateResultsPage}, + + [Parameter(Mandatory=$true)] + [Alias('disp')] + [System.Nullable[bool]] + ${DisplayInAdminUI}, + + [Alias('type')] + [System.Nullable[int]] + ${CompilationType}, + + [Alias('f')] + [string] + ${ExtendedSearchFilter}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchQueryScopeRule { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('u')] + [uri] + ${Url}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [Alias('s')] + [object] + ${Scope}, + + [Parameter(Mandatory=$true)] + [Alias('type')] + [string] + ${RuleType}, + + [Alias('f')] + [string] + ${FilterBehavior}, + + [Alias('ut')] + [string] + ${UrlScopeRuleType}, + + [Alias('text')] + [string] + ${MatchingString}, + + [Alias('value')] + [string] + ${PropertyValue}, + + [Alias('mname')] + [object] + ${ManagedProperty}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchRankingModel { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [string] + ${RankingModelXML}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchResultItemType { + [CmdletBinding(DefaultParameterSetName='New', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchApplicationProxy}, + + [Parameter(ParameterSetName='New', Mandatory=$true, Position=1)] + [Parameter(ParameterSetName='Copy', Position=1)] + [Alias('n')] + [string] + ${Name}, + + [Parameter(ParameterSetName='Copy', Position=2)] + [Parameter(ParameterSetName='New', Mandatory=$true, Position=2)] + [Alias('rule')] + [object] + ${Rules}, + + [Parameter(Position=3)] + [Alias('priority')] + [int] + ${RulePriority}, + + [Parameter(Position=4)] + [Alias('dp')] + [string] + ${DisplayProperties}, + + [Parameter(Position=5)] + [Alias('sid')] + [System.Nullable[guid]] + ${SourceID}, + + [Parameter(ParameterSetName='Copy', Position=6)] + [Parameter(ParameterSetName='New', Mandatory=$true, Position=6)] + [Alias('url')] + [string] + ${DisplayTemplateUrl}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ParameterSetName='Copy', Mandatory=$true)] + [Alias('copy')] + [object] + ${ExistingResultItemType}, + + [Parameter(ParameterSetName='Copy', Mandatory=$true)] + [Alias('eo')] + [object] + ${ExistingResultItemTypeOwner}, + + [Alias('opt')] + [System.Nullable[bool]] + ${OptimizeForFrequentUse}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchResultSource { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [string] + ${Description}, + + [string] + ${QueryTemplate}, + + [Parameter(Mandatory=$true)] + [guid] + ${ProviderId}, + + [string] + ${RemoteUrl}, + + [System.Nullable[bool]] + ${AutoDiscover}, + + [object] + ${AuthenticationType}, + + [string] + ${UserName}, + + [string] + ${Password}, + + [string] + ${SsoId}, + + [System.Nullable[bool]] + ${MakeDefault}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchSecurityTrimmer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [int] + ${Id}, + + [Parameter(Mandatory=$true)] + [string] + ${TypeName}, + + [string] + ${Properties}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [string] + ${RulePath}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0)] + [string] + ${Name}, + + [string] + ${DatabaseServer}, + + [string] + ${DatabaseName}, + + [string] + ${DatabaseUsername}, + + [securestring] + ${DatabasePassword}, + + [string] + ${FailoverDatabaseServer}, + + [switch] + ${Partitioned}, + + [Parameter(Mandatory=$true)] + [object] + ${ApplicationPool}, + + [object] + ${AdminApplicationPool}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchServiceApplicationProxy { + [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='SSA', Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(Position=0)] + [string] + ${Name}, + + [Parameter(ParameterSetName='Uri', Mandatory=$true)] + [string] + ${Uri}, + + [switch] + ${Partitioned}, + + [switch] + ${MergeWithDefaultPartition}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchSiteHitRule { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchService}, + + [Parameter(Mandatory=$true)] + [string] + ${HitRate}, + + [Parameter(Mandatory=$true)] + [string] + ${Behavior}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchTopology { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ParameterSetName='Clone')] + [switch] + ${Clone}, + + [Parameter(ParameterSetName='Clone')] + [object] + ${SearchTopology}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPExcelBIServer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${ServerId}, + + [string] + ${Description}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPExcelBlockedFileType { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${FileType}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPExcelDataConnectionLibrary { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${Address}, + + [string] + ${Description}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPExcelDataProvider { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${ProviderId}, + + [Parameter(Mandatory=$true)] + [object] + ${ProviderType}, + + [string] + ${Description}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPExcelFileLocation { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${Address}, + + [object] + ${LocationType}, + + [switch] + ${IncludeChildren}, + + [int] + ${SessionTimeout}, + + [int] + ${ShortSessionTimeout}, + + [int] + ${NewWorkbookSessionTimeout}, + + [int] + ${RequestDurationMax}, + + [int] + ${ChartRenderDurationMax}, + + [int] + ${WorkbookSizeMax}, + + [int] + ${ChartAndImageSizeMax}, + + [int] + ${AutomaticVolatileFunctionCacheLifetime}, + + [object] + ${DefaultWorkbookCalcMode}, + + [object] + ${ExternalDataAllowed}, + + [switch] + ${WarnOnDataRefresh}, + + [switch] + ${DisplayGranularExtDataErrors}, + + [switch] + ${AbortOnRefreshOnOpenFail}, + + [int] + ${PeriodicExtDataCacheLifetime}, + + [int] + ${ManualExtDataCacheLifetime}, + + [int] + ${ConcurrentDataRequestsPerSessionMax}, + + [switch] + ${UdfsAllowed}, + + [string] + ${Description}, + + [switch] + ${RESTExternalDataAllowed}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPExcelServiceApplication { + [CmdletBinding(DefaultParameterSetName='ExistingTargetApplicationParameterSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [int] + ${ExternalDataConnectionLifetime}, + + [Parameter(ParameterSetName='ExistingTargetApplicationParameterSet')] + [string] + ${UnattendedAccountApplicationId}, + + [object] + ${LoadBalancingScheme}, + + [int] + ${SessionsPerUserMax}, + + [int] + ${PrivateBytesMax}, + + [int] + ${MemoryCacheThreshold}, + + [int] + ${UnusedObjectAgeMax}, + + [int] + ${ThrottleAccessViolationsPerSiteCollection}, + + [int] + ${SiteCollectionAnonymousSessionsMax}, + + [string] + ${WorkbookCache}, + + [int] + ${WorkbookCacheSizeMax}, + + [switch] + ${CachingOfUnusedFilesEnable}, + + [object] + ${FileAccessMethod}, + + [object] + ${EncryptedUserConnectionRequired}, + + [switch] + ${CrossDomainAccessAllowed}, + + [switch] + ${TerminateProcessOnAccessViolation}, + + [switch] + ${UseEffectiveUserName}, + + [string] + ${WorkbookModelUsageTracker}, + + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [switch] + ${Default}, + + [Parameter(ParameterSetName='NewTargetApplicationParameterSet')] + [pscredential] + ${UnattendedServiceAccount}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPExcelUserDefinedFunction { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${Assembly}, + + [object] + ${AssemblyLocation}, + + [switch] + ${Enable}, + + [string] + ${Description}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPLogFile { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPManagedAccount { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [pscredential] + ${Credential}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPManagedPath { + [CmdletBinding(DefaultParameterSetName='WebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${RelativeURL}, + + [Parameter(ParameterSetName='WebApplication', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='HostHeader', Mandatory=$true)] + [switch] + ${HostHeader}, + + [switch] + ${Explicit}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPMarketplaceWebServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ServiceEndpointUri}, + + [ValidateNotNull()] + [switch] + ${DefaultProxyGroup}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPMetadataServiceApplication { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${AdministratorAccount}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [string] + ${DatabaseName}, + + [string] + ${DatabaseServer}, + + [pscredential] + ${DatabaseCredentials}, + + [string] + ${FailoverDatabaseServer}, + + [string] + ${FullAccessAccount}, + + [string] + ${HubUri}, + + [Parameter(ParameterSetName='Default', Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='NoQuota', Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='Quota', Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [switch] + ${PartitionMode}, + + [string] + ${ReadAccessAccount}, + + [string] + ${RestrictedAccount}, + + [switch] + ${SyndicationErrorReportEnabled}, + + [int] + ${CacheTimeCheckInterval}, + + [int] + ${MaxChannelCache}, + + [Parameter(ParameterSetName='NoQuota', Mandatory=$true)] + [switch] + ${DisablePartitionQuota}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${GroupsPerPartition}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${TermSetsPerPartition}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${TermsPerPartition}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${LabelsPerPartition}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${PropertiesPerPartition}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPMetadataServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [switch] + ${ContentTypePushdownEnabled}, + + [switch] + ${ContentTypeSyndicationEnabled}, + + [switch] + ${DefaultProxyGroup}, + + [switch] + ${DefaultKeywordTaxonomy}, + + [switch] + ${DefaultSiteCollectionTaxonomy}, + + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [switch] + ${PartitionMode}, + + [object] + ${ServiceApplication}, + + [string] + ${Uri}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPODataConnectionSetting { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(Mandatory=$true)] + [ValidateLength(0, 246)] + [ValidateNotNull()] + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${ServiceAddressURL}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${AuthenticationMode}, + + [ValidateNotNull()] + [ValidateLength(0, 1024)] + [string] + ${SecureStoreTargetApplicationId}, + + [string] + ${ExtensionProvider}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPOnlineApplicationPrincipalManagementServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${OnlineTenantUri}, + + [ValidateNotNull()] + [switch] + ${DefaultProxyGroup}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPPerformancePointServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateLength(0, 64)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ApplicationPool}, + + [bool] + ${CommentsDisabled}, + + [int] + ${CommentsScorecardMax}, + + [int] + ${IndicatorImageCacheSeconds}, + + [int] + ${DataSourceQueryTimeoutSeconds}, + + [int] + ${FilterRememberUserSelectionsDays}, + + [int] + ${FilterTreeMembersMax}, + + [int] + ${FilterSearchResultsMax}, + + [int] + ${ShowDetailsInitialRows}, + + [bool] + ${ShowDetailsMaxRowsDisabled}, + + [int] + ${ShowDetailsMaxRows}, + + [bool] + ${MSMQEnabled}, + + [string] + ${MSMQName}, + + [int] + ${SessionHistoryHours}, + + [bool] + ${AnalyticQueryLoggingEnabled}, + + [bool] + ${TrustedDataSourceLocationsRestricted}, + + [bool] + ${TrustedContentLocationsRestricted}, + + [int] + ${SelectMeasureMaximum}, + + [int] + ${DecompositionTreeMaximum}, + + [bool] + ${ApplicationProxyCacheEnabled}, + + [bool] + ${ApplicationCacheEnabled}, + + [int] + ${ApplicationCacheMinimumHitCount}, + + [int] + ${AnalyticResultCacheMinimumHitCount}, + + [int] + ${ElementCacheSeconds}, + + [int] + ${AnalyticQueryCellMax}, + + [string] + ${DatabaseServer}, + + [string] + ${DatabaseName}, + + [string] + ${DatabaseFailoverServer}, + + [pscredential] + ${DatabaseSQLAuthenticationCredential}, + + [bool] + ${UseEffectiveUserName}, + + [string] + ${DataSourceUnattendedServiceAccountTargetApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPPerformancePointServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateLength(0, 64)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [switch] + ${Default}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPPerformancePointServiceApplicationTrustedLocation { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateLength(0, 1024)] + [string] + ${Url}, + + [Parameter(Mandatory=$true)] + [object] + ${Type}, + + [Parameter(Mandatory=$true)] + [object] + ${TrustedLocationType}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [string] + ${Description}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPPowerPointConversionServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateLength(1, 128)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ApplicationPool}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPPowerPointConversionServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateLength(1, 128)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [switch] + ${AddToDefaultGroup}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPProfileServiceApplication { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ApplicationPool}, + + [string] + ${ProfileDBName}, + + [string] + ${ProfileDBServer}, + + [pscredential] + ${ProfileDBCredentials}, + + [string] + ${ProfileDBFailoverServer}, + + [string] + ${SocialDBName}, + + [string] + ${SocialDBServer}, + + [pscredential] + ${SocialDBCredentials}, + + [string] + ${SocialDBFailoverServer}, + + [string] + ${ProfileSyncDBName}, + + [string] + ${ProfileSyncDBServer}, + + [pscredential] + ${ProfileSyncDBCredentials}, + + [string] + ${ProfileSyncDBFailoverServer}, + + [switch] + ${PartitionMode}, + + [Parameter(ParameterSetName='MySiteSettings', Mandatory=$true, ValueFromPipeline=$true)] + [Parameter(ValueFromPipeline=$true)] + [object] + ${MySiteHostLocation}, + + [Parameter(ParameterSetName='MySiteSettings', ValueFromPipeline=$true)] + [object] + ${MySiteManagedPath}, + + [Parameter(ParameterSetName='MySiteSettings')] + [ValidateSet('None','Resolve','Block')] + [string] + ${SiteNamingConflictResolution}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPProfileServiceApplicationProxy { + [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [string] + ${Name}, + + [Parameter(ParameterSetName='Application', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceApplication}, + + [Parameter(ParameterSetName='Uri', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [uri] + ${Uri}, + + [switch] + ${DefaultProxyGroup}, + + [switch] + ${PartitionMode}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPRequestManagementRuleCriteria { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='StandardParameterSet', Mandatory=$true, Position=0)] + [Parameter(ParameterSetName='CustomPropertyParameterSet', Mandatory=$true, Position=0)] + [string] + ${Value}, + + [Parameter(ParameterSetName='CustomPropertyParameterSet', Mandatory=$true, Position=1)] + [string] + ${CustomHeader}, + + [Parameter(ParameterSetName='StandardParameterSet', Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${Property}, + + [Parameter(ParameterSetName='StandardParameterSet', Position=2)] + [Parameter(ParameterSetName='CustomPropertyParameterSet', Position=2)] + [ValidateNotNull()] + [object] + ${MatchType}, + + [Parameter(ParameterSetName='CustomPropertyParameterSet', Position=2)] + [Parameter(ParameterSetName='StandardParameterSet', Position=2)] + [System.Nullable[switch]] + ${CaseSensitive}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSecureStoreApplication { + [CmdletBinding()] +param( + [object] + ${Administrator}, + + [object] + ${CredentialsOwnerGroup}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Fields}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(Mandatory=$true)] + [object] + ${TargetApplication}, + + [object] + ${TicketRedeemer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSecureStoreApplicationField { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [switch] + ${Masked}, + + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [object] + ${Type}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSecureStoreServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ApplicationPool}, + + [Parameter(Mandatory=$true)] + [switch] + ${AuditingEnabled}, + + [System.Nullable[int]] + ${AuditlogMaxSize}, + + [pscredential] + ${DatabaseCredentials}, + + [string] + ${DatabaseName}, + + [securestring] + ${DatabasePassword}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [string] + ${DatabaseUsername}, + + [string] + ${FailoverDatabaseServer}, + + [string] + ${Name}, + + [switch] + ${PartitionMode}, + + [switch] + ${Sharing}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSecureStoreServiceApplicationProxy { + [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [switch] + ${DefaultProxyGroup}, + + [string] + ${Name}, + + [Parameter(ParameterSetName='PipeBind', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ParameterSetName='Uri', Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${Uri}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSecureStoreTargetApplication { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [object] + ${ApplicationType}, + + [string] + ${ContactEmail}, + + [Parameter(Mandatory=$true)] + [string] + ${FriendlyName}, + + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [ValidateNotNull()] + [uri] + ${SetCredentialsUri}, + + [int] + ${TimeoutInMinutes}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPServiceApplicationPool { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [ValidateLength(1, 100)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, Position=1)] + [object] + ${Account}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPServiceApplicationProxyGroup { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateLength(0, 100)] + [AllowEmptyString()] + [ValidateNotNull()] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSite { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Url}, + + [uint32] + ${Language}, + + [object] + ${Template}, + + [string] + ${Name}, + + [string] + ${Description}, + + [object] + ${QuotaTemplate}, + + [string] + ${OwnerEmail}, + + [Parameter(Mandatory=$true)] + [object] + ${OwnerAlias}, + + [string] + ${SecondaryEmail}, + + [object] + ${SecondaryOwnerAlias}, + + [object] + ${HostHeaderWebApplication}, + + [object] + ${ContentDatabase}, + + [object] + ${SiteSubscription}, + + [object] + ${AdministrationSiteType}, + + [int] + ${CompatibilityLevel}, + + [switch] + ${OverrideCompatibilityRestriction}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSiteSubscription { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSiteSubscriptionFeaturePack { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPStateServiceApplication { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Database}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPStateServiceApplicationProxy { + [CmdletBinding()] +param( + [string] + ${Name}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ServiceApplication}, + + [switch] + ${DefaultProxyGroup}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPStateServiceDatabase { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [string] + ${DatabaseServer}, + + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [ValidateRange(0, 10)] + [System.Nullable[int]] + ${Weight}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSubscriptionSettingsServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${Name}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseName}, + + [ValidateNotNullOrEmpty()] + [string] + ${FailoverDatabaseServer}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ApplicationPool}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSubscriptionSettingsServiceApplicationProxy { + [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Uri', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Uri}, + + [Parameter(ParameterSetName='ServiceApplication', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPTranslationServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [string] + ${DatabaseName}, + + [string] + ${DatabaseServer}, + + [pscredential] + ${DatabaseCredential}, + + [string] + ${FailoverDatabaseServer}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [switch] + ${PartitionMode}, + + [switch] + ${Default}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPTranslationServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [switch] + ${DefaultProxyGroup}, + + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [switch] + ${PartitionMode}, + + [Parameter(ParameterSetName='ConnectLocal', Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ParameterSetName='ConnectRemote', Mandatory=$true)] + [string] + ${Uri}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPTrustedIdentityTokenIssuer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='BasicParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(ParameterSetName='BasicParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Description}, + + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet')] + [Parameter(ParameterSetName='BasicParameterSet')] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${ImportTrustCertificate}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, + + [Parameter(ParameterSetName='BasicParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ClaimsMappings}, + + [Parameter(ParameterSetName='BasicParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SignInUrl}, + + [Parameter(ParameterSetName='BasicParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${IdentifierClaim}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [Parameter(ParameterSetName='BasicParameterSet')] + [object] + ${ClaimProvider}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='BasicParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [string] + ${Realm}, + + [Parameter(ParameterSetName='BasicParameterSet')] + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet')] + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [switch] + ${UseWReply}, + + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet', Mandatory=$true)] + [switch] + ${UseDefaultConfiguration}, + + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet')] + [ValidateSet('EMAIL','USER-PRINCIPAL-NAME','ACCOUNT-NAME')] + [string] + ${IdentifierClaimIs}, + + [Parameter(ParameterSetName='BasicParameterSet')] + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet')] + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [ValidateNotNullOrEmpty()] + [string] + ${SignOutUrl}, + + [Parameter(ParameterSetName='BasicParameterSet')] + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet')] + [ValidateNotNullOrEmpty()] + [string] + ${RegisteredIssuerName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPTrustedRootAuthority { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(ParameterSetName='ManualUpdateCertificateParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${Certificate}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPTrustedSecurityTokenIssuer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [ValidateNotNullOrEmpty()] + [string] + ${Description}, + + [ValidateNotNullOrEmpty()] + [string] + ${RegisteredIssuerName}, + + [ValidateNotNullOrEmpty()] + [switch] + ${IsTrustBroker}, + + [Parameter(ParameterSetName='ImportCertificateParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${Certificate}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPTrustedServiceTokenIssuer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [ValidateNotNullOrEmpty()] + [string] + ${Description}, + + [Parameter(ParameterSetName='ImportCertificateParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${Certificate}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPUsageApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0)] + [string] + ${Name}, + + [ValidateNotNullOrEmpty()] + [ValidateLength(1, 135)] + [string] + ${DatabaseServer}, + + [ValidateNotNullOrEmpty()] + [ValidateLength(1, 135)] + [string] + ${FailoverDatabaseServer}, + + [ValidateNotNullOrEmpty()] + [ValidateLength(1, 128)] + [string] + ${DatabaseName}, + + [Parameter(ParameterSetName='SQLAuthentication')] + [ValidateLength(1, 128)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseUsername}, + + [Parameter(ParameterSetName='SQLAuthentication')] + [ValidateNotNull()] + [securestring] + ${DatabasePassword}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${UsageService}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPUsageLogFile { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPUser { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${UserAlias}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Web}, + + [string] + ${Email}, + + [object] + ${Group}, + + [string[]] + ${PermissionLevel}, + + [string] + ${DisplayName}, + + [switch] + ${SiteCollectionAdmin}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPUserLicenseMapping { + [CmdletBinding(DefaultParameterSetName='WindowsAuth', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='WindowsAuth', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SecurityGroup}, + + [Parameter(ParameterSetName='FormsAuth', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Role}, + + [Parameter(ParameterSetName='FormsAuth', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${RoleProviderName}, + + [Parameter(ParameterSetName='ClaimsValues', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${OriginalIssuer}, + + [Parameter(ParameterSetName='ClaimsValues', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Value}, + + [Parameter(ParameterSetName='ClaimsValues', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ClaimType}, + + [Parameter(ParameterSetName='ClaimsValues')] + [ValidateNotNullOrEmpty()] + [string] + ${ValueType}, + + [Parameter(ParameterSetName='TrustIdentity', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Claim}, + + [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${License}, + + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPUserSettingsProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [string] + ${DisplayName}, + + [Parameter(Mandatory=$true)] + [string] + ${AssemblyName}, + + [Parameter(Mandatory=$true)] + [string] + ${Type}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPVisioSafeDataProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${VisioServiceApplication}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DataProviderId}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [int] + ${DataProviderType}, + + [string] + ${Description}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPVisioServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [switch] + ${AddToDefaultGroup}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${ApplicationPool}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPVisioServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWeb { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Url}, + + [uint32] + ${Language}, + + [object] + ${Template}, + + [string] + ${Name}, + + [string] + ${Description}, + + [switch] + ${AddToQuickLaunch}, + + [switch] + ${UniquePermissions}, + + [switch] + ${AddToTopNav}, + + [switch] + ${UseParentTopNav}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWebApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [string] + ${ApplicationPool}, + + [object] + ${ApplicationPoolAccount}, + + [Alias('ProxyGroup')] + [object] + ${ServiceApplicationProxyGroup}, + + [switch] + ${SecureSocketsLayer}, + + [string] + ${HostHeader}, + + [uint32] + ${Port}, + + [switch] + ${AllowAnonymousAccess}, + + [string] + ${Path}, + + [string] + ${Url}, + + [ValidateSet('Kerberos','NTLM')] + [string] + ${AuthenticationMethod}, + + [object] + ${AuthenticationProvider}, + + [object] + ${AdditionalClaimProvider}, + + [string] + ${SignInRedirectURL}, + + [object] + ${SignInRedirectProvider}, + + [object] + ${UserSettingsProvider}, + + [pscredential] + ${DatabaseCredentials}, + + [string] + ${DatabaseServer}, + + [string] + ${DatabaseName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWebApplicationAppDomain { + [CmdletBinding(DefaultParameterSetName='WebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${AppDomain}, + + [object] + ${Zone}, + + [int] + ${Port}, + + [switch] + ${SecureSocketsLayer}, + + [Parameter(Mandatory=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWebApplicationExtension { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [object] + ${Zone}, + + [uint32] + ${Port}, + + [string] + ${HostHeader}, + + [string] + ${Path}, + + [string] + ${Url}, + + [ValidateSet('Kerberos','NTLM')] + [string] + ${AuthenticationMethod}, + + [switch] + ${AllowAnonymousAccess}, + + [switch] + ${SecureSocketsLayer}, + + [object] + ${AuthenticationProvider}, + + [object] + ${AdditionalClaimProvider}, + + [string] + ${SignInRedirectURL}, + + [object] + ${SignInRedirectProvider}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWOPIBinding { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [ValidateNotNullOrEmpty()] + [string] + ${FileName}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ServerName}, + + [ValidateNotNullOrEmpty()] + [string] + ${Action}, + + [ValidateNotNullOrEmpty()] + [string] + ${Extension}, + + [ValidateNotNullOrEmpty()] + [string] + ${ProgId}, + + [ValidateNotNullOrEmpty()] + [string] + ${Application}, + + [switch] + ${AllowHTTP}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWOPISuppressionSetting { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [ValidateNotNullOrEmpty()] + [string] + ${Extension}, + + [ValidateNotNullOrEmpty()] + [string] + ${ProgId}, + + [ValidateNotNullOrEmpty()] + [string] + ${Action}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWordConversionServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [string] + ${DatabaseName}, + + [string] + ${DatabaseServer}, + + [pscredential] + ${DatabaseCredential}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [switch] + ${PartitionMode}, + + [switch] + ${Default}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWorkflowServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [switch] + ${PartitionMode}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWorkManagementServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [switch] + ${Proxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWorkManagementServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [switch] + ${DefaultProxyGroup}, + + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [object] + ${ServiceApplication}, + + [string] + ${Uri}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Publish-SPServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateLength(0, 250)] + [AllowEmptyString()] + [string] + ${Description}, + + [ValidateNotNullOrEmpty()] + [uri] + ${InfoLink}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Receive-SPServiceApplicationConnectionInfo { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [uri] + ${FarmUrl}, + + [ValidateNotNullOrEmpty()] + [string] + ${Filter}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Register-SPAppPrincipal { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${NameIdentifier}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DisplayName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Register-SPWorkflowService { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [object] + ${SPSite}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${WorkflowHostUri}, + + [string] + ${ScopeName}, + + [switch] + ${PartitionMode}, + + [switch] + ${AllowOAuthHttp}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-DatabaseFromAvailabilityGroup { + [CmdletBinding(DefaultParameterSetName='Default')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${AGName}, + + [Parameter(ParameterSetName='Default', Mandatory=$true)] + [string] + ${DatabaseName}, + + [Parameter(ParameterSetName='AllDatabases', Mandatory=$true)] + [switch] + ${ProcessAllDatabases}, + + [switch] + ${Force}, + + [switch] + ${KeepSecondaryData}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPAccessServicesDatabaseServer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${DatabaseServer}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${DatabaseServerGroup}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceContext}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPActivityFeedItems { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [bool] + ${AllItems}, + + [long] + ${ID}, + + [string] + ${SearchText}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPAlternateURL { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPAppDeniedEndpoint { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${Endpoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPAppPrincipalPermission { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${AppPrincipal}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Scope}, + + [switch] + ${DisableAppOnlyPolicy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPBusinessDataCatalogModel { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPClaimProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPClaimTypeMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${TrustedIdentityTokenIssuer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPConfigurationDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPContentDatabase { + [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPContentDeploymentJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPContentDeploymentPath { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPDeletedSite { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPDiagnosticsPerformanceCounter { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)] + [string] + ${Category}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${Counter}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${Instance}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${WebFrontEnd}, + + [Parameter(ValueFromPipeline=$true)] + [switch] + ${DatabaseServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPDistributedCacheServiceInstance { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEduClassMember { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${UserAlias}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${ClassId}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchComponent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchTopology}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchContentEnrichmentConfiguration { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchCrawlContentSource { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchCrawlCustomConnector { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchCrawlDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchCrawlExtension { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchCrawlLogReadPermission { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SearchApplication}, + + [guid] + ${Tenant}, + + [string] + ${UserNames}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchCrawlMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchCrawlRule { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchFileFormat { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchLanguageResourcePhrase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [object] + ${Type}, + + [string] + ${Language}, + + [string] + ${Mapping}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [guid] + ${SourceId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchLinksDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchMetadataCategory { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchMetadataManagedProperty { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchMetadataMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchQueryAuthority { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchQueryDemoted { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchQueryKeyword { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchQueryScope { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Alias('u')] + [uri] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchQueryScopeRule { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('u')] + [uri] + ${Url}, + + [Alias('n')] + [object] + ${Scope}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchRankingModel { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchResultItemType { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchApplicationProxy}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchResultSource { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchSecurityTrimmer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${RemoveData}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchServiceApplicationSiteSettings { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [guid] + ${TenantId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchSiteHitRule { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchService}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchTenantConfiguration { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Identity')] + [guid] + ${SiteSubscriptionId}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchTenantSchema { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchTopology { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPExcelBIServer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPExcelBlockedFileType { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPExcelDataConnectionLibrary { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPExcelDataProvider { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPExcelFileLocation { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPExcelUserDefinedFunction { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPInfoPathUserAgent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPManagedAccount { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='ChangePassword')] + [switch] + ${ChangePassword}, + + [Parameter(ParameterSetName='ChangePassword', Mandatory=$true)] + [securestring] + ${NewPassword}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPManagedPath { + [CmdletBinding(DefaultParameterSetName='WebApplication', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='WebApplication', Mandatory=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='HostHeader', Mandatory=$true)] + [switch] + ${HostHeader}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPODataConnectionSetting { + [CmdletBinding(DefaultParameterSetName='Name', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ParameterSetName='Name', Mandatory=$true)] + [ValidateNotNull()] + [string] + ${Name}, + + [Parameter(ParameterSetName='Identity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPPerformancePointServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPPerformancePointServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPPerformancePointServiceApplicationTrustedLocation { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPPluggableSecurityTrimmer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNull()] + [guid] + ${UserProfileApplicationProxyId}, + + [Parameter(Mandatory=$true)] + [int] + ${PlugInId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPProfileLeader { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SiteSubscription}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPProfileSyncConnection { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplication}, + + [Parameter(Mandatory=$true)] + [string] + ${ConnectionForestName}, + + [Parameter(Mandatory=$true)] + [string] + ${ConnectionDomain}, + + [Parameter(Mandatory=$true)] + [string] + ${ConnectionUserName}, + + [Parameter(Mandatory=$true)] + [securestring] + ${ConnectionPassword}, + + [string] + ${ConnectionServerName}, + + [string] + ${ConnectionNamingContext}, + + [Parameter(Mandatory=$true)] + [string] + ${ConnectionSynchronizationOU}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPRoutingMachineInfo { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPRoutingMachinePool { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPRoutingRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPScaleOutDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Database}, + + [switch] + ${DeleteData}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSecureStoreApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSecureStoreSystemAccount { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPServerScaleOutDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Database}, + + [switch] + ${DeleteData}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNull()] + [switch] + ${RemoveData}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPServiceApplicationPool { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNull()] + [switch] + ${RemoveData}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPServiceApplicationProxyGroup { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPServiceApplicationProxyGroupMember { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1)] + [Alias('Proxy')] + [ValidateNotNull()] + [object] + ${Member}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPShellAdmin { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${UserName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${database}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSite { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${Identity}, + + [switch] + ${DeleteADAccounts}, + + [switch] + ${GradualDelete}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteSubscription { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteSubscriptionBusinessDataCatalogConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteSubscriptionFeaturePack { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteSubscriptionFeaturePackMember { + [CmdletBinding(DefaultParameterSetName='SingleFeatureDefinition', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='SingleFeatureDefinition', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${FeatureDefinition}, + + [Parameter(ParameterSetName='AllFeatureDefinitions', Mandatory=$true)] + [switch] + ${AllFeatureDefinitions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteSubscriptionMetadataConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteSubscriptionProfileConfig { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='Default', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Default', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ParameterSetName='ServiceContext', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteSubscriptionSettings { + [CmdletBinding(DefaultParameterSetName='SpecifySiteSubscriptions', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='SpecifySiteSubscriptions', Mandatory=$true)] + [ValidateNotNull()] + [guid[]] + ${SiteSubscriptions}, + + [Parameter(ParameterSetName='FindAllOrphans', Mandatory=$true)] + [ValidateSet('True')] + [switch] + ${FindAllOrphans}, + + [Parameter(ParameterSetName='FindAllOrphans')] + [ValidateNotNull()] + [guid[]] + ${AlternativeSiteSubscriptions}, + + [Parameter(ParameterSetName='FindAllOrphans')] + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteUpgradeSessionInfo { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteURL { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSocialItemByDate { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SiteSubscription}, + + [bool] + ${RemoveTags}, + + [bool] + ${RemoveComments}, + + [bool] + ${RemoveRatings}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [datetime] + ${EndDate}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSolution { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [uint32] + ${Language}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSolutionDeploymentLock { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPStateServiceDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPThrottlingRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPTranslationServiceJobHistory { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [switch] + ${IncludeActiveJobs}, + + [System.Nullable[datetime]] + ${BeforeDate}, + + [System.Nullable[guid]] + ${JobId}, + + [System.Nullable[guid]] + ${PartitionId}, + + [switch] + ${AllPartitions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPTrustedIdentityTokenIssuer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPTrustedRootAuthority { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPTrustedSecurityTokenIssuer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPTrustedServiceTokenIssuer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPUsageApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${UsageService}, + + [switch] + ${RemoveData}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPUser { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('UserAlias')] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Web}, + + [object] + ${Group}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPUserLicenseMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNull()] + [System.Collections.Generic.List[guid]] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPUserSettingsProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPUserSolution { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPVisioSafeDataProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${VisioServiceApplication}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DataProviderId}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [int] + ${DataProviderType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPWeb { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${Recycle}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPWebApplication { + [CmdletBinding(DefaultParameterSetName='RemoveWebApp', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='RemoveZoneOfWebApp', Mandatory=$true)] + [object] + ${Zone}, + + [Parameter(ParameterSetName='RemoveWebApp')] + [switch] + ${RemoveContentDatabases}, + + [switch] + ${DeleteIISSite}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPWebApplicationAppDomain { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPWOPIBinding { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='Identity', Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Filter')] + [ValidateNotNullOrEmpty()] + [string] + ${Action}, + + [Parameter(ParameterSetName='Filter')] + [ValidateNotNullOrEmpty()] + [string] + ${Extension}, + + [Parameter(ParameterSetName='Filter')] + [ValidateNotNullOrEmpty()] + [string] + ${ProgId}, + + [Parameter(ParameterSetName='Filter')] + [ValidateNotNullOrEmpty()] + [string] + ${Application}, + + [Parameter(ParameterSetName='Filter')] + [ValidateNotNullOrEmpty()] + [string] + ${Server}, + + [Parameter(ParameterSetName='Filter')] + [ValidateNotNullOrEmpty()] + [string] + ${WOPIZone}, + + [Parameter(ParameterSetName='RemoveAll')] + [switch] + ${All}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPWOPISuppressionSetting { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='DocTypeAndAction')] + [ValidateNotNullOrEmpty()] + [string] + ${Extension}, + + [Parameter(ParameterSetName='DocTypeAndAction')] + [ValidateNotNullOrEmpty()] + [string] + ${ProgId}, + + [Parameter(ParameterSetName='DocTypeAndAction')] + [ValidateNotNullOrEmpty()] + [string] + ${Action}, + + [Parameter(ParameterSetName='Identity', ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPWordConversionServiceJobHistory { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [switch] + ${IncludeActiveJobs}, + + [System.Nullable[datetime]] + ${BeforeDate}, + + [System.Nullable[guid]] + ${JobId}, + + [System.Nullable[guid]] + ${SubscriptionId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Rename-SPServer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Address')] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Repair-SPManagedAccountDeployment { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Repair-SPSite { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [guid] + ${RuleId}, + + [switch] + ${RunAlways}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Request-SPUpgradeEvaluationSite { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${NoUpgrade}, + + [switch] + ${Email}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Reset-SPAccessServicesDatabasePassword { + [CmdletBinding(DefaultParameterSetName='ResetAllApps', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ResetSingleApp', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Database}, + + [Parameter(ParameterSetName='ResetAllApps', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='ResetSingleApp', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Restart-SPAppInstanceJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${AppInstance}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Restore-SPDeletedSite { + [CmdletBinding(DefaultParameterSetName='DatabaseFromPipebind', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Restore-SPEnterpriseSearchServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [Parameter(ParameterSetName='Config', Mandatory=$true)] + [string] + ${DatabaseServer}, + + [Parameter(ParameterSetName='Config', Mandatory=$true)] + [string] + ${DatabaseName}, + + [Parameter(ParameterSetName='Config')] + [string] + ${DatabaseUsername}, + + [Parameter(ParameterSetName='Config')] + [securestring] + ${DatabasePassword}, + + [Parameter(ParameterSetName='Config')] + [string] + ${FailoverDatabaseServer}, + + [Parameter(ParameterSetName='Full', Mandatory=$true)] + [string] + ${TopologyFile}, + + [Parameter(Mandatory=$true)] + [object] + ${ApplicationPool}, + + [Parameter(ParameterSetName='Config', Mandatory=$true)] + [object] + ${AdminSearchServiceInstance}, + + [Parameter(ParameterSetName='Full')] + [switch] + ${KeepId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Restore-SPEnterpriseSearchServiceApplicationIndex { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [object] + ${SearchApplication}, + + [Parameter(ParameterSetName='RestoreProgress', Mandatory=$true, Position=1)] + [string] + ${Handle}, + + [Parameter(ParameterSetName='Restore', Mandatory=$true, Position=1)] + [string] + ${BackupFolder}, + + [Parameter(ParameterSetName='Restore', Position=2)] + [switch] + ${AllReplicas}, + + [Parameter(ParameterSetName='Restore', Position=3)] + [switch] + ${AllowMove}, + + [Parameter(Position=4)] + [int] + ${Retries}, + + [Parameter(Position=5)] + [int] + ${RetryPauseSeconds}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Restore-SPFarm { + [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [string] + ${Directory}, + + [Parameter(ParameterSetName='DefaultSet', Mandatory=$true)] + [ValidateSet('New','Overwrite')] + [string] + ${RestoreMethod}, + + [Parameter(ParameterSetName='DefaultSet')] + [int] + ${RestoreThreads}, + + [Parameter(ParameterSetName='DefaultSet')] + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [guid] + ${BackupId}, + + [Parameter(ParameterSetName='DefaultSet')] + [string] + ${NewDatabaseServer}, + + [Parameter(ParameterSetName='DefaultSet', ValueFromPipeline=$true)] + [pscredential] + ${FarmCredentials}, + + [string] + ${Item}, + + [Parameter(ParameterSetName='ShowTree', Mandatory=$true)] + [switch] + ${ShowTree}, + + [switch] + ${ConfigurationOnly}, + + [Parameter(ParameterSetName='DefaultSet')] + [int] + ${Percentage}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Restore-SPSite { + [CmdletBinding(DefaultParameterSetName='DatabaseFromPipebind', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [string] + ${Path}, + + [string] + ${HostHeaderWebApplication}, + + [switch] + ${Force}, + + [switch] + ${GradualDelete}, + + [Parameter(ParameterSetName='DatabaseFromPipebind', ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(ParameterSetName='DatabaseParameter')] + [string] + ${DatabaseName}, + + [Parameter(ParameterSetName='DatabaseParameter')] + [string] + ${DatabaseServer}, + + [switch] + ${PreserveSiteID}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Resume-SPEnterpriseSearchServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Resume-SPStateServiceDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Revoke-SPBusinessDataCatalogMetadataObject { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Principal}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${Right}, + + [string] + ${SettingId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Revoke-SPObjectSecurity { + [CmdletBinding(DefaultParameterSetName='RevokeOne')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='RevokeOne', Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${Principal}, + + [Parameter(ParameterSetName='RevokeOne', Position=2)] + [ValidateNotNull()] + [string[]] + ${Rights}, + + [Parameter(ParameterSetName='RevokeAll', Mandatory=$true)] + [switch] + ${All}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAccessServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [ValidateRange(1, 255)] + [int] + ${ColumnsMax}, + + [ValidateRange(1, 200000)] + [int] + ${RowsMax}, + + [ValidateRange(1, 20)] + [int] + ${SourcesMax}, + + [ValidateRange(0, 32)] + [int] + ${OutputCalculatedColumnsMax}, + + [ValidateRange(0, 8)] + [int] + ${OrderByMax}, + + [switch] + ${OuterJoinsAllowed}, + + [switch] + ${NonRemotableQueriesAllowed}, + + [ValidateRange(-1, 2147483647)] + [int] + ${RecordsInTableMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${ApplicationLogSizeMax}, + + [ValidateRange(-1, 2073600)] + [int] + ${RequestDurationMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${SessionsPerUserMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${SessionsPerAnonymousUserMax}, + + [ValidateRange(-1, 2073600)] + [int] + ${CacheTimeout}, + + [ValidateRange(0, 4096)] + [int] + ${SessionMemoryMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${PrivateBytesMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${TemplateSizeMax}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAccessServicesApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [ValidateRange(-1, 2073600)] + [int] + ${RequestDurationMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${SessionsPerUserMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${SessionsPerAnonymousUserMax}, + + [ValidateRange(-1, 2073600)] + [int] + ${CacheTimeout}, + + [ValidateRange(-1, 2147483647)] + [int] + ${PrivateBytesMax}, + + [ValidateRange(-1, 1440)] + [int] + ${RecoveryPointObjective}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAccessServicesDatabaseServer { + [CmdletBinding(DefaultParameterSetName='SetCredentialsParameterSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='SetCredentialsParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='SetUserDomainParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='SetAvailableForCreateParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='SetEncryptParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='SetSecondaryDatabaseServerNameParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='SetFailoverParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceContext}, + + [Parameter(ParameterSetName='SetFailoverParameterSet', Mandatory=$true)] + [Parameter(Mandatory=$true)] + [Parameter(ParameterSetName='SetCredentialsParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetAvailableForCreateParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetEncryptParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetSecondaryDatabaseServerNameParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetUserDomainParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${DatabaseServerGroup}, + + [Parameter(Mandatory=$true)] + [Parameter(ParameterSetName='SetSecondaryDatabaseServerNameParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetCredentialsParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetAvailableForCreateParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetEncryptParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetUserDomainParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetFailoverParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${DatabaseServer}, + + [Parameter(ParameterSetName='SetCredentialsParameterSet')] + [string] + ${DatabaseServerName}, + + [Parameter(ParameterSetName='SetCredentialsParameterSet')] + [pscredential] + ${DatabaseServerCredentials}, + + [Parameter(ParameterSetName='SetAvailableForCreateParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [bool] + ${AvailableForCreate}, + + [Parameter(ParameterSetName='SetAvailableForCreateParameterSet')] + [ValidateNotNullOrEmpty()] + [bool] + ${Exclusive}, + + [Parameter(ParameterSetName='SetEncryptParameterSet', Mandatory=$true)] + [bool] + ${Encrypt}, + + [Parameter(ParameterSetName='SetEncryptParameterSet', Mandatory=$true)] + [bool] + ${TrustServerCertificate}, + + [Parameter(ParameterSetName='SetSecondaryDatabaseServerNameParameterSet')] + [string] + ${SecondaryDatabaseServerName}, + + [Parameter(ParameterSetName='SetFailoverParameterSet', Mandatory=$true)] + [bool] + ${Failover}, + + [Parameter(ParameterSetName='SetUserDomainParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${UserDomain}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAccessServicesDatabaseServerGroupMapping { + [CmdletBinding(DefaultParameterSetName='SetDatabaseServerGroupMappingParameter', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='SetDatabaseServerGroupMappingParameter', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='ClearDatabaseServerGroupMappingParameterSetName', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceContext}, + + [Parameter(ParameterSetName='SetDatabaseServerGroupMappingParameter', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${DatabaseServerGroup}, + + [Parameter(ParameterSetName='SetDatabaseServerGroupMappingParameter')] + [Parameter(ParameterSetName='ClearDatabaseServerGroupMappingParameterSetName')] + [switch] + ${CorporateCatalog}, + + [Parameter(ParameterSetName='ClearDatabaseServerGroupMappingParameterSetName')] + [Parameter(ParameterSetName='SetDatabaseServerGroupMappingParameter')] + [switch] + ${ObjectModel}, + + [Parameter(ParameterSetName='SetDatabaseServerGroupMappingParameter')] + [Parameter(ParameterSetName='ClearDatabaseServerGroupMappingParameterSetName')] + [switch] + ${RemoteObjectModel}, + + [Parameter(ParameterSetName='ClearDatabaseServerGroupMappingParameterSetName')] + [Parameter(ParameterSetName='SetDatabaseServerGroupMappingParameter')] + [switch] + ${DeveloperSite}, + + [Parameter(ParameterSetName='SetDatabaseServerGroupMappingParameter')] + [Parameter(ParameterSetName='ClearDatabaseServerGroupMappingParameterSetName')] + [switch] + ${StoreFront}, + + [Parameter(ParameterSetName='ClearDatabaseServerGroupMappingParameterSetName', Mandatory=$true)] + [switch] + ${ClearMapping}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAlternateURL { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Url}, + + [object] + ${Zone}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppAcquisitionConfiguration { + [CmdletBinding(DefaultParameterSetName='MarketplaceSettingsInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [bool] + ${Enable}, + + [Parameter(ParameterSetName='MarketplaceSettingsInWebApplication', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='MarketplaceSettingsInSiteSubscription', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppAutoProvisionConnection { + [CmdletBinding()] +param( + [object] + ${SiteSubscription}, + + [Parameter(ParameterSetName='WebHostEndPoint', Mandatory=$true)] + [Parameter(ParameterSetName='WebHostSetup', Mandatory=$true)] + [Parameter(ParameterSetName='WebHostCredential', Mandatory=$true)] + [object] + ${ConnectionType}, + + [Parameter(ParameterSetName='WebHostSetup', Mandatory=$true)] + [Parameter(ParameterSetName='WebHostCredential', Mandatory=$true)] + [string] + ${Username}, + + [Parameter(ParameterSetName='WebHostSetup', Mandatory=$true)] + [Parameter(ParameterSetName='WebHostCredential', Mandatory=$true)] + [string] + ${Password}, + + [Parameter(ParameterSetName='WebHostEndPoint', Mandatory=$true)] + [Parameter(ParameterSetName='WebHostSetup', Mandatory=$true)] + [string] + ${EndPoint}, + + [Parameter(ParameterSetName='Remove', Mandatory=$true)] + [switch] + ${Remove}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppDisablingConfiguration { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [bool] + ${Enable}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppDomain { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [AllowNull()] + [AllowEmptyString()] + [string] + ${AppDomain}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppHostingQuotaConfiguration { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SiteSubscription}, + + [Parameter(Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [double] + ${AppHostingLicenseQuota}, + + [Parameter(Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [double] + ${AppInstanceCountQuota}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppManagementDeploymentId { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [guid] + ${DeploymentId}, + + [Parameter(ValueFromPipeline=$true)] + [Alias('Subscription')] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${AppManagementServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppPrincipalPermission { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${AppPrincipal}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Scope}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Right}, + + [switch] + ${EnableAppOnlyPolicy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppScaleProfile { + [CmdletBinding()] +param( + [ValidateNotNullOrEmpty()] + [string] + ${MaxDatabaseSize}, + + [ValidateRange(1, 255)] + [int] + ${RemoteWebSiteInstanceCount}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppSiteDomain { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppSiteSubscriptionName { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [object] + ${SiteSubscription}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppStateUpdateInterval { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateRange(0, 32768)] + [int] + ${AppStateSyncHours}, + + [Parameter(Mandatory=$true)] + [ValidateRange(0, 32768)] + [int] + ${FastAppRevocationHours}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppStoreConfiguration { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${Url}, + + [Parameter(Mandatory=$true)] + [bool] + ${Enable}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAuthenticationRealm { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [string] + ${Realm}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPBingMapsBlock { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0, HelpMessage='Block Bing Maps in all locales.')] + [switch] + ${BlockBingMapsInAllLocales}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPBingMapsKey { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, HelpMessage='Enter the Bing Maps API key.')] + [string] + ${BingKey}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPBrowserCustomerExperienceImprovementProgram { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [Parameter(ParameterSetName='Farm', Mandatory=$true)] + [switch] + ${Farm}, + + [Parameter(ParameterSetName='WebApplication', Mandatory=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='SiteSubscription', Mandatory=$true)] + [object] + ${SiteSubscription}, + + [switch] + ${Enable}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPBusinessDataCatalogEntityNotificationWeb { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Web}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPBusinessDataCatalogMetadataObject { + [CmdletBinding(DefaultParameterSetName='NameValue', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Display')] + [string] + ${DisplayName}, + + [Parameter(ParameterSetName='NameRemove')] + [Parameter(ParameterSetName='NameValue')] + [ValidateNotNull()] + [string] + ${PropertyName}, + + [Parameter(ParameterSetName='NameValue')] + [psobject] + ${PropertyValue}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='NameRemove')] + [switch] + ${Remove}, + + [string] + ${SettingId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPBusinessDataCatalogServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${Sharing}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${DatabaseName}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${FailoverDatabaseServer}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [object] + ${ApplicationPool}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${DatabaseUsername}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [securestring] + ${DatabasePassword}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPBusinessDataCatalogThrottleConfig { + [CmdletBinding(DefaultParameterSetName='MaxDefault', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='MaxDefault', Mandatory=$true)] + [int] + ${Maximum}, + + [Parameter(ParameterSetName='MaxDefault', Mandatory=$true)] + [int] + ${Default}, + + [Parameter(ParameterSetName='Enforcement', Mandatory=$true)] + [switch] + ${Enforced}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPCentralAdministration { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [int] + ${Port}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPClaimProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [switch] + ${Enabled}, + + [switch] + ${Default}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPContentDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateRange(1, 2147483647)] + [int] + ${MaxSiteCount}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${WarningSiteCount}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${Status}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPContentDeploymentJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${Description}, + + [object] + ${Scope}, + + [string] + ${Schedule}, + + [switch] + ${ScheduleEnabled}, + + [switch] + ${IncrementalEnabled}, + + [object] + ${SqlSnapshotSetting}, + + [switch] + ${HostingSupportEnabled}, + + [object] + ${EmailNotifications}, + + [string[]] + ${EmailAddresses}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPContentDeploymentPath { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${Description}, + + [uri] + ${DestinationCentralAdministrationURL}, + + [object] + ${Authentication}, + + [pscredential] + ${PathAccount}, + + [switch] + ${DeployUserNamesEnabled}, + + [object] + ${DeploySecurityInformation}, + + [switch] + ${EventReceiversEnabled}, + + [switch] + ${CompressionEnabled}, + + [switch] + ${PathEnabled}, + + [object] + ${KeepTemporaryFilesOptions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPCustomLayoutsPage { + [CmdletBinding(DefaultParameterSetName='CustomPage', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='CustomPage', Mandatory=$true)] + [string] + ${RelativePath}, + + [Parameter(ParameterSetName='CustomPage')] + [Parameter(ParameterSetName='ResetCustomPage')] + [ValidateRange(14, 15)] + [int] + ${CompatibilityLevel}, + + [Parameter(ParameterSetName='ResetCustomPage', Mandatory=$true)] + [switch] + ${Reset}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPDataConnectionFile { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [ValidateLength(0, 255)] + [string] + ${DisplayName}, + + [ValidateLength(0, 255)] + [string] + ${Description}, + + [ValidateLength(0, 255)] + [string] + ${Category}, + + [ValidateSet('true','false')] + [string] + ${WebAccessible}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPDesignerSettings { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='WebApplication', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${WebApplication}, + + [bool] + ${AllowDesigner}, + + [bool] + ${AllowRevertFromTemplate}, + + [bool] + ${AllowMasterPageEditing}, + + [bool] + ${ShowURLStructure}, + + [string] + ${RequiredDesignerVersion}, + + [string] + ${DesignerDownloadUrl}, + + [bool] + ${AllowCreateDeclarativeWorkflow}, + + [bool] + ${AllowSavePublishDeclarativeWorkflow}, + + [bool] + ${AllowSaveDeclarativeWorkflowAsTemplate}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPDiagnosticConfig { + [CmdletBinding()] +param( + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${AllowLegacyTraceProviders}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${AppAnalyticsAutomaticUploadEnabled}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${CustomerExperienceImprovementProgramEnabled}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${ErrorReportingEnabled}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${ErrorReportingAutomaticUploadEnabled}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${DownloadErrorReportingUpdatesEnabled}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateRange(1, 366)] + [int] + ${DaysToKeepLogs}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${LogMaxDiskSpaceUsageEnabled}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateRange(1, 1000)] + [int] + ${LogDiskSpaceUsageGB}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${LogLocation}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateRange(1, 1440)] + [int] + ${LogCutInterval}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${EventLogFloodProtectionEnabled}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateRange(1, 100)] + [int] + ${EventLogFloodProtectionThreshold}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateRange(1, 1440)] + [int] + ${EventLogFloodProtectionTriggerPeriod}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateRange(1, 1440)] + [int] + ${EventLogFloodProtectionQuietPeriod}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateRange(1, 1440)] + [int] + ${EventLogFloodProtectionNotifyInterval}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${ScriptErrorReportingEnabled}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${ScriptErrorReportingRequireAuth}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateRange(1, 1440)] + [int] + ${ScriptErrorReportingDelay}, + + [Parameter(ValueFromPipeline=$true)] + [psobject] + ${InputObject}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPDiagnosticsProvider { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${Enable}, + + [ValidateRange(1, 31)] + [int] + ${DaysRetained}, + + [ValidateRange(1, 9223372036854775807)] + [long] + ${MaxTotalSizeInBytes}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPDistributedCacheClientSetting { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ContainerType}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${DistributedCacheClientSettings}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEduServiceSetting { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [object] + ${Service}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Site}, + + [Parameter(Position=0)] + [bool] + ${Enabled}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchAdministrationComponent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [string] + ${StoragePath}, + + [object] + ${SearchServiceInstance}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchContentEnrichmentConfiguration { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ContentEnrichmentConfiguration}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchCrawlContentSource { + [CmdletBinding(DefaultParameterSetName='NoSchedule', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Alias('n')] + [string] + ${Name}, + + [Alias('t')] + [string] + ${Tag}, + + [Alias('s')] + [string] + ${StartAddresses}, + + [Alias('p')] + [object] + ${CrawlPriority}, + + [Parameter(ParameterSetName='Weekly')] + [Parameter(ParameterSetName='Daily', Mandatory=$true)] + [Parameter(ParameterSetName='RemoveSchedule')] + [Parameter(ParameterSetName='MonthlyDate')] + [object] + ${ScheduleType}, + + [Parameter(ParameterSetName='Daily')] + [Alias('daily')] + [switch] + ${DailyCrawlSchedule}, + + [Parameter(ParameterSetName='Weekly')] + [Alias('weekly')] + [switch] + ${WeeklyCrawlSchedule}, + + [Parameter(ParameterSetName='MonthlyDate')] + [Alias('monthly')] + [switch] + ${MonthlyCrawlSchedule}, + + [Parameter(ParameterSetName='RemoveSchedule')] + [switch] + ${RemoveCrawlSchedule}, + + [Parameter(ParameterSetName='MonthlyDate')] + [Parameter(ParameterSetName='Daily')] + [Parameter(ParameterSetName='Weekly')] + [Alias('start')] + [System.Nullable[datetime]] + ${CrawlScheduleStartDateTime}, + + [Parameter(ParameterSetName='MonthlyDate')] + [Parameter(ParameterSetName='Daily')] + [Parameter(ParameterSetName='Weekly')] + [Alias('duration')] + [System.Nullable[int]] + ${CrawlScheduleRepeatDuration}, + + [Parameter(ParameterSetName='MonthlyDate')] + [Parameter(ParameterSetName='Daily')] + [Parameter(ParameterSetName='Weekly')] + [Alias('interval')] + [System.Nullable[int]] + ${CrawlScheduleRepeatInterval}, + + [Parameter(ParameterSetName='Daily')] + [Parameter(ParameterSetName='Weekly')] + [Alias('every')] + [System.Nullable[int]] + ${CrawlScheduleRunEveryInterval}, + + [Parameter(ParameterSetName='Weekly')] + [object] + ${CrawlScheduleDaysOfWeek}, + + [Parameter(ParameterSetName='MonthlyDate')] + [System.Nullable[int]] + ${CrawlScheduleDaysOfMonth}, + + [Parameter(ParameterSetName='MonthlyDate')] + [Alias('month')] + [object] + ${CrawlScheduleMonthsOfYear}, + + [System.Nullable[int]] + ${MaxPageEnumerationDepth}, + + [System.Nullable[int]] + ${MaxSiteEnumerationDepth}, + + [object] + ${BDCApplicationProxyGroup}, + + [string[]] + ${LOBSystemSet}, + + [string] + ${CustomProtocol}, + + [System.Nullable[bool]] + ${EnableContinuousCrawls}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchCrawlDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [string] + ${DatabaseServer}, + + [string] + ${DatabaseName}, + + [string] + ${DatabaseUsername}, + + [securestring] + ${DatabasePassword}, + + [string] + ${FailoverDatabaseServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchCrawlLogReadPermission { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [guid] + ${Tenant}, + + [string] + ${UserNames}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchCrawlRule { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Alias('t')] + [object] + ${Type}, + + [System.Nullable[bool]] + ${IsAdvancedRegularExpression}, + + [System.Nullable[bool]] + ${CrawlAsHttp}, + + [System.Nullable[bool]] + ${FollowComplexUrls}, + + [System.Nullable[int]] + ${PluggableSecurityTimmerId}, + + [System.Nullable[bool]] + ${SuppressIndexing}, + + [System.Nullable[int]] + ${Priority}, + + [string] + ${ContentClass}, + + [object] + ${AuthenticationType}, + + [string] + ${AccountName}, + + [securestring] + ${AccountPassword}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchFileFormatState { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1)] + [bool] + ${Enable}, + + [Parameter(Position=2)] + [System.Nullable[bool]] + ${UseIFilter}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchLinguisticComponentsStatus { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [System.Nullable[bool]] + ${ThesaurusEnabled}, + + [System.Nullable[bool]] + ${StemmingEnabled}, + + [System.Nullable[bool]] + ${QuerySpellingEnabled}, + + [System.Nullable[bool]] + ${EntityExtractionEnabled}, + + [System.Nullable[bool]] + ${AllEnabled}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchLinksDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [string] + ${DatabaseServer}, + + [string] + ${DatabaseName}, + + [string] + ${DatabaseUsername}, + + [securestring] + ${DatabasePassword}, + + [string] + ${FailoverDatabaseServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchMetadataCategory { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Alias('n')] + [string] + ${Name}, + + [Alias('d')] + [System.Nullable[bool]] + ${DiscoverNewProperties}, + + [Alias('m')] + [System.Nullable[bool]] + ${MapToContents}, + + [Alias('auto')] + [System.Nullable[bool]] + ${AutoCreateNewManagedProperties}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchMetadataCrawledProperty { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [Alias('im')] + [System.Nullable[bool]] + ${IsMappedToContents}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchMetadataManagedProperty { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Alias('n')] + [string] + ${Name}, + + [Alias('d')] + [string] + ${Description}, + + [Alias('f')] + [System.Nullable[bool]] + ${FullTextQueriable}, + + [Alias('r')] + [System.Nullable[bool]] + ${Retrievable}, + + [Alias('e')] + [System.Nullable[bool]] + ${EnabledForScoping}, + + [Alias('nn')] + [System.Nullable[bool]] + ${NameNormalized}, + + [Alias('rp')] + [System.Nullable[bool]] + ${RespectPriority}, + + [Alias('rd')] + [System.Nullable[bool]] + ${RemoveDuplicates}, + + [Alias('im5')] + [Obsolete('This property is replaced by IncludeInAlertSignature.')] + [System.Nullable[bool]] + ${IncludeInMd5}, + + [Alias('ia')] + [System.Nullable[bool]] + ${IncludeInAlertSignature}, + + [Alias('sfa')] + [System.Nullable[bool]] + ${SafeForAnonymous}, + + [Alias('nw')] + [System.Nullable[bool]] + ${NoWordBreaker}, + + [Alias('u')] + [System.Nullable[int16]] + ${UserFlags}, + + [Alias('qir')] + [System.Nullable[bool]] + ${EnabledForQueryIndependentRank}, + + [Alias('def')] + [System.Nullable[uint32]] + ${DefaultForQueryIndependentRank}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchMetadataMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [object] + ${ManagedProperty}, + + [object] + ${CrawledProperty}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchPrimaryHostController { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${SearchServiceInstance}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchQueryAuthority { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Alias('l')] + [System.Nullable[float]] + ${Level}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchQueryKeyword { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${Site}, + + [Alias('t')] + [string] + ${Term}, + + [Alias('d')] + [string] + ${Definition}, + + [Alias('c')] + [string] + ${Contact}, + + [Alias('s')] + [System.Nullable[datetime]] + ${StartDate}, + + [Alias('e')] + [System.Nullable[datetime]] + ${EndDate}, + + [Alias('r')] + [System.Nullable[datetime]] + ${ReviewDate}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchQueryScope { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [uri] + ${Url}, + + [Parameter(Mandatory=$true)] + [Alias('u')] + [string] + ${AlternateResultsPage}, + + [Alias('n')] + [string] + ${Name}, + + [Alias('d')] + [string] + ${Description}, + + [Alias('disp')] + [System.Nullable[bool]] + ${DisplayInAdminUI}, + + [Alias('type')] + [System.Nullable[int]] + ${CompilationType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchQueryScopeRule { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('u')] + [uri] + ${Url}, + + [Alias('n')] + [object] + ${Scope}, + + [Alias('f')] + [string] + ${FilterBehavior}, + + [Alias('ut')] + [string] + ${UrlScopeRuleType}, + + [Alias('text')] + [string] + ${MatchingString}, + + [Alias('value')] + [string] + ${PropertyValue}, + + [Alias('mname')] + [string] + ${ManagedPropertyName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchQuerySpellingCorrection { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [System.Nullable[bool]] + ${ContentAlignmentEnabled}, + + [System.Nullable[int]] + ${MaxDictionarySize}, + + [System.Nullable[bool]] + ${DiacriticsInSuggestionsEnabled}, + + [System.Nullable[int]] + ${TermFrequencyThreshold}, + + [System.Nullable[bool]] + ${SecurityTrimmingEnabled}, + + [object] + ${SpellingDictionary}, + + [System.Nullable[timespan]] + ${MaxProcessingTime}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchRankingModel { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(Mandatory=$true)] + [string] + ${RankingModelXML}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchResultItemType { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchApplicationProxy}, + + [Alias('n')] + [string] + ${Name}, + + [Alias('rule')] + [object] + ${Rules}, + + [Alias('priority')] + [System.Nullable[int]] + ${RulePriority}, + + [Alias('dp')] + [string] + ${DisplayProperties}, + + [Alias('sid')] + [System.Nullable[guid]] + ${SourceID}, + + [Alias('url')] + [string] + ${DisplayTemplateUrl}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Alias('opt')] + [System.Nullable[bool]] + ${OptimizeForFrequentUse}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchResultSource { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Alias('o')] + [object] + ${Owner}, + + [string] + ${Name}, + + [string] + ${Description}, + + [string] + ${QueryTemplate}, + + [guid] + ${ProviderId}, + + [string] + ${RemoteUrl}, + + [System.Nullable[bool]] + ${AutoDiscover}, + + [object] + ${AuthenticationType}, + + [string] + ${UserName}, + + [string] + ${Password}, + + [string] + ${SsoId}, + + [System.Nullable[bool]] + ${MakeDefault}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchService { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${ServiceAccount}, + + [securestring] + ${ServicePassword}, + + [string] + ${ContactEmail}, + + [string] + ${ConnectionTimeout}, + + [string] + ${AcknowledgementTimeout}, + + [string] + ${ProxyType}, + + [string] + ${IgnoreSSLWarnings}, + + [string] + ${InternetIdentity}, + + [string] + ${PerformanceLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${FailoverDatabaseServer}, + + [string] + ${DiacriticSensitive}, + + [object] + ${DefaultSearchProvider}, + + [string] + ${VerboseQueryMonitoring}, + + [object] + ${ApplicationPool}, + + [object] + ${AdminApplicationPool}, + + [string] + ${DefaultContentAccessAccountName}, + + [securestring] + ${DefaultContentAccessAccountPassword}, + + [string] + ${DatabaseServer}, + + [string] + ${DatabaseName}, + + [string] + ${DatabaseUsername}, + + [securestring] + ${DatabasePassword}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchServiceInstance { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${DefaultIndexLocation}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchTopology { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPExcelBIServer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${ServerId}, + + [string] + ${Description}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPExcelDataConnectionLibrary { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${Address}, + + [string] + ${Description}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPExcelDataProvider { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${ProviderId}, + + [object] + ${ProviderType}, + + [string] + ${Description}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPExcelFileLocation { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${Address}, + + [object] + ${LocationType}, + + [switch] + ${IncludeChildren}, + + [int] + ${SessionTimeout}, + + [int] + ${ShortSessionTimeout}, + + [int] + ${NewWorkbookSessionTimeout}, + + [int] + ${RequestDurationMax}, + + [int] + ${ChartRenderDurationMax}, + + [int] + ${WorkbookSizeMax}, + + [int] + ${ChartAndImageSizeMax}, + + [int] + ${AutomaticVolatileFunctionCacheLifetime}, + + [object] + ${DefaultWorkbookCalcMode}, + + [object] + ${ExternalDataAllowed}, + + [switch] + ${WarnOnDataRefresh}, + + [switch] + ${DisplayGranularExtDataErrors}, + + [switch] + ${AbortOnRefreshOnOpenFail}, + + [int] + ${PeriodicExtDataCacheLifetime}, + + [int] + ${ManualExtDataCacheLifetime}, + + [int] + ${ConcurrentDataRequestsPerSessionMax}, + + [switch] + ${UdfsAllowed}, + + [string] + ${Description}, + + [switch] + ${RESTExternalDataAllowed}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPExcelServiceApplication { + [CmdletBinding(DefaultParameterSetName='ExistingTargetApplicationParameterSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [int] + ${ExternalDataConnectionLifetime}, + + [Parameter(ParameterSetName='ExistingTargetApplicationParameterSet')] + [string] + ${UnattendedAccountApplicationId}, + + [object] + ${LoadBalancingScheme}, + + [int] + ${SessionsPerUserMax}, + + [int] + ${PrivateBytesMax}, + + [int] + ${MemoryCacheThreshold}, + + [int] + ${UnusedObjectAgeMax}, + + [int] + ${ThrottleAccessViolationsPerSiteCollection}, + + [int] + ${SiteCollectionAnonymousSessionsMax}, + + [string] + ${WorkbookCache}, + + [int] + ${WorkbookCacheSizeMax}, + + [switch] + ${CachingOfUnusedFilesEnable}, + + [object] + ${FileAccessMethod}, + + [object] + ${EncryptedUserConnectionRequired}, + + [switch] + ${CrossDomainAccessAllowed}, + + [switch] + ${TerminateProcessOnAccessViolation}, + + [switch] + ${UseEffectiveUserName}, + + [string] + ${WorkbookModelUsageTracker}, + + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='NewTargetApplicationParameterSet')] + [pscredential] + ${UnattendedServiceAccount}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPExcelUserDefinedFunction { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${Assembly}, + + [object] + ${AssemblyLocation}, + + [switch] + ${Enable}, + + [string] + ${Description}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ExcelServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPFarmConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipelineByPropertyName=$true)] + [int] + ${WorkflowBatchSize}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [int] + ${WorkflowPostponeThreshold}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [int] + ${WorkflowEventDeliveryTimeout}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${InstalledProductsRefresh}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [bool] + ${DataFormWebPartAutoRefreshEnabled}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [bool] + ${ASPScriptOptimizationEnabled}, + + [switch] + ${ServiceConnectionPointDelete}, + + [string] + ${ServiceConnectionPointBindingInformation}, + + [switch] + ${Force}, + + [System.Nullable[switch]] + ${UserAccountDirectoryPathIsImmutable}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPInfoPathFormsService { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [object] + ${Identity}, + + [ValidateSet('true','false')] + [string] + ${AllowUserFormBrowserEnabling}, + + [ValidateSet('true','false')] + [string] + ${AllowUserFormBrowserRendering}, + + [ValidateRange(0, 2147483647)] + [System.Nullable[int]] + ${DefaultDataConnectionTimeout}, + + [ValidateRange(0, 2147483647)] + [System.Nullable[int]] + ${MemoryCacheSize}, + + [ValidateRange(0, 2147483647)] + [System.Nullable[int]] + ${MaxDataConnectionTimeout}, + + [ValidateRange(0, 2147483647)] + [System.Nullable[int]] + ${MaxDataConnectionResponseSize}, + + [ValidateSet('true','false')] + [string] + ${RequireSslForDataConnections}, + + [ValidateSet('true','false')] + [string] + ${AllowEmbeddedSqlForDataConnections}, + + [ValidateSet('true','false')] + [string] + ${AllowUdcAuthenticationForDataConnections}, + + [ValidateSet('true','false')] + [string] + ${AllowUserFormCrossDomainDataConnections}, + + [ValidateRange(0, 999999)] + [System.Nullable[int]] + ${MaxPostbacksPerSession}, + + [ValidateRange(0, 999999)] + [System.Nullable[int]] + ${MaxUserActionsPerPostback}, + + [ValidateRange(0, 999999)] + [System.Nullable[int]] + ${ActiveSessionTimeout}, + + [ValidateRange(0, 99999999)] + [System.Nullable[int]] + ${MaxSizeOfUserFormState}, + + [ValidateSet('true','false')] + [string] + ${AllowViewState}, + + [ValidateRange(0, 99999999)] + [System.Nullable[int]] + ${ViewStateThreshold}, + + [ValidateRange(0, 99999999)] + [System.Nullable[int]] + ${MaxFormLoadTime}, + + [ValidateRange(0, 99999999)] + [System.Nullable[int]] + ${MaxDataConnectionRoundTrip}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPInfoPathFormTemplate { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [ValidateLength(0, 255)] + [string] + ${Category}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPInfoPathWebServiceProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [ValidateSet('true','false')] + [string] + ${AllowWebServiceProxy}, + + [ValidateSet('true','false')] + [string] + ${AllowForUserForms}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPInternalAppStateUpdateInterval { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateRange(0, 32768)] + [int] + ${AppStateSyncHours}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPIRMSettings { + [CmdletBinding(DefaultParameterSetName='UseServiceDiscovery', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [switch] + ${IrmEnabled}, + + [switch] + ${SubscriptionScopeSettingsEnabled}, + + [Parameter(ParameterSetName='UseServiceDiscovery')] + [switch] + ${UseActiveDirectoryDiscovery}, + + [Parameter(ParameterSetName='UseSpecifiedCertificateUrl', Mandatory=$true)] + [uri] + ${CertificateServerUrl}, + + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${ServiceAuthenticationCertificate}, + + [ValidateNotNull()] + [securestring] + ${CertificatePassword}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPLogLevel { + [CmdletBinding()] +param( + [string] + ${TraceSeverity}, + + [string] + ${EventSeverity}, + + [string[]] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [psobject] + ${InputObject}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPManagedAccount { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Schedule}, + + [int] + ${PreExpireDays}, + + [int] + ${EmailNotification}, + + [Parameter(ParameterSetName='AutoGeneratePassword')] + [switch] + ${AutoGeneratePassword}, + + [Parameter(ParameterSetName='NewPasswordAsParameter', Mandatory=$true)] + [securestring] + ${Password}, + + [Parameter(ParameterSetName='NewPassword')] + [switch] + ${SetNewPassword}, + + [Parameter(ParameterSetName='NewPassword', Mandatory=$true)] + [securestring] + ${NewPassword}, + + [Parameter(ParameterSetName='NewPassword', Mandatory=$true)] + [securestring] + ${ConfirmPassword}, + + [Parameter(ParameterSetName='ExistingPassword')] + [switch] + ${UseExistingPassword}, + + [Parameter(ParameterSetName='ExistingPassword', Mandatory=$true)] + [securestring] + ${ExistingPassword}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPMetadataServiceApplication { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [string] + ${AdministratorAccount}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [string] + ${DatabaseName}, + + [string] + ${DatabaseServer}, + + [pscredential] + ${DatabaseCredentials}, + + [string] + ${FailoverDatabaseServer}, + + [string] + ${FullAccessAccount}, + + [string] + ${HubUri}, + + [int] + ${CacheTimeCheckInterval}, + + [int] + ${MaxChannelCache}, + + [switch] + ${DoNotUnpublishAllPackages}, + + [Parameter(ParameterSetName='NoQuota', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='Quota', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='Default', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Name}, + + [string] + ${ReadAccessAccount}, + + [string] + ${RestrictedAccount}, + + [switch] + ${SyndicationErrorReportEnabled}, + + [Parameter(ParameterSetName='NoQuota', Mandatory=$true)] + [switch] + ${DisablePartitionQuota}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${GroupsPerPartition}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${TermSetsPerPartition}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${TermsPerPartition}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${LabelsPerPartition}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${PropertiesPerPartition}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPMetadataServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [switch] + ${ContentTypeSyndicationEnabled}, + + [switch] + ${ContentTypePushdownEnabled}, + + [switch] + ${DefaultKeywordTaxonomy}, + + [switch] + ${DefaultProxyGroup}, + + [switch] + ${DefaultSiteCollectionTaxonomy}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPMobileMessagingAccount { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [Alias('ServiceType','AccountType')] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [string] + ${ServiceName}, + + [string] + ${ServiceUrl}, + + [string] + ${UserId}, + + [string] + ${Password}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPODataConnectionSetting { + [CmdletBinding(DefaultParameterSetName='Name', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ParameterSetName='Name', Mandatory=$true)] + [ValidateNotNull()] + [ValidateLength(0, 246)] + [string] + ${Name}, + + [ValidateNotNull()] + [uri] + ${ServiceAddressURL}, + + [ValidateNotNull()] + [object] + ${AuthenticationMode}, + + [ValidateNotNull()] + [ValidateLength(0, 1024)] + [string] + ${SecureStoreTargetApplicationId}, + + [string] + ${ExtensionProvider}, + + [Parameter(ParameterSetName='Identity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPODataConnectionSettingMetadata { + [CmdletBinding(DefaultParameterSetName='Name', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ParameterSetName='Name', Mandatory=$true)] + [ValidateLength(0, 255)] + [ValidateNotNull()] + [string] + ${Name}, + + [ValidateNotNull()] + [uri] + ${ServiceAddressMetadataURL}, + + [ValidateNotNull()] + [object] + ${AuthenticationMode}, + + [ValidateNotNull()] + [ValidateLength(0, 1024)] + [string] + ${SecureStoreTargetApplicationId}, + + [Parameter(ParameterSetName='Identity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPOfficeStoreAppsDefaultActivation { + [CmdletBinding(DefaultParameterSetName='AppsForOfficeSettingsInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [bool] + ${Enable}, + + [Parameter(ParameterSetName='AppsForOfficeSettingsInWebApplication', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='AppsForOfficeSettingsInSiteSubscription', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPPassPhrase { + [CmdletBinding(DefaultParameterSetName='AcrossFarm', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [securestring] + ${PassPhrase}, + + [Parameter(ParameterSetName='AcrossFarm', Mandatory=$true)] + [securestring] + ${ConfirmPassPhrase}, + + [Parameter(ParameterSetName='LocalOnly')] + [switch] + ${LocalServerOnly}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPPerformancePointSecureDataValues { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true)] + [pscredential] + ${DataSourceUnattendedServiceAccount}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPPerformancePointServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ApplicationPool}, + + [bool] + ${CommentsDisabled}, + + [int] + ${CommentsScorecardMax}, + + [int] + ${IndicatorImageCacheSeconds}, + + [int] + ${DataSourceQueryTimeoutSeconds}, + + [int] + ${FilterRememberUserSelectionsDays}, + + [int] + ${FilterTreeMembersMax}, + + [int] + ${FilterSearchResultsMax}, + + [int] + ${ShowDetailsInitialRows}, + + [bool] + ${ShowDetailsMaxRowsDisabled}, + + [int] + ${ShowDetailsMaxRows}, + + [bool] + ${MSMQEnabled}, + + [string] + ${MSMQName}, + + [int] + ${SessionHistoryHours}, + + [bool] + ${AnalyticQueryLoggingEnabled}, + + [bool] + ${TrustedDataSourceLocationsRestricted}, + + [bool] + ${TrustedContentLocationsRestricted}, + + [int] + ${SelectMeasureMaximum}, + + [int] + ${DecompositionTreeMaximum}, + + [bool] + ${ApplicationProxyCacheEnabled}, + + [bool] + ${ApplicationCacheEnabled}, + + [int] + ${ApplicationCacheMinimumHitCount}, + + [int] + ${AnalyticResultCacheMinimumHitCount}, + + [int] + ${ElementCacheSeconds}, + + [int] + ${AnalyticQueryCellMax}, + + [string] + ${SettingsDatabase}, + + [string] + ${DatabaseServer}, + + [string] + ${DatabaseName}, + + [pscredential] + ${DatabaseSQLAuthenticationCredential}, + + [string] + ${DatabaseFailoverServer}, + + [bool] + ${DatabaseUseWindowsAuthentication}, + + [string] + ${DataSourceUnattendedServiceAccountTargetApplication}, + + [bool] + ${UseEffectiveUserName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPPowerPointConversionServiceApplication { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [uint32] + ${CacheExpirationPeriodInSeconds}, + + [uint32] + ${WorkerProcessCount}, + + [uint32] + ${WorkerKeepAliveTimeoutInSeconds}, + + [uint32] + ${WorkerTimeoutInSeconds}, + + [uint32] + ${MaximumConversionsPerWorker}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPProfileServiceApplication { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [string] + ${Name}, + + [object] + ${ApplicationPool}, + + [pscredential] + ${ProfileDBCredentials}, + + [string] + ${ProfileDBFailoverServer}, + + [pscredential] + ${SocialDBCredentials}, + + [string] + ${SocialDBFailoverServer}, + + [pscredential] + ${ProfileSyncDBCredentials}, + + [string] + ${ProfileSyncDBFailoverServer}, + + [Parameter(ValueFromPipeline=$true)] + [Parameter(ParameterSetName='MySiteSettings', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${MySiteHostLocation}, + + [Parameter(ParameterSetName='MySiteSettings', ValueFromPipeline=$true)] + [object] + ${MySiteManagedPath}, + + [Parameter(ParameterSetName='MySiteSettings')] + [ValidateSet('None','Resolve','Block')] + [string] + ${SiteNamingConflictResolution}, + + [bool] + ${PurgeNonImportedObjects}, + + [bool] + ${UseOnlyPreferredDomainControllers}, + + [bool] + ${GetNonImportedObjects}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPProfileServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [string] + ${Name}, + + [switch] + ${DefaultProxyGroup}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${MySiteHostLocation}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${MySiteManagedPath}, + + [ValidateSet('None','Resolve','Block')] + [string] + ${SiteNamingConflictResolution}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPProfileServiceApplicationSecurity { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [ValidateSet('UserACL','MySiteReaderACL')] + [string] + ${Type}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPRequestManagementSettings { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNull()] + [System.Nullable[switch]] + ${RoutingEnabled}, + + [ValidateNotNull()] + [System.Nullable[switch]] + ${ThrottlingEnabled}, + + [ValidateNotNull()] + [object] + ${RoutingScheme}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPRoutingMachineInfo { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNull()] + [object] + ${Availability}, + + [ValidateNotNull()] + [object] + ${OutgoingScheme}, + + [ValidateRange(1, 65535)] + [ValidateNotNull()] + [System.Nullable[int]] + ${OutgoingPort}, + + [ValidateNotNull()] + [switch] + ${ClearOutgoingPort}, + + [ValidateNotNull()] + [System.Nullable[double]] + ${StaticWeight}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPRoutingMachinePool { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNull()] + [object] + ${MachineTargets}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPRoutingRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNull()] + [object] + ${Criteria}, + + [object] + ${MachinePool}, + + [ValidateNotNull()] + [System.Nullable[int]] + ${ExecutionGroup}, + + [ValidateNotNull()] + [System.Nullable[datetime]] + ${Expiration}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPScaleOutDatabaseDataRange { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Database}, + + [Parameter(Mandatory=$true)] + [object] + ${Range}, + + [byte[]] + ${NewRangePoint}, + + [Parameter(Mandatory=$true)] + [bool] + ${IsUpperSubRange}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPScaleOutDatabaseDataSubRange { + [CmdletBinding(DefaultParameterSetName='AttachedDatabase', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='AttachedDatabase', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [Parameter(ParameterSetName='UnattachedDatabase', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ConnectionString}, + + [Parameter(ParameterSetName='UnattachedDatabase')] + [switch] + ${IsAzureDatabase}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Range}, + + [byte[]] + ${SubRangePoint}, + + [Parameter(Mandatory=$true)] + [object] + ${SubRangeMode}, + + [Parameter(Mandatory=$true)] + [bool] + ${IsUpperSubRange}, + + [switch] + ${IgnoreSubRangePointOnBoundary}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSecureStoreApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [object] + ${Administrator}, + + [object] + ${CredentialsOwnerGroup}, + + [object] + ${Fields}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [object] + ${TargetApplication}, + + [object] + ${TicketRedeemer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSecureStoreDefaultProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [type] + ${Type}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSecureStoreServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [object] + ${ApplicationPool}, + + [switch] + ${AuditingEnabled}, + + [System.Nullable[int]] + ${AuditlogMaxSize}, + + [pscredential] + ${DatabaseCredentials}, + + [string] + ${DatabaseName}, + + [securestring] + ${DatabasePassword}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [string] + ${DatabaseUsername}, + + [string] + ${FailoverDatabaseServer}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${Sharing}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSecurityTokenServiceConfig { + [CmdletBinding(DefaultParameterSetName='SigningCertificateImport', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='SigningCertificateImport')] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${ImportSigningCertificate}, + + [Parameter(ParameterSetName='SigningCertificateReference', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SigningCertificateThumbprint}, + + [Parameter(ParameterSetName='SigningCertificateReference')] + [ValidateNotNullOrEmpty()] + [string] + ${SigningCertificateStoreName}, + + [Parameter(ParameterSetName='SigningCertificateQueue')] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${QueueSigningCertificate}, + + [Parameter(ParameterSetName='QueueSigningCertificateReference', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${QueueSigningCertificateThumbprint}, + + [Parameter(ParameterSetName='QueueSigningCertificateReference')] + [ValidateNotNullOrEmpty()] + [string] + ${QueueSigningCertificateStoreName}, + + [Parameter(ParameterSetName='SigningCertificateRevoke')] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${RevokeSigningCertificate}, + + [Parameter(ParameterSetName='RevokeSigningCertificateReference', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${RevokeSigningCertificateThumbprint}, + + [Parameter(ParameterSetName='RevokeSigningCertificateReference')] + [ValidateNotNullOrEmpty()] + [string] + ${RevokeSigningCertificateStoreName}, + + [int] + ${ServiceTokenLifetime}, + + [int] + ${ServiceTokenCacheExpirationWindow}, + + [int] + ${FormsTokenLifetime}, + + [int] + ${WindowsTokenLifetime}, + + [int] + ${MaxLogonTokenCacheItems}, + + [int] + ${MaxServiceTokenCacheItems}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPServerScaleOutDatabaseDataRange { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Database}, + + [Parameter(Mandatory=$true)] + [object] + ${Range}, + + [byte[]] + ${NewRangePoint}, + + [Parameter(Mandatory=$true)] + [bool] + ${IsUpperSubRange}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPServerScaleOutDatabaseDataSubRange { + [CmdletBinding(DefaultParameterSetName='AttachedDatabase', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='AttachedDatabase', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [Parameter(ParameterSetName='UnattachedDatabase', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ConnectionString}, + + [Parameter(ParameterSetName='UnattachedDatabase')] + [switch] + ${IsAzureDatabase}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Range}, + + [byte[]] + ${SubRangePoint}, + + [Parameter(Mandatory=$true)] + [object] + ${SubRangeMode}, + + [Parameter(Mandatory=$true)] + [bool] + ${IsUpperSubRange}, + + [switch] + ${IgnoreSubRangePointOnBoundary}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNull()] + [object] + ${DefaultEndpoint}, + + [ValidateNotNull()] + [object] + ${ServiceApplicationProxyGroup}, + + [ValidateNotNull()] + [object] + ${IisWebServiceApplicationPool}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPServiceApplicationEndpoint { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='HostName', Mandatory=$true)] + [ValidateNotNull()] + [string] + ${HostName}, + + [Parameter(ParameterSetName='ResetHostName', Mandatory=$true)] + [switch] + ${ResetHostName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPServiceApplicationPool { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Position=1)] + [object] + ${Account}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPServiceApplicationSecurity { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${ObjectSecurity}, + + [switch] + ${Admin}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPServiceHostConfig { + [CmdletBinding(DefaultParameterSetName='SslCertificateImport', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='SslCertificateImport', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='SslCertificateReference', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='SslCertificateReference')] + [Parameter(ParameterSetName='SslCertificateImport')] + [Alias('Port')] + [ValidateRange(1, 65535)] + [int] + ${HttpPort}, + + [Parameter(ParameterSetName='SslCertificateImport')] + [Parameter(ParameterSetName='SslCertificateReference')] + [Alias('SecurePort')] + [ValidateRange(1, 65535)] + [int] + ${HttpsPort}, + + [Parameter(ParameterSetName='SslCertificateImport')] + [Parameter(ParameterSetName='SslCertificateReference')] + [ValidateRange(1, 65535)] + [int] + ${NetTcpPort}, + + [Parameter(ParameterSetName='SslCertificateReference', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SslCertificateThumbprint}, + + [Parameter(ParameterSetName='SslCertificateReference')] + [ValidateNotNullOrEmpty()] + [string] + ${SslCertificateStoreName}, + + [Parameter(ParameterSetName='SslCertificateImport')] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${ImportSslCertificate}, + + [switch] + ${NoWait}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSessionStateService { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [System.Nullable[int]] + ${SessionTimeout}, + + [Parameter(ParameterSetName='AdvancedProvision')] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSite { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Default')] + [object] + ${OwnerAlias}, + + [Parameter(ParameterSetName='Default')] + [object] + ${QuotaTemplate}, + + [Parameter(ParameterSetName='Default')] + [object] + ${Template}, + + [Parameter(ParameterSetName='Default')] + [string] + ${Url}, + + [Parameter(ParameterSetName='Default')] + [long] + ${MaxSize}, + + [Parameter(ParameterSetName='Default')] + [long] + ${WarningSize}, + + [Parameter(ParameterSetName='Default')] + [string] + ${SharingType}, + + [Parameter(ParameterSetName='Default')] + [ValidateSet('Unlock','NoAdditions','ReadOnly','NoAccess')] + [string] + ${LockState}, + + [Parameter(ParameterSetName='Default')] + [object] + ${SecondaryOwnerAlias}, + + [Parameter(ParameterSetName='Default')] + [string] + ${UserAccountDirectoryPath}, + + [Parameter(ParameterSetName='SiteSubscription')] + [object] + ${SiteSubscription}, + + [Parameter(ParameterSetName='SiteSubscription')] + [switch] + ${Force}, + + [object] + ${AdministrationSiteType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSiteAdministration { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Default')] + [object] + ${OwnerAlias}, + + [Parameter(ParameterSetName='Default')] + [object] + ${SecondaryOwnerAlias}, + + [Parameter(ParameterSetName='Default')] + [object] + ${Template}, + + [Parameter(ParameterSetName='Default')] + [ValidateSet('Unlock','NoAdditions','ReadOnly','NoAccess')] + [string] + ${LockState}, + + [Parameter(ParameterSetName='Default')] + [long] + ${MaxSize}, + + [Parameter(ParameterSetName='Default')] + [long] + ${WarningSize}, + + [Parameter(ParameterSetName='SiteSubscription')] + [object] + ${SiteSubscription}, + + [Parameter(ParameterSetName='SiteSubscription')] + [switch] + ${Force}, + + [object] + ${AdministrationSiteType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSiteSubscriptionConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${UserAccountDirectoryPath}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${FeaturePack}, + + [switch] + ${PassThru}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSiteSubscriptionEdiscoveryHub { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${SearchScope}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSiteSubscriptionIRMConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [switch] + ${IrmEnabled}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [uri] + ${CertificateServerUrl}, + + [switch] + ${PassThru}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSiteSubscriptionMetadataConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceProxy}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${HubUri}, + + [switch] + ${DoNotUnpublishAllPackages}, + + [switch] + ${SyndicationErrorReportEnabled}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSiteSubscriptionProfileConfig { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [Parameter(ParameterSetName='MySiteSettings', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${MySiteHostLocation}, + + [Parameter(ParameterSetName='MySiteSettings', ValueFromPipeline=$true)] + [object] + ${MySiteManagedPath}, + + [Parameter(ParameterSetName='MySiteSettings')] + [ValidateSet('None','Resolve','Block')] + [string] + ${SiteNamingConflictResolution}, + + [string] + ${SynchronizationOU}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSiteURL { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${Zone}, + + [Parameter(Mandatory=$true)] + [string] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPStateServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPStateServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPStateServiceDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [Alias('Application')] + [object] + ${ServiceApplication}, + + [ValidateRange(1, 10)] + [System.Nullable[int]] + ${Weight}, + + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSubscriptionSettingsServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [ValidateNotNullOrEmpty()] + [string] + ${FailoverDatabaseServer}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseName}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPThrottlingRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNull()] + [object] + ${Criteria}, + + [ValidateNotNull()] + [ValidateRange(0, 10)] + [System.Nullable[int]] + ${Threshold}, + + [ValidateNotNull()] + [System.Nullable[datetime]] + ${Expiration}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTimerJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [ValidateNotNullOrEmpty()] + [string] + ${Schedule}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTopologyServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [string] + ${LoadBalancerUrl}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTopologyServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [string] + ${BadListPeriod}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTranslationServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [string] + ${DatabaseName}, + + [pscredential] + ${DatabaseCredential}, + + [string] + ${DatabaseServer}, + + [string] + ${FailoverDatabaseServer}, + + [System.Nullable[int]] + ${TimerJobFrequency}, + + [System.Nullable[int]] + ${MaximumTranslationAttempts}, + + [System.Nullable[int]] + ${KeepAliveTimeout}, + + [System.Nullable[int]] + ${MaximumTranslationTime}, + + [System.Nullable[int]] + ${TranslationsPerInstance}, + + [System.Nullable[int]] + ${MaximumSyncTranslationRequests}, + + [System.Nullable[int]] + ${RecycleProcessThreshold}, + + [System.Nullable[int]] + ${TotalActiveProcesses}, + + [string] + ${MachineTranslationClientId}, + + [string] + ${MachineTranslationCategory}, + + [switch] + ${UseDefaultInternetSettings}, + + [string] + ${WebProxyAddress}, + + [string] + ${MachineTranslationAddress}, + + [System.Nullable[int]] + ${JobExpirationDays}, + + [System.Nullable[int]] + ${MaximumItemsPerDay}, + + [System.Nullable[int]] + ${MaximumItemsPerPartitionPerDay}, + + [System.Nullable[int]] + ${MaximumBinaryFileSize}, + + [System.Nullable[int]] + ${MaximumTextFileSize}, + + [System.Nullable[int]] + ${MaximumWordCharacterCount}, + + [System.Nullable[bool]] + ${DisableBinaryFileScan}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [string[]] + ${AddEnabledFileExtensions}, + + [string[]] + ${RemoveEnabledFileExtensions}, + + [switch] + ${ClearEnabledFileExtensions}, + + [switch] + ${EnableAllFileExtensions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTranslationServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [System.Nullable[int]] + ${MaximumGroupSize}, + + [System.Nullable[int]] + ${MaximumItemCount}, + + [switch] + ${DefaultProxyGroup}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTranslationThrottlingSetting { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [System.Nullable[int]] + ${SiteQuota}, + + [System.Nullable[int]] + ${TenantQuota}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTrustedIdentityTokenIssuer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='BasicParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='ImportCertificateParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [Parameter(ParameterSetName='BasicParameterSet')] + [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [ValidateNotNullOrEmpty()] + [string] + ${Description}, + + [Parameter(ParameterSetName='ImportCertificateParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${ImportTrustCertificate}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [Parameter(ParameterSetName='BasicParameterSet')] + [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [object] + ${ClaimsMappings}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [Parameter(ParameterSetName='BasicParameterSet')] + [ValidateNotNullOrEmpty()] + [string] + ${SignInUrl}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [Parameter(ParameterSetName='BasicParameterSet')] + [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [object] + ${ClaimProvider}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [Parameter(ParameterSetName='BasicParameterSet')] + [string] + ${Realm}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [Parameter(ParameterSetName='BasicParameterSet')] + [switch] + ${UseWReply}, + + [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [Parameter(ParameterSetName='BasicParameterSet')] + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [string] + ${RegisteredIssuerName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTrustedRootAuthority { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='ManualUpdateCertificateParameterSet')] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${Certificate}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTrustedSecurityTokenIssuer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNullOrEmpty()] + [string] + ${Description}, + + [string] + ${RegisteredIssuerName}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, + + [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${Certificate}, + + [ValidateNotNullOrEmpty()] + [switch] + ${IsTrustBroker}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTrustedServiceTokenIssuer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNullOrEmpty()] + [string] + ${Description}, + + [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${Certificate}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPUsageApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${UsageService}, + + [ValidateNotNullOrEmpty()] + [ValidateLength(1, 135)] + [string] + ${DatabaseServer}, + + [ValidateLength(1, 128)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseName}, + + [ValidateNotNullOrEmpty()] + [ValidateLength(1, 128)] + [string] + ${DatabaseUsername}, + + [ValidateNotNull()] + [securestring] + ${DatabasePassword}, + + [switch] + ${EnableLogging}, + + [ValidateLength(1, 135)] + [string] + ${FailoverDatabaseServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPUsageDefinition { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${Enable}, + + [ValidateRange(0, 31)] + [int] + ${DaysRetained}, + + [ValidateRange(0, 31)] + [int] + ${DaysToKeepUsageFiles}, + + [ValidateRange(1, 9223372036854775807)] + [long] + ${MaxTotalSizeInBytes}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPUsageService { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true, HelpMessage='The max space, in GB, that Usage log files should take up.')] + [ValidateRange(1, 20)] + [uint32] + ${UsageLogMaxSpaceGB}, + + [Parameter(ValueFromPipeline=$true, HelpMessage='The location where Usage log files are created.')] + [ValidateNotNullOrEmpty()] + [ValidateLength(1, 181)] + [string] + ${UsageLogLocation}, + + [Parameter(ValueFromPipeline=$true, HelpMessage='The time interval, in minutes, that Usage log files should be cut and start a new one.')] + [ValidateRange(1, 1440)] + [uint32] + ${UsageLogCutTime}, + + [Parameter(ValueFromPipeline=$true, HelpMessage='The max usage file size, in KB, that Usage log files should be cut and start a new one.')] + [ValidateRange(512, 65536)] + [uint32] + ${UsageLogMaxFileSizeKB}, + + [System.Nullable[bool]] + ${LoggingEnabled}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPUser { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('UserAlias')] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${Web}, + + [object] + ${Group}, + + [string] + ${DisplayName}, + + [switch] + ${SyncFromAD}, + + [string[]] + ${AddPermissionLevel}, + + [string[]] + ${RemovePermissionLevel}, + + [switch] + ${ClearPermissions}, + + [switch] + ${PassThru}, + + [string] + ${Email}, + + [switch] + ${IsSiteCollectionAdmin}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPVisioExternalData { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${VisioServiceApplication}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${UnattendedServiceAccountApplicationID}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPVisioPerformance { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${VisioServiceApplication}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [long] + ${MaxDiagramSize}, + + [Parameter(Mandatory=$true)] + [int] + ${MinDiagramCacheAge}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [int] + ${MaxDiagramCacheAge}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [int] + ${MaxRecalcDuration}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [long] + ${MaxCacheSize}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPVisioSafeDataProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${VisioServiceApplication}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DataProviderId}, + + [Parameter(Mandatory=$true)] + [int] + ${DataProviderType}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Description}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPVisioServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${ServiceApplicationPool}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPWeb { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${RelativeUrl}, + + [string] + ${Description}, + + [object] + ${Template}, + + [Obsolete('This control applies to SharePoint 2007 theming and is no longer functional')] + [string] + ${Theme}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPWebApplication { + [CmdletBinding(DefaultParameterSetName='UpdateGeneralSettings', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='UpdateClaimSettings', Mandatory=$true)] + [object] + ${Zone}, + + [Parameter(ParameterSetName='UpdateGeneralSettings')] + [int] + ${DefaultTimeZone}, + + [Parameter(ParameterSetName='UpdateGeneralSettings')] + [string] + ${DefaultQuotaTemplate}, + + [Parameter(ParameterSetName='UpdateMailSettings', Mandatory=$true)] + [string] + ${SMTPServer}, + + [Parameter(ParameterSetName='UpdateMailSettings')] + [string] + ${OutgoingEmailAddress}, + + [Parameter(ParameterSetName='UpdateMailSettings')] + [string] + ${ReplyToEmailAddress}, + + [Parameter(ParameterSetName='UpdateGeneralSettings')] + [Alias('ProxyGroup')] + [object] + ${ServiceApplicationProxyGroup}, + + [Parameter(ParameterSetName='UpdateClaimSettings')] + [object] + ${AuthenticationProvider}, + + [Parameter(ParameterSetName='UpdateClaimSettings')] + [object] + ${AdditionalClaimProvider}, + + [Parameter(ParameterSetName='UpdateClaimSettings')] + [string] + ${SignInRedirectURL}, + + [Parameter(ParameterSetName='UpdateClaimSettings')] + [object] + ${SignInRedirectProvider}, + + [Parameter(ParameterSetName='UpdateClaimSettings')] + [ValidateSet('Kerberos','NTLM')] + [string] + ${AuthenticationMethod}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPWebApplicationHttpThrottlingMonitor { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)] + [string] + ${Category}, + + [Parameter(Mandatory=$true, Position=2, ValueFromPipelineByPropertyName=$true)] + [string] + ${Counter}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${Instance}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [Alias('Upper')] + [ValidateRange(0, 1.7976931348623157E+308)] + [double] + ${UpperLimit}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [Alias('Lower')] + [ValidateRange(0, 1.7976931348623157E+308)] + [double] + ${LowerLimit}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [Alias('Buckets')] + [double[]] + ${HealthScoreBuckets}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${IsDESC}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPWOPIBinding { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [switch] + ${DefaultAction}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPWOPIZone { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${Zone}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPWordConversionServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [string] + ${DatabaseName}, + + [pscredential] + ${DatabaseCredential}, + + [string] + ${DatabaseServer}, + + [System.Nullable[int]] + ${TimerJobFrequency}, + + [System.Nullable[int]] + ${ConversionTimeout}, + + [System.Nullable[int]] + ${MaximumConversionAttempts}, + + [System.Nullable[int]] + ${KeepAliveTimeout}, + + [System.Nullable[int]] + ${MaximumConversionTime}, + + [System.Nullable[int]] + ${MaximumSyncConversionRequests}, + + [System.Nullable[int]] + ${ConversionsPerInstance}, + + [switch] + ${DisableEmbeddedFonts}, + + [switch] + ${DisableBinaryFileScan}, + + [System.Nullable[int]] + ${RecycleProcessThreshold}, + + [System.Nullable[int]] + ${ActiveProcesses}, + + [System.Nullable[int]] + ${MaximumMemoryUsage}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [string[]] + ${AddSupportedFormats}, + + [string[]] + ${RemoveSupportedFormats}, + + [switch] + ${ClearSupportedFormats}, + + [System.Nullable[int]] + ${MaximumGroupSize}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPWorkflowConfig { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='WebApplication', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='SiteCollection', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${SiteCollection}, + + [bool] + ${EmailNoPermissionParticipantsEnabled}, + + [bool] + ${SendDocumentToExternalParticipants}, + + [bool] + ${DeclarativeWorkflowsEnabled}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPWorkManagementServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Name}, + + [Parameter(HelpMessage='This value specifies the minimum amount of time between refreshes for a provider for a given user.')] + [timespan] + ${MinimumTimeBetweenProviderRefreshes}, + + [Parameter(HelpMessage='This value specifies the minimum amount of time between calls to search for a given user.')] + [timespan] + ${MinimumTimeBetweenSearchQueries}, + + [Parameter(HelpMessage='This value specifies the minimum amount of time between calls into our routine that tries to find new tenants that want to sync EWS tasks.')] + [timespan] + ${MinimumTimeBetweenEwsSyncSubscriptionSearches}, + + [Parameter(HelpMessage='This value specifies the maximum number of users a service instance will try to sync on a given tenant via EWS per Timer job interval')] + [uint32] + ${NumberOfUsersPerEwsSyncBatch}, + + [Parameter(HelpMessage='This value specifies the maximum number of users a service instance machine will sync via EWS at one time across all tenants.')] + [uint32] + ${NumberOfUsersEwsSyncWillProcessAtOnce}, + + [Parameter(HelpMessage='This value specifies the maximum number of tenants the service will try to sync via EWS per Timer job interval')] + [uint32] + ${NumberOfSubscriptionSyncsPerEwsSyncRun}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPWorkManagementServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [switch] + ${DefaultProxyGroup}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Split-SPScaleOutDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='NewDatabase', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${NewDatabaseName}, + + [Parameter(ParameterSetName='NewDatabase')] + [ValidateNotNullOrEmpty()] + [string] + ${NewDatabaseServer}, + + [Parameter(ParameterSetName='NewDatabase')] + [ValidateNotNullOrEmpty()] + [string] + ${NewDatabaseFailoverServer}, + + [Parameter(ParameterSetName='NewDatabase')] + [ValidateNotNull()] + [pscredential] + ${NewDatabaseCredentials}, + + [Parameter(ParameterSetName='ExistingDatabase', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${TargetDatabase}, + + [Parameter(Mandatory=$true)] + [object] + ${SourceDatabase}, + + [Parameter(Mandatory=$true)] + [object] + ${SourceServiceApplication}, + + [int] + ${SourcePercentage}, + + [switch] + ${MoveLowerHalf}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Split-SPServerScaleOutDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='NewDatabase', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${NewDatabaseName}, + + [Parameter(ParameterSetName='NewDatabase')] + [ValidateNotNullOrEmpty()] + [string] + ${NewDatabaseServer}, + + [Parameter(ParameterSetName='NewDatabase')] + [ValidateNotNullOrEmpty()] + [string] + ${NewDatabaseFailoverServer}, + + [Parameter(ParameterSetName='NewDatabase')] + [ValidateNotNull()] + [pscredential] + ${NewDatabaseCredentials}, + + [Parameter(ParameterSetName='ExistingDatabase', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${TargetDatabase}, + + [Parameter(Mandatory=$true)] + [object] + ${SourceDatabase}, + + [Parameter(Mandatory=$true)] + [object] + ${SourceServiceApplication}, + + [int] + ${SourcePercentage}, + + [switch] + ${MoveLowerHalf}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPAdminJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPAssignment { + [CmdletBinding()] +param( + [switch] + ${Global}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPContentDeploymentJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [switch] + ${WaitEnabled}, + + [string] + ${DeploySinceTime}, + + [switch] + ${TestEnabled}, + + [string] + ${UseSpecificSnapshot}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPDiagnosticsSession { + [CmdletBinding()] +param( + [guid] + ${CorrelationId}, + + [switch] + ${Dashboard}, + + [ValidateSet('High','Medium','Monitorable','Unexpected','Verbose','VerboseEx','None')] + [string] + ${TraceLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPEnterpriseSearchServiceInstance { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPInfoPathFormTemplate { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPServiceInstance { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPTimerJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Stop-SPAssignment { + [CmdletBinding()] +param( + [switch] + ${Global}, + + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${SemiGlobal}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Stop-SPDiagnosticsSession { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Stop-SPDistributedCacheServiceInstance { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [switch] + ${Graceful}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Stop-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Stop-SPEnterpriseSearchServiceInstance { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Stop-SPInfoPathFormTemplate { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [ValidateRange(0, 1440)] + [System.Nullable[int]] + ${TimeLeft}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Stop-SPServiceInstance { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Suspend-SPEnterpriseSearchServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Suspend-SPStateServiceDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Test-SPContentDatabase { + [CmdletBinding(DefaultParameterSetName='ContentDatabaseById')] +param( + [Parameter(ParameterSetName='ContentDatabaseByName', Mandatory=$true)] + [ValidateNotNull()] + [string] + ${Name}, + + [Parameter(ParameterSetName='ContentDatabaseByName', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [ValidateNotNull()] + [object] + ${ServerInstance}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [switch] + ${ShowRowCounts}, + + [switch] + ${ShowLocation}, + + [Parameter(ParameterSetName='ContentDatabaseById', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${ExtendedCheck}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Test-SPInfoPathFormTemplate { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Path}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Test-SPSite { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [guid] + ${RuleId}, + + [switch] + ${RunAlways}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Uninstall-SPAppInstance { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Uninstall-SPDataConnectionFile { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Uninstall-SPFeature { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${Force}, + + [int] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Uninstall-SPHelpCollection { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Uninstall-SPInfoPathFormTemplate { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Uninstall-SPSolution { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='OneWebApplication', Mandatory=$true)] + [object] + ${WebApplication}, + + [string] + ${Time}, + + [switch] + ${Local}, + + [Parameter(ParameterSetName='AllWebApplication', Mandatory=$true)] + [switch] + ${AllWebApplications}, + + [uint32] + ${Language}, + + [string] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Uninstall-SPUserSolution { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Uninstall-SPWebPartPack { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [uint32] + ${Language}, + + [string] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Unpublish-SPServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPAppCatalogConfiguration { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [switch] + ${SkipWebTemplateChecking}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPAppInstance { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${App}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPDistributedCacheSize { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [uint32] + ${CacheSizeInMB}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPFarmEncryptionKey { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [switch] + ${Resume}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPHelp { + [CmdletBinding()] +param( + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPInfoPathAdminFileUrl { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [uri] + ${Find}, + + [Parameter(Mandatory=$true)] + [uri] + ${Replace}, + + [switch] + ${Scan}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPInfoPathFormTemplate { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPInfoPathUserFileUrl { + [CmdletBinding(DefaultParameterSetName='WebApp', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='WebApp', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='ContentDB', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(ParameterSetName='Site', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Site}, + + [Parameter(Mandatory=$true)] + [uri] + ${Find}, + + [Parameter(Mandatory=$true)] + [uri] + ${Replace}, + + [switch] + ${Scan}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPProfilePhotoStore { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${MySiteHostLocation}, + + [bool] + ${CreateThumbnailsForImportedPhotos}, + + [bool] + ${NoDelete}, + + [uri] + ${OldBaseUri}, + + [uri] + ${NewBaseUri}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPRepopulateMicroblogFeedCache { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SiteSubscription}, + + [ValidateNotNull()] + [string] + ${AccountName}, + + [ValidateNotNull()] + [string] + ${SiteUrl}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPRepopulateMicroblogLMTCache { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPSecureStoreApplicationServerKey { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [string] + ${Passphrase}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPSecureStoreCredentialMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Principal}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [securestring[]] + ${Values}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPSecureStoreGroupCredentialMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [securestring[]] + ${Values}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPSecureStoreMasterKey { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [string] + ${Passphrase}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPSolution { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [string] + ${LiteralPath}, + + [string] + ${Time}, + + [switch] + ${CASPolicies}, + + [switch] + ${GACDeployment}, + + [switch] + ${FullTrustBinDeployment}, + + [switch] + ${Local}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPUserSolution { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${Site}, + + [Parameter(Mandatory=$true)] + [object] + ${ToSolution}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPWOPIProofKey { + [CmdletBinding()] +param( + [ValidateNotNullOrEmpty()] + [string] + ${ServerName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Upgrade-SPContentDatabase { + [CmdletBinding(DefaultParameterSetName='ContentDatabaseById', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='ContentDatabaseByName', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='ContentDatabaseByName', Mandatory=$true)] + [ValidateNotNull()] + [string] + ${Name}, + + [ValidateNotNull()] + [object] + ${ServerInstance}, + + [switch] + ${UseSnapshot}, + + [Parameter(ParameterSetName='ContentDatabaseById', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Position=1)] + [switch] + ${ForceDeleteLock}, + + [switch] + ${SkipIntegrityChecks}, + + [switch] + ${NoB2BSiteUpgrade}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Upgrade-SPEnterpriseSearchServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Upgrade-SPEnterpriseSearchServiceApplicationSiteSettings { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Upgrade-SPFarm { + [CmdletBinding(DefaultParameterSetName='FarmById', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Upgrade-SPSingleSignOnDatabase { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SSOConnectionString}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SecureStoreConnectionString}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [securestring] + ${SecureStorePassphrase}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Upgrade-SPSite { + [CmdletBinding(DefaultParameterSetName='SPSiteById', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='SPSiteById', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${VersionUpgrade}, + + [switch] + ${QueueOnly}, + + [switch] + ${Email}, + + [switch] + ${Unthrottled}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + + diff --git a/Tests/Stubs/SharePoint/16.0.4316.1217/Microsoft.SharePoint.PowerShell.psm1 b/Tests/Stubs/SharePoint/16.0.4316.1217/Microsoft.SharePoint.PowerShell.psm1 new file mode 100644 index 000000000..1bbee345f --- /dev/null +++ b/Tests/Stubs/SharePoint/16.0.4316.1217/Microsoft.SharePoint.PowerShell.psm1 @@ -0,0 +1,22281 @@ +function Add-SPAppDeniedEndpoint { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${Endpoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPClaimTypeMapping { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${TrustedIdentityTokenIssuer}, + + [ValidateNotNull()] + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPDiagnosticsPerformanceCounter { + [CmdletBinding(DefaultParameterSetName='AddCounter', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='AddMultipleCounters', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='AddInstance', Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='AddCounter', Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)] + [string] + ${Category}, + + [Parameter(ParameterSetName='AddInstance', ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='AddCounter', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Counter}, + + [Parameter(ParameterSetName='AddMultipleCounters', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNull()] + [string[]] + ${CounterList}, + + [Parameter(ParameterSetName='AddInstance', Mandatory=$true, ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='AddMultipleCounters', ValueFromPipelineByPropertyName=$true)] + [string] + ${Instance}, + + [Parameter(ParameterSetName='AddCounter', ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='AddInstance', ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='AddMultipleCounters', ValueFromPipelineByPropertyName=$true)] + [switch] + ${WebFrontEnd}, + + [Parameter(ParameterSetName='AddInstance', ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='AddMultipleCounters', ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='AddCounter', ValueFromPipelineByPropertyName=$true)] + [switch] + ${DatabaseServer}, + + [Parameter(ParameterSetName='AddCounter', ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='AddMultipleCounters', ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='AddInstance', ValueFromPipelineByPropertyName=$true)] + [switch] + ${AllInstances}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPDistributedCacheServiceInstance { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPInfoPathUserAgent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPIPRangeAllowList { + [CmdletBinding(DefaultParameterSetName='CustomIPAllowList', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='CustomIPAllowList', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SiteName}, + + [Parameter(ParameterSetName='InternalIPAllowList', Mandatory=$true)] + [switch] + ${InternalIPAllowList}, + + [ValidateNotNullOrEmpty()] + [switch] + ${IPV4}, + + [ValidateNotNullOrEmpty()] + [switch] + ${IPV6}, + + [ValidateNotNullOrEmpty()] + [string] + ${IP}, + + [ValidateNotNullOrEmpty()] + [System.Collections.Generic.List[string]] + ${IPList}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPPluggableSecurityTrimmer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNull()] + [guid] + ${UserProfileApplicationProxyId}, + + [Parameter(Mandatory=$true)] + [int] + ${PlugInId}, + + [string] + ${QualifiedTypeName}, + + [System.Collections.Specialized.NameValueCollection] + ${CustomProperties}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPProfileLeader { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SiteSubscription}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPProfileSyncConnection { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplication}, + + [Parameter(Mandatory=$true)] + [string] + ${ConnectionForestName}, + + [Parameter(Mandatory=$true)] + [string] + ${ConnectionDomain}, + + [Parameter(Mandatory=$true)] + [string] + ${ConnectionUserName}, + + [Parameter(Mandatory=$true)] + [securestring] + ${ConnectionPassword}, + + [string] + ${ConnectionServerName}, + + [int] + ${ConnectionPort}, + + [bool] + ${ConnectionUseSSL}, + + [bool] + ${ConnectionUseDisabledFilter}, + + [string] + ${ConnectionNamingContext}, + + [string] + ${ConnectionSynchronizationOU}, + + [string] + ${ConnectionClaimProviderTypeValue}, + + [string] + ${ConnectionClaimProviderIdValue}, + + [string] + ${ConnectionClaimIDMapAttribute}, + + [bool] + ${ConnectionFilterOutUnlicensed}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPRoutingMachineInfo { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${RequestManagementSettings}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [ValidateNotNull()] + [object] + ${Availability}, + + [ValidateNotNull()] + [object] + ${OutgoingScheme}, + + [System.Nullable[int]] + ${OutgoingPort}, + + [ValidateNotNull()] + [System.Nullable[double]] + ${StaticWeight}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPRoutingMachinePool { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${RequestManagementSettings}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [ValidateNotNull()] + [object] + ${MachineTargets}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPRoutingRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${RequestManagementSettings}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [ValidateNotNull()] + [object] + ${Criteria}, + + [object] + ${MachinePool}, + + [ValidateNotNull()] + [System.Nullable[int]] + ${ExecutionGroup}, + + [ValidateNotNull()] + [System.Nullable[datetime]] + ${Expiration}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPScaleOutDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseName}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseFailoverServer}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [switch] + ${DeferUpgradeActions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPSecureStoreSystemAccount { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${AccountName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPServerScaleOutDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseName}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseFailoverServer}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [switch] + ${DeferUpgradeActions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPServiceApplicationProxyGroupMember { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1)] + [Alias('Proxy')] + [ValidateNotNull()] + [object] + ${Member}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPShellAdmin { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${UserName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${database}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPSiteSubscriptionFeaturePackMember { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${FeatureDefinition}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPSiteSubscriptionProfileConfig { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [Parameter(ParameterSetName='MySiteSettings', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${MySiteHostLocation}, + + [Parameter(ParameterSetName='MySiteSettings', ValueFromPipeline=$true)] + [object] + ${MySiteManagedPath}, + + [Parameter(ParameterSetName='MySiteSettings')] + [ValidateSet('None','Resolve','Block')] + [string] + ${SiteNamingConflictResolution}, + + [string] + ${SynchronizationOU}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPSolution { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${LiteralPath}, + + [uint32] + ${Language}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPThrottlingRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${RequestManagementSettings}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [ValidateNotNull()] + [object] + ${Criteria}, + + [ValidateNotNull()] + [ValidateRange(0, 10)] + [System.Nullable[int]] + ${Threshold}, + + [ValidateNotNull()] + [System.Nullable[datetime]] + ${Expiration}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPUserLicenseMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true, ValueFromRemainingArguments=$true)] + [ValidateNotNullOrEmpty()] + [System.Collections.Generic.List`1[[object]]] + ${Mapping}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Add-SPUserSolution { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${LiteralPath}, + + [Parameter(Mandatory=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Backup-SPConfigurationDatabase { + [CmdletBinding(DefaultParameterSetName='DefaultSet')] +param( + [string] + ${DatabaseName}, + + [string] + ${DatabaseServer}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ParameterSetName='DefaultSet', Mandatory=$true)] + [string] + ${Directory}, + + [string] + ${Item}, + + [Parameter(ParameterSetName='ShowTree', Mandatory=$true)] + [switch] + ${ShowTree}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Backup-SPEnterpriseSearchServiceApplicationIndex { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='RunBackup', Mandatory=$true, Position=0)] + [int] + ${Phase}, + + [Parameter(ParameterSetName='AbortBackup', Mandatory=$true, Position=0)] + [switch] + ${Abort}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ParameterSetName='RunBackup', Mandatory=$true, Position=2)] + [string] + ${BackupFolder}, + + [Parameter(Mandatory=$true, Position=3)] + [string] + ${BackupHandleFile}, + + [Parameter(Position=4)] + [int] + ${Retries}, + + [Parameter(Position=5)] + [switch] + ${PeerToPeer}, + + [Parameter(Position=6)] + [string] + ${SpecifiedBackupHandle}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Backup-SPFarm { + [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='DefaultSet', Mandatory=$true)] + [string] + ${Directory}, + + [Parameter(ParameterSetName='DefaultSet', Mandatory=$true)] + [ValidateSet('Full','Differential','None')] + [string] + ${BackupMethod}, + + [Parameter(ParameterSetName='DefaultSet')] + [int] + ${BackupThreads}, + + [Parameter(ParameterSetName='DefaultSet')] + [switch] + ${Force}, + + [string] + ${Item}, + + [Parameter(ParameterSetName='ShowTree', Mandatory=$true)] + [switch] + ${ShowTree}, + + [switch] + ${ConfigurationOnly}, + + [Parameter(ParameterSetName='DefaultSet')] + [int] + ${Percentage}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Backup-SPSite { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [string] + ${Path}, + + [switch] + ${Force}, + + [switch] + ${UseSqlSnapshot}, + + [switch] + ${NoSiteLock}, + + [switch] + ${UseABSDocStreamInfo}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPAppDeniedEndpointList { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPBusinessDataCatalogEntityNotificationWeb { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPDistributedCacheItem { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ContainerType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPLogLevel { + [CmdletBinding()] +param( + [string[]] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [psobject] + ${InputObject}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPMetadataWebServicePartitionData { + [CmdletBinding(DefaultParameterSetName='Default')] +param( + [Parameter(ParameterSetName='Default', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ServiceProxy}, + + [Parameter(ParameterSetName='ServiceContext', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [switch] + ${FromServiceDatabase}, + + [ValidateNotNull()] + [object] + ${FromContentDatabase}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPPerformancePointServiceApplicationTrustedLocation { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [object] + ${TrustedLocationType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPScaleOutDatabaseDeletedDataSubRange { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Range}, + + [Parameter(Mandatory=$true)] + [bool] + ${IsUpperSubRange}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPScaleOutDatabaseLog { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [int] + ${LogEntryTimeout}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPScaleOutDatabaseTenantData { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true)] + [guid] + ${SiteSubscriptionId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPSecureStoreCredentialMapping { + [CmdletBinding(DefaultParameterSetName='OneApplication', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='AllApplications', Mandatory=$true)] + [switch] + ${All}, + + [Parameter(ParameterSetName='OneApplication', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Principal}, + + [Parameter(ParameterSetName='AllApplications', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPSecureStoreDefaultProvider { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPServerScaleOutDatabaseDeletedDataSubRange { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Range}, + + [Parameter(Mandatory=$true)] + [bool] + ${IsUpperSubRange}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPServerScaleOutDatabaseLog { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [int] + ${LogEntryTimeout}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPServerScaleOutDatabaseTenantData { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true)] + [guid] + ${SiteSubscriptionId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Clear-SPSiteSubscriptionBusinessDataCatalogConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Compare-SPDatabaseSchema { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Source}, + + [Parameter(Mandatory=$true, Position=1)] + [object] + ${Target}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Connect-SPConfigurationDatabase { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${DatabaseName}, + + [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(Mandatory=$true, Position=8, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [securestring] + ${Passphrase}, + + [Parameter(Position=9, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [switch] + ${SkipRegisterAsDistributedCacheHost}, + + [string] + ${DatabaseFailOverPartner}, + + [object] + ${LocalServerRole}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Convert-SPWebApplication { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='Claims', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Claims', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateSet('LEGACY','CLAIMS-WINDOWS','CLAIMS-TRUSTED-DEFAULT')] + [string] + ${From}, + + [Parameter(ParameterSetName='Claims', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateSet('CLAIMS','CLAIMS-WINDOWS','CLAIMS-TRUSTED-DEFAULT','CLAIMS-SHAREPOINT-ONLINE')] + [string] + ${To}, + + [Parameter(ParameterSetName='Claims')] + [switch] + ${Force}, + + [Parameter(ParameterSetName='Claims')] + [switch] + ${RetainPermissions}, + + [Parameter(ParameterSetName='Claims')] + [string] + ${SourceSkipList}, + + [Parameter(ParameterSetName='Claims')] + [string] + ${MapList}, + + [Parameter(ParameterSetName='Claims')] + [switch] + ${SkipSites}, + + [Parameter(ParameterSetName='Claims')] + [switch] + ${SkipPolicies}, + + [Parameter(ParameterSetName='Claims')] + [object] + ${Database}, + + [Parameter(ParameterSetName='Claims')] + [object] + ${TrustedProvider}, + + [Parameter(ParameterSetName='Claims')] + [guid] + ${SiteSubsriptionId}, + + [Parameter(ParameterSetName='Claims')] + [string] + ${LoggingDirectory}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Copy-SPAccessServicesDatabaseCredentials { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${AppUrl}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServiceContext}, + + [Parameter(Mandatory=$true)] + [string] + ${SourceServer}, + + [Parameter(Mandatory=$true)] + [string] + ${TargetServer}, + + [Parameter(Mandatory=$true)] + [System.Net.NetworkCredential] + ${ServerCredential}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Copy-SPActivitiesToWorkflowService { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${WorkflowServiceAddress}, + + [string] + ${ActivityName}, + + [System.Net.ICredentials] + ${Credential}, + + [bool] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Copy-SPBusinessDataCatalogAclToChildren { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${MetadataObject}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Copy-SPDatabase { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Source}, + + [Parameter(Mandatory=$true, Position=1)] + [string] + ${TargetConnectionString}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Copy-SPSideBySideFiles { + [CmdletBinding()] +param( + [string] + ${LogFile}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Copy-SPSite { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${Identity}, + + [object] + ${DestinationDatabase}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true)] + [string] + ${TargetUrl}, + + [string] + ${HostHeaderWebApplication}, + + [switch] + ${PreserveSiteId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPAppAutoProvision { + [CmdletBinding()] +param( + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPBusinessDataCatalogEntity { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPFeature { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Url}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPHealthAnalysisRule { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPInfoPathFormTemplate { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] + [Alias('Url')] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPIPRangeAllowList { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPProjectActiveDirectoryEnterpriseResourcePoolSync { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPProjectEmailNotification { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPProjectEnterpriseProjectTaskSync { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [uri] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPProjectQueueStatsMonitoring { + [CmdletBinding(DefaultParameterSetName='__AllParameterSets')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPSecureStoreMinDB { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ApplicationName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPSessionStateService { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPSingleSignOn { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ServerName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPTimerJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPUserLicensing { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPVideoStreaming { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPWebApplicationHttpThrottling { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disable-SPWebTemplateForSiteMaster { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [object] + ${Template}, + + [int] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Disconnect-SPConfigurationDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Dismount-SPContentDatabase { + [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Dismount-SPSiteMapDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [guid] + ${DatabaseId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Dismount-SPStateServiceDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPAppAutoProvision { + [CmdletBinding()] +param( + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPBusinessDataCatalogEntity { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPFeature { + [CmdletBinding(DefaultParameterSetName='FarmFeatureDefinition', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='SiteFeature')] + [string] + ${Url}, + + [switch] + ${PassThru}, + + [switch] + ${Force}, + + [Parameter(ParameterSetName='FarmFeatureDefinition')] + [int] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPHealthAnalysisRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPInfoPathFormTemplate { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] + [Alias('url')] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPIPRangeAllowList { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPProjectActiveDirectoryEnterpriseResourcePoolSync { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNullOrEmpty()] + [System.Collections.Generic.IEnumerable[guid]] + ${GroupUids}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPProjectEmailNotification { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPProjectEnterpriseProjectTaskSync { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [uri] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPProjectQueueStatsMonitoring { + [CmdletBinding(DefaultParameterSetName='__AllParameterSets')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPSecureStoreMinDB { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ApplicationName}, + + [ValidateNotNullOrEmpty()] + [guid] + ${SiteSubscriptionId}, + + [ValidateNotNullOrEmpty()] + [int] + ${PartitionLimit}, + + [ValidateNotNullOrEmpty()] + [int] + ${ThreadLimit}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPSessionStateService { + [CmdletBinding(DefaultParameterSetName='AdvancedProvision', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='DefaultProvision', Mandatory=$true)] + [switch] + ${DefaultProvision}, + + [Parameter(ParameterSetName='AdvancedProvision')] + [string] + ${DatabaseServer}, + + [Parameter(ParameterSetName='AdvancedProvision', Mandatory=$true)] + [string] + ${DatabaseName}, + + [System.Nullable[int]] + ${SessionTimeout}, + + [Parameter(ParameterSetName='AdvancedProvision')] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPTimerJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPUserLicensing { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPVideoStreaming { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPWebApplicationHttpThrottling { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Enable-SPWebTemplateForSiteMaster { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [object] + ${Template}, + + [int] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPAccessServicesDatabase { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseName}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [guid] + ${ServerReferenceId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPAppPackage { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${App}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPBusinessDataCatalogModel { + [CmdletBinding()] +param( + [switch] + ${ModelsIncluded}, + + [switch] + ${LocalizedNamesIncluded}, + + [switch] + ${PropertiesIncluded}, + + [switch] + ${ProxiesIncluded}, + + [switch] + ${PermissionsIncluded}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [string] + ${SettingId}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPEnterpriseSearchTopology { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [string] + ${Filename}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPInfoPathAdministrationFiles { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Path}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPMetadataWebServicePartitionData { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceProxy}, + + [switch] + ${NoCompression}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPPerformancePointContent { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [string] + ${ExportFileUrl}, + + [Parameter(Mandatory=$true)] + [array] + ${ItemUrls}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPScaleOutDatabaseTenantData { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${FilePath}, + + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true)] + [guid] + ${SiteSubscriptionId}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPServerScaleOutDatabaseTenantData { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${FilePath}, + + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true)] + [guid] + ${SiteSubscriptionId}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPSiteSubscriptionBusinessDataCatalogConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [switch] + ${Force}, + + [switch] + ${ModelsIncluded}, + + [switch] + ${LocalizedNamesIncluded}, + + [switch] + ${PropertiesIncluded}, + + [switch] + ${ProxiesIncluded}, + + [switch] + ${PermissionsIncluded}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPSiteSubscriptionSettings { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [switch] + ${AdminProperties}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPTagsAndNotesData { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${FilePath}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Export-SPWeb { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${IncludeAlerts}, + + [object] + ${IncludeVersions}, + + [int] + ${CompressionSize}, + + [switch] + ${UseSqlSnapshot}, + + [string] + ${AppLogFilePath}, + + [string] + ${ItemUrl}, + + [Parameter(Mandatory=$true)] + [string] + ${Path}, + + [switch] + ${Force}, + + [switch] + ${IncludeUserSecurity}, + + [switch] + ${HaltOnWarning}, + + [switch] + ${HaltOnError}, + + [switch] + ${NoLogFile}, + + [switch] + ${NoFileCompression}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAccessServiceApplication { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAccessServicesApplication { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAccessServicesDatabase { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Position=1, ValueFromPipeline=$true)] + [object] + ${ContentDb}, + + [Parameter(Position=2, ValueFromPipeline=$true)] + [bool] + ${AccessAppsOnly}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAccessServicesDatabaseServer { + [CmdletBinding(DefaultParameterSetName='GetDatabaseServersParameterSet')] +param( + [Parameter(ParameterSetName='GetDatabaseServersParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='GetSingleDatabaseServerParamterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceContext}, + + [Parameter(ParameterSetName='GetSingleDatabaseServerParamterSet', Mandatory=$true)] + [Parameter(ParameterSetName='GetDatabaseServersParameterSet')] + [object] + ${DatabaseServerGroup}, + + [Parameter(ParameterSetName='GetSingleDatabaseServerParamterSet', Mandatory=$true)] + [object] + ${DatabaseServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAccessServicesDatabaseServerGroup { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceContext}, + + [Parameter(Position=1, ValueFromPipeline=$true)] + [object] + ${DatabaseServerGroup}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAccessServicesDatabaseServerGroupMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAlternateURL { + [CmdletBinding(DefaultParameterSetName='Default')] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='WebApplication', Mandatory=$true)] + [object] + ${WebApplication}, + + [object] + ${Zone}, + + [Parameter(ParameterSetName='ResourceName', Mandatory=$true)] + [string] + ${ResourceName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppAcquisitionConfiguration { + [CmdletBinding(DefaultParameterSetName='MarketplaceSettingsInWebApplication')] +param( + [Parameter(ParameterSetName='MarketplaceSettingsInWebApplication', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='MarketplaceSettingsInSiteSubscription', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppAutoProvisionConnection { + [CmdletBinding()] +param( + [object] + ${SiteSubscription}, + + [object] + ${ConnectionType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppDeniedEndpointList { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppDisablingConfiguration { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppDomain { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppHostingQuotaConfiguration { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppInstance { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='IdentityParameterSet', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='WebParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Web}, + + [Parameter(ParameterSetName='WebParameterSet')] + [ValidateNotNull()] + [object] + ${App}, + + [Parameter(ParameterSetName='SiteAndIdParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [Parameter(ParameterSetName='SiteAndIdParameterSet', Mandatory=$true)] + [guid] + ${AppInstanceId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppPrincipal { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${NameIdentifier}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppScaleProfile { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppSiteSubscriptionName { + [CmdletBinding()] +param( + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppStateSyncLastRunTime { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppStateUpdateInterval { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppStoreConfiguration { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAppStoreWebServiceConfiguration { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAuthenticationProvider { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(Mandatory=$true, Position=2)] + [object] + ${Zone}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAuthenticationRealm { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPAzureVideoServiceAccount { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(Mandatory=$true, Position=1)] + [object] + ${ServiceContext}, + + [Parameter(Position=2)] + [System.Net.ICredentials] + ${OAuth2BearerCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPBackupHistory { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [string] + ${Directory}, + + [switch] + ${ShowBackup}, + + [switch] + ${ShowRestore}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPBingMapsBlock { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPBingMapsKey { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPBrowserCustomerExperienceImprovementProgram { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='Farm', Mandatory=$true)] + [switch] + ${Farm}, + + [Parameter(ParameterSetName='WebApplication', Mandatory=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='SiteSubscription', Mandatory=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPBusinessDataCatalogEntityNotificationWeb { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPBusinessDataCatalogMetadataObject { + [CmdletBinding()] +param( + [string] + ${Namespace}, + + [string] + ${Name}, + + [string] + ${ContainingLobSystem}, + + [Parameter(Mandatory=$true)] + [object] + ${BdcObjectType}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPBusinessDataCatalogThrottleConfig { + [CmdletBinding(DefaultParameterSetName='ProxyProvided')] +param( + [Parameter(Mandatory=$true)] + [object] + ${Scope}, + + [Parameter(Mandatory=$true)] + [object] + ${ThrottleType}, + + [Parameter(ParameterSetName='ProxyProvided', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceApplicationProxy}, + + [Parameter(ParameterSetName='FileBackedProvided', Mandatory=$true)] + [switch] + ${FileBacked}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPCertificateAuthority { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPClaimProvider { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPClaimProviderManager { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPClaimTypeEncoding { + [CmdletBinding()] +param( + [char] + ${EncodingCharacter}, + + [ValidateNotNullOrEmpty()] + [string] + ${ClaimType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPConnectedServiceApplicationInformation { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPContentDatabase { + [CmdletBinding(DefaultParameterSetName='DefaultSet')] +param( + [Parameter(ParameterSetName='DefaultSet', Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='AllContentDatabasesInWebApplication', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='ContentDatabasesOfSite', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [Parameter(ParameterSetName='Unattached', Mandatory=$true)] + [switch] + ${ConnectAsUnattachedDatabase}, + + [Parameter(ParameterSetName='Unattached')] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ParameterSetName='Unattached', Mandatory=$true)] + [string] + ${DatabaseServer}, + + [Parameter(ParameterSetName='Unattached', Mandatory=$true)] + [string] + ${DatabaseName}, + + [Parameter(ParameterSetName='AllContentDatabasesInWebApplication')] + [Parameter(ParameterSetName='DefaultSet')] + [switch] + ${NoStatusFilter}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPContentDeploymentJob { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [object] + ${Path}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPContentDeploymentPath { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPCustomLayoutsPage { + [CmdletBinding()] +param( + [object] + ${Identity}, + + [ValidateRange(14, 15)] + [int] + ${CompatibilityLevel}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPDatabase { + [CmdletBinding(DefaultParameterSetName='DefaultParameterSet')] +param( + [Parameter(ParameterSetName='DefaultParameterSet', Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='ServerParameterSet', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServerInstance}, + + [Parameter(ParameterSetName='NameParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPDataConnectionFile { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPDataConnectionFileDependent { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPDeletedSite { + [CmdletBinding(DefaultParameterSetName='AllDeletedSitesInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='AllDeletedSitesInIdentity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Limit}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [string] + ${DateTimeFrom}, + + [string] + ${DateTimeTo}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPDesignerSettings { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='WebApplication', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPDiagnosticConfig { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPDiagnosticsPerformanceCounter { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [switch] + ${WebFrontEnd}, + + [Parameter(ValueFromPipeline=$true)] + [switch] + ${DatabaseServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPDiagnosticsProvider { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPDistributedCacheClientSetting { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ContainerType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchAdministrationComponent { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchComponent { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchTopology}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchContentEnrichmentConfiguration { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchCrawlContentSource { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchCrawlCustomConnector { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SearchApplication}, + + [string] + ${Protocol}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchCrawlDatabase { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchCrawlExtension { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchCrawlLogReadPermission { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SearchApplication}, + + [guid] + ${Tenant}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchCrawlMapping { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchCrawlRule { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchFileFormat { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchHostController { + [CmdletBinding()] +param( + [object] + ${SearchServiceInstance}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchLanguageResourcePhrase { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [object] + ${Type}, + + [string] + ${Language}, + + [string] + ${Mapping}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [guid] + ${SourceId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchLinguisticComponentsStatus { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchLinksDatabase { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchMetadataCategory { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchMetadataCrawledProperty { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Alias('p')] + [System.Nullable[guid]] + ${PropSet}, + + [Alias('vt')] + [Obsolete()] + [System.Nullable[int]] + ${VariantType}, + + [Alias('c')] + [object] + ${Category}, + + [string] + ${Limit}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchMetadataManagedProperty { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [string] + ${Limit}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchMetadataMapping { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [object] + ${ManagedProperty}, + + [object] + ${CrawledProperty}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchOwner { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [Alias('l')] + [object] + ${Level}, + + [object] + ${SPWeb}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchPropertyRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${PropertyName}, + + [Parameter(Mandatory=$true, Position=1)] + [object] + ${Operator}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchPropertyRuleCollection { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQueryAndSiteSettingsService { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [switch] + ${Local}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQueryAndSiteSettingsServiceProxy { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQueryAuthority { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQueryDemoted { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQueryKeyword { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQueryScope { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Alias('u')] + [uri] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQueryScopeRule { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [uri] + ${Url}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [Alias('n')] + [object] + ${Scope}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQuerySpellingCorrection { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchQuerySuggestionCandidates { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [guid] + ${SourceId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchRankingModel { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchResultItemType { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchApplicationProxy}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchResultSource { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchSecurityTrimmer { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchService { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchServiceApplication { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchServiceApplicationBackupStore { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${BackupFolder}, + + [Parameter(Mandatory=$true, Position=1)] + [string] + ${Name}, + + [Parameter(Position=3, ValueFromPipeline=$true)] + [string] + ${BackupId}, + + [Parameter(Position=4)] + [switch] + ${UseMostRecent}, + + [Parameter(Position=5)] + [switch] + ${IsVerbose}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchServiceApplicationProxy { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchServiceInstance { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [switch] + ${Local}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchSiteHitRule { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchService}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchStatus { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [switch] + ${Primary}, + + [switch] + ${Text}, + + [switch] + ${Detailed}, + + [switch] + ${Constellation}, + + [switch] + ${JobStatus}, + + [switch] + ${HealthReport}, + + [switch] + ${DetailSearchRuntime}, + + [string] + ${Component}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchTopology { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [switch] + ${Active}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPEnterpriseSearchVssDataPath { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPFarm { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPFarmConfig { + [CmdletBinding()] +param( + [switch] + ${ServiceConnectionPoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPFeature { + [CmdletBinding(DefaultParameterSetName='Default')] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='FarmFeatures')] + [switch] + ${Farm}, + + [Parameter(ParameterSetName='SiteFeatures')] + [object] + ${Site}, + + [Parameter(ParameterSetName='WebFeatures')] + [object] + ${Web}, + + [Parameter(ParameterSetName='WebApplicationFeatures')] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='SiteFeatures')] + [switch] + ${Sandboxed}, + + [string] + ${Limit}, + + [Parameter(ParameterSetName='FarmFeatureDefinitions')] + [int] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPHealthAnalysisRule { + [CmdletBinding(DefaultParameterSetName='Default')] +param( + [Parameter(ParameterSetName='SpecificRule', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPHelpCollection { + [CmdletBinding()] +param( + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPInfoPathFormsService { + [CmdletBinding()] +param( + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPInfoPathFormTemplate { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPInfoPathUserAgent { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPInfoPathWebServiceProxy { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPInsightsAuthSettings { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPInternalAppStateSyncLastRunTime { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPInternalAppStateUpdateInterval { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPIPRangeAllowList { + [CmdletBinding(DefaultParameterSetName='CustomIPAllowList', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='CustomIPAllowList', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SiteName}, + + [Parameter(ParameterSetName='InternalIPAllowList', Mandatory=$true)] + [switch] + ${InternalIPAllowList}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPIRMSettings { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPLogEvent { + [CmdletBinding(DefaultParameterSetName='Directory')] +param( + [Parameter(ParameterSetName='Directory')] + [ValidateNotNullOrEmpty()] + [string] + ${Directory}, + + [Parameter(ParameterSetName='File')] + [ValidateNotNullOrEmpty()] + [string] + ${File}, + + [switch] + ${AsString}, + + [ValidateNotNullOrEmpty()] + [string[]] + ${ContextKey}, + + [datetime] + ${StartTime}, + + [datetime] + ${EndTime}, + + [ValidateNotNullOrEmpty()] + [string] + ${MinimumLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPLogLevel { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [string[]] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPManagedAccount { + [CmdletBinding(DefaultParameterSetName='Service')] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Service', ValueFromPipeline=$true)] + [object] + ${Service}, + + [Parameter(ParameterSetName='WebApplication', ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='Server', ValueFromPipeline=$true)] + [object] + ${Server}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPManagedPath { + [CmdletBinding(DefaultParameterSetName='WebApplication')] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='WebApplication', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='HostHeader', Mandatory=$true)] + [switch] + ${HostHeader}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPMetadataServiceApplication { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPMetadataServiceApplicationProxy { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPMicrofeedOptions { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPMobileMessagingAccount { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [Alias('ServiceType','AccountType')] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPO365LinkSettings { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPODataConnectionSetting { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [ValidateNotNull()] + [ValidateLength(0, 246)] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPODataConnectionSettingMetadata { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(Mandatory=$true)] + [ValidateLength(0, 255)] + [ValidateNotNull()] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPOfficeStoreAppsDefaultActivation { + [CmdletBinding(DefaultParameterSetName='AppsForOfficeSettingsInWebApplication')] +param( + [Parameter(ParameterSetName='AppsForOfficeSettingsInWebApplication', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='AppsForOfficeSettingsInSiteSubscription', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPPendingUpgradeActions { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${RootObject}, + + [switch] + ${Recursive}, + + [switch] + ${SkipSiteUpgradeActionInfo}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPPerformancePointServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPPerformancePointServiceApplicationTrustedLocation { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPPluggableSecurityTrimmer { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNull()] + [guid] + ${UserProfileApplicationProxyId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPProcessAccount { + [CmdletBinding(DefaultParameterSetName='NetworkService')] +param( + [Parameter(ParameterSetName='NetworkService')] + [switch] + ${NetworkService}, + + [Parameter(ParameterSetName='LocalSystem')] + [switch] + ${LocalSystem}, + + [Parameter(ParameterSetName='LocalService')] + [switch] + ${LocalService}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPProduct { + [CmdletBinding(DefaultParameterSetName='Local')] +param( + [Parameter(ParameterSetName='Server', ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Server}, + + [Parameter(ParameterSetName='Local')] + [switch] + ${Local}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPProfileLeader { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPProfileServiceApplicationSecurity { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [ValidateSet('UserACL','MySiteReaderACL')] + [string] + ${Type}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPProjectDatabaseQuota { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPProjectDatabaseUsage { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPProjectEnterpriseProjectTaskSync { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [uri] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPProjectEventServiceSettings { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPProjectIsEmailNotificationEnabled { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPProjectOdataConfiguration { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPProjectPCSSettings { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [Alias('sa')] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPProjectPermissionMode { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPProjectQueueSettings { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [Alias('sa')] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPProjectWebInstance { + [CmdletBinding()] +param( + [uri] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [Alias('sa')] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPRequestManagementSettings { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPRoutingMachineInfo { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${RequestManagementSettings}, + + [ValidateNotNull()] + [string] + ${Name}, + + [ValidateNotNull()] + [object] + ${Availability}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPRoutingMachinePool { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${RequestManagementSettings}, + + [ValidateNotNull()] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPRoutingRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${RequestManagementSettings}, + + [ValidateNotNull()] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPRuntimeTelemetry { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPScaleOutDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPScaleOutDatabaseDataState { + [CmdletBinding(DefaultParameterSetName='AttachedDatabase', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='AttachedDatabase', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [Parameter(ParameterSetName='UnattachedDatabase', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ConnectionString}, + + [Parameter(ParameterSetName='UnattachedDatabase')] + [switch] + ${IsAzureDatabase}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPScaleOutDatabaseInconsistency { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPScaleOutDatabaseLogEntry { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [Parameter(Mandatory=$true)] + [int] + ${Count}, + + [object] + ${MajorAction}, + + [System.Nullable[guid]] + ${CorrelationId}, + + [byte[]] + ${RangeLimitPoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSecureStoreApplication { + [CmdletBinding(DefaultParameterSetName='NameSet')] +param( + [Parameter(ParameterSetName='AllSet', Mandatory=$true)] + [switch] + ${All}, + + [Parameter(ParameterSetName='NameSet', Mandatory=$true)] + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSecureStoreSystemAccount { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSecurityTokenServiceConfig { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServer { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [Alias('Address')] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServerScaleOutDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServerScaleOutDatabaseDataState { + [CmdletBinding(DefaultParameterSetName='AttachedDatabase', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='AttachedDatabase', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [Parameter(ParameterSetName='UnattachedDatabase', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ConnectionString}, + + [Parameter(ParameterSetName='UnattachedDatabase')] + [switch] + ${IsAzureDatabase}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServerScaleOutDatabaseInconsistency { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServerScaleOutDatabaseLogEntry { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [Parameter(Mandatory=$true)] + [int] + ${Count}, + + [object] + ${MajorAction}, + + [System.Nullable[guid]] + ${CorrelationId}, + + [byte[]] + ${RangeLimitPoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPService { + [CmdletBinding(DefaultParameterSetName='Identity')] +param( + [Parameter(ParameterSetName='Identity', Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${All}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServiceApplication { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServiceApplicationEndpoint { + [CmdletBinding(DefaultParameterSetName='Identity')] +param( + [Parameter(ParameterSetName='Identity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Name', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ParameterSetName='Name')] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServiceApplicationPool { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServiceApplicationProxy { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServiceApplicationProxyGroup { + [CmdletBinding(DefaultParameterSetName='Identity')] +param( + [Parameter(ParameterSetName='Identity', Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Default identity', Mandatory=$true)] + [switch] + ${Default}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServiceApplicationSecurity { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [switch] + ${Admin}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServiceContext { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='Site', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Site}, + + [Parameter(ParameterSetName='SiteSubscription', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServiceHostConfig { + [CmdletBinding()] +param( + [switch] + ${Default}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPServiceInstance { + [CmdletBinding(DefaultParameterSetName='Identity')] +param( + [Parameter(ParameterSetName='Identity', Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Server', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Server}, + + [switch] + ${All}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSessionStateService { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPShellAdmin { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${database}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSite { + [CmdletBinding(DefaultParameterSetName='AllSitesInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='AllSitesInIdentity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Limit}, + + [Parameter(ParameterSetName='AllSitesInContentDB', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(ParameterSetName='AllSitesInContentDB')] + [switch] + ${NeedsB2BUpgrade}, + + [Parameter(ParameterSetName='AllSitesInWebApplication', ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='AllSitesInSiteSubscription', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ParameterSetName='AllSitesInIdentity')] + [switch] + ${Regex}, + + [scriptblock] + ${Filter}, + + [int] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteAdministration { + [CmdletBinding(DefaultParameterSetName='AllSitesInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='AllSitesInIdentity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Limit}, + + [Parameter(ParameterSetName='AllSitesInContentDB', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(ParameterSetName='AllSitesInWebApplication', ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='AllSitesInSiteSubscription', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ParameterSetName='AllSitesInIdentity')] + [switch] + ${Regex}, + + [scriptblock] + ${Filter}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteMapDatabase { + [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteMaster { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteSubscription { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteSubscriptionConfig { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteSubscriptionEdiscoveryHub { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteSubscriptionEdiscoverySearchScope { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteSubscriptionFeaturePack { + [CmdletBinding(DefaultParameterSetName='FeaturePack')] +param( + [Parameter(ParameterSetName='FeaturePack', Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='SiteSubscription', ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteSubscriptionIRMConfig { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteSubscriptionMetadataConfig { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteUpgradeSessionInfo { + [CmdletBinding(DefaultParameterSetName='ContentDB')] +param( + [Parameter(ParameterSetName='Site', Mandatory=$true)] + [object] + ${Site}, + + [Parameter(ParameterSetName='ContentDB', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(ParameterSetName='ContentDB')] + [object] + ${SiteSubscription}, + + [Parameter(ParameterSetName='ContentDB')] + [switch] + ${HideWaiting}, + + [Parameter(ParameterSetName='ContentDB')] + [switch] + ${ShowInProgress}, + + [Parameter(ParameterSetName='ContentDB')] + [switch] + ${ShowCompleted}, + + [Parameter(ParameterSetName='ContentDB')] + [switch] + ${ShowFailed}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSiteURL { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPSolution { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPStateServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPStateServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPStateServiceDatabase { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Default', Position=0, ValueFromPipeline=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(ParameterSetName='ServiceApplication', Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [Alias('Application')] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPTaxonomySession { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPThrottlingRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${RequestManagementSettings}, + + [ValidateNotNull()] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPTimerJob { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [ValidateNotNullOrEmpty()] + [string] + ${Type}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPTopologyServiceApplication { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPTopologyServiceApplicationProxy { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPTranslationThrottlingSetting { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [object] + ${Farm}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPTrustedIdentityTokenIssuer { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPTrustedRootAuthority { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPTrustedSecurityTokenIssuer { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPTrustedServiceTokenIssuer { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUpgradeActions { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUsageApplication { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${UsageService}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUsageDefinition { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUsageService { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUser { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [Alias('UserAlias')] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Web}, + + [object] + ${Group}, + + [string] + ${Limit}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUserLicense { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUserLicenseMapping { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='WebApplication', ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUserLicensing { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUserSettingsProvider { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUserSettingsProviderManager { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPUserSolution { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPVideoStreamingConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPVisioExternalData { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${VisioServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPVisioPerformance { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${VisioServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPVisioSafeDataProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${VisioServiceApplication}, + + [string] + ${DataProviderId}, + + [int] + ${DataProviderType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPVisioServiceApplication { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPVisioServiceApplicationProxy { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWeb { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${Site}, + + [string] + ${Limit}, + + [switch] + ${Regex}, + + [scriptblock] + ${Filter}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWebApplication { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${IncludeCentralAdministration}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWebApplicationAppDomain { + [CmdletBinding(DefaultParameterSetName='Default')] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='WebApplication', Mandatory=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='ResourceName', Mandatory=$true)] + [string] + ${AppDomain}, + + [object] + ${Zone}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWebApplicationHttpThrottlingMonitor { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWebPartPack { + [CmdletBinding()] +param( + [Parameter(Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [switch] + ${GlobalOnly}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWebTemplate { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [uint32] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWebTemplatesEnabledForSiteMaster { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWOPIBinding { + [CmdletBinding()] +param( + [ValidateNotNullOrEmpty()] + [string] + ${Application}, + + [ValidateNotNullOrEmpty()] + [string] + ${Action}, + + [ValidateNotNullOrEmpty()] + [string] + ${Extension}, + + [ValidateNotNullOrEmpty()] + [string] + ${ProgId}, + + [ValidateNotNullOrEmpty()] + [string] + ${Server}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${WOPIZone}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWOPISuppressionSetting { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWOPIZone { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWorkflowConfig { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='WebApplication', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='SiteCollection', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Get-SPWorkflowServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Grant-SPBusinessDataCatalogMetadataObject { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Principal}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${Right}, + + [string] + ${SettingId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Grant-SPObjectSecurity { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${Principal}, + + [Parameter(Mandatory=$true, Position=2)] + [ValidateNotNull()] + [string[]] + ${Rights}, + + [switch] + ${Replace}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPAccessServicesDatabase { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseName}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [guid] + ${ServerReferenceId}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [byte[]] + ${Bacpac}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPAppPackage { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [Parameter(Mandatory=$true)] + [object] + ${Source}, + + [string] + ${AssetId}, + + [string] + ${ContentMarket}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPBusinessDataCatalogDotNetAssembly { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [ValidateNotNullOrEmpty()] + [string[]] + ${DependentAssemblyPaths}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${LobSystem}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPBusinessDataCatalogModel { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [switch] + ${ModelsIncluded}, + + [switch] + ${LocalizedNamesIncluded}, + + [switch] + ${PropertiesIncluded}, + + [switch] + ${PermissionsIncluded}, + + [Parameter(ParameterSetName='Catalog', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='ServiceContext', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [switch] + ${Force}, + + [string] + ${SettingId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPEnterpriseSearchCustomExtractionDictionary { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true, HelpMessage='Specify the UNC path to the CSV file.')] + [string] + ${FileName}, + + [Parameter(Mandatory=$true, HelpMessage='Specify the fully qualified name of the target dictionary to be deployed.')] + [ValidateSet('Microsoft.UserDictionaries.EntityExtraction.Custom.Word.1','Microsoft.UserDictionaries.EntityExtraction.Custom.Word.2','Microsoft.UserDictionaries.EntityExtraction.Custom.Word.3','Microsoft.UserDictionaries.EntityExtraction.Custom.Word.4','Microsoft.UserDictionaries.EntityExtraction.Custom.Word.5','Microsoft.UserDictionaries.EntityExtraction.Custom.ExactWord.1','Microsoft.UserDictionaries.EntityExtraction.Custom.WordPart.1','Microsoft.UserDictionaries.EntityExtraction.Custom.WordPart.2','Microsoft.UserDictionaries.EntityExtraction.Custom.WordPart.3','Microsoft.UserDictionaries.EntityExtraction.Custom.WordPart.4','Microsoft.UserDictionaries.EntityExtraction.Custom.WordPart.5','Microsoft.UserDictionaries.EntityExtraction.Custom.ExactWordPart.1')] + [string] + ${DictionaryName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPEnterpriseSearchPopularQueries { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplicationProxy}, + + [Parameter(Mandatory=$true)] + [object] + ${ResultSource}, + + [Parameter(Mandatory=$true)] + [object] + ${Web}, + + [string] + ${Filename}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPEnterpriseSearchThesaurus { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true, HelpMessage='Specify the UNC path to the CSV file.')] + [string] + ${FileName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPEnterpriseSearchTopology { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [string] + ${Filename}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPInfoPathAdministrationFiles { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Path}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPMetadataWebServicePartitionData { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceProxy}, + + [switch] + ${ToServiceDatabase}, + + [ValidateNotNull()] + [object] + ${ToContentDatabase}, + + [switch] + ${NoCompression}, + + [ValidateSet('true','false')] + [switch] + ${OverwriteExisting}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPPerformancePointContent { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [string] + ${ImportFileUrl}, + + [Parameter(Mandatory=$true)] + [string] + ${MasterPageUrl}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${SiteDestination}, + + [Parameter(Mandatory=$true)] + [hashtable] + ${LocationMap}, + + [Parameter(Mandatory=$true)] + [hashtable] + ${DatasourceMap}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPScaleOutDatabaseTenantData { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${FilePath}, + + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true)] + [guid] + ${SiteSubscriptionId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPServerScaleOutDatabaseTenantData { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${FilePath}, + + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true)] + [guid] + ${SiteSubscriptionId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPSiteSubscriptionBusinessDataCatalogConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [switch] + ${ModelsIncluded}, + + [switch] + ${LocalizedNamesIncluded}, + + [switch] + ${PropertiesIncluded}, + + [switch] + ${ProxiesIncluded}, + + [switch] + ${PermissionsIncluded}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPSiteSubscriptionSettings { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [switch] + ${AdminProperties}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Import-SPWeb { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${IncludeUserCustomAction}, + + [switch] + ${ActivateSolutions}, + + [object] + ${UpdateVersions}, + + [Parameter(Mandatory=$true)] + [string] + ${Path}, + + [switch] + ${Force}, + + [switch] + ${IncludeUserSecurity}, + + [switch] + ${HaltOnWarning}, + + [switch] + ${HaltOnError}, + + [switch] + ${NoLogFile}, + + [switch] + ${NoFileCompression}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Initialize-SPResourceSecurity { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Initialize-SPStateServiceDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPApp { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Web}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPApplicationContent { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPDataConnectionFile { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Path}, + + [ValidateLength(0, 255)] + [string] + ${Category}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${WebAccessible}, + + [switch] + ${Overwrite}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPFeature { + [CmdletBinding(DefaultParameterSetName='PathSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='PathSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Path}, + + [Parameter(ParameterSetName='AllExistingFeatures', Mandatory=$true)] + [switch] + ${AllExistingFeatures}, + + [Parameter(ParameterSetName='ScanForFeatures', Mandatory=$true)] + [switch] + ${ScanForFeatures}, + + [switch] + ${Force}, + + [Parameter(ParameterSetName='ScanForFeatures')] + [Parameter(ParameterSetName='AllExistingFeatures')] + [string] + ${SolutionId}, + + [Parameter(ParameterSetName='PathSet')] + [int] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPHelpCollection { + [CmdletBinding(DefaultParameterSetName='InstallOne')] +param( + [Parameter(ParameterSetName='InstallOne', Mandatory=$true)] + [ValidateNotNull()] + [string] + ${LiteralPath}, + + [Parameter(ParameterSetName='InstallAll', Mandatory=$true)] + [switch] + ${All}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPInfoPathFormTemplate { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Path}, + + [switch] + ${EnableGradualUpgrade}, + + [switch] + ${NoWait}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPService { + [CmdletBinding()] +param( + [switch] + ${Provision}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPSolution { + [CmdletBinding(DefaultParameterSetName='Deploy', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Synchronize', Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='Deploy', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Deploy')] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='Deploy')] + [string] + ${Time}, + + [Parameter(ParameterSetName='Deploy')] + [switch] + ${CASPolicies}, + + [Parameter(ParameterSetName='Deploy')] + [switch] + ${GACDeployment}, + + [Parameter(ParameterSetName='Deploy')] + [switch] + ${FullTrustBinDeployment}, + + [Parameter(ParameterSetName='Deploy')] + [switch] + ${Local}, + + [uint32] + ${Language}, + + [Parameter(ParameterSetName='Deploy')] + [switch] + ${Force}, + + [Parameter(ParameterSetName='Deploy')] + [switch] + ${AllWebApplications}, + + [Parameter(ParameterSetName='Deploy')] + [string] + ${CompatibilityLevel}, + + [Parameter(ParameterSetName='Synchronize', Mandatory=$true)] + [switch] + ${Synchronize}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPUserSolution { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Install-SPWebPartPack { + [CmdletBinding(DefaultParameterSetName='UseFileName', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='UseName', Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(ParameterSetName='UseFileName', Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${LiteralPath}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [switch] + ${GlobalInstall}, + + [uint32] + ${Language}, + + [switch] + ${Force}, + + [string] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Invoke-SPProjectActiveDirectoryEnterpriseResourcePoolSync { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Invoke-SPProjectActiveDirectoryGroupSync { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Merge-SPLogFile { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [string] + ${Path}, + + [switch] + ${Overwrite}, + + [datetime] + ${StartTime}, + + [datetime] + ${EndTime}, + + [string[]] + ${Process}, + + [uint32[]] + ${ThreadID}, + + [string[]] + ${Area}, + + [string[]] + ${Category}, + + [string[]] + ${EventID}, + + [string] + ${Level}, + + [string[]] + ${Message}, + + [guid[]] + ${Correlation}, + + [string[]] + ${ContextFilter}, + + [switch] + ${ExcludeNestedCorrelation}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Migrate-SPDatabase { + [CmdletBinding(DefaultParameterSetName='SiteSubscription', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='SiteSubscription', Mandatory=$true, Position=1)] + [object] + ${DestinationDatabase}, + + [Parameter(ParameterSetName='SiteCollection', Mandatory=$true, Position=2)] + [object] + ${SiteCollection}, + + [Parameter(ParameterSetName='SiteSubscription', Mandatory=$true, Position=2)] + [object] + ${SiteSubscription}, + + [Parameter(Mandatory=$true, Position=3)] + [object] + ${ServiceType}, + + [Parameter(Position=4)] + [switch] + ${Overwrite}, + + [Parameter(Position=5)] + [switch] + ${UseLinkedSqlServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Migrate-SPProjectDatabase { + [CmdletBinding(DefaultParameterSetName='web', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='web', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseName}, + + [Parameter(ParameterSetName='web')] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [Parameter(ParameterSetName='web')] + [ValidateNotNullOrEmpty()] + [string] + ${FailoverPartner}, + + [Parameter(ParameterSetName='web')] + [pscredential] + ${SQLLogon}, + + [Parameter(ParameterSetName='web')] + [switch] + ${Overwrite}, + + [Parameter(ParameterSetName='web', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Migrate-SPProjectResourcePlans { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Mount-SPContentDatabase { + [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [switch] + ${SkipIntegrityChecks}, + + [switch] + ${NoB2BSiteUpgrade}, + + [string] + ${DatabaseFailoverServer}, + + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNull()] + [string] + ${Name}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseAccessCredentials}, + + [ValidateRange(1, 2147483647)] + [int] + ${MaxSiteCount}, + + [ValidateRange(0, 2147483647)] + [int] + ${WarningSiteCount}, + + [switch] + ${ClearChangeLog}, + + [switch] + ${ChangeSyncKnowledge}, + + [switch] + ${AssignNewDatabaseId}, + + [switch] + ${UseLatestSchema}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Mount-SPSiteMapDatabase { + [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseName}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [string] + ${DatabaseFailoverServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Mount-SPStateServiceDatabase { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [string] + ${DatabaseServer}, + + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [ValidateRange(0, 10)] + [System.Nullable[int]] + ${Weight}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Move-SPAppManagementData { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Default', Mandatory=$true)] + [object] + ${SourceAppManagementDatabase}, + + [Parameter(ParameterSetName='Default', Mandatory=$true)] + [object] + ${TargetContentDatabase}, + + [Parameter(ParameterSetName='Default', Mandatory=$true)] + [guid] + ${SiteSubscriptionId}, + + [Parameter(ParameterSetName='Default')] + [switch] + ${OverWrite}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Move-SPBlobStorageLocation { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${SourceDatabase}, + + [ValidateNotNullOrEmpty()] + [string] + ${DestinationDataSourceInstance}, + + [ValidateNotNullOrEmpty()] + [string] + ${DestinationDatabase}, + + [ValidateNotNullOrEmpty()] + [string] + ${Dir}, + + [ValidateNotNullOrEmpty()] + [bool] + ${VerboseMod}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Move-SPDeletedSite { + [CmdletBinding(DefaultParameterSetName='DatabaseFromPipebind', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(Mandatory=$true)] + [object] + ${DestinationDatabase}, + + [hashtable] + ${RbsProviderMapping}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Move-SPEnterpriseSearchLinksDatabases { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Position=1)] + [System.Nullable[guid]] + ${RepartitioningId}, + + [Parameter(Position=2)] + [object] + ${SourceStores}, + + [Parameter(Position=3)] + [object] + ${TargetStores}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Move-SPProfileManagedMetadataProperty { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [string] + ${Identity}, + + [string] + ${TermSetName}, + + [switch] + ${AvailableForTagging}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Move-SPSecureStorePartitionData { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseConnectionString}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [string] + ${SourceFarmPassphrase}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [string] + ${TargetFarmPassphrase}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Move-SPSite { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${DestinationDatabase}, + + [hashtable] + ${RbsProviderMapping}, + + [bool] + ${CopyEvents}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Move-SPSocialComment { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [string] + ${OldUrl}, + + [string] + ${NewUrl}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Move-SPUser { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('UserAlias')] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${NewAlias}, + + [switch] + ${IgnoreSID}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAccessServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ApplicationPool}, + + [string] + ${Name}, + + [switch] + ${Default}, + + [ValidateRange(1, 255)] + [int] + ${ColumnsMax}, + + [ValidateRange(1, 200000)] + [int] + ${RowsMax}, + + [ValidateRange(1, 20)] + [int] + ${SourcesMax}, + + [ValidateRange(0, 32)] + [int] + ${OutputCalculatedColumnsMax}, + + [ValidateRange(0, 8)] + [int] + ${OrderByMax}, + + [switch] + ${OuterJoinsAllowed}, + + [switch] + ${NonRemotableQueriesAllowed}, + + [ValidateRange(-1, 2147483647)] + [int] + ${RecordsInTableMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${ApplicationLogSizeMax}, + + [ValidateRange(-1, 2073600)] + [int] + ${RequestDurationMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${SessionsPerUserMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${SessionsPerAnonymousUserMax}, + + [ValidateRange(-1, 2073600)] + [int] + ${CacheTimeout}, + + [ValidateRange(0, 4096)] + [int] + ${SessionMemoryMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${PrivateBytesMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${TemplateSizeMax}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAccessServicesApplication { + [CmdletBinding(DefaultParameterSetName='NoApplicationServerParameterSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='DefaultParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [ValidateNotNull()] + [pscredential] + ${DatabaseServerCredentials}, + + [Parameter(ParameterSetName='DefaultParameterSet', Mandatory=$true, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='NoApplicationServerParameterSet', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ApplicationPool}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [string] + ${Name}, + + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [Parameter(ParameterSetName='DefaultParameterSet', Mandatory=$true)] + [switch] + ${Default}, + + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [Parameter(ParameterSetName='DefaultParameterSet')] + [ValidateRange(-1, 2073600)] + [int] + ${RequestDurationMax}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [ValidateRange(-1, 2147483647)] + [int] + ${SessionsPerUserMax}, + + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [Parameter(ParameterSetName='DefaultParameterSet')] + [ValidateRange(-1, 2147483647)] + [int] + ${SessionsPerAnonymousUserMax}, + + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [Parameter(ParameterSetName='DefaultParameterSet')] + [ValidateRange(-1, 2073600)] + [int] + ${CacheTimeout}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [ValidateRange(-1, 2147483647)] + [int] + ${PrivateBytesMax}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [ValidateRange(-1, 2073600)] + [int] + ${QueryTimeout}, + + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [Parameter(ParameterSetName='DefaultParameterSet')] + [ValidateRange(-1, 1440)] + [int] + ${RecoveryPointObjective}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [Parameter(ParameterSetName='NoApplicationServerParameterSet')] + [bool] + ${Hosted}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [bool] + ${Encrypt}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [bool] + ${TrustServerCertificate}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAccessServicesApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${application}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAccessServicesDatabaseServer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceContext}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServerName}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServerGroupName}, + + [ValidateNotNullOrEmpty()] + [guid] + ${ServerReferenceId}, + + [ValidateNotNullOrEmpty()] + [pscredential] + ${DatabaseServerCredentials}, + + [ValidateNotNullOrEmpty()] + [bool] + ${AvailableForCreate}, + + [ValidateNotNullOrEmpty()] + [bool] + ${Exclusive}, + + [bool] + ${Encrypt}, + + [bool] + ${TrustServerCertificate}, + + [bool] + ${ValidateServer}, + + [ValidateNotNullOrEmpty()] + [string] + ${SecondaryDatabaseServerName}, + + [ValidateNotNullOrEmpty()] + [string] + ${UserDomain}, + + [object] + ${LoginType}, + + [object] + ${State}, + + [object] + ${StateOwner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAlternateURL { + [CmdletBinding(DefaultParameterSetName='WebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Url}, + + [object] + ${Zone}, + + [switch] + ${Internal}, + + [Parameter(ParameterSetName='WebApplication', Mandatory=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='ResourceName', Mandatory=$true)] + [string] + ${ResourceName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAppManagementServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${Name}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseName}, + + [ValidateNotNullOrEmpty()] + [string] + ${FailoverDatabaseServer}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ApplicationPool}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [switch] + ${DeferUpgradeActions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAppManagementServiceApplicationProxy { + [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${Name}, + + [switch] + ${UseDefaultProxyGroup}, + + [Parameter(ParameterSetName='Uri', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Uri}, + + [Parameter(ParameterSetName='ServiceApplication', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAuthenticationProvider { + [CmdletBinding(DefaultParameterSetName='Windows')] +param( + [Parameter(ParameterSetName='Windows')] + [switch] + ${AllowAnonymous}, + + [Parameter(ParameterSetName='Windows')] + [switch] + ${UseBasicAuthentication}, + + [Parameter(ParameterSetName='Windows')] + [switch] + ${DisableKerberos}, + + [Parameter(ParameterSetName='Windows')] + [switch] + ${UseWindowsIntegratedAuthentication}, + + [Parameter(ParameterSetName='Forms', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ASPNETMembershipProvider}, + + [Parameter(ParameterSetName='Forms', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ASPNETRoleProviderName}, + + [Parameter(ParameterSetName='Trusted', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${TrustedIdentityTokenIssuer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAzureAccessControlServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${MetadataServiceEndpointUri}, + + [ValidateNotNull()] + [switch] + ${DefaultProxyGroup}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPAzureVideoServiceAccount { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(Mandatory=$true, Position=1)] + [object] + ${ServiceContext}, + + [Parameter(Mandatory=$true, Position=2)] + [uri] + ${GlobalLocatorServiceUri}, + + [Parameter(Mandatory=$true, Position=3)] + [string] + ${Region}, + + [Parameter(Position=4)] + [System.Net.ICredentials] + ${OAuth2BearerCredentials}, + + [Parameter(Position=5)] + [switch] + ${SkipCheckAccountExistence}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPBECWebServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ServiceEndpointUri}, + + [ValidateNotNull()] + [switch] + ${DefaultProxyGroup}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPBusinessDataCatalogServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${Name}, + + [switch] + ${PartitionMode}, + + [switch] + ${Sharing}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [string] + ${DatabaseName}, + + [string] + ${FailoverDatabaseServer}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [pscredential] + ${DatabaseCredentials}, + + [string] + ${DatabaseUsername}, + + [securestring] + ${DatabasePassword}, + + [switch] + ${DeferUpgradeActions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPBusinessDataCatalogServiceApplicationProxy { + [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Uri', Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${Uri}, + + [switch] + ${DefaultProxyGroup}, + + [string] + ${Name}, + + [Parameter(ParameterSetName='PipeBind', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ServiceApplication}, + + [Parameter(ParameterSetName='Uri')] + [switch] + ${PartitionMode}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPCentralAdministration { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [int] + ${Port}, + + [Parameter(Position=1, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${WindowsAuthProvider}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPClaimProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [string] + ${DisplayName}, + + [Parameter(Mandatory=$true)] + [string] + ${Description}, + + [Parameter(Mandatory=$true)] + [string] + ${AssemblyName}, + + [Parameter(Mandatory=$true)] + [string] + ${Type}, + + [switch] + ${Enabled}, + + [switch] + ${Default}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPClaimsPrincipal { + [CmdletBinding(DefaultParameterSetName='IdentityType')] +param( + [Parameter(ParameterSetName='IdentityType', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='TrustIdentity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Identity}, + + [Parameter(ParameterSetName='STSIdentity', Mandatory=$true, Position=2)] + [Parameter(ParameterSetName='TrustIdentity', Mandatory=$true, Position=1)] + [ValidateNotNullOrEmpty()] + [object] + ${TrustedIdentityTokenIssuer}, + + [Parameter(ParameterSetName='IdentityType', Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${IdentityType}, + + [Parameter(ParameterSetName='BasicClaim', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${EncodedClaim}, + + [Parameter(ParameterSetName='ClaimProvider', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='STSIdentity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ClaimValue}, + + [Parameter(ParameterSetName='ClaimProvider', Mandatory=$true, Position=1)] + [Parameter(ParameterSetName='STSIdentity', Position=1)] + [ValidateNotNullOrEmpty()] + [string] + ${ClaimType}, + + [Parameter(ParameterSetName='ClaimProvider', Mandatory=$true, Position=2)] + [ValidateNotNull()] + [object] + ${ClaimProvider}, + + [Parameter(ParameterSetName='STSIdentity', Position=3)] + [ValidateNotNull()] + [switch] + ${IdentifierClaim}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPClaimTypeEncoding { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [char] + ${EncodingCharacter}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ClaimType}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPClaimTypeMapping { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${IncomingClaimType}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNullOrEmpty()] + [string] + ${IncomingClaimTypeDisplayName}, + + [Parameter(Position=2)] + [ValidateNotNullOrEmpty()] + [string] + ${LocalClaimType}, + + [ValidateNotNull()] + [switch] + ${SameAsIncoming}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPConfigurationDatabase { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${DatabaseName}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [Parameter(Position=2, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DirectoryDomain}, + + [Parameter(Position=3, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DirectoryOrganizationUnit}, + + [Parameter(Position=4, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${AdministrationContentDatabaseName}, + + [Parameter(Position=5, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(Mandatory=$true, Position=6, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [pscredential] + ${FarmCredentials}, + + [Parameter(Mandatory=$true, Position=7, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [securestring] + ${Passphrase}, + + [Parameter(Position=8, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [switch] + ${SkipRegisterAsDistributedCacheHost}, + + [Parameter(Position=9, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SiteMapDatabaseName}, + + [Parameter(Position=10, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SiteMapDatabaseServer}, + + [Parameter(Position=11, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${DatabaseFailOverServer}, + + [object] + ${LocalServerRole}, + + [switch] + ${ServerRoleOptional}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPContentDatabase { + [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNull()] + [string] + ${Name}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseAccessCredentials}, + + [ValidateRange(1, 2147483647)] + [int] + ${MaxSiteCount}, + + [ValidateRange(0, 2147483647)] + [int] + ${WarningSiteCount}, + + [switch] + ${ClearChangeLog}, + + [switch] + ${ChangeSyncKnowledge}, + + [switch] + ${AssignNewDatabaseId}, + + [switch] + ${UseLatestSchema}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPContentDeploymentJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [string] + ${Description}, + + [Parameter(Mandatory=$true)] + [object] + ${SPContentDeploymentPath}, + + [object] + ${Scope}, + + [string] + ${Schedule}, + + [switch] + ${ScheduleEnabled}, + + [switch] + ${IncrementalEnabled}, + + [object] + ${SqlSnapshotSetting}, + + [switch] + ${HostingSupportEnabled}, + + [object] + ${EmailNotifications}, + + [string[]] + ${EmailAddresses}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPContentDeploymentPath { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [string] + ${Description}, + + [Parameter(Mandatory=$true)] + [object] + ${SourceSPWebApplication}, + + [Parameter(Mandatory=$true)] + [object] + ${SourceSPSite}, + + [Parameter(Mandatory=$true)] + [uri] + ${DestinationCentralAdministrationURL}, + + [Parameter(Mandatory=$true)] + [uri] + ${DestinationSPWebApplication}, + + [Parameter(Mandatory=$true)] + [string] + ${DestinationSPSite}, + + [object] + ${Authentication}, + + [Parameter(Mandatory=$true)] + [pscredential] + ${PathAccount}, + + [switch] + ${DeployUserNamesEnabled}, + + [object] + ${DeploySecurityInformation}, + + [switch] + ${EventReceiversEnabled}, + + [switch] + ${CompressionEnabled}, + + [switch] + ${PathEnabled}, + + [object] + ${KeepTemporaryFilesOptions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchAdminComponent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchTopology}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchServiceInstance}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchAnalyticsProcessingComponent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchTopology}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchServiceInstance}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchContentEnrichmentConfiguration { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchContentProcessingComponent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchTopology}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchServiceInstance}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchCrawlComponent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchTopology}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchServiceInstance}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchCrawlContentSource { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('t')] + [object] + ${Type}, + + [string] + ${Tag}, + + [Alias('s')] + [string] + ${StartAddresses}, + + [Alias('p')] + [object] + ${CrawlPriority}, + + [System.Nullable[int]] + ${MaxPageEnumerationDepth}, + + [System.Nullable[int]] + ${MaxSiteEnumerationDepth}, + + [object] + ${SharePointCrawlBehavior}, + + [object] + ${BDCApplicationProxyGroup}, + + [string[]] + ${LOBSystemSet}, + + [string] + ${CustomProtocol}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchCrawlCustomConnector { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [string] + ${Protocol}, + + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [string] + ${ModelFilePath}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchCrawlDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [string] + ${DatabaseName}, + + [string] + ${DatabaseServer}, + + [string] + ${DatabaseUsername}, + + [securestring] + ${DatabasePassword}, + + [string] + ${FailoverDatabaseServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchCrawlExtension { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchCrawlMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Url}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('t')] + [string] + ${Target}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchCrawlRule { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Path}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('t')] + [object] + ${Type}, + + [System.Nullable[bool]] + ${IsAdvancedRegularExpression}, + + [System.Nullable[bool]] + ${CrawlAsHttp}, + + [System.Nullable[bool]] + ${FollowComplexUrls}, + + [System.Nullable[int]] + ${PluggableSecurityTimmerId}, + + [System.Nullable[bool]] + ${SuppressIndexing}, + + [System.Nullable[int]] + ${Priority}, + + [string] + ${ContentClass}, + + [object] + ${AuthenticationType}, + + [string] + ${AccountName}, + + [securestring] + ${AccountPassword}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchFileFormat { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true, Position=0)] + [string] + ${FormatId}, + + [Parameter(Mandatory=$true, Position=1)] + [string] + ${FormatName}, + + [Parameter(Mandatory=$true, Position=2)] + [string] + ${MimeType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchIndexComponent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchTopology}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchServiceInstance}, + + [object] + ${SearchApplication}, + + [uint32] + ${IndexPartition}, + + [string] + ${RootDirectory}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchLanguageResourcePhrase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [object] + ${Type}, + + [Parameter(Mandatory=$true)] + [string] + ${Language}, + + [string] + ${Mapping}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [guid] + ${SourceId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchLinksDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [string] + ${DatabaseName}, + + [string] + ${DatabaseServer}, + + [string] + ${DatabaseUsername}, + + [securestring] + ${DatabasePassword}, + + [string] + ${FailoverDatabaseServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchMetadataCategory { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Alias('p')] + [System.Nullable[guid]] + ${PropSet}, + + [Alias('d')] + [System.Nullable[bool]] + ${DiscoverNewProperties}, + + [Alias('m')] + [System.Nullable[bool]] + ${MapToContents}, + + [Alias('auto')] + [System.Nullable[bool]] + ${AutoCreateNewManagedProperties}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchMetadataCrawledProperty { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('c')] + [object] + ${Category}, + + [Parameter(Mandatory=$true)] + [Alias('ie')] + [bool] + ${IsNameEnum}, + + [Parameter(Mandatory=$true)] + [Alias('vt')] + [Obsolete()] + [int] + ${VariantType}, + + [Parameter(Mandatory=$true)] + [Alias('p')] + [guid] + ${PropSet}, + + [Alias('im')] + [System.Nullable[bool]] + ${IsMappedToContents}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchMetadataManagedProperty { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('t')] + [int] + ${Type}, + + [Alias('d')] + [string] + ${Description}, + + [Alias('f')] + [System.Nullable[bool]] + ${FullTextQueriable}, + + [Alias('r')] + [System.Nullable[bool]] + ${Retrievable}, + + [Alias('q')] + [System.Nullable[bool]] + ${Queryable}, + + [Alias('e')] + [System.Nullable[bool]] + ${EnabledForScoping}, + + [Alias('nn')] + [System.Nullable[bool]] + ${NameNormalized}, + + [Alias('rp')] + [System.Nullable[bool]] + ${RespectPriority}, + + [Alias('rd')] + [System.Nullable[bool]] + ${RemoveDuplicates}, + + [Alias('im5')] + [Obsolete('This property is replaced by IncludeInAlertSignature.')] + [System.Nullable[bool]] + ${IncludeInMd5}, + + [Alias('sfa')] + [System.Nullable[bool]] + ${SafeForAnonymous}, + + [Alias('ia')] + [System.Nullable[bool]] + ${IncludeInAlertSignature}, + + [Alias('nw')] + [System.Nullable[bool]] + ${NoWordBreaker}, + + [Alias('u')] + [System.Nullable[int16]] + ${UserFlags}, + + [Alias('qir')] + [System.Nullable[bool]] + ${EnabledForQueryIndependentRank}, + + [Alias('def')] + [System.Nullable[uint32]] + ${DefaultForQueryIndependentRank}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchMetadataMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [object] + ${ManagedProperty}, + + [Parameter(Mandatory=$true)] + [object] + ${CrawledProperty}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchQueryAuthority { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Url}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('l')] + [float] + ${Level}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchQueryDemoted { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Url}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchQueryKeyword { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Term}, + + [Parameter(Mandatory=$true)] + [object] + ${Site}, + + [Alias('d')] + [string] + ${Definition}, + + [Alias('c')] + [string] + ${Contact}, + + [Alias('s')] + [System.Nullable[datetime]] + ${StartDate}, + + [Alias('e')] + [System.Nullable[datetime]] + ${EndDate}, + + [Alias('r')] + [System.Nullable[datetime]] + ${ReviewDate}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchQueryProcessingComponent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchTopology}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchServiceInstance}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchQueryScope { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('d')] + [string] + ${Description}, + + [Alias('o')] + [uri] + ${OwningSiteUrl}, + + [Alias('a')] + [string] + ${AlternateResultsPage}, + + [Parameter(Mandatory=$true)] + [Alias('disp')] + [System.Nullable[bool]] + ${DisplayInAdminUI}, + + [Alias('type')] + [System.Nullable[int]] + ${CompilationType}, + + [Alias('f')] + [string] + ${ExtendedSearchFilter}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchQueryScopeRule { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('u')] + [uri] + ${Url}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [Alias('s')] + [object] + ${Scope}, + + [Parameter(Mandatory=$true)] + [Alias('type')] + [string] + ${RuleType}, + + [Alias('f')] + [string] + ${FilterBehavior}, + + [Alias('ut')] + [string] + ${UrlScopeRuleType}, + + [Alias('text')] + [string] + ${MatchingString}, + + [Alias('value')] + [string] + ${PropertyValue}, + + [Alias('mname')] + [object] + ${ManagedProperty}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchRankingModel { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [string] + ${RankingModelXML}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchResultItemType { + [CmdletBinding(DefaultParameterSetName='New', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchApplicationProxy}, + + [Parameter(ParameterSetName='New', Mandatory=$true, Position=1)] + [Parameter(ParameterSetName='Copy', Position=1)] + [Alias('n')] + [string] + ${Name}, + + [Parameter(ParameterSetName='New', Mandatory=$true, Position=2)] + [Parameter(ParameterSetName='Copy', Position=2)] + [Alias('rule')] + [object] + ${Rules}, + + [Parameter(Position=3)] + [Alias('priority')] + [int] + ${RulePriority}, + + [Parameter(Position=4)] + [Alias('dp')] + [string] + ${DisplayProperties}, + + [Parameter(Position=5)] + [Alias('sid')] + [System.Nullable[guid]] + ${SourceID}, + + [Parameter(ParameterSetName='New', Mandatory=$true, Position=6)] + [Parameter(ParameterSetName='Copy', Position=6)] + [Alias('url')] + [string] + ${DisplayTemplateUrl}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ParameterSetName='Copy', Mandatory=$true)] + [Alias('copy')] + [object] + ${ExistingResultItemType}, + + [Parameter(ParameterSetName='Copy', Mandatory=$true)] + [Alias('eo')] + [object] + ${ExistingResultItemTypeOwner}, + + [Alias('opt')] + [System.Nullable[bool]] + ${OptimizeForFrequentUse}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchResultSource { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [string] + ${Description}, + + [string] + ${QueryTemplate}, + + [Parameter(Mandatory=$true)] + [guid] + ${ProviderId}, + + [string] + ${RemoteUrl}, + + [System.Nullable[bool]] + ${AutoDiscover}, + + [object] + ${AuthenticationType}, + + [string] + ${UserName}, + + [string] + ${Password}, + + [string] + ${SsoId}, + + [System.Nullable[bool]] + ${MakeDefault}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchSecurityTrimmer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [int] + ${Id}, + + [Parameter(Mandatory=$true)] + [string] + ${TypeName}, + + [string] + ${Properties}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [string] + ${RulePath}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='DefaultParameterSet', Position=0)] + [Parameter(ParameterSetName='DatabasePlacement', Position=0)] + [string] + ${Name}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [string] + ${DatabaseServer}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [string] + ${DatabaseName}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [string] + ${DatabaseUsername}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [securestring] + ${DatabasePassword}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [string] + ${FailoverDatabaseServer}, + + [Parameter(ParameterSetName='DatabasePlacement')] + [Parameter(ParameterSetName='DefaultParameterSet')] + [switch] + ${Partitioned}, + + [Parameter(ParameterSetName='DefaultParameterSet', Mandatory=$true)] + [object] + ${ApplicationPool}, + + [Parameter(ParameterSetName='DefaultParameterSet')] + [object] + ${AdminApplicationPool}, + + [Parameter(ParameterSetName='DatabasePlacement', Mandatory=$true)] + [hashtable] + ${ParametersForDatabases}, + + [Parameter(ParameterSetName='DatabasePlacement')] + [Parameter(ParameterSetName='DefaultParameterSet')] + [bool] + ${CloudIndex}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchServiceApplicationProxy { + [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='SSA', Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(Position=0)] + [string] + ${Name}, + + [Parameter(ParameterSetName='Uri', Mandatory=$true)] + [string] + ${Uri}, + + [switch] + ${Partitioned}, + + [switch] + ${MergeWithDefaultPartition}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchSiteHitRule { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchService}, + + [Parameter(Mandatory=$true)] + [string] + ${HitRate}, + + [Parameter(Mandatory=$true)] + [string] + ${Behavior}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPEnterpriseSearchTopology { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ParameterSetName='Clone')] + [switch] + ${Clone}, + + [Parameter(ParameterSetName='Clone')] + [object] + ${SearchTopology}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPLogFile { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPManagedAccount { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [pscredential] + ${Credential}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPManagedPath { + [CmdletBinding(DefaultParameterSetName='WebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${RelativeURL}, + + [Parameter(ParameterSetName='WebApplication', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='HostHeader', Mandatory=$true)] + [switch] + ${HostHeader}, + + [switch] + ${Explicit}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPMarketplaceWebServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ServiceEndpointUri}, + + [ValidateNotNull()] + [switch] + ${DefaultProxyGroup}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPMetadataServiceApplication { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${AdministratorAccount}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [string] + ${DatabaseName}, + + [string] + ${DatabaseServer}, + + [pscredential] + ${DatabaseCredentials}, + + [string] + ${FailoverDatabaseServer}, + + [string] + ${FullAccessAccount}, + + [string] + ${HubUri}, + + [Parameter(ParameterSetName='NoQuota', Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='Quota', Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [Parameter(ParameterSetName='Default', Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [switch] + ${PartitionMode}, + + [string] + ${ReadAccessAccount}, + + [string] + ${RestrictedAccount}, + + [switch] + ${SyndicationErrorReportEnabled}, + + [int] + ${CacheTimeCheckInterval}, + + [int] + ${MaxChannelCache}, + + [Parameter(ParameterSetName='NoQuota', Mandatory=$true)] + [switch] + ${DisablePartitionQuota}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${GroupsPerPartition}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${TermSetsPerPartition}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${TermsPerPartition}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${LabelsPerPartition}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${PropertiesPerPartition}, + + [switch] + ${DeferUpgradeActions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPMetadataServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [switch] + ${ContentTypePushdownEnabled}, + + [switch] + ${ContentTypeSyndicationEnabled}, + + [switch] + ${DefaultProxyGroup}, + + [switch] + ${DefaultKeywordTaxonomy}, + + [switch] + ${DefaultSiteCollectionTaxonomy}, + + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [switch] + ${PartitionMode}, + + [object] + ${ServiceApplication}, + + [string] + ${Uri}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPODataConnectionSetting { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [ValidateLength(0, 246)] + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${ServiceAddressURL}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${AuthenticationMode}, + + [ValidateNotNull()] + [ValidateLength(0, 1024)] + [string] + ${SecureStoreTargetApplicationId}, + + [string] + ${ExtensionProvider}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPOnlineApplicationPrincipalManagementServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${OnlineTenantUri}, + + [ValidateNotNull()] + [switch] + ${DefaultProxyGroup}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPPerformancePointServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateLength(0, 64)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ApplicationPool}, + + [bool] + ${CommentsDisabled}, + + [int] + ${CommentsScorecardMax}, + + [int] + ${IndicatorImageCacheSeconds}, + + [int] + ${DataSourceQueryTimeoutSeconds}, + + [int] + ${FilterRememberUserSelectionsDays}, + + [int] + ${FilterTreeMembersMax}, + + [int] + ${FilterSearchResultsMax}, + + [int] + ${ShowDetailsInitialRows}, + + [bool] + ${ShowDetailsMaxRowsDisabled}, + + [int] + ${ShowDetailsMaxRows}, + + [bool] + ${MSMQEnabled}, + + [string] + ${MSMQName}, + + [int] + ${SessionHistoryHours}, + + [bool] + ${AnalyticQueryLoggingEnabled}, + + [bool] + ${TrustedDataSourceLocationsRestricted}, + + [bool] + ${TrustedContentLocationsRestricted}, + + [int] + ${SelectMeasureMaximum}, + + [int] + ${DecompositionTreeMaximum}, + + [bool] + ${ApplicationProxyCacheEnabled}, + + [bool] + ${ApplicationCacheEnabled}, + + [int] + ${ApplicationCacheMinimumHitCount}, + + [int] + ${AnalyticResultCacheMinimumHitCount}, + + [int] + ${ElementCacheSeconds}, + + [int] + ${AnalyticQueryCellMax}, + + [string] + ${DatabaseServer}, + + [string] + ${DatabaseName}, + + [string] + ${DatabaseFailoverServer}, + + [pscredential] + ${DatabaseSQLAuthenticationCredential}, + + [bool] + ${UseEffectiveUserName}, + + [string] + ${DataSourceUnattendedServiceAccountTargetApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPPerformancePointServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateLength(0, 64)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [switch] + ${Default}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPPerformancePointServiceApplicationTrustedLocation { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateLength(0, 1024)] + [string] + ${Url}, + + [Parameter(Mandatory=$true)] + [object] + ${Type}, + + [Parameter(Mandatory=$true)] + [object] + ${TrustedLocationType}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [string] + ${Description}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPPowerPointConversionServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateLength(1, 128)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ApplicationPool}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPPowerPointConversionServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateLength(1, 128)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [switch] + ${AddToDefaultGroup}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPProfileServiceApplication { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ApplicationPool}, + + [string] + ${ProfileDBName}, + + [string] + ${ProfileDBServer}, + + [pscredential] + ${ProfileDBCredentials}, + + [string] + ${ProfileDBFailoverServer}, + + [string] + ${SocialDBName}, + + [string] + ${SocialDBServer}, + + [pscredential] + ${SocialDBCredentials}, + + [string] + ${SocialDBFailoverServer}, + + [string] + ${ProfileSyncDBName}, + + [string] + ${ProfileSyncDBServer}, + + [pscredential] + ${ProfileSyncDBCredentials}, + + [string] + ${ProfileSyncDBFailoverServer}, + + [switch] + ${PartitionMode}, + + [Parameter(ValueFromPipeline=$true)] + [Parameter(ParameterSetName='MySiteSettings', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${MySiteHostLocation}, + + [Parameter(ParameterSetName='MySiteSettings', ValueFromPipeline=$true)] + [object] + ${MySiteManagedPath}, + + [Parameter(ParameterSetName='MySiteSettings')] + [ValidateSet('None','Resolve','Block')] + [string] + ${SiteNamingConflictResolution}, + + [switch] + ${DeferUpgradeActions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPProfileServiceApplicationProxy { + [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [string] + ${Name}, + + [Parameter(ParameterSetName='Application', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceApplication}, + + [Parameter(ParameterSetName='Uri', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [uri] + ${Uri}, + + [switch] + ${DefaultProxyGroup}, + + [switch] + ${PartitionMode}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPProjectServiceApplication { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${ApplicationPool}, + + [switch] + ${Proxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPProjectServiceApplicationProxy { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [Alias('sa')] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPRequestManagementRuleCriteria { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='CustomPropertyParameterSet', Mandatory=$true, Position=0)] + [Parameter(ParameterSetName='StandardParameterSet', Mandatory=$true, Position=0)] + [string] + ${Value}, + + [Parameter(ParameterSetName='CustomPropertyParameterSet', Mandatory=$true, Position=1)] + [string] + ${CustomHeader}, + + [Parameter(ParameterSetName='StandardParameterSet', Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${Property}, + + [Parameter(ParameterSetName='CustomPropertyParameterSet', Position=2)] + [Parameter(ParameterSetName='StandardParameterSet', Position=2)] + [ValidateNotNull()] + [object] + ${MatchType}, + + [Parameter(ParameterSetName='StandardParameterSet', Position=2)] + [Parameter(ParameterSetName='CustomPropertyParameterSet', Position=2)] + [System.Nullable[switch]] + ${CaseSensitive}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSecureStoreApplication { + [CmdletBinding()] +param( + [object] + ${Administrator}, + + [object] + ${CredentialsOwnerGroup}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Fields}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(Mandatory=$true)] + [object] + ${TargetApplication}, + + [object] + ${TicketRedeemer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSecureStoreApplicationField { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [switch] + ${Masked}, + + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [object] + ${Type}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSecureStoreServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='MinDBSet', Mandatory=$true)] + [Parameter(ParameterSetName='NoMinDBSet', Mandatory=$true)] + [object] + ${ApplicationPool}, + + [Parameter(ParameterSetName='MinDBSet', Mandatory=$true)] + [Parameter(ParameterSetName='NoMinDBSet', Mandatory=$true)] + [switch] + ${AuditingEnabled}, + + [Parameter(ParameterSetName='NoMinDBSet')] + [Parameter(ParameterSetName='MinDBSet')] + [System.Nullable[int]] + ${AuditlogMaxSize}, + + [Parameter(ParameterSetName='NoMinDBSet')] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ParameterSetName='NoMinDBSet')] + [string] + ${DatabaseName}, + + [Parameter(ParameterSetName='NoMinDBSet')] + [securestring] + ${DatabasePassword}, + + [Parameter(ParameterSetName='NoMinDBSet')] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [Parameter(ParameterSetName='NoMinDBSet')] + [string] + ${DatabaseUsername}, + + [Parameter(ParameterSetName='NoMinDBSet')] + [string] + ${FailoverDatabaseServer}, + + [Parameter(ParameterSetName='MinDBSet')] + [Parameter(ParameterSetName='NoMinDBSet')] + [string] + ${Name}, + + [Parameter(ParameterSetName='NoMinDBSet')] + [Parameter(ParameterSetName='MinDBSet')] + [switch] + ${PartitionMode}, + + [Parameter(ParameterSetName='NoMinDBSet')] + [Parameter(ParameterSetName='MinDBSet')] + [switch] + ${Sharing}, + + [Parameter(ParameterSetName='MinDBSet')] + [Parameter(ParameterSetName='NoMinDBSet')] + [switch] + ${DeferUpgradeActions}, + + [Parameter(ParameterSetName='MinDBSet', Mandatory=$true)] + [switch] + ${EnableMinDB}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSecureStoreServiceApplicationProxy { + [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [switch] + ${DefaultProxyGroup}, + + [string] + ${Name}, + + [Parameter(ParameterSetName='PipeBind', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ParameterSetName='Uri', Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${Uri}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSecureStoreTargetApplication { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [object] + ${ApplicationType}, + + [string] + ${ContactEmail}, + + [Parameter(Mandatory=$true)] + [string] + ${FriendlyName}, + + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [ValidateNotNull()] + [uri] + ${SetCredentialsUri}, + + [int] + ${TimeoutInMinutes}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPServiceApplicationPool { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateLength(1, 100)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(Mandatory=$true, Position=1)] + [object] + ${Account}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPServiceApplicationProxyGroup { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNull()] + [AllowEmptyString()] + [ValidateLength(0, 100)] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSite { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Url}, + + [uint32] + ${Language}, + + [object] + ${Template}, + + [string] + ${Name}, + + [string] + ${Description}, + + [object] + ${QuotaTemplate}, + + [string] + ${OwnerEmail}, + + [Parameter(Mandatory=$true)] + [object] + ${OwnerAlias}, + + [string] + ${SecondaryEmail}, + + [object] + ${SecondaryOwnerAlias}, + + [object] + ${HostHeaderWebApplication}, + + [object] + ${ContentDatabase}, + + [object] + ${SiteSubscription}, + + [object] + ${AdministrationSiteType}, + + [int] + ${CompatibilityLevel}, + + [switch] + ${OverrideCompatibilityRestriction}, + + [switch] + ${CreateFromSiteMaster}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSiteMaster { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(Mandatory=$true)] + [object] + ${Template}, + + [uint32] + ${Language}, + + [int] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSiteSubscription { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSiteSubscriptionFeaturePack { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPStateServiceApplication { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Database}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPStateServiceApplicationProxy { + [CmdletBinding()] +param( + [string] + ${Name}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ServiceApplication}, + + [switch] + ${DefaultProxyGroup}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPStateServiceDatabase { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [string] + ${DatabaseServer}, + + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [ValidateRange(0, 10)] + [System.Nullable[int]] + ${Weight}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSubscriptionSettingsServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${Name}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseName}, + + [ValidateNotNullOrEmpty()] + [string] + ${FailoverDatabaseServer}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ApplicationPool}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [switch] + ${DeferUpgradeActions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPSubscriptionSettingsServiceApplicationProxy { + [CmdletBinding(DefaultParameterSetName='Uri', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Uri', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Uri}, + + [Parameter(ParameterSetName='ServiceApplication', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPTranslationServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [string] + ${DatabaseName}, + + [string] + ${DatabaseServer}, + + [pscredential] + ${DatabaseCredential}, + + [string] + ${FailoverDatabaseServer}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [switch] + ${PartitionMode}, + + [switch] + ${Default}, + + [switch] + ${DeferUpgradeActions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPTranslationServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [switch] + ${DefaultProxyGroup}, + + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [switch] + ${PartitionMode}, + + [Parameter(ParameterSetName='ConnectLocal', Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(ParameterSetName='ConnectRemote', Mandatory=$true)] + [string] + ${Uri}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPTrustedIdentityTokenIssuer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='BasicParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(ParameterSetName='BasicParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Description}, + + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet')] + [Parameter(ParameterSetName='BasicParameterSet')] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${ImportTrustCertificate}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='BasicParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ClaimsMappings}, + + [Parameter(ParameterSetName='BasicParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SignInUrl}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='BasicParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${IdentifierClaim}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [Parameter(ParameterSetName='BasicParameterSet')] + [object] + ${ClaimProvider}, + + [Parameter(ParameterSetName='BasicParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [string] + ${Realm}, + + [Parameter(ParameterSetName='BasicParameterSet')] + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet')] + [switch] + ${UseWReply}, + + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet', Mandatory=$true)] + [switch] + ${UseDefaultConfiguration}, + + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet')] + [ValidateSet('EMAIL','USER-PRINCIPAL-NAME','ACCOUNT-NAME')] + [string] + ${IdentifierClaimIs}, + + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet')] + [Parameter(ParameterSetName='BasicParameterSet')] + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [ValidateNotNullOrEmpty()] + [string] + ${SignOutUrl}, + + [Parameter(ParameterSetName='ActiveDirectoryBackedParameterSet')] + [Parameter(ParameterSetName='BasicParameterSet')] + [ValidateNotNullOrEmpty()] + [string] + ${RegisteredIssuerName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPTrustedRootAuthority { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(ParameterSetName='ManualUpdateCertificateParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${Certificate}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPTrustedSecurityTokenIssuer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [ValidateNotNullOrEmpty()] + [string] + ${Description}, + + [ValidateNotNullOrEmpty()] + [string] + ${RegisteredIssuerName}, + + [ValidateNotNullOrEmpty()] + [switch] + ${IsTrustBroker}, + + [Parameter(ParameterSetName='ImportCertificateParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${Certificate}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPTrustedServiceTokenIssuer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [ValidateNotNullOrEmpty()] + [string] + ${Description}, + + [Parameter(ParameterSetName='ImportCertificateParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${Certificate}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPUsageApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0)] + [string] + ${Name}, + + [ValidateNotNullOrEmpty()] + [ValidateLength(1, 135)] + [string] + ${DatabaseServer}, + + [ValidateNotNullOrEmpty()] + [ValidateLength(1, 135)] + [string] + ${FailoverDatabaseServer}, + + [ValidateNotNullOrEmpty()] + [ValidateLength(1, 128)] + [string] + ${DatabaseName}, + + [Parameter(ParameterSetName='SQLAuthentication')] + [ValidateLength(1, 128)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseUsername}, + + [Parameter(ParameterSetName='SQLAuthentication')] + [ValidateNotNull()] + [securestring] + ${DatabasePassword}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${UsageService}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPUsageLogFile { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPUser { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${UserAlias}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Web}, + + [string] + ${Email}, + + [object] + ${Group}, + + [string[]] + ${PermissionLevel}, + + [string] + ${DisplayName}, + + [switch] + ${SiteCollectionAdmin}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPUserLicenseMapping { + [CmdletBinding(DefaultParameterSetName='WindowsAuth', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='WindowsAuth', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SecurityGroup}, + + [Parameter(ParameterSetName='FormsAuth', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Role}, + + [Parameter(ParameterSetName='FormsAuth', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${RoleProviderName}, + + [Parameter(ParameterSetName='ClaimsValues', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${OriginalIssuer}, + + [Parameter(ParameterSetName='ClaimsValues', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Value}, + + [Parameter(ParameterSetName='ClaimsValues', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ClaimType}, + + [Parameter(ParameterSetName='ClaimsValues')] + [ValidateNotNullOrEmpty()] + [string] + ${ValueType}, + + [Parameter(ParameterSetName='TrustIdentity', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Claim}, + + [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${License}, + + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPUserSettingsProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [string] + ${DisplayName}, + + [Parameter(Mandatory=$true)] + [string] + ${AssemblyName}, + + [Parameter(Mandatory=$true)] + [string] + ${Type}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPVisioSafeDataProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${VisioServiceApplication}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DataProviderId}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [int] + ${DataProviderType}, + + [string] + ${Description}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPVisioServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [switch] + ${AddToDefaultGroup}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${ApplicationPool}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPVisioServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWeb { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Url}, + + [uint32] + ${Language}, + + [object] + ${Template}, + + [string] + ${Name}, + + [string] + ${Description}, + + [switch] + ${AddToQuickLaunch}, + + [switch] + ${UniquePermissions}, + + [switch] + ${AddToTopNav}, + + [switch] + ${UseParentTopNav}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWebApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [string] + ${ApplicationPool}, + + [object] + ${ApplicationPoolAccount}, + + [Alias('ProxyGroup')] + [object] + ${ServiceApplicationProxyGroup}, + + [switch] + ${SecureSocketsLayer}, + + [string] + ${HostHeader}, + + [uint32] + ${Port}, + + [switch] + ${AllowAnonymousAccess}, + + [string] + ${Path}, + + [string] + ${Url}, + + [ValidateSet('Kerberos','NTLM')] + [string] + ${AuthenticationMethod}, + + [object] + ${AuthenticationProvider}, + + [object] + ${AdditionalClaimProvider}, + + [string] + ${SignInRedirectURL}, + + [object] + ${SignInRedirectProvider}, + + [object] + ${UserSettingsProvider}, + + [pscredential] + ${DatabaseCredentials}, + + [string] + ${DatabaseServer}, + + [string] + ${DatabaseName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWebApplicationAppDomain { + [CmdletBinding(DefaultParameterSetName='WebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${AppDomain}, + + [object] + ${Zone}, + + [int] + ${Port}, + + [switch] + ${SecureSocketsLayer}, + + [Parameter(Mandatory=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWebApplicationExtension { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [Parameter(Mandatory=$true)] + [object] + ${Zone}, + + [uint32] + ${Port}, + + [string] + ${HostHeader}, + + [string] + ${Path}, + + [string] + ${Url}, + + [ValidateSet('Kerberos','NTLM')] + [string] + ${AuthenticationMethod}, + + [switch] + ${AllowAnonymousAccess}, + + [switch] + ${SecureSocketsLayer}, + + [object] + ${AuthenticationProvider}, + + [object] + ${AdditionalClaimProvider}, + + [string] + ${SignInRedirectURL}, + + [object] + ${SignInRedirectProvider}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWOPIBinding { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [ValidateNotNullOrEmpty()] + [string] + ${FileName}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ServerName}, + + [ValidateNotNullOrEmpty()] + [string] + ${Action}, + + [ValidateNotNullOrEmpty()] + [string] + ${Extension}, + + [ValidateNotNullOrEmpty()] + [string] + ${ProgId}, + + [ValidateNotNullOrEmpty()] + [string] + ${Application}, + + [switch] + ${AllowHTTP}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWOPISuppressionSetting { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [ValidateNotNullOrEmpty()] + [string] + ${Extension}, + + [ValidateNotNullOrEmpty()] + [string] + ${ProgId}, + + [ValidateNotNullOrEmpty()] + [string] + ${Action}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWordConversionServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [string] + ${DatabaseName}, + + [string] + ${DatabaseServer}, + + [pscredential] + ${DatabaseCredential}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [switch] + ${PartitionMode}, + + [switch] + ${Default}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWorkflowServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [switch] + ${PartitionMode}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWorkManagementServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [switch] + ${Proxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function New-SPWorkManagementServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [switch] + ${DefaultProxyGroup}, + + [Parameter(Mandatory=$true)] + [string] + ${Name}, + + [object] + ${ServiceApplication}, + + [string] + ${Uri}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Pause-SPProjectWebInstance { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Publish-SPServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [AllowEmptyString()] + [ValidateLength(0, 250)] + [string] + ${Description}, + + [ValidateNotNullOrEmpty()] + [uri] + ${InfoLink}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Receive-SPServiceApplicationConnectionInfo { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [uri] + ${FarmUrl}, + + [ValidateNotNullOrEmpty()] + [string] + ${Filter}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Register-SPAppPrincipal { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${NameIdentifier}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DisplayName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Register-SPContentDatabase { + [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNull()] + [string] + ${Name}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNull()] + [guid] + ${DatabaseId}, + + [Parameter(Mandatory=$true, Position=2)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(Mandatory=$true, Position=3)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [string] + ${DatabaseFailoverServer}, + + [switch] + ${IsSqlAzure}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseAccessCredentials}, + + [ValidateRange(1, 2147483647)] + [int] + ${MaxSiteCount}, + + [ValidateRange(0, 2147483647)] + [int] + ${WarningSiteCount}, + + [switch] + ${SkipWebApplicationUpdate}, + + [switch] + ${ForceDeleteLock}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Register-SPWorkflowService { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [object] + ${SPSite}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${WorkflowHostUri}, + + [string] + ${ScopeName}, + + [switch] + ${PartitionMode}, + + [switch] + ${AllowOAuthHttp}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPAccessServicesDatabaseServer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${DatabaseServer}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${DatabaseServerGroup}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceContext}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPActivityFeedItems { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [bool] + ${AllItems}, + + [int] + ${ID}, + + [string] + ${SearchText}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPAlternateURL { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPAppDeniedEndpoint { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${Endpoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPAppPrincipalPermission { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${AppPrincipal}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Scope}, + + [switch] + ${DisableAppOnlyPolicy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPAzureVideoServiceAccount { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(Mandatory=$true, Position=1)] + [object] + ${ServiceContext}, + + [Parameter(Position=2)] + [System.Net.ICredentials] + ${OAuth2BearerCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPBusinessDataCatalogModel { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPClaimProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPClaimTypeMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${TrustedIdentityTokenIssuer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPConfigurationDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPContentDatabase { + [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPContentDeploymentJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPContentDeploymentPath { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPDeletedSite { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPDiagnosticsPerformanceCounter { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)] + [string] + ${Category}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${Counter}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${Instance}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${WebFrontEnd}, + + [Parameter(ValueFromPipeline=$true)] + [switch] + ${DatabaseServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPDistributedCacheServiceInstance { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchComponent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchTopology}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchContentEnrichmentConfiguration { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchCrawlContentSource { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchCrawlCustomConnector { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchCrawlDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchCrawlExtension { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchCrawlLogReadPermission { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SearchApplication}, + + [guid] + ${Tenant}, + + [string] + ${UserNames}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchCrawlMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchCrawlRule { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchFileFormat { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchLanguageResourcePhrase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [object] + ${Type}, + + [string] + ${Language}, + + [string] + ${Mapping}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [guid] + ${SourceId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchLinksDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchMetadataCategory { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchMetadataManagedProperty { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchMetadataMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchQueryAuthority { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchQueryDemoted { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchQueryKeyword { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchQueryScope { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Alias('u')] + [uri] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchQueryScopeRule { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('u')] + [uri] + ${Url}, + + [Alias('n')] + [object] + ${Scope}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchRankingModel { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchResultItemType { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchApplicationProxy}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchResultSource { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchSecurityTrimmer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${RemoveData}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchServiceApplicationSiteSettings { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [guid] + ${TenantId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchSiteHitRule { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchService}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchTenantConfiguration { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Identity')] + [guid] + ${SiteSubscriptionId}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchTenantSchema { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPEnterpriseSearchTopology { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPInfoPathUserAgent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPIPRangeAllowList { + [CmdletBinding(DefaultParameterSetName='CustomIPAllowList', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='CustomIPAllowList', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SiteName}, + + [Parameter(ParameterSetName='InternalIPAllowList', Mandatory=$true)] + [switch] + ${InternalIPAllowList}, + + [ValidateNotNullOrEmpty()] + [switch] + ${IPV4}, + + [ValidateNotNullOrEmpty()] + [switch] + ${IPV6}, + + [ValidateNotNullOrEmpty()] + [string] + ${IP}, + + [ValidateNotNullOrEmpty()] + [System.Collections.Generic.List[string]] + ${IPList}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPManagedAccount { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='ChangePassword')] + [switch] + ${ChangePassword}, + + [Parameter(ParameterSetName='ChangePassword', Mandatory=$true)] + [securestring] + ${NewPassword}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPManagedPath { + [CmdletBinding(DefaultParameterSetName='WebApplication', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='WebApplication', Mandatory=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='HostHeader', Mandatory=$true)] + [switch] + ${HostHeader}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPODataConnectionSetting { + [CmdletBinding(DefaultParameterSetName='Name', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ParameterSetName='Name', Mandatory=$true)] + [ValidateNotNull()] + [string] + ${Name}, + + [Parameter(ParameterSetName='Identity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPPerformancePointServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPPerformancePointServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPPerformancePointServiceApplicationTrustedLocation { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPPluggableSecurityTrimmer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNull()] + [guid] + ${UserProfileApplicationProxyId}, + + [Parameter(Mandatory=$true)] + [int] + ${PlugInId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPProfileLeader { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SiteSubscription}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPProfileSyncConnection { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplication}, + + [Parameter(Mandatory=$true)] + [string] + ${ConnectionForestName}, + + [Parameter(Mandatory=$true)] + [string] + ${ConnectionDomain}, + + [Parameter(Mandatory=$true)] + [string] + ${ConnectionUserName}, + + [Parameter(Mandatory=$true)] + [securestring] + ${ConnectionPassword}, + + [string] + ${ConnectionServerName}, + + [string] + ${ConnectionNamingContext}, + + [Parameter(Mandatory=$true)] + [string] + ${ConnectionSynchronizationOU}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPProjectWebInstanceData { + [CmdletBinding(DefaultParameterSetName='web', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='web', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPRoutingMachineInfo { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPRoutingMachinePool { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPRoutingRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPScaleOutDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Database}, + + [switch] + ${DeleteData}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSecureStoreApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSecureStoreSystemAccount { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPServerScaleOutDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Database}, + + [switch] + ${DeleteData}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNull()] + [switch] + ${RemoveData}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPServiceApplicationPool { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNull()] + [switch] + ${RemoveData}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPServiceApplicationProxyGroup { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPServiceApplicationProxyGroupMember { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1)] + [Alias('Proxy')] + [ValidateNotNull()] + [object] + ${Member}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPShellAdmin { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${UserName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${database}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSite { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${Identity}, + + [switch] + ${DeleteADAccounts}, + + [switch] + ${GradualDelete}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteMaster { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ContentDatabase}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)] + [guid] + ${SiteId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteSubscription { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteSubscriptionBusinessDataCatalogConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteSubscriptionFeaturePack { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteSubscriptionFeaturePackMember { + [CmdletBinding(DefaultParameterSetName='SingleFeatureDefinition', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='SingleFeatureDefinition', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${FeatureDefinition}, + + [Parameter(ParameterSetName='AllFeatureDefinitions', Mandatory=$true)] + [switch] + ${AllFeatureDefinitions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteSubscriptionMetadataConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteSubscriptionProfileConfig { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='Default', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Default', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ParameterSetName='ServiceContext', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteSubscriptionSettings { + [CmdletBinding(DefaultParameterSetName='SpecifySiteSubscriptions', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='SpecifySiteSubscriptions', Mandatory=$true)] + [ValidateNotNull()] + [guid[]] + ${SiteSubscriptions}, + + [Parameter(ParameterSetName='FindAllOrphans', Mandatory=$true)] + [ValidateSet('True')] + [switch] + ${FindAllOrphans}, + + [Parameter(ParameterSetName='FindAllOrphans')] + [ValidateNotNull()] + [guid[]] + ${AlternativeSiteSubscriptions}, + + [Parameter(ParameterSetName='FindAllOrphans')] + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteUpgradeSessionInfo { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSiteURL { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSocialItemByDate { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SiteSubscription}, + + [bool] + ${RemoveTags}, + + [bool] + ${RemoveComments}, + + [bool] + ${RemoveRatings}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [datetime] + ${EndDate}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSolution { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [uint32] + ${Language}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPSolutionDeploymentLock { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Position=0)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPStateServiceDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPThrottlingRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPTranslationServiceJobHistory { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [switch] + ${IncludeActiveJobs}, + + [System.Nullable[datetime]] + ${BeforeDate}, + + [System.Nullable[guid]] + ${JobId}, + + [System.Nullable[guid]] + ${PartitionId}, + + [switch] + ${AllPartitions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPTrustedIdentityTokenIssuer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPTrustedRootAuthority { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPTrustedSecurityTokenIssuer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPTrustedServiceTokenIssuer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPUsageApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${UsageService}, + + [switch] + ${RemoveData}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPUser { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('UserAlias')] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Web}, + + [object] + ${Group}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPUserLicenseMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNull()] + [System.Collections.Generic.List[guid]] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPUserSettingsProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPUserSolution { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPVisioSafeDataProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${VisioServiceApplication}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DataProviderId}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [int] + ${DataProviderType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPWeb { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${Recycle}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPWebApplication { + [CmdletBinding(DefaultParameterSetName='RemoveWebApp', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='RemoveZoneOfWebApp', Mandatory=$true)] + [object] + ${Zone}, + + [Parameter(ParameterSetName='RemoveWebApp')] + [switch] + ${RemoveContentDatabases}, + + [switch] + ${DeleteIISSite}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPWebApplicationAppDomain { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPWOPIBinding { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='Identity', Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Filter')] + [ValidateNotNullOrEmpty()] + [string] + ${Action}, + + [Parameter(ParameterSetName='Filter')] + [ValidateNotNullOrEmpty()] + [string] + ${Extension}, + + [Parameter(ParameterSetName='Filter')] + [ValidateNotNullOrEmpty()] + [string] + ${ProgId}, + + [Parameter(ParameterSetName='Filter')] + [ValidateNotNullOrEmpty()] + [string] + ${Application}, + + [Parameter(ParameterSetName='Filter')] + [ValidateNotNullOrEmpty()] + [string] + ${Server}, + + [Parameter(ParameterSetName='Filter')] + [ValidateNotNullOrEmpty()] + [string] + ${WOPIZone}, + + [Parameter(ParameterSetName='RemoveAll')] + [switch] + ${All}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPWOPISuppressionSetting { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='DocTypeAndAction')] + [ValidateNotNullOrEmpty()] + [string] + ${Extension}, + + [Parameter(ParameterSetName='DocTypeAndAction')] + [ValidateNotNullOrEmpty()] + [string] + ${ProgId}, + + [Parameter(ParameterSetName='DocTypeAndAction')] + [ValidateNotNullOrEmpty()] + [string] + ${Action}, + + [Parameter(ParameterSetName='Identity', ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Remove-SPWordConversionServiceJobHistory { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [switch] + ${IncludeActiveJobs}, + + [System.Nullable[datetime]] + ${BeforeDate}, + + [System.Nullable[guid]] + ${JobId}, + + [System.Nullable[guid]] + ${SubscriptionId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Rename-SPServer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Address')] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Repair-SPManagedAccountDeployment { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Repair-SPProjectWebInstance { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='FindProjectSiteByWebInstance', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${RepairRule}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Repair-SPSite { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [guid] + ${RuleId}, + + [switch] + ${RunAlways}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Request-SPUpgradeEvaluationSite { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${NoUpgrade}, + + [switch] + ${Email}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Reset-SPAccessServicesDatabasePassword { + [CmdletBinding(DefaultParameterSetName='ResetAllApps', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='ResetSingleApp', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Database}, + + [Parameter(ParameterSetName='ResetSingleApp', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='ResetAllApps', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceContext}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Reset-SPProjectEventServiceSettings { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Reset-SPProjectPCSSettings { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [Alias('sa')] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Reset-SPProjectQueueSettings { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [Alias('sa')] + [object] + ${ServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Reset-SPSites { + [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Restart-SPAppInstanceJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${AppInstance}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Restore-SPDeletedSite { + [CmdletBinding(DefaultParameterSetName='DatabaseFromPipebind', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Restore-SPEnterpriseSearchServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [string] + ${Name}, + + [Parameter(ParameterSetName='Config', Mandatory=$true)] + [string] + ${DatabaseServer}, + + [Parameter(ParameterSetName='Config', Mandatory=$true)] + [string] + ${DatabaseName}, + + [Parameter(ParameterSetName='Config')] + [string] + ${DatabaseUsername}, + + [Parameter(ParameterSetName='Config')] + [securestring] + ${DatabasePassword}, + + [Parameter(ParameterSetName='Config')] + [string] + ${FailoverDatabaseServer}, + + [Parameter(ParameterSetName='Full', Mandatory=$true)] + [string] + ${TopologyFile}, + + [Parameter(Mandatory=$true)] + [object] + ${ApplicationPool}, + + [Parameter(ParameterSetName='Config', Mandatory=$true)] + [object] + ${AdminSearchServiceInstance}, + + [Parameter(ParameterSetName='Full')] + [switch] + ${KeepId}, + + [Parameter(ParameterSetName='Full')] + [switch] + ${DeferUpgradeActions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Restore-SPEnterpriseSearchServiceApplicationIndex { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [object] + ${SearchApplication}, + + [Parameter(ParameterSetName='RestoreProgress', Mandatory=$true, Position=1)] + [string] + ${Handle}, + + [Parameter(ParameterSetName='Restore', Mandatory=$true, Position=1)] + [string] + ${BackupFolder}, + + [Parameter(ParameterSetName='Restore', Position=2)] + [switch] + ${AllReplicas}, + + [Parameter(ParameterSetName='Restore', Position=3)] + [switch] + ${AllowMove}, + + [Parameter(Position=4)] + [int] + ${Retries}, + + [Parameter(Position=5)] + [int] + ${RetryPauseSeconds}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Restore-SPFarm { + [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [string] + ${Directory}, + + [Parameter(ParameterSetName='DefaultSet', Mandatory=$true)] + [ValidateSet('New','Overwrite')] + [string] + ${RestoreMethod}, + + [Parameter(ParameterSetName='DefaultSet')] + [int] + ${RestoreThreads}, + + [Parameter(ParameterSetName='DefaultSet')] + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [guid] + ${BackupId}, + + [Parameter(ParameterSetName='DefaultSet')] + [string] + ${NewDatabaseServer}, + + [Parameter(ParameterSetName='DefaultSet', ValueFromPipeline=$true)] + [pscredential] + ${FarmCredentials}, + + [string] + ${Item}, + + [Parameter(ParameterSetName='ShowTree', Mandatory=$true)] + [switch] + ${ShowTree}, + + [switch] + ${ConfigurationOnly}, + + [Parameter(ParameterSetName='DefaultSet')] + [int] + ${Percentage}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Restore-SPSite { + [CmdletBinding(DefaultParameterSetName='DatabaseFromPipebind', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [string] + ${Path}, + + [string] + ${HostHeaderWebApplication}, + + [switch] + ${Force}, + + [switch] + ${GradualDelete}, + + [Parameter(ParameterSetName='DatabaseFromPipebind', ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(ParameterSetName='DatabaseParameter')] + [string] + ${DatabaseName}, + + [Parameter(ParameterSetName='DatabaseParameter')] + [string] + ${DatabaseServer}, + + [switch] + ${PreserveSiteID}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Resume-SPEnterpriseSearchServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Resume-SPProjectWebInstance { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Resume-SPStateServiceDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Resume-SPVideoStreamingAccess { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Revoke-SPBusinessDataCatalogMetadataObject { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Principal}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${Right}, + + [string] + ${SettingId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Revoke-SPObjectSecurity { + [CmdletBinding(DefaultParameterSetName='RevokeOne')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='RevokeOne', Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${Principal}, + + [Parameter(ParameterSetName='RevokeOne', Position=2)] + [ValidateNotNull()] + [string[]] + ${Rights}, + + [Parameter(ParameterSetName='RevokeAll', Mandatory=$true)] + [switch] + ${All}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAccessServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [ValidateRange(1, 255)] + [int] + ${ColumnsMax}, + + [ValidateRange(1, 200000)] + [int] + ${RowsMax}, + + [ValidateRange(1, 20)] + [int] + ${SourcesMax}, + + [ValidateRange(0, 32)] + [int] + ${OutputCalculatedColumnsMax}, + + [ValidateRange(0, 8)] + [int] + ${OrderByMax}, + + [switch] + ${OuterJoinsAllowed}, + + [switch] + ${NonRemotableQueriesAllowed}, + + [ValidateRange(-1, 2147483647)] + [int] + ${RecordsInTableMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${ApplicationLogSizeMax}, + + [ValidateRange(-1, 2073600)] + [int] + ${RequestDurationMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${SessionsPerUserMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${SessionsPerAnonymousUserMax}, + + [ValidateRange(-1, 2073600)] + [int] + ${CacheTimeout}, + + [ValidateRange(0, 4096)] + [int] + ${SessionMemoryMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${PrivateBytesMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${TemplateSizeMax}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAccessServicesApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [ValidateRange(-1, 2073600)] + [int] + ${RequestDurationMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${SessionsPerUserMax}, + + [ValidateRange(-1, 2147483647)] + [int] + ${SessionsPerAnonymousUserMax}, + + [ValidateRange(-1, 2073600)] + [int] + ${CacheTimeout}, + + [ValidateRange(-1, 2147483647)] + [int] + ${PrivateBytesMax}, + + [ValidateRange(-1, 1440)] + [int] + ${RecoveryPointObjective}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAccessServicesDatabaseServer { + [CmdletBinding(DefaultParameterSetName='SetCredentialsParameterSet', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='SetServerStateParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='SetUserDomainParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='SetCredentialsParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='SetAvailableForCreateParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='SetEncryptParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='SetSecondaryDatabaseServerNameParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='SetFailoverParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceContext}, + + [Parameter(ParameterSetName='SetAvailableForCreateParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetServerStateParameterSet', Mandatory=$true)] + [Parameter(Mandatory=$true)] + [Parameter(ParameterSetName='SetCredentialsParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetEncryptParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetSecondaryDatabaseServerNameParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetFailoverParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetUserDomainParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${DatabaseServerGroup}, + + [Parameter(ParameterSetName='SetEncryptParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetSecondaryDatabaseServerNameParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetFailoverParameterSet', Mandatory=$true)] + [Parameter(Mandatory=$true)] + [Parameter(ParameterSetName='SetCredentialsParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetAvailableForCreateParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetServerStateParameterSet', Mandatory=$true)] + [Parameter(ParameterSetName='SetUserDomainParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${DatabaseServer}, + + [Parameter(ParameterSetName='SetCredentialsParameterSet')] + [string] + ${DatabaseServerName}, + + [Parameter(ParameterSetName='SetCredentialsParameterSet')] + [pscredential] + ${DatabaseServerCredentials}, + + [Parameter(ParameterSetName='SetAvailableForCreateParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [bool] + ${AvailableForCreate}, + + [Parameter(ParameterSetName='SetAvailableForCreateParameterSet')] + [ValidateNotNullOrEmpty()] + [bool] + ${Exclusive}, + + [Parameter(ParameterSetName='SetEncryptParameterSet', Mandatory=$true)] + [bool] + ${Encrypt}, + + [Parameter(ParameterSetName='SetEncryptParameterSet', Mandatory=$true)] + [bool] + ${TrustServerCertificate}, + + [Parameter(ParameterSetName='SetSecondaryDatabaseServerNameParameterSet')] + [string] + ${SecondaryDatabaseServerName}, + + [Parameter(ParameterSetName='SetFailoverParameterSet', Mandatory=$true)] + [bool] + ${Failover}, + + [Parameter(ParameterSetName='SetUserDomainParameterSet', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${UserDomain}, + + [Parameter(ParameterSetName='SetServerStateParameterSet', Mandatory=$true)] + [object] + ${State}, + + [Parameter(ParameterSetName='SetServerStateParameterSet', Mandatory=$true)] + [object] + ${StateOwner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAccessServicesDatabaseServerGroupMapping { + [CmdletBinding(DefaultParameterSetName='SetDatabaseServerGroupMappingParameter', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='SetDatabaseServerGroupMappingParameter', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='ClearDatabaseServerGroupMappingParameterSetName', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceContext}, + + [Parameter(ParameterSetName='SetDatabaseServerGroupMappingParameter', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${DatabaseServerGroup}, + + [Parameter(ParameterSetName='SetDatabaseServerGroupMappingParameter')] + [Parameter(ParameterSetName='ClearDatabaseServerGroupMappingParameterSetName')] + [switch] + ${CorporateCatalog}, + + [Parameter(ParameterSetName='SetDatabaseServerGroupMappingParameter')] + [Parameter(ParameterSetName='ClearDatabaseServerGroupMappingParameterSetName')] + [switch] + ${ObjectModel}, + + [Parameter(ParameterSetName='SetDatabaseServerGroupMappingParameter')] + [Parameter(ParameterSetName='ClearDatabaseServerGroupMappingParameterSetName')] + [switch] + ${RemoteObjectModel}, + + [Parameter(ParameterSetName='SetDatabaseServerGroupMappingParameter')] + [Parameter(ParameterSetName='ClearDatabaseServerGroupMappingParameterSetName')] + [switch] + ${DeveloperSite}, + + [Parameter(ParameterSetName='ClearDatabaseServerGroupMappingParameterSetName')] + [Parameter(ParameterSetName='SetDatabaseServerGroupMappingParameter')] + [switch] + ${StoreFront}, + + [Parameter(ParameterSetName='ClearDatabaseServerGroupMappingParameterSetName', Mandatory=$true)] + [switch] + ${ClearMapping}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAlternateURL { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Url}, + + [object] + ${Zone}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppAcquisitionConfiguration { + [CmdletBinding(DefaultParameterSetName='MarketplaceSettingsInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [bool] + ${Enable}, + + [Parameter(ParameterSetName='MarketplaceSettingsInWebApplication', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='MarketplaceSettingsInSiteSubscription', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppAutoProvisionConnection { + [CmdletBinding()] +param( + [object] + ${SiteSubscription}, + + [Parameter(ParameterSetName='WebHostSetup', Mandatory=$true)] + [Parameter(ParameterSetName='WebHostEndPoint', Mandatory=$true)] + [Parameter(ParameterSetName='WebHostCredential', Mandatory=$true)] + [object] + ${ConnectionType}, + + [Parameter(ParameterSetName='WebHostCredential', Mandatory=$true)] + [Parameter(ParameterSetName='WebHostSetup', Mandatory=$true)] + [string] + ${Username}, + + [Parameter(ParameterSetName='WebHostCredential', Mandatory=$true)] + [Parameter(ParameterSetName='WebHostSetup', Mandatory=$true)] + [string] + ${Password}, + + [Parameter(ParameterSetName='WebHostEndPoint', Mandatory=$true)] + [Parameter(ParameterSetName='WebHostSetup', Mandatory=$true)] + [string] + ${EndPoint}, + + [Parameter(ParameterSetName='Remove', Mandatory=$true)] + [switch] + ${Remove}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppDisablingConfiguration { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [bool] + ${Enable}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppDomain { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0)] + [AllowEmptyString()] + [AllowNull()] + [string] + ${AppDomain}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppHostingQuotaConfiguration { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SiteSubscription}, + + [Parameter(Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [double] + ${AppHostingLicenseQuota}, + + [Parameter(Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [double] + ${AppInstanceCountQuota}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppManagementDeploymentId { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [guid] + ${DeploymentId}, + + [Parameter(ValueFromPipeline=$true)] + [Alias('Subscription')] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${AppManagementServiceApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppPrincipalPermission { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${AppPrincipal}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Scope}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Right}, + + [switch] + ${EnableAppOnlyPolicy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppScaleProfile { + [CmdletBinding()] +param( + [ValidateNotNullOrEmpty()] + [string] + ${MaxDatabaseSize}, + + [ValidateRange(1, 255)] + [int] + ${RemoteWebSiteInstanceCount}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppSiteDomain { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppSiteSubscriptionName { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [object] + ${SiteSubscription}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppStateUpdateInterval { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateRange(0, 32768)] + [int] + ${AppStateSyncHours}, + + [Parameter(Mandatory=$true)] + [ValidateRange(0, 32768)] + [int] + ${FastAppRevocationHours}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppStoreConfiguration { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [string] + ${Url}, + + [Parameter(Mandatory=$true)] + [bool] + ${Enable}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAppStoreWebServiceConfiguration { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${Client}, + + [version] + ${ProxyVersion}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPAuthenticationRealm { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [string] + ${Realm}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPBingMapsBlock { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0, HelpMessage='Block Bing Maps in all locales.')] + [switch] + ${BlockBingMapsInAllLocales}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPBingMapsKey { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, HelpMessage='Enter the Bing Maps API key.')] + [string] + ${BingKey}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPBrowserCustomerExperienceImprovementProgram { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [Parameter(ParameterSetName='Farm', Mandatory=$true)] + [switch] + ${Farm}, + + [Parameter(ParameterSetName='WebApplication', Mandatory=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='SiteSubscription', Mandatory=$true)] + [object] + ${SiteSubscription}, + + [switch] + ${Enable}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPBusinessDataCatalogEntityNotificationWeb { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Web}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPBusinessDataCatalogMetadataObject { + [CmdletBinding(DefaultParameterSetName='NameValue', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Display')] + [string] + ${DisplayName}, + + [Parameter(ParameterSetName='NameRemove')] + [Parameter(ParameterSetName='NameValue')] + [ValidateNotNull()] + [string] + ${PropertyName}, + + [Parameter(ParameterSetName='NameValue')] + [psobject] + ${PropertyValue}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='NameRemove')] + [switch] + ${Remove}, + + [string] + ${SettingId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPBusinessDataCatalogServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${Sharing}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${DatabaseName}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${FailoverDatabaseServer}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [object] + ${ApplicationPool}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${DatabaseUsername}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [securestring] + ${DatabasePassword}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPBusinessDataCatalogThrottleConfig { + [CmdletBinding(DefaultParameterSetName='MaxDefault', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='MaxDefault', Mandatory=$true)] + [int] + ${Maximum}, + + [Parameter(ParameterSetName='MaxDefault', Mandatory=$true)] + [int] + ${Default}, + + [Parameter(ParameterSetName='Enforcement', Mandatory=$true)] + [switch] + ${Enforced}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPCentralAdministration { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [int] + ${Port}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPClaimProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [switch] + ${Enabled}, + + [switch] + ${Default}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPContentDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateRange(1, 2147483647)] + [int] + ${MaxSiteCount}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${WarningSiteCount}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${Status}, + + [Parameter(ValueFromPipeline=$true)] + [string] + ${DatabaseFailoverServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPContentDeploymentJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${Description}, + + [object] + ${Scope}, + + [string] + ${Schedule}, + + [switch] + ${ScheduleEnabled}, + + [switch] + ${IncrementalEnabled}, + + [object] + ${SqlSnapshotSetting}, + + [switch] + ${HostingSupportEnabled}, + + [object] + ${EmailNotifications}, + + [string[]] + ${EmailAddresses}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPContentDeploymentPath { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${Name}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${Description}, + + [uri] + ${DestinationCentralAdministrationURL}, + + [object] + ${Authentication}, + + [pscredential] + ${PathAccount}, + + [switch] + ${DeployUserNamesEnabled}, + + [object] + ${DeploySecurityInformation}, + + [switch] + ${EventReceiversEnabled}, + + [switch] + ${CompressionEnabled}, + + [switch] + ${PathEnabled}, + + [object] + ${KeepTemporaryFilesOptions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPCustomLayoutsPage { + [CmdletBinding(DefaultParameterSetName='CustomPage', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='CustomPage', Mandatory=$true)] + [string] + ${RelativePath}, + + [Parameter(ParameterSetName='CustomPage')] + [Parameter(ParameterSetName='ResetCustomPage')] + [ValidateRange(14, 15)] + [int] + ${CompatibilityLevel}, + + [Parameter(ParameterSetName='ResetCustomPage', Mandatory=$true)] + [switch] + ${Reset}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPDataConnectionFile { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [ValidateLength(0, 255)] + [string] + ${DisplayName}, + + [ValidateLength(0, 255)] + [string] + ${Description}, + + [ValidateLength(0, 255)] + [string] + ${Category}, + + [ValidateSet('true','false')] + [string] + ${WebAccessible}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPDefaultProfileConfig { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(Mandatory=$true)] + [bool] + ${MySitesPublicEnabled}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPDesignerSettings { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='WebApplication', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${WebApplication}, + + [bool] + ${AllowDesigner}, + + [bool] + ${AllowRevertFromTemplate}, + + [bool] + ${AllowMasterPageEditing}, + + [bool] + ${ShowURLStructure}, + + [string] + ${RequiredDesignerVersion}, + + [string] + ${DesignerDownloadUrl}, + + [bool] + ${AllowCreateDeclarativeWorkflow}, + + [bool] + ${AllowSavePublishDeclarativeWorkflow}, + + [bool] + ${AllowSaveDeclarativeWorkflowAsTemplate}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPDiagnosticConfig { + [CmdletBinding()] +param( + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${AllowLegacyTraceProviders}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${AppAnalyticsAutomaticUploadEnabled}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${CustomerExperienceImprovementProgramEnabled}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${ErrorReportingEnabled}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${ErrorReportingAutomaticUploadEnabled}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${DownloadErrorReportingUpdatesEnabled}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateRange(1, 366)] + [int] + ${DaysToKeepLogs}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${LogMaxDiskSpaceUsageEnabled}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateRange(1, 1000)] + [int] + ${LogDiskSpaceUsageGB}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${LogLocation}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateRange(1, 1440)] + [int] + ${LogCutInterval}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${EventLogFloodProtectionEnabled}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateRange(1, 100)] + [int] + ${EventLogFloodProtectionThreshold}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateRange(1, 1440)] + [int] + ${EventLogFloodProtectionTriggerPeriod}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateRange(1, 1440)] + [int] + ${EventLogFloodProtectionQuietPeriod}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateRange(1, 1440)] + [int] + ${EventLogFloodProtectionNotifyInterval}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${ScriptErrorReportingEnabled}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${ScriptErrorReportingRequireAuth}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [ValidateRange(1, 1440)] + [int] + ${ScriptErrorReportingDelay}, + + [Parameter(ValueFromPipeline=$true)] + [psobject] + ${InputObject}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPDiagnosticsProvider { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${Enable}, + + [ValidateRange(1, 31)] + [int] + ${DaysRetained}, + + [ValidateRange(1, 9223372036854775807)] + [long] + ${MaxTotalSizeInBytes}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPDistributedCacheClientSetting { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ContainerType}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${DistributedCacheClientSettings}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchAdministrationComponent { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [string] + ${StoragePath}, + + [object] + ${SearchServiceInstance}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchContentEnrichmentConfiguration { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${ContentEnrichmentConfiguration}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchCrawlContentSource { + [CmdletBinding(DefaultParameterSetName='NoSchedule', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Alias('n')] + [string] + ${Name}, + + [Alias('t')] + [string] + ${Tag}, + + [Alias('s')] + [string] + ${StartAddresses}, + + [Alias('p')] + [object] + ${CrawlPriority}, + + [Parameter(ParameterSetName='Weekly')] + [Parameter(ParameterSetName='RemoveSchedule')] + [Parameter(ParameterSetName='MonthlyDate')] + [Parameter(ParameterSetName='Daily', Mandatory=$true)] + [System.Nullable`1[[object]]] + ${ScheduleType}, + + [Parameter(ParameterSetName='Daily')] + [Alias('daily')] + [switch] + ${DailyCrawlSchedule}, + + [Parameter(ParameterSetName='Weekly')] + [Alias('weekly')] + [switch] + ${WeeklyCrawlSchedule}, + + [Parameter(ParameterSetName='MonthlyDate')] + [Alias('monthly')] + [switch] + ${MonthlyCrawlSchedule}, + + [Parameter(ParameterSetName='RemoveSchedule')] + [switch] + ${RemoveCrawlSchedule}, + + [Parameter(ParameterSetName='Daily')] + [Parameter(ParameterSetName='Weekly')] + [Parameter(ParameterSetName='MonthlyDate')] + [Alias('start')] + [System.Nullable[datetime]] + ${CrawlScheduleStartDateTime}, + + [Parameter(ParameterSetName='MonthlyDate')] + [Parameter(ParameterSetName='Weekly')] + [Parameter(ParameterSetName='Daily')] + [Alias('duration')] + [System.Nullable[int]] + ${CrawlScheduleRepeatDuration}, + + [Parameter(ParameterSetName='MonthlyDate')] + [Parameter(ParameterSetName='Daily')] + [Parameter(ParameterSetName='Weekly')] + [Alias('interval')] + [System.Nullable[int]] + ${CrawlScheduleRepeatInterval}, + + [Parameter(ParameterSetName='Daily')] + [Parameter(ParameterSetName='Weekly')] + [Alias('every')] + [System.Nullable[int]] + ${CrawlScheduleRunEveryInterval}, + + [Parameter(ParameterSetName='Weekly')] + [object] + ${CrawlScheduleDaysOfWeek}, + + [Parameter(ParameterSetName='MonthlyDate')] + [System.Nullable[int]] + ${CrawlScheduleDaysOfMonth}, + + [Parameter(ParameterSetName='MonthlyDate')] + [Alias('month')] + [object] + ${CrawlScheduleMonthsOfYear}, + + [System.Nullable[int]] + ${MaxPageEnumerationDepth}, + + [System.Nullable[int]] + ${MaxSiteEnumerationDepth}, + + [object] + ${BDCApplicationProxyGroup}, + + [string[]] + ${LOBSystemSet}, + + [string] + ${CustomProtocol}, + + [System.Nullable[bool]] + ${EnableContinuousCrawls}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchCrawlDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [string] + ${DatabaseServer}, + + [string] + ${DatabaseName}, + + [string] + ${DatabaseUsername}, + + [securestring] + ${DatabasePassword}, + + [string] + ${FailoverDatabaseServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchCrawlLogReadPermission { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [guid] + ${Tenant}, + + [string] + ${UserNames}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchCrawlRule { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Alias('t')] + [object] + ${Type}, + + [System.Nullable[bool]] + ${IsAdvancedRegularExpression}, + + [System.Nullable[bool]] + ${CrawlAsHttp}, + + [System.Nullable[bool]] + ${FollowComplexUrls}, + + [System.Nullable[int]] + ${PluggableSecurityTimmerId}, + + [System.Nullable[bool]] + ${SuppressIndexing}, + + [System.Nullable[int]] + ${Priority}, + + [string] + ${ContentClass}, + + [object] + ${AuthenticationType}, + + [string] + ${AccountName}, + + [securestring] + ${AccountPassword}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchFileFormatState { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1)] + [bool] + ${Enable}, + + [Parameter(Position=2)] + [System.Nullable[bool]] + ${UseIFilter}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchLinguisticComponentsStatus { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [System.Nullable[bool]] + ${ThesaurusEnabled}, + + [System.Nullable[bool]] + ${StemmingEnabled}, + + [System.Nullable[bool]] + ${QuerySpellingEnabled}, + + [System.Nullable[bool]] + ${EntityExtractionEnabled}, + + [System.Nullable[bool]] + ${AllEnabled}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchLinksDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [string] + ${DatabaseServer}, + + [string] + ${DatabaseName}, + + [string] + ${DatabaseUsername}, + + [securestring] + ${DatabasePassword}, + + [string] + ${FailoverDatabaseServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchMetadataCategory { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Alias('n')] + [string] + ${Name}, + + [Alias('d')] + [System.Nullable[bool]] + ${DiscoverNewProperties}, + + [Alias('m')] + [System.Nullable[bool]] + ${MapToContents}, + + [Alias('auto')] + [System.Nullable[bool]] + ${AutoCreateNewManagedProperties}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchMetadataCrawledProperty { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [Alias('im')] + [System.Nullable[bool]] + ${IsMappedToContents}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchMetadataManagedProperty { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Alias('n')] + [string] + ${Name}, + + [Alias('d')] + [string] + ${Description}, + + [Alias('f')] + [System.Nullable[bool]] + ${FullTextQueriable}, + + [Alias('r')] + [System.Nullable[bool]] + ${Retrievable}, + + [Alias('e')] + [System.Nullable[bool]] + ${EnabledForScoping}, + + [Alias('nn')] + [System.Nullable[bool]] + ${NameNormalized}, + + [Alias('rp')] + [System.Nullable[bool]] + ${RespectPriority}, + + [Alias('rd')] + [System.Nullable[bool]] + ${RemoveDuplicates}, + + [Alias('im5')] + [Obsolete('This property is replaced by IncludeInAlertSignature.')] + [System.Nullable[bool]] + ${IncludeInMd5}, + + [Alias('ia')] + [System.Nullable[bool]] + ${IncludeInAlertSignature}, + + [Alias('sfa')] + [System.Nullable[bool]] + ${SafeForAnonymous}, + + [Alias('nw')] + [System.Nullable[bool]] + ${NoWordBreaker}, + + [Alias('u')] + [System.Nullable[int16]] + ${UserFlags}, + + [Alias('qir')] + [System.Nullable[bool]] + ${EnabledForQueryIndependentRank}, + + [Alias('def')] + [System.Nullable[uint32]] + ${DefaultForQueryIndependentRank}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchMetadataMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [object] + ${ManagedProperty}, + + [object] + ${CrawledProperty}, + + [guid] + ${Tenant}, + + [guid] + ${SiteCollection}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchPrimaryHostController { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${SearchServiceInstance}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchQueryAuthority { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Alias('l')] + [System.Nullable[float]] + ${Level}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchQueryKeyword { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${Site}, + + [Alias('t')] + [string] + ${Term}, + + [Alias('d')] + [string] + ${Definition}, + + [Alias('c')] + [string] + ${Contact}, + + [Alias('s')] + [System.Nullable[datetime]] + ${StartDate}, + + [Alias('e')] + [System.Nullable[datetime]] + ${EndDate}, + + [Alias('r')] + [System.Nullable[datetime]] + ${ReviewDate}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchQueryScope { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [uri] + ${Url}, + + [Parameter(Mandatory=$true)] + [Alias('u')] + [string] + ${AlternateResultsPage}, + + [Alias('n')] + [string] + ${Name}, + + [Alias('d')] + [string] + ${Description}, + + [Alias('disp')] + [System.Nullable[bool]] + ${DisplayInAdminUI}, + + [Alias('type')] + [System.Nullable[int]] + ${CompilationType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchQueryScopeRule { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('u')] + [uri] + ${Url}, + + [Alias('n')] + [object] + ${Scope}, + + [Alias('f')] + [string] + ${FilterBehavior}, + + [Alias('ut')] + [string] + ${UrlScopeRuleType}, + + [Alias('text')] + [string] + ${MatchingString}, + + [Alias('value')] + [string] + ${PropertyValue}, + + [Alias('mname')] + [string] + ${ManagedPropertyName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchQuerySpellingCorrection { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [object] + ${SearchApplication}, + + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [System.Nullable[bool]] + ${ContentAlignmentEnabled}, + + [System.Nullable[int]] + ${MaxDictionarySize}, + + [System.Nullable[bool]] + ${DiacriticsInSuggestionsEnabled}, + + [System.Nullable[int]] + ${TermFrequencyThreshold}, + + [System.Nullable[bool]] + ${SecurityTrimmingEnabled}, + + [object] + ${SpellingDictionary}, + + [System.Nullable[timespan]] + ${MaxProcessingTime}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchRankingModel { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Parameter(Mandatory=$true)] + [string] + ${RankingModelXML}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchResultItemType { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchApplicationProxy}, + + [Alias('n')] + [string] + ${Name}, + + [Alias('rule')] + [object] + ${Rules}, + + [Alias('priority')] + [System.Nullable[int]] + ${RulePriority}, + + [Alias('dp')] + [string] + ${DisplayProperties}, + + [Alias('sid')] + [System.Nullable[guid]] + ${SourceID}, + + [Alias('url')] + [string] + ${DisplayTemplateUrl}, + + [Parameter(Mandatory=$true)] + [Alias('o')] + [object] + ${Owner}, + + [Alias('opt')] + [System.Nullable[bool]] + ${OptimizeForFrequentUse}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchResultSource { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SearchApplication}, + + [Alias('o')] + [object] + ${Owner}, + + [string] + ${Name}, + + [string] + ${Description}, + + [string] + ${QueryTemplate}, + + [guid] + ${ProviderId}, + + [string] + ${RemoteUrl}, + + [System.Nullable[bool]] + ${AutoDiscover}, + + [object] + ${AuthenticationType}, + + [string] + ${UserName}, + + [string] + ${Password}, + + [string] + ${SsoId}, + + [System.Nullable[bool]] + ${MakeDefault}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchService { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${ServiceAccount}, + + [securestring] + ${ServicePassword}, + + [string] + ${ContactEmail}, + + [string] + ${ConnectionTimeout}, + + [string] + ${AcknowledgementTimeout}, + + [string] + ${ProxyType}, + + [string] + ${IgnoreSSLWarnings}, + + [string] + ${InternetIdentity}, + + [string] + ${PerformanceLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${FailoverDatabaseServer}, + + [string] + ${DiacriticSensitive}, + + [object] + ${DefaultSearchProvider}, + + [string] + ${VerboseQueryMonitoring}, + + [object] + ${ApplicationPool}, + + [object] + ${AdminApplicationPool}, + + [string] + ${DefaultContentAccessAccountName}, + + [securestring] + ${DefaultContentAccessAccountPassword}, + + [string] + ${DatabaseServer}, + + [string] + ${DatabaseName}, + + [string] + ${DatabaseUsername}, + + [securestring] + ${DatabasePassword}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchServiceInstance { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${DefaultIndexLocation}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPEnterpriseSearchTopology { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${SearchApplication}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPFarmConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipelineByPropertyName=$true)] + [int] + ${WorkflowBatchSize}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [int] + ${WorkflowPostponeThreshold}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [int] + ${WorkflowEventDeliveryTimeout}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${InstalledProductsRefresh}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [bool] + ${DataFormWebPartAutoRefreshEnabled}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [bool] + ${ASPScriptOptimizationEnabled}, + + [switch] + ${ServiceConnectionPointDelete}, + + [string] + ${ServiceConnectionPointBindingInformation}, + + [object] + ${SiteMasterMode}, + + [System.Nullable[uint32]] + ${SiteMasterValidationIntervalInHours}, + + [System.Nullable[bool]] + ${DefaultActivateOnSiteMasterValue}, + + [switch] + ${Force}, + + [System.Nullable[switch]] + ${UserAccountDirectoryPathIsImmutable}, + + [System.Nullable[uint32]] + ${MaxTenantStoreValueLength}, + + [System.Nullable[uint32]] + ${MaxSiteSubscriptionSettingsValueLength}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPInfoPathFormsService { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [object] + ${Identity}, + + [ValidateSet('true','false')] + [string] + ${AllowUserFormBrowserEnabling}, + + [ValidateSet('true','false')] + [string] + ${AllowUserFormBrowserRendering}, + + [ValidateRange(0, 2147483647)] + [System.Nullable[int]] + ${DefaultDataConnectionTimeout}, + + [ValidateRange(0, 2147483647)] + [System.Nullable[int]] + ${MemoryCacheSize}, + + [ValidateRange(0, 2147483647)] + [System.Nullable[int]] + ${MaxDataConnectionTimeout}, + + [ValidateRange(0, 2147483647)] + [System.Nullable[int]] + ${MaxDataConnectionResponseSize}, + + [ValidateSet('true','false')] + [string] + ${RequireSslForDataConnections}, + + [ValidateSet('true','false')] + [string] + ${AllowEmbeddedSqlForDataConnections}, + + [ValidateSet('true','false')] + [string] + ${AllowUdcAuthenticationForDataConnections}, + + [ValidateSet('true','false')] + [string] + ${AllowUserFormCrossDomainDataConnections}, + + [ValidateRange(0, 999999)] + [System.Nullable[int]] + ${MaxPostbacksPerSession}, + + [ValidateRange(0, 999999)] + [System.Nullable[int]] + ${MaxUserActionsPerPostback}, + + [ValidateRange(0, 999999)] + [System.Nullable[int]] + ${ActiveSessionTimeout}, + + [ValidateRange(0, 99999999)] + [System.Nullable[int]] + ${MaxSizeOfUserFormState}, + + [ValidateSet('true','false')] + [string] + ${AllowViewState}, + + [ValidateRange(0, 99999999)] + [System.Nullable[int]] + ${ViewStateThreshold}, + + [ValidateRange(0, 99999999)] + [System.Nullable[int]] + ${MaxFormLoadTime}, + + [ValidateRange(0, 99999999)] + [System.Nullable[int]] + ${MaxDataConnectionRoundTrip}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPInfoPathFormTemplate { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [ValidateLength(0, 255)] + [string] + ${Category}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPInfoPathWebServiceProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [ValidateSet('true','false')] + [string] + ${AllowWebServiceProxy}, + + [ValidateSet('true','false')] + [string] + ${AllowForUserForms}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPInsightsAuthSettings { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [string] + ${LogFEEndpoint}, + + [Parameter(Mandatory=$true)] + [string] + ${Tenant}, + + [Parameter(Mandatory=$true)] + [string] + ${LogClientAppId}, + + [Parameter(Mandatory=$true)] + [string] + ${LogClientCertificateSubject}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPInternalAppStateUpdateInterval { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [ValidateRange(0, 32768)] + [int] + ${AppStateSyncHours}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPIPAccessControlOperationMode { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${OperationMode}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPIPAccessControlSubscriptionId { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SiteSubscriptionId}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [switch] + ${Enabled}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPIPRangeAllowList { + [CmdletBinding(DefaultParameterSetName='CustomIPAllowList', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='CustomIPAllowList', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SiteName}, + + [Parameter(ParameterSetName='InternalIPAllowList', Mandatory=$true)] + [switch] + ${InternalIPAllowList}, + + [ValidateNotNullOrEmpty()] + [switch] + ${IPV4}, + + [ValidateNotNullOrEmpty()] + [switch] + ${IPV6}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [System.Collections.Generic.List[string]] + ${IPList}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPIPRangeAllowListSetting { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SiteName}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${IPAddressAllowanceLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPIRMSettings { + [CmdletBinding(DefaultParameterSetName='UseServiceDiscovery', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [switch] + ${IrmEnabled}, + + [switch] + ${SubscriptionScopeSettingsEnabled}, + + [Parameter(ParameterSetName='UseServiceDiscovery')] + [switch] + ${UseActiveDirectoryDiscovery}, + + [Parameter(ParameterSetName='UseSpecifiedCertificateUrl', Mandatory=$true)] + [uri] + ${CertificateServerUrl}, + + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${ServiceAuthenticationCertificate}, + + [ValidateNotNull()] + [securestring] + ${CertificatePassword}, + + [switch] + ${UseOauth}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPLogLevel { + [CmdletBinding()] +param( + [string] + ${TraceSeverity}, + + [string] + ${EventSeverity}, + + [string[]] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [psobject] + ${InputObject}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPManagedAccount { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Schedule}, + + [int] + ${PreExpireDays}, + + [int] + ${EmailNotification}, + + [Parameter(ParameterSetName='AutoGeneratePassword')] + [switch] + ${AutoGeneratePassword}, + + [Parameter(ParameterSetName='NewPasswordAsParameter', Mandatory=$true)] + [securestring] + ${Password}, + + [Parameter(ParameterSetName='NewPassword')] + [switch] + ${SetNewPassword}, + + [Parameter(ParameterSetName='NewPassword', Mandatory=$true)] + [securestring] + ${NewPassword}, + + [Parameter(ParameterSetName='NewPassword', Mandatory=$true)] + [securestring] + ${ConfirmPassword}, + + [Parameter(ParameterSetName='ExistingPassword')] + [switch] + ${UseExistingPassword}, + + [Parameter(ParameterSetName='ExistingPassword', Mandatory=$true)] + [securestring] + ${ExistingPassword}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPMetadataServiceApplication { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [string] + ${AdministratorAccount}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [string] + ${DatabaseName}, + + [string] + ${DatabaseServer}, + + [pscredential] + ${DatabaseCredentials}, + + [string] + ${FailoverDatabaseServer}, + + [string] + ${FullAccessAccount}, + + [string] + ${HubUri}, + + [int] + ${CacheTimeCheckInterval}, + + [int] + ${MaxChannelCache}, + + [switch] + ${DoNotUnpublishAllPackages}, + + [Parameter(ParameterSetName='NoQuota', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='Quota', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='Default', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Name}, + + [string] + ${ReadAccessAccount}, + + [string] + ${RestrictedAccount}, + + [switch] + ${SyndicationErrorReportEnabled}, + + [Parameter(ParameterSetName='NoQuota', Mandatory=$true)] + [switch] + ${DisablePartitionQuota}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${GroupsPerPartition}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${TermSetsPerPartition}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${TermsPerPartition}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${LabelsPerPartition}, + + [Parameter(ParameterSetName='Quota', Mandatory=$true)] + [ValidateRange(0, 2147483647)] + [int] + ${PropertiesPerPartition}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPMetadataServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [switch] + ${ContentTypeSyndicationEnabled}, + + [switch] + ${ContentTypePushdownEnabled}, + + [switch] + ${DefaultKeywordTaxonomy}, + + [switch] + ${DefaultProxyGroup}, + + [switch] + ${DefaultSiteCollectionTaxonomy}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPMicrofeedOptions { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SiteSubscription}, + + [ValidateNotNull()] + [int] + ${MaxPostLength}, + + [ValidateNotNull()] + [int] + ${MaxMentions}, + + [ValidateNotNull()] + [int] + ${MaxTags}, + + [ValidateNotNull()] + [System.Nullable[bool]] + ${AsyncRefs}, + + [ValidateNotNull()] + [int] + ${MaxCacheMs}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPMobileMessagingAccount { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [Alias('ServiceType','AccountType')] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [string] + ${ServiceName}, + + [string] + ${ServiceUrl}, + + [string] + ${UserId}, + + [string] + ${Password}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPO365LinkSettings { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] + [AllowEmptyString()] + [string] + ${MySiteHostUrl}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string[]] + ${Audiences}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [bool] + ${RedirectSites}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPODataConnectionSetting { + [CmdletBinding(DefaultParameterSetName='Name', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ParameterSetName='Name', Mandatory=$true)] + [ValidateNotNull()] + [ValidateLength(0, 246)] + [string] + ${Name}, + + [ValidateNotNull()] + [uri] + ${ServiceAddressURL}, + + [ValidateNotNull()] + [object] + ${AuthenticationMode}, + + [ValidateNotNull()] + [ValidateLength(0, 1024)] + [string] + ${SecureStoreTargetApplicationId}, + + [string] + ${ExtensionProvider}, + + [Parameter(ParameterSetName='Identity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPODataConnectionSettingMetadata { + [CmdletBinding(DefaultParameterSetName='Name', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceContext}, + + [Parameter(ParameterSetName='Name', Mandatory=$true)] + [ValidateNotNull()] + [ValidateLength(0, 255)] + [string] + ${Name}, + + [ValidateNotNull()] + [uri] + ${ServiceAddressMetadataURL}, + + [ValidateNotNull()] + [object] + ${AuthenticationMode}, + + [ValidateLength(0, 1024)] + [ValidateNotNull()] + [string] + ${SecureStoreTargetApplicationId}, + + [Parameter(ParameterSetName='Identity', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPOfficeStoreAppsDefaultActivation { + [CmdletBinding(DefaultParameterSetName='AppsForOfficeSettingsInWebApplication', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [bool] + ${Enable}, + + [Parameter(ParameterSetName='AppsForOfficeSettingsInWebApplication', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='AppsForOfficeSettingsInSiteSubscription', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPPassPhrase { + [CmdletBinding(DefaultParameterSetName='AcrossFarm', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [securestring] + ${PassPhrase}, + + [Parameter(ParameterSetName='AcrossFarm', Mandatory=$true)] + [securestring] + ${ConfirmPassPhrase}, + + [Parameter(ParameterSetName='LocalOnly')] + [switch] + ${LocalServerOnly}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPPerformancePointSecureDataValues { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ServiceApplication}, + + [Parameter(Mandatory=$true)] + [pscredential] + ${DataSourceUnattendedServiceAccount}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPPerformancePointServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${ApplicationPool}, + + [bool] + ${CommentsDisabled}, + + [int] + ${CommentsScorecardMax}, + + [int] + ${IndicatorImageCacheSeconds}, + + [int] + ${DataSourceQueryTimeoutSeconds}, + + [int] + ${FilterRememberUserSelectionsDays}, + + [int] + ${FilterTreeMembersMax}, + + [int] + ${FilterSearchResultsMax}, + + [int] + ${ShowDetailsInitialRows}, + + [bool] + ${ShowDetailsMaxRowsDisabled}, + + [int] + ${ShowDetailsMaxRows}, + + [bool] + ${MSMQEnabled}, + + [string] + ${MSMQName}, + + [int] + ${SessionHistoryHours}, + + [bool] + ${AnalyticQueryLoggingEnabled}, + + [bool] + ${TrustedDataSourceLocationsRestricted}, + + [bool] + ${TrustedContentLocationsRestricted}, + + [int] + ${SelectMeasureMaximum}, + + [int] + ${DecompositionTreeMaximum}, + + [bool] + ${ApplicationProxyCacheEnabled}, + + [bool] + ${ApplicationCacheEnabled}, + + [int] + ${ApplicationCacheMinimumHitCount}, + + [int] + ${AnalyticResultCacheMinimumHitCount}, + + [int] + ${ElementCacheSeconds}, + + [int] + ${AnalyticQueryCellMax}, + + [string] + ${SettingsDatabase}, + + [string] + ${DatabaseServer}, + + [string] + ${DatabaseName}, + + [pscredential] + ${DatabaseSQLAuthenticationCredential}, + + [string] + ${DatabaseFailoverServer}, + + [bool] + ${DatabaseUseWindowsAuthentication}, + + [string] + ${DataSourceUnattendedServiceAccountTargetApplication}, + + [bool] + ${UseEffectiveUserName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPPowerPointConversionServiceApplication { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [uint32] + ${CacheExpirationPeriodInSeconds}, + + [uint32] + ${WorkerProcessCount}, + + [uint32] + ${WorkerKeepAliveTimeoutInSeconds}, + + [uint32] + ${WorkerTimeoutInSeconds}, + + [uint32] + ${MaximumConversionsPerWorker}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPProfileServiceApplication { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [string] + ${Name}, + + [object] + ${ApplicationPool}, + + [pscredential] + ${ProfileDBCredentials}, + + [string] + ${ProfileDBFailoverServer}, + + [pscredential] + ${SocialDBCredentials}, + + [string] + ${SocialDBFailoverServer}, + + [pscredential] + ${ProfileSyncDBCredentials}, + + [string] + ${ProfileSyncDBFailoverServer}, + + [Parameter(ParameterSetName='MySiteSettings', Mandatory=$true, ValueFromPipeline=$true)] + [Parameter(ValueFromPipeline=$true)] + [object] + ${MySiteHostLocation}, + + [Parameter(ParameterSetName='MySiteSettings', ValueFromPipeline=$true)] + [object] + ${MySiteManagedPath}, + + [Parameter(ParameterSetName='MySiteSettings')] + [ValidateSet('None','Resolve','Block')] + [string] + ${SiteNamingConflictResolution}, + + [bool] + ${PurgeNonImportedObjects}, + + [bool] + ${UseOnlyPreferredDomainControllers}, + + [bool] + ${GetNonImportedObjects}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPProfileServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [string] + ${Name}, + + [switch] + ${DefaultProxyGroup}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${MySiteHostLocation}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${MySiteManagedPath}, + + [ValidateSet('None','Resolve','Block')] + [string] + ${SiteNamingConflictResolution}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPProfileServiceApplicationSecurity { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [ValidateSet('UserACL','MySiteReaderACL')] + [string] + ${Type}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPProjectDatabaseQuota { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(ParameterSetName='settings', Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${Settings}, + + [Parameter(ParameterSetName='options', Mandatory=$true)] + [switch] + ${Enabled}, + + [Parameter(ParameterSetName='options', Mandatory=$true)] + [ValidateRange(0, 1024000)] + [int] + ${ReadOnlyLimit}, + + [Parameter(ParameterSetName='options', Mandatory=$true)] + [ValidateRange(0, 100)] + [int] + ${ReadOnlyWarningThreshold}, + + [Parameter(ParameterSetName='options', Mandatory=$true)] + [ValidateRange(0, 1024000)] + [int] + ${MaxDbSize}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPProjectEventServiceSettings { + [CmdletBinding()] +param( + [System.Nullable[int]] + ${NetTcpPort}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPProjectOdataConfiguration { + [CmdletBinding()] +param( + [bool] + ${UseVerboseErrors}, + + [ValidateRange(1, 2147483647)] + [int] + ${MaxResultsPerCollection}, + + [bool] + ${AcceptCountRequests}, + + [bool] + ${AcceptProjectionRequests}, + + [ValidateRange(1, 2147483647)] + [int] + ${DefaultMaxPageSize}, + + [switch] + ${ClearEntityPageSizeOverrides}, + + [string] + ${EntitySetName}, + + [ValidateRange(1, 2147483647)] + [int] + ${PageSizeOverride}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPProjectPCSSettings { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [Alias('sa')] + [object] + ${ServiceApplication}, + + [System.Nullable[int]] + ${MaximumIdleWorkersCount}, + + [System.Nullable[int]] + ${MaximumWorkersCount}, + + [System.Nullable[int]] + ${EditingSessionTimeout}, + + [System.Nullable[int]] + ${MaximumSessionsPerUser}, + + [System.Nullable[int]] + ${CachePersistence}, + + [System.Nullable[int]] + ${MinimumMemoryRequired}, + + [System.Nullable[int]] + ${RequestTimeLimits}, + + [System.Nullable[int]] + ${MaximumProjectSize}, + + [System.Nullable[int]] + ${NetTcpPort}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPProjectPermissionMode { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateSet('SharePoint','ProjectServer')] + [ValidateNotNullOrEmpty()] + [object] + ${Mode}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPProjectQueueSettings { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [Alias('sa')] + [object] + ${ServiceApplication}, + + [System.Nullable[int]] + ${MaxDegreeOfConcurrency}, + + [System.Nullable[int]] + ${MsgRetryInterval}, + + [System.Nullable[int]] + ${MsgRetryLimit}, + + [System.Nullable[int]] + ${SqlRetryInterval}, + + [System.Nullable[int]] + ${SqlRetryLimit}, + + [System.Nullable[int]] + ${SqlCommandTimeout}, + + [System.Nullable[int]] + ${CleanupSuccessAgeLimit}, + + [System.Nullable[int]] + ${CleanupNonSuccessAgeLimit}, + + [System.Nullable[int]] + ${PeriodicTasksInterval}, + + [System.Nullable[int]] + ${QueueTimeout}, + + [System.Nullable[int]] + ${MaxConnections}, + + [System.Nullable[int]] + ${NetTcpPort}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPProjectServiceApplication { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [object] + ${ApplicationPool}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPProjectUserSync { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(Mandatory=$true, Position=2)] + [ValidateNotNullOrEmpty()] + [object] + ${Value}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPProjectUserSyncDisabledSyncThreshold { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(Mandatory=$true, Position=2)] + [ValidateNotNullOrEmpty()] + [int] + ${Threshold}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPProjectUserSyncFullSyncThreshold { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(Mandatory=$true, Position=2)] + [ValidateNotNullOrEmpty()] + [int] + ${Threshold}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPProjectUserSyncOffPeakSyncThreshold { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(Mandatory=$true, Position=2)] + [ValidateNotNullOrEmpty()] + [int] + ${Threshold}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPRequestManagementSettings { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNull()] + [System.Nullable[switch]] + ${RoutingEnabled}, + + [ValidateNotNull()] + [System.Nullable[switch]] + ${ThrottlingEnabled}, + + [ValidateNotNull()] + [object] + ${RoutingScheme}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPRoutingMachineInfo { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNull()] + [object] + ${Availability}, + + [ValidateNotNull()] + [object] + ${OutgoingScheme}, + + [ValidateRange(1, 65535)] + [ValidateNotNull()] + [System.Nullable[int]] + ${OutgoingPort}, + + [ValidateNotNull()] + [switch] + ${ClearOutgoingPort}, + + [ValidateNotNull()] + [System.Nullable[double]] + ${StaticWeight}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPRoutingMachinePool { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNull()] + [object] + ${MachineTargets}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPRoutingRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNull()] + [object] + ${Criteria}, + + [object] + ${MachinePool}, + + [ValidateNotNull()] + [System.Nullable[int]] + ${ExecutionGroup}, + + [ValidateNotNull()] + [System.Nullable[datetime]] + ${Expiration}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPRuntimeTelemetry { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [int] + ${Interval}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPScaleOutDatabaseDataRange { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Database}, + + [Parameter(Mandatory=$true)] + [object] + ${Range}, + + [byte[]] + ${NewRangePoint}, + + [Parameter(Mandatory=$true)] + [bool] + ${IsUpperSubRange}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPScaleOutDatabaseDataSubRange { + [CmdletBinding(DefaultParameterSetName='AttachedDatabase', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='AttachedDatabase', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [Parameter(ParameterSetName='UnattachedDatabase', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ConnectionString}, + + [Parameter(ParameterSetName='UnattachedDatabase')] + [switch] + ${IsAzureDatabase}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Range}, + + [byte[]] + ${SubRangePoint}, + + [Parameter(Mandatory=$true)] + [object] + ${SubRangeMode}, + + [Parameter(Mandatory=$true)] + [bool] + ${IsUpperSubRange}, + + [switch] + ${IgnoreSubRangePointOnBoundary}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSecureStoreApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [object] + ${Administrator}, + + [object] + ${CredentialsOwnerGroup}, + + [object] + ${Fields}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [object] + ${TargetApplication}, + + [object] + ${TicketRedeemer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSecureStoreDefaultProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [type] + ${Type}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSecureStoreServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='MinDBSet')] + [Parameter(ParameterSetName='NoMinDBSet')] + [object] + ${ApplicationPool}, + + [Parameter(ParameterSetName='NoMinDBSet')] + [Parameter(ParameterSetName='MinDBSet')] + [switch] + ${AuditingEnabled}, + + [Parameter(ParameterSetName='MinDBSet')] + [Parameter(ParameterSetName='NoMinDBSet')] + [System.Nullable[int]] + ${AuditlogMaxSize}, + + [Parameter(ParameterSetName='NoMinDBSet')] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ParameterSetName='NoMinDBSet')] + [string] + ${DatabaseName}, + + [Parameter(ParameterSetName='NoMinDBSet')] + [securestring] + ${DatabasePassword}, + + [Parameter(ParameterSetName='NoMinDBSet')] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [Parameter(ParameterSetName='NoMinDBSet')] + [string] + ${DatabaseUsername}, + + [Parameter(ParameterSetName='NoMinDBSet')] + [string] + ${FailoverDatabaseServer}, + + [Parameter(ParameterSetName='NoMinDBSet', Mandatory=$true, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='MinDBSet', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='NoMinDBSet')] + [Parameter(ParameterSetName='MinDBSet')] + [switch] + ${Sharing}, + + [Parameter(ParameterSetName='MinDBSet', Mandatory=$true)] + [switch] + ${EnableMinDB}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSecurityTokenServiceConfig { + [CmdletBinding(DefaultParameterSetName='SigningCertificateImport', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='SigningCertificateImport')] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${ImportSigningCertificate}, + + [Parameter(ParameterSetName='SigningCertificateReference')] + [string] + ${SigningCertificateThumbprint}, + + [Parameter(ParameterSetName='SigningCertificateReference')] + [string] + ${SigningCertificateStoreName}, + + [Parameter(ParameterSetName='SigningCertificateQueue')] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${QueueSigningCertificate}, + + [Parameter(ParameterSetName='SigningCertificateReference')] + [string] + ${QueueSigningCertificateThumbprint}, + + [Parameter(ParameterSetName='SigningCertificateReference')] + [string] + ${QueueSigningCertificateStoreName}, + + [Parameter(ParameterSetName='SigningCertificateRevoke')] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${RevokeSigningCertificate}, + + [Parameter(ParameterSetName='RevokeSigningCertificateReference', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${RevokeSigningCertificateThumbprint}, + + [Parameter(ParameterSetName='RevokeSigningCertificateReference')] + [ValidateNotNullOrEmpty()] + [string] + ${RevokeSigningCertificateStoreName}, + + [switch] + ${SkipProvisionInstances}, + + [int] + ${ServiceTokenLifetime}, + + [int] + ${ServiceTokenCacheExpirationWindow}, + + [int] + ${FormsTokenLifetime}, + + [int] + ${WindowsTokenLifetime}, + + [int] + ${MaxLogonTokenCacheItems}, + + [int] + ${MaxServiceTokenCacheItems}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPServer { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Address')] + [object] + ${Identity}, + + [object] + ${Status}, + + [object] + ${Role}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPServerScaleOutDatabaseDataRange { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Database}, + + [Parameter(Mandatory=$true)] + [object] + ${Range}, + + [byte[]] + ${NewRangePoint}, + + [Parameter(Mandatory=$true)] + [bool] + ${IsUpperSubRange}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPServerScaleOutDatabaseDataSubRange { + [CmdletBinding(DefaultParameterSetName='AttachedDatabase', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='AttachedDatabase', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Database}, + + [Parameter(ParameterSetName='UnattachedDatabase', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ConnectionString}, + + [Parameter(ParameterSetName='UnattachedDatabase')] + [switch] + ${IsAzureDatabase}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Range}, + + [byte[]] + ${SubRangePoint}, + + [Parameter(Mandatory=$true)] + [object] + ${SubRangeMode}, + + [Parameter(Mandatory=$true)] + [bool] + ${IsUpperSubRange}, + + [switch] + ${IgnoreSubRangePointOnBoundary}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNull()] + [object] + ${DefaultEndpoint}, + + [ValidateNotNull()] + [object] + ${ServiceApplicationProxyGroup}, + + [ValidateNotNull()] + [object] + ${IisWebServiceApplicationPool}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPServiceApplicationEndpoint { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='HostName', Mandatory=$true)] + [ValidateNotNull()] + [string] + ${HostName}, + + [Parameter(ParameterSetName='ResetHostName', Mandatory=$true)] + [switch] + ${ResetHostName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPServiceApplicationPool { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Position=1)] + [object] + ${Account}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPServiceApplicationSecurity { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1)] + [ValidateNotNull()] + [object] + ${ObjectSecurity}, + + [switch] + ${Admin}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPServiceHostConfig { + [CmdletBinding(DefaultParameterSetName='SslCertificateImport', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='SslCertificateReference', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='SslCertificateImport', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='SslCertificateReference')] + [Parameter(ParameterSetName='SslCertificateImport')] + [Alias('Port')] + [ValidateRange(1, 65535)] + [int] + ${HttpPort}, + + [Parameter(ParameterSetName='SslCertificateReference')] + [Parameter(ParameterSetName='SslCertificateImport')] + [Alias('SecurePort')] + [ValidateRange(1, 65535)] + [int] + ${HttpsPort}, + + [Parameter(ParameterSetName='SslCertificateImport')] + [Parameter(ParameterSetName='SslCertificateReference')] + [ValidateRange(1, 65535)] + [int] + ${NetTcpPort}, + + [Parameter(ParameterSetName='SslCertificateReference', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SslCertificateThumbprint}, + + [Parameter(ParameterSetName='SslCertificateReference')] + [ValidateNotNullOrEmpty()] + [string] + ${SslCertificateStoreName}, + + [Parameter(ParameterSetName='SslCertificateImport')] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${ImportSslCertificate}, + + [switch] + ${NoWait}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSessionStateService { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [System.Nullable[int]] + ${SessionTimeout}, + + [Parameter(ParameterSetName='AdvancedProvision')] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSite { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Default')] + [object] + ${OwnerAlias}, + + [Parameter(ParameterSetName='Default')] + [object] + ${QuotaTemplate}, + + [Parameter(ParameterSetName='Default')] + [object] + ${Template}, + + [Parameter(ParameterSetName='Default')] + [string] + ${Url}, + + [Parameter(ParameterSetName='Default')] + [long] + ${MaxSize}, + + [Parameter(ParameterSetName='Default')] + [long] + ${WarningSize}, + + [Parameter(ParameterSetName='Default')] + [string] + ${SharingType}, + + [Parameter(ParameterSetName='Default')] + [ValidateSet('Unlock','NoAdditions','ReadOnly','NoAccess')] + [string] + ${LockState}, + + [Parameter(ParameterSetName='Default')] + [object] + ${SecondaryOwnerAlias}, + + [Parameter(ParameterSetName='Default')] + [string] + ${UserAccountDirectoryPath}, + + [Parameter(ParameterSetName='SiteSubscription')] + [object] + ${SiteSubscription}, + + [Parameter(ParameterSetName='SiteSubscription')] + [switch] + ${Force}, + + [object] + ${AdministrationSiteType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSiteAdministration { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='Default')] + [object] + ${OwnerAlias}, + + [Parameter(ParameterSetName='Default')] + [object] + ${SecondaryOwnerAlias}, + + [Parameter(ParameterSetName='Default')] + [object] + ${Template}, + + [Parameter(ParameterSetName='Default')] + [ValidateSet('Unlock','NoAdditions','ReadOnly','NoAccess')] + [string] + ${LockState}, + + [Parameter(ParameterSetName='Default')] + [long] + ${MaxSize}, + + [Parameter(ParameterSetName='Default')] + [long] + ${WarningSize}, + + [Parameter(ParameterSetName='SiteSubscription')] + [object] + ${SiteSubscription}, + + [Parameter(ParameterSetName='SiteSubscription')] + [switch] + ${Force}, + + [object] + ${AdministrationSiteType}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSiteSubscriptionConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${UserAccountDirectoryPath}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${FeaturePack}, + + [switch] + ${PassThru}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSiteSubscriptionEdiscoveryHub { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${SearchScope}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSiteSubscriptionIRMConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [switch] + ${IrmEnabled}, + + [Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [uri] + ${CertificateServerUrl}, + + [switch] + ${PassThru}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSiteSubscriptionMetadataConfig { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ServiceProxy}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${HubUri}, + + [switch] + ${DoNotUnpublishAllPackages}, + + [switch] + ${SyndicationErrorReportEnabled}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSiteSubscriptionProfileConfig { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [Parameter(ParameterSetName='MySiteSettings', Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${MySiteHostLocation}, + + [Parameter(ParameterSetName='MySiteSettings', ValueFromPipeline=$true)] + [object] + ${MySiteManagedPath}, + + [Parameter(ParameterSetName='MySiteSettings')] + [ValidateSet('None','Resolve','Block')] + [string] + ${SiteNamingConflictResolution}, + + [string] + ${SynchronizationOU}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSiteURL { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${Zone}, + + [Parameter(Mandatory=$true)] + [string] + ${Url}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPStateServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPStateServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPStateServiceDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [Alias('Application')] + [object] + ${ServiceApplication}, + + [ValidateRange(1, 10)] + [System.Nullable[int]] + ${Weight}, + + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPSubscriptionSettingsServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [ValidateNotNullOrEmpty()] + [string] + ${FailoverDatabaseServer}, + + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseName}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPThrottlingRule { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNull()] + [object] + ${Criteria}, + + [ValidateRange(0, 10)] + [ValidateNotNull()] + [System.Nullable[int]] + ${Threshold}, + + [ValidateNotNull()] + [System.Nullable[datetime]] + ${Expiration}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTimerJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [ValidateNotNullOrEmpty()] + [string] + ${Schedule}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTopologyServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [string] + ${LoadBalancerUrl}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTopologyServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [string] + ${BadListPeriod}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTranslationServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [string] + ${DatabaseName}, + + [pscredential] + ${DatabaseCredential}, + + [string] + ${DatabaseServer}, + + [string] + ${FailoverDatabaseServer}, + + [System.Nullable[int]] + ${TimerJobFrequency}, + + [System.Nullable[int]] + ${MaximumTranslationAttempts}, + + [System.Nullable[int]] + ${KeepAliveTimeout}, + + [System.Nullable[int]] + ${MaximumTranslationTime}, + + [System.Nullable[int]] + ${TranslationsPerInstance}, + + [System.Nullable[int]] + ${MaximumSyncTranslationRequests}, + + [System.Nullable[int]] + ${RecycleProcessThreshold}, + + [System.Nullable[int]] + ${TotalActiveProcesses}, + + [string] + ${MachineTranslationClientId}, + + [string] + ${MachineTranslationCategory}, + + [switch] + ${UseDefaultInternetSettings}, + + [string] + ${WebProxyAddress}, + + [string] + ${MachineTranslationAddress}, + + [System.Nullable[int]] + ${JobExpirationDays}, + + [System.Nullable[int]] + ${MaximumItemsPerDay}, + + [System.Nullable[int]] + ${MaximumItemsPerPartitionPerDay}, + + [System.Nullable[int]] + ${MaximumBinaryFileSize}, + + [System.Nullable[int]] + ${MaximumTextFileSize}, + + [System.Nullable[int]] + ${MaximumWordCharacterCount}, + + [System.Nullable[bool]] + ${DisableBinaryFileScan}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [string[]] + ${AddEnabledFileExtensions}, + + [string[]] + ${RemoveEnabledFileExtensions}, + + [switch] + ${ClearEnabledFileExtensions}, + + [switch] + ${EnableAllFileExtensions}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTranslationServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [System.Nullable[int]] + ${MaximumGroupSize}, + + [System.Nullable[int]] + ${MaximumItemCount}, + + [switch] + ${DefaultProxyGroup}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTranslationThrottlingSetting { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [System.Nullable[int]] + ${SiteQuota}, + + [System.Nullable[int]] + ${TenantQuota}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTrustedIdentityTokenIssuer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='ImportCertificateParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='BasicParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='BasicParameterSet')] + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [ValidateNotNullOrEmpty()] + [string] + ${Description}, + + [Parameter(ParameterSetName='ImportCertificateParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${ImportTrustCertificate}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet', Mandatory=$true)] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, + + [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [Parameter(ParameterSetName='BasicParameterSet')] + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [object] + ${ClaimsMappings}, + + [Parameter(ParameterSetName='BasicParameterSet')] + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [ValidateNotNullOrEmpty()] + [string] + ${SignInUrl}, + + [Parameter(ParameterSetName='BasicParameterSet')] + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [object] + ${ClaimProvider}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [Parameter(ParameterSetName='BasicParameterSet')] + [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [string] + ${Realm}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [Parameter(ParameterSetName='BasicParameterSet')] + [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [switch] + ${UseWReply}, + + [Parameter(ParameterSetName='BasicParameterSet')] + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [string] + ${RegisteredIssuerName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTrustedRootAuthority { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName='ManualUpdateCertificateParameterSet')] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${Certificate}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTrustedSecurityTokenIssuer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNullOrEmpty()] + [string] + ${Description}, + + [string] + ${RegisteredIssuerName}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, + + [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${Certificate}, + + [ValidateNotNullOrEmpty()] + [switch] + ${IsTrustBroker}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPTrustedServiceTokenIssuer { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [ValidateNotNullOrEmpty()] + [string] + ${Description}, + + [Parameter(ParameterSetName='ImportCertificateParameterSet')] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2] + ${Certificate}, + + [Parameter(ParameterSetName='MetadataEndPointParameterSet')] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPUsageApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [object] + ${UsageService}, + + [ValidateLength(1, 135)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [ValidateNotNullOrEmpty()] + [ValidateLength(1, 128)] + [string] + ${DatabaseName}, + + [ValidateNotNullOrEmpty()] + [ValidateLength(1, 128)] + [string] + ${DatabaseUsername}, + + [ValidateNotNull()] + [securestring] + ${DatabasePassword}, + + [switch] + ${EnableLogging}, + + [ValidateLength(1, 135)] + [string] + ${FailoverDatabaseServer}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPUsageDefinition { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${Enable}, + + [ValidateRange(0, 31)] + [int] + ${DaysRetained}, + + [ValidateRange(0, 31)] + [int] + ${DaysToKeepUsageFiles}, + + [ValidateRange(1, 9223372036854775807)] + [long] + ${MaxTotalSizeInBytes}, + + [switch] + ${UsageDatabaseEnabled}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPUsageService { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true, HelpMessage='The max space, in GB, that Usage log files should take up.')] + [ValidateRange(1, 20)] + [uint32] + ${UsageLogMaxSpaceGB}, + + [Parameter(ValueFromPipeline=$true, HelpMessage='The location where Usage log files are created.')] + [ValidateLength(1, 181)] + [ValidateNotNullOrEmpty()] + [string] + ${UsageLogLocation}, + + [Parameter(ValueFromPipeline=$true, HelpMessage='The time interval, in minutes, that Usage log files should be cut and start a new one.')] + [ValidateRange(1, 1440)] + [uint32] + ${UsageLogCutTime}, + + [Parameter(ValueFromPipeline=$true, HelpMessage='The max usage file size, in KB, that Usage log files should be cut and start a new one.')] + [ValidateRange(512, 65536)] + [uint32] + ${UsageLogMaxFileSizeKB}, + + [System.Nullable[bool]] + ${LoggingEnabled}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPUser { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('UserAlias')] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${Web}, + + [object] + ${Group}, + + [string] + ${DisplayName}, + + [switch] + ${SyncFromAD}, + + [string[]] + ${AddPermissionLevel}, + + [string[]] + ${RemovePermissionLevel}, + + [switch] + ${ClearPermissions}, + + [switch] + ${PassThru}, + + [string] + ${Email}, + + [switch] + ${IsSiteCollectionAdmin}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPVisioExternalData { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${VisioServiceApplication}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${UnattendedServiceAccountApplicationID}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPVisioPerformance { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${VisioServiceApplication}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [long] + ${MaxDiagramSize}, + + [Parameter(Mandatory=$true)] + [int] + ${MinDiagramCacheAge}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [int] + ${MaxDiagramCacheAge}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [int] + ${MaxRecalcDuration}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [long] + ${MaxCacheSize}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPVisioSafeDataProvider { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${VisioServiceApplication}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DataProviderId}, + + [Parameter(Mandatory=$true)] + [int] + ${DataProviderType}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Description}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPVisioServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${ServiceApplicationPool}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPWeb { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${RelativeUrl}, + + [string] + ${Description}, + + [object] + ${Template}, + + [Obsolete('This control applies to SharePoint 2007 theming and is no longer functional')] + [string] + ${Theme}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPWebApplication { + [CmdletBinding(DefaultParameterSetName='UpdateGeneralSettings', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='UpdateClaimSettings', Mandatory=$true)] + [object] + ${Zone}, + + [Parameter(ParameterSetName='UpdateGeneralSettings')] + [int] + ${DefaultTimeZone}, + + [Parameter(ParameterSetName='UpdateGeneralSettings')] + [string] + ${DefaultQuotaTemplate}, + + [Parameter(ParameterSetName='UpdateMailSettings', Mandatory=$true)] + [string] + ${SMTPServer}, + + [Parameter(ParameterSetName='UpdateMailSettings')] + [switch] + ${DisableSMTPEncryption}, + + [Parameter(ParameterSetName='UpdateMailSettings')] + [int] + ${SMTPServerPort}, + + [Parameter(ParameterSetName='UpdateMailSettings')] + [string] + ${OutgoingEmailAddress}, + + [Parameter(ParameterSetName='UpdateMailSettings')] + [string] + ${ReplyToEmailAddress}, + + [Parameter(ParameterSetName='UpdateGeneralSettings')] + [Alias('ProxyGroup')] + [object] + ${ServiceApplicationProxyGroup}, + + [Parameter(ParameterSetName='UpdateClaimSettings')] + [object] + ${AuthenticationProvider}, + + [Parameter(ParameterSetName='UpdateClaimSettings')] + [object] + ${AdditionalClaimProvider}, + + [Parameter(ParameterSetName='UpdateClaimSettings')] + [string] + ${SignInRedirectURL}, + + [Parameter(ParameterSetName='UpdateClaimSettings')] + [object] + ${SignInRedirectProvider}, + + [Parameter(ParameterSetName='UpdateClaimSettings')] + [ValidateSet('Kerberos','NTLM')] + [string] + ${AuthenticationMethod}, + + [switch] + ${Force}, + + [switch] + ${NotProvisionGlobally}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPWebApplicationHttpThrottlingMonitor { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true, Position=1, ValueFromPipelineByPropertyName=$true)] + [string] + ${Category}, + + [Parameter(Mandatory=$true, Position=2, ValueFromPipelineByPropertyName=$true)] + [string] + ${Counter}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [string] + ${Instance}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [Alias('Upper')] + [ValidateRange(0, 1.7976931348623157E+308)] + [double] + ${UpperLimit}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [Alias('Lower')] + [ValidateRange(0, 1.7976931348623157E+308)] + [double] + ${LowerLimit}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [Alias('Buckets')] + [double[]] + ${HealthScoreBuckets}, + + [Parameter(ValueFromPipelineByPropertyName=$true)] + [switch] + ${IsDESC}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPWOPIBinding { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [switch] + ${DefaultAction}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPWOPIZone { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${Zone}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPWordConversionServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Low')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [string] + ${DatabaseName}, + + [pscredential] + ${DatabaseCredential}, + + [string] + ${DatabaseServer}, + + [System.Nullable[int]] + ${TimerJobFrequency}, + + [System.Nullable[int]] + ${ConversionTimeout}, + + [System.Nullable[int]] + ${MaximumConversionAttempts}, + + [System.Nullable[int]] + ${KeepAliveTimeout}, + + [System.Nullable[int]] + ${MaximumConversionTime}, + + [System.Nullable[int]] + ${MaximumSyncConversionRequests}, + + [System.Nullable[int]] + ${ConversionsPerInstance}, + + [switch] + ${DisableEmbeddedFonts}, + + [switch] + ${DisableBinaryFileScan}, + + [System.Nullable[int]] + ${RecycleProcessThreshold}, + + [System.Nullable[int]] + ${ActiveProcesses}, + + [System.Nullable[int]] + ${MaximumMemoryUsage}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [string[]] + ${AddSupportedFormats}, + + [string[]] + ${RemoveSupportedFormats}, + + [switch] + ${ClearSupportedFormats}, + + [System.Nullable[int]] + ${MaximumGroupSize}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPWorkflowConfig { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='WebApplication', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='SiteCollection', Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${SiteCollection}, + + [bool] + ${EmailNoPermissionParticipantsEnabled}, + + [bool] + ${SendDocumentToExternalParticipants}, + + [bool] + ${DeclarativeWorkflowsEnabled}, + + [int] + ${SingleWorkflowEpisodeTimeout}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPWorkManagementServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${ApplicationPool}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Name}, + + [Parameter(HelpMessage='This value specifies the minimum amount of time between refreshes for a provider for a given user.')] + [timespan] + ${MinimumTimeBetweenProviderRefreshes}, + + [Parameter(HelpMessage='This value specifies the minimum amount of time between calls to search for a given user.')] + [timespan] + ${MinimumTimeBetweenSearchQueries}, + + [Parameter(HelpMessage='This value specifies the minimum amount of time between calls into our routine that tries to find new tenants that want to sync EWS tasks.')] + [timespan] + ${MinimumTimeBetweenEwsSyncSubscriptionSearches}, + + [Parameter(HelpMessage='This value specifies the maximum number of users a service instance will try to sync on a given tenant via EWS per Timer job interval')] + [uint32] + ${NumberOfUsersPerEwsSyncBatch}, + + [Parameter(HelpMessage='This value specifies the maximum number of users a service instance machine will sync via EWS at one time across all tenants.')] + [uint32] + ${NumberOfUsersEwsSyncWillProcessAtOnce}, + + [Parameter(HelpMessage='This value specifies the maximum number of tenants the service will try to sync via EWS per Timer job interval')] + [uint32] + ${NumberOfSubscriptionSyncsPerEwsSyncRun}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Set-SPWorkManagementServiceApplicationProxy { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [switch] + ${DefaultProxyGroup}, + + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Split-SPScaleOutDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='NewDatabase', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${NewDatabaseName}, + + [Parameter(ParameterSetName='NewDatabase')] + [ValidateNotNullOrEmpty()] + [string] + ${NewDatabaseServer}, + + [Parameter(ParameterSetName='NewDatabase')] + [ValidateNotNullOrEmpty()] + [string] + ${NewDatabaseFailoverServer}, + + [Parameter(ParameterSetName='NewDatabase')] + [ValidateNotNull()] + [pscredential] + ${NewDatabaseCredentials}, + + [Parameter(ParameterSetName='ExistingDatabase', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${TargetDatabase}, + + [Parameter(Mandatory=$true)] + [object] + ${SourceDatabase}, + + [Parameter(Mandatory=$true)] + [object] + ${SourceServiceApplication}, + + [int] + ${SourcePercentage}, + + [switch] + ${MoveLowerHalf}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Split-SPServerScaleOutDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='NewDatabase', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${NewDatabaseName}, + + [Parameter(ParameterSetName='NewDatabase')] + [ValidateNotNullOrEmpty()] + [string] + ${NewDatabaseServer}, + + [Parameter(ParameterSetName='NewDatabase')] + [ValidateNotNullOrEmpty()] + [string] + ${NewDatabaseFailoverServer}, + + [Parameter(ParameterSetName='NewDatabase')] + [ValidateNotNull()] + [pscredential] + ${NewDatabaseCredentials}, + + [Parameter(ParameterSetName='ExistingDatabase', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${TargetDatabase}, + + [Parameter(Mandatory=$true)] + [object] + ${SourceDatabase}, + + [Parameter(Mandatory=$true)] + [object] + ${SourceServiceApplication}, + + [int] + ${SourcePercentage}, + + [switch] + ${MoveLowerHalf}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPAdminJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPAssignment { + [CmdletBinding()] +param( + [switch] + ${Global}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPContentDeploymentJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [object] + ${Identity}, + + [switch] + ${WaitEnabled}, + + [string] + ${DeploySinceTime}, + + [switch] + ${TestEnabled}, + + [string] + ${UseSpecificSnapshot}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPDiagnosticsSession { + [CmdletBinding()] +param( + [guid] + ${CorrelationId}, + + [switch] + ${Dashboard}, + + [ValidateSet('High','Medium','Monitorable','Unexpected','Verbose','VerboseEx','None')] + [string] + ${TraceLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPEnterpriseSearchServiceInstance { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPInfoPathFormTemplate { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPService { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPServiceInstance { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Start-SPTimerJob { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Stop-SPAssignment { + [CmdletBinding()] +param( + [switch] + ${Global}, + + [Parameter(Position=0, ValueFromPipeline=$true)] + [object] + ${SemiGlobal}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Stop-SPDiagnosticsSession { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Stop-SPDistributedCacheServiceInstance { + [CmdletBinding()] +param( + [Parameter(Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [switch] + ${Graceful}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Stop-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Stop-SPEnterpriseSearchServiceInstance { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Stop-SPInfoPathFormTemplate { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [ValidateRange(0, 1440)] + [System.Nullable[int]] + ${TimeLeft}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Stop-SPService { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Stop-SPServiceInstance { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Suspend-SPEnterpriseSearchServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Suspend-SPStateServiceDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [Alias('Name')] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Suspend-SPVideoStreamingAccess { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${SiteSubscription}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Switch-SPSitesToNewDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [guid[]] + ${SiteIds}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${SourceDatabase}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DestinationDatabase}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Sync-SPProjectPermissions { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='SPMode', Mandatory=$true, Position=0)] + [Parameter(ParameterSetName='PSMode', Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(ParameterSetName='SPMode', Position=1)] + [ValidateSet('Full','Incremental')] + [ValidateNotNullOrEmpty()] + [object] + ${Type}, + + [Parameter(ParameterSetName='PSMode', Position=1)] + [switch] + ${SyncPWASite}, + + [Parameter(ParameterSetName='PSMode', Position=2)] + [switch] + ${SyncProjectSites}, + + [Parameter(ParameterSetName='PSMode', Position=3)] + [switch] + ${Async}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Test-SPContentDatabase { + [CmdletBinding(DefaultParameterSetName='ContentDatabaseById')] +param( + [Parameter(ParameterSetName='ContentDatabaseByName', Mandatory=$true)] + [ValidateNotNull()] + [string] + ${Name}, + + [Parameter(ParameterSetName='ContentDatabaseByName', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [ValidateNotNull()] + [object] + ${ServerInstance}, + + [ValidateNotNull()] + [pscredential] + ${DatabaseCredentials}, + + [switch] + ${ShowRowCounts}, + + [switch] + ${ShowLocation}, + + [Parameter(ParameterSetName='ContentDatabaseById', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${ExtendedCheck}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Test-SPInfoPathFormTemplate { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [string] + ${Path}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Test-SPIPRangeAllowList { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SiteName}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${IP}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Test-SPO365LinkSettings { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true)] + [uri] + ${MySiteHostUrl}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Test-SPProjectServiceApplication { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Position=1, ValueFromPipeline=$true)] + [object] + ${Rule}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Test-SPProjectWebInstance { + [CmdletBinding()] +param( + [Parameter(ParameterSetName='FindProjectSiteByWebInstance', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='FindProjectSiteByWebInstance', Position=1, ValueFromPipeline=$true)] + [object] + ${Rule}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Test-SPSite { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [guid] + ${RuleId}, + + [switch] + ${RunAlways}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Uninstall-SPAppInstance { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Uninstall-SPDataConnectionFile { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Uninstall-SPFeature { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${Force}, + + [int] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Uninstall-SPHelpCollection { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Uninstall-SPInfoPathFormTemplate { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Uninstall-SPSolution { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='OneWebApplication', Mandatory=$true)] + [object] + ${WebApplication}, + + [string] + ${Time}, + + [switch] + ${Local}, + + [Parameter(ParameterSetName='AllWebApplication', Mandatory=$true)] + [switch] + ${AllWebApplications}, + + [uint32] + ${Language}, + + [string] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Uninstall-SPUserSolution { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${Site}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Uninstall-SPWebPartPack { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [string] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [uint32] + ${Language}, + + [string] + ${CompatibilityLevel}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Unpublish-SPServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPAppCatalogConfiguration { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Site}, + + [switch] + ${SkipWebTemplateChecking}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPAppInstance { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${App}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPAzureBlobConfigLocator { + [CmdletBinding(DefaultParameterSetName='__AllParameterSets')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [byte[]] + ${Locator}) + + + } + + +function Update-SPAzureBlobConfigLocatorEx { + [CmdletBinding(DefaultParameterSetName='__AllParameterSets')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [byte[]] + ${Locator}) + + + } + + +function Update-SPAzureBlobConfigLocatorEx1 { + [CmdletBinding(DefaultParameterSetName='__AllParameterSets')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}, + + [Parameter(ParameterSetName='default')] + [bool] + ${UpdateContentPoolsWithDelay}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [byte[]] + ${Locator}) + + + } + + +function Update-SPAzureBlobLogStoreSignatures { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ReadSignaturesByPrimaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${WriteSignaturesByPrimaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ReadSignaturesBySecondaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${WriteSignaturesBySecondaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DRReadSignaturesByPrimaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DRWriteSignaturesByPrimaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DRReadSignaturesBySecondaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DRWriteSignaturesBySecondaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${PrimaryFarmPoolId}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DRFarmPoolId}) + + + } + + +function Update-SPAzureBlobSignaturesEx { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ReadSignaturesByPrimaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${WriteSignaturesByPrimaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ReadSignaturesBySecondaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${WriteSignaturesBySecondaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DRReadSignaturesByPrimaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DRWriteSignaturesByPrimaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DRReadSignaturesBySecondaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DRWriteSignaturesBySecondaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${PrimaryFarmPoolId}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DRFarmPoolId}) + + + } + + +function Update-SPAzureBlobSignaturesEx1 { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ReadSignaturesByPrimaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${WriteSignaturesByPrimaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${ReadSignaturesBySecondaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${WriteSignaturesBySecondaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DRReadSignaturesByPrimaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DRWriteSignaturesByPrimaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DRReadSignaturesBySecondaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DRWriteSignaturesBySecondaryKey}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${PrimaryFarmPoolId}, + + [Parameter(ParameterSetName='default', Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${DRFarmPoolId}, + + [Parameter(ParameterSetName='default')] + [bool] + ${UpdateContentPoolsWithDelay}) + + + } + + +function Update-SPDistributedCacheSize { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] + [uint32] + ${CacheSizeInMB}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPFarmEncryptionKey { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [switch] + ${Resume}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPHelp { + [CmdletBinding()] +param( + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPInfoPathAdminFileUrl { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true)] + [uri] + ${Find}, + + [Parameter(Mandatory=$true)] + [uri] + ${Replace}, + + [switch] + ${Scan}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPInfoPathFormTemplate { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPInfoPathUserFileUrl { + [CmdletBinding(DefaultParameterSetName='WebApp', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='WebApp', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='ContentDB', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${ContentDatabase}, + + [Parameter(ParameterSetName='Site', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Site}, + + [Parameter(Mandatory=$true)] + [uri] + ${Find}, + + [Parameter(Mandatory=$true)] + [uri] + ${Replace}, + + [switch] + ${Scan}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPProfilePhotoStore { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${MySiteHostLocation}, + + [bool] + ${CreateThumbnailsForImportedPhotos}, + + [bool] + ${NoDelete}, + + [uri] + ${OldBaseUri}, + + [uri] + ${NewBaseUri}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPRepopulateMicroblogFeedCache { + [CmdletBinding(DefaultParameterSetName='Default')] +param( + [Parameter(ParameterSetName='Default', Mandatory=$true, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='FollowableList', Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ParameterSetName='FollowableList', Mandatory=$true, ValueFromPipeline=$true)] + [Parameter(ParameterSetName='Default', ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${SiteSubscription}, + + [Parameter(ParameterSetName='Default')] + [ValidateNotNull()] + [string] + ${AccountName}, + + [Parameter(ParameterSetName='Default')] + [ValidateNotNull()] + [string] + ${SiteUrl}, + + [Parameter(ParameterSetName='FollowableList', Mandatory=$true)] + [ValidateNotNull()] + [guid] + ${SiteId}, + + [Parameter(ParameterSetName='FollowableList', Mandatory=$true)] + [ValidateNotNull()] + [guid] + ${WebId}, + + [Parameter(ParameterSetName='FollowableList', Mandatory=$true)] + [ValidateNotNull()] + [guid] + ${ListId}, + + [Parameter(ParameterSetName='FollowableList', Mandatory=$true)] + [ValidateNotNull()] + [string] + ${ListRootFolderUrl}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPRepopulateMicroblogLMTCache { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${ProfileServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPSecureStoreApplicationServerKey { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [string] + ${Passphrase}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPSecureStoreCredentialMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${Principal}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [securestring[]] + ${Values}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPSecureStoreGroupCredentialMapping { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [securestring[]] + ${Values}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPSecureStoreMasterKey { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [string] + ${Passphrase}, + + [Parameter(Mandatory=$true)] + [ValidateNotNull()] + [object] + ${ServiceApplicationProxy}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPSolution { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [string] + ${LiteralPath}, + + [string] + ${Time}, + + [switch] + ${CASPolicies}, + + [switch] + ${GACDeployment}, + + [switch] + ${FullTrustBinDeployment}, + + [switch] + ${Local}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPUserSolution { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Mandatory=$true)] + [object] + ${Site}, + + [Parameter(Mandatory=$true)] + [object] + ${ToSolution}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Update-SPWOPIProofKey { + [CmdletBinding()] +param( + [ValidateNotNullOrEmpty()] + [string] + ${ServerName}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Upgrade-SPAppManagementServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='AppManagementSvcAppById', Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName='AppManagementSvcAppByName')] + [string] + ${Name}, + + [guid[]] + ${DatabaseIds}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Upgrade-SPConfigurationDatabase { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Upgrade-SPContentDatabase { + [CmdletBinding(DefaultParameterSetName='ContentDatabaseById', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='ContentDatabaseByName', Mandatory=$true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName='ContentDatabaseByName', Mandatory=$true)] + [ValidateNotNull()] + [string] + ${Name}, + + [ValidateNotNull()] + [object] + ${ServerInstance}, + + [switch] + ${UseSnapshot}, + + [Parameter(ParameterSetName='ContentDatabaseById', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(Position=1)] + [switch] + ${ForceDeleteLock}, + + [switch] + ${SkipIntegrityChecks}, + + [switch] + ${NoB2BSiteUpgrade}, + + [switch] + ${AllowUnattached}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Upgrade-SPEnterpriseSearchServiceApplication { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Upgrade-SPEnterpriseSearchServiceApplicationSiteSettings { + [CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Upgrade-SPFarm { + [CmdletBinding(DefaultParameterSetName='FarmById', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [switch] + ${ServerOnly}, + + [switch] + ${SkipDatabaseUpgrade}, + + [switch] + ${NoB2BSiteUpgrade}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Upgrade-SPProfileServiceApplication { + [CmdletBinding(DefaultParameterSetName='Default', SupportsShouldProcess=$true, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Upgrade-SPServer { + [CmdletBinding()] +param( + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Upgrade-SPSingleSignOnDatabase { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SSOConnectionString}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [string] + ${SecureStoreConnectionString}, + + [Parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [securestring] + ${SecureStorePassphrase}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Upgrade-SPSite { + [CmdletBinding(DefaultParameterSetName='SPSiteById', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(ParameterSetName='SPSiteById', Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [object] + ${Identity}, + + [switch] + ${VersionUpgrade}, + + [switch] + ${QueueOnly}, + + [switch] + ${Email}, + + [switch] + ${Unthrottled}, + + [byte] + ${Priority}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Upgrade-SPSiteMapDatabase { + [CmdletBinding(DefaultParameterSetName='DefaultSet', SupportsShouldProcess=$true, ConfirmImpact='High')] +param( + [Parameter(Mandatory=$true, Position=0)] + [ValidateNotNullOrEmpty()] + [guid] + ${DatabaseId}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + +function Upgrade-SPWebApplication { + [CmdletBinding()] +param( + [Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)] + [ValidateNotNullOrEmpty()] + [object] + ${Identity}, + + [Parameter(ValueFromPipeline=$true)] + [object] + ${AssignmentCollection}) + + + } + + + diff --git a/Tests/Tests.pssproj b/Tests/Tests.pssproj index 597acb246..09c494faf 100644 --- a/Tests/Tests.pssproj +++ b/Tests/Tests.pssproj @@ -27,6 +27,11 @@ 4 + + + + + @@ -54,6 +59,10 @@ + + + + diff --git a/Tests/xSharePoint.TestHarness.psm1 b/Tests/xSharePoint.TestHarness.psm1 new file mode 100644 index 000000000..5dcbc4aa0 --- /dev/null +++ b/Tests/xSharePoint.TestHarness.psm1 @@ -0,0 +1,82 @@ +function Invoke-xSharePointTests() { + $repoDir = Join-Path $PSScriptRoot "..\" -Resolve + + $testCoverageFiles = @() + Get-ChildItem "$repoDir\modules\xSharePoint\**\*.psm1" -Recurse | ForEach-Object { $testCoverageFiles += $_.FullName } + + $results = Invoke-Pester -Script @( + @{ + 'Path' = $repoDir + 'Parameters' = @{ + 'SharePointCmdletModule' = (Join-Path $repoDir "\Tests\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1") + } + }, + @{ + 'Path' = $repoDir + 'Parameters' = @{ + 'SharePointCmdletModule' = (Join-Path $repoDir "\Tests\Stubs\SharePoint\16.0.4316.1217\Microsoft.SharePoint.PowerShell.psm1") + } + } + ) -CodeCoverage $testCoverageFiles -PassThru +} + +function Write-xSharePointStubFiles() { + param + ( + [parameter(Mandatory = $true)] [System.String] $SharePointStubPath, + [parameter(Mandatory = $true)] [System.String] $DCacheStubPath + ) + + Add-PSSnapin Microsoft.SharePoint.PowerShell + + $SPStubContent = ((Get-Command | Where-Object { $_.Source -eq "Microsoft.SharePoint.PowerShell" } ) | ForEach-Object -Process { + $signature = $null + $command = $_ + $metadata = New-Object -TypeName System.Management.Automation.CommandMetaData -ArgumentList $command + $definition = [System.Management.Automation.ProxyCommand]::Create($metadata) + foreach ($line in $definition -split "`n") + { + if ($line.Trim() -eq 'begin') + { + break + } + $signature += $line + } + "function $($command.Name) { `n $signature `n } `n" + }) | Out-String + + foreach ($line in $SPStubContent.Split([Environment]::NewLine)) { + $line = $line.Replace("[System.Nullable``1[[Microsoft.Office.Server.Search.Cmdlet.ContentSourceCrawlScheduleType, Microsoft.Office.Server.Search.PowerShell, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]", "[object]") + $line = $line.Replace("[System.Collections.Generic.List``1[[Microsoft.SharePoint.PowerShell.SPUserLicenseMapping, Microsoft.SharePoint.PowerShell, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c]], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]", "[object]") + $line = $line -replace "\[System.Nullable\[Microsoft.*]]", "[System.Nullable[object]]" + $line = $line -replace "\[Microsoft.*.\]", "[object]" + + $line | Out-File $SharePointStubPath -Encoding utf8 -Append + } + + + Use-CacheCluster + + $dcacheStubContent = ((Get-Command | Where-Object { $_.Source -match "DistributedCache*" } ) | ForEach-Object -Process { + $signature = $null + $command = $_ + $metadata = New-Object -TypeName System.Management.Automation.CommandMetaData -ArgumentList $command + $definition = [System.Management.Automation.ProxyCommand]::Create($metadata) + foreach ($line in $definition -split "`n") + { + if ($line.Trim() -eq 'begin') + { + break + } + $signature += $line + } + "function $($command.Name) { `n $signature `n } `n" + }) | Out-String + + foreach ($line in $dcacheStubContent.Split([Environment]::NewLine)) { + $line = $line -replace "\[System.Nullable\[Microsoft.*]]", "[System.Nullable[object]]" + $line = $line -replace "\[Microsoft.*.\]", "[object]" + + $line | Out-File $DCacheStubPath -Encoding utf8 -Append + } +} \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 b/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 index d150ecd1c..cfe9684bf 100644 --- a/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.Global.Tests.ps1 @@ -1,10 +1,7 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest @@ -12,34 +9,30 @@ Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path Import-Module "$PSScriptRoot\xSharePoint.TestHelpers.psm1" -Describe 'xSharePoint Global Tests' { +Describe 'xSharePoint whole of module tests' { $mofFiles = @(Get-ChildItem $RepoRoot -Recurse -Filter "*.schema.mof" -File | ? { ($_.FullName -like "*\DscResources\*") }) - Context 'MOF schemas' { + Context "Validate the MOF schemas for the DSC resources" { - It "Don't have InstallAccount as a required parameter" { + It "should not list InstallAccount as required if it does have that attribute" { $mofFilesWithNoInstallAccount = 0 - $mofFiles | % { + $mofFiles | ForEach-Object { $fileHasInstallAccount = $false - Get-Content $_.FullName | % { - if ($_.IndexOf("[Write, EmbeddedInstance(`"MSFT_Credential`")] String InstallAccount;") -gt 0) { $fileHasInstallAccount = $true } - } - if (-not $fileHasInstallAccount -and $_.Name -ne "MSFT_xSPInstall.schema.mof" ` - -and $_.Name -ne "MSFT_xSPClearRemoteSessions.schema.mof" ` - -and $_.Name -ne "MSFT_xSPInstallPrereqs.schema.mof") { + + $mofSchema = Get-MofSchemaObject $_.FullName + $installAccount = $mofSchema.Attributes | Where-Object { $_.Name -eq "InstallAccount" } + if (($null -ne $installAccount) -and ($installAccount.State -eq "Required")) { $mofFilesWithNoInstallAccount += 1 - Write-Warning "File $($_.FullName) does not contain an InstallAccount parameter. All SharePoint specific resources should use this to impersonate as and access SharePoint resources" + Write-Warning "File $($_.FullName) has InstallAccount listed as a required parameter. After v0.6 of xSharePoint this should be changed to 'write' instead of 'required'" } } $mofFilesWithNoInstallAccount | Should Be 0 } - - - It "Has MOF schemas that match properties on PowerShell functions" { + It "uses MOF schemas that match the functions used in the corresponding PowerShell module for each resource" { $filesWithErrors = 0 $WarningPreference = "Continue" $mofFiles | % { @@ -48,18 +41,15 @@ Describe 'xSharePoint Global Tests' { $filesWithErrors | Should Be 0 } } -} -$DSCTestsPath = (Get-Item (Join-Path $RepoRoot "..\**\DSCResource.Tests\MetaFixers.psm1" -Resolve)).FullName -if ($null -ne $DSCTestsPath) { - Import-Module $DSCTestsPath + $DSCTestsPath = (Get-Item (Join-Path $RepoRoot "..\**\DSCResource.Tests\MetaFixers.psm1" -Resolve)).FullName + if ($null -ne $DSCTestsPath) { + Import-Module $DSCTestsPath + Context "Validate the format and structure of all text files in the module" { - Describe 'Text files formatting' { - $allTextFiles = Get-TextFilesList $RepoRoot - - Context 'Files encoding' { + $allTextFiles = Get-TextFilesList $RepoRoot - It "Doesn't use Unicode encoding" { + It "has no files that aren't in UTF-8 encoding" { $unicodeFilesCount = 0 $allTextFiles | %{ if (Test-FileUnicode $_) { @@ -69,11 +59,8 @@ if ($null -ne $DSCTestsPath) { } $unicodeFilesCount | Should Be 0 } - } - - Context 'Indentations' { - It "Uses spaces for indentation, not tabs" { + It "has no files with tabs in the content" { $totalTabsCount = 0 $allTextFiles | %{ $fileName = $_.FullName @@ -86,78 +73,23 @@ if ($null -ne $DSCTestsPath) { } } } -} - - -Describe 'PowerShell Modules' { - - $psm1Files = @(ls $RepoRoot -Recurse -Filter "*.psm1" -File | ? { - ($_.FullName -like "*\DscResources\*" -or $_.FullName -like "*\Modules\xSharePoint.*") -and (-not ($_.Name -like "*.schema.psm1")) - }) - - if (-not $psm1Files) { - Write-Verbose -Verbose "There are no resource files to analyze" - } else { - - Write-Verbose -Verbose "Analyzing $($psm1Files.Count) files" - - Context 'Correctness' { - function Get-ParseErrors - { - param( - [Parameter(ValueFromPipeline=$True,Mandatory=$True)] - [string]$fileName - ) - - $tokens = $null - $errors = $null - $ast = [System.Management.Automation.Language.Parser]::ParseFile($fileName, [ref] $tokens, [ref] $errors) - return $errors - } - - - It 'all .psm1 files don''t have parse errors' { - $errors = @() - $psm1Files | ForEach-Object { - $localErrors = Get-ParseErrors $_.FullName - if ($localErrors) { - Write-Warning "There are parsing errors in $($_.FullName)" - Write-Warning ($localErrors | Format-List | Out-String) - } - $errors += $localErrors - } - $errors.Count | Should Be 0 - } - } - - Context "SharePoint Cmdlet use" { - function Get-SPCmdletCalls - { - param( - [Parameter(ValueFromPipeline=$True,Mandatory=$True)] - [string]$fileName - ) - - $tokens = $null - $errors = $null - $ast = [System.Management.Automation.Language.Parser]::ParseFile($fileName, [ref] $tokens, [ref] $errors) - return $tokens | Where-Object { $_.TokenFlags -contains "CommandName" -and $_.Text -like "*-SP*"} | ft - } - - It "doesn't call SharePoint PowerShell cmdlets directly" { - $tokens = @() - $psm1Files | ForEach-Object { - $localCmdletCalls = Get-SPCmdletCalls $_.FullName - if ($localCmdletCalls) { - Write-Warning "There are calls to SharePoint cmdlets in $($_.FullName) - use Invoke-xSharePointSPCmdlet instead to mock and test these calls" - Write-Warning ($localCmdletCalls | Format-List | Out-String) - } - $tokens += $localCmdletCalls + Context "Validate the PowerShell modules used throughout the module" { + $psm1Files = @(ls $RepoRoot -Recurse -Filter "*.psm1" -File | ? { + ($_.FullName -like "*\DscResources\*" -or $_.FullName -like "*\Modules\xSharePoint.*") -and (-not ($_.Name -like "*.schema.psm1")) + }) + + It 'has valid PowerShell syntax in all module files' { + $errors = @() + $psm1Files | ForEach-Object { + $localErrors = Get-ParseErrors $_.FullName + if ($localErrors) { + Write-Warning "There are parsing errors in $($_.FullName)" + Write-Warning ($localErrors | Format-List | Out-String) } - $tokens.Count | Should Be 0 + $errors += $localErrors } + $errors.Count | Should Be 0 } } -} - +} \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.TestHelpers.psm1 b/Tests/xSharePoint/xSharePoint.TestHelpers.psm1 index b8cafe9db..0d2001041 100644 --- a/Tests/xSharePoint/xSharePoint.TestHelpers.psm1 +++ b/Tests/xSharePoint/xSharePoint.TestHelpers.psm1 @@ -87,93 +87,107 @@ function Assert-MofSchemaScriptParameters() { $functions = $ast.FindAll( {$args[0] -is [System.Management.Automation.Language.FunctionDefinitionAst]}, $true) $functions | ForEach-Object { - $function = $_ - $astTokens = $null - $astErrors = $null - $functionAst = [System.Management.Automation.Language.Parser]::ParseInput($_.Body, [ref] $astTokens, [ref] $astErrors) + if ($_ -like "*-TargetResource") { + $function = $_ + $astTokens = $null + $astErrors = $null + $functionAst = [System.Management.Automation.Language.Parser]::ParseInput($_.Body, [ref] $astTokens, [ref] $astErrors) - $parameters = $functionAst.FindAll( {$args[0] -is [System.Management.Automation.Language.ParameterAst]}, $true) + $parameters = $functionAst.FindAll( {$args[0] -is [System.Management.Automation.Language.ParameterAst]}, $true) - foreach ($mofParameter in $mofData.Attributes) { - # Check the parameter exists - $paramToCheck = $parameters | Where-Object { $_.Name.ToString() -eq "`$$($mofParameter.Name)" } + foreach ($mofParameter in $mofData.Attributes) { + # Check the parameter exists + $paramToCheck = $parameters | Where-Object { $_.Name.ToString() -eq "`$$($mofParameter.Name)" } - if ($null -eq $paramToCheck) { - $hasErrors = $true - Write-Warning "File $psFile is missing parameter $($mofParameter.Name) from the $($_.Name) method" - } + if ($null -eq $paramToCheck) { + $hasErrors = $true + Write-Warning "File $psFile is missing parameter $($mofParameter.Name) from the $($_.Name) method" + } - $parameterAttribute = $paramToCheck.Attributes | ? { $_.TypeName.ToString() -eq "parameter" } -ErrorAction SilentlyContinue + $parameterAttribute = $paramToCheck.Attributes | ? { $_.TypeName.ToString() -eq "parameter" } -ErrorAction SilentlyContinue - if (($mofParameter.State -eq "Key" -or $mofParameter.State -eq "Required")) { + if (($mofParameter.State -eq "Key" -or $mofParameter.State -eq "Required")) { - if (-not $parameterAttribute) { - $hasErrors = $true - Write-Warning "File $psFile has parameter $($mofParameter.Name) that is not marked as mandatory (has no parameter attribute) in the $($function.Name) method" - } else { - $isMandatoryInScript = [bool]::Parse(($parameterAttribute.NamedArguments | ? { $_.ArgumentName -eq "Mandatory" }).Argument.VariablePath.ToString()) - - if ($isMandatoryInScript -eq $false) { + if (-not $parameterAttribute) { $hasErrors = $true - Write-Warning "File $psFile has parameter $($mofParameter.Name) that is not marked as mandatory in the $($function.Name) method" + Write-Warning "File $psFile has parameter $($mofParameter.Name) that is not marked as mandatory (has no parameter attribute) in the $($function.Name) method" + } else { + $isMandatoryInScript = [bool]::Parse(($parameterAttribute.NamedArguments | ? { $_.ArgumentName -eq "Mandatory" }).Argument.VariablePath.ToString()) + + if ($isMandatoryInScript -eq $false) { + $hasErrors = $true + Write-Warning "File $psFile has parameter $($mofParameter.Name) that is not marked as mandatory in the $($function.Name) method" + } } } - } - if ($mofParameter.State -eq "Write") { - if ($null -ne $parameterAttribute) { - $isMandatoryInScript = [bool]::Parse(($parameterAttribute.NamedArguments | ? { $_.ArgumentName -eq "Mandatory" }).Argument.VariablePath.ToString()) - if ($isMandatoryInScript -eq $true) { - $hasErrors = $true - Write-Warning "File $psFile has parameter $($mofParameter.Name) that is marked as mandatory in the $($function.Name) method and it should not be" + if ($mofParameter.State -eq "Write") { + if ($null -ne $parameterAttribute) { + $isMandatoryInScript = [bool]::Parse(($parameterAttribute.NamedArguments | ? { $_.ArgumentName -eq "Mandatory" }).Argument.VariablePath.ToString()) + if ($isMandatoryInScript -eq $true) { + $hasErrors = $true + Write-Warning "File $psFile has parameter $($mofParameter.Name) that is marked as mandatory in the $($function.Name) method and it should not be" + } } } - } - - if ($null -ne $mofParameter.ValueMap) { - $validateSetAttribute = ($paramToCheck.Attributes | ? { $_.TypeName.ToString() -eq "ValidateSet" }) - - if (-not $validateSetAttribute) { - $hasErrors = $true - Write-Warning "File $psFile has parameter $($mofParameter.Name) that is missing a ValidateSet attribute in the $($function.Name) method" - } - $psValidateSetParams = $validateSetAttribute.PositionalArguments | % { $_.Value.ToString() } + if ($null -ne $mofParameter.ValueMap) { + $validateSetAttribute = ($paramToCheck.Attributes | ? { $_.TypeName.ToString() -eq "ValidateSet" }) - $mofParameter.ValueMap | ForEach-Object { - if ($psValidateSetParams -notcontains $_) { + if (-not $validateSetAttribute) { $hasErrors = $true - Write-Warning "File $psFile has parameter $($mofParameter.Name) that does not have '$_' in its validateset parameter for $($function.Name) method" + Write-Warning "File $psFile has parameter $($mofParameter.Name) that is missing a ValidateSet attribute in the $($function.Name) method" } - } - $psValidateSetParams | ForEach-Object { - if ($mofParameter.ValueMap -notcontains $_) { - $hasErrors = $true - Write-Warning "File $psFile has parameter $($mofParameter.Name) that contains '$_' in the $($function.Name) function which is not in the valuemap in the schema" + $psValidateSetParams = $validateSetAttribute.PositionalArguments | % { $_.Value.ToString() } + + $mofParameter.ValueMap | ForEach-Object { + if ($psValidateSetParams -notcontains $_) { + $hasErrors = $true + Write-Warning "File $psFile has parameter $($mofParameter.Name) that does not have '$_' in its validateset parameter for $($function.Name) method" + } } - } - } - if ($mofParameter.EmbeddedInstance -eq $null) { - if (($paramToCheck.Attributes | ? { $_.TypeName.ToString() -match $mofParameter.DataType }) -eq $null) { - $hasErrors = $true - Write-Warning "File $psFile has parameter $($mofParameter.Name) in function $($function.Name) that does not match the data type of the schema" - } - } else { - switch ($mofParameter.EmbeddedInstance) { - "MSFT_Credential" { - if (($paramToCheck.Attributes | ? { $_.TypeName.ToString() -match "PSCredential" }) -eq $null) { + $psValidateSetParams | ForEach-Object { + if ($mofParameter.ValueMap -notcontains $_) { $hasErrors = $true - Write-Warning "File $psFile has parameter $($mofParameter.Name) in function $($function.Name) that does not match the data type of the schema" + Write-Warning "File $psFile has parameter $($mofParameter.Name) that contains '$_' in the $($function.Name) function which is not in the valuemap in the schema" } } } - } + + if ($mofParameter.EmbeddedInstance -eq $null) { + if (($paramToCheck.Attributes | ? { $_.TypeName.ToString() -match $mofParameter.DataType }) -eq $null) { + $hasErrors = $true + Write-Warning "File $psFile has parameter $($mofParameter.Name) in function $($function.Name) that does not match the data type of the schema" + } + } else { + switch ($mofParameter.EmbeddedInstance) { + "MSFT_Credential" { + if (($paramToCheck.Attributes | ? { $_.TypeName.ToString() -match "PSCredential" }) -eq $null) { + $hasErrors = $true + Write-Warning "File $psFile has parameter $($mofParameter.Name) in function $($function.Name) that does not match the data type of the schema" + } + } + } + } + } } } return (!$hasErrors) } +function Get-ParseErrors { + param( + [Parameter(ValueFromPipeline=$True,Mandatory=$True)] + [string]$fileName + ) + + $tokens = $null + $errors = $null + $ast = [System.Management.Automation.Language.Parser]::ParseFile($fileName, [ref] $tokens, [ref] $errors) + return $errors +} + Export-ModuleMember * \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 b/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 index 9176d93fe..ac91c7392 100644 --- a/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 @@ -1,10 +1,7 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest diff --git a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 index 37697f927..f2eafb624 100644 --- a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 @@ -1,5 +1,7 @@ [CmdletBinding()] -param() +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 { @@ -10,6 +12,7 @@ $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPBCSServiceApp" Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") @@ -23,67 +26,76 @@ Describe "xSPBCSServiceApp" { DatabaseServer = "TestServer\Instance" } - Context "Validate get method" { - It "Calls the service application picker with the appropriate type name" { - Mock Get-xSharePointServiceApplication { return @{ - DisplayName = $testParams.Name - ApplicationPool = @{ Name = $testParams.ApplicationPool } - } } -Verifiable -ParameterFilter {$Name -eq $testParams.Name -and $TypeName -eq "BCS"} - - $results = Get-TargetResource @testParams - $results | Should Not BeNullOrEmpty + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + + Context "When no service application exists in the current farm" { - Assert-VerifiableMocks + Mock Get-SPServiceApplication { return $null } + Mock New-SPBusinessDataCatalogServiceApplication { } + + It "returns null from the Get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } } - } - Context "Validate test method" { - It "Fails when no service app exists" { - Mock Get-TargetResource { return @{} } + It "returns false when the Test method is called" { Test-TargetResource @testParams | Should Be $false } - It "Passes when the service app exists" { - Mock Get-TargetResource { - return @{ - Name = $testParams.Name - ApplicationPool = $testParams.ApplicationPool - } - } - Test-TargetResource @testParams | Should Be $true - } - It "Fails when the service app exists but has the wrong app pool" { - Mock Get-TargetResource { - return @{ - Name = $testParams.Name - ApplicationPool = "Wrong app pool" - } - } - Test-TargetResource @testParams | Should Be $false + + It "creates a new service application in the set method" { + Set-TargetResource @testParams + Assert-MockCalled New-SPBusinessDataCatalogServiceApplication } } - Context "Validate set method" { - It "Creates a new service application" { - Mock Get-TargetResource { return @{} } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPBusinessDataCatalogServiceApplication" } + Context "When a service application exists and is configured correctly" { + Mock Get-SPServiceApplication { + return @(@{ + TypeName = "Business Data Connectivity Service Application" + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } + Database = @{ + Name = $testParams.DatabaseName + Server = @{ Name = $testParams.DatabaseServer } + } + }) + } - Set-TargetResource @testParams + It "returns values from the get method" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } + } - Assert-VerifiableMocks + It "returns true when the Test method is called" { + Test-TargetResource @testParams | Should Be $true } + } - It "Updates an existing service application" { - Mock Get-TargetResource { return @{ Name = $testParams.Name; ApplicationPool = "Wrong app pool" } } - Mock Get-xSharePointServiceApplication { return @{ + Context "When a service application exists and the app pool is not configured correctly" { + Mock Get-SPServiceApplication { + return @(@{ + TypeName = "Business Data Connectivity Service Application" DisplayName = $testParams.Name - ApplicationPool = @{ Name = $testParams.ApplicationPool } - } } -Verifiable -ParameterFilter {$Name -eq $testParams.Name -and $TypeName -eq "BCS"} - Mock Invoke-xSharePointSPCmdlet { return @{ Name = $testParams.ApplicationPool } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplicationPool" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPBusinessDataCatalogServiceApplication" } + ApplicationPool = @{ Name = "Wrong App Pool Name" } + Database = @{ + Name = $testParams.DatabaseName + Server = @{ Name = $testParams.DatabaseServer } + } + }) + } + Mock Get-SPServiceApplicationPool { return @{ Name = $testParams.ApplicationPool } } + Mock Set-SPBusinessDataCatalogServiceApplication { } + + It "returns false when the Test method is called" { + Test-TargetResource @testParams | Should Be $false + } + It "calls the update service app cmdlet from the set method" { Set-TargetResource @testParams - Assert-VerifiableMocks + Assert-MockCalled Get-SPServiceApplicationPool + Assert-MockCalled Set-SPBusinessDataCatalogServiceApplication -ParameterFilter { $ApplicationPool.Name -eq $testParams.ApplicationPool } } } } diff --git a/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 index b90843f9e..dc162e3db 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 @@ -1,20 +1,16 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPCacheAccounts" -Import-Module (Join-Path $RepoRoot "Modules\xSharePoint") Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") -Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\Modules\xSharePoint.CacheAccounts\xSharePoint.CacheAccounts.psm1") Describe "xSPCacheAccounts" { InModuleScope $ModuleName { @@ -24,84 +20,104 @@ Describe "xSPCacheAccounts" { SuperReaderAlias = "DEMO\SuperReader" } - Context "Validate get method" { - It "Calls the service application picker with the appropriate type name" { - Mock Invoke-xSharePointSPCmdlet { return @{ - Properties = @{ - SuperUserAlias = $testParams.SuperUserAlias - SuperReaderAlias = $testParams.SuperReaderAlias - } - }} -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPWebApplication" } - - $results = Get-TargetResource @testParams - $results.Count | Should Not BeNullOrEmpty + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + Mock Set-xSharePointCacheReaderPolicy {} + Mock Set-xSharePointCacheOwnerPolicy {} + Mock Update-xSharePointObject {} + + Context "The web application specified does not exist" { + Mock Get-SPWebApplication { return $null } - Assert-VerifiableMocks + It "returns null from the get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty } - } - Context "Validate test method" { - It "Fails when no cache accounts exist" { - Mock -ModuleName $ModuleName Get-TargetResource { return @{} } + It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false } - It "Passes when the correct accounts are assigned" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - SuperUserAlias = $testParams.SuperUserAlias - SuperReaderAlias = $testParams.SuperReaderAlias - } - } - Test-TargetResource @testParams | Should Be $true + + It "throws and exception where set is called" { + { Set-TargetResource @testParams } | Should Throw } - It "Fails when the wrong super reader is defined" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - SuperUserAlias = $testParams.SuperUserAlias - SuperReaderAlias = "DEMO\WrongUser" - } - } - Test-TargetResource @testParams | Should Be $false + } + + Context "The specified cache accounts have not been configured" { + Mock Get-SPWebApplication { return @{ + Properties = @{ } + }} + + It "returns empty strings from the Get method" { + $results = Get-TargetResource @testParams + $results.SuperUserAlias | Should BeNullOrEmpty + $results.SuperReaderAlias | Should BeNullOrEmpty } - It "Fails when the wrong super user is defined" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - SuperUserAlias = "DEMO\WrongUser" - SuperReaderAlias = $testParams.SuperReaderAlias - } - } + + It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false } + + It "Updates the accounts when set is called" { + Set-TargetResource @testParams + + Assert-MockCalled Set-xSharePointCacheReaderPolicy + Assert-MockCalled Set-xSharePointCacheOwnerPolicy + Assert-MockCalled Update-xSharePointObject + } } - Context "Validate set method" { - It "Sets accounts when no existing account is set" { - Mock Invoke-xSharePointSPCmdlet { return @{ - Properties = @{} - } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPWebApplication" } - Mock Set-xSharePointCacheReaderPolicy { return $null } -Verifiable - Mock Set-xSharePointCacheOwnerPolicy { return $null } -Verifiable - Mock Update-xSharePointObject { return $null } -Verifiable + Context "The cache accounts have been configured correctly" { + Mock Get-SPWebApplication { return @{ + Properties = @{ + portalsuperuseraccount = $testParams.SuperUserAlias + portalsuperreaderaccount = $testParams.SuperReaderAlias + } + }} - Set-TargetResource @testParams + It "returns the values from the get method" { + $results = Get-TargetResource @testParams + $results.SuperUserAlias | Should Not BeNullOrEmpty + $results.SuperReaderAlias | Should Not BeNullOrEmpty + } - Assert-VerifiableMocks + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true } + } + + Context "Cache accounts have been configured, but the reader account is wrong" { + Mock Get-SPWebApplication { return @{ + Properties = @{ + SuperUserAlias = $testParams.SuperUserAlias + SuperReaderAlias = "WRONG\AccountName" + } + }} - It "Sets accounts when existing accounts are set" { - Mock Invoke-xSharePointSPCmdlet { return @{ - Properties = @{ - SuperUserAlias = $testParams.SuperUserAlias - SuperReaderAlias = $testParams.SuperReaderAlias - } - } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPWebApplication" } - Mock Set-xSharePointCacheReaderPolicy { return $null } -Verifiable - Mock Set-xSharePointCacheOwnerPolicy { return $null } -Verifiable - Mock Update-xSharePointObject { return $null } -Verifiable + It "returns false from the test method" { + Test-TargetResource @testParams | Should Be $false + } + It "sets the correct accounts to the web app again" { Set-TargetResource @testParams + Assert-MockCalled Update-xSharePointObject + } + } + + Context "Cache accounts have been configured, but the super account is wrong" { + Mock Get-SPWebApplication { return @{ + Properties = @{ + SuperUserAlias = "WRONG\AccountName" + SuperReaderAlias = $testParams.SuperReaderAlias + } + }} - Assert-VerifiableMocks + It "returns false from the test method" { + Test-TargetResource @testParams | Should Be $false + } + + It "sets the correct accounts to the web app again" { + Set-TargetResource @testParams + Assert-MockCalled Update-xSharePointObject } } } diff --git a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 index 5653127e7..38ef599b3 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 @@ -1,18 +1,15 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPCreateFarm" -Import-Module (Join-Path $RepoRoot "Modules\xSharePoint") Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") Describe "xSPCreateFarm" { @@ -23,101 +20,92 @@ Describe "xSPCreateFarm" { FarmAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) Passphrase = "passphrase" AdminContentDatabaseName = "Admin_Content" + CentralAdministrationPort = 1234 } - Context "Validate get method" { - It "Calls SP Farm to find the local environment settings" { - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter {$CmdletName -eq "Get-SPFarm"} - $results = Get-TargetResource @testParams - Assert-VerifiableMocks - } - } - - Context "Validate test method" { - It "Fails when local server is not in a farm" { - Mock -ModuleName $ModuleName Get-TargetResource { return @{} } - Test-TargetResource @testParams | Should Be $false - } - It "Passes when local server is in a farm" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - FarmConfigDatabaseName = "SP_Config" - } - } - Test-TargetResource @testParams | Should Be $true - } - } + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + Mock New-SPConfigurationDatabase {} + Mock Install-SPHelpCollection {} + Mock Initialize-SPResourceSecurity {} + Mock Install-SPService {} + Mock Install-SPFeature {} + Mock New-SPCentralAdministration {} + Mock Install-SPApplicationContent {} - Context "Validate set method" { - It "Creates a new SharePoint 2016 farm" { - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPConfigurationDatabase" -and $Arguments.ContainsKey("LocalServerRole") } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPHelpCollection" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Initialize-SPResourceSecurity" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPService" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPFeature" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPCentralAdministration" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPApplicationContent" } + $versionBeingTested = (Get-Item $Global:CurrentSharePointStubModule).Directory.BaseName + $majorBuildNumber = $versionBeingTested.Substring(0, $versionBeingTested.IndexOf(".")) - Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 16 } } + Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = $majorBuildNumber } } - Set-TargetResource @testParams + Context "no farm is configured locally and a supported version of SharePoint is installed" { + Mock Get-SPFarm { return $null } - Assert-VerifiableMocks + It "the get method returns null when the farm is not configured" { + Get-TargetResource @testParams | Should BeNullOrEmpty } - It "Creates a new SharePoint 2013 farm" { - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPConfigurationDatabase" -and (-not $Arguments.ContainsKey("LocalServerRole")) } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPHelpCollection" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Initialize-SPResourceSecurity" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPService" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPFeature" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPCentralAdministration" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPApplicationContent" } - - Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 15 } } + It "returns false from the test method" { + Test-TargetResource @testParams | Should Be $false + } + It "calls the appropriate cmdlets in the set method" { Set-TargetResource @testParams - - Assert-VerifiableMocks + switch ($majorBuildNumber) + { + 15 { + Assert-MockCalled New-SPConfigurationDatabase + } + 16 { + Assert-MockCalled New-SPConfigurationDatabase -ParameterFilter { $LocalServerRole -ne $null } + } + Default { + throw [Exception] "A supported version of SharePoint was not used in testing" + } + } + } + } - It "Throws an exception for unsupported SharePoint versions" { - Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 1 } } + Context "no farm is configured locally and an unsupported version of SharePoint is installed on the server" { + Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 14 } } + It "throws when an unsupported version is installed and set is called" { { Set-TargetResource @testParams } | Should throw } + } - It "Uses a default port for central admin when none is provided" { - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPConfigurationDatabase" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPHelpCollection" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Initialize-SPResourceSecurity" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPService" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPFeature" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPCentralAdministration" -and $Arguments.Port -eq 9999 } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPApplicationContent" } - - Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 15 } } - - Set-TargetResource @testParams - - Assert-VerifiableMocks + Context "a farm exists locally" { + Mock Get-SPFarm { return @{ + DefaultServiceAccount = @{ Name = $testParams.FarmAccount.UserName } + Name = $testParams.FarmConfigDatabaseName + }} + Mock Get-SPDatabase { return @(@{ + Name = $testParams.FarmConfigDatabaseName + Type = "Configuration Database" + Server = @{ Name = $testParams.DatabaseServer } + })} + Mock Get-SPWebApplication { return @(@{ + IsAdministrationWebApplication = $true + ContentDatabases = @(@{ Name = $testParams.AdminContentDatabaseName }) + Url = "http://$($env:ComputerName):$($testParams.CentralAdministrationPort)" + })} + + It "the get method returns values when the farm is configured" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty } - $testParams.Add("CentralAdministrationPort", 1234) - It "Uses a the specified port for central admin when it is provided" { - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPConfigurationDatabase" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPHelpCollection" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Initialize-SPResourceSecurity" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPService" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPFeature" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPCentralAdministration" -and $Arguments.Port -eq 1234 } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPApplicationContent" } + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true + } + } - Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 15 } } + Context "no farm is configured locally, a supported version is installed and no central admin port is specified" { + $testParams.Remove("CentralAdministrationPort") + It "uses a default value for the central admin port" { Set-TargetResource @testParams - - Assert-VerifiableMocks + Assert-MockCalled New-SPCentralAdministration -ParameterFilter { $Port -eq 9999 } } } } diff --git a/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 index 775cb20b5..e9cbebfe6 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 @@ -1,18 +1,16 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPDiagnosticLoggingSettings" -Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") -Force +Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") Describe "xSPDiagnosticLoggingSettings" { InModuleScope $ModuleName { @@ -30,99 +28,117 @@ Describe "xSPDiagnosticLoggingSettings" { ScriptErrorReportingEnabled = $true ScriptErrorReportingRequireAuth = $true ScriptErrorReportingDelay = 5 + EventLogFloodProtectionEnabled = $true + EventLogFloodProtectionThreshold = 10 + EventLogFloodProtectionTriggerPeriod = 5 + EventLogFloodProtectionQuietPeriod = 5 + EventLogFloodProtectionNotifyInterval = 5 } - Context "Validate get method" { - It "Calls the correct function to retrieve settings" { - Mock Invoke-xSharePointSPCmdlet { return @{}} -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPDiagnosticConfig" } - Get-TargetResource @testParams - Assert-VerifiableMocks + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + + Context "Diagnostic configuration can not be loaded" { + Mock Get-SPDiagnosticConfig { return $null } + + It "returns null from the get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty } - } - Context "Validate test method" { - It "Fails logging settings can not be found" { - Mock Get-TargetResource { return @{} } + It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false } - It "Passes when logging settings are applied correctly" { - Mock Get-TargetResource { - return @{ - AppAnalyticsAutomaticUploadEnabled = $testParams.AppAnalyticsAutomaticUploadEnabled - CustomerExperienceImprovementProgramEnabled = $testParams.CustomerExperienceImprovementProgramEnabled - ErrorReportingEnabled = $testParams.ErrorReportingEnabled - ErrorReportingAutomaticUploadEnabled = $testParams.ErrorReportingAutomaticUploadEnabled - DownloadErrorReportingUpdatesEnabled = $testParams.DownloadErrorReportingUpdatesEnabled - DaysToKeepLogs = $testParams.DaysToKeepLogs - LogMaxDiskSpaceUsageEnabled = $testParams.LogMaxDiskSpaceUsageEnabled - LogSpaceInGB = $testParams.LogSpaceInGB - LogPath = $testParams.LogPath - LogCutInterval = $testParams.LogCutInterval - ScriptErrorReportingEnabled = $testParams.ScriptErrorReportingEnabled - ScriptErrorReportingRequireAuth = $testParams.ScriptErrorReportingRequireAuth - ScriptErrorReportingDelay = $testParams.ScriptErrorReportingDelay - InstallAccount = $null - } - } + } + + Context "Diagnostic configuration can be loaded and it is configured correctly" { + Mock Get-SPDiagnosticConfig { return @{ + AppAnalyticsAutomaticUploadEnabled = $testParams.AppAnalyticsAutomaticUploadEnabled + CustomerExperienceImprovementProgramEnabled = $testParams.CustomerExperienceImprovementProgramEnabled + ErrorReportingEnabled = $testParams.ErrorReportingEnabled + ErrorReportingAutomaticUploadEnabled = $testParams.ErrorReportingAutomaticUploadEnabled + DownloadErrorReportingUpdatesEnabled = $testParams.DownloadErrorReportingUpdatesEnabled + DaysToKeepLogs = $testParams.DaysToKeepLogs + LogMaxDiskSpaceUsageEnabled = $testParams.LogMaxDiskSpaceUsageEnabled + LogDiskSpaceUsageGB = $testParams.LogSpaceInGB + LogLocation = $testParams.LogPath + LogCutInterval = $testParams.LogCutInterval + EventLogFloodProtectionEnabled = $testParams.EventLogFloodProtectionEnabled + EventLogFloodProtectionThreshold = $testParams.EventLogFloodProtectionThreshold + EventLogFloodProtectionTriggerPeriod = $testParams.EventLogFloodProtectionTriggerPeriod + EventLogFloodProtectionQuietPeriod = $testParams.EventLogFloodProtectionQuietPeriod + EventLogFloodProtectionNotifyInterval = $testParams.EventLogFloodProtectionNotifyInterval + ScriptErrorReportingEnabled = $testParams.ScriptErrorReportingEnabled + ScriptErrorReportingRequireAuth = $testParams.ScriptErrorReportingRequireAuth + ScriptErrorReportingDelay = $testParams.ScriptErrorReportingDelay + } } + + It "return values from the get method" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + } + + It "returns true from the test method" { Test-TargetResource @testParams | Should Be $true } - It "Fails when disk location is incorrect" { - Mock Get-TargetResource { - return @{ - AppAnalyticsAutomaticUploadEnabled = $testParams.AppAnalyticsAutomaticUploadEnabled - CustomerExperienceImprovementProgramEnabled = $testParams.CustomerExperienceImprovementProgramEnabled - ErrorReportingEnabled = $testParams.ErrorReportingEnabled - ErrorReportingAutomaticUploadEnabled = $testParams.ErrorReportingAutomaticUploadEnabled - DownloadErrorReportingUpdatesEnabled = $testParams.DownloadErrorReportingUpdatesEnabled - DaysToKeepLogs = $testParams.DaysToKeepLogs - LogMaxDiskSpaceUsageEnabled = $testParams.LogMaxDiskSpaceUsageEnabled - LogSpaceInGB = $testParams.LogSpaceInGB - LogPath = "C:\logs" - LogCutInterval = $testParams.LogCutInterval - EventLogFloodProtectionEnabled = $testParams.EventLogFloodProtectionEnabled - EventLogFloodProtectionThreshold = $testParams.EventLogFloodProtectionThreshold - EventLogFloodProtectionTriggerPeriod = $testParams.EventLogFloodProtectionTriggerPeriod - EventLogFloodProtectionQuietPeriod = $testParams.EventLogFloodProtectionQuietPeriod - EventLogFloodProtectionNotifyInterval = $testParams.EventLogFloodProtectionNotifyInterval - ScriptErrorReportingEnabled = $testParams.ScriptErrorReportingEnabled - ScriptErrorReportingRequireAuth = $testParams.ScriptErrorReportingRequireAuth - ScriptErrorReportingDelay = $testParams.ScriptErrorReportingDelay - } - } + } + + Context "Diagnostic configuration can be loaded and the log path is not set correctly" { + Mock Get-SPDiagnosticConfig { return @{ + AppAnalyticsAutomaticUploadEnabled = $testParams.AppAnalyticsAutomaticUploadEnabled + CustomerExperienceImprovementProgramEnabled = $testParams.CustomerExperienceImprovementProgramEnabled + ErrorReportingEnabled = $testParams.ErrorReportingEnabled + ErrorReportingAutomaticUploadEnabled = $testParams.ErrorReportingAutomaticUploadEnabled + DownloadErrorReportingUpdatesEnabled = $testParams.DownloadErrorReportingUpdatesEnabled + DaysToKeepLogs = $testParams.DaysToKeepLogs + LogMaxDiskSpaceUsageEnabled = $testParams.LogMaxDiskSpaceUsageEnabled + LogDiskSpaceUsageGB = $testParams.LogSpaceInGB + LogLocation = "C:\incorrect\value" + LogCutInterval = $testParams.LogCutInterval + EventLogFloodProtectionEnabled = $testParams.EventLogFloodProtectionEnabled + EventLogFloodProtectionThreshold = $testParams.EventLogFloodProtectionThreshold + EventLogFloodProtectionTriggerPeriod = $testParams.EventLogFloodProtectionTriggerPeriod + EventLogFloodProtectionQuietPeriod = $testParams.EventLogFloodProtectionQuietPeriod + EventLogFloodProtectionNotifyInterval = $testParams.EventLogFloodProtectionNotifyInterval + ScriptErrorReportingEnabled = $testParams.ScriptErrorReportingEnabled + ScriptErrorReportingRequireAuth = $testParams.ScriptErrorReportingRequireAuth + ScriptErrorReportingDelay = $testParams.ScriptErrorReportingDelay + } } + + + It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false } - It "Fails when log size is incorrect" { - Mock Get-TargetResource { - return @{ - AppAnalyticsAutomaticUploadEnabled = $testParams.AppAnalyticsAutomaticUploadEnabled - CustomerExperienceImprovementProgramEnabled = $testParams.CustomerExperienceImprovementProgramEnabled - ErrorReportingEnabled = $testParams.ErrorReportingEnabled - ErrorReportingAutomaticUploadEnabled = $testParams.ErrorReportingAutomaticUploadEnabled - DownloadErrorReportingUpdatesEnabled = $testParams.DownloadErrorReportingUpdatesEnabled - DaysToKeepLogs = $testParams.DaysToKeepLogs - LogMaxDiskSpaceUsageEnabled = $testParams.LogMaxDiskSpaceUsageEnabled - LogSpaceInGB = 1 - LogPath = $testParams.LogPath - LogCutInterval = $testParams.LogCutInterval - EventLogFloodProtectionEnabled = $testParams.EventLogFloodProtectionEnabled - EventLogFloodProtectionThreshold = $testParams.EventLogFloodProtectionThreshold - EventLogFloodProtectionTriggerPeriod = $testParams.EventLogFloodProtectionTriggerPeriod - EventLogFloodProtectionQuietPeriod = $testParams.EventLogFloodProtectionQuietPeriod - EventLogFloodProtectionNotifyInterval = $testParams.EventLogFloodProtectionNotifyInterval - ScriptErrorReportingEnabled = $testParams.ScriptErrorReportingEnabled - ScriptErrorReportingRequireAuth = $testParams.ScriptErrorReportingRequireAuth - ScriptErrorReportingDelay = $testParams.ScriptErrorReportingDelay - } - } + } + + Context "Diagnostic configuration can be loaded and the log size is not set correctly" { + Mock Get-SPDiagnosticConfig { return @{ + AppAnalyticsAutomaticUploadEnabled = $testParams.AppAnalyticsAutomaticUploadEnabled + CustomerExperienceImprovementProgramEnabled = $testParams.CustomerExperienceImprovementProgramEnabled + ErrorReportingEnabled = $testParams.ErrorReportingEnabled + ErrorReportingAutomaticUploadEnabled = $testParams.ErrorReportingAutomaticUploadEnabled + DownloadErrorReportingUpdatesEnabled = $testParams.DownloadErrorReportingUpdatesEnabled + DaysToKeepLogs = $testParams.DaysToKeepLogs + LogMaxDiskSpaceUsageEnabled = $testParams.LogMaxDiskSpaceUsageEnabled + LogDiskSpaceUsageGB = 1 + LogLocation = $testParams.LogPath + LogCutInterval = $testParams.LogCutInterval + EventLogFloodProtectionEnabled = $testParams.EventLogFloodProtectionEnabled + EventLogFloodProtectionThreshold = $testParams.EventLogFloodProtectionThreshold + EventLogFloodProtectionTriggerPeriod = $testParams.EventLogFloodProtectionTriggerPeriod + EventLogFloodProtectionQuietPeriod = $testParams.EventLogFloodProtectionQuietPeriod + EventLogFloodProtectionNotifyInterval = $testParams.EventLogFloodProtectionNotifyInterval + ScriptErrorReportingEnabled = $testParams.ScriptErrorReportingEnabled + ScriptErrorReportingRequireAuth = $testParams.ScriptErrorReportingRequireAuth + ScriptErrorReportingDelay = $testParams.ScriptErrorReportingDelay + } } + + It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false } - } - Context "Validate set method" { - It "Calls the correct function to retrieve settings" { - Mock Invoke-xSharePointSPCmdlet { return @{}} -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPDiagnosticConfig" -and $Arguments.ContainsKey("InstallAccount") -eq $false } + It "repairs the diagnostic configuration" { + Mock Set-SPDiagnosticConfig {} Set-TargetResource @testParams - Assert-VerifiableMocks + Assert-MockCalled Set-SPDiagnosticConfig } } } diff --git a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 index 668432a07..8f7eedadb 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 @@ -1,19 +1,17 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPDistributedCacheService" -Import-Module (Join-Path $RepoRoot "Modules\xSharePoint") Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") +Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\Modules\xSharePoint.DistributedCache\xSharePoint.DistributedCache.psm1") Describe "xSPDistributedCacheService" { InModuleScope $ModuleName { @@ -21,129 +19,93 @@ Describe "xSPDistributedCacheService" { Name = "AppFabricCache" Ensure = "Present" CacheSizeInMB = 1024 - ServiceAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) + ServiceAccount = "DOMAIN\user" CreateFirewallRules = $true } - Context "Validate get method" { - It "Returns local cache settings correctly when it exists" { - Mock Invoke-xSharePointDCCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Use-CacheCluster" } - Mock Invoke-xSharePointDCCmdlet { return @{ - PortNo = 22233 - } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-CacheHost" } - Mock Invoke-xSharePointDCCmdlet { return @{ - HostName = $env:COMPUTERNAME - Port = 22233 - Size = $testParams.CacheSizeInMB - } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-AFCacheHostConfiguration" } - - Mock Get-WmiObject { @{ StartName = $testParams.ServiceAccount.UserName } } -Verifiable - Mock Get-NetFirewallRule { @{} } -Verifiable - - $result = Get-TargetResource @testParams - - Assert-VerifiableMocks + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path + Import-Module "$RepoRoot\Tests\Stubs\DistributedCache\DistributedCache.psm1" -WarningAction SilentlyContinue + + Mock Initialize-xSharePointPSSnapin { } + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.DistributedCache" + Mock Use-CacheCluster { } + Mock Get-WmiObject { return @{ StartName = $testParams.ServiceAccount } } + Mock Get-NetFirewallRule { return @{} } + Mock Get-NetFirewallRule { return @{} } -ModuleName "xSharePoint.DistributedCache" + Mock Enable-NetFirewallRule { } -ModuleName "xSharePoint.DistributedCache" + Mock New-NetFirewallRule { } -ModuleName "xSharePoint.DistributedCache" + Mock Disable-NetFirewallRule { } -ModuleName "xSharePoint.DistributedCache" + Mock Add-SPDistributedCacheServiceInstance { } -ModuleName "xSharePoint.DistributedCache" + Mock Update-SPDistributedCacheSize { } -ModuleName "xSharePoint.DistributedCache" + Mock Get-SPManagedAccount { return @{} } -ModuleName "xSharePoint.DistributedCache" + Mock Get-SPFarm { return @{ + Services = @(@{ + Name = "AppFabricCachingService" + ProcessIdentity = @{ ManagedAccount = $null } + }) + } } -ModuleName "xSharePoint.DistributedCache" + Mock Update-xSharePointDistributedCacheService { } -ModuleName "xSharePoint.DistributedCache" + + + Context "Distributed cache is not configured" { + Mock Get-CacheHost { return $null } + + It "returns null from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - It "Returns local cache settings correctly when it does not exist" { - Mock Invoke-xSharePointDCCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Use-CacheCluster" } - Mock Invoke-xSharePointDCCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-CacheHost" } - $result = Get-TargetResource @testParams - - $result | Should BeNullOrEmpty - - Assert-VerifiableMocks - } - } - - Context "Validate test method" { - It "Fails when no cache is present locally but should be" { - Mock -ModuleName $ModuleName Get-TargetResource { return @{} } + It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false } - It "Passes when cache is present and size is correct" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - CacheSizeInMB = $testParams.CacheSizeInMB - ServiceAccount = $testParams.ServiceAccount.UserName - CreateFirewallRules = $testParams.CreateFirewallRules - Ensure = "Present" - } - } - Test-TargetResource @testParams | Should Be $true - } - It "Fails when cache is present but size is not correct" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - CacheSizeInMB = 1 - ServiceAccount = $testParams.ServiceAccount.UserName - CreateFirewallRules = $testParams.CreateFirewallRules - Ensure = "Present" - } - } - Test-TargetResource @testParams | Should Be $false + + It "Sets up the cache correctly" { + Set-TargetResource @testParams + Assert-MockCalled Add-SPDistributedCacheServiceInstance -ModuleName "xSharePoint.DistributedCache" } + } - $testParams.Ensure = "Absent" + Context "Distributed cache is configured correctly and running as required" { + Mock Get-AFCacheHostConfiguration { return @{ + Size = $testParams.CacheSizeInMB + }} + Mock Get-CacheHost { return @{ PortNo = 22233 } } - It "Fails when cache is present but not should be" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - CacheSizeInMB = $testParams.CacheSizeInMB - ServiceAccount = $testParams.ServiceAccount.UserName - CreateFirewallRules = $testParams.CreateFirewallRules - Ensure = "Present" - } - } - Test-TargetResource @testParams | Should Be $false - } - It "Passes when cache is not present and should not be" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - CacheSizeInMB = $testParams.CacheSizeInMB - ServiceAccount = $testParams.ServiceAccount.UserName - CreateFirewallRules = $testParams.CreateFirewallRules - Ensure = "Absent" - } - } + It "returns true from the test method" { Test-TargetResource @testParams | Should Be $true } } - Context "Validate set method" { + Context "Distributed cache is configured but the required firewall rules are not deployed" { + Mock Get-NetFirewallRule { return $null } - $testParams.Ensure = "Present" - - It "Provisions distributed cache locally when is should be present, installing firewall when asked for" { - Mock Enable-xSharePointDCIcmpFireWallRule { return $null } -Verifiable - Mock Enable-xSharePointDCFireWallRule { return $null } -Verifiable - - Mock Add-xSharePointDistributedCacheServer { return $null } -Verifiable -ParameterFilter { $CacheSizeInMB -eq $testParams.CacheSizeInMB } - - Set-TargetResource @testParams - - Assert-VerifiableMocks + It "returns false from the test method" { + Test-TargetResource @testParams | Should Be $false } - $testParams.CreateFirewallRules = $false - - It "Provisions distributed cache locally when is should be present, not installing firewall" { - Mock Add-xSharePointDistributedCacheServer { return $null } -Verifiable -ParameterFilter { $CacheSizeInMB -eq $testParams.CacheSizeInMB } - + It "shuts down the distributed cache service" { Set-TargetResource @testParams - - Assert-VerifiableMocks + Assert-MockCalled Enable-NetFirewallRule -ModuleName "xSharePoint.DistributedCache" } + } + Context "Distributed cache is confgured but should not be running on this machine" { $testParams.Ensure = "Absent" + Mock Get-AFCacheHostConfiguration { return @{ + Size = $testParams.CacheSizeInMB + }} + Mock Get-CacheHost { return @{ PortNo = 22233 } } + Mock Remove-xSharePointDistributedCacheServer { } + Mock Get-NetFirewallRule { return @{} } -ModuleName "xSharePoint.DistributedCache" + + It "returns false from the test method" { + Test-TargetResource @testParams | Should Be $false + } - It "Removes distributed cache locally when is should not be present" { - Mock Remove-xSharePointDistributedCacheServer { return $null } -Verifiable -ParameterFilter { $CacheSizeInMB -eq $testParams.CacheSizeInMB } - Mock Disable-xSharePointDCFireWallRule { return $null } -Verifiable - + It "shuts down the distributed cache service" { Set-TargetResource @testParams - - Assert-VerifiableMocks + Assert-MockCalled Remove-xSharePointDistributedCacheServer + Assert-MockCalled Disable-NetFirewallRule -ModuleName "xSharePoint.DistributedCache" } } } diff --git a/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 index ce4a166b3..3a0ea039a 100644 --- a/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 @@ -1,5 +1,7 @@ [CmdletBinding()] -param() +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 { @@ -10,6 +12,7 @@ $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPFeature" Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") @@ -23,164 +26,121 @@ Describe "xSPFeature" { Ensure = "Present" } - Context "Validate get method" { - It "Returns as empty where a feature is not installed in the farm" { - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPFeature" -and $Arguments.Count -eq 1 } + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + Mock Enable-SPFeature {} + Mock Disable-SPFeature {} - Get-TargetResource @testParams + Context "A feature that is not installed in the farm should be turned on" { + Mock Get-SPFeature { return $null } -ParameterFilter { $Farm -ne $true } - Assert-VerifiableMocks + It "returns null from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - It "Returns a disabled state when an installed feature is not found at a farm scope" { - Mock Invoke-xSharePointSPCmdlet { return @{ Name = $testParams.Name } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPFeature" -and $Arguments.Count -eq 1 } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPFeature" -and $Arguments.Count -eq 2 } - $result = Get-TargetResource @testParams + It "returns false from the test method" { + Test-TargetResource @testParams | Should Be $false + } + } - $result.Ensure | Should be "Absent" + Context "A farm scoped feature is not enabled and should be" { + Mock Get-SPFeature { return $null } -ParameterFilter { $Farm -eq $true } + $testParams.FeatureScope = "Farm" - Assert-VerifiableMocks + It "returns null from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - $testParams.FeatureScope = "Site" - It "Returns a disabled state when an installed feature is not found at a site scope" { - Mock Invoke-xSharePointSPCmdlet { return @{ Name = $testParams.Name } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPFeature" -and $Arguments.Count -eq 1 } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPFeature" -and $Arguments.Count -eq 2 } - $result = Get-TargetResource @testParams + It "returns false from the test method" { + Test-TargetResource @testParams | Should Be $false + } - $result.Ensure | Should be "Absent" + It "enables the feature in the set method" { + Set-TargetResource @testParams - Assert-VerifiableMocks + Assert-MockCalled Enable-SPFeature } - It "Returns an enabled state when an installed feature is found at a site scope" { - Mock Invoke-xSharePointSPCmdlet { return @{ Name = $testParams.Name } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPFeature" -and $Arguments.Count -eq 1 } - Mock Invoke-xSharePointSPCmdlet { return @{ Name = $testParams.Name } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPFeature" -and $Arguments.Count -eq 2 } - - $result = Get-TargetResource @testParams + } - $result.Ensure | Should be "Present" + Context "A site collection scoped feature is not enabled and should be" { + Mock Get-SPFeature { return $null } -ParameterFilter { $Site -eq $true } + $testParams.FeatureScope = "Site" - Assert-VerifiableMocks + It "returns null from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - $testParams.FeatureScope = "Farm" - It "Returns an enabled state when an installed feature is found at a farm scope" { - Mock Invoke-xSharePointSPCmdlet { return @{ Name = $testParams.Name } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPFeature" -and $Arguments.Count -eq 1 } - Mock Invoke-xSharePointSPCmdlet { return @{ Name = $testParams.Name } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPFeature" -and $Arguments.Count -eq 2 } - $result = Get-TargetResource @testParams + It "returns false from the test method" { + Test-TargetResource @testParams | Should Be $false + } - $result.Ensure | Should be "Present" + It "enables the feature in the set method" { + Set-TargetResource @testParams - Assert-VerifiableMocks + Assert-MockCalled Enable-SPFeature } } - Context "Validate test method" { - It "Passes when a farm feature is enabaled and should be" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - Ensure = "Present" - } - } - Test-TargetResource @testParams | Should Be $true + Context "A farm scoped feature is enabled and should not be" { + Mock Get-SPFeature { return @{} } + Mock Get-SPFeature { return @{} } -ParameterFilter { $Farm -eq $true } + $testParams.FeatureScope = "Farm" + $testParams.Ensure = "Absent" + + It "returns null from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Present" } - It "Fails when a farm feature is not enabaled and should be" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - Ensure = "Absent" - } - } + + It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false } - $testParams.Ensure = "Absent" + It "enables the feature in the set method" { + Set-TargetResource @testParams - It "Passes when a farm feature is not enabaled and should not be" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - Ensure = "Absent" - } - } - Test-TargetResource @testParams | Should Be $true - } - It "Fails when a farm feature is enabaled and should not be" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - Ensure = "Present" - } - } - Test-TargetResource @testParams | Should Be $false + Assert-MockCalled Disable-SPFeature } + } - $testParams.Ensure = "Present" + Context "A site collection scoped feature is enabled and should not be" { + Mock Get-SPFeature { return @{} } + Mock Get-SPFeature { return @{} } -ParameterFilter { $Site -eq $true } $testParams.FeatureScope = "Site" - It "Passes when a site feature is enabaled and should be" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - Ensure = "Present" - } - } - Test-TargetResource @testParams | Should Be $true + It "returns null from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Present" } - It "Fails when a site feature is not enabaled and should be" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - Ensure = "Absent" - } - } + + It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false } - $testParams.Ensure = "Absent" + It "enables the feature in the set method" { + Set-TargetResource @testParams - It "Passes when a site feature is not enabaled and should not be" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - Ensure = "Absent" - } - } - Test-TargetResource @testParams | Should Be $true - } - It "Fails when a site feature is enabaled and should not be" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - Ensure = "Present" - } - } - Test-TargetResource @testParams | Should Be $false + Assert-MockCalled Disable-SPFeature } } - Context "Validate set method" { - + Context "A farm scoped feature is enabled and should be" { + Mock Get-SPFeature { return @{} } + Mock Get-SPFeature { return @{} } -ParameterFilter { $Farm -eq $true } + $testParams.FeatureScope = "Farm" $testParams.Ensure = "Present" - It "Enables a feature that should be on" { - Mock Invoke-xSharePointSPCmdlet { return $false } -Verifiable -ParameterFilter { $CmdletName -eq "Enable-SPFeature" } - - Set-TargetResource @testParams - - Assert-VerifiableMocks + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true } + } - $testParams.Ensure = "Absent" - - It "Disables a feature that should be turned off" { - Mock Invoke-xSharePointSPCmdlet { return $false } -Verifiable -ParameterFilter { $CmdletName -eq "Disable-SPFeature" } - - Set-TargetResource @testParams + Context "A site collection scoped feature is enabled and should be" { + Mock Get-SPFeature { return @{} } + Mock Get-SPFeature { return @{} } -ParameterFilter { $Site -eq $testParams.Url } + $testParams.FeatureScope = "Site" - Assert-VerifiableMocks + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true } } - } + } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 index dff6e1289..b224206fb 100644 --- a/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 @@ -1,10 +1,7 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest @@ -22,79 +19,59 @@ Describe "xSPInstall" { Ensure = "Present" } - Context "Validate get method" { + Context "SharePoint binaries are not installed but should be" { + Mock Get-CimInstance { return $null } - It "Returns false when SharePoint is not detected" { - Mock Get-CimInstance { return $null } -Verifiable - $result = Get-TargetResource @testParams - Assert-VerifiableMocks + It "returns absent from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - It "Returns true when SharePoint is detected" { - Mock Get-CimInstance { return @{} } -Verifiable - $result = Get-TargetResource @testParams - Assert-VerifiableMocks + It "returns false from the test method" { + Test-TargetResource @testParams | Should Be $false } } - Context "Validate test method" { - It "Passes when SharePoint is installed" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - BinaryDir = $testParams.BinaryDir - ProductKey = $testParams.ProductKey - Ensure = "Present" - } - } - Test-TargetResource @testParams | Should Be $true - } - It "Fails when SharePoint is not installed" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - BinaryDir = $null - ProductKey = $testParams.ProductKey - Ensure = "Absent" - } - } - Test-TargetResource @testParams | Should Be $false + Context "SharePoint binaries are installed and should be" { + Mock Get-CimInstance { return @{} } + + It "returns present from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Present" } - $testParams.Ensure = "Absent" - It "Throws an error if SharePoint should be absent" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - BinaryDir = $null - ProductKey = $testParams.ProductKey - Ensure = "Absent" - } - } - { Test-TargetResource @testParams } | Should Throw + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true } - $testParams.Ensure = "Present" } - Context "Validate set method" { - It "Reboots the server after a successful install" { - Mock Start-Process { @{ ExitCode = 0 }} -Verifiable + Context "SharePoint installation executes as expected" { + Mock Start-Process { @{ ExitCode = 0 }} + It "reboots the server after a successful installation" { Set-TargetResource @testParams - $global:DSCMachineStatus | Should Be 1 - - Assert-VerifiableMocks } - It "Throws an error on unknown exit code" { - Mock Start-Process { @{ ExitCode = -1 }} -Verifiable + } + + Context "SharePoint installation fails" { + Mock Start-Process { @{ ExitCode = -1 }} + It "throws an exception on an unknown exit code" { { Set-TargetResource @testParams } | Should Throw + } + } - Assert-VerifiableMocks + $testParams.Ensure = "Absent" + + Context "SharePoint binaries are installed and should not be" { + Mock Get-CimInstance { return @{} } + + It "throws in the test method because uninstall is unsupported" { + { Test-TargetResource @testParams } | Should Throw } - $testParams.Ensure = "Absent" - It "Throws an error when SharePoint should be absent" { + + It "throws in the set method because uninstall is unsupported" { { Set-TargetResource @testParams } | Should Throw } - $testParams.Ensure = "Present" } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 index ca9511ac6..ccbf690e8 100644 --- a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 @@ -1,15 +1,13 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPInstallPrereqs" Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") @@ -22,92 +20,110 @@ Describe "xSPInstallPrereqs" { Ensure = "Present" } - Context "Validate get method" { - It "Checks windows features as well as installed products" { - Mock Get-xSharePointAssemblyVersion { return 16 } -Verifiable - Mock Invoke-Command { return $null } -Verifiable -ParameterFilter { $ScriptBlock.ToString().Contains("Get-WindowsFeature") -eq $true } - Mock Get-CimInstance { return @{} } -Verifiable + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + $versionBeingTested = (Get-Item $Global:CurrentSharePointStubModule).Directory.BaseName + $majorBuildNumber = $versionBeingTested.Substring(0, $versionBeingTested.IndexOf(".")) - Get-TargetResource @testParams + Mock Get-xSharePointAssemblyVersion { return $majorBuildNumber } + Mock Check-xSharePointInstalledProductRegistryKey { return $null } - Assert-VerifiableMocks - } - } + Context "Prerequisites are not installed but should be" { + Mock Invoke-Command { @( @{ Name = "ExampleFeature"; Installed = $false}) } -ParameterFilter { $ScriptBlock.ToString().Contains("Get-WindowsFeature") -eq $true } + Mock Get-CimInstance { return @() } + Mock Get-ChildItem { return $null } - Context "Validate test method" { - It "Passes when all Prereqs are installed" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - InstallerPath = "C:\SPInstall" - OnlineMode = $true - Ensure = "Present" - } - } - Test-TargetResource @testParams | Should Be $true + It "returns absent from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - It "Fails when there are Prereqs missing" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - InstallerPath = "C:\SPInstall" - OnlineMode = $true - Ensure = "Absent" - } - } + + It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false } - $testParams.Ensure = "Absent" - It "Throws an error if SharePoint prereqs should be absent" { - { Test-TargetResource @testParams } | Should Throw + + It "Calls the prerequisite installer from the set method and records the need for a reboot" { + Mock Start-Process { return @{ ExitCode = 3010 } } + + Set-TargetResource @testParams + Assert-MockCalled Start-Process } - $testParams.Ensure = "Present" - } - Context "Validate set method" { - It "Runs the installer and exists after success" { - Mock Get-xSharePointAssemblyVersion { return 15 } - Mock Start-Process { return @{ ExitCode = 0 } } -Verifiable + It "Calls the prerequisite installer from the set method and a pending reboot is preventing it from running" { + Mock Start-Process { return @{ ExitCode = 1001 } } + + Set-TargetResource @testParams + Assert-MockCalled Start-Process + } + + It "Calls the prerequisite installer from the set method and passes a successful installation" { + Mock Start-Process { return @{ ExitCode = 0 } } + Set-TargetResource @testParams - Assert-VerifiableMocks + Assert-MockCalled Start-Process } - It "Detects errors in the installer" { - Mock Get-xSharePointAssemblyVersion { return 15 } + It "Calls the prerequisite installer from the set method when the prerequisite installer is already running" { Mock Start-Process { return @{ ExitCode = 1 } } - { Set-TargetResource @testParams } | Should throw "already running" - + + { Set-TargetResource @testParams } | Should Throw "already running" + } + + It "Calls the prerequisite installer from the set method and invalid arguments are passed to the installer" { Mock Start-Process { return @{ ExitCode = 2 } } - { Set-TargetResource @testParams } | Should throw "Invalid command line parameters" - Mock Start-Process { return @{ ExitCode = -1 } } - { Set-TargetResource @testParams } | Should throw "unknown exit code" + { Set-TargetResource @testParams } | Should Throw "Invalid command line parameters" } - It "Detects reboot conditions in the installer" { - Mock Get-xSharePointAssemblyVersion { return 15 } + It "Calls the prerequisite installer from the set method and throws for unknown error codes" { + Mock Start-Process { return @{ ExitCode = -1 } } - $global:DSCMachineStatus = 0 - Mock Start-Process { return @{ ExitCode = 1001 } } - Set-TargetResource @testParams - $global:DSCMachineStatus | Should Be 1 - - $global:DSCMachineStatus = 0 - Mock Start-Process { return @{ ExitCode = 3010 } } - Set-TargetResource @testParams - $global:DSCMachineStatus | Should Be 1 + { Set-TargetResource @testParams } | Should Throw "unknown exit code" } + } - $testParams.OnlineMode = $false - It "Throws an error if offline mode is run without prerequisite location parameters" { - Mock Get-xSharePointAssemblyVersion { return 15 } + Context "Prerequisites are installed and should be" { + Mock Invoke-Command { return @( @{ Name = "ExampleFeature"; Installed = $true }) } -ParameterFilter { $ScriptBlock.ToString().Contains("Get-WindowsFeature") -eq $true } + if ($majorBuildNumber -eq 15) { + Mock Get-CimInstance { return @( + @{ Name = "Microsoft CCR and DSS Runtime 2008 R3"} + @{ Name = "Microsoft Sync Framework Runtime v1.0 SP1 (x64)"} + @{ Name = "AppFabric 1.1 for Windows Server"} + @{ Name = "WCF Data Services 5.6.0 Runtime"} + @{ Name = "WCF Data Services 5.0 (for OData v3) Primary Components"} + @{ Name = "Microsoft SQL Server 2008 R2 Native Client"} + @{ Name = "Active Directory Rights Management Services Client 2.0"} + )} + } + if ($majorBuildNumber -eq 16) { + Mock Get-CimInstance { return @( + @{ Name = "Microsoft CCR and DSS Runtime 2008 R3"} + @{ Name = "Microsoft Sync Framework Runtime v1.0 SP1 (x64)"} + @{ Name = "AppFabric 1.1 for Windows Server"} + @{ Name = "WCF Data Services 5.6.0 Runtime"} + @{ Name = "Microsoft ODBC Driver 11 for SQL Server"} + @{ Name = "Microsoft Visual C++ 2013 x64 Minimum Runtime - 12.0.21005"} + @{ Name = "Microsoft Visual C++ 2013 x64 Additional Runtime - 12.0.21005"} + @{ Name = "Microsoft SQL Server 2012 Native Client"} + @{ Name = "Active Directory Rights Management Services Client 2.1"} + )} + } + Mock Get-ChildItem { return $null } + Mock Check-xSharePointInstalledProductRegistryKey { return @( @{Example = $true } ) } + + It "returns present from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Present" + } - { Set-TargetResource @testParams } | Should throw "offline mode" + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true } + } + Context "Prerequisites are installed but should not be" { $testParams.Ensure = "Absent" - It "Throws an error if SharePoint prereqs should be absent" { - { Set-TargetResource @testParams } | Should Throw + + It "throws an exception from the set method" { + {Set-TargetResource @testParams} | Should Throw } - $testParams.Ensure = "Present" } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 index 2600e602c..b91bf63c3 100644 --- a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 @@ -1,15 +1,13 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPJoinFarm" Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") @@ -22,71 +20,79 @@ Describe "xSPJoinFarm" { Passphrase = "passphrase" } - Context "Validate get method" { - It "Calls SP Farm to find the local environment settings" { - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter {$CmdletName -eq "Get-SPFarm"} - $results = Get-TargetResource @testParams - Assert-VerifiableMocks - } - } + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + Mock Connect-SPConfigurationDatabase {} + Mock Install-SPHelpCollection {} + Mock Initialize-SPResourceSecurity {} + Mock Install-SPService {} + Mock Install-SPFeature {} + Mock New-SPCentralAdministration {} + Mock Install-SPApplicationContent {} + Mock Start-Service {} + Mock Invoke-Command {} -ParameterFilter { $ScriptBlock.ToString().Contains("Start-Sleep") -eq $true } - Context "Validate test method" { - It "Fails when local server is not in a farm" { - Mock -ModuleName $ModuleName Get-TargetResource { return @{} } - Test-TargetResource @testParams | Should Be $false - } - It "Passes when local server is in a farm" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - FarmConfigDatabaseName = "SP_Config" - } - } - Test-TargetResource @testParams | Should Be $true - } - } + $versionBeingTested = (Get-Item $Global:CurrentSharePointStubModule).Directory.BaseName + $majorBuildNumber = $versionBeingTested.Substring(0, $versionBeingTested.IndexOf(".")) - Context "Validate set method" { - It "Joins a new SharePoint 2016 farm" { - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Connect-SPConfigurationDatabase" -and $Arguments.ContainsKey("LocalServerRole") } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPHelpCollection" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Initialize-SPResourceSecurity" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPService" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPFeature" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPApplicationContent" } + Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = $majorBuildNumber } } - Mock Invoke-Command { return $null } - Mock Start-Service { return $null } -Verifiable - Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 16 } } + Context "no farm is configured locally and a supported version of SharePoint is installed" { + Mock Get-SPFarm { return $null } - Set-TargetResource @testParams - - Assert-VerifiableMocks + It "the get method returns null when the farm is not configured" { + Get-TargetResource @testParams | Should BeNullOrEmpty } - It "Joins a new SharePoint 2013 farm" { - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Connect-SPConfigurationDatabase" -and (-not $Arguments.ContainsKey("LocalServerRole")) } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPHelpCollection" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Initialize-SPResourceSecurity" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPService" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPFeature" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Install-SPApplicationContent" } - - Mock Invoke-Command { return $null } - Mock Start-Service { return $null } -Verifiable - - Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 15 } } + It "returns false from the test method" { + Test-TargetResource @testParams | Should Be $false + } + It "calls the appropriate cmdlets in the set method" { Set-TargetResource @testParams - - Assert-VerifiableMocks + switch ($majorBuildNumber) + { + 15 { + Assert-MockCalled Connect-SPConfigurationDatabase + } + 16 { + Assert-MockCalled Connect-SPConfigurationDatabase -ParameterFilter { $LocalServerRole -ne $null } + } + Default { + throw [Exception] "A supported version of SharePoint was not used in testing" + } + } + } + } - It "Throws an exception for unsupported SharePoint versions" { - Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 1 } } + Context "no farm is configured locally and an unsupported version of SharePoint is installed on the server" { + Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 14 } } + It "throws when an unsupported version is installed and set is called" { { Set-TargetResource @testParams } | Should throw } } + + Context "a farm exists locally" { + Mock Get-SPFarm { return @{ + DefaultServiceAccount = @{ Name = $testParams.FarmAccount.UserName } + Name = $testParams.FarmConfigDatabaseName + }} + Mock Get-SPDatabase { return @(@{ + Name = $testParams.FarmConfigDatabaseName + Type = "Configuration Database" + Server = @{ Name = $testParams.DatabaseServer } + })} + + It "the get method returns values when the farm is configured" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + } + + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true + } + } } } \ No newline at end of file diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 index 350029685..24a679b4a 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 @@ -1,18 +1,15 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPManagedAccount" -Import-Module (Join-Path $RepoRoot "Modules\xSharePoint") Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") Describe "xSPManagedAccount" { @@ -25,76 +22,74 @@ Describe "xSPManagedAccount" { AccountName = "username" } - Context "Validate get method" { - It "Calls the service application picker with the appropriate type name" { - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPManagedAccount" -and $Arguments.Identity -eq $testParams.Account.UserName } - - $results = Get-TargetResource @testParams + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + Mock New-SPManagedAccount { } + Mock Set-SPManagedAccount { } + + Context "The specified managed account does not exist in the farm" { + Mock Get-SPManagedAccount { return $null } - Assert-VerifiableMocks + It "returns null from the get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty } - } - Context "Validate test method" { - It "Fails when managed account does not exist in the farm" { - Mock -ModuleName $ModuleName Get-TargetResource { return @{} } + It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false } - It "Passes when the account exists and has correct settings" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - AccountName = $testParams.AccountName - EmailNotification = $testParams.EmailNotification - PreExpireDays = $testParams.PreExpireDays - Schedule = $testParams.Schedule - } - } - Test-TargetResource @testParams | Should Be $true + + It "calls the new and set methods from the set function" { + Set-TargetResource @testParams + Assert-MockCalled New-SPManagedAccount + Assert-MockCalled Set-SPManagedAccount } - It "Fails when the account exists and the schedule doesnt match" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - AccountName = $testParams.AccountName - EmailNotification = $testParams.EmailNotification - PreExpireDays = $testParams.PreExpireDays - Schedule = "Weekly Friday between 01:00 and 02:00" - } - } + } + + Context "The specified managed account exists but has an incorrect schedule" { + Mock Get-SPManagedAccount { return @{ + Username = $testParams.AccountName + DaysBeforeChangeToEmail = $testParams.EmailNotification + DaysBeforeExpiryToChange = $testParams.PreExpireDays + ChangeSchedule = "wrong schedule" + }} + + It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false } - It "Fails when the account exists and the email settings dont match" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - AccountName = $testParams.AccountName - EmailNotification = 0 - PreExpireDays = 0 - Schedule = $testParams.Schedule - } - } - Test-TargetResource @testParams | Should Be $false + + It "calls the set methods from the set function" { + Set-TargetResource @testParams + Assert-MockCalled Set-SPManagedAccount } } - Context "Validate set method" { - It "Creates a new account when none exists" { - Mock Get-TargetResource { return @{} } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPManagedAccount" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPManagedAccount" } + Context "The specified managed account exists but has incorrect notifcation settings" { + Mock Get-SPManagedAccount { return @{ + Username = $testParams.AccountName + DaysBeforeChangeToEmail = 0 + DaysBeforeExpiryToChange = 0 + ChangeSchedule = $testParams.Schedule + }} - Set-TargetResource @testParams - - Assert-VerifiableMocks + It "returns false from the test method" { + Test-TargetResource @testParams | Should Be $false } - It "Modifies an existing account where it already exists" { - Mock Get-TargetResource { return @{} - AccountName = $testParams.Account.UserName - Schedule = $testParams.Schedule - } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPManagedAccount" } + } - Set-TargetResource @testParams + Context "The specified managed account exists and is configured correctly" { + Mock Get-SPManagedAccount { return @{ + Username = $testParams.AccountName + DaysBeforeChangeToEmail = $testParams.EmailNotification + DaysBeforeExpiryToChange = $testParams.PreExpireDays + ChangeSchedule = $testParams.Schedule + }} - Assert-VerifiableMocks + It "returns the current values from the get method" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + } + + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true } } } diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 index 099bfa164..85dd3fd64 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 @@ -1,18 +1,15 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPManagedMetaDataServiceApp" -Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\Modules\xSharePoint.Util\xSharePoint.Util.psm1") Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") Describe "xSPManagedMetaDataServiceApp" { @@ -24,59 +21,76 @@ Describe "xSPManagedMetaDataServiceApp" { DatabaseName = "SP_MMS" } - Context "Validate get method" { - It "Retrieves the data from SharePoint" { - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" - Get-TargetResource @testParams - Assert-VerifiableMocks + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + + Context "When no service application exists in the current farm" { + + Mock Get-SPServiceApplication { return $null } + Mock New-SPMetadataServiceApplication { } + + It "returns null from the Get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } } - } - Context "Validate test method" { - It "Fails when MMS service app doesn't exist" { - Mock -ModuleName $ModuleName Get-TargetResource { return @{} } + It "returns false when the Test method is called" { Test-TargetResource @testParams | Should Be $false } - It "Passes when the app exists and uses the correct app pool" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - ApplicationPool = $testParams.ApplicationPool - } - } - Test-TargetResource @testParams | Should Be $true - } - It "Fails when the app exists but uses the wrong app pool" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - ApplicationPool = "wrong pool" - } - } - Test-TargetResource @testParams | Should Be $false + + It "creates a new service application in the set method" { + Set-TargetResource @testParams + Assert-MockCalled New-SPMetadataServiceApplication } } - Context "Validate set method" { - It "Creates a new service app where none exists" { - Mock Get-TargetResource { return @{} } -Verifiable - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPMetadataServiceApplication" } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPMetadataServiceApplicationProxy" } + Context "When a service application exists and is configured correctly" { + Mock Get-SPServiceApplication { + return @(@{ + TypeName = "Managed Metadata Service" + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } + Database = @{ + Name = $testParams.DatabaseName + Server = @{ Name = $testParams.DatabaseServer } + } + }) + } - Set-TargetResource @testParams + It "returns values from the get method" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } + } - Assert-VerifiableMocks + It "returns true when the Test method is called" { + Test-TargetResource @testParams | Should Be $true } + } - It "Updates an existing service app" { - Mock Get-TargetResource { return @{ ApplicationPool = "Invalid"} } -Verifiable - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPMetadataServiceApplication" } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplicationPool" } + Context "When a service application exists and the app pool is not configured correctly" { + Mock Get-SPServiceApplication { + return @(@{ + TypeName = "Managed Metadata Service" + DisplayName = $testParams.Name + ApplicationPool = @{ Name = "Wrong App Pool Name" } + Database = @{ + Name = $testParams.DatabaseName + Server = @{ Name = $testParams.DatabaseServer } + } + }) + } + Mock Get-SPServiceApplicationPool { return @{ Name = $testParams.ApplicationPool } } + Mock Set-SPMetadataServiceApplication { } + + It "returns false when the Test method is called" { + Test-TargetResource @testParams | Should Be $false + } + It "calls the update service app cmdlet from the set method" { Set-TargetResource @testParams - Assert-VerifiableMocks + Assert-MockCalled Get-SPServiceApplicationPool + Assert-MockCalled Set-SPMetadataServiceApplication -ParameterFilter { $ApplicationPool.Name -eq $testParams.ApplicationPool } } } } diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 index a73f3f4bc..38331a592 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 @@ -1,15 +1,13 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPManagedPath" Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") @@ -23,58 +21,59 @@ Describe "xSPManagedPath" { HostHeader = $false } - Context "Validate get method" { - It "Calls the data from SharePoint" { - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPManagedPath" } - Get-TargetResource @testParams - Assert-VerifiableMocks + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + Mock New-SPManagedPath { } + + Context "The managed path does not exist and should" { + Mock Get-SPManagedPath { return $null } + + It "returns null from the get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty } - } - Context "Validate test method" { - It "Fails when path is not found" { - Mock -ModuleName $ModuleName Get-TargetResource { return @{} } + It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false } - It "Passes when the path is found and is the correct type" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - RelativeUrl = $testParams.RelativeUrl - Explicit = $testParams.Explicit - HostHeader = $testParams.HostHeader - WebAppUrl = $testParams.WebAppUrl - } - } - Test-TargetResource @testParams | Should Be $true + + It "creates a host header path in the set method" { + Set-TargetResource @testParams + + Assert-MockCalled New-SPManagedPath } - It "Fails when the path is found and is not the correct type" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - RelativeUrl = $testParams.RelativeUrl - Explicit = (-not $testParams.Explicit) - HostHeader = $testParams.HostHeader - WebAppUrl = $testParams.WebAppUrl - } - } + + $testParams.HostHeader = $true + It "creates a host header path in the set method" { + Set-TargetResource @testParams + + Assert-MockCalled New-SPManagedPath + } + $testParams.HostHeader = $false + } + + Context "The path exists but is of the wrong type" { + Mock Get-SPManagedPath { return @{ + Name = $testParams.RelativeUrl + Type = "ExplicitInclusion" + } } + + It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false } } - Context "Validate set method" { - It "Creates a new web application managed path" { - Mock Get-TargetResource { return $null } -Verifiable - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPManagedPath" -and $Arguments.WebApplication -eq $testParams.WebAppUrl } - Set-TargetResource @testParams - Assert-VerifiableMocks + Context "The path exists and is the correct type" { + Mock Get-SPManagedPath { return @{ + Name = $testParams.RelativeUrl + Type = "WildcardInclusion" + } } + + It "returns results from the get method" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty } - - $testParams.HostHeader = $true - It "Creates a new host header managed path" { - Mock Get-TargetResource { return $null } -Verifiable - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPManagedPath" -and $Arguments.HostHeader -eq $true } - Set-TargetResource @testParams - Assert-VerifiableMocks + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true } } } diff --git a/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 index d0368a2b6..6cfb0f037 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 @@ -1,15 +1,13 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPSearchServiceApp" Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") @@ -21,61 +19,81 @@ Describe "xSPSearchServiceApp" { ApplicationPool = "SharePoint Search Services" } - Context "Validate get method" { - It "Retrieves the data from SharePoint" { - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" - Get-TargetResource @testParams - Assert-VerifiableMocks + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + + Context "When no service application exists in the current farm" { + + Mock Get-SPServiceApplication { return $null } + Mock Get-SPEnterpriseSearchServiceInstance { return @{} } + Mock New-SPBusinessDataCatalogServiceApplication { } + Mock Start-SPEnterpriseSearchServiceInstance { } + Mock New-SPEnterpriseSearchServiceApplication { return @{} } + Mock New-SPEnterpriseSearchServiceApplicationProxy { } + Mock Set-SPEnterpriseSearchServiceApplication { } + + It "returns null from the Get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } } - } - Context "Validate test method" { - It "Fails when service app is not found" { - Mock -ModuleName $ModuleName Get-TargetResource { return @{} } + It "returns false when the Test method is called" { Test-TargetResource @testParams | Should Be $false } - It "Passes when the path is found and is the correct type" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - ApplicationPool = $testParams.ApplicationPool - } - } - Test-TargetResource @testParams | Should Be $true + + It "creates a new service application in the set method" { + Set-TargetResource @testParams + Assert-MockCalled New-SPEnterpriseSearchServiceApplication } - It "Fails when the service app is found but uses the wrong app pool" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - ApplicationPool = "Wrong App Pool" + } + + Context "When a service application exists and is configured correctly" { + Mock Get-SPServiceApplication { + return @(@{ + TypeName = "Search Service Application" + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } + Database = @{ + Name = $testParams.DatabaseName + Server = @{ Name = $testParams.DatabaseServer } } - } - Test-TargetResource @testParams | Should Be $false + }) } - } - Context "Validate set method" { - It "Creates a new service app where none exists" { - Mock Get-TargetResource { return @{} } -Verifiable - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPEnterpriseSearchServiceInstance" } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Start-SPEnterpriseSearchServiceInstance" } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPEnterpriseSearchServiceApplication" } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPEnterpriseSearchServiceApplicationProxy" } + It "returns values from the get method" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } + } - Set-TargetResource @testParams + It "returns true when the Test method is called" { + Test-TargetResource @testParams | Should Be $true + } + } - Assert-VerifiableMocks + Context "When a service application exists and the app pool is not configured correctly" { + Mock Get-SPServiceApplication { + return @(@{ + TypeName = "Search Service Application" + DisplayName = $testParams.Name + ApplicationPool = @{ Name = "Wrong App Pool Name" } + Database = @{ + Name = $testParams.DatabaseName + Server = @{ Name = $testParams.DatabaseServer } + } + }) } + Mock Get-SPServiceApplicationPool { return @{ Name = $testParams.ApplicationPool } } + Mock Set-SPEnterpriseSearchServiceApplication { } - It "Updates an existing service app" { - Mock Get-TargetResource { return @{ ApplicationPool = "Invalid"} } -Verifiable - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPEnterpriseSearchServiceApplication" } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplicationPool" } + It "returns false when the Test method is called" { + Test-TargetResource @testParams | Should Be $false + } + It "calls the update service app cmdlet from the set method" { Set-TargetResource @testParams - Assert-VerifiableMocks + Assert-MockCalled Get-SPServiceApplicationPool + Assert-MockCalled Set-SPEnterpriseSearchServiceApplication } } } diff --git a/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 index 284fe5657..8722f4bc6 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 @@ -1,15 +1,13 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPSecureStoreServiceApp" Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") @@ -22,59 +20,82 @@ Describe "xSPSecureStoreServiceApp" { AuditingEnabled = $false } - Context "Validate get method" { - It "Retrieves the data from SharePoint" { - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" - Get-TargetResource @testParams - Assert-VerifiableMocks + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + + $versionBeingTested = (Get-Item $Global:CurrentSharePointStubModule).Directory.BaseName + $majorBuildNumber = $versionBeingTested.Substring(0, $versionBeingTested.IndexOf(".")) + + Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = $majorBuildNumber } } + + Context "When no service application exists in the current farm" { + + Mock Get-SPServiceApplication { return $null } + Mock New-SPSecureStoreServiceApplication { } + Mock New-SPSecureStoreServiceApplicationProxy { } + + It "returns null from the Get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } } - } - Context "Validate test method" { - It "Fails when service app is not found" { - Mock -ModuleName $ModuleName Get-TargetResource { return @{} } + It "returns false when the Test method is called" { Test-TargetResource @testParams | Should Be $false } - It "Passes when the path is found and is the correct type" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - ApplicationPool = $testParams.ApplicationPool - } - } - Test-TargetResource @testParams | Should Be $true + + It "creates a new service application in the set method" { + Set-TargetResource @testParams + Assert-MockCalled New-SPSecureStoreServiceApplication } - It "Fails when the service app is found but uses the wrong app pool" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - ApplicationPool = "Wrong App Pool" + } + + Context "When a service application exists and is configured correctly" { + Mock Get-SPServiceApplication { + return @(@{ + TypeName = "Secure Store Service Application" + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } + Database = @{ + Name = $testParams.DatabaseName + Server = @{ Name = $testParams.DatabaseServer } } - } - Test-TargetResource @testParams | Should Be $false + }) } - } - Context "Validate set method" { - It "Creates a new service app where none exists" { - Mock Get-TargetResource { return @{} } -Verifiable - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPSecureStoreServiceApplication" } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPSecureStoreServiceApplicationProxy" } + It "returns values from the get method" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } + } - Set-TargetResource @testParams + It "returns true when the Test method is called" { + Test-TargetResource @testParams | Should Be $true + } + } - Assert-VerifiableMocks + Context "When a service application exists and the app pool is not configured correctly" { + Mock Get-SPServiceApplication { + return @(@{ + TypeName = "Secure Store Service Application" + DisplayName = $testParams.Name + ApplicationPool = @{ Name = "Wrong App Pool Name" } + Database = @{ + Name = $testParams.DatabaseName + Server = @{ Name = $testParams.DatabaseServer } + } + }) } + Mock Get-SPServiceApplicationPool { return @{ Name = $testParams.ApplicationPool } } + Mock Set-SPSecureStoreServiceApplication { } - It "Updates an existing service app" { - Mock Get-TargetResource { return @{ ApplicationPool = "Invalid"} } -Verifiable - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPSecureStoreServiceApplication" } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplicationPool" } + It "returns false when the Test method is called" { + Test-TargetResource @testParams | Should Be $false + } + It "calls the update service app cmdlet from the set method" { Set-TargetResource @testParams - Assert-VerifiableMocks + Assert-MockCalled Get-SPServiceApplicationPool + Assert-MockCalled Set-SPSecureStoreServiceApplication } } } diff --git a/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 index e15a63fd9..ee02b76c6 100644 --- a/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 @@ -1,15 +1,13 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPServiceAppPool" Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") @@ -21,54 +19,59 @@ Describe "xSPServiceAppPool" { ServiceAccount = "DEMO\svcSPServiceApps" } - Context "Validate get method" { - It "Calls the right functions to retrieve SharePoint data" { - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplicationPool" -and $Arguments.Identity -eq $testParams.Name } - Get-TargetResource @testParams - Assert-VerifiableMocks + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + + Mock New-SPServiceApplicationPool { } + Mock Set-SPServiceApplicationPool { } + + Context "A service account pool does not exist but should" { + Mock Get-SPServiceApplicationPool { return $null } + + It "returns null from the get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty } - } - Context "Validate test method" { - It "Fails when service app pool is not found" { - Mock -ModuleName $ModuleName Get-TargetResource { return @{} } + It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false } - It "Passes when the pool exists and has the correct service account" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - ServiceAccount = $testParams.ServiceAccount - } - } - Test-TargetResource @testParams | Should Be $true - } - It "Fails when the service app pool is found but uses the wrong service account" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - ServiceAccount = "Wrong account name" - } - } - Test-TargetResource @testParams | Should Be $false + + It "calls the set method to create a new service account pool" { + Set-TargetResource @testParams + + Assert-MockCalled New-SPServiceApplicationPool } } - Context "Validate set method" { - It "Creates a new service app pool when none exists" { - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplicationPool" -and $Arguments.Identity -eq $testParams.Name } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPServiceApplicationPool" -and $Arguments.Name -eq $testParams.Name } + Context "A service account pool exists but has the wrong service account" { + Mock Get-SPServiceApplicationPool { return @{ + Name = $testParams.Name + ProcessAccountName = "WRONG\account" + }} + + It "returns false from the test method" { + Test-TargetResource @testParams | Should Be $false + } + It "calls the set method to update the service account pool" { Set-TargetResource @testParams - Assert-VerifiableMocks + + Assert-MockCalled Set-SPServiceApplicationPool } + } - It "Updates the service account of the pool when it is wrong" { - Mock Invoke-xSharePointSPCmdlet { return @{ ProcessAccountName = "wrong name" } } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplicationPool" -and $Arguments.Identity -eq $testParams.Name } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPServiceApplicationPool" } + Context "A service account pool exists and uses the correct account" { + Mock Get-SPServiceApplicationPool { return @{ + Name = $testParams.Name + ProcessAccountName = $testParams.ServiceAccount + }} - Set-TargetResource @testParams - Assert-VerifiableMocks + It "retrieves the status from the get method" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + } + + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true } } } diff --git a/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 index 612c9b64b..31d6f079c 100644 --- a/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 @@ -1,15 +1,13 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPServiceInstance" Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") @@ -21,80 +19,106 @@ Describe "xSPServiceInstance" { Ensure = "Present" } - Context "Validate get method" { - It "Calls the right functions to retrieve SharePoint data" { - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceInstance" } - Get-TargetResource @testParams - Assert-VerifiableMocks + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + Mock Start-SPServiceInstance { } + Mock Stop-SPServiceInstance { } + + Context "The service instance is not running but should be" { + Mock Get-SPServiceInstance { return @( + @{ + TypeName = $testParams.Name + Status = "Disabled" + }) + } + + It "returns absent from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - } - Context "Validate test method" { - It "Fails when service instance is not found at all" { - Mock -ModuleName $ModuleName Get-TargetResource { return @{} } + It "returns false from the set method" { Test-TargetResource @testParams | Should Be $false } - It "Passes when the service instance is running and it should be" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - Ensure = "Present" - } - } + + It "calls the start service call from the set method" { + Set-TargetResource @testParams + + Assert-MockCalled Start-SPServiceInstance + } + } + + Context "The service instance is running and should be" { + Mock Get-SPServiceInstance { return @( + @{ + TypeName = $testParams.Name + Status = "Online" + }) + } + + It "returns present from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Present" + } + + It "returns true from the test method" { Test-TargetResource @testParams | Should Be $true } - It "Fails when the service instance isn't running and it should be" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - Ensure = "Absent" - } - } - Test-TargetResource @testParams | Should Be $false + } + + Context "An invalid service application is specified to start" { + Mock Get-SPServiceInstance { return $null } + + It "throws when the set method is called" { + { Set-TargetResource @testParams } | Should Throw } + } - $testParams.Ensure = "Absent" + $testParams.Ensure = "Absent" - It "Fails when the service instance is running and it should not be" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - Ensure = "Present" - } - } - Test-TargetResource @testParams | Should Be $false + Context "The service instance is not running and should not be" { + Mock Get-SPServiceInstance { return @( + @{ + TypeName = $testParams.Name + Status = "Disabled" + }) } - It "Passes when the service instance isn't running and it should not be" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - Ensure = "Absent" - } - } + + It "returns absent from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Absent" + } + + It "returns true from the test method" { Test-TargetResource @testParams | Should Be $true } } - Context "Validate set method" { + Context "The service instance is running and should not be" { + Mock Get-SPServiceInstance { return @( + @{ + TypeName = $testParams.Name + Status = "Online" + }) + } - $testParams.Ensure = "Present" + It "returns present from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Present" + } - It "Starts a service that should be running" { - Mock Invoke-xSharePointSPCmdlet { return @( @{ TypeName = $testParams.Name } ) } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceInstance" } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Start-SPServiceInstance" } + It "returns false from the set method" { + Test-TargetResource @testParams | Should Be $false + } + It "calls the stop service call from the set method" { Set-TargetResource @testParams - Assert-VerifiableMocks - } - $testParams.Ensure = "Absent" + Assert-MockCalled Stop-SPServiceInstance + } + } - It "Stops a service that should be stopped" { - Mock Invoke-xSharePointSPCmdlet { return @( @{ TypeName = $testParams.Name } ) } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceInstance" } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Stop-SPServiceInstance" } + Context "An invalid service application is specified to stop" { + Mock Get-SPServiceInstance { return $null } - Set-TargetResource @testParams - Assert-VerifiableMocks + It "throws when the set method is called" { + { Set-TargetResource @testParams } | Should Throw } } } diff --git a/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 index 88a5af60d..921d1c797 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 @@ -1,15 +1,13 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPSite" Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") @@ -21,36 +19,86 @@ Describe "xSPSite" { OwnerAlias = "DEMO\User" } - Context "Validate get method" { - It "Calls the right functions to retrieve SharePoint data" { - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPSite" } - Get-TargetResource @testParams - Assert-VerifiableMocks + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + Mock New-SPSite { } + + Context "The site doesn't exist yet and should" { + Mock Get-SPSite { return $null } + + It "returns null from the get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty } - } - Context "Validate test method" { - It "Fails when site collection isn't found" { - Mock -ModuleName $ModuleName Get-TargetResource { return @{} } + It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false } - It "Passes when the site collection is found" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Url = $testParams.Url - OwnerAlias = $testParams.OwnerAlias - } - } + + It "creates a new site from the set method" { + Set-TargetResource @testParams + + Assert-MockCalled New-SPSite + } + } + + Context "The site exists and is a host named site collection" { + Mock Get-SPSite { return @{ + HostHeaderIsSiteName = $true + WebApplication = @{ + Url = $testParams.Url + UseClaimsAuthentication = $false + } + Url = $testParams.Url + Owner = @{ UserLogin = "DEMO\owner" } + }} + + It "returns the site data from the get method" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + } + + It "returns true from the test method" { Test-TargetResource @testParams | Should Be $true } } - Context "Validate set method" { - It "Creates a new site when none exists" { - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPSite" } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPSite" } - Set-TargetResource @testParams - Assert-VerifiableMocks + Context "The site exists and uses claims authentication" { + Mock Get-SPSite { return @{ + HostHeaderIsSiteName = $false + WebApplication = @{ + Url = $testParams.Url + UseClaimsAuthentication = $true + } + Url = $testParams.Url + Owner = @{ UserLogin = "DEMO\owner" } + }} + Mock New-SPClaimsPrincipal { return @{ Value = $testParams.OwnerAlias }} + + It "returns the site data from the get method" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + } + + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true + } + } + + Context "The site exists and uses classic authentication" { + Mock Get-SPSite { return @{ + HostHeaderIsSiteName = $false + WebApplication = @{ + Url = $testParams.Url + UseClaimsAuthentication = $false + } + Url = $testParams.Url + Owner = @{ UserLogin = "DEMO\owner" } + }} + + It "returns the site data from the get method" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + } + + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true } } } diff --git a/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 index d3d862acf..8a2e60caa 100644 --- a/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 @@ -1,15 +1,13 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPStateServiceApp" Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") @@ -18,40 +16,42 @@ Describe "xSPStateServiceApp" { InModuleScope $ModuleName { $testParams = @{ Name = "State Service App" + DatabaseName = "SP_StateService" } - Context "Validate get method" { - It "Calls the right functions to retrieve SharePoint data" { - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPStateServiceApplication" } - Get-TargetResource @testParams - Assert-VerifiableMocks + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + Mock New-SPStateServiceDatabase { return @{} } + Mock New-SPStateServiceApplication { return @{} } + Mock New-SPStateServiceApplicationProxy { return @{} } + + Context "the service app doesn't exist and should" { + Mock Get-SPStateServiceApplication { return $null } + + It "returns null from the get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty } - } - Context "Validate test method" { - It "Fails when state service app doesn't exist" { - Mock -ModuleName $ModuleName Get-TargetResource { return @{} } + It "returns false from the get method" { Test-TargetResource @testParams | Should Be $false } - It "Passes when the state service app exists" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - } - } - Test-TargetResource @testParams | Should Be $true + + It "creates a state service app from the set method" { + Set-TargetResource @testParams + + Assert-MockCalled New-SPStateServiceApplication } } - Context "Validate set method" { - It "Creates a new service app where none exists" { - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPStateServiceApplication" } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPStateServiceDatabase" } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPStateServiceApplication" } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPStateServiceApplicationProxy" } + Context "the service app exists and should" { + Mock Get-SPStateServiceApplication { return @{ DisplayName = $testParams.Name } } - Set-TargetResource @testParams - Assert-VerifiableMocks + It "returns the current info from the get method" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + } + + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true } } } diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 index 888990102..e666757cc 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 @@ -1,16 +1,14 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path - +$Global:CurrentSharePointStubModule = $SharePointCmdletModule + $ModuleName = "MSFT_xSPUserProfileServiceApp" Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") @@ -22,68 +20,67 @@ Describe "xSPUserProfileServiceApp" { FarmAccount = New-Object System.Management.Automation.PSCredential ("domain\username", (ConvertTo-SecureString "password" -AsPlainText -Force)) } - Context "Validate get method" { - It "Retrieves the data from SharePoint" { - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" - Get-TargetResource @testParams - Assert-VerifiableMocks - } - } - - Context "Validate test method" { - It "Fails when user profile service app doesn't exist" { - Mock -ModuleName $ModuleName Get-TargetResource { return @{} } - Test-TargetResource @testParams | Should Be $false + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + Mock Get-UserProfileServiceProperties { return @{ + ProfileDatabase = @{ + Name = "SP_ProfileDB" + Server = @{ Name = "SQL.domain.local" } } - It "Passes when the user profile service app exists and uses the correct app pool" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - ApplicationPool = $testParams.ApplicationPool - } - } - Test-TargetResource @testParams | Should Be $true + SocialDatabase = @{ + Name = "SP_SocialDB" + Server = @{ Name = "SQL.domain.local" } } - It "Fails when the user profile service app exists but uses the wrong app pool" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - ApplicationPool = "wrong pool" - } - } - Test-TargetResource @testParams | Should Be $false + SynchronizationDatabase = @{ + Name = "SP_SyncDB" + Server = @{ Name = "SQL.domain.local" } } - } + }} + Mock Get-SPFarm { return @{ + DefaultServiceAccount = @{ Name = $testParams.FarmAccount.Username } + }} + Mock New-SPProfileServiceApplication { } + Mock New-SPProfileServiceApplicationProxy { } + Mock Add-xSharePointUserToLocalAdmin { } + Mock Test-xSharePointUserIsLocalAdmin { return $false } + Mock Remove-xSharePointUserToLocalAdmin { } + Mock New-PSSession { return $null } -ModuleName "xSharePoint.Util" - Context "Validate set method" { - It "Creates a new service app where none exists, adding user to the local admin group" { - Mock Test-xSharePointUserIsLocalAdmin { return $false } -Verifiable - Mock Add-xSharePointUserToLocalAdmin -Verifiable - Mock Remove-xSharePointUserToLocalAdmin -Verifiable + Context "When no service application exists in the current farm" { - Mock New-PSSession { return $null } -ModuleName "xSharePoint.Util" - - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPProfileServiceApplication" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPProfileServiceApplicationProxy" } + Mock Get-SPServiceApplication { return $null } - Set-TargetResource @testParams + It "returns null from the Get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } + } - Assert-VerifiableMocks + It "returns false when the Test method is called" { + Test-TargetResource @testParams | Should Be $false } - It "Creates a new service app where none exists, without adding user to the local admin group" { - Mock Test-xSharePointUserIsLocalAdmin { return $true } -Verifiable - - Mock New-PSSession { return $null } -ModuleName "xSharePoint.Util" + It "creates a new service application in the set method" { + Set-TargetResource @testParams + Assert-MockCalled New-SPProfileServiceApplication + } + } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPProfileServiceApplication" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPProfileServiceApplicationProxy" } + Context "When a service application exists and is configured correctly" { + Mock Get-SPServiceApplication { + return @(@{ + TypeName = "User Profile Service Application" + DisplayName = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } + }) + } - Set-TargetResource @testParams + It "returns values from the get method" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } + } - Assert-VerifiableMocks + It "returns true when the Test method is called" { + Test-TargetResource @testParams | Should Be $true } } } diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 index 340653a36..5e42c1d43 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 @@ -1,15 +1,13 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPUserProfileSyncService" Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") @@ -22,106 +20,130 @@ Describe "xSPUserProfileSyncService" { Ensure = "Present" } - Context "Validate get method" { - It "Retrieves the data from SharePoint" { - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceInstance" } - Get-TargetResource @testParams - Assert-VerifiableMocks + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + Mock Get-SPFarm { return @{ + DefaultServiceAccount = @{ Name = $testParams.FarmAccount.Username } + }} + Mock Start-SPServiceInstance { } + Mock Stop-SPServiceInstance { } + Mock Restart-Service { } + Mock Add-xSharePointUserToLocalAdmin { } + Mock Test-xSharePointUserIsLocalAdmin { return $false } + Mock Remove-xSharePointUserToLocalAdmin { } + Mock New-PSSession { return $null } -ModuleName "xSharePoint.Util" + + Context "User profile sync service is not running and should be" { + Mock Get-SPServiceInstance { if ($Global:xSharePointUPACheck -eq $false) { + $Global:xSharePointUPACheck = $true + return @( @{ + Status = "Disabled" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::Empty + TypeName = "User Profile Synchronization Service" + }) + } else { + return @( @{ + Status = "Online" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::NewGuid() + TypeName = "User Profile Synchronization Service" + }) + } + } + + It "returns absent from the get method" { + $Global:xSharePointUPACheck = $false + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - } - Context "Validate test method" { - It "Fails when user profile sync service doesn't exist" { - Mock -ModuleName $ModuleName Get-TargetResource { return @{} } - Test-TargetResource @testParams | Should Be $false - } - It "Passes when the user profile sync service is running and should be" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Ensure = "Present" - } - } - Test-TargetResource @testParams | Should Be $true - } - It "Fails when the user profile sync service is not running and should be" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Ensure = "Absent" - } - } + It "returns false from the test method" { + $Global:xSharePointUPACheck = $false Test-TargetResource @testParams | Should Be $false } - $testParams.Ensure = "Absent" + It "calls the start service cmdlet from the set method" { + $Global:xSharePointUPACheck = $false + Mock Set-xSharePointUserProfileSyncMachine { } + Set-TargetResource @testParams - It "Fails when the user profile sync service is running and should not be" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Ensure = "Present" - } - } - Test-TargetResource @testParams | Should Be $false - } - It "Passes when the user profile sync service is not running and should not be" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Ensure = "Absent" - } - } - Test-TargetResource @testParams | Should Be $true + Assert-MockCalled Start-SPServiceInstance } } - $testParams.Ensure = "Present" - $Global:xSharePointUPACheck = $false - - Context "Validate set method" { - It "Povisions the user profile sync service where it should be running" { - Mock Test-xSharePointUserIsLocalAdmin { return $false } -Verifiable - Mock Add-xSharePointUserToLocalAdmin -Verifiable - Mock Remove-xSharePointUserToLocalAdmin -Verifiable - - Mock New-PSSession { return $null } -ModuleName "xSharePoint.Util" - Mock Restart-Service { return $null } - - Mock Set-xSharePointUserProfileSyncMachine { return $null } -Verifiable - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Start-SPServiceInstance" } - Mock Invoke-xSharePointSPCmdlet { if ($Global:xSharePointUPACheck -eq $false) { - $Global:xSharePointUPACheck = $true - return @( @{ Status = "Offline"; ID = [Guid]::NewGuid(); TypeName = "User Profile Synchronization Service" }) - } else { - return @( @{ Status = "Online"; ID = [Guid]::NewGuid(); TypeName = "User Profile Synchronization Service" }) - } - } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceInstance" } - - Set-TargetResource @testParams + Context "User profile sync service is running and should be" { + Mock Get-SPServiceInstance { return @( @{ + Status = "Online" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::NewGuid() + TypeName = "User Profile Synchronization Service" + }) + } + + It "returns present from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Present" + } - Assert-VerifiableMocks + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true } + } - $testParams.Ensure = "Absent" - $Global:xSharePointUPACheck = $false + $testParams.Ensure = "Absent" + + Context "User profile sync service is running and shouldn't be" { + Mock Get-SPServiceInstance { if ($Global:xSharePointUPACheck -eq $false) { + $Global:xSharePointUPACheck = $true + return @( @{ + Status = "Online" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::NewGuid() + TypeName = "User Profile Synchronization Service" + }) + } else { + return @( @{ + Status = "Disabled" + ID = [Guid]::Empty + UserProfileApplicationGuid = [Guid]::Empty + TypeName = "User Profile Synchronization Service" + }) + } + } + + It "returns present from the get method" { + $Global:xSharePointUPACheck = $false + (Get-TargetResource @testParams).Ensure | Should Be "Present" + } - It "Stops the user profile sync service where it should not be running" { - Mock Test-xSharePointUserIsLocalAdmin { return $false } -Verifiable - Mock Add-xSharePointUserToLocalAdmin -Verifiable - Mock Remove-xSharePointUserToLocalAdmin -Verifiable + It "returns false from the test method" { + $Global:xSharePointUPACheck = $false + Test-TargetResource @testParams | Should Be $false + } - Mock New-PSSession { return $null } -ModuleName "xSharePoint.Util" - Mock Restart-Service { return $null } + It "calls the start service cmdlet from the set method" { + $Global:xSharePointUPACheck = $false + Mock Set-xSharePointUserProfileSyncMachine { } -ModuleName "xSharePoint.UserProfileService" + Set-TargetResource @testParams - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Stop-SPServiceInstance" } - Mock Invoke-xSharePointSPCmdlet { if ($Global:xSharePointUPACheck -eq $false) { - $Global:xSharePointUPACheck = $true - return @( @{ Status = "Online"; ID = [Guid]::NewGuid(); TypeName = "User Profile Synchronization Service" }) - } else { - return @( @{ Status = "Disabled"; ID = [Guid]::NewGuid(); TypeName = "User Profile Synchronization Service" }) - } - } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceInstance" } + Assert-MockCalled Stop-SPServiceInstance + } + } - Set-TargetResource @testParams + Context "User profile sync service is not running and shouldn't be" { + Mock Get-SPServiceInstance { return @( @{ + Status = "Disabled" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::Empty + TypeName = "User Profile Synchronization Service" + }) + } + + It "returns absent from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Absent" + } - Assert-VerifiableMocks + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true } } } diff --git a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 index df4bc81f0..9afd4a661 100644 --- a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 @@ -1,15 +1,13 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPWebApplication" Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") @@ -21,50 +19,79 @@ Describe "xSPWebApplication" { ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" Url = "http://sites.sharepoint.com" + AuthenticationMethod = "NTLM" } - Context "Validate get method" { - It "Calls the right functions to retrieve SharePoint data" { - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPWebApplication" } - Get-TargetResource @testParams - Assert-VerifiableMocks + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + Mock New-SPAuthenticationProvider { } + Mock New-SPWebApplication { } + + Context "The web application that uses NTLM doesn't exist but should" { + Mock Get-SPWebApplication { return $null } + + It "returns null from the get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty } - } - Context "Validate test method" { - It "Fails when web app doesn't exist" { - Mock -ModuleName $ModuleName Get-TargetResource { return @{} } + It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false } - It "Passes when the web app exists and has correct settings" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - ApplicationPool = $testParams.ApplicationPool - ApplicationPoolAccount = $testParams.ApplicationPoolAccount - } - } - Test-TargetResource @testParams | Should Be $true + + It "calls the new cmdlet from the set method" { + Set-TargetResource @testParams + + Assert-MockCalled New-SPWebApplication + Assert-MockCalled New-SPAuthenticationProvider -ParameterFilter { $DisableKerberos -eq $true } } - It "Fails when the web app exists and has the wrong app pool" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - ApplicationPool = "Wrong app pool" - ApplicationPoolAccount = $testParams.ApplicationPoolAccount - } - } + } + + $testParams.AuthenticationMethod = "Kerberos" + + Context "The web application that uses Kerberos doesn't exist but should" { + Mock Get-SPWebApplication { return $null } + + It "returns null from the get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty + } + + It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false } - } - Context "Validate set method" { - It "Creates a new site when none exists" { - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPAuthenticationProvider" } - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPWebApplication" } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPWebApplication" } + It "calls the new cmdlet from the set method" { Set-TargetResource @testParams - Assert-VerifiableMocks + + Assert-MockCalled New-SPWebApplication + } + } + + Context "The web appliation does exist and should" { + Mock Get-SPAuthenticationProvider { return @{ DisableKerberos = $true; AllowAnonymous = $false } } + Mock Get-SPWebApplication { return @(@{ + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool + Username = $testParams.ApplicationPoolAccount + } + ContentDatabases = @( + @{ + Name = "SP_Content_01" + Server = "sql.domain.local" + } + ) + IisSettings = @( + @{ Path = "C:\inetpub\wwwroot\something" } + ) + Url = $testParams.Url + })} + + It "returns the current data from the get method" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + } + + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true } } } diff --git a/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 index b9affd5e6..4826fc22b 100644 --- a/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 @@ -1,15 +1,13 @@ [CmdletBinding()] -param() - -if (!$PSScriptRoot) # $PSScriptRoot is not defined in 2.0 -{ - $PSScriptRoot = [System.IO.Path]::GetDirectoryName($MyInvocation.MyCommand.Path) -} +param( + [string] $SharePointCmdletModule = (Join-Path $PSScriptRoot "..\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1" -Resolve) +) $ErrorActionPreference = 'stop' Set-StrictMode -Version latest $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path +$Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPUsageApplication" Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") @@ -24,85 +22,113 @@ Describe "xSPUsageApplication" { UsageLogMaxSpaceGB = 10 } - Context "Validate get method" { - It "Calls the right functions to retrieve SharePoint data" { - Mock Invoke-xSharePointSPCmdlet { return @(@{ TypeName = "Usage and Health Data Collection Service Application" }) } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } -ModuleName "xSharePoint.ServiceApplications" - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPUsageService" } - Get-TargetResource @testParams - Assert-VerifiableMocks + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Initialize-xSharePointPSSnapin { } + Mock New-SPUsageApplication { } + Mock Set-SPUsageService { } + Mock Get-SPUsageService { return @{ + UsageLogCutTime = $testParams.UsageLogCutTime + UsageLogDir = $testParams.UsageLogLocation + UsageLogMaxFileSize = ($testParams.UsageLogMaxFileSizeKB * 1024) + UsageLogMaxSpaceGB = $testParams.UsageLogMaxSpaceGB + }} + + Context "When no service application exists in the current farm" { + + Mock Get-SPServiceApplication { return $null } + + It "returns null from the Get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } } - } - Context "Validate test method" { - It "Fails when state service app doesn't exist" { - Mock -ModuleName $ModuleName Get-TargetResource { return @{} } + It "returns false when the Test method is called" { Test-TargetResource @testParams | Should Be $false } - It "Passes when the state service app exists and settings are corrent" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - UsageLogCutTime = $testParams.UsageLogCutTime - UsageLogLocation = $testParams.UsageLogLocation - UsageLogMaxFileSizeKB = $testParams.UsageLogMaxFileSizeKB - UsageLogMaxSpaceGB = $testParams.UsageLogMaxSpaceGB - } - } + + It "creates a new service application in the set method" { + Set-TargetResource @testParams + Assert-MockCalled New-SPUsageApplication + } + } + + Context "When a service application exists and is configured correctly" { + Mock Get-SPServiceApplication { + return @(@{ + TypeName = "Usage and Health Data Collection Service Application" + DisplayName = $testParams.Name + UsageDatabase = @{ + Name = $testParams.DatabaseName + Server = @{ Name = $testParams.DatabaseServer } + } + }) + } + + It "returns values from the get method" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } + } + + It "returns true when the Test method is called" { Test-TargetResource @testParams | Should Be $true } - It "Fails when the state service app exists and settings are wrong" { - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - UsageLogCutTime = $testParams.UsageLogCutTime - UsageLogLocation = "C:\WrongPath" - UsageLogMaxFileSizeKB = $testParams.UsageLogMaxFileSizeKB - UsageLogMaxSpaceGB = $testParams.UsageLogMaxSpaceGB - } - } - Test-TargetResource @testParams | Should Be $false - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - UsageLogCutTime = 0 - UsageLogLocation = $testParams.UsageLogLocation - UsageLogMaxFileSizeKB = $testParams.UsageLogMaxFileSizeKB - UsageLogMaxSpaceGB = $testParams.UsageLogMaxSpaceGB - } - } - Test-TargetResource @testParams | Should Be $false - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - UsageLogCutTime = $testParams.UsageLogCutTime - UsageLogLocation = $testParams.UsageLogLocation - UsageLogMaxFileSizeKB = 0 - UsageLogMaxSpaceGB = $testParams.UsageLogMaxSpaceGB - } - } - Test-TargetResource @testParams | Should Be $false - Mock -ModuleName $ModuleName Get-TargetResource { - return @{ - Name = $testParams.Name - UsageLogCutTime = $testParams.UsageLogCutTime - UsageLogLocation = $testParams.UsageLogLocation - UsageLogMaxFileSizeKB = $testParams.UsageLogMaxFileSizeKB - UsageLogMaxSpaceGB = 0 - } - } + } + + Context "When a service application exists and log path are not configured correctly" { + Mock Get-SPServiceApplication { + return @(@{ + TypeName = "Usage and Health Data Collection Service Application" + DisplayName = $testParams.Name + UsageDatabase = @{ + Name = $testParams.DatabaseName + Server = @{ Name = $testParams.DatabaseServer } + } + }) + } + Mock Get-SPUsageService { return @{ + UsageLogCutTime = $testParams.UsageLogCutTime + UsageLogDir = "C:\Wrong\Location" + UsageLogMaxFileSize = ($testParams.UsageLogMaxFileSizeKB * 1024) + UsageLogMaxSpaceGB = $testParams.UsageLogMaxSpaceGB + }} + + It "returns false when the Test method is called" { Test-TargetResource @testParams | Should Be $false } + + It "calls the update service app cmdlet from the set method" { + Set-TargetResource @testParams + + Assert-MockCalled Set-SPUsageService + } } - Context "Validate set method" { - It "Sets the usage values correctly" { - Mock Invoke-xSharePointSPCmdlet { return $null } -Verifiable -ParameterFilter { $CmdletName -eq "Get-SPServiceApplication" -and $Arguments.Name -eq $testParams.Name } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "New-SPUsageApplication" } - Mock Invoke-xSharePointSPCmdlet { return @{} } -Verifiable -ParameterFilter { $CmdletName -eq "Set-SPUsageService" } + Context "When a service application exists and log size is not configured correctly" { + Mock Get-SPServiceApplication { + return @(@{ + TypeName = "Usage and Health Data Collection Service Application" + DisplayName = $testParams.Name + UsageDatabase = @{ + Name = $testParams.DatabaseName + Server = @{ Name = $testParams.DatabaseServer } + } + }) + } + Mock Get-SPUsageService { return @{ + UsageLogCutTime = $testParams.UsageLogCutTime + UsageLogDir = $testParams.UsageLogLocation + UsageLogMaxFileSize = ($testParams.UsageLogMaxFileSizeKB * 1024) + UsageLogMaxSpaceGB = 1 + }} + + It "returns false when the Test method is called" { + Test-TargetResource @testParams | Should Be $false + } + It "calls the update service app cmdlet from the set method" { Set-TargetResource @testParams - Assert-VerifiableMocks + Assert-MockCalled Set-SPUsageService } } } From 8cc37c0c6ee96f37b2e7106915650e215a3444b8 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 24 Sep 2015 00:29:20 +1000 Subject: [PATCH 079/146] Fixed URI generation --- .../DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 | 2 +- .../MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 index 2914acc59..c039da403 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 @@ -43,7 +43,7 @@ function Get-TargetResource InstallAccount = $params.InstallAccount Passphrase = $params.Passphrase AdminContentDatabaseName = $centralAdminSite.ContentDatabases[0].Name - CentralAdministrationPort = [Uri]::new($centralAdminSite.Url).Port + CentralAdministrationPort = (New-Object System.Uri $centralAdminSite.Url).Port } return $returnValue } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 index e61dc48a5..a4e29c115 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 @@ -39,9 +39,9 @@ function Get-TargetResource AllowAnonymous = $authProvider.AllowAnonymous DatabaseName = $wa.ContentDatabases[0].Name DatabaseServer = $wa.ContentDatabases[0].Server - HostHeader = [Uri]::New($wa.Url).Host + HostHeader = (New-Object System.Uri $wa.Url).Host Path = $wa.IisSettings[0].Path - Port = [Uri]::New($wa.Url).Port + Port = (New-Object System.Uri $wa.Url).Port AuthenticationMethod = $localAuthMode InstallAccount = $params.InstallAccount } From ee2e7661b9dc383159428591a988500524d38ae8 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 24 Sep 2015 00:37:33 +1000 Subject: [PATCH 080/146] Update harness to output results, integrated to AppVeyor --- Tests/xSharePoint.TestHarness.psm1 | 15 ++++++++++++++- appveyor.yml | 4 ++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Tests/xSharePoint.TestHarness.psm1 b/Tests/xSharePoint.TestHarness.psm1 index 5dcbc4aa0..5fd8a6355 100644 --- a/Tests/xSharePoint.TestHarness.psm1 +++ b/Tests/xSharePoint.TestHarness.psm1 @@ -1,9 +1,20 @@ function Invoke-xSharePointTests() { + param + ( + [parameter(Mandatory = $false)] [System.String] $testResultsFile + ) + $repoDir = Join-Path $PSScriptRoot "..\" -Resolve $testCoverageFiles = @() Get-ChildItem "$repoDir\modules\xSharePoint\**\*.psm1" -Recurse | ForEach-Object { $testCoverageFiles += $_.FullName } + $testResultSettings = @{ } + if ([string]::IsNullOrEmpty($testResultsFile) -eq $false) { + $testResultSettings.Add("OutputFormat", "NUnitXml" ) + $testResultSettings.Add("OutputFile", $testResultsFile) + } + $results = Invoke-Pester -Script @( @{ 'Path' = $repoDir @@ -17,7 +28,9 @@ function Invoke-xSharePointTests() { 'SharePointCmdletModule' = (Join-Path $repoDir "\Tests\Stubs\SharePoint\16.0.4316.1217\Microsoft.SharePoint.PowerShell.psm1") } } - ) -CodeCoverage $testCoverageFiles -PassThru + ) -CodeCoverage $testCoverageFiles -PassThru @testResultSettings + + return $results } function Write-xSharePointStubFiles() { diff --git a/appveyor.yml b/appveyor.yml index d9a05c8f2..7ddccfb41 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -13,8 +13,8 @@ test_script: - ps: | $testResultsFile = ".\TestsResults.xml" $testCoverageFiles = @() - Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint\**\*.psm1" -Recurse | ForEach-Object { $testCoverageFiles += $_.FullName } - $res = Invoke-Pester -OutputFormat NUnitXml -OutputFile $testResultsFile -PassThru -CodeCoverage $testCoverageFiles + Import-Module "$env:APPVEYOR_BUILD_FOLDER\Tests\xSharePoint.TestHarness.psm1" + $res = Invoke-xSharePointTests $testResultsFile (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFile)) if ($res.FailedCount -gt 0) { throw "$($res.FailedCount) tests failed." From 601cbe6db0910838d45f07b8f8198dced539c2cd Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 24 Sep 2015 00:41:04 +1000 Subject: [PATCH 081/146] Imported module specifically during tests --- Tests/xSharePoint.TestHarness.psm1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/xSharePoint.TestHarness.psm1 b/Tests/xSharePoint.TestHarness.psm1 index 5fd8a6355..7c4fdadd7 100644 --- a/Tests/xSharePoint.TestHarness.psm1 +++ b/Tests/xSharePoint.TestHarness.psm1 @@ -11,9 +11,10 @@ function Invoke-xSharePointTests() { $testResultSettings = @{ } if ([string]::IsNullOrEmpty($testResultsFile) -eq $false) { - $testResultSettings.Add("OutputFormat", "NUnitXml" ) + $testResultSettings.Add("OutputFormat", "NUnitXml" ) $testResultSettings.Add("OutputFile", $testResultsFile) } + Import-Module "$repoDir\modules\xSharePoint" $results = Invoke-Pester -Script @( @{ From b67e90a8e0082917882d6fd172cc3298c1c68663 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 24 Sep 2015 00:56:14 +1000 Subject: [PATCH 082/146] Testing fix for appveyor build --- Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 index f2eafb624..6ef2cf9bb 100644 --- a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 @@ -15,6 +15,7 @@ $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path $Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPBCSServiceApp" +Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\") Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") Describe "xSPBCSServiceApp" { From e75ce7816d56f6ac652c77db962f8fa53503ed4a Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 24 Sep 2015 07:56:41 +1000 Subject: [PATCH 083/146] Removed DSC test clone --- appveyor.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 7ddccfb41..1a3d54eb0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,11 +1,7 @@ version: 0.6.{build}.0 install: - - cinst -y pester - - git clone https://github.com/PowerShell/DscResource.Tests - - ps: | - Import-Module .\DscResource.Tests\TestHelper.psm1 -force - + - cinst -y pester build: off @@ -31,5 +27,5 @@ after_test: New-Nuspec -packageName $env:APPVEYOR_PROJECT_NAME -version $env:APPVEYOR_BUILD_VERSION -author "Microsoft" -owners "Microsoft" -licenseUrl "https://github.com/PowerShell/DscResources/blob/master/LICENSE" -projectUrl "https://github.com/$($env:APPVEYOR_REPO_NAME)" -packageDescription $env:APPVEYOR_PROJECT_NAME -tags "DesiredStateConfiguration DSC DSCResourceKit" -destinationPath . nuget pack ".\$($env:APPVEYOR_PROJECT_NAME).nuspec" -outputdirectory $env:APPVEYOR_BUILD_FOLDER - $nuGetPackageName = $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" + $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\$nuGetPackageName" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } From 3169cd76eb05428178c5632fb4c181f8b6ee6629 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 24 Sep 2015 07:58:08 +1000 Subject: [PATCH 084/146] Fixed tests directory --- Tests/xSharePoint.TestHarness.psm1 | 4 ++-- appveyor.yml | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Tests/xSharePoint.TestHarness.psm1 b/Tests/xSharePoint.TestHarness.psm1 index 7c4fdadd7..a729aa5d8 100644 --- a/Tests/xSharePoint.TestHarness.psm1 +++ b/Tests/xSharePoint.TestHarness.psm1 @@ -18,13 +18,13 @@ function Invoke-xSharePointTests() { $results = Invoke-Pester -Script @( @{ - 'Path' = $repoDir + 'Path' = "$repoDir\Tests" 'Parameters' = @{ 'SharePointCmdletModule' = (Join-Path $repoDir "\Tests\Stubs\SharePoint\15.0.4693.1000\Microsoft.SharePoint.PowerShell.psm1") } }, @{ - 'Path' = $repoDir + 'Path' = "$repoDir\Tests" 'Parameters' = @{ 'SharePointCmdletModule' = (Join-Path $repoDir "\Tests\Stubs\SharePoint\16.0.4316.1217\Microsoft.SharePoint.PowerShell.psm1") } diff --git a/appveyor.yml b/appveyor.yml index 1a3d54eb0..d96aa691f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,11 @@ version: 0.6.{build}.0 install: - - cinst -y pester + - cinst -y pester + - git clone https://github.com/PowerShell/DscResource.Tests + - ps: | + Import-Module .\DscResource.Tests\TestHelper.psm1 -force + build: off From 65d277b790c43590ea302a24adc804134263090e Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 24 Sep 2015 08:01:37 +1000 Subject: [PATCH 085/146] Path fixes for AppVeyor --- Tests/xSharePoint.TestHarness.psm1 | 2 +- Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/xSharePoint.TestHarness.psm1 b/Tests/xSharePoint.TestHarness.psm1 index a729aa5d8..59f098825 100644 --- a/Tests/xSharePoint.TestHarness.psm1 +++ b/Tests/xSharePoint.TestHarness.psm1 @@ -14,7 +14,7 @@ function Invoke-xSharePointTests() { $testResultSettings.Add("OutputFormat", "NUnitXml" ) $testResultSettings.Add("OutputFile", $testResultsFile) } - Import-Module "$repoDir\modules\xSharePoint" + Import-Module "$repoDir\modules\xSharePoint\xSharePoint.psd1" $results = Invoke-Pester -Script @( @{ diff --git a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 index 6ef2cf9bb..6f5629e3e 100644 --- a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 @@ -15,7 +15,7 @@ $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path $Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPBCSServiceApp" -Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\") +Import-Module (Join-Path $RepoRoot "Modules\xSharePoint") Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") Describe "xSPBCSServiceApp" { From 2c769ebce7accf60cfe342e46fefcf2a9d0116b8 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 24 Sep 2015 08:05:00 +1000 Subject: [PATCH 086/146] Added module reference --- Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 index 6f5629e3e..1f06d0fdc 100644 --- a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 @@ -15,7 +15,7 @@ $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path $Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPBCSServiceApp" -Import-Module (Join-Path $RepoRoot "Modules\xSharePoint") +Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\Modules\xSharePoint.Util\xSharePoint.Util.psm1") Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") Describe "xSPBCSServiceApp" { From 56aca97cb5663fbf1c3cdeb05689b1be646ac1f3 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 24 Sep 2015 08:07:43 +1000 Subject: [PATCH 087/146] Testing new load technique --- Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 index 1f06d0fdc..076a04b06 100644 --- a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 @@ -15,7 +15,6 @@ $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path $Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPBCSServiceApp" -Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\Modules\xSharePoint.Util\xSharePoint.Util.psm1") Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") Describe "xSPBCSServiceApp" { @@ -28,6 +27,8 @@ Describe "xSPBCSServiceApp" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") + Mock Initialize-xSharePointPSSnapin { } Context "When no service application exists in the current farm" { From 907f4e59284a92e7f42474fa90736d1973636060 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 24 Sep 2015 08:14:15 +1000 Subject: [PATCH 088/146] Fixed module load approaches --- Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 | 2 +- Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 | 1 + Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 | 1 + .../xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 | 1 + .../xSharePoint.xSPDistributedCacheService.Tests.ps1 | 1 + Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 | 1 + Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 | 1 + Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 | 1 + Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 | 1 + Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 | 1 + .../xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 | 1 + Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 | 1 + Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 | 1 + .../xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 | 1 + Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 | 1 + Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 | 1 + Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 | 1 + Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 | 1 + .../xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 | 1 + .../xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 | 1 + Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 | 1 + Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 | 1 + 22 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 index 076a04b06..1a8f20237 100644 --- a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 @@ -27,7 +27,7 @@ Describe "xSPBCSServiceApp" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } diff --git a/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 index dc162e3db..e8d3b1471 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 @@ -21,6 +21,7 @@ Describe "xSPCacheAccounts" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } Mock Set-xSharePointCacheReaderPolicy {} Mock Set-xSharePointCacheOwnerPolicy {} diff --git a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 index 38ef599b3..ec6cc1635 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 @@ -35,6 +35,7 @@ Describe "xSPCreateFarm" { $versionBeingTested = (Get-Item $Global:CurrentSharePointStubModule).Directory.BaseName $majorBuildNumber = $versionBeingTested.Substring(0, $versionBeingTested.IndexOf(".")) + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = $majorBuildNumber } } diff --git a/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 index e9cbebfe6..2c8517882 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 @@ -36,6 +36,7 @@ Describe "xSPDiagnosticLoggingSettings" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } Context "Diagnostic configuration can not be loaded" { diff --git a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 index 8f7eedadb..010c27ffc 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 @@ -24,6 +24,7 @@ Describe "xSPDistributedCacheService" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path Import-Module "$RepoRoot\Tests\Stubs\DistributedCache\DistributedCache.psm1" -WarningAction SilentlyContinue diff --git a/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 index 3a0ea039a..91eecb543 100644 --- a/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 @@ -27,6 +27,7 @@ Describe "xSPFeature" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } Mock Enable-SPFeature {} Mock Disable-SPFeature {} diff --git a/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 index b224206fb..c57e51e37 100644 --- a/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 @@ -18,6 +18,7 @@ Describe "xSPInstall" { ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" Ensure = "Present" } + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Context "SharePoint binaries are not installed but should be" { Mock Get-CimInstance { return $null } diff --git a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 index ccbf690e8..dcac7762a 100644 --- a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 @@ -21,6 +21,7 @@ Describe "xSPInstallPrereqs" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") $versionBeingTested = (Get-Item $Global:CurrentSharePointStubModule).Directory.BaseName $majorBuildNumber = $versionBeingTested.Substring(0, $versionBeingTested.IndexOf(".")) diff --git a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 index b91bf63c3..f78c49e75 100644 --- a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 @@ -21,6 +21,7 @@ Describe "xSPJoinFarm" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } Mock Connect-SPConfigurationDatabase {} Mock Install-SPHelpCollection {} diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 index 24a679b4a..7d2d41236 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 @@ -23,6 +23,7 @@ Describe "xSPManagedAccount" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } Mock New-SPManagedAccount { } Mock Set-SPManagedAccount { } diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 index 85dd3fd64..d51336231 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 @@ -22,6 +22,7 @@ Describe "xSPManagedMetaDataServiceApp" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } Context "When no service application exists in the current farm" { diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 index 38331a592..5fc319740 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 @@ -22,6 +22,7 @@ Describe "xSPManagedPath" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } Mock New-SPManagedPath { } diff --git a/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 index 6cfb0f037..30ef0b45c 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 @@ -20,6 +20,7 @@ Describe "xSPSearchServiceApp" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } Context "When no service application exists in the current farm" { diff --git a/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 index 8722f4bc6..eb3ee009e 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 @@ -21,6 +21,7 @@ Describe "xSPSecureStoreServiceApp" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } $versionBeingTested = (Get-Item $Global:CurrentSharePointStubModule).Directory.BaseName diff --git a/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 index ee02b76c6..306bd8c4a 100644 --- a/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 @@ -20,6 +20,7 @@ Describe "xSPServiceAppPool" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } Mock New-SPServiceApplicationPool { } diff --git a/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 index 31d6f079c..ed08fb904 100644 --- a/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 @@ -20,6 +20,7 @@ Describe "xSPServiceInstance" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } Mock Start-SPServiceInstance { } Mock Stop-SPServiceInstance { } diff --git a/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 index 921d1c797..56cfcc4b3 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 @@ -20,6 +20,7 @@ Describe "xSPSite" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } Mock New-SPSite { } diff --git a/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 index 8a2e60caa..d2fd9bdf7 100644 --- a/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 @@ -20,6 +20,7 @@ Describe "xSPStateServiceApp" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } Mock New-SPStateServiceDatabase { return @{} } Mock New-SPStateServiceApplication { return @{} } diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 index e666757cc..0ff6400a7 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 @@ -21,6 +21,7 @@ Describe "xSPUserProfileServiceApp" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } Mock Get-UserProfileServiceProperties { return @{ ProfileDatabase = @{ diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 index 5e42c1d43..21e296e2f 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 @@ -21,6 +21,7 @@ Describe "xSPUserProfileSyncService" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } Mock Get-SPFarm { return @{ DefaultServiceAccount = @{ Name = $testParams.FarmAccount.Username } diff --git a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 index 9afd4a661..a9d7e6358 100644 --- a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 @@ -23,6 +23,7 @@ Describe "xSPWebApplication" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } Mock New-SPAuthenticationProvider { } Mock New-SPWebApplication { } diff --git a/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 index 4826fc22b..1c8731e8e 100644 --- a/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 @@ -23,6 +23,7 @@ Describe "xSPUsageApplication" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } Mock New-SPUsageApplication { } Mock Set-SPUsageService { } From 2018ab83e11ec66ba68c74588a96c637d8d86bb6 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 24 Sep 2015 08:19:47 +1000 Subject: [PATCH 089/146] Fixing missed module import --- Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 index ec6cc1635..a2c1aa235 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 @@ -24,6 +24,7 @@ Describe "xSPCreateFarm" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } Mock New-SPConfigurationDatabase {} Mock Install-SPHelpCollection {} From ef2fd8aa7adc2a07bffc9bfbde2c0695a12f72bd Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 24 Sep 2015 08:21:37 +1000 Subject: [PATCH 090/146] Fixed spacing --- Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 index a2c1aa235..b13ea4778 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 @@ -24,7 +24,7 @@ Describe "xSPCreateFarm" { } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } Mock New-SPConfigurationDatabase {} Mock Install-SPHelpCollection {} From 16958648c2f0cdd05f996b107610d303846defa8 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 24 Sep 2015 08:25:04 +1000 Subject: [PATCH 091/146] Removed duplicate load --- Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 | 2 -- 1 file changed, 2 deletions(-) diff --git a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 index b13ea4778..344e2aea3 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 @@ -36,8 +36,6 @@ Describe "xSPCreateFarm" { $versionBeingTested = (Get-Item $Global:CurrentSharePointStubModule).Directory.BaseName $majorBuildNumber = $versionBeingTested.Substring(0, $versionBeingTested.IndexOf(".")) - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = $majorBuildNumber } } Context "no farm is configured locally and a supported version of SharePoint is installed" { From 81bc151fc05002cf28106d2d1e4a034719509d08 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 24 Sep 2015 19:39:13 +1000 Subject: [PATCH 092/146] Updated build to 0.7 --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index d96aa691f..f37a60a92 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 0.6.{build}.0 +version: 0.7.{build}.0 install: - cinst -y pester @@ -24,7 +24,7 @@ after_test: - ps: | Remove-Item (Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.pssproj") $manifest = Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.psd1" - (Get-Content $manifest -Raw).Replace("0.6.0.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest + (Get-Content $manifest -Raw).Replace("0.7.0.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest Add-Type -assemblyname System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::CreateFromDirectory("$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint", "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip") Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } From 3a6d819fffc31f85f1ecf13a98ea70e1e50fb44e Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 24 Sep 2015 19:39:52 +1000 Subject: [PATCH 093/146] Updated to 0.7 --- Modules/xSharePoint/xSharePoint.psd1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1 index 800950a2a..f4cc7d1b5 100644 --- a/Modules/xSharePoint/xSharePoint.psd1 +++ b/Modules/xSharePoint/xSharePoint.psd1 @@ -12,7 +12,7 @@ # RootModule = '' # Version number of this module. -ModuleVersion = '0.6.0.0' +ModuleVersion = '0.7.0.0' # ID used to uniquely identify this module GUID = '6c1176a0-4fac-4134-8ca2-3fa8a21a7b90' From c02d97394d1b5f7517d6c09edbc2bf3b1020249e Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 25 Sep 2015 13:19:31 +1000 Subject: [PATCH 094/146] Fixed loading of PSSnapin --- .../MSFT_xSPBCSServiceApp.psm1 | 6 +-- .../MSFT_xSPCacheAccounts.psm1 | 4 +- .../MSFT_xSPCreateFarm.psm1 | 4 +- .../MSFT_xSPDiagnosticLoggingSettings.psm1 | 4 +- .../MSFT_xSPDistributedCacheService.psm1 | 6 +-- .../MSFT_xSPFeature/MSFT_xSPFeature.psm1 | 4 +- .../MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 | 4 +- .../MSFT_xSPManagedAccount.psm1 | 4 +- .../MSFT_xSPManagedMetaDataServiceApp.psm1 | 6 +-- .../MSFT_xSPManagedPath.psm1 | 4 +- .../MSFT_xSPSearchServiceApp.psm1 | 6 +-- .../MSFT_xSPSecureStoreServiceApp.psm1 | 6 +-- .../MSFT_xSPServiceAppPool.psm1 | 4 +- .../MSFT_xSPServiceInstance.psm1 | 6 +-- .../MSFT_xSPSite/MSFT_xSPSite.psm1 | 4 +- .../MSFT_xSPStateServiceApp.psm1 | 4 +- .../MSFT_xSPUsageApplication.psm1 | 6 +-- .../MSFT_xSPUserProfileServiceApp.psm1 | 4 +- .../MSFT_xSPUserProfileSyncService.psm1 | 4 +- .../MSFT_xSPWebApplication.psm1 | 4 +- .../xSharePoint.DistributedCache.psm1 | 2 +- .../xSharePoint.Util/xSharePoint.Util.psm1 | 54 +++++-------------- Modules/xSharePoint/xSharePoint.psd1 | 7 ++- appveyor.yml | 4 +- 24 files changed, 67 insertions(+), 94 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 index 00a4c102e..9163e831a 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 @@ -14,7 +14,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue if ($null -eq $serviceApps) { @@ -57,7 +57,7 @@ function Set-TargetResource Write-Verbose -Message "Creating BCS Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + New-SPBusinessDataCatalogServiceApplication -Name $params.Name ` -ApplicationPool $params.ApplicationPool ` @@ -70,7 +70,7 @@ function Set-TargetResource Write-Verbose -Message "Updating BCS Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 index 098b24ed4..1034c3baf 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 @@ -14,7 +14,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue @@ -54,7 +54,7 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue if ($null -eq $wa) { diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 index c039da403..30aa00b47 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 @@ -17,7 +17,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" try { $spFarm = Get-SPFarm @@ -68,7 +68,7 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" $newFarmArgs = @{ DatabaseServer = $params.DatabaseServer diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 index c18d2e1ef..a9eac3b62 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 @@ -29,7 +29,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $dc = Get-SPDiagnosticConfig -ErrorAction SilentlyContinue if ($null -eq $dc) { return $null } @@ -90,7 +90,7 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } $params = $params | Rename-xSharePointParamValue -oldName "LogPath" -newName "LogLocation" ` diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index 2eafd31f2..195f0ab1b 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -23,7 +23,7 @@ function Get-TargetResource } try { - Initialize-xSharePointPSSnapin + Use-CacheCluster -ErrorAction SilentlyContinue $cacheHost = Get-CacheHost -ErrorAction SilentlyContinue @@ -84,14 +84,14 @@ function Set-TargetResource Write-Verbose -Message "Enabling distributed cache service" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + Add-xSharePointDistributedCacheServer -CacheSizeInMB $params.CacheSizeInMB -ServiceAccount $params.ServiceAccount } } } else { Write-Verbose -Message "Removing distributed cache to the server" Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { - Initialize-xSharePointPSSnapin + Remove-xSharePointDistributedCacheServer } if ($CreateFirewallRules -eq $true) { diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 index 872610d40..ea16a0fb2 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 @@ -15,7 +15,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $feature = Get-SPFeature -Identity $params.Name -ErrorAction SilentlyContinue @@ -64,7 +64,7 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $runParams = @{} $runParams.Add("Identity", $params.Name) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 index 693b31a9e..53418eb70 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 @@ -14,7 +14,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + try { $spFarm = Get-SPFarm -ErrorAction SilentlyContinue @@ -52,7 +52,7 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $joinFarmArgs = @{ DatabaseServer = $params.DatabaseServer diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 index 89158a88c..015e3fc95 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 @@ -16,7 +16,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + try { $ma = Get-SPManagedAccount -Identity $params.Account.UserName -ErrorAction SilentlyContinue @@ -53,7 +53,7 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $current = Get-TargetResource @params if ($current.Count -eq 0) { diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 index 52d25f9b2..79b301f55 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 @@ -15,7 +15,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + try { @@ -67,7 +67,7 @@ function Set-TargetResource Write-Verbose -Message "Creating Managed Metadata Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } @@ -88,7 +88,7 @@ function Set-TargetResource Write-Verbose -Message "Updating Managed Metadata Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object { $_.TypeName -eq "Managed Metadata Service" } $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 index f9f51a59e..30da5d478 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 @@ -15,7 +15,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $getParams = @{ Identity = $params.RelativeUrl @@ -56,7 +56,7 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $path = Get-TargetResource @params -ErrorAction SilentlyContinue diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 index 43af1b72c..ff62feb88 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 @@ -15,7 +15,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue if ($null -eq $serviceApps) { @@ -57,7 +57,7 @@ function Set-TargetResource Write-Verbose -Message "Creating Search Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } @@ -73,7 +73,7 @@ function Set-TargetResource Write-Verbose -Message "Updating Search Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object { $_.TypeName -eq "Search Service Application" } $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 index 26e402f6b..3fad07354 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 @@ -23,7 +23,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue if ($null -eq $serviceApps) { @@ -74,7 +74,7 @@ function Set-TargetResource Write-Verbose -Message "Creating Secure Store Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } @@ -98,7 +98,7 @@ function Set-TargetResource Write-Verbose -Message "Updating Secure Store Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object { $_.TypeName -eq "Secure Store Service Application" } $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 index cf028547e..7ebe121e8 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 @@ -13,7 +13,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $sap = Get-SPServiceApplicationPool -Identity $params.Name -ErrorAction SilentlyContinue if ($null -eq $sap) { return $null } @@ -42,7 +42,7 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $sap = Get-SPServiceApplicationPool -Identity $params.Name -ErrorAction SilentlyContinue if ($null -eq $sap) { diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 index 024b0b74b..2fefb2ef4 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 @@ -13,7 +13,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq $params.Name } if ($null -eq $si) { return @{ @@ -48,7 +48,7 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq $params.Name } if ($null -eq $si) { @@ -61,7 +61,7 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq $params.Name } if ($null -eq $si) { diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 index c4ccb2ae8..fe9206883 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 @@ -24,7 +24,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $site = Get-SPSite -Identity $params.Url -ErrorAction SilentlyContinue @@ -100,7 +100,7 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $params.Remove("InstallAccount") | Out-Null diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 index b33990c45..1637f5c3c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 @@ -15,7 +15,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $serviceApp = Get-SPStateServiceApplication -Identity $params.Name -ErrorAction SilentlyContinue @@ -48,7 +48,7 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $app = Get-SPStateServiceApplication -Identity $params.Name -ErrorAction SilentlyContinue if ($null -eq $app) { diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 index e9ea867a5..088d93e97 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 @@ -21,7 +21,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue if ($null -eq $serviceApps) { @@ -80,7 +80,7 @@ function Set-TargetResource if ($null -eq $CurrentState) { Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $newParams = @{} $newParams.Add("Name", $params.Name) @@ -97,7 +97,7 @@ function Set-TargetResource Write-Verbose -Message "Configuring usage application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $setParams = @{} $setParams.Add("LoggingEnabled", $true) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 index 296834a8c..4e5698f54 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 @@ -21,7 +21,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue if ($null -eq $serviceApps) { @@ -114,7 +114,7 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $FarmAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } $params.Remove("FarmAccount") | Out-Null diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 index 00ecf09a5..493bd1971 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 @@ -13,7 +13,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $syncService = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq "User Profile Synchronization Service" } @@ -74,7 +74,7 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $FarmAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $syncService = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq "User Profile Synchronization Service" } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 index a4e29c115..1b519c8a6 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 @@ -22,7 +22,7 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $wa = Get-SPWebApplication -Identity $params.Name -ErrorAction SilentlyContinue if ($null -eq $wa) { return $null } @@ -73,7 +73,7 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Initialize-xSharePointPSSnapin + $wa = Get-SPWebApplication -Identity $params.Name -ErrorAction SilentlyContinue if ($null -eq $wa) { diff --git a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 index c77b28fee..10aec41db 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 @@ -10,7 +10,7 @@ function Add-xSharePointDistributedCacheServer() { [System.String] $ServiceAccount ) - Initialize-xSharePointPSSnapin + Add-SPDistributedCacheServiceInstance Update-SPDistributedCacheSize -CacheSizeInMB $CacheSizeInMB diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 8be3d0114..6254965a0 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -18,7 +18,7 @@ function Invoke-xSharePointCommand() { $VerbosePreference = 'Continue' $invokeArgs = @{ - ScriptBlock = $ScriptBlock + ScriptBlock = [ScriptBlock]::Create("Initialize-xSharePointPSSnapin; " + $ScriptBlock.ToString()) } if ($null -ne $Arguments) { $invokeArgs.Add("ArgumentList", $Arguments) @@ -31,7 +31,7 @@ function Invoke-xSharePointCommand() { } Write-Verbose "Executing as the local run as user $($Env:USERDOMAIN)\$($Env:USERNAME)" - $result = Invoke-Command @invokeArgs -Verbose + $result = Invoke-Command @invokeArgs -Verbose -NoNewScope return $result } else { if ($Credential.UserName.Split("\")[1] -eq $Env:USERNAME) { @@ -56,45 +56,19 @@ function Invoke-xSharePointCommand() { } } -function Invoke-xSharePointSPCmdlet() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - [string] - $CmdletName, - - [parameter(Mandatory = $false,Position=2)] - [HashTable] - $Arguments - ) - - Write-Verbose "Preparing to execute SharePoint command - $CmdletName" - - if ($null -ne $Arguments -and $Arguments.Count -gt 0) { - $argumentsString = "" - $Arguments.Keys | ForEach-Object { - $argumentsString += "$($_): $($Arguments.$_); " - } - Write-Verbose "Arguments for $CmdletName - $argumentsString" - } - - if ($null -eq $Arguments) { - $script = ([scriptblock]::Create("Initialize-xSharePointPSSnapin; $CmdletName; `$params = `$null")) - $result = Invoke-Command -ScriptBlock $script -NoNewScope - } else { - $script = ([scriptblock]::Create("Initialize-xSharePointPSSnapin; `$params = `$args[0]; $CmdletName @params; `$params = `$null")) - $result = Invoke-Command -ScriptBlock $script -ArgumentList $Arguments -NoNewScope - } - return $result -} - function Initialize-xSharePointPSSnapin() { - if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) - { - Write-Verbose "Loading SharePoint PowerShell snapin" - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" - } + Write-Verbose "Checking for the powershell snapin" + if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) + { + Write-Verbose "Loading SharePoint PowerShell snapin" + try + { + Add-PSSnapin "Microsoft.SharePoint.PowerShell" + } catch { + Write-Verbose ( $_ | Format-List | Out-String ) + } + + } } function Rename-xSharePointParamValue() { diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1 index 800950a2a..81a314ddd 100644 --- a/Modules/xSharePoint/xSharePoint.psd1 +++ b/Modules/xSharePoint/xSharePoint.psd1 @@ -12,7 +12,7 @@ # RootModule = '' # Version number of this module. -ModuleVersion = '0.6.0.0' +ModuleVersion = '0.7.0.0' # ID used to uniquely identify this module GUID = '6c1176a0-4fac-4134-8ca2-3fa8a21a7b90' @@ -75,9 +75,7 @@ FunctionsToExport = '*' CmdletsToExport = @("Add-xSharePointDistributedCacheServer", "Remove-xSharePointDistributedCacheServer", "Invoke-xSharePointCommand", - "Initialize-xSharePointPSSnapin", "Get-xSharePointInstalledProductVersion", - "Invoke-xSharePointSPCmdlet", "Rename-xSharePointParamValue", "Update-xSharePointObject", "Set-xSharePointCacheReaderPolicy", @@ -89,7 +87,8 @@ CmdletsToExport = @("Add-xSharePointDistributedCacheServer", "Remove-xSharePointUserToLocalAdmin", "Test-xSharePointUserIsLocalAdmin", "Set-xSharePointUserProfileSyncMachine", - "Test-xSharePointSpecificParameters") + "Test-xSharePointSpecificParameters", + "Initialize-xSharePointPSSnapin") # Variables to export from this module VariablesToExport = '*' diff --git a/appveyor.yml b/appveyor.yml index d96aa691f..f37a60a92 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 0.6.{build}.0 +version: 0.7.{build}.0 install: - cinst -y pester @@ -24,7 +24,7 @@ after_test: - ps: | Remove-Item (Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.pssproj") $manifest = Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.psd1" - (Get-Content $manifest -Raw).Replace("0.6.0.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest + (Get-Content $manifest -Raw).Replace("0.7.0.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest Add-Type -assemblyname System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::CreateFromDirectory("$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint", "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip") Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } From a8aef31d23f6bab7b0fd620b2c1db9c5e9dc0c01 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 25 Sep 2015 13:20:26 +1000 Subject: [PATCH 095/146] Fixed spacing in file --- .../xSharePoint.Util/xSharePoint.Util.psm1 | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 6254965a0..10daa4284 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -57,18 +57,18 @@ function Invoke-xSharePointCommand() { } function Initialize-xSharePointPSSnapin() { - Write-Verbose "Checking for the powershell snapin" - if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) - { - Write-Verbose "Loading SharePoint PowerShell snapin" - try - { - Add-PSSnapin "Microsoft.SharePoint.PowerShell" - } catch { - Write-Verbose ( $_ | Format-List | Out-String ) - } - - } + Write-Verbose "Checking for the powershell snapin" + if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) + { + Write-Verbose "Loading SharePoint PowerShell snapin" + try + { + Add-PSSnapin "Microsoft.SharePoint.PowerShell" + } catch { + Write-Verbose ( $_ | Format-List | Out-String ) + } + + } } function Rename-xSharePointParamValue() { From eb49fd2e960b0f30aa424989b7705c198c68a470 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 25 Sep 2015 15:30:26 +1000 Subject: [PATCH 096/146] Updated module loads and minor mocks in tests --- .../MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 | 1 - .../MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 | 2 -- .../MSFT_xSPDistributedCacheService.psm1 | 2 -- .../MSFT_xSPManagedMetaDataServiceApp.psm1 | 8 ++++---- .../xSharePoint.DistributedCache.psm1 | 2 +- .../Modules/xSharePoint.Util/xSharePoint.Util.psm1 | 2 +- .../xSharePoint.xSPBCSServiceApp.Tests.ps1 | 10 ++++++---- .../xSharePoint.xSPCacheAccounts.Tests.ps1 | 9 ++++++--- .../xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 | 9 ++++++--- ...SharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 | 9 ++++++--- .../xSharePoint.xSPDistributedCacheService.Tests.ps1 | 12 +++++++----- Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 | 9 ++++++--- Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 | 7 ++++++- .../xSharePoint.xSPInstallPrereqs.Tests.ps1 | 8 ++++++-- Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 | 9 ++++++--- .../xSharePoint.xSPManagedAccount.Tests.ps1 | 9 ++++++--- ...SharePoint.xSPManagedMetadataServiceApp.Tests.ps1 | 12 ++++++++---- .../xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 | 9 ++++++--- .../xSharePoint.xSPSearchServiceApp.Tests.ps1 | 9 ++++++--- .../xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 | 10 ++++++---- .../xSharePoint.xSPServiceAppPool.Tests.ps1 | 10 ++++++---- .../xSharePoint.xSPServiceInstance.Tests.ps1 | 9 ++++++--- Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 | 9 ++++++--- .../xSharePoint.xSPStateServiceApp.Tests.ps1 | 9 ++++++--- .../xSharePoint.xSPUserProfileServiceApp.Tests.ps1 | 9 ++++++--- .../xSharePoint.xSPUserProfileSyncService.Tests.ps1 | 9 ++++++--- .../xSharePoint.xSPWebApplication.Tests.ps1 | 9 ++++++--- .../xSharePoint.xSPusageApplication.Tests.ps1 | 9 ++++++--- 28 files changed, 141 insertions(+), 80 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 index 9163e831a..bbd3967e7 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 @@ -15,7 +15,6 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue if ($null -eq $serviceApps) { return $null diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 index 30aa00b47..61983d91b 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 @@ -17,7 +17,6 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" try { $spFarm = Get-SPFarm @@ -68,7 +67,6 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" $newFarmArgs = @{ DatabaseServer = $params.DatabaseServer diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index 195f0ab1b..0c88f5104 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -23,8 +23,6 @@ function Get-TargetResource } try { - - Use-CacheCluster -ErrorAction SilentlyContinue $cacheHost = Get-CacheHost -ErrorAction SilentlyContinue diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 index 79b301f55..32e85b85c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 @@ -76,10 +76,10 @@ function Set-TargetResource { New-SPMetadataServiceApplicationProxy -Name ($params.Name + " Proxy") ` -ServiceApplication $app ` - -DefaultProxyGroup $true ` - -ContentTypePushdownEnabled $true ` - -DefaultKeywordTaxonomy = $true ` - -DefaultSiteCollectionTaxonomy = $true + -DefaultProxyGroup ` + -ContentTypePushdownEnabled ` + -DefaultKeywordTaxonomy ` + -DefaultSiteCollectionTaxonomy } } } diff --git a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 index 10aec41db..a41f95e12 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 @@ -10,7 +10,7 @@ function Add-xSharePointDistributedCacheServer() { [System.String] $ServiceAccount ) - + Initialize-xSharePointPSSnapin Add-SPDistributedCacheServiceInstance Update-SPDistributedCacheSize -CacheSizeInMB $CacheSizeInMB diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 10daa4284..6571791fe 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -31,7 +31,7 @@ function Invoke-xSharePointCommand() { } Write-Verbose "Executing as the local run as user $($Env:USERDOMAIN)\$($Env:USERNAME)" - $result = Invoke-Command @invokeArgs -Verbose -NoNewScope + $result = Invoke-Command @invokeArgs -Verbose return $result } else { if ($Credential.UserName.Split("\")[1] -eq $Env:USERNAME) { diff --git a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 index 1a8f20237..190ac91ad 100644 --- a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 @@ -26,10 +26,12 @@ Describe "xSPBCSServiceApp" { DatabaseServer = "TestServer\Instance" } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - - Mock Initialize-xSharePointPSSnapin { } + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Context "When no service application exists in the current farm" { diff --git a/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 index e8d3b1471..288d6178d 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 @@ -20,9 +20,12 @@ Describe "xSPCacheAccounts" { SuperReaderAlias = "DEMO\SuperReader" } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Mock Set-xSharePointCacheReaderPolicy {} Mock Set-xSharePointCacheOwnerPolicy {} Mock Update-xSharePointObject {} diff --git a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 index 344e2aea3..b071a2e6e 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 @@ -23,9 +23,12 @@ Describe "xSPCreateFarm" { CentralAdministrationPort = 1234 } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Mock New-SPConfigurationDatabase {} Mock Install-SPHelpCollection {} Mock Initialize-SPResourceSecurity {} diff --git a/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 index 2c8517882..6b5d33b6d 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 @@ -35,9 +35,12 @@ Describe "xSPDiagnosticLoggingSettings" { EventLogFloodProtectionNotifyInterval = 5 } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Context "Diagnostic configuration can not be loaded" { Mock Get-SPDiagnosticConfig { return $null } diff --git a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 index 010c27ffc..366874a8e 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 @@ -23,13 +23,15 @@ Describe "xSPDistributedCacheService" { CreateFirewallRules = $true } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.DistributedCache" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue $RepoRoot = (Resolve-Path $PSScriptRoot\..\..).Path Import-Module "$RepoRoot\Tests\Stubs\DistributedCache\DistributedCache.psm1" -WarningAction SilentlyContinue - - Mock Initialize-xSharePointPSSnapin { } - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.DistributedCache" Mock Use-CacheCluster { } Mock Get-WmiObject { return @{ StartName = $testParams.ServiceAccount } } Mock Get-NetFirewallRule { return @{} } diff --git a/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 index 91eecb543..6c7bb2a57 100644 --- a/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 @@ -26,9 +26,12 @@ Describe "xSPFeature" { Ensure = "Present" } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Mock Enable-SPFeature {} Mock Disable-SPFeature {} diff --git a/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 index c57e51e37..530d0fa29 100644 --- a/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 @@ -18,7 +18,12 @@ Describe "xSPInstall" { ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" Ensure = "Present" } - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Context "SharePoint binaries are not installed but should be" { Mock Get-CimInstance { return $null } diff --git a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 index dcac7762a..fa7505b6c 100644 --- a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 @@ -20,8 +20,12 @@ Describe "xSPInstallPrereqs" { Ensure = "Present" } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue $versionBeingTested = (Get-Item $Global:CurrentSharePointStubModule).Directory.BaseName $majorBuildNumber = $versionBeingTested.Substring(0, $versionBeingTested.IndexOf(".")) diff --git a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 index f78c49e75..655af33d9 100644 --- a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 @@ -20,9 +20,12 @@ Describe "xSPJoinFarm" { Passphrase = "passphrase" } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Mock Connect-SPConfigurationDatabase {} Mock Install-SPHelpCollection {} Mock Initialize-SPResourceSecurity {} diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 index 7d2d41236..23377903b 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 @@ -22,9 +22,12 @@ Describe "xSPManagedAccount" { AccountName = "username" } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Mock New-SPManagedAccount { } Mock Set-SPManagedAccount { } diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 index d51336231..fd7ef366a 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 @@ -21,14 +21,18 @@ Describe "xSPManagedMetaDataServiceApp" { DatabaseName = "SP_MMS" } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Context "When no service application exists in the current farm" { Mock Get-SPServiceApplication { return $null } - Mock New-SPMetadataServiceApplication { } + Mock New-SPMetadataServiceApplication { return @{} } + Mock New-SPMetadataServiceApplicationProxy { return @{} } It "returns null from the Get method" { Get-TargetResource @testParams | Should BeNullOrEmpty diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 index 5fc319740..abaaa2b29 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 @@ -21,9 +21,12 @@ Describe "xSPManagedPath" { HostHeader = $false } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Mock New-SPManagedPath { } Context "The managed path does not exist and should" { diff --git a/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 index 30ef0b45c..91508ca93 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 @@ -19,9 +19,12 @@ Describe "xSPSearchServiceApp" { ApplicationPool = "SharePoint Search Services" } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Context "When no service application exists in the current farm" { diff --git a/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 index eb3ee009e..e21b14c22 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 @@ -20,10 +20,12 @@ Describe "xSPSecureStoreServiceApp" { AuditingEnabled = $false } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } - + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue $versionBeingTested = (Get-Item $Global:CurrentSharePointStubModule).Directory.BaseName $majorBuildNumber = $versionBeingTested.Substring(0, $versionBeingTested.IndexOf(".")) diff --git a/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 index 306bd8c4a..f33956f1b 100644 --- a/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 @@ -19,10 +19,12 @@ Describe "xSPServiceAppPool" { ServiceAccount = "DEMO\svcSPServiceApps" } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } - + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Mock New-SPServiceApplicationPool { } Mock Set-SPServiceApplicationPool { } diff --git a/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 index ed08fb904..5edd6b47e 100644 --- a/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 @@ -19,9 +19,12 @@ Describe "xSPServiceInstance" { Ensure = "Present" } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Mock Start-SPServiceInstance { } Mock Stop-SPServiceInstance { } diff --git a/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 index 56cfcc4b3..304f27850 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 @@ -19,9 +19,12 @@ Describe "xSPSite" { OwnerAlias = "DEMO\User" } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Mock New-SPSite { } Context "The site doesn't exist yet and should" { diff --git a/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 index d2fd9bdf7..f774117ab 100644 --- a/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 @@ -19,9 +19,12 @@ Describe "xSPStateServiceApp" { DatabaseName = "SP_StateService" } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Mock New-SPStateServiceDatabase { return @{} } Mock New-SPStateServiceApplication { return @{} } Mock New-SPStateServiceApplicationProxy { return @{} } diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 index 0ff6400a7..74d1c88ac 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 @@ -20,9 +20,12 @@ Describe "xSPUserProfileServiceApp" { FarmAccount = New-Object System.Management.Automation.PSCredential ("domain\username", (ConvertTo-SecureString "password" -AsPlainText -Force)) } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Mock Get-UserProfileServiceProperties { return @{ ProfileDatabase = @{ Name = "SP_ProfileDB" diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 index 21e296e2f..76c1eb225 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 @@ -20,9 +20,12 @@ Describe "xSPUserProfileSyncService" { Ensure = "Present" } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Mock Get-SPFarm { return @{ DefaultServiceAccount = @{ Name = $testParams.FarmAccount.Username } }} diff --git a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 index a9d7e6358..7e1867263 100644 --- a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 @@ -22,9 +22,12 @@ Describe "xSPWebApplication" { AuthenticationMethod = "NTLM" } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Mock New-SPAuthenticationProvider { } Mock New-SPWebApplication { } diff --git a/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 index 1c8731e8e..de4241420 100644 --- a/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 @@ -22,9 +22,12 @@ Describe "xSPUsageApplication" { UsageLogMaxSpaceGB = 10 } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } + Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { + return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope + } + + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Mock New-SPUsageApplication { } Mock Set-SPUsageService { } Mock Get-SPUsageService { return @{ From 82bc4a71e35f1f7b21c987dea08737d7cd8451bc Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 25 Sep 2015 16:46:51 +1000 Subject: [PATCH 097/146] Updated module loading in tests --- .../xSharePoint.DistributedCache.psm1 | 1 + .../xSharePoint.UserProfileService.psm1 | 1 + Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 | 3 ++- Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 | 2 +- Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 | 2 +- .../xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 | 2 +- .../xSharePoint.xSPDistributedCacheService.Tests.ps1 | 2 +- Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 | 2 +- Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 | 1 + Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 | 2 +- Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 | 2 +- Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 | 2 +- .../xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 | 2 +- Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 | 2 +- Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 | 2 +- .../xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 | 2 +- Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 | 2 +- Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 | 2 +- Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 | 3 ++- Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 | 3 ++- .../xSharePoint.xSPUserProfileServiceApp.Tests.ps1 | 3 ++- .../xSharePoint.xSPUserProfileSyncService.Tests.ps1 | 3 ++- Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 | 5 +++-- Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 | 3 ++- 24 files changed, 32 insertions(+), 22 deletions(-) diff --git a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 index a41f95e12..4937688e7 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 @@ -41,6 +41,7 @@ function Remove-xSharePointDistributedCacheServer() { $instanceName ="SPDistributedCacheService Name=AppFabricCachingService" $serviceInstance = Get-SPServiceInstance | Where-Object { ($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq $env:computername } $serviceInstance.Delete() + Initialize-xSharePointPSSnapin Remove-SPDistributedCacheServiceInstance } diff --git a/Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 b/Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 index d052d5188..dab52d34c 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 @@ -63,6 +63,7 @@ function Set-xSharePointUserProfileSyncMachine() { [PSCredential] $FarmAccount ) + Initialize-xSharePointPSSnapin $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue if ($null -eq $serviceApps) { return $null diff --git a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 index 190ac91ad..8e8095911 100644 --- a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 @@ -25,13 +25,14 @@ Describe "xSPBCSServiceApp" { DatabaseName = "Test_DB" DatabaseServer = "TestServer\Instance" } + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue Context "When no service application exists in the current farm" { diff --git a/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 index 288d6178d..ec2148082 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 @@ -19,7 +19,7 @@ Describe "xSPCacheAccounts" { SuperUserAlias = "DEMO\SuperUser" SuperReaderAlias = "DEMO\SuperReader" } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope diff --git a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 index b071a2e6e..bd9680bdd 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 @@ -22,7 +22,7 @@ Describe "xSPCreateFarm" { AdminContentDatabaseName = "Admin_Content" CentralAdministrationPort = 1234 } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope diff --git a/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 index 6b5d33b6d..326fbd9fa 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 @@ -34,7 +34,7 @@ Describe "xSPDiagnosticLoggingSettings" { EventLogFloodProtectionQuietPeriod = 5 EventLogFloodProtectionNotifyInterval = 5 } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope diff --git a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 index 366874a8e..d64f7f8e9 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 @@ -22,7 +22,7 @@ Describe "xSPDistributedCacheService" { ServiceAccount = "DOMAIN\user" CreateFirewallRules = $true } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.DistributedCache" Mock Invoke-xSharePointCommand { diff --git a/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 index 6c7bb2a57..f84656125 100644 --- a/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 @@ -25,7 +25,7 @@ Describe "xSPFeature" { Url = "http://site.sharepoint.com" Ensure = "Present" } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope diff --git a/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 index 530d0fa29..878e0895f 100644 --- a/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 @@ -18,6 +18,7 @@ Describe "xSPInstall" { ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" Ensure = "Present" } + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope diff --git a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 index fa7505b6c..76a17180d 100644 --- a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 @@ -19,7 +19,7 @@ Describe "xSPInstallPrereqs" { OnlineMode = $true Ensure = "Present" } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope diff --git a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 index 655af33d9..66b36f5bf 100644 --- a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 @@ -19,7 +19,7 @@ Describe "xSPJoinFarm" { DatabaseServer = "DatabaseServer\Instance" Passphrase = "passphrase" } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 index 23377903b..c1eb27e32 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 @@ -21,7 +21,7 @@ Describe "xSPManagedAccount" { Schedule = "" AccountName = "username" } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 index fd7ef366a..eeef78fdd 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 @@ -20,7 +20,7 @@ Describe "xSPManagedMetaDataServiceApp" { DatabaseServer = "databaseserver\instance" DatabaseName = "SP_MMS" } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 index abaaa2b29..aa08e2dce 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 @@ -20,7 +20,7 @@ Describe "xSPManagedPath" { Explicit = $false HostHeader = $false } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope diff --git a/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 index 91508ca93..867714ea0 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 @@ -18,7 +18,7 @@ Describe "xSPSearchServiceApp" { Name = "Search Service Application" ApplicationPool = "SharePoint Search Services" } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope diff --git a/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 index e21b14c22..dbc9ea890 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 @@ -19,7 +19,7 @@ Describe "xSPSecureStoreServiceApp" { ApplicationPool = "SharePoint Search Services" AuditingEnabled = $false } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope diff --git a/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 index f33956f1b..b04d57344 100644 --- a/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 @@ -18,7 +18,7 @@ Describe "xSPServiceAppPool" { Name = "Service pool" ServiceAccount = "DEMO\svcSPServiceApps" } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope diff --git a/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 index 5edd6b47e..466389c87 100644 --- a/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 @@ -18,7 +18,7 @@ Describe "xSPServiceInstance" { Name = "Service pool" Ensure = "Present" } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope diff --git a/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 index 304f27850..5ef04b2b6 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 @@ -18,13 +18,14 @@ Describe "xSPSite" { Url = "http://site.sharepoint.com" OwnerAlias = "DEMO\User" } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock New-SPSite { } Context "The site doesn't exist yet and should" { diff --git a/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 index f774117ab..d0d11e9d6 100644 --- a/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 @@ -18,13 +18,14 @@ Describe "xSPStateServiceApp" { Name = "State Service App" DatabaseName = "SP_StateService" } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock New-SPStateServiceDatabase { return @{} } Mock New-SPStateServiceApplication { return @{} } Mock New-SPStateServiceApplicationProxy { return @{} } diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 index 74d1c88ac..21d2563db 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 @@ -19,13 +19,14 @@ Describe "xSPUserProfileServiceApp" { ApplicationPool = "SharePoint Service Applications" FarmAccount = New-Object System.Management.Automation.PSCredential ("domain\username", (ConvertTo-SecureString "password" -AsPlainText -Force)) } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Get-UserProfileServiceProperties { return @{ ProfileDatabase = @{ Name = "SP_ProfileDB" diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 index 76c1eb225..0d97e077c 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 @@ -19,13 +19,14 @@ Describe "xSPUserProfileSyncService" { FarmAccount = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) Ensure = "Present" } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock Get-SPFarm { return @{ DefaultServiceAccount = @{ Name = $testParams.FarmAccount.Username } }} diff --git a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 index 7e1867263..d235969c4 100644 --- a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 @@ -21,13 +21,14 @@ Describe "xSPWebApplication" { Url = "http://sites.sharepoint.com" AuthenticationMethod = "NTLM" } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } - Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock New-SPAuthenticationProvider { } Mock New-SPWebApplication { } diff --git a/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 index de4241420..32146ecd3 100644 --- a/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 @@ -21,13 +21,14 @@ Describe "xSPUsageApplication" { UsageLogMaxFileSizeKB = 1024 UsageLogMaxSpaceGB = 10 } - + Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + Mock New-SPUsageApplication { } Mock Set-SPUsageService { } Mock Get-SPUsageService { return @{ From a57dd9c88af263a5d971c5ade8e6bdf5a39d5f64 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 25 Sep 2015 18:57:22 +1000 Subject: [PATCH 098/146] Consolidated DCache and UPS functions to resources --- .../MSFT_xSPDistributedCacheService.psm1 | 50 +++++++++++-- .../MSFT_xSPUserProfileSyncService.psm1 | 27 ++++++- .../xSharePoint.DistributedCache.psm1 | 72 ------------------- .../xSharePoint.UserProfileService.psm1 | 25 ------- Modules/xSharePoint/xSharePoint.psd1 | 11 +-- Modules/xSharePoint/xSharePoint.pssproj | 2 - 6 files changed, 72 insertions(+), 115 deletions(-) delete mode 100644 Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index 0c88f5104..7837a34d2 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -72,8 +72,17 @@ function Set-TargetResource if($createFirewallRules -eq $true) { Write-Verbose -Message "Create a firewall rule for AppFabric" Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { - Enable-xSharePointDCIcmpFireWallRule - Enable-xSharePointDCFireWallRule + $icmpFirewallRule = Get-NetFirewallRule -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-In)" -ErrorAction SilentlyContinue + if($null -eq $icmpFirewallRule ) { + New-NetFirewallRule -Name Allow_Ping -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-In)" -Description "Allow ICMPv4 ping" -Protocol ICMPv4 -IcmpType 8 -Enabled True -Profile Any -Action Allow + } + Enable-NetFirewallRule -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-In)" + + $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distributed Cache" -ErrorAction SilentlyContinue + if($null -eq $firewallRule) { + New-NetFirewallRule -Name "SPDistCache" -DisplayName "SharePoint Distributed Cache" -Protocol TCP -LocalPort 22233-22236 -Group "SharePoint" + } + Enable-NetFirewallRule -DisplayName "SharePoint Distributed Cache" } Write-Verbose -Message "Firewall rule added" } @@ -83,24 +92,53 @@ function Set-TargetResource Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - Add-xSharePointDistributedCacheServer -CacheSizeInMB $params.CacheSizeInMB -ServiceAccount $params.ServiceAccount + Add-SPDistributedCacheServiceInstance + Update-SPDistributedCacheSize -CacheSizeInMB $params.CacheSizeInMB + + $farm = Get-SPFarm + $cacheService = $farm.Services | Where-Object { $_.Name -eq "AppFabricCachingService" } + $cacheService.ProcessIdentity.CurrentIdentityType = "SpecificUser" + + $account = Get-SPManagedAccount -Identity $params.ServiceAccount + $cacheService.ProcessIdentity.ManagedAccount = $account + + Update-DCacheService $cacheService } } } else { Write-Verbose -Message "Removing distributed cache to the server" Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { - - Remove-xSharePointDistributedCacheServer + $instanceName ="SPDistributedCacheService Name=AppFabricCachingService" + $serviceInstance = Get-SPServiceInstance | Where-Object { ($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq $env:computername } + $serviceInstance.Delete() + Initialize-xSharePointPSSnapin + Remove-SPDistributedCacheServiceInstance } if ($CreateFirewallRules -eq $true) { Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { - Disable-xSharePointDCFireWallRule + $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distribute Cache" -ErrorAction SilentlyContinue + if($null -ne $firewallRule) { + Write-Verbose -Message "Disabling firewall rules." + Disable-NetFirewallRule -DisplayName "SharePoint Distribute Cache" + } } } Write-Verbose -Message "Distributed cache removed." } } +function Update-DCacheService() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + [object] + $CacheService + ) + $CacheService.ProcessIdentity.Update() + $CacheService.ProcessIdentity.Deploy() +} + function Test-TargetResource { diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 index 493bd1971..e239267c9 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 @@ -80,7 +80,13 @@ function Set-TargetResource # Start the Sync service if it should be running on this server if (($params.Ensure -eq "Present") -and ($syncService.Status -ne "Online")) { - Set-xSharePointUserProfileSyncMachine -UserProfileServiceAppName $params.UserProfileServiceAppName -SyncServiceId $syncService.ID -FarmAccount $params.FarmAccount + $serviceApps = Get-SPServiceApplication -Name $params.UserProfileServiceAppName -ErrorAction SilentlyContinue + if ($null -eq $serviceApps) { + throw [Exception] "No user profile service was found named $($params.UserProfileServiceAppName)" + } + $ups = $serviceApps | Where-Object { $_.TypeName -eq "User Profile Service Application" } + + Set-UserProfileSyncMachine -SyncServiceId $syncService.ID -FarmAccount $params.FarmAccount Start-SPServiceInstance -Identity $syncService.ID $desiredState = "Online" @@ -111,6 +117,25 @@ function Set-TargetResource } } +function Set-UserProfileSyncMachine() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=2)] + [Guid] + $SyncServiceId, + + [parameter(Mandatory = $true,Position=3)] + [PSCredential] + $FarmAccount, + + [parameter(Mandatory = $true,Position=4)] + [object] + $Ups + ) + + $Ups.SetSynchronizationMachine($env:COMPUTERNAME, $SyncServiceId, $FarmAccount.UserName, $FarmAccount.GetNetworkCredential().Password) +} function Test-TargetResource { diff --git a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 b/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 deleted file mode 100644 index 4937688e7..000000000 --- a/Modules/xSharePoint/Modules/xSharePoint.DistributedCache/xSharePoint.DistributedCache.psm1 +++ /dev/null @@ -1,72 +0,0 @@ -function Add-xSharePointDistributedCacheServer() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - [System.Uint32] - $CacheSizeInMB, - - [parameter(Mandatory = $true,Position=2)] - [System.String] - $ServiceAccount - ) - Initialize-xSharePointPSSnapin - - Add-SPDistributedCacheServiceInstance - Update-SPDistributedCacheSize -CacheSizeInMB $CacheSizeInMB - - $farm = Get-SPFarm - $cacheService = $farm.Services | Where-Object { $_.Name -eq "AppFabricCachingService" } - $cacheService.ProcessIdentity.CurrentIdentityType = "SpecificUser" - - $account = Get-SPManagedAccount -Identity $ServiceAccount - $cacheService.ProcessIdentity.ManagedAccount = $account - - Update-xSharePointDistributedCacheService -CacheService $cacheService -} - -function Update-xSharePointDistributedCacheService() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - [object] - $CacheService - ) - $CacheService.ProcessIdentity.Update() - $CacheService.ProcessIdentity.Deploy() -} - -function Remove-xSharePointDistributedCacheServer() { - $instanceName ="SPDistributedCacheService Name=AppFabricCachingService" - $serviceInstance = Get-SPServiceInstance | Where-Object { ($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq $env:computername } - $serviceInstance.Delete() - Initialize-xSharePointPSSnapin - Remove-SPDistributedCacheServiceInstance -} - -function Enable-xSharePointDCIcmpFireWallRule() { - $firewallRule = Get-NetFirewallRule -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-In)" -ErrorAction SilentlyContinue - if($null -eq $firewallRule) { - New-NetFirewallRule -Name Allow_Ping -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-In)" -Description "Allow ICMPv4 ping" -Protocol ICMPv4 -IcmpType 8 -Enabled True -Profile Any -Action Allow - } - Enable-NetFirewallRule -DisplayName "File and Printer Sharing (Echo Request - ICMPv4-In)" -} - -function Enable-xSharePointDCFireWallRule() { - $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distributed Cache" -ErrorAction SilentlyContinue - if($null -eq $firewallRule) { - New-NetFirewallRule -Name "SPDistCache" -DisplayName "SharePoint Distributed Cache" -Protocol TCP -LocalPort 22233-22236 -Group "SharePoint" - } - Enable-NetFirewallRule -DisplayName "SharePoint Distributed Cache" -} - -function Disable-xSharePointDCFireWallRule() { - $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distribute Cache" -ErrorAction SilentlyContinue - if($null -ne $firewallRule) { - Write-Verbose -Message "Disabling firewall rules." - Disable-NetFirewallRule -DisplayName "SharePoint Distribute Cache" - } -} - -Export-ModuleMember -Function * diff --git a/Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 b/Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 index dab52d34c..2b029a1fb 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 @@ -47,29 +47,4 @@ function Remove-xSharePointUserToLocalAdmin() { ([ADSI]"WinNT://$($env:computername)/Administrators,group").Remove("WinNT://$domainName/$accountName") | Out-Null } -function Set-xSharePointUserProfileSyncMachine() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - [string] - $UserProfileServiceAppName, - - [parameter(Mandatory = $true,Position=2)] - [Guid] - $SyncServiceId, - - [parameter(Mandatory = $true,Position=3)] - [PSCredential] - $FarmAccount - ) - Initialize-xSharePointPSSnapin - $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue - if ($null -eq $serviceApps) { - return $null - } - $ups = $serviceApps | Where-Object { $_.TypeName -eq "User Profile Service Application" } - $ups.SetSynchronizationMachine($env:COMPUTERNAME, $SyncServiceId, $FarmAccount.UserName, $FarmAccount.GetNetworkCredential().Password) -} - Export-ModuleMember -Function * diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1 index 81a314ddd..beb912521 100644 --- a/Modules/xSharePoint/xSharePoint.psd1 +++ b/Modules/xSharePoint/xSharePoint.psd1 @@ -1,4 +1,4 @@ -# +]# # Module manifest for module 'xSharePoint' # # Generated by: Brian Farnhill @@ -64,7 +64,6 @@ Description = 'This DSC module is used to deploy and configure SharePoint Server # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess NestedModules = @("modules\xSharePoint.CacheAccounts\xSharePoint.CacheAccounts.psm1", - "modules\xSharePoint.DistributedCache\xSharePoint.DistributedCache.psm1", "modules\xSharePoint.UserProfileService\xSharePoint.UserProfileService.psm1", "modules\xSharePoint.Util\xSharePoint.Util.psm1") @@ -72,21 +71,15 @@ NestedModules = @("modules\xSharePoint.CacheAccounts\xSharePoint.CacheAccounts.p FunctionsToExport = '*' # Cmdlets to export from this module -CmdletsToExport = @("Add-xSharePointDistributedCacheServer", - "Remove-xSharePointDistributedCacheServer", - "Invoke-xSharePointCommand", +CmdletsToExport = @("Invoke-xSharePointCommand", "Get-xSharePointInstalledProductVersion", "Rename-xSharePointParamValue", "Update-xSharePointObject", "Set-xSharePointCacheReaderPolicy", "Set-xSharePointCacheOwnerPolicy", - "Enable-xSharePointDCIcmpFireWallRule", - "Enable-xSharePointDCFireWallRule", - "Disable-xSharePointDCFireWallRule", "Add-xSharePointUserToLocalAdmin", "Remove-xSharePointUserToLocalAdmin", "Test-xSharePointUserIsLocalAdmin", - "Set-xSharePointUserProfileSyncMachine", "Test-xSharePointSpecificParameters", "Initialize-xSharePointPSSnapin") diff --git a/Modules/xSharePoint/xSharePoint.pssproj b/Modules/xSharePoint/xSharePoint.pssproj index f246942c2..26dca94f6 100644 --- a/Modules/xSharePoint/xSharePoint.pssproj +++ b/Modules/xSharePoint/xSharePoint.pssproj @@ -77,7 +77,6 @@ - @@ -136,7 +135,6 @@ - From ec05e816da65de3ec345e6691cc99a670c21e650 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 25 Sep 2015 18:59:17 +1000 Subject: [PATCH 099/146] Removed typo character --- Modules/xSharePoint/xSharePoint.psd1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1 index beb912521..1d22f7597 100644 --- a/Modules/xSharePoint/xSharePoint.psd1 +++ b/Modules/xSharePoint/xSharePoint.psd1 @@ -1,4 +1,4 @@ -]# +# # Module manifest for module 'xSharePoint' # # Generated by: Brian Farnhill From e20309163e6465b9b198560f83ba14b19d52e060 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 25 Sep 2015 19:20:17 +1000 Subject: [PATCH 100/146] Refactored tests after module clean up --- .../MSFT_xSPDistributedCacheService.psm1 | 17 +++++++-- .../MSFT_xSPUserProfileSyncService.psm1 | 2 +- ...Point.xSPDistributedCacheService.Tests.ps1 | 37 ++++++++++--------- ...ePoint.xSPUserProfileSyncService.Tests.ps1 | 10 +++-- 4 files changed, 41 insertions(+), 25 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index 7837a34d2..44ce222b1 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -108,10 +108,9 @@ function Set-TargetResource } else { Write-Verbose -Message "Removing distributed cache to the server" Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { - $instanceName ="SPDistributedCacheService Name=AppFabricCachingService" - $serviceInstance = Get-SPServiceInstance | Where-Object { ($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq $env:computername } - $serviceInstance.Delete() - Initialize-xSharePointPSSnapin + $serviceInstance = Get-SPServiceInstance | Where-Object { ($_.Service.Tostring()) -eq "SPDistributedCacheService Name=AppFabricCachingService" -and ($_.Server.Name) -eq $env:computername } + Delete-DCacheService $serviceInstance + Remove-SPDistributedCacheServiceInstance } if ($CreateFirewallRules -eq $true) { @@ -139,6 +138,16 @@ function Update-DCacheService() { $CacheService.ProcessIdentity.Deploy() } +function Delete-DCacheService() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + [object] + $CacheService + ) + $CacheService.Delete() +} function Test-TargetResource { diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 index e239267c9..22a549cd6 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 @@ -86,7 +86,7 @@ function Set-TargetResource } $ups = $serviceApps | Where-Object { $_.TypeName -eq "User Profile Service Application" } - Set-UserProfileSyncMachine -SyncServiceId $syncService.ID -FarmAccount $params.FarmAccount + Set-UserProfileSyncMachine -SyncServiceId $syncService.ID -FarmAccount $params.FarmAccount -Ups $ups Start-SPServiceInstance -Identity $syncService.ID $desiredState = "Online" diff --git a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 index d64f7f8e9..50b360ca3 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 @@ -11,7 +11,6 @@ $Global:CurrentSharePointStubModule = $SharePointCmdletModule $ModuleName = "MSFT_xSPDistributedCacheService" Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\DSCResources\$ModuleName\$ModuleName.psm1") -Import-Module (Join-Path $RepoRoot "Modules\xSharePoint\Modules\xSharePoint.DistributedCache\xSharePoint.DistributedCache.psm1") Describe "xSPDistributedCacheService" { InModuleScope $ModuleName { @@ -24,7 +23,6 @@ Describe "xSPDistributedCacheService" { } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.DistributedCache" Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } @@ -35,20 +33,20 @@ Describe "xSPDistributedCacheService" { Mock Use-CacheCluster { } Mock Get-WmiObject { return @{ StartName = $testParams.ServiceAccount } } Mock Get-NetFirewallRule { return @{} } - Mock Get-NetFirewallRule { return @{} } -ModuleName "xSharePoint.DistributedCache" - Mock Enable-NetFirewallRule { } -ModuleName "xSharePoint.DistributedCache" - Mock New-NetFirewallRule { } -ModuleName "xSharePoint.DistributedCache" - Mock Disable-NetFirewallRule { } -ModuleName "xSharePoint.DistributedCache" - Mock Add-SPDistributedCacheServiceInstance { } -ModuleName "xSharePoint.DistributedCache" - Mock Update-SPDistributedCacheSize { } -ModuleName "xSharePoint.DistributedCache" - Mock Get-SPManagedAccount { return @{} } -ModuleName "xSharePoint.DistributedCache" + Mock Get-NetFirewallRule { return @{} } + Mock Enable-NetFirewallRule { } + Mock New-NetFirewallRule { } + Mock Disable-NetFirewallRule { } + Mock Add-SPDistributedCacheServiceInstance { } + Mock Update-SPDistributedCacheSize { } + Mock Get-SPManagedAccount { return @{} } Mock Get-SPFarm { return @{ Services = @(@{ Name = "AppFabricCachingService" ProcessIdentity = @{ ManagedAccount = $null } }) - } } -ModuleName "xSharePoint.DistributedCache" - Mock Update-xSharePointDistributedCacheService { } -ModuleName "xSharePoint.DistributedCache" + } } + Mock Update-DCacheService { } Context "Distributed cache is not configured" { @@ -64,7 +62,7 @@ Describe "xSPDistributedCacheService" { It "Sets up the cache correctly" { Set-TargetResource @testParams - Assert-MockCalled Add-SPDistributedCacheServiceInstance -ModuleName "xSharePoint.DistributedCache" + Assert-MockCalled Add-SPDistributedCacheServiceInstance } } @@ -88,7 +86,7 @@ Describe "xSPDistributedCacheService" { It "shuts down the distributed cache service" { Set-TargetResource @testParams - Assert-MockCalled Enable-NetFirewallRule -ModuleName "xSharePoint.DistributedCache" + Assert-MockCalled Enable-NetFirewallRule } } @@ -98,8 +96,13 @@ Describe "xSPDistributedCacheService" { Size = $testParams.CacheSizeInMB }} Mock Get-CacheHost { return @{ PortNo = 22233 } } - Mock Remove-xSharePointDistributedCacheServer { } - Mock Get-NetFirewallRule { return @{} } -ModuleName "xSharePoint.DistributedCache" + Mock Get-NetFirewallRule { return @{} } + Mock Get-SPServiceInstance { return @(@{ + Service = "SPDistributedCacheService Name=AppFabricCachingService" + Server = @{ Name = $env:COMPUTERNAME } + })} + Mock Delete-DCacheService { } + Mock Remove-SPDistributedCacheServiceInstance { } It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false @@ -107,8 +110,8 @@ Describe "xSPDistributedCacheService" { It "shuts down the distributed cache service" { Set-TargetResource @testParams - Assert-MockCalled Remove-xSharePointDistributedCacheServer - Assert-MockCalled Disable-NetFirewallRule -ModuleName "xSharePoint.DistributedCache" + Assert-MockCalled Remove-SPDistributedCacheServiceInstance + Assert-MockCalled Disable-NetFirewallRule } } } diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 index 0d97e077c..f0349ebf3 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 @@ -55,7 +55,11 @@ Describe "xSPUserProfileSyncService" { TypeName = "User Profile Synchronization Service" }) } - } + } + Mock Get-SPServiceApplication { return @{ + ID = [Guid]::NewGuid() + TypeName = "User Profile Service Application" + } } It "returns absent from the get method" { $Global:xSharePointUPACheck = $false @@ -69,7 +73,7 @@ Describe "xSPUserProfileSyncService" { It "calls the start service cmdlet from the set method" { $Global:xSharePointUPACheck = $false - Mock Set-xSharePointUserProfileSyncMachine { } + Mock Set-UserProfileSyncMachine { } Set-TargetResource @testParams Assert-MockCalled Start-SPServiceInstance @@ -127,7 +131,7 @@ Describe "xSPUserProfileSyncService" { It "calls the start service cmdlet from the set method" { $Global:xSharePointUPACheck = $false - Mock Set-xSharePointUserProfileSyncMachine { } -ModuleName "xSharePoint.UserProfileService" + Mock Set-UserProfileSyncMachine { } Set-TargetResource @testParams Assert-MockCalled Stop-SPServiceInstance From 47f4a299a23732a423e9f88a03cc7f075db131bd Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sat, 26 Sep 2015 22:24:00 +1000 Subject: [PATCH 101/146] Refactored method calls and test mocks --- .../MSFT_xSPDistributedCacheService.psm1 | 29 ++----------------- .../MSFT_xSPUserProfileSyncService.psm1 | 22 +------------- .../xSharePoint.Util/xSharePoint.Util.psm1 | 24 ++++++++------- ...Point.xSPDistributedCacheService.Tests.ps1 | 20 +++++++------ ...ePoint.xSPUserProfileSyncService.Tests.ps1 | 14 +++++---- 5 files changed, 36 insertions(+), 73 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index 44ce222b1..43c1fd263 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -101,15 +101,15 @@ function Set-TargetResource $account = Get-SPManagedAccount -Identity $params.ServiceAccount $cacheService.ProcessIdentity.ManagedAccount = $account - - Update-DCacheService $cacheService + $cacheService.ProcessIdentity.Update() + $cacheService.ProcessIdentity.Deploy() } } } else { Write-Verbose -Message "Removing distributed cache to the server" Invoke-xSharePointCommand -Credential $InstallAccount -ScriptBlock { $serviceInstance = Get-SPServiceInstance | Where-Object { ($_.Service.Tostring()) -eq "SPDistributedCacheService Name=AppFabricCachingService" -and ($_.Server.Name) -eq $env:computername } - Delete-DCacheService $serviceInstance + $serviceInstance.Delete() Remove-SPDistributedCacheServiceInstance } @@ -126,29 +126,6 @@ function Set-TargetResource } } -function Update-DCacheService() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - [object] - $CacheService - ) - $CacheService.ProcessIdentity.Update() - $CacheService.ProcessIdentity.Deploy() -} - -function Delete-DCacheService() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - [object] - $CacheService - ) - $CacheService.Delete() -} - function Test-TargetResource { [CmdletBinding()] diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 index 22a549cd6..01d422ee3 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 @@ -85,8 +85,8 @@ function Set-TargetResource throw [Exception] "No user profile service was found named $($params.UserProfileServiceAppName)" } $ups = $serviceApps | Where-Object { $_.TypeName -eq "User Profile Service Application" } + $ups.SetSynchronizationMachine($env:COMPUTERNAME, $syncService.ID, $params.FarmAccount.UserName, $params.FarmAccount.GetNetworkCredential().Password) - Set-UserProfileSyncMachine -SyncServiceId $syncService.ID -FarmAccount $params.FarmAccount -Ups $ups Start-SPServiceInstance -Identity $syncService.ID $desiredState = "Online" @@ -117,26 +117,6 @@ function Set-TargetResource } } -function Set-UserProfileSyncMachine() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=2)] - [Guid] - $SyncServiceId, - - [parameter(Mandatory = $true,Position=3)] - [PSCredential] - $FarmAccount, - - [parameter(Mandatory = $true,Position=4)] - [object] - $Ups - ) - - $Ups.SetSynchronizationMachine($env:COMPUTERNAME, $SyncServiceId, $FarmAccount.UserName, $FarmAccount.GetNetworkCredential().Password) -} - function Test-TargetResource { [CmdletBinding()] diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 6571791fe..064e147ef 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -10,6 +10,7 @@ function Invoke-xSharePointCommand() { [HashTable] $Arguments, + [parameter(Mandatory = $true)] [ScriptBlock] $ScriptBlock @@ -18,7 +19,7 @@ function Invoke-xSharePointCommand() { $VerbosePreference = 'Continue' $invokeArgs = @{ - ScriptBlock = [ScriptBlock]::Create("Initialize-xSharePointPSSnapin; " + $ScriptBlock.ToString()) + ScriptBlock = [ScriptBlock]::Create("Initialize-xSharePointPSSnapin -Verbose; " + $ScriptBlock.ToString()) } if ($null -ne $Arguments) { $invokeArgs.Add("ArgumentList", $Arguments) @@ -45,7 +46,7 @@ function Invoke-xSharePointCommand() { #Running garbage collection to resolve issues related to Azure DSC extention use [GC]::Collect() - $session = New-PSSession -ComputerName $env:COMPUTERNAME -Credential $Credential -Authentication CredSSP -Name "Microsoft.SharePoint.DSC" -SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck -OperationTimeout 0 -IdleTimeout 60000) -ErrorAction Continue + $session = New-PSSession -ComputerName $env:COMPUTERNAME -Credential $Credential -Authentication CredSSP -Name "Microsoft.SharePoint.DSC" -SessionOption (New-PSSessionOption -OperationTimeout 0 -IdleTimeout 60000) -ErrorAction Continue if ($session) { $invokeArgs.Add("Session", $session) } @@ -57,18 +58,19 @@ function Invoke-xSharePointCommand() { } function Initialize-xSharePointPSSnapin() { + $VerbosePreference = "Continue" Write-Verbose "Checking for the powershell snapin" - if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) + if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) + { + Write-Verbose "Loading SharePoint PowerShell snapin" + try { - Write-Verbose "Loading SharePoint PowerShell snapin" - try - { - Add-PSSnapin "Microsoft.SharePoint.PowerShell" - } catch { - Write-Verbose ( $_ | Format-List | Out-String ) - } - + Add-PSSnapin "Microsoft.SharePoint.PowerShell" + } catch { + Write-Verbose ( $_ | Format-List | Out-String ) } + + } } function Rename-xSharePointParamValue() { diff --git a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 index 50b360ca3..2d3276742 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 @@ -43,11 +43,13 @@ Describe "xSPDistributedCacheService" { Mock Get-SPFarm { return @{ Services = @(@{ Name = "AppFabricCachingService" - ProcessIdentity = @{ ManagedAccount = $null } + ProcessIdentity = New-Object Object | + Add-Member NoteProperty ManagedAccount $null -PassThru | + Add-Member NoteProperty CurrentIdentityType $null -PassThru | + Add-Member ScriptMethod Update {} -PassThru | + Add-Member ScriptMethod Deploy {} -PassThru }) - } } - Mock Update-DCacheService { } - + } } Context "Distributed cache is not configured" { Mock Get-CacheHost { return $null } @@ -97,11 +99,11 @@ Describe "xSPDistributedCacheService" { }} Mock Get-CacheHost { return @{ PortNo = 22233 } } Mock Get-NetFirewallRule { return @{} } - Mock Get-SPServiceInstance { return @(@{ - Service = "SPDistributedCacheService Name=AppFabricCachingService" - Server = @{ Name = $env:COMPUTERNAME } - })} - Mock Delete-DCacheService { } + Mock Get-SPServiceInstance { return @(New-Object Object | + Add-Member NoteProperty Service "SPDistributedCacheService Name=AppFabricCachingService" -PassThru | + Add-Member NoteProperty Server @{ Name = $env:COMPUTERNAME } -PassThru | + Add-Member ScriptMethod Delete {} -PassThru + )} Mock Remove-SPDistributedCacheServiceInstance { } It "returns false from the test method" { diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 index f0349ebf3..bdfe5f6a9 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 @@ -56,10 +56,14 @@ Describe "xSPUserProfileSyncService" { }) } } - Mock Get-SPServiceApplication { return @{ - ID = [Guid]::NewGuid() - TypeName = "User Profile Service Application" - } } + Mock Get-SPServiceApplication { return @( + New-Object Object | + Add-Member NoteProperty ID ([Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f")) -PassThru | + Add-Member NoteProperty TypeName "User Profile Service Application" -PassThru | + Add-Member ScriptMethod SetSynchronizationMachine { + param($computerName, $syncServiceID, $FarmUserName, $FarmPassword) + } -PassThru + )} It "returns absent from the get method" { $Global:xSharePointUPACheck = $false @@ -73,7 +77,6 @@ Describe "xSPUserProfileSyncService" { It "calls the start service cmdlet from the set method" { $Global:xSharePointUPACheck = $false - Mock Set-UserProfileSyncMachine { } Set-TargetResource @testParams Assert-MockCalled Start-SPServiceInstance @@ -131,7 +134,6 @@ Describe "xSPUserProfileSyncService" { It "calls the start service cmdlet from the set method" { $Global:xSharePointUPACheck = $false - Mock Set-UserProfileSyncMachine { } Set-TargetResource @testParams Assert-MockCalled Stop-SPServiceInstance From 3fd03a4a6c9d4875df2921841556030b51531c37 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sat, 26 Sep 2015 23:17:12 +1000 Subject: [PATCH 102/146] Removed referenced to initialize-xsharepointsnapin --- .../xSharePoint.Util/xSharePoint.Util.psm1 | 18 +----------------- Modules/xSharePoint/xSharePoint.psd1 | 3 +-- .../xSharePoint.xSPBCSServiceApp.Tests.ps1 | 2 +- .../xSharePoint.xSPCacheAccounts.Tests.ps1 | 2 +- .../xSharePoint.xSPCreateFarm.Tests.ps1 | 2 +- ...oint.xSPDiagnosticLoggingSettings.Tests.ps1 | 2 +- ...ePoint.xSPDistributedCacheService.Tests.ps1 | 2 +- .../xSharePoint.xSPFeature.Tests.ps1 | 2 +- .../xSharePoint.xSPInstall.Tests.ps1 | 2 +- .../xSharePoint.xSPInstallPrereqs.Tests.ps1 | 2 +- .../xSharePoint.xSPJoinFarm.Tests.ps1 | 2 +- .../xSharePoint.xSPManagedAccount.Tests.ps1 | 2 +- ...oint.xSPManagedMetadataServiceApp.Tests.ps1 | 2 +- .../xSharePoint.xSPManagedPath.Tests.ps1 | 2 +- .../xSharePoint.xSPSearchServiceApp.Tests.ps1 | 2 +- ...arePoint.xSPSecureStoreServiceApp.Tests.ps1 | 2 +- .../xSharePoint.xSPServiceAppPool.Tests.ps1 | 2 +- .../xSharePoint.xSPServiceInstance.Tests.ps1 | 2 +- .../xSharePoint/xSharePoint.xSPSite.Tests.ps1 | 2 +- .../xSharePoint.xSPStateServiceApp.Tests.ps1 | 2 +- ...arePoint.xSPUserProfileServiceApp.Tests.ps1 | 2 +- ...rePoint.xSPUserProfileSyncService.Tests.ps1 | 2 +- .../xSharePoint.xSPWebApplication.Tests.ps1 | 2 +- .../xSharePoint.xSPusageApplication.Tests.ps1 | 2 +- 24 files changed, 24 insertions(+), 41 deletions(-) diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 064e147ef..6f6ec46db 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -19,7 +19,7 @@ function Invoke-xSharePointCommand() { $VerbosePreference = 'Continue' $invokeArgs = @{ - ScriptBlock = [ScriptBlock]::Create("Initialize-xSharePointPSSnapin -Verbose; " + $ScriptBlock.ToString()) + ScriptBlock = [ScriptBlock]::Create("if (`$null -eq (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue)) {Add-PSSnapin Microsoft.SharePoint.PowerShell}; " + $ScriptBlock.ToString()) } if ($null -ne $Arguments) { $invokeArgs.Add("ArgumentList", $Arguments) @@ -57,22 +57,6 @@ function Invoke-xSharePointCommand() { } } -function Initialize-xSharePointPSSnapin() { - $VerbosePreference = "Continue" - Write-Verbose "Checking for the powershell snapin" - if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) - { - Write-Verbose "Loading SharePoint PowerShell snapin" - try - { - Add-PSSnapin "Microsoft.SharePoint.PowerShell" - } catch { - Write-Verbose ( $_ | Format-List | Out-String ) - } - - } -} - function Rename-xSharePointParamValue() { [CmdletBinding()] param diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1 index 1d22f7597..52963a2ea 100644 --- a/Modules/xSharePoint/xSharePoint.psd1 +++ b/Modules/xSharePoint/xSharePoint.psd1 @@ -80,8 +80,7 @@ CmdletsToExport = @("Invoke-xSharePointCommand", "Add-xSharePointUserToLocalAdmin", "Remove-xSharePointUserToLocalAdmin", "Test-xSharePointUserIsLocalAdmin", - "Test-xSharePointSpecificParameters", - "Initialize-xSharePointPSSnapin") + "Test-xSharePointSpecificParameters") # Variables to export from this module VariablesToExport = '*' diff --git a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 index 8e8095911..bd4d25a3b 100644 --- a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 @@ -27,7 +27,7 @@ Describe "xSPBCSServiceApp" { } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 index ec2148082..976d52a9f 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 @@ -20,7 +20,7 @@ Describe "xSPCacheAccounts" { SuperReaderAlias = "DEMO\SuperReader" } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 index bd9680bdd..fc118d243 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 @@ -23,7 +23,7 @@ Describe "xSPCreateFarm" { CentralAdministrationPort = 1234 } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 index 326fbd9fa..42587234b 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 @@ -35,7 +35,7 @@ Describe "xSPDiagnosticLoggingSettings" { EventLogFloodProtectionNotifyInterval = 5 } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 index 2d3276742..8926cd417 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 @@ -22,7 +22,7 @@ Describe "xSPDistributedCacheService" { CreateFirewallRules = $true } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 index f84656125..6c9ed42e0 100644 --- a/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 @@ -26,7 +26,7 @@ Describe "xSPFeature" { Ensure = "Present" } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 index 878e0895f..51c791728 100644 --- a/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPInstall.Tests.ps1 @@ -19,7 +19,7 @@ Describe "xSPInstall" { Ensure = "Present" } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 index 76a17180d..f77d29e51 100644 --- a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 @@ -20,7 +20,7 @@ Describe "xSPInstallPrereqs" { Ensure = "Present" } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 index 66b36f5bf..c2ca83c4d 100644 --- a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 @@ -20,7 +20,7 @@ Describe "xSPJoinFarm" { Passphrase = "passphrase" } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 index c1eb27e32..3e48f6950 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedAccount.Tests.ps1 @@ -22,7 +22,7 @@ Describe "xSPManagedAccount" { AccountName = "username" } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 index eeef78fdd..26d36946c 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 @@ -21,7 +21,7 @@ Describe "xSPManagedMetaDataServiceApp" { DatabaseName = "SP_MMS" } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 index aa08e2dce..f35840ab8 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 @@ -21,7 +21,7 @@ Describe "xSPManagedPath" { HostHeader = $false } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 index 867714ea0..a59826a9b 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 @@ -19,7 +19,7 @@ Describe "xSPSearchServiceApp" { ApplicationPool = "SharePoint Search Services" } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 index dbc9ea890..4172b56a4 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 @@ -20,7 +20,7 @@ Describe "xSPSecureStoreServiceApp" { AuditingEnabled = $false } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 index b04d57344..990578005 100644 --- a/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPServiceAppPool.Tests.ps1 @@ -19,7 +19,7 @@ Describe "xSPServiceAppPool" { ServiceAccount = "DEMO\svcSPServiceApps" } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 index 466389c87..5e69f07a1 100644 --- a/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 @@ -19,7 +19,7 @@ Describe "xSPServiceInstance" { Ensure = "Present" } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 index 5ef04b2b6..7f6af8826 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 @@ -19,7 +19,7 @@ Describe "xSPSite" { OwnerAlias = "DEMO\User" } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 index d0d11e9d6..1454092cd 100644 --- a/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 @@ -19,7 +19,7 @@ Describe "xSPStateServiceApp" { DatabaseName = "SP_StateService" } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 index 21d2563db..329478f9d 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 @@ -20,7 +20,7 @@ Describe "xSPUserProfileServiceApp" { FarmAccount = New-Object System.Management.Automation.PSCredential ("domain\username", (ConvertTo-SecureString "password" -AsPlainText -Force)) } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 index bdfe5f6a9..322e0e04a 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 @@ -20,7 +20,7 @@ Describe "xSPUserProfileSyncService" { Ensure = "Present" } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 index d235969c4..b2a6a83fe 100644 --- a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 @@ -22,7 +22,7 @@ Describe "xSPWebApplication" { AuthenticationMethod = "NTLM" } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } diff --git a/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 index 32146ecd3..5d8e07ea4 100644 --- a/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 @@ -22,7 +22,7 @@ Describe "xSPUsageApplication" { UsageLogMaxSpaceGB = 10 } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") - Mock Initialize-xSharePointPSSnapin { } -ModuleName "xSharePoint.Util" + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } From 0ced9f538b827ea177050259746bea370e2554ac Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 27 Sep 2015 15:00:50 +1000 Subject: [PATCH 103/146] Bug fix in get method --- .../MSFT_xSPUserProfileServiceApp.psm1 | 35 +++++++------------ 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 index 4e5698f54..7c82c4dfe 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 @@ -35,7 +35,18 @@ function Get-TargetResource } else { - $databases = Get-UserProfileServiceProperties $serviceApp + $databases = @{} + $propData = $serviceApp.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic) + + $socialProp = $propData | Where-Object {$_.Name -eq "SocialDatabase"} + $databases.Add("SocialDatabase", $socialProp.GetValue($serviceApp)) + + $profileProp = $propData | Where-Object {$_.Name -eq "ProfileDatabase"} + $databases.Add("ProfileDatabase", $profileProp.GetValue($serviceApp)) + + $syncProp = $propData | Where-Object {$_.Name -eq "SynchronizationDatabase"} + $databases.Add("SynchronizationDatabase", $syncProp.GetValue($serviceApp)) + $spFarm = Get-SPFarm if ($params.FarmAccount.UserName -eq $spFarm.DefaultServiceAccount.Name) { @@ -62,28 +73,6 @@ function Get-TargetResource return $result } -function Get-UserProfileServiceProperties() { - [CmdletBinding()] - [OutputType([System.Collections.Hashtable])] - param - ( - [parameter(Mandatory = $true)] [System.String] $serviceApp - ) - $results = @{} - $propData = $serviceApp.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic) - - $socialProp = $propData | Where-Object {$_.Name -eq "SocialDatabase"} - $results.Add("SocialDatabase", $socialProp.GetValue($serviceApp)) - - $profileProp = $propData | Where-Object {$_.Name -eq "ProfileDatabase"} - $results.Add("ProfileDatabase", $profileProp.GetValue($serviceApp)) - - $syncProp = $propData | Where-Object {$_.Name -eq "SynchronizationDatabase"} - $results.Add("SynchronizationDatabase", $syncProp.GetValue($serviceApp)) - - return $results -} - function Set-TargetResource { [CmdletBinding()] From 195a316b46e3749507e2f554fa66ba8e1de13dd9 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 27 Sep 2015 15:54:24 +1000 Subject: [PATCH 104/146] Refactored calls to reflect profile DBs --- .../MSFT_xSPUserProfileServiceApp.psm1 | 14 ++--- ...rePoint.xSPUserProfileServiceApp.Tests.ps1 | 61 +++++++++++++------ 2 files changed, 49 insertions(+), 26 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 index 7c82c4dfe..1c7f12ca4 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 @@ -36,16 +36,16 @@ function Get-TargetResource else { $databases = @{} - $propData = $serviceApp.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic) + $propData = $serviceApp.GetType().GetProperties([System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic) - $socialProp = $propData | Where-Object {$_.Name -eq "SocialDatabase"} - $databases.Add("SocialDatabase", $socialProp.GetValue($serviceApp)) + $socialProp = $propData | Where-Object {$_.Name -eq "SocialDatabase"} + $databases.Add("SocialDatabase", $socialProp.GetValue($serviceApp)) - $profileProp = $propData | Where-Object {$_.Name -eq "ProfileDatabase"} - $databases.Add("ProfileDatabase", $profileProp.GetValue($serviceApp)) + $profileProp = $propData | Where-Object {$_.Name -eq "ProfileDatabase"} + $databases.Add("ProfileDatabase", $profileProp.GetValue($serviceApp)) - $syncProp = $propData | Where-Object {$_.Name -eq "SynchronizationDatabase"} - $databases.Add("SynchronizationDatabase", $syncProp.GetValue($serviceApp)) + $syncProp = $propData | Where-Object {$_.Name -eq "SynchronizationDatabase"} + $databases.Add("SynchronizationDatabase", $syncProp.GetValue($serviceApp)) $spFarm = Get-SPFarm diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 index 329478f9d..8d1b09f64 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 @@ -27,20 +27,6 @@ Describe "xSPUserProfileServiceApp" { Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Mock Get-UserProfileServiceProperties { return @{ - ProfileDatabase = @{ - Name = "SP_ProfileDB" - Server = @{ Name = "SQL.domain.local" } - } - SocialDatabase = @{ - Name = "SP_SocialDB" - Server = @{ Name = "SQL.domain.local" } - } - SynchronizationDatabase = @{ - Name = "SP_SyncDB" - Server = @{ Name = "SQL.domain.local" } - } - }} Mock Get-SPFarm { return @{ DefaultServiceAccount = @{ Name = $testParams.FarmAccount.Username } }} @@ -72,11 +58,48 @@ Describe "xSPUserProfileServiceApp" { Context "When a service application exists and is configured correctly" { Mock Get-SPServiceApplication { - return @(@{ - TypeName = "User Profile Service Application" - DisplayName = $testParams.Name - ApplicationPool = @{ Name = $testParams.ApplicationPool } - }) + return @( + New-Object Object | + Add-Member NoteProperty TypeName "User Profile Service Application" -PassThru | + Add-Member NoteProperty DisplayName $testParams.Name -PassThru | + Add-Member NoteProperty ApplicationPool @{ Name = $testParams.ApplicationPool } -PassThru | + Add-Member ScriptMethod GetType { + New-Object Object | + Add-Member ScriptMethod GetProperties { + param($x) + return @( + (New-Object Object | + Add-Member NoteProperty Name "SocialDatabase" -PassThru | + Add-Member ScriptMethod GetValue { + param($x) + return @{ + Name = "SP_SocialDB" + Server = @{ Name = "SQL.domain.local" } + } + } -PassThru + ), + (New-Object Object | + Add-Member NoteProperty Name "ProfileDatabase" -PassThru | + Add-Member ScriptMethod GetValue { + return @{ + Name = "SP_ProfileDB" + Server = @{ Name = "SQL.domain.local" } + } + } -PassThru + ), + (New-Object Object | + Add-Member NoteProperty Name "SynchronizationDatabase" -PassThru | + Add-Member ScriptMethod GetValue { + return @{ + Name = "SP_ProfileSyncDB" + Server = @{ Name = "SQL.domain.local" } + } + } -PassThru + ) + ) + } -PassThru + } -PassThru -Force + ) } It "returns values from the get method" { From b375468072876b4ca1e96595546cb8a25a1cbab5 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 27 Sep 2015 16:22:41 +1000 Subject: [PATCH 105/146] Refactor to take get call out of invoke block --- .../MSFT_xSPManagedAccount.psm1 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 index 015e3fc95..304dc902f 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 @@ -51,15 +51,16 @@ function Set-TargetResource Write-Verbose -Message "Setting managed account $AccountName" + if ($null -eq (Get-TargetResource @params)) { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + $params = $args[0] + New-SPManagedAccount -Credential $params.Account + } + } + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - - $current = Get-TargetResource @params - if ($current.Count -eq 0) { - New-SPManagedAccount -Credential $params.Account - } - $updateParams = @{ Identity = $params.Account.UserName } From 04e851397f05ea05e30f3a9702a9ffa545635c1a Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 27 Sep 2015 17:45:57 +1000 Subject: [PATCH 106/146] Fixed issue with the get call in the set method --- .../MSFT_xSPSecureStoreServiceApp.psm1 | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 index 3fad07354..33a1693e5 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 @@ -70,7 +70,7 @@ function Set-TargetResource $result = Get-TargetResource @PSBoundParameters - if ($result.Count -eq 0) { + if ($null -eq $result) { Write-Verbose -Message "Creating Secure Store Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] @@ -80,18 +80,15 @@ function Set-TargetResource switch((Get-xSharePointInstalledProductVersion).FileMajorPart) { 15 { - $app = New-SPSecureStoreServiceApplication @params + New-SPSecureStoreServiceApplication @params | New-SPSecureStoreServiceApplicationProxy -Name "$($params.Name) Proxy" } 16 { - $app = New-SPSecureStoreServiceApplication @params -EnableMinDB:$false + $app = New-SPSecureStoreServiceApplication @params -EnableMinDB:$false | New-SPSecureStoreServiceApplicationProxy -Name "$($params.Name) Proxy" } Default { throw [Exception] "An unknown version of SharePoint (Major version $_) was detected. Only versions 15 (SharePoint 2013) or 16 (SharePoint 2016) are supported." } } - if ($app) { - New-SPSecureStoreServiceApplicationProxy -Name "$($params.Name) Proxy" -ServiceApplication $app - } } } else { if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) { From 6159c631ac58b7070b1f5a508202734e54caa7b1 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 27 Sep 2015 18:04:34 +1000 Subject: [PATCH 107/146] Fixed variable name in set method --- .../MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 index 304dc902f..acfda0b27 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 @@ -48,16 +48,16 @@ function Set-TargetResource [parameter(Mandatory = $false)] [System.String] $Schedule, [parameter(Mandatory = $true)] [System.String] $AccountName ) - - Write-Verbose -Message "Setting managed account $AccountName" - if ($null -eq (Get-TargetResource @params)) { + if ($null -eq (Get-TargetResource @PSBoundParameters)) { + Write-Verbose "Creating a new managed account" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] New-SPManagedAccount -Credential $params.Account } } + Write-Verbose -Message "Updating settings for managed account" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] From 4a9cb6f90b1b81c2ac7d56251a84fb523e7cd1fb Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 27 Sep 2015 18:06:17 +1000 Subject: [PATCH 108/146] Formatting corrections --- .../MSFT_xSPManagedAccount.psm1 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 index acfda0b27..6b85880f4 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 @@ -49,15 +49,15 @@ function Set-TargetResource [parameter(Mandatory = $true)] [System.String] $AccountName ) - if ($null -eq (Get-TargetResource @PSBoundParameters)) { - Write-Verbose "Creating a new managed account" - Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - $params = $args[0] - New-SPManagedAccount -Credential $params.Account - } - } + if ($null -eq (Get-TargetResource @PSBoundParameters)) { + Write-Verbose "Creating a new managed account" + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + $params = $args[0] + New-SPManagedAccount -Credential $params.Account + } + } - Write-Verbose -Message "Updating settings for managed account" + Write-Verbose -Message "Updating settings for managed account" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] From beeaf958b39d4fe153609753ecdcb04c5d7c45d9 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 27 Sep 2015 18:27:10 +1000 Subject: [PATCH 109/146] Increase code coverage of BCS service app resource tests --- .../xSharePoint.xSPBCSServiceApp.Tests.ps1 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 index bd4d25a3b..4f8a2023e 100644 --- a/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPBCSServiceApp.Tests.ps1 @@ -34,7 +34,7 @@ Describe "xSPBCSServiceApp" { Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Context "When no service application exists in the current farm" { + Context "When no service applications exist in the current farm" { Mock Get-SPServiceApplication { return $null } Mock New-SPBusinessDataCatalogServiceApplication { } @@ -54,6 +54,19 @@ Describe "xSPBCSServiceApp" { } } + Context "When service applications exist in the current farm but the specific BCS app does not" { + + Mock Get-SPServiceApplication { return @(@{ + TypeName = "Some other service app type" + }) } + + It "returns null from the Get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } + } + + } + Context "When a service application exists and is configured correctly" { Mock Get-SPServiceApplication { return @(@{ From 98d527f1bec87fb78afceee15a72db9403b0f09b Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 27 Sep 2015 21:38:23 +1000 Subject: [PATCH 110/146] Fixed issue with 2016 calls to secure store cmdlets --- .../MSFT_xSPSecureStoreServiceApp.psm1 | 31 +-- .../MSFT_xSPUserProfileSyncService.psm1 | 13 + ...ePoint.xSPUserProfileSyncService.Tests.ps1 | 228 ++++++++++-------- 3 files changed, 159 insertions(+), 113 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 index 33a1693e5..a27731b3c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 @@ -69,33 +69,36 @@ function Set-TargetResource ) $result = Get-TargetResource @PSBoundParameters + $params = $PSBoundParameters + + switch((Get-xSharePointInstalledProductVersion).FileMajorPart) { + 16 { + $hasOptionalParams = $false + @("AuditlogMaxSize","DatabaseName","DatabasePassword","DatabaseServer","DatabaseUsername", ` + "FailoverDatabaseServer","PartitionMode","Sharing","DatabaseCredentials") | ForEach-Object { + if ($PSBoundParameters.ContainsKey($_) -eq $true) { $hasOptionalParams = $true } + } + if ($hasOptionalParams -eq $false) { + # Add the MinDB param to ensure that the cmdlet call gets differentiated without the optional params being set + $params.Add("EnableMinDB", $false) + } + } + } if ($null -eq $result) { Write-Verbose -Message "Creating Secure Store Service Application $Name" - Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $params -ScriptBlock { $params = $args[0] - if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } - switch((Get-xSharePointInstalledProductVersion).FileMajorPart) { - 15 { - New-SPSecureStoreServiceApplication @params | New-SPSecureStoreServiceApplicationProxy -Name "$($params.Name) Proxy" - } - 16 { - $app = New-SPSecureStoreServiceApplication @params -EnableMinDB:$false | New-SPSecureStoreServiceApplicationProxy -Name "$($params.Name) Proxy" - } - Default { - throw [Exception] "An unknown version of SharePoint (Major version $_) was detected. Only versions 15 (SharePoint 2013) or 16 (SharePoint 2016) are supported." - } - } + New-SPSecureStoreServiceApplication @params | New-SPSecureStoreServiceApplicationProxy -Name "$($params.Name) Proxy" } } else { if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating Secure Store Service Application $Name" Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $serviceApp = Get-SPServiceApplication -Name $params.Name | Where-Object { $_.TypeName -eq "Secure Store Service Application" } $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 index 01d422ee3..bfa80d63d 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 @@ -9,6 +9,11 @@ function Get-TargetResource [parameter(Mandatory = $true)] [System.Management.Automation.PSCredential] $FarmAccount, [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) + + if ((Get-xSharePointInstalledProductVersion).FileMajorPart -ne 15) { + throw [Exception] "Only SharePoint 2013 is supported to deploy the user profile sync service via DSC, as 2016 does not use the FIM based sync service." + } + Write-Verbose -Message "Getting the local user profile sync service instance" $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { @@ -59,6 +64,10 @@ function Set-TargetResource [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) + if ((Get-xSharePointInstalledProductVersion).FileMajorPart -ne 15) { + throw [Exception] "Only SharePoint 2013 is supported to deploy the user profile sync service via DSC, as 2016 does not use the FIM based sync service." + } + Write-Verbose -Message "Setting User Profile Synchronization Service" # Add the FarmAccount to the local Admins group, if it's not already there @@ -129,6 +138,10 @@ function Test-TargetResource [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount ) + if ((Get-xSharePointInstalledProductVersion).FileMajorPart -ne 15) { + throw [Exception] "Only SharePoint 2013 is supported to deploy the user profile sync service via DSC, as 2016 does not use the FIM based sync service." + } + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for User Profile Synchronization Service" return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("Ensure") diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 index 322e0e04a..088953a3b 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 @@ -21,6 +21,11 @@ Describe "xSPUserProfileSyncService" { } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") + Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue + $versionBeingTested = (Get-Item $Global:CurrentSharePointStubModule).Directory.BaseName + $majorBuildNumber = $versionBeingTested.Substring(0, $versionBeingTested.IndexOf(".")) + Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = $majorBuildNumber } } + Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } @@ -38,124 +43,149 @@ Describe "xSPUserProfileSyncService" { Mock Remove-xSharePointUserToLocalAdmin { } Mock New-PSSession { return $null } -ModuleName "xSharePoint.Util" - Context "User profile sync service is not running and should be" { - Mock Get-SPServiceInstance { if ($Global:xSharePointUPACheck -eq $false) { - $Global:xSharePointUPACheck = $true - return @( @{ - Status = "Disabled" - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") - UserProfileApplicationGuid = [Guid]::Empty - TypeName = "User Profile Synchronization Service" - }) - } else { - return @( @{ - Status = "Online" - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") - UserProfileApplicationGuid = [Guid]::NewGuid() - TypeName = "User Profile Synchronization Service" - }) + switch ($majorBuildNumber) { + 15 { + Context "User profile sync service is not running and should be" { + Mock Get-SPServiceInstance { if ($Global:xSharePointUPACheck -eq $false) { + $Global:xSharePointUPACheck = $true + return @( @{ + Status = "Disabled" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::Empty + TypeName = "User Profile Synchronization Service" + }) + } else { + return @( @{ + Status = "Online" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::NewGuid() + TypeName = "User Profile Synchronization Service" + }) + } + } + Mock Get-SPServiceApplication { return @( + New-Object Object | + Add-Member NoteProperty ID ([Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f")) -PassThru | + Add-Member NoteProperty TypeName "User Profile Service Application" -PassThru | + Add-Member ScriptMethod SetSynchronizationMachine { + param($computerName, $syncServiceID, $FarmUserName, $FarmPassword) + } -PassThru + )} + + It "returns absent from the get method" { + $Global:xSharePointUPACheck = $false + (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - } - Mock Get-SPServiceApplication { return @( - New-Object Object | - Add-Member NoteProperty ID ([Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f")) -PassThru | - Add-Member NoteProperty TypeName "User Profile Service Application" -PassThru | - Add-Member ScriptMethod SetSynchronizationMachine { - param($computerName, $syncServiceID, $FarmUserName, $FarmPassword) - } -PassThru - )} - - It "returns absent from the get method" { - $Global:xSharePointUPACheck = $false - (Get-TargetResource @testParams).Ensure | Should Be "Absent" - } - It "returns false from the test method" { - $Global:xSharePointUPACheck = $false - Test-TargetResource @testParams | Should Be $false - } + It "returns false from the test method" { + $Global:xSharePointUPACheck = $false + Test-TargetResource @testParams | Should Be $false + } - It "calls the start service cmdlet from the set method" { - $Global:xSharePointUPACheck = $false - Set-TargetResource @testParams + It "calls the start service cmdlet from the set method" { + $Global:xSharePointUPACheck = $false + Set-TargetResource @testParams - Assert-MockCalled Start-SPServiceInstance + Assert-MockCalled Start-SPServiceInstance + } } - } - Context "User profile sync service is running and should be" { - Mock Get-SPServiceInstance { return @( @{ - Status = "Online" - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") - UserProfileApplicationGuid = [Guid]::NewGuid() - TypeName = "User Profile Synchronization Service" - }) - } + Context "User profile sync service is running and should be" { + Mock Get-SPServiceInstance { return @( @{ + Status = "Online" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::NewGuid() + TypeName = "User Profile Synchronization Service" + }) + } - It "returns present from the get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Present" - } + It "returns present from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Present" + } - It "returns true from the test method" { - Test-TargetResource @testParams | Should Be $true + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true + } } - } - $testParams.Ensure = "Absent" - - Context "User profile sync service is running and shouldn't be" { - Mock Get-SPServiceInstance { if ($Global:xSharePointUPACheck -eq $false) { - $Global:xSharePointUPACheck = $true - return @( @{ - Status = "Online" - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") - UserProfileApplicationGuid = [Guid]::NewGuid() - TypeName = "User Profile Synchronization Service" - }) - } else { - return @( @{ - Status = "Disabled" - ID = [Guid]::Empty - UserProfileApplicationGuid = [Guid]::Empty - TypeName = "User Profile Synchronization Service" - }) + $testParams.Ensure = "Absent" + + Context "User profile sync service is running and shouldn't be" { + Mock Get-SPServiceInstance { if ($Global:xSharePointUPACheck -eq $false) { + $Global:xSharePointUPACheck = $true + return @( @{ + Status = "Online" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::NewGuid() + TypeName = "User Profile Synchronization Service" + }) + } else { + return @( @{ + Status = "Disabled" + ID = [Guid]::Empty + UserProfileApplicationGuid = [Guid]::Empty + TypeName = "User Profile Synchronization Service" + }) + } + } + + It "returns present from the get method" { + $Global:xSharePointUPACheck = $false + (Get-TargetResource @testParams).Ensure | Should Be "Present" } - } - It "returns present from the get method" { - $Global:xSharePointUPACheck = $false - (Get-TargetResource @testParams).Ensure | Should Be "Present" - } + It "returns false from the test method" { + $Global:xSharePointUPACheck = $false + Test-TargetResource @testParams | Should Be $false + } - It "returns false from the test method" { - $Global:xSharePointUPACheck = $false - Test-TargetResource @testParams | Should Be $false + It "calls the start service cmdlet from the set method" { + $Global:xSharePointUPACheck = $false + Set-TargetResource @testParams + + Assert-MockCalled Stop-SPServiceInstance + } } - It "calls the start service cmdlet from the set method" { - $Global:xSharePointUPACheck = $false - Set-TargetResource @testParams + Context "User profile sync service is not running and shouldn't be" { + Mock Get-SPServiceInstance { return @( @{ + Status = "Disabled" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::Empty + TypeName = "User Profile Synchronization Service" + }) + } + + It "returns absent from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Absent" + } - Assert-MockCalled Stop-SPServiceInstance + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true + } } - } - - Context "User profile sync service is not running and shouldn't be" { - Mock Get-SPServiceInstance { return @( @{ - Status = "Disabled" - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") - UserProfileApplicationGuid = [Guid]::Empty - TypeName = "User Profile Synchronization Service" - }) - } - - It "returns absent from the get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" } - - It "returns true from the test method" { - Test-TargetResource @testParams | Should Be $true + 16 { + Context "All methods throw exceptions as user profile sync doesn't exist in 2016" { + It "throws on the get method" { + { Get-TargetResource @testParams } | Should Throw + } + + It "throws on the test method" { + { Test-TargetResource @testParams } | Should Throw + } + + It "throws on the set method" { + { Set-TargetResource @testParams } | Should Throw + } + } } } + + + + + + } } \ No newline at end of file From 7e4b581038561c4a64f257bb601072df7e6895b1 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 27 Sep 2015 22:25:48 +1000 Subject: [PATCH 111/146] Removed faulty DCache stub generation --- Tests/xSharePoint.TestHarness.psm1 | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/Tests/xSharePoint.TestHarness.psm1 b/Tests/xSharePoint.TestHarness.psm1 index 59f098825..ac58cfa37 100644 --- a/Tests/xSharePoint.TestHarness.psm1 +++ b/Tests/xSharePoint.TestHarness.psm1 @@ -37,8 +37,7 @@ function Invoke-xSharePointTests() { function Write-xSharePointStubFiles() { param ( - [parameter(Mandatory = $true)] [System.String] $SharePointStubPath, - [parameter(Mandatory = $true)] [System.String] $DCacheStubPath + [parameter(Mandatory = $true)] [System.String] $SharePointStubPath ) Add-PSSnapin Microsoft.SharePoint.PowerShell @@ -67,30 +66,4 @@ function Write-xSharePointStubFiles() { $line | Out-File $SharePointStubPath -Encoding utf8 -Append } - - - Use-CacheCluster - - $dcacheStubContent = ((Get-Command | Where-Object { $_.Source -match "DistributedCache*" } ) | ForEach-Object -Process { - $signature = $null - $command = $_ - $metadata = New-Object -TypeName System.Management.Automation.CommandMetaData -ArgumentList $command - $definition = [System.Management.Automation.ProxyCommand]::Create($metadata) - foreach ($line in $definition -split "`n") - { - if ($line.Trim() -eq 'begin') - { - break - } - $signature += $line - } - "function $($command.Name) { `n $signature `n } `n" - }) | Out-String - - foreach ($line in $dcacheStubContent.Split([Environment]::NewLine)) { - $line = $line -replace "\[System.Nullable\[Microsoft.*]]", "[System.Nullable[object]]" - $line = $line -replace "\[Microsoft.*.\]", "[object]" - - $line | Out-File $DCacheStubPath -Encoding utf8 -Append - } } \ No newline at end of file From abf5a3a6881599c0d340db6e63b2a4e448980675 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 27 Sep 2015 23:59:06 +1000 Subject: [PATCH 112/146] Fixes to parameters and return values --- .../MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 | 2 +- Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 index 1034c3baf..364ef1cc6 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 @@ -18,7 +18,7 @@ function Get-TargetResource $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue - if ($null -eq $wa) { return @{} } + if ($null -eq $wa) { return $null } $returnVal = @{} $returnVal.Add("WebAppUrl", $params.WebAppUrl) diff --git a/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 index 976d52a9f..7dff5d9a1 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 @@ -92,8 +92,8 @@ Describe "xSPCacheAccounts" { Context "Cache accounts have been configured, but the reader account is wrong" { Mock Get-SPWebApplication { return @{ Properties = @{ - SuperUserAlias = $testParams.SuperUserAlias - SuperReaderAlias = "WRONG\AccountName" + portalsuperuseraccount = $testParams.SuperUserAlias + portalsuperreaderaccount = "WRONG\AccountName" } }} @@ -110,8 +110,8 @@ Describe "xSPCacheAccounts" { Context "Cache accounts have been configured, but the super account is wrong" { Mock Get-SPWebApplication { return @{ Properties = @{ - SuperUserAlias = "WRONG\AccountName" - SuperReaderAlias = $testParams.SuperReaderAlias + portalsuperuseraccount = "WRONG\AccountName" + portalsuperreaderaccount = $testParams.SuperReaderAlias } }} From 8c280012b14f1ce2a14aa81f168621cac3825c75 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 28 Sep 2015 00:11:01 +1000 Subject: [PATCH 113/146] Expanded tests to cover all scenarios coded for --- .../xSharePoint.xSPCreateFarm.Tests.ps1 | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 index fc118d243..d86efdb0e 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 @@ -42,7 +42,7 @@ Describe "xSPCreateFarm" { Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = $majorBuildNumber } } Context "no farm is configured locally and a supported version of SharePoint is installed" { - Mock Get-SPFarm { return $null } + Mock Get-SPFarm { throw "Unable to detect local farm" } It "the get method returns null when the farm is not configured" { Get-TargetResource @testParams | Should BeNullOrEmpty @@ -103,6 +103,22 @@ Describe "xSPCreateFarm" { } } + Context "a farm exists locally with the wrong farm account" { + Mock Get-SPFarm { return @{ + DefaultServiceAccount = @{ Name = "WRONG\account" } + Name = $testParams.FarmConfigDatabaseName + }} + + It "the get method returns current values" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + } + + It "returns true from the test method as changing the farm account isn't supported so set shouldn't be called" { + Test-TargetResource @testParams | Should Be $true + } + + } + Context "no farm is configured locally, a supported version is installed and no central admin port is specified" { $testParams.Remove("CentralAdministrationPort") From 2bae03955438fb61894a5a6c3a536ccc9a78a24a Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 28 Sep 2015 00:11:32 +1000 Subject: [PATCH 114/146] Formatting fixes --- Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 index d86efdb0e..acb2e84c5 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 @@ -103,13 +103,13 @@ Describe "xSPCreateFarm" { } } - Context "a farm exists locally with the wrong farm account" { - Mock Get-SPFarm { return @{ + Context "a farm exists locally with the wrong farm account" { + Mock Get-SPFarm { return @{ DefaultServiceAccount = @{ Name = "WRONG\account" } Name = $testParams.FarmConfigDatabaseName }} - It "the get method returns current values" { + It "the get method returns current values" { Get-TargetResource @testParams | Should Not BeNullOrEmpty } From 2e91b62afe3de31c8eabb2284ba777cdaaedacd5 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 28 Sep 2015 00:31:44 +1000 Subject: [PATCH 115/146] Fixes to diagnostic logging and create farm tests --- .../xSharePoint.xSPCreateFarm.Tests.ps1 | 5 +++ ...int.xSPDiagnosticLoggingSettings.Tests.ps1 | 35 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 index acb2e84c5..47f668ff6 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 @@ -108,6 +108,11 @@ Describe "xSPCreateFarm" { DefaultServiceAccount = @{ Name = "WRONG\account" } Name = $testParams.FarmConfigDatabaseName }} + Mock Get-SPWebApplication { return @(@{ + IsAdministrationWebApplication = $true + ContentDatabases = @(@{ Name = $testParams.AdminContentDatabaseName }) + Url = "http://$($env:ComputerName):$($testParams.CentralAdministrationPort)" + })} It "the get method returns current values" { Get-TargetResource @testParams | Should Not BeNullOrEmpty diff --git a/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 index 42587234b..dd9685437 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDiagnosticLoggingSettings.Tests.ps1 @@ -145,5 +145,40 @@ Describe "xSPDiagnosticLoggingSettings" { Assert-MockCalled Set-SPDiagnosticConfig } } + + Context "Diagnostic configuration needs updating and the InstallAccount option is used" { + $testParams.Add("InstallAccount", (New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force))) ) + + Mock Get-SPDiagnosticConfig { return @{ + AppAnalyticsAutomaticUploadEnabled = $testParams.AppAnalyticsAutomaticUploadEnabled + CustomerExperienceImprovementProgramEnabled = $testParams.CustomerExperienceImprovementProgramEnabled + ErrorReportingEnabled = $testParams.ErrorReportingEnabled + ErrorReportingAutomaticUploadEnabled = $testParams.ErrorReportingAutomaticUploadEnabled + DownloadErrorReportingUpdatesEnabled = $testParams.DownloadErrorReportingUpdatesEnabled + DaysToKeepLogs = $testParams.DaysToKeepLogs + LogMaxDiskSpaceUsageEnabled = $testParams.LogMaxDiskSpaceUsageEnabled + LogDiskSpaceUsageGB = 1 + LogLocation = $testParams.LogPath + LogCutInterval = $testParams.LogCutInterval + EventLogFloodProtectionEnabled = $testParams.EventLogFloodProtectionEnabled + EventLogFloodProtectionThreshold = $testParams.EventLogFloodProtectionThreshold + EventLogFloodProtectionTriggerPeriod = $testParams.EventLogFloodProtectionTriggerPeriod + EventLogFloodProtectionQuietPeriod = $testParams.EventLogFloodProtectionQuietPeriod + EventLogFloodProtectionNotifyInterval = $testParams.EventLogFloodProtectionNotifyInterval + ScriptErrorReportingEnabled = $testParams.ScriptErrorReportingEnabled + ScriptErrorReportingRequireAuth = $testParams.ScriptErrorReportingRequireAuth + ScriptErrorReportingDelay = $testParams.ScriptErrorReportingDelay + } } + + It "returns false from the test method" { + Test-TargetResource @testParams | Should Be $false + } + + It "repairs the diagnostic configuration" { + Mock Set-SPDiagnosticConfig {} + Set-TargetResource @testParams + Assert-MockCalled Set-SPDiagnosticConfig + } + } } } \ No newline at end of file From f3c8b4fb282a49ae21fced696cc301143701c1d5 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 28 Sep 2015 00:48:04 +1000 Subject: [PATCH 116/146] Fixes to get method and test structure --- .../MSFT_xSPDistributedCacheService.psm1 | 40 ++++++++----------- .../xSharePoint.xSPCreateFarm.Tests.ps1 | 2 +- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index 43c1fd263..d3f57cd58 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -21,31 +21,24 @@ function Get-TargetResource Ensure = "Absent" InstallAccount = $params.InstallAccount } - try - { - Use-CacheCluster -ErrorAction SilentlyContinue - $cacheHost = Get-CacheHost -ErrorAction SilentlyContinue - - if ($null -eq $cacheHost) { return $nullReturnValue } - $computerName = ([System.Net.Dns]::GetHostByName($env:computerName)).HostName - $cacheHostConfig = Get-AFCacheHostConfiguration -ComputerName $computerName -CachePort $cacheHost.PortNo -ErrorAction SilentlyContinue - - if ($null -eq $cacheHostConfig) { return $nullReturnValue } - $windowsService = Get-WmiObject "win32_service" -Filter "Name='AppFabricCachingService'" - $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distributed Cache" -ErrorAction SilentlyContinue + Use-CacheCluster -ErrorAction SilentlyContinue + $cacheHost = Get-CacheHost -ErrorAction SilentlyContinue + + if ($null -eq $cacheHost) { return $nullReturnValue } + $computerName = ([System.Net.Dns]::GetHostByName($env:computerName)).HostName + $cacheHostConfig = Get-AFCacheHostConfiguration -ComputerName $computerName -CachePort $cacheHost.PortNo -ErrorAction SilentlyContinue + + $windowsService = Get-WmiObject "win32_service" -Filter "Name='AppFabricCachingService'" + $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distributed Cache" -ErrorAction SilentlyContinue - return @{ - Name = $params.Name - CacheSizeInMB = $cacheHostConfig.Size - ServiceAccount = $windowsService.StartName - CreateFirewallRules = ($firewallRule -ne $null) - Ensure = "Present" - InstallAccount = $params.InstallAccount - } - } - catch{ - return $nullReturnValue + return @{ + Name = $params.Name + CacheSizeInMB = $cacheHostConfig.Size + ServiceAccount = $windowsService.StartName + CreateFirewallRules = ($firewallRule -ne $null) + Ensure = "Present" + InstallAccount = $params.InstallAccount } } return $result @@ -142,7 +135,6 @@ function Test-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Testing for distributed cache configuration" - if ($null -eq $CurrentValues) { return $false } return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("Ensure", "CreateFirewallRules") } diff --git a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 index 47f668ff6..a897949bc 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 @@ -108,7 +108,7 @@ Describe "xSPCreateFarm" { DefaultServiceAccount = @{ Name = "WRONG\account" } Name = $testParams.FarmConfigDatabaseName }} - Mock Get-SPWebApplication { return @(@{ + Mock Get-SPWebApplication { return @(@{ IsAdministrationWebApplication = $true ContentDatabases = @(@{ Name = $testParams.AdminContentDatabaseName }) Url = "http://$($env:ComputerName):$($testParams.CentralAdministrationPort)" From 0eb19e1149a37a3b5140d99e3c1f8f22d0ff698d Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 28 Sep 2015 20:48:22 +1000 Subject: [PATCH 117/146] Fixing issue with removal of try..catch from get --- .../MSFT_xSPDistributedCacheService.psm1 | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index d3f57cd58..b0c092b0b 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -22,23 +22,29 @@ function Get-TargetResource InstallAccount = $params.InstallAccount } - Use-CacheCluster -ErrorAction SilentlyContinue - $cacheHost = Get-CacheHost -ErrorAction SilentlyContinue - - if ($null -eq $cacheHost) { return $nullReturnValue } - $computerName = ([System.Net.Dns]::GetHostByName($env:computerName)).HostName - $cacheHostConfig = Get-AFCacheHostConfiguration -ComputerName $computerName -CachePort $cacheHost.PortNo -ErrorAction SilentlyContinue - - $windowsService = Get-WmiObject "win32_service" -Filter "Name='AppFabricCachingService'" - $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distributed Cache" -ErrorAction SilentlyContinue - - return @{ - Name = $params.Name - CacheSizeInMB = $cacheHostConfig.Size - ServiceAccount = $windowsService.StartName - CreateFirewallRules = ($firewallRule -ne $null) - Ensure = "Present" - InstallAccount = $params.InstallAccount + try + { + Use-CacheCluster -ErrorAction SilentlyContinue + $cacheHost = Get-CacheHost -ErrorAction SilentlyContinue + + if ($null -eq $cacheHost) { return $nullReturnValue } + $computerName = ([System.Net.Dns]::GetHostByName($env:computerName)).HostName + $cacheHostConfig = Get-AFCacheHostConfiguration -ComputerName $computerName -CachePort $cacheHost.PortNo -ErrorAction SilentlyContinue + + $windowsService = Get-WmiObject "win32_service" -Filter "Name='AppFabricCachingService'" + $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distributed Cache" -ErrorAction SilentlyContinue + + return @{ + Name = $params.Name + CacheSizeInMB = $cacheHostConfig.Size + ServiceAccount = $windowsService.StartName + CreateFirewallRules = ($firewallRule -ne $null) + Ensure = "Present" + InstallAccount = $params.InstallAccount + } + } + catch { + return $nullReturnValue } } return $result From d617f2e69f44eff960f2f364db3c37b9c205f88c Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 28 Sep 2015 20:57:01 +1000 Subject: [PATCH 118/146] Fixed get test to throw when its not configured --- .../xSharePoint.xSPDistributedCacheService.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 index 8926cd417..f53a68cd7 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 @@ -52,7 +52,7 @@ Describe "xSPDistributedCacheService" { } } Context "Distributed cache is not configured" { - Mock Get-CacheHost { return $null } + Mock Use-CacheCluster { throw [Exception] "ERRPS001 Error in reading provider and connection string values." } It "returns null from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" From 3d2678b074e7eae8affb919873f7e57d792701e0 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 28 Sep 2015 21:34:17 +1000 Subject: [PATCH 119/146] Refactore feature resource with code coverage increase --- .../MSFT_xSPFeature/MSFT_xSPFeature.psm1 | 18 +++--------------- .../xSharePoint.xSPFeature.Tests.ps1 | 14 +++++++------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 index ea16a0fb2..cb94bf93d 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 @@ -15,28 +15,16 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - - - $feature = Get-SPFeature -Identity $params.Name -ErrorAction SilentlyContinue - - if ($null -eq $feature) { return @{ - Name = $params.Name - FeatureScope = $params.FeatureScope - Url = $params.Url - InstalAcount = $params.InstallAccount - Ensure = "Absent" - } } - $checkParams = @{} - $checkParams.Add("Identity", $params.Name) - if ($FeatureScope -eq "Farm") { + $checkParams = @{ Identity = $params.Name } + if ($params.FeatureScope -eq "Farm") { $checkParams.Add($params.FeatureScope, $true) } else { $checkParams.Add($params.FeatureScope, $params.Url) } $featureAtScope = Get-SPFeature @checkParams -ErrorAction SilentlyContinue $enabled = ($null -ne $featureAtScope) - if ($enabled) { $currentState = "Present" } else { $currentState = "Absent" } + if ($enabled -eq $true) { $currentState = "Present" } else { $currentState = "Absent" } return @{ Name = $params.Name diff --git a/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 index 6c9ed42e0..f43987dcf 100644 --- a/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPFeature.Tests.ps1 @@ -36,7 +36,7 @@ Describe "xSPFeature" { Mock Disable-SPFeature {} Context "A feature that is not installed in the farm should be turned on" { - Mock Get-SPFeature { return $null } -ParameterFilter { $Farm -ne $true } + Mock Get-SPFeature { return $null } It "returns null from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" @@ -48,7 +48,7 @@ Describe "xSPFeature" { } Context "A farm scoped feature is not enabled and should be" { - Mock Get-SPFeature { return $null } -ParameterFilter { $Farm -eq $true } + Mock Get-SPFeature { return $null } $testParams.FeatureScope = "Farm" It "returns null from the get method" { @@ -67,7 +67,7 @@ Describe "xSPFeature" { } Context "A site collection scoped feature is not enabled and should be" { - Mock Get-SPFeature { return $null } -ParameterFilter { $Site -eq $true } + Mock Get-SPFeature { return $null } $testParams.FeatureScope = "Site" It "returns null from the get method" { @@ -87,7 +87,7 @@ Describe "xSPFeature" { Context "A farm scoped feature is enabled and should not be" { Mock Get-SPFeature { return @{} } - Mock Get-SPFeature { return @{} } -ParameterFilter { $Farm -eq $true } + $testParams.FeatureScope = "Farm" $testParams.Ensure = "Absent" @@ -108,7 +108,7 @@ Describe "xSPFeature" { Context "A site collection scoped feature is enabled and should not be" { Mock Get-SPFeature { return @{} } - Mock Get-SPFeature { return @{} } -ParameterFilter { $Site -eq $true } + $testParams.FeatureScope = "Site" It "returns null from the get method" { @@ -128,7 +128,7 @@ Describe "xSPFeature" { Context "A farm scoped feature is enabled and should be" { Mock Get-SPFeature { return @{} } - Mock Get-SPFeature { return @{} } -ParameterFilter { $Farm -eq $true } + $testParams.FeatureScope = "Farm" $testParams.Ensure = "Present" @@ -139,7 +139,7 @@ Describe "xSPFeature" { Context "A site collection scoped feature is enabled and should be" { Mock Get-SPFeature { return @{} } - Mock Get-SPFeature { return @{} } -ParameterFilter { $Site -eq $testParams.Url } + $testParams.FeatureScope = "Site" It "returns true from the test method" { From 58af96cf6890a6a460bbbfbb977181eb7e680c8d Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 28 Sep 2015 22:38:12 +1000 Subject: [PATCH 120/146] Refactor and expand test coverage of InstallPrereqs resource --- .../MSFT_xSPInstallPrereqs.psm1 | 18 ++----- .../xSharePoint.xSPInstallPrereqs.Tests.ps1 | 51 ++++++++++++++++--- 2 files changed, 48 insertions(+), 21 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 index 58c81bda8..41f852290 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 @@ -35,10 +35,10 @@ function Get-TargetResource Write-Verbose -Message "Getting installed windows features" if ($majorVersion -eq 15) { - $WindowsFeatures = Invoke-Command -ScriptBlock { Get-WindowsFeature -Name Net-Framework-Features,Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Security,Web-Basic-Auth,Web-Windows-Auth,Web-Filtering,Web-Digest-Auth,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Application-Server,AS-Web-Support,AS-TCP-Port-Sharing,AS-WAS-Support, AS-HTTP-Activation,AS-TCP-Activation,AS-Named-Pipes,AS-Net-Framework,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Web-Lgcy-Scripting,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer } -NoNewScope + $WindowsFeatures = Get-WindowsFeature -Name Net-Framework-Features,Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Security,Web-Basic-Auth,Web-Windows-Auth,Web-Filtering,Web-Digest-Auth,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Application-Server,AS-Web-Support,AS-TCP-Port-Sharing,AS-WAS-Support, AS-HTTP-Activation,AS-TCP-Activation,AS-Named-Pipes,AS-Net-Framework,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Web-Lgcy-Scripting,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer } if ($majorVersion -eq 16) { - $WindowsFeatures = Invoke-Command -ScriptBlock { Get-WindowsFeature -Name Application-Server,AS-NET-Framework,AS-Web-Support,Web-Server,Web-WebServer,Web-Common-Http,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-Static-Content,Web-Http-Redirect,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Security,Web-Filtering,Web-Basic-Auth,Web-Client-Auth,Web-Digest-Auth,Web-Cert-Auth,Web-IP-Security,Web-Url-Auth,Web-Windows-Auth,Web-App-Dev,Web-Net-Ext,Web-Net-Ext45,Web-Asp-Net45,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Web-Lgcy-Mgmt-Console,Web-Lgcy-Scripting,Web-WMI,Web-Scripting-Tools,NET-Framework-Features,NET-Framework-Core,NET-HTTP-Activation,NET-Non-HTTP-Activ,NET-Framework-45-ASPNET,NET-WCF-HTTP-Activation45,Windows-Identity-Foundation,PowerShell-V2,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs } -NoNewScope + $WindowsFeatures = Get-WindowsFeature -Name Application-Server,AS-NET-Framework,AS-Web-Support,Web-Server,Web-WebServer,Web-Common-Http,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-Static-Content,Web-Http-Redirect,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Security,Web-Filtering,Web-Basic-Auth,Web-Client-Auth,Web-Digest-Auth,Web-Cert-Auth,Web-IP-Security,Web-Url-Auth,Web-Windows-Auth,Web-App-Dev,Web-Net-Ext,Web-Net-Ext45,Web-Asp-Net45,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Web-Lgcy-Mgmt-Console,Web-Lgcy-Scripting,Web-WMI,Web-Scripting-Tools,NET-Framework-Features,NET-Framework-Core,NET-HTTP-Activation,NET-Non-HTTP-Activ,NET-Framework-45-ASPNET,NET-WCF-HTTP-Activation45,Windows-Identity-Foundation,PowerShell-V2,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs } foreach ($feature in $WindowsFeatures) { @@ -49,7 +49,7 @@ function Get-TargetResource $installedItems = Get-CimInstance -ClassName Win32_Product #Common prereqs - $returnValue.Add("Microsoft Identity Extensions", (Check-xSharePointInstalledProductRegistryKey -RegKeysCollection (Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\ -Recurse) -ProductName "Microsoft Identity Extensions").Count -gt 0) + $returnValue.Add("Microsoft Identity Extensions", (@(Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\ -Recurse | ? {$_.GetValue("DisplayName") -eq "Microsoft Identity Extensions" }).Count -gt 0)) $returnValue.Add("Microsoft CCR and DSS Runtime 2008 R3", (($installedItems | ? {$_.Name -eq "Microsoft CCR and DSS Runtime 2008 R3"}) -ne $null)) $returnValue.Add("Microsoft Sync Framework Runtime v1.0 SP1 (x64)", (($installedItems | ? {$_.Name -eq "Microsoft Sync Framework Runtime v1.0 SP1 (x64)"}) -ne $null)) $returnValue.Add("AppFabric 1.1 for Windows Server", (($installedItems | ? {$_.Name -eq "AppFabric 1.1 for Windows Server"}) -ne $null)) @@ -81,18 +81,6 @@ function Get-TargetResource return $results } -function Check-xSharePointInstalledProductRegistryKey() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $false)] [object] $RegKeysCollection, - [parameter(Mandatory = $true)] [string] $ProductName - ) - if ($RegKeysCollection -eq $null) { return $null } - return @($RegKeysCollection | ? {$_.GetValue("DisplayName") -eq $ProductName }) -} - - function Set-TargetResource { [CmdletBinding()] diff --git a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 index f77d29e51..32039d4cf 100644 --- a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 @@ -24,18 +24,22 @@ Describe "xSPInstallPrereqs" { Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } + + if ($null -eq (Get-Command Get-WindowsFeature -ErrorAction SilentlyContinue)) { + function Get-WindowsFeature() { } + } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue $versionBeingTested = (Get-Item $Global:CurrentSharePointStubModule).Directory.BaseName $majorBuildNumber = $versionBeingTested.Substring(0, $versionBeingTested.IndexOf(".")) Mock Get-xSharePointAssemblyVersion { return $majorBuildNumber } - Mock Check-xSharePointInstalledProductRegistryKey { return $null } + Mock Get-ChildItem { return $null } - Context "Prerequisites are not installed but should be" { - Mock Invoke-Command { @( @{ Name = "ExampleFeature"; Installed = $false}) } -ParameterFilter { $ScriptBlock.ToString().Contains("Get-WindowsFeature") -eq $true } + Context "Prerequisites are not installed but should be and are to be installed in online mode" { + Mock Get-WindowsFeature { @( @{ Name = "ExampleFeature"; Installed = $false}) } Mock Get-CimInstance { return @() } - Mock Get-ChildItem { return $null } + Mock Get-ChildItem { return @() } It "returns absent from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Absent" @@ -86,7 +90,7 @@ Describe "xSPInstallPrereqs" { } Context "Prerequisites are installed and should be" { - Mock Invoke-Command { return @( @{ Name = "ExampleFeature"; Installed = $true }) } -ParameterFilter { $ScriptBlock.ToString().Contains("Get-WindowsFeature") -eq $true } + Mock Get-WindowsFeature { @( @{ Name = "ExampleFeature"; Installed = $true }) } if ($majorBuildNumber -eq 15) { Mock Get-CimInstance { return @( @{ Name = "Microsoft CCR and DSS Runtime 2008 R3"} @@ -112,7 +116,10 @@ Describe "xSPInstallPrereqs" { )} } Mock Get-ChildItem { return $null } - Mock Check-xSharePointInstalledProductRegistryKey { return @( @{Example = $true } ) } + Mock Get-ChildItem { return @( + (New-Object Object | + Add-Member ScriptMethod GetValue { return "Microsoft Identity Extensions" } -PassThru) + ) } It "returns present from the get method" { (Get-TargetResource @testParams).Ensure | Should Be "Present" @@ -126,9 +133,41 @@ Describe "xSPInstallPrereqs" { Context "Prerequisites are installed but should not be" { $testParams.Ensure = "Absent" + It "throws an exception from the set method" { + {Test-TargetResource @testParams} | Should Throw + } + It "throws an exception from the set method" { {Set-TargetResource @testParams} | Should Throw } } + + Context "Prerequisites are not installed but should be and are to be installed in offline mode" { + $testParams.OnlineMode = $false + $testParams.Ensure = "Present" + Mock Get-WindowsFeature { @( @{ Name = "ExampleFeature"; Installed = $false}) } + Mock Get-CimInstance { return @() } + Mock Get-ChildItem { return @() } + + It "throws an exception in the set method if required parameters are not set" { + {Set-TargetResource @testParams} | Should Throw + } + + if ($majorBuildNumber -eq 15) { + $requiredParams = @("SQLNCli","PowerShell","NETFX","IDFX","Sync","AppFabric","IDFX11","MSIPCClient","WCFDataServices","KB2671763","WCFDataServices56") + } + if ($majorBuildNumber -eq 16) { + $requiredParams = @("SQLNCli","Sync","AppFabric","IDFX11","MSIPCClient","WCFDataServices","KB2671763","WCFDataServices56","KB2898850","MSVCRT12") + } + $requiredParams | ForEach-Object { + $testParams.Add($_, "C:\fake\value.exe") + } + + It "does not throw an exception where the required parameters are included" { + Mock Start-Process { return @{ ExitCode = 0 } } + + {Set-TargetResource @testParams} | Should Not Throw + } + } } } \ No newline at end of file From 86bbc30defb8b2075f5efd6fc8a59ceab297696d Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 28 Sep 2015 23:06:26 +1000 Subject: [PATCH 121/146] Formatting fix --- Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 index 32039d4cf..e66f9f35c 100644 --- a/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPInstallPrereqs.Tests.ps1 @@ -133,7 +133,7 @@ Describe "xSPInstallPrereqs" { Context "Prerequisites are installed but should not be" { $testParams.Ensure = "Absent" - It "throws an exception from the set method" { + It "throws an exception from the set method" { {Test-TargetResource @testParams} | Should Throw } @@ -144,7 +144,7 @@ Describe "xSPInstallPrereqs" { Context "Prerequisites are not installed but should be and are to be installed in offline mode" { $testParams.OnlineMode = $false - $testParams.Ensure = "Present" + $testParams.Ensure = "Present" Mock Get-WindowsFeature { @( @{ Name = "ExampleFeature"; Installed = $false}) } Mock Get-CimInstance { return @() } Mock Get-ChildItem { return @() } From e9f2444ca2bf1261227c8c27c9db84722ec2e241 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 28 Sep 2015 23:33:42 +1000 Subject: [PATCH 122/146] Temporary local admin applied to DCache resource --- .../MSFT_xSPDistributedCacheService.psm1 | 15 +++++- .../xSharePoint.UserProfileService.psm1 | 50 ------------------- .../xSharePoint.Util/xSharePoint.Util.psm1 | 49 ++++++++++++++++++ Modules/xSharePoint/xSharePoint.psd1 | 1 - Modules/xSharePoint/xSharePoint.pssproj | 2 - ...Point.xSPDistributedCacheService.Tests.ps1 | 3 ++ 6 files changed, 66 insertions(+), 54 deletions(-) delete mode 100644 Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index b0c092b0b..f8a2dd321 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -13,7 +13,7 @@ function Get-TargetResource ) Write-Verbose -Message "Getting the cache host information" - + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] $nullReturnValue = @{ @@ -66,6 +66,13 @@ function Set-TargetResource $CurrentState = Get-TargetResource @PSBoundParameters + $isLocalAdmin = Test-xSharePointUserIsLocalAdmin -UserName $ServiceAccount + + if (!$isLocalAdmin) + { + Add-xSharePointUserToLocalAdmin -UserName $ServiceAccount + } + if ($Ensure -eq "Present") { Write-Verbose -Message "Adding the distributed cache to the server" if($createFirewallRules -eq $true) { @@ -123,6 +130,12 @@ function Set-TargetResource } Write-Verbose -Message "Distributed cache removed." } + + # Remove the FarmAccount from the local Administrators group, if it was added above + if (!$isLocalAdmin) + { + Remove-xSharePointUserToLocalAdmin -UserName $ServiceAccount + } } function Test-TargetResource diff --git a/Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 b/Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 deleted file mode 100644 index 2b029a1fb..000000000 --- a/Modules/xSharePoint/Modules/xSharePoint.UserProfileService/xSharePoint.UserProfileService.psm1 +++ /dev/null @@ -1,50 +0,0 @@ -function Test-xSharePointUserIsLocalAdmin() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - [string] - $UserName - ) - - $domainName = $UserName.Split('\')[0] - $accountName = $UserName.Split('\')[1] - - return ([ADSI]"WinNT://$($env:computername)/Administrators,group").PSBase.Invoke("Members") | - ForEach-Object {$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)} | - Where-Object { $_ -eq $accountName } -} - -function Add-xSharePointUserToLocalAdmin() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - [string] - $UserName - ) - - $domainName = $UserName.Split('\')[0] - $accountName = $UserName.Split('\')[1] - - Write-Verbose -Message "Adding $domainName\$userName to local admin group" - ([ADSI]"WinNT://$($env:computername)/Administrators,group").Add("WinNT://$domainName/$accountName") | Out-Null -} - -function Remove-xSharePointUserToLocalAdmin() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - [string] - $UserName - ) - - $domainName = $UserName.Split('\')[0] - $accountName = $UserName.Split('\')[1] - - Write-Verbose -Message "Removing $domainName\$userName from local admin group" - ([ADSI]"WinNT://$($env:computername)/Administrators,group").Remove("WinNT://$domainName/$accountName") | Out-Null -} - -Export-ModuleMember -Function * diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 6f6ec46db..592288615 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -160,4 +160,53 @@ function Test-xSharePointSpecificParameters() { return $returnValue } +function Test-xSharePointUserIsLocalAdmin() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + [string] + $UserName + ) + + $domainName = $UserName.Split('\')[0] + $accountName = $UserName.Split('\')[1] + + return ([ADSI]"WinNT://$($env:computername)/Administrators,group").PSBase.Invoke("Members") | + ForEach-Object {$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)} | + Where-Object { $_ -eq $accountName } +} + +function Add-xSharePointUserToLocalAdmin() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + [string] + $UserName + ) + + $domainName = $UserName.Split('\')[0] + $accountName = $UserName.Split('\')[1] + + Write-Verbose -Message "Adding $domainName\$userName to local admin group" + ([ADSI]"WinNT://$($env:computername)/Administrators,group").Add("WinNT://$domainName/$accountName") | Out-Null +} + +function Remove-xSharePointUserToLocalAdmin() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + [string] + $UserName + ) + + $domainName = $UserName.Split('\')[0] + $accountName = $UserName.Split('\')[1] + + Write-Verbose -Message "Removing $domainName\$userName from local admin group" + ([ADSI]"WinNT://$($env:computername)/Administrators,group").Remove("WinNT://$domainName/$accountName") | Out-Null +} + Export-ModuleMember -Function * diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1 index 52963a2ea..dc07ab2d1 100644 --- a/Modules/xSharePoint/xSharePoint.psd1 +++ b/Modules/xSharePoint/xSharePoint.psd1 @@ -64,7 +64,6 @@ Description = 'This DSC module is used to deploy and configure SharePoint Server # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess NestedModules = @("modules\xSharePoint.CacheAccounts\xSharePoint.CacheAccounts.psm1", - "modules\xSharePoint.UserProfileService\xSharePoint.UserProfileService.psm1", "modules\xSharePoint.Util\xSharePoint.Util.psm1") # Functions to export from this module diff --git a/Modules/xSharePoint/xSharePoint.pssproj b/Modules/xSharePoint/xSharePoint.pssproj index 26dca94f6..fc4bcb504 100644 --- a/Modules/xSharePoint/xSharePoint.pssproj +++ b/Modules/xSharePoint/xSharePoint.pssproj @@ -75,7 +75,6 @@ - @@ -126,7 +125,6 @@ - diff --git a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 index f53a68cd7..5b39ed05f 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 @@ -40,6 +40,9 @@ Describe "xSPDistributedCacheService" { Mock Add-SPDistributedCacheServiceInstance { } Mock Update-SPDistributedCacheSize { } Mock Get-SPManagedAccount { return @{} } + Mock Add-xSharePointUserToLocalAdmin { } + Mock Test-xSharePointUserIsLocalAdmin { return $false } + Mock Remove-xSharePointUserToLocalAdmin { } Mock Get-SPFarm { return @{ Services = @(@{ Name = "AppFabricCachingService" From 6227a69a9b3e3d5410d0ccfa53aaefac9cd6eb2e Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 28 Sep 2015 23:50:58 +1000 Subject: [PATCH 123/146] Refactor and test coverage improvement --- .../DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 | 2 +- Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 index 53418eb70..15007c946 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 @@ -86,7 +86,7 @@ function Set-TargetResource Start-Service -Name sptimerv4 Write-Verbose -Message "Pausing for 5 minutes to allow the timer service to fully provision the server" - Invoke-Command -ScriptBlock { Start-Sleep -Seconds 300 } -NoNewScope + Start-Sleep -Seconds 300 Write-Verbose -Message "Join farm complete. Restarting computer to allow configuration to continue" $global:DSCMachineStatus = 1 diff --git a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 index c2ca83c4d..91d3d969e 100644 --- a/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPJoinFarm.Tests.ps1 @@ -34,7 +34,7 @@ Describe "xSPJoinFarm" { Mock New-SPCentralAdministration {} Mock Install-SPApplicationContent {} Mock Start-Service {} - Mock Invoke-Command {} -ParameterFilter { $ScriptBlock.ToString().Contains("Start-Sleep") -eq $true } + Mock Start-Sleep {} $versionBeingTested = (Get-Item $Global:CurrentSharePointStubModule).Directory.BaseName $majorBuildNumber = $versionBeingTested.Substring(0, $versionBeingTested.IndexOf(".")) @@ -43,7 +43,7 @@ Describe "xSPJoinFarm" { Context "no farm is configured locally and a supported version of SharePoint is installed" { - Mock Get-SPFarm { return $null } + Mock Get-SPFarm { throw "Unable to detect local farm" } It "the get method returns null when the farm is not configured" { Get-TargetResource @testParams | Should BeNullOrEmpty From aa020a0d0eb5923e32a486e09623745e10e91a59 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 29 Sep 2015 00:08:52 +1000 Subject: [PATCH 124/146] Removed redundant catch block --- .../MSFT_xSPManagedAccount.psm1 | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 index 6b85880f4..c461730cb 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 @@ -17,20 +17,15 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - - try { - $ma = Get-SPManagedAccount -Identity $params.Account.UserName -ErrorAction SilentlyContinue - if ($null -eq $ma) { return $null } - return @{ - AccountName = $ma.Username - EmailNotification = $ma.DaysBeforeChangeToEmail - PreExpireDays = $ma.DaysBeforeExpiryToChange - Schedule = $ma.ChangeSchedule - Account = $params.Account - InstallAccount = $params.InstallAccount - } - } catch { - return $null + $ma = Get-SPManagedAccount -Identity $params.Account.UserName -ErrorAction SilentlyContinue + if ($null -eq $ma) { return $null } + return @{ + AccountName = $ma.Username + EmailNotification = $ma.DaysBeforeChangeToEmail + PreExpireDays = $ma.DaysBeforeExpiryToChange + Schedule = $ma.ChangeSchedule + Account = $params.Account + InstallAccount = $params.InstallAccount } } return $result From 5ce8b872ba323fbc2ca7886191db1e48e609d16b Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 29 Sep 2015 00:21:19 +1000 Subject: [PATCH 125/146] Refactor and increase test coverage --- .../MSFT_xSPManagedMetaDataServiceApp.psm1 | 40 ++++++++----------- ...int.xSPManagedMetadataServiceApp.Tests.ps1 | 25 +++++++++++- 2 files changed, 40 insertions(+), 25 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 index 32e85b85c..6aecc1c07 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 @@ -16,33 +16,25 @@ function Get-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] + $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue + if ($null -eq $serviceApps) { + return $null + } + $serviceApp = $serviceApps | Where-Object { $_.TypeName -eq "Managed Metadata Service" } - try + If ($null -eq $serviceApp) { - $serviceApps = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue - if ($null -eq $serviceApps) { - return $null - } - $serviceApp = $serviceApps | Where-Object { $_.TypeName -eq "Managed Metadata Service" } - - If ($null -eq $serviceApp) - { - return $null - } - else - { - return @{ - Name = $serviceApp.DisplayName - ApplicationPool = $serviceApp.ApplicationPool.Name - DatabaseName = $serviceApp.Database.Name - DatabaseServer = $serviceApp.Database.Server.Name - InstallAccount = $params.InstallAccount - } - } - } - catch + return $null + } + else { - return $null + return @{ + Name = $serviceApp.DisplayName + ApplicationPool = $serviceApp.ApplicationPool.Name + DatabaseName = $serviceApp.Database.Name + DatabaseServer = $serviceApp.Database.Server.Name + InstallAccount = $params.InstallAccount + } } } return $result diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 index 26d36946c..c9a035099 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedMetadataServiceApp.Tests.ps1 @@ -28,7 +28,7 @@ Describe "xSPManagedMetaDataServiceApp" { Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Context "When no service application exists in the current farm" { + Context "When no service applications exist in the current farm" { Mock Get-SPServiceApplication { return $null } Mock New-SPMetadataServiceApplication { return @{} } @@ -47,6 +47,29 @@ Describe "xSPManagedMetaDataServiceApp" { Set-TargetResource @testParams Assert-MockCalled New-SPMetadataServiceApplication } + + $testParams.Add("InstallAccount", (New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)))) + It "creates a new service application in the set method where InstallAccount is used" { + Set-TargetResource @testParams + Assert-MockCalled New-SPMetadataServiceApplication + } + $testParams.Remove("InstallAccount") + } + + Context "When service applications exist in the current farm but the specific MMS app does not" { + + Mock Get-SPServiceApplication { return @(@{ + TypeName = "Some other service app type" + }) } + + It "returns null from the Get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } + } + + It "returns false when the Test method is called" { + Test-TargetResource @testParams | Should Be $false + } } Context "When a service application exists and is configured correctly" { From 28e80e05bb0074db92a45ff6046bf375beff33a5 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 29 Sep 2015 00:26:32 +1000 Subject: [PATCH 126/146] Expanded test coverage --- Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 index f35840ab8..9be3120e4 100644 --- a/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPManagedPath.Tests.ps1 @@ -53,6 +53,14 @@ Describe "xSPManagedPath" { Assert-MockCalled New-SPManagedPath } $testParams.HostHeader = $false + + $testParams.Add("InstallAccount", (New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)))) + It "creates a host header path in the set method where InstallAccount is used" { + Set-TargetResource @testParams + + Assert-MockCalled New-SPManagedPath + } + $testParams.Remove("InstallAccount") } Context "The path exists but is of the wrong type" { From 7dab31472081951a9aaea592d99ccc5bb4f8fe2c Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 29 Sep 2015 00:31:31 +1000 Subject: [PATCH 127/146] Expanded test coverage --- .../xSharePoint.xSPSearchServiceApp.Tests.ps1 | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 index a59826a9b..6137db92f 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSearchServiceApp.Tests.ps1 @@ -26,7 +26,7 @@ Describe "xSPSearchServiceApp" { Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Context "When no service application exists in the current farm" { + Context "When no service applications exist in the current farm" { Mock Get-SPServiceApplication { return $null } Mock Get-SPEnterpriseSearchServiceInstance { return @{} } @@ -49,6 +49,39 @@ Describe "xSPSearchServiceApp" { Set-TargetResource @testParams Assert-MockCalled New-SPEnterpriseSearchServiceApplication } + + $testParams.Add("InstallAccount", (New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)))) + It "creates a new service application in the set method where InstallAccount is used" { + Set-TargetResource @testParams + Assert-MockCalled New-SPEnterpriseSearchServiceApplication + } + $testParams.Remove("InstallAccount") + } + + Context "When service applications exist in the current farm but the specific search app does not" { + Mock Get-SPEnterpriseSearchServiceInstance { return @{} } + Mock New-SPBusinessDataCatalogServiceApplication { } + Mock Start-SPEnterpriseSearchServiceInstance { } + Mock New-SPEnterpriseSearchServiceApplication { return @{} } + Mock New-SPEnterpriseSearchServiceApplicationProxy { } + Mock Set-SPEnterpriseSearchServiceApplication { } + Mock Get-SPServiceApplication { return @(@{ + TypeName = "Some other service app type" + }) } + + It "returns null from the Get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } + } + + It "returns false when the Test method is called" { + Test-TargetResource @testParams | Should Be $false + } + + It "creates a new service application in the set method" { + Set-TargetResource @testParams + Assert-MockCalled New-SPEnterpriseSearchServiceApplication + } } Context "When a service application exists and is configured correctly" { From 16a0c49fa9b6b75bc520bd47adb171dbc5b14bed Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 29 Sep 2015 07:44:30 +1000 Subject: [PATCH 128/146] Test coverage improvements --- ...rePoint.xSPSecureStoreServiceApp.Tests.ps1 | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 index 4172b56a4..0b4cdc8c7 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 @@ -50,6 +50,35 @@ Describe "xSPSecureStoreServiceApp" { Set-TargetResource @testParams Assert-MockCalled New-SPSecureStoreServiceApplication } + + $testParams.Add("InstallAccount", (New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)))) + It "creates a new service application in the set method where InstallAccount is used" { + Set-TargetResource @testParams + Assert-MockCalled New-SPSecureStoreServiceApplication + } + $testParams.Remove("InstallAccount") + + $testParams.Add("DatabaseName", "SP_SecureStore") + It "creates a new service application in the set method where parameters beyond the minimum required set" { + Set-TargetResource @testParams + Assert-MockCalled New-SPSecureStoreServiceApplication + } + $testParams.Remove("DatabaseName") + } + + Context "When service applications exist in the current farm but the specific search app does not" { + Mock Get-SPServiceApplication { return @(@{ + TypeName = "Some other service app type" + }) } + + It "returns null from the Get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } + } + + It "returns false when the Test method is called" { + Test-TargetResource @testParams | Should Be $false + } } Context "When a service application exists and is configured correctly" { @@ -100,6 +129,27 @@ Describe "xSPSecureStoreServiceApp" { Assert-MockCalled Get-SPServiceApplicationPool Assert-MockCalled Set-SPSecureStoreServiceApplication } + } + + Context "When an unsupported version of SharePoint is installed" { + Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 14 } } + Mock Get-SPServiceApplication { + return @(@{ + TypeName = "Secure Store Service Application" + DisplayName = $testParams.Name + ApplicationPool = @{ Name = "Wrong App Pool Name" } + Database = @{ + Name = $testParams.DatabaseName + Server = @{ Name = $testParams.DatabaseServer } + } + }) + } + Mock Get-SPServiceApplicationPool { return @{ Name = $testParams.ApplicationPool } } + Mock Set-SPSecureStoreServiceApplication { } + + It "the set method throws an exception" { + { Set-TargetResource @testParams } | Should Throw + } } } } \ No newline at end of file From f8da3047e43b50367d40e79ba850988988be1471 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 29 Sep 2015 11:06:09 +1000 Subject: [PATCH 129/146] --- .../xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 index 0b4cdc8c7..4dd73048c 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSecureStoreServiceApp.Tests.ps1 @@ -58,7 +58,7 @@ Describe "xSPSecureStoreServiceApp" { } $testParams.Remove("InstallAccount") - $testParams.Add("DatabaseName", "SP_SecureStore") + $testParams.Add("DatabaseName", "SP_SecureStore") It "creates a new service application in the set method where parameters beyond the minimum required set" { Set-TargetResource @testParams Assert-MockCalled New-SPSecureStoreServiceApplication @@ -131,8 +131,8 @@ Describe "xSPSecureStoreServiceApp" { } } - Context "When an unsupported version of SharePoint is installed" { - Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 14 } } + Context "When an unsupported version of SharePoint is installed" { + Mock Get-xSharePointInstalledProductVersion { return @{ FileMajorPart = 14 } } Mock Get-SPServiceApplication { return @(@{ TypeName = "Secure Store Service Application" From 7c0319a44d161a2f8891ee292a0a67f298c3e119 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 29 Sep 2015 20:59:15 +1000 Subject: [PATCH 130/146] Expanded test coverage --- .../xSharePoint.xSPServiceInstance.Tests.ps1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 index 5e69f07a1..d2016c7a9 100644 --- a/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPServiceInstance.Tests.ps1 @@ -28,6 +28,18 @@ Describe "xSPServiceInstance" { Mock Start-SPServiceInstance { } Mock Stop-SPServiceInstance { } + Context "The service instance is not running but should be" { + Mock Get-SPServiceInstance { return $null } + + It "returns absent from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Absent" + } + + It "returns false from the set method" { + Test-TargetResource @testParams | Should Be $false + } + } + Context "The service instance is not running but should be" { Mock Get-SPServiceInstance { return @( @{ From 96be03f32eabd684c9595358669b39be3023de4f Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 29 Sep 2015 21:37:39 +1000 Subject: [PATCH 131/146] Expanded code coverage --- .../xSharePoint/xSharePoint.xSPSite.Tests.ps1 | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 index 7f6af8826..c5ad1e72d 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 @@ -84,6 +84,35 @@ Describe "xSPSite" { It "returns true from the test method" { Test-TargetResource @testParams | Should Be $true + } + + Mock Get-SPSite { return @{ + HostHeaderIsSiteName = $false + WebApplication = @{ + Url = $testParams.Url + UseClaimsAuthentication = $true + } + Url = $testParams.Url + Owner = $null + }} + + It "returns the site data from the get method where a valid site collection admin does not exist" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + } + + Mock Get-SPSite { return @{ + HostHeaderIsSiteName = $false + WebApplication = @{ + Url = $testParams.Url + UseClaimsAuthentication = $true + } + Url = $testParams.Url + Owner = @{ UserLogin = "DEMO\owner" } + SecondaryContact = @{ UserLogin = "DEMO\secondary" } + }} + + It "returns the site data from the get method where a secondary site contact exists" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty } } @@ -104,6 +133,21 @@ Describe "xSPSite" { It "returns true from the test method" { Test-TargetResource @testParams | Should Be $true + } + + Mock Get-SPSite { return @{ + HostHeaderIsSiteName = $false + WebApplication = @{ + Url = $testParams.Url + UseClaimsAuthentication = $false + } + Url = $testParams.Url + Owner = @{ UserLogin = "DEMO\owner" } + SecondaryContact = @{ UserLogin = "DEMO\secondary" } + }} + + It "returns the site data from the get method where a secondary site contact exists" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty } } } From 52d185deed4724d6454a0e802bb38f88c6cb1d5d Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 29 Sep 2015 21:41:57 +1000 Subject: [PATCH 132/146] Expanded test coverage --- Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 index 1454092cd..24d1146fd 100644 --- a/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 @@ -17,6 +17,8 @@ Describe "xSPStateServiceApp" { $testParams = @{ Name = "State Service App" DatabaseName = "SP_StateService" + DatabaseServer = "SQL.test.domain" + DatabaseCredentials = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") From 6959dd589b62be78e66143510f47ed7a58b96335 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 29 Sep 2015 22:17:36 +1000 Subject: [PATCH 133/146] Expanded test coverage, fixed minor issues --- .../MSFT_xSPUsageApplication.psm1 | 3 +-- .../xSharePoint/xSharePoint.xSPSite.Tests.ps1 | 18 +++++++-------- .../xSharePoint.xSPStateServiceApp.Tests.ps1 | 4 ++-- .../xSharePoint.xSPusageApplication.Tests.ps1 | 23 ++++++++++++++++++- 4 files changed, 34 insertions(+), 14 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 index 088d93e97..4fd51fefe 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 @@ -80,12 +80,11 @@ function Set-TargetResource if ($null -eq $CurrentState) { Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $newParams = @{} $newParams.Add("Name", $params.Name) if ($params.ContainsKey("DatabaseName")) { $newParams.Add("DatabaseName", $params.DatabaseName) } - if ($params.ContainsKey("DatabasePassword")) { $newParams.Add("DatabasePassword", $params.DatabasePassword) } + if ($params.ContainsKey("DatabasePassword")) { $newParams.Add("DatabasePassword", (ConvertTo-SecureString -String $params.DatabasePassword -AsPlainText -force)) } if ($params.ContainsKey("DatabaseServer")) { $newParams.Add("DatabaseServer", $params.DatabaseServer) } if ($params.ContainsKey("DatabaseUsername")) { $newParams.Add("DatabaseUsername", $params.DatabaseUsername) } if ($params.ContainsKey("FailoverDatabaseServer")) { $newParams.Add("FailoverDatabaseServer", $params.FailoverDatabaseServer) } diff --git a/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 index c5ad1e72d..b0ecec56b 100644 --- a/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPSite.Tests.ps1 @@ -86,7 +86,7 @@ Describe "xSPSite" { Test-TargetResource @testParams | Should Be $true } - Mock Get-SPSite { return @{ + Mock Get-SPSite { return @{ HostHeaderIsSiteName = $false WebApplication = @{ Url = $testParams.Url @@ -96,11 +96,11 @@ Describe "xSPSite" { Owner = $null }} - It "returns the site data from the get method where a valid site collection admin does not exist" { + It "returns the site data from the get method where a valid site collection admin does not exist" { Get-TargetResource @testParams | Should Not BeNullOrEmpty } - - Mock Get-SPSite { return @{ + + Mock Get-SPSite { return @{ HostHeaderIsSiteName = $false WebApplication = @{ Url = $testParams.Url @@ -108,10 +108,10 @@ Describe "xSPSite" { } Url = $testParams.Url Owner = @{ UserLogin = "DEMO\owner" } - SecondaryContact = @{ UserLogin = "DEMO\secondary" } + SecondaryContact = @{ UserLogin = "DEMO\secondary" } }} - It "returns the site data from the get method where a secondary site contact exists" { + It "returns the site data from the get method where a secondary site contact exists" { Get-TargetResource @testParams | Should Not BeNullOrEmpty } } @@ -135,7 +135,7 @@ Describe "xSPSite" { Test-TargetResource @testParams | Should Be $true } - Mock Get-SPSite { return @{ + Mock Get-SPSite { return @{ HostHeaderIsSiteName = $false WebApplication = @{ Url = $testParams.Url @@ -143,10 +143,10 @@ Describe "xSPSite" { } Url = $testParams.Url Owner = @{ UserLogin = "DEMO\owner" } - SecondaryContact = @{ UserLogin = "DEMO\secondary" } + SecondaryContact = @{ UserLogin = "DEMO\secondary" } }} - It "returns the site data from the get method where a secondary site contact exists" { + It "returns the site data from the get method where a secondary site contact exists" { Get-TargetResource @testParams | Should Not BeNullOrEmpty } } diff --git a/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 index 24d1146fd..8175ebaca 100644 --- a/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPStateServiceApp.Tests.ps1 @@ -17,8 +17,8 @@ Describe "xSPStateServiceApp" { $testParams = @{ Name = "State Service App" DatabaseName = "SP_StateService" - DatabaseServer = "SQL.test.domain" - DatabaseCredentials = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) + DatabaseServer = "SQL.test.domain" + DatabaseCredentials = New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)) } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") diff --git a/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 index 5d8e07ea4..b95d44197 100644 --- a/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPusageApplication.Tests.ps1 @@ -20,6 +20,11 @@ Describe "xSPUsageApplication" { UsageLogLocation = "L:\UsageLogs" UsageLogMaxFileSizeKB = 1024 UsageLogMaxSpaceGB = 10 + DatabaseName = "SP_Usage" + DatabaseServer = "sql.test.domain" + DatabaseUsername = "user" + DatabasePassword = "password" + FailoverDatabaseServer = "anothersql.test.domain" } Import-Module (Join-Path ((Resolve-Path $PSScriptRoot\..\..).Path) "Modules\xSharePoint") @@ -38,7 +43,7 @@ Describe "xSPUsageApplication" { UsageLogMaxSpaceGB = $testParams.UsageLogMaxSpaceGB }} - Context "When no service application exists in the current farm" { + Context "When no service applications exist in the current farm" { Mock Get-SPServiceApplication { return $null } @@ -57,6 +62,22 @@ Describe "xSPUsageApplication" { } } + Context "When service applications exist in the current farm but not the specific usage service app" { + + Mock Get-SPServiceApplication { return @(@{ + TypeName = "Some other service app type" + }) } + + It "returns null from the Get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } + } + + It "returns false when the Test method is called" { + Test-TargetResource @testParams | Should Be $false + } + } + Context "When a service application exists and is configured correctly" { Mock Get-SPServiceApplication { return @(@{ From 24dbba847d561ccc2216b776b76dc00b1711dc9f Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 29 Sep 2015 22:34:25 +1000 Subject: [PATCH 134/146] Code coverage improvements --- ...rePoint.xSPUserProfileServiceApp.Tests.ps1 | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 index 8d1b09f64..01b96af4f 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 @@ -30,14 +30,14 @@ Describe "xSPUserProfileServiceApp" { Mock Get-SPFarm { return @{ DefaultServiceAccount = @{ Name = $testParams.FarmAccount.Username } }} - Mock New-SPProfileServiceApplication { } + Mock New-SPProfileServiceApplication { return @{} } Mock New-SPProfileServiceApplicationProxy { } Mock Add-xSharePointUserToLocalAdmin { } Mock Test-xSharePointUserIsLocalAdmin { return $false } Mock Remove-xSharePointUserToLocalAdmin { } Mock New-PSSession { return $null } -ModuleName "xSharePoint.Util" - Context "When no service application exists in the current farm" { + Context "When no service applications exist in the current farm" { Mock Get-SPServiceApplication { return $null } @@ -53,6 +53,29 @@ Describe "xSPUserProfileServiceApp" { It "creates a new service application in the set method" { Set-TargetResource @testParams Assert-MockCalled New-SPProfileServiceApplication + } + + $testParams.Add("InstallAccount", (New-Object System.Management.Automation.PSCredential ("domain\username", (ConvertTo-SecureString "password" -AsPlainText -Force)))) + It "creates a new service application in the set method when InstallAccount is used" { + Set-TargetResource @testParams + Assert-MockCalled New-SPProfileServiceApplication + } + $testParams.Remove("InstallAccount") + } + + Context "When service applications exist in the current farm but not the specific user profile service app" { + + Mock Get-SPServiceApplication { return @(@{ + TypeName = "Some other service app type" + }) } + + It "returns null from the Get method" { + Get-TargetResource @testParams | Should BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } + } + + It "returns false when the Test method is called" { + Test-TargetResource @testParams | Should Be $false } } @@ -110,6 +133,15 @@ Describe "xSPUserProfileServiceApp" { It "returns true when the Test method is called" { Test-TargetResource @testParams | Should Be $true } + + Mock Get-SPFarm { return @{ + DefaultServiceAccount = @{ Name = "WRONG\account" } + }} + + It "returns values from the get method where the farm account doesn't match" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + Assert-MockCalled Get-SPServiceApplication -ParameterFilter { $Name -eq $testParams.Name } + } } } } \ No newline at end of file From f19aa1097b819d08429e9dc6720257b24cbbb03e Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 29 Sep 2015 23:28:33 +1000 Subject: [PATCH 135/146] Expanded code coverage --- .../MSFT_xSPUserProfileSyncService.psm1 | 5 +- ...ePoint.xSPUserProfileSyncService.Tests.ps1 | 256 ++++++++++-------- 2 files changed, 142 insertions(+), 119 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 index bfa80d63d..0baebd176 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 @@ -111,10 +111,9 @@ function Set-TargetResource $maxCount = 10 while (($count -lt $maxCount) -and ($syncService.Status -ne $desiredState)) { - # Get the current status of the Sync service - $syncService = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq "User Profile Synchronization Service" } - if ($syncService.Status -ne $desiredState) { Start-Sleep -Seconds 60 } + # Get the current status of the Sync service + $syncService = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq "User Profile Synchronization Service" } $count++ } } diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 index 088953a3b..a5698e344 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 @@ -42,128 +42,152 @@ Describe "xSPUserProfileSyncService" { Mock Test-xSharePointUserIsLocalAdmin { return $false } Mock Remove-xSharePointUserToLocalAdmin { } Mock New-PSSession { return $null } -ModuleName "xSharePoint.Util" + Mock Start-Sleep { } switch ($majorBuildNumber) { 15 { - Context "User profile sync service is not running and should be" { - Mock Get-SPServiceInstance { if ($Global:xSharePointUPACheck -eq $false) { - $Global:xSharePointUPACheck = $true - return @( @{ - Status = "Disabled" - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") - UserProfileApplicationGuid = [Guid]::Empty - TypeName = "User Profile Synchronization Service" - }) - } else { - return @( @{ - Status = "Online" - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") - UserProfileApplicationGuid = [Guid]::NewGuid() - TypeName = "User Profile Synchronization Service" - }) - } - } - Mock Get-SPServiceApplication { return @( - New-Object Object | - Add-Member NoteProperty ID ([Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f")) -PassThru | - Add-Member NoteProperty TypeName "User Profile Service Application" -PassThru | - Add-Member ScriptMethod SetSynchronizationMachine { - param($computerName, $syncServiceID, $FarmUserName, $FarmPassword) - } -PassThru - )} - - It "returns absent from the get method" { - $Global:xSharePointUPACheck = $false - (Get-TargetResource @testParams).Ensure | Should Be "Absent" - } + Context "User profile sync service is not found locally" { + Mock Get-SPServiceInstance { return $null } - It "returns false from the test method" { - $Global:xSharePointUPACheck = $false - Test-TargetResource @testParams | Should Be $false - } - - It "calls the start service cmdlet from the set method" { - $Global:xSharePointUPACheck = $false - Set-TargetResource @testParams + It "returns absent from the get method" { + $Global:xSharePointUPACheck = $false + (Get-TargetResource @testParams).Ensure | Should Be "Absent" + } + } - Assert-MockCalled Start-SPServiceInstance - } - } - - Context "User profile sync service is running and should be" { - Mock Get-SPServiceInstance { return @( @{ - Status = "Online" - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") - UserProfileApplicationGuid = [Guid]::NewGuid() - TypeName = "User Profile Synchronization Service" - }) - } + Context "User profile sync service is not running and should be" { + Mock Get-SPServiceInstance { if ($Global:xSharePointUPACheck -eq $false) { + $Global:xSharePointUPACheck = $true + return @( @{ + Status = "Disabled" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::Empty + TypeName = "User Profile Synchronization Service" + }) + } else { + return @( @{ + Status = "Online" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::NewGuid() + TypeName = "User Profile Synchronization Service" + }) + } + } + Mock Get-SPServiceApplication { return @( + New-Object Object | + Add-Member NoteProperty ID ([Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f")) -PassThru | + Add-Member NoteProperty TypeName "User Profile Service Application" -PassThru | + Add-Member ScriptMethod SetSynchronizationMachine { + param($computerName, $syncServiceID, $FarmUserName, $FarmPassword) + } -PassThru + )} + + It "returns absent from the get method" { + $Global:xSharePointUPACheck = $false + (Get-TargetResource @testParams).Ensure | Should Be "Absent" + } + + It "returns false from the test method" { + $Global:xSharePointUPACheck = $false + Test-TargetResource @testParams | Should Be $false + } + + It "calls the start service cmdlet from the set method" { + $Global:xSharePointUPACheck = $false + Set-TargetResource @testParams + + Assert-MockCalled Start-SPServiceInstance + } + + Mock Get-SPFarm { return @{ + DefaultServiceAccount = @{ Name = "WRONG\account" } + }} + + It "returns values from the get method where the farm account doesn't match" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + } + + $Global:xSharePointUPACheck = $false + Mock Get-SPServiceApplication { return $null } + It "throws in the set method if the user profile service app can't be found" { + { Set-TargetResource @testParams } | Should Throw + } + } + + Context "User profile sync service is running and should be" { + Mock Get-SPServiceInstance { return @( @{ + Status = "Online" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::NewGuid() + TypeName = "User Profile Synchronization Service" + }) + } - It "returns present from the get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Present" - } - - It "returns true from the test method" { - Test-TargetResource @testParams | Should Be $true - } - } - - $testParams.Ensure = "Absent" - - Context "User profile sync service is running and shouldn't be" { - Mock Get-SPServiceInstance { if ($Global:xSharePointUPACheck -eq $false) { - $Global:xSharePointUPACheck = $true - return @( @{ - Status = "Online" - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") - UserProfileApplicationGuid = [Guid]::NewGuid() - TypeName = "User Profile Synchronization Service" - }) - } else { - return @( @{ - Status = "Disabled" - ID = [Guid]::Empty - UserProfileApplicationGuid = [Guid]::Empty - TypeName = "User Profile Synchronization Service" - }) - } - } - - It "returns present from the get method" { - $Global:xSharePointUPACheck = $false - (Get-TargetResource @testParams).Ensure | Should Be "Present" - } - - It "returns false from the test method" { - $Global:xSharePointUPACheck = $false - Test-TargetResource @testParams | Should Be $false - } - - It "calls the start service cmdlet from the set method" { - $Global:xSharePointUPACheck = $false - Set-TargetResource @testParams - - Assert-MockCalled Stop-SPServiceInstance - } - } - - Context "User profile sync service is not running and shouldn't be" { - Mock Get-SPServiceInstance { return @( @{ - Status = "Disabled" - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") - UserProfileApplicationGuid = [Guid]::Empty - TypeName = "User Profile Synchronization Service" - }) - } - - It "returns absent from the get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" - } - - It "returns true from the test method" { - Test-TargetResource @testParams | Should Be $true - } - } + It "returns present from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Present" + } + + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true + } + } + + $testParams.Ensure = "Absent" + + Context "User profile sync service is running and shouldn't be" { + Mock Get-SPServiceInstance { if ($Global:xSharePointUPACheck -eq $false) { + $Global:xSharePointUPACheck = $true + return @( @{ + Status = "Online" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::NewGuid() + TypeName = "User Profile Synchronization Service" + }) + } else { + return @( @{ + Status = "Disabled" + ID = [Guid]::Empty + UserProfileApplicationGuid = [Guid]::Empty + TypeName = "User Profile Synchronization Service" + }) + } + } + + It "returns present from the get method" { + $Global:xSharePointUPACheck = $false + (Get-TargetResource @testParams).Ensure | Should Be "Present" + } + + It "returns false from the test method" { + $Global:xSharePointUPACheck = $false + Test-TargetResource @testParams | Should Be $false + } + + It "calls the start service cmdlet from the set method" { + $Global:xSharePointUPACheck = $false + Set-TargetResource @testParams + + Assert-MockCalled Stop-SPServiceInstance + } + } + + Context "User profile sync service is not running and shouldn't be" { + Mock Get-SPServiceInstance { return @( @{ + Status = "Disabled" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::Empty + TypeName = "User Profile Synchronization Service" + }) + } + + It "returns absent from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Absent" + } + + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true + } + } } 16 { Context "All methods throw exceptions as user profile sync doesn't exist in 2016" { From 2f7ac55f428f3bbea8dba9b747aea750d1ceeb7b Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 29 Sep 2015 23:40:15 +1000 Subject: [PATCH 136/146] Added scenarios to expand test coverage --- .../xSharePoint.xSPWebApplication.Tests.ps1 | 53 ++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 index b2a6a83fe..36f5c0548 100644 --- a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 @@ -49,6 +49,24 @@ Describe "xSPWebApplication" { Assert-MockCalled New-SPWebApplication Assert-MockCalled New-SPAuthenticationProvider -ParameterFilter { $DisableKerberos -eq $true } } + + $testParams.Add("InstallAccount", (New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)))) + It "calls the new cmdlet from the set method where InstallAccount is used" { + Set-TargetResource @testParams + + Assert-MockCalled New-SPWebApplication + Assert-MockCalled New-SPAuthenticationProvider -ParameterFilter { $DisableKerberos -eq $true } + } + $testParams.Remove("InstallAccount") + + $testParams.Add("AllowAnonymous", $true) + It "calls the new cmdlet from the set where anonymous authentication is requested" { + Set-TargetResource @testParams + + Assert-MockCalled New-SPWebApplication + Assert-MockCalled New-SPAuthenticationProvider -ParameterFilter { $DisableKerberos -eq $true } + } + $testParams.Remove("AllowAnonymous") } $testParams.AuthenticationMethod = "Kerberos" @@ -71,7 +89,9 @@ Describe "xSPWebApplication" { } } - Context "The web appliation does exist and should" { + $testParams.AuthenticationMethod = "NTLM" + + Context "The web appliation does exist and should that uses NTLM" { Mock Get-SPAuthenticationProvider { return @{ DisableKerberos = $true; AllowAnonymous = $false } } Mock Get-SPWebApplication { return @(@{ DisplayName = $testParams.Name @@ -95,6 +115,37 @@ Describe "xSPWebApplication" { Get-TargetResource @testParams | Should Not BeNullOrEmpty } + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true + } + } + + $testParams.AuthenticationMethod = "Kerberos" + + Context "The web appliation does exist and should that uses Kerberos" { + Mock Get-SPAuthenticationProvider { return @{ DisableKerberos = $false; AllowAnonymous = $false } } + Mock Get-SPWebApplication { return @(@{ + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool + Username = $testParams.ApplicationPoolAccount + } + ContentDatabases = @( + @{ + Name = "SP_Content_01" + Server = "sql.domain.local" + } + ) + IisSettings = @( + @{ Path = "C:\inetpub\wwwroot\something" } + ) + Url = $testParams.Url + })} + + It "returns the current data from the get method" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + } + It "returns true from the test method" { Test-TargetResource @testParams | Should Be $true } From 01e66eb6a6427fa1de41f9c63f75d85db2a9cbc1 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 29 Sep 2015 23:40:54 +1000 Subject: [PATCH 137/146] Formatting fixes --- .../MSFT_xSPUserProfileSyncService.psm1 | 2 +- ...rePoint.xSPUserProfileServiceApp.Tests.ps1 | 6 +- ...ePoint.xSPUserProfileSyncService.Tests.ps1 | 278 +++++++++--------- .../xSharePoint.xSPWebApplication.Tests.ps1 | 18 +- 4 files changed, 152 insertions(+), 152 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 index 0baebd176..eac5b8704 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 @@ -112,7 +112,7 @@ function Set-TargetResource while (($count -lt $maxCount) -and ($syncService.Status -ne $desiredState)) { if ($syncService.Status -ne $desiredState) { Start-Sleep -Seconds 60 } - # Get the current status of the Sync service + # Get the current status of the Sync service $syncService = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq "User Profile Synchronization Service" } $count++ } diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 index 01b96af4f..97081f11b 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileServiceApp.Tests.ps1 @@ -55,12 +55,12 @@ Describe "xSPUserProfileServiceApp" { Assert-MockCalled New-SPProfileServiceApplication } - $testParams.Add("InstallAccount", (New-Object System.Management.Automation.PSCredential ("domain\username", (ConvertTo-SecureString "password" -AsPlainText -Force)))) - It "creates a new service application in the set method when InstallAccount is used" { + $testParams.Add("InstallAccount", (New-Object System.Management.Automation.PSCredential ("domain\username", (ConvertTo-SecureString "password" -AsPlainText -Force)))) + It "creates a new service application in the set method when InstallAccount is used" { Set-TargetResource @testParams Assert-MockCalled New-SPProfileServiceApplication } - $testParams.Remove("InstallAccount") + $testParams.Remove("InstallAccount") } Context "When service applications exist in the current farm but not the specific user profile service app" { diff --git a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 index a5698e344..e06fbe133 100644 --- a/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPUserProfileSyncService.Tests.ps1 @@ -42,152 +42,152 @@ Describe "xSPUserProfileSyncService" { Mock Test-xSharePointUserIsLocalAdmin { return $false } Mock Remove-xSharePointUserToLocalAdmin { } Mock New-PSSession { return $null } -ModuleName "xSharePoint.Util" - Mock Start-Sleep { } + Mock Start-Sleep { } switch ($majorBuildNumber) { 15 { - Context "User profile sync service is not found locally" { - Mock Get-SPServiceInstance { return $null } + Context "User profile sync service is not found locally" { + Mock Get-SPServiceInstance { return $null } - It "returns absent from the get method" { - $Global:xSharePointUPACheck = $false - (Get-TargetResource @testParams).Ensure | Should Be "Absent" - } - } + It "returns absent from the get method" { + $Global:xSharePointUPACheck = $false + (Get-TargetResource @testParams).Ensure | Should Be "Absent" + } + } Context "User profile sync service is not running and should be" { - Mock Get-SPServiceInstance { if ($Global:xSharePointUPACheck -eq $false) { - $Global:xSharePointUPACheck = $true - return @( @{ - Status = "Disabled" - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") - UserProfileApplicationGuid = [Guid]::Empty - TypeName = "User Profile Synchronization Service" - }) - } else { - return @( @{ - Status = "Online" - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") - UserProfileApplicationGuid = [Guid]::NewGuid() - TypeName = "User Profile Synchronization Service" - }) - } - } - Mock Get-SPServiceApplication { return @( - New-Object Object | - Add-Member NoteProperty ID ([Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f")) -PassThru | - Add-Member NoteProperty TypeName "User Profile Service Application" -PassThru | - Add-Member ScriptMethod SetSynchronizationMachine { - param($computerName, $syncServiceID, $FarmUserName, $FarmPassword) - } -PassThru - )} - - It "returns absent from the get method" { - $Global:xSharePointUPACheck = $false - (Get-TargetResource @testParams).Ensure | Should Be "Absent" - } - - It "returns false from the test method" { - $Global:xSharePointUPACheck = $false - Test-TargetResource @testParams | Should Be $false - } - - It "calls the start service cmdlet from the set method" { - $Global:xSharePointUPACheck = $false - Set-TargetResource @testParams - - Assert-MockCalled Start-SPServiceInstance - } - - Mock Get-SPFarm { return @{ - DefaultServiceAccount = @{ Name = "WRONG\account" } - }} - - It "returns values from the get method where the farm account doesn't match" { - Get-TargetResource @testParams | Should Not BeNullOrEmpty - } - - $Global:xSharePointUPACheck = $false - Mock Get-SPServiceApplication { return $null } - It "throws in the set method if the user profile service app can't be found" { - { Set-TargetResource @testParams } | Should Throw - } - } - - Context "User profile sync service is running and should be" { - Mock Get-SPServiceInstance { return @( @{ - Status = "Online" - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") - UserProfileApplicationGuid = [Guid]::NewGuid() - TypeName = "User Profile Synchronization Service" - }) - } + Mock Get-SPServiceInstance { if ($Global:xSharePointUPACheck -eq $false) { + $Global:xSharePointUPACheck = $true + return @( @{ + Status = "Disabled" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::Empty + TypeName = "User Profile Synchronization Service" + }) + } else { + return @( @{ + Status = "Online" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::NewGuid() + TypeName = "User Profile Synchronization Service" + }) + } + } + Mock Get-SPServiceApplication { return @( + New-Object Object | + Add-Member NoteProperty ID ([Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f")) -PassThru | + Add-Member NoteProperty TypeName "User Profile Service Application" -PassThru | + Add-Member ScriptMethod SetSynchronizationMachine { + param($computerName, $syncServiceID, $FarmUserName, $FarmPassword) + } -PassThru + )} + + It "returns absent from the get method" { + $Global:xSharePointUPACheck = $false + (Get-TargetResource @testParams).Ensure | Should Be "Absent" + } + + It "returns false from the test method" { + $Global:xSharePointUPACheck = $false + Test-TargetResource @testParams | Should Be $false + } + + It "calls the start service cmdlet from the set method" { + $Global:xSharePointUPACheck = $false + Set-TargetResource @testParams + + Assert-MockCalled Start-SPServiceInstance + } + + Mock Get-SPFarm { return @{ + DefaultServiceAccount = @{ Name = "WRONG\account" } + }} + + It "returns values from the get method where the farm account doesn't match" { + Get-TargetResource @testParams | Should Not BeNullOrEmpty + } + + $Global:xSharePointUPACheck = $false + Mock Get-SPServiceApplication { return $null } + It "throws in the set method if the user profile service app can't be found" { + { Set-TargetResource @testParams } | Should Throw + } + } + + Context "User profile sync service is running and should be" { + Mock Get-SPServiceInstance { return @( @{ + Status = "Online" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::NewGuid() + TypeName = "User Profile Synchronization Service" + }) + } - It "returns present from the get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Present" - } - - It "returns true from the test method" { - Test-TargetResource @testParams | Should Be $true - } - } - - $testParams.Ensure = "Absent" - - Context "User profile sync service is running and shouldn't be" { - Mock Get-SPServiceInstance { if ($Global:xSharePointUPACheck -eq $false) { - $Global:xSharePointUPACheck = $true - return @( @{ - Status = "Online" - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") - UserProfileApplicationGuid = [Guid]::NewGuid() - TypeName = "User Profile Synchronization Service" - }) - } else { - return @( @{ - Status = "Disabled" - ID = [Guid]::Empty - UserProfileApplicationGuid = [Guid]::Empty - TypeName = "User Profile Synchronization Service" - }) - } - } - - It "returns present from the get method" { - $Global:xSharePointUPACheck = $false - (Get-TargetResource @testParams).Ensure | Should Be "Present" - } - - It "returns false from the test method" { - $Global:xSharePointUPACheck = $false - Test-TargetResource @testParams | Should Be $false - } - - It "calls the start service cmdlet from the set method" { - $Global:xSharePointUPACheck = $false - Set-TargetResource @testParams - - Assert-MockCalled Stop-SPServiceInstance - } - } - - Context "User profile sync service is not running and shouldn't be" { - Mock Get-SPServiceInstance { return @( @{ - Status = "Disabled" - ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") - UserProfileApplicationGuid = [Guid]::Empty - TypeName = "User Profile Synchronization Service" - }) - } - - It "returns absent from the get method" { - (Get-TargetResource @testParams).Ensure | Should Be "Absent" - } - - It "returns true from the test method" { - Test-TargetResource @testParams | Should Be $true - } - } + It "returns present from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Present" + } + + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true + } + } + + $testParams.Ensure = "Absent" + + Context "User profile sync service is running and shouldn't be" { + Mock Get-SPServiceInstance { if ($Global:xSharePointUPACheck -eq $false) { + $Global:xSharePointUPACheck = $true + return @( @{ + Status = "Online" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::NewGuid() + TypeName = "User Profile Synchronization Service" + }) + } else { + return @( @{ + Status = "Disabled" + ID = [Guid]::Empty + UserProfileApplicationGuid = [Guid]::Empty + TypeName = "User Profile Synchronization Service" + }) + } + } + + It "returns present from the get method" { + $Global:xSharePointUPACheck = $false + (Get-TargetResource @testParams).Ensure | Should Be "Present" + } + + It "returns false from the test method" { + $Global:xSharePointUPACheck = $false + Test-TargetResource @testParams | Should Be $false + } + + It "calls the start service cmdlet from the set method" { + $Global:xSharePointUPACheck = $false + Set-TargetResource @testParams + + Assert-MockCalled Stop-SPServiceInstance + } + } + + Context "User profile sync service is not running and shouldn't be" { + Mock Get-SPServiceInstance { return @( @{ + Status = "Disabled" + ID = [Guid]::Parse("21946987-5163-418f-b781-2beb83aa191f") + UserProfileApplicationGuid = [Guid]::Empty + TypeName = "User Profile Synchronization Service" + }) + } + + It "returns absent from the get method" { + (Get-TargetResource @testParams).Ensure | Should Be "Absent" + } + + It "returns true from the test method" { + Test-TargetResource @testParams | Should Be $true + } + } } 16 { Context "All methods throw exceptions as user profile sync doesn't exist in 2016" { diff --git a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 index 36f5c0548..9bcb0d0bf 100644 --- a/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPWebApplication.Tests.ps1 @@ -50,23 +50,23 @@ Describe "xSPWebApplication" { Assert-MockCalled New-SPAuthenticationProvider -ParameterFilter { $DisableKerberos -eq $true } } - $testParams.Add("InstallAccount", (New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)))) - It "calls the new cmdlet from the set method where InstallAccount is used" { + $testParams.Add("InstallAccount", (New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)))) + It "calls the new cmdlet from the set method where InstallAccount is used" { Set-TargetResource @testParams Assert-MockCalled New-SPWebApplication Assert-MockCalled New-SPAuthenticationProvider -ParameterFilter { $DisableKerberos -eq $true } } - $testParams.Remove("InstallAccount") + $testParams.Remove("InstallAccount") - $testParams.Add("AllowAnonymous", $true) - It "calls the new cmdlet from the set where anonymous authentication is requested" { + $testParams.Add("AllowAnonymous", $true) + It "calls the new cmdlet from the set where anonymous authentication is requested" { Set-TargetResource @testParams Assert-MockCalled New-SPWebApplication Assert-MockCalled New-SPAuthenticationProvider -ParameterFilter { $DisableKerberos -eq $true } } - $testParams.Remove("AllowAnonymous") + $testParams.Remove("AllowAnonymous") } $testParams.AuthenticationMethod = "Kerberos" @@ -89,7 +89,7 @@ Describe "xSPWebApplication" { } } - $testParams.AuthenticationMethod = "NTLM" + $testParams.AuthenticationMethod = "NTLM" Context "The web appliation does exist and should that uses NTLM" { Mock Get-SPAuthenticationProvider { return @{ DisableKerberos = $true; AllowAnonymous = $false } } @@ -120,9 +120,9 @@ Describe "xSPWebApplication" { } } - $testParams.AuthenticationMethod = "Kerberos" + $testParams.AuthenticationMethod = "Kerberos" - Context "The web appliation does exist and should that uses Kerberos" { + Context "The web appliation does exist and should that uses Kerberos" { Mock Get-SPAuthenticationProvider { return @{ DisableKerberos = $false; AllowAnonymous = $false } } Mock Get-SPWebApplication { return @(@{ DisplayName = $testParams.Name From a17ff915a5621a75d165ceca2c443312a85a0f7e Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 1 Oct 2015 10:15:52 +1000 Subject: [PATCH 138/146] Refactored tests for cache accounts and util --- .../MSFT_xSPCacheAccounts.psm1 | 12 +- .../xSharePoint.CacheAccounts.psm1 | 35 ----- .../xSharePoint.Util/xSharePoint.Util.psm1 | 131 ++++++------------ Modules/xSharePoint/xSharePoint.psd1 | 6 +- Modules/xSharePoint/xSharePoint.pssproj | 2 - Tests/xSharePoint/xSharePoint.Util.Tests.ps1 | 29 ++++ .../xSharePoint.xSPCacheAccounts.Tests.ps1 | 106 ++++++++++---- 7 files changed, 165 insertions(+), 156 deletions(-) delete mode 100644 Modules/xSharePoint/Modules/xSharePoint.CacheAccounts/xSharePoint.CacheAccounts.psm1 diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 index 364ef1cc6..b96cd2072 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 @@ -54,7 +54,6 @@ function Set-TargetResource $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] - $wa = Get-SPWebApplication -Identity $params.WebAppUrl -ErrorAction SilentlyContinue if ($null -eq $wa) { @@ -72,10 +71,15 @@ function Set-TargetResource $wa.Properties.Add("portalsuperreaderaccount", $params.SuperReaderAlias) } - Set-xSharePointCacheReaderPolicy -WebApplication $wa -UserName $params.SuperReaderAlias - Set-xSharePointCacheOwnerPolicy -WebApplication $wa -UserName $params.SuperUserAlias + $readPolicy = $wa.Policies.Add($params.SuperReaderAlias, $params.SuperReaderAlias) + $readPolicyRole = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullRead) + $readPolicy.PolicyRoleBindings.Add($readPolicyRole) - Update-xSharePointObject -InputObject $wa + $policy = $wa.Policies.Add($params.SuperUserAlias, $params.SuperUserAlias) + $policyRole = $wa.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullControl) + $policy.PolicyRoleBindings.Add($policyRole) + + $wa.Update() } } diff --git a/Modules/xSharePoint/Modules/xSharePoint.CacheAccounts/xSharePoint.CacheAccounts.psm1 b/Modules/xSharePoint/Modules/xSharePoint.CacheAccounts/xSharePoint.CacheAccounts.psm1 deleted file mode 100644 index a97057976..000000000 --- a/Modules/xSharePoint/Modules/xSharePoint.CacheAccounts/xSharePoint.CacheAccounts.psm1 +++ /dev/null @@ -1,35 +0,0 @@ -function Set-xSharePointCacheReaderPolicy() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - $WebApplication, - - [parameter(Mandatory = $true,Position=2)] - [string] - $UserName - ) - $VerbosePreference = "Continue" - - $policy = $WebApplication.Policies.Add($UserName, $UserName) - $policyRole = $WebApplication.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullRead) - $policy.PolicyRoleBindings.Add($policyRole) -} - -function Set-xSharePointCacheOwnerPolicy() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - $WebApplication, - - [parameter(Mandatory = $true,Position=2)] - [string] - $UserName - ) - $policy = $WebApplication.Policies.Add($UserName, $UserName) - $policyRole = $WebApplication.PolicyRoles.GetSpecialRole([Microsoft.SharePoint.Administration.SPPolicyRoleType]::FullControl) - $policy.PolicyRoleBindings.Add($policyRole) -} - -Export-ModuleMember -Function * \ No newline at end of file diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 592288615..3bcd9be0b 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -1,19 +1,41 @@ -function Invoke-xSharePointCommand() { +function Add-xSharePointUserToLocalAdmin() { [CmdletBinding()] param ( - [parameter(Mandatory = $false)] - [System.Management.Automation.PSCredential] - $Credential, + [parameter(Mandatory = $true,Position=1)] [string] $UserName + ) - [parameter(Mandatory = $false)] - [HashTable] - $Arguments, + $domainName = $UserName.Split('\')[0] + $accountName = $UserName.Split('\')[1] + Write-Verbose -Message "Adding $domainName\$userName to local admin group" + ([ADSI]"WinNT://$($env:computername)/Administrators,group").Add("WinNT://$domainName/$accountName") | Out-Null +} - [parameter(Mandatory = $true)] - [ScriptBlock] - $ScriptBlock +function Get-xSharePointAssemblyVersion() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + [string] + $PathToAssembly + ) + return (Get-Command $PathToAssembly).FileVersionInfo.FileMajorPart +} + +function Get-xSharePointInstalledProductVersion() { + $pathToSearch = "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\*\ISAPI\Microsoft.SharePoint.dll" + $fullPath = Get-Item $pathToSearch | Sort-Object { $_.Directory } -Descending | Select-Object -First 1 + return (Get-Command $fullPath).FileVersionInfo +} + +function Invoke-xSharePointCommand() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $Credential, + [parameter(Mandatory = $false)] [HashTable] $Arguments, + [parameter(Mandatory = $true)] [ScriptBlock] $ScriptBlock ) $VerbosePreference = 'Continue' @@ -61,14 +83,9 @@ function Rename-xSharePointParamValue() { [CmdletBinding()] param ( - [parameter(Mandatory = $true,Position=1,ValueFromPipeline=$true)] - $params, - - [parameter(Mandatory = $true,Position=2)] - $oldName, - - [parameter(Mandatory = $true,Position=3)] - $newName + [parameter(Mandatory = $true,Position=1,ValueFromPipeline=$true)] $params, + [parameter(Mandatory = $true,Position=2)] $oldName, + [parameter(Mandatory = $true,Position=3)] $newName ) if ($params.ContainsKey($oldName)) { @@ -78,49 +95,27 @@ function Rename-xSharePointParamValue() { return $params } -function Get-xSharePointInstalledProductVersion() { - $pathToSearch = "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\*\ISAPI\Microsoft.SharePoint.dll" - $fullPath = Get-Item $pathToSearch | Sort-Object { $_.Directory } -Descending | Select-Object -First 1 - return (Get-Command $fullPath).FileVersionInfo -} - -function Get-xSharePointAssemblyVersion() { +function Remove-xSharePointUserToLocalAdmin() { [CmdletBinding()] param ( - [parameter(Mandatory = $true,Position=1)] - [string] - $PathToAssembly + [parameter(Mandatory = $true,Position=1)] [string] $UserName ) - return (Get-Command $PathToAssembly).FileVersionInfo.FileMajorPart -} -function Update-xSharePointObject() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - [object] - $InputObject - ) - $InputObject.Update() + $domainName = $UserName.Split('\')[0] + $accountName = $UserName.Split('\')[1] + + Write-Verbose -Message "Removing $domainName\$userName from local admin group" + ([ADSI]"WinNT://$($env:computername)/Administrators,group").Remove("WinNT://$domainName/$accountName") | Out-Null } function Test-xSharePointSpecificParameters() { [CmdletBinding()] param ( - [parameter(Mandatory = $true,Position=1)] - [HashTable] - $CurrentValues, - - [parameter(Mandatory = $true,Position=2)] - [HashTable] - $DesiredValues, - - [parameter(Mandatory = $false,Position=3)] - [Array] - $ValuesToCheck + [parameter(Mandatory = $true,Position=1)] [HashTable] $CurrentValues, + [parameter(Mandatory = $true,Position=2)] [HashTable] $DesiredValues, + [parameter(Mandatory = $false,Position=3)] [Array] $ValuesToCheck ) $returnValue = $true @@ -164,9 +159,7 @@ function Test-xSharePointUserIsLocalAdmin() { [CmdletBinding()] param ( - [parameter(Mandatory = $true,Position=1)] - [string] - $UserName + [parameter(Mandatory = $true,Position=1)] [string] $UserName ) $domainName = $UserName.Split('\')[0] @@ -177,36 +170,4 @@ function Test-xSharePointUserIsLocalAdmin() { Where-Object { $_ -eq $accountName } } -function Add-xSharePointUserToLocalAdmin() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - [string] - $UserName - ) - - $domainName = $UserName.Split('\')[0] - $accountName = $UserName.Split('\')[1] - - Write-Verbose -Message "Adding $domainName\$userName to local admin group" - ([ADSI]"WinNT://$($env:computername)/Administrators,group").Add("WinNT://$domainName/$accountName") | Out-Null -} - -function Remove-xSharePointUserToLocalAdmin() { - [CmdletBinding()] - param - ( - [parameter(Mandatory = $true,Position=1)] - [string] - $UserName - ) - - $domainName = $UserName.Split('\')[0] - $accountName = $UserName.Split('\')[1] - - Write-Verbose -Message "Removing $domainName\$userName from local admin group" - ([ADSI]"WinNT://$($env:computername)/Administrators,group").Remove("WinNT://$domainName/$accountName") | Out-Null -} - Export-ModuleMember -Function * diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1 index dc07ab2d1..7d7cf4054 100644 --- a/Modules/xSharePoint/xSharePoint.psd1 +++ b/Modules/xSharePoint/xSharePoint.psd1 @@ -63,8 +63,7 @@ Description = 'This DSC module is used to deploy and configure SharePoint Server # FormatsToProcess = @() # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -NestedModules = @("modules\xSharePoint.CacheAccounts\xSharePoint.CacheAccounts.psm1", - "modules\xSharePoint.Util\xSharePoint.Util.psm1") +NestedModules = @("modules\xSharePoint.Util\xSharePoint.Util.psm1") # Functions to export from this module FunctionsToExport = '*' @@ -73,9 +72,6 @@ FunctionsToExport = '*' CmdletsToExport = @("Invoke-xSharePointCommand", "Get-xSharePointInstalledProductVersion", "Rename-xSharePointParamValue", - "Update-xSharePointObject", - "Set-xSharePointCacheReaderPolicy", - "Set-xSharePointCacheOwnerPolicy", "Add-xSharePointUserToLocalAdmin", "Remove-xSharePointUserToLocalAdmin", "Test-xSharePointUserIsLocalAdmin", diff --git a/Modules/xSharePoint/xSharePoint.pssproj b/Modules/xSharePoint/xSharePoint.pssproj index fc4bcb504..dd7740cee 100644 --- a/Modules/xSharePoint/xSharePoint.pssproj +++ b/Modules/xSharePoint/xSharePoint.pssproj @@ -75,7 +75,6 @@ - @@ -124,7 +123,6 @@ - diff --git a/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 b/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 index ac91c7392..0dcfc8c62 100644 --- a/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 @@ -12,6 +12,35 @@ $ModuleName = "xSharePoint.Util" Import-Module (Join-Path $RepoRoot "Modules\xSharePoint") Describe "xSharePoint.Util" { + Context "Validate Get-xSharePointAssemblyVersion" { + It "returns the version number of a given executable" { + Get-xSharePointAssemblyVersion -PathToAssembly "C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe" | Should Not Be 0 + } + } + + Context "Validate Invoke-xSharePointCommand" { + Mock Invoke-Command { return $null } -ModuleName "xSharePoint.Util" + Mock New-PSSession { return $null } -ModuleName "xSharePoint.Util" + Mock Get-PSSnapin { return $null } -ModuleName "xSharePoint.Util" + Mock Add-PSSnapin { return $null } -ModuleName "xSharePoint.Util" + + It "executes a command as the local run as user" { + Invoke-xSharePointCommand -ScriptBlock { return "value" } + } + + It "executes a command as the local run as user with additional arguments" { + Invoke-xSharePointCommand -ScriptBlock { return "value" } -Arguments @{ Something = "42" } + } + + It "executes a command as the specified InstallAccount user where it is different to the current user" { + Invoke-xSharePointCommand -ScriptBlock { return "value" } -Credential (New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force))) + } + + It "throws an exception when the run as user is the same as the InstallAccount user" { + { Invoke-xSharePointCommand -ScriptBlock { return "value" } -Credential (New-Object System.Management.Automation.PSCredential ("$($Env:USERDOMAIN)\$($Env:USERNAME)", (ConvertTo-SecureString "password" -AsPlainText -Force)))} | Should Throw + } + } + Context "Validate Test-xSharePointSpecificParameters" { It "Returns true for two identical tables" { $desired = @{ Example = "test" } diff --git a/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 index 7dff5d9a1..2acd07423 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCacheAccounts.Tests.ps1 @@ -24,12 +24,18 @@ Describe "xSPCacheAccounts" { Mock Invoke-xSharePointCommand { return Invoke-Command -ScriptBlock $ScriptBlock -ArgumentList $Arguments -NoNewScope } + + try { [Microsoft.SharePoint.Administration.SPThingType] } + catch { + Add-Type @" +namespace Microsoft.SharePoint.Administration { + public enum SPPolicyRoleType { FullRead, FullControl }; +} +"@ + } Import-Module $Global:CurrentSharePointStubModule -WarningAction SilentlyContinue - Mock Set-xSharePointCacheReaderPolicy {} - Mock Set-xSharePointCacheOwnerPolicy {} - Mock Update-xSharePointObject {} - + Context "The web application specified does not exist" { Mock Get-SPWebApplication { return $null } @@ -47,9 +53,23 @@ Describe "xSPCacheAccounts" { } Context "The specified cache accounts have not been configured" { - Mock Get-SPWebApplication { return @{ - Properties = @{ } - }} + Mock Get-SPWebApplication { return New-Object Object | + Add-Member NoteProperty Properties @{} -PassThru | + Add-Member NoteProperty Policies ( + New-Object Object | + Add-Member ScriptMethod Add { return New-Object Object | + Add-Member NoteProperty PolicyRoleBindings ( + New-Object Object | + Add-Member ScriptMethod Add {} -PassThru + ) -PassThru + } -PassThru + ) -PassThru | + Add-Member NoteProperty PolicyRoles ( + New-Object Object | + Add-Member ScriptMethod GetSpecialRole { return @{} } -PassThru + ) -PassThru | + Add-Member ScriptMethod Update {} -PassThru + } It "returns empty strings from the Get method" { $results = Get-TargetResource @testParams @@ -63,20 +83,30 @@ Describe "xSPCacheAccounts" { It "Updates the accounts when set is called" { Set-TargetResource @testParams - - Assert-MockCalled Set-xSharePointCacheReaderPolicy - Assert-MockCalled Set-xSharePointCacheOwnerPolicy - Assert-MockCalled Update-xSharePointObject } } Context "The cache accounts have been configured correctly" { - Mock Get-SPWebApplication { return @{ - Properties = @{ + Mock Get-SPWebApplication { return New-Object Object | + Add-Member NoteProperty Properties @{ portalsuperuseraccount = $testParams.SuperUserAlias portalsuperreaderaccount = $testParams.SuperReaderAlias - } - }} + } -PassThru | + Add-Member NoteProperty Policies ( + New-Object Object | + Add-Member ScriptMethod Add { return New-Object Object | + Add-Member NoteProperty PolicyRoleBindings ( + New-Object Object | + Add-Member ScriptMethod Add {} -PassThru + ) -PassThru + } -PassThru + ) -PassThru | + Add-Member NoteProperty PolicyRoles ( + New-Object Object | + Add-Member ScriptMethod GetSpecialRole { return @{} } -PassThru + ) -PassThru | + Add-Member ScriptMethod Update {} -PassThru + } It "returns the values from the get method" { $results = Get-TargetResource @testParams @@ -90,12 +120,26 @@ Describe "xSPCacheAccounts" { } Context "Cache accounts have been configured, but the reader account is wrong" { - Mock Get-SPWebApplication { return @{ - Properties = @{ + Mock Get-SPWebApplication { return New-Object Object | + Add-Member NoteProperty Properties @{ portalsuperuseraccount = $testParams.SuperUserAlias portalsuperreaderaccount = "WRONG\AccountName" - } - }} + } -PassThru | + Add-Member NoteProperty Policies ( + New-Object Object | + Add-Member ScriptMethod Add { return New-Object Object | + Add-Member NoteProperty PolicyRoleBindings ( + New-Object Object | + Add-Member ScriptMethod Add {} -PassThru + ) -PassThru + } -PassThru + ) -PassThru | + Add-Member NoteProperty PolicyRoles ( + New-Object Object | + Add-Member ScriptMethod GetSpecialRole { return @{} } -PassThru + ) -PassThru | + Add-Member ScriptMethod Update {} -PassThru + } It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false @@ -103,17 +147,30 @@ Describe "xSPCacheAccounts" { It "sets the correct accounts to the web app again" { Set-TargetResource @testParams - Assert-MockCalled Update-xSharePointObject } } Context "Cache accounts have been configured, but the super account is wrong" { - Mock Get-SPWebApplication { return @{ - Properties = @{ + Mock Get-SPWebApplication { return New-Object Object | + Add-Member NoteProperty Properties @{ portalsuperuseraccount = "WRONG\AccountName" portalsuperreaderaccount = $testParams.SuperReaderAlias - } - }} + } -PassThru | + Add-Member NoteProperty Policies ( + New-Object Object | + Add-Member ScriptMethod Add { return New-Object Object | + Add-Member NoteProperty PolicyRoleBindings ( + New-Object Object | + Add-Member ScriptMethod Add {} -PassThru + ) -PassThru + } -PassThru + ) -PassThru | + Add-Member NoteProperty PolicyRoles ( + New-Object Object | + Add-Member ScriptMethod GetSpecialRole { return @{} } -PassThru + ) -PassThru | + Add-Member ScriptMethod Update {} -PassThru + } It "returns false from the test method" { Test-TargetResource @testParams | Should Be $false @@ -121,7 +178,6 @@ Describe "xSPCacheAccounts" { It "sets the correct accounts to the web app again" { Set-TargetResource @testParams - Assert-MockCalled Update-xSharePointObject } } } From f2b460ad718e53831ae54ea583aff4f3517533c7 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 1 Oct 2015 10:18:59 +1000 Subject: [PATCH 139/146] Updated for 0.7 --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 815c14934..8ba0bfcb2 100644 --- a/README.md +++ b/README.md @@ -68,10 +68,13 @@ Additional detailed documentation is included on the wiki on GitHub. ## Version History +### 0.7.0.0 + + * Bug fixes and stability improvements + ### 0.6.0.0 * Added support for PsDscRunAsCredential in PowerShell 5 resource use - * Expanded automated unit testing * Removed timeout loop in xSPJoinFarm in favour of WaitForAll resource in PowerShell 5 ### 0.5.0.0 From 2b417f6f7b206c941dbb138e9fa9e8353ec23518 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 2 Oct 2015 09:47:50 +1000 Subject: [PATCH 140/146] Fix to placement of get call in set method --- .../MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 index 30da5d478..68df6b5b6 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 @@ -54,16 +54,12 @@ function Set-TargetResource Write-Verbose -Message "Creating the managed path $RelativeUrl in $WebAppUrl" - Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { - $params = $args[0] - - - $path = Get-TargetResource @params -ErrorAction SilentlyContinue + $path = Get-TargetResource @PSBoundParameters - if ($params.ContainsKey("InstallAccount")) { $params.Remove("InstallAccount") | Out-Null } + if ($null -eq $path) { + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + $params = $args[0] - if ($null -eq $path) { - $newParams = @{} if ($params.HostHeader) { $newParams.Add("HostHeader", $params.HostHeader) From ece7a801a6b43401974bddbc13a012f4b824ebbf Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 2 Oct 2015 10:23:22 +1000 Subject: [PATCH 141/146] Added formatting test to username parameters --- .../Modules/xSharePoint.Util/xSharePoint.Util.psm1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 3bcd9be0b..7b5b5c388 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -5,6 +5,10 @@ function Add-xSharePointUserToLocalAdmin() { [parameter(Mandatory = $true,Position=1)] [string] $UserName ) + if ($UserName.Contains("\") -eq $false) { + throw [Exception] "Usernames should be formatted as domain\username" + } + $domainName = $UserName.Split('\')[0] $accountName = $UserName.Split('\')[1] @@ -102,6 +106,10 @@ function Remove-xSharePointUserToLocalAdmin() { [parameter(Mandatory = $true,Position=1)] [string] $UserName ) + if ($UserName.Contains("\") -eq $false) { + throw [Exception] "Usernames should be formatted as domain\username" + } + $domainName = $UserName.Split('\')[0] $accountName = $UserName.Split('\')[1] @@ -162,6 +170,10 @@ function Test-xSharePointUserIsLocalAdmin() { [parameter(Mandatory = $true,Position=1)] [string] $UserName ) + if ($UserName.Contains("\") -eq $false) { + throw [Exception] "Usernames should be formatted as domain\username" + } + $domainName = $UserName.Split('\')[0] $accountName = $UserName.Split('\')[1] From abfde41079d8188dd3d30f5203a43cba6e609df3 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 2 Oct 2015 23:35:09 +1000 Subject: [PATCH 142/146] Added full MinRole support, error trapping for conflicts in primary invoker --- .../MSFT_xSPCreateFarm.psm1 | 30 ++++++++++++++--- .../MSFT_xSPCreateFarm.schema.mof | 1 + .../xSharePoint.Util/xSharePoint.Util.psm1 | 23 +++++++++++-- Tests/xSharePoint/xSharePoint.Util.Tests.ps1 | 24 ++++++++++++++ .../xSharePoint.xSPCreateFarm.Tests.ps1 | 33 +++++++++++++++++-- 5 files changed, 102 insertions(+), 9 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 index 61983d91b..af9b56d41 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 @@ -10,11 +10,16 @@ function Get-TargetResource [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, [parameter(Mandatory = $true)] [System.String] $Passphrase, [parameter(Mandatory = $true)] [System.String] $AdminContentDatabaseName, - [parameter(Mandatory = $false)] [System.UInt32] $CentralAdministrationPort + [parameter(Mandatory = $false)] [System.UInt32] $CentralAdministrationPort, + [parameter(Mandatory = $false)] [ValidateSet("Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd")] $ServerRole ) Write-Verbose -Message "Checking for local SP Farm" + if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { + throw [Exception] "Server role is only supported in SharePoint 2016." + } + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] @@ -60,9 +65,14 @@ function Set-TargetResource [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, [parameter(Mandatory = $true)] [System.String] $Passphrase, [parameter(Mandatory = $true)] [System.String] $AdminContentDatabaseName, - [parameter(Mandatory = $false)] [System.UInt32] $CentralAdministrationPort + [parameter(Mandatory = $false)] [System.UInt32] $CentralAdministrationPort, + [parameter(Mandatory = $false)] [ValidateSet("Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd")] $ServerRole ) + if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { + throw [Exception] "Server role is only supported in SharePoint 2016." + } + if (-not $PSBoundParameters.ContainsKey("CentralAdministrationPort")) { $PSBoundParameters.Add("CentralAdministrationPort", 9999) } $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { @@ -82,8 +92,13 @@ function Set-TargetResource Write-Verbose -Message "Detected Version: SharePoint 2013" } 16 { - Write-Verbose -Message "Detected Version: SharePoint 2016" - $newFarmArgs.Add("LocalServerRole", "Custom") + if ($params.ContainsKey("ServerRole") -eq $true) { + Write-Verbose -Message "Detected Version: SharePoint 2016 - configuring server as $($params.ServerRole)" + $newFarmArgs.Add("LocalServerRole", $params.ServerRole) + } else { + Write-Verbose -Message "Detected Version: SharePoint 2016 - no server role provided, configuring server without a specific role" + $newFarmArgs.Add("ServerRoleOptional", $true) + } } Default { throw [Exception] "An unknown version of SharePoint (Major version $_) was detected. Only versions 15 (SharePoint 2013) or 16 (SharePoint 2016) are supported." @@ -112,9 +127,14 @@ function Test-TargetResource [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, [parameter(Mandatory = $true)] [System.String] $Passphrase, [parameter(Mandatory = $true)] [System.String] $AdminContentDatabaseName, - [parameter(Mandatory = $false)] [System.UInt32] $CentralAdministrationPort + [parameter(Mandatory = $false)] [System.UInt32] $CentralAdministrationPort, + [parameter(Mandatory = $false)] [ValidateSet("Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd")] $ServerRole ) + if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { + throw [Exception] "Server role is only supported in SharePoint 2016." + } + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose "Checking for local farm presence" if ($null -eq $CurrentValues) { return $false } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof index 7d3767e44..3c51d885e 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof @@ -9,4 +9,5 @@ class MSFT_xSPCreateFarm : OMI_BaseResource [Required] String Passphrase; [Required] String AdminContentDatabaseName; [Write] uint32 CentralAdministrationPort; + [Write, ValueMap{"Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd"}, Values{"Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd"}] string ServerRole; }; diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 7b5b5c388..fa7b44dc9 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -58,7 +58,17 @@ function Invoke-xSharePointCommand() { } Write-Verbose "Executing as the local run as user $($Env:USERDOMAIN)\$($Env:USERNAME)" - $result = Invoke-Command @invokeArgs -Verbose + try { + $result = Invoke-Command @invokeArgs -Verbose + } catch { + if ($_.Exception.Message.Contains("An update conflict has occurred, and you must re-try this action")) { + Write-Verbose "Detected an update conflict, restarting server to allow DSC to resume and retry" + $global:DSCMachineStatus = 1 + } else { + throw $_ + } + } + return $result } else { if ($Credential.UserName.Split("\")[1] -eq $Env:USERNAME) { @@ -76,7 +86,16 @@ function Invoke-xSharePointCommand() { if ($session) { $invokeArgs.Add("Session", $session) } - $result = Invoke-Command @invokeArgs -Verbose + try { + $result = Invoke-Command @invokeArgs -Verbose + } catch { + if ($_.Exception.Message.Contains("An update conflict has occurred, and you must re-try this action")) { + Write-Verbose "Detected an update conflict, restarting server to allow DSC to resume and retry" + $global:DSCMachineStatus = 1 + } else { + throw $_ + } + } if ($session) { Remove-PSSession $session } return $result diff --git a/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 b/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 index 0dcfc8c62..93b0e3329 100644 --- a/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.Util.Tests.ps1 @@ -39,6 +39,30 @@ Describe "xSharePoint.Util" { It "throws an exception when the run as user is the same as the InstallAccount user" { { Invoke-xSharePointCommand -ScriptBlock { return "value" } -Credential (New-Object System.Management.Automation.PSCredential ("$($Env:USERDOMAIN)\$($Env:USERNAME)", (ConvertTo-SecureString "password" -AsPlainText -Force)))} | Should Throw } + + It "throws normal exceptions when triggered in the script block" { + Mock Invoke-Command { throw [Exception] "A random exception" } -ModuleName "xSharePoint.Util" + + { Invoke-xSharePointCommand -ScriptBlock { return "value" } } | Should Throw + } + + It "throws normal exceptions when triggered in the script block using InstallAccount" { + Mock Invoke-Command { throw [Exception] "A random exception" } -ModuleName "xSharePoint.Util" + + { Invoke-xSharePointCommand -ScriptBlock { return "value" } -Credential (New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)))} | Should Throw + } + + It "handles a SharePoint update conflict exception by rebooting the server to retry" { + Mock Invoke-Command { throw [Exception] "An update conflict has occurred, and you must re-try this action." } -ModuleName "xSharePoint.Util" + + { Invoke-xSharePointCommand -ScriptBlock { return "value" } } | Should Not Throw + } + + It "handles a SharePoint update conflict exception by rebooting the server to retry using InstallAccount" { + Mock Invoke-Command { throw [Exception] "An update conflict has occurred, and you must re-try this action." } -ModuleName "xSharePoint.Util" + + { Invoke-xSharePointCommand -ScriptBlock { return "value" } -Credential (New-Object System.Management.Automation.PSCredential ("username", (ConvertTo-SecureString "password" -AsPlainText -Force)))} | Should Not Throw + } } Context "Validate Test-xSharePointSpecificParameters" { diff --git a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 index a897949bc..327757c9a 100644 --- a/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPCreateFarm.Tests.ps1 @@ -52,7 +52,7 @@ Describe "xSPCreateFarm" { Test-TargetResource @testParams | Should Be $false } - It "calls the appropriate cmdlets in the set method" { + It "calls the new configuration database cmdlet in the set method" { Set-TargetResource @testParams switch ($majorBuildNumber) { @@ -60,7 +60,7 @@ Describe "xSPCreateFarm" { Assert-MockCalled New-SPConfigurationDatabase } 16 { - Assert-MockCalled New-SPConfigurationDatabase -ParameterFilter { $LocalServerRole -ne $null } + Assert-MockCalled New-SPConfigurationDatabase -ParameterFilter { $ServerRoleOptional -eq $true } } Default { throw [Exception] "A supported version of SharePoint was not used in testing" @@ -68,6 +68,35 @@ Describe "xSPCreateFarm" { } } + + if ($majorBuildNumber -eq 16) { + $testParams.Add("ServerRole", "WebFrontEnd") + It "creates a farm with a specific server role" { + Set-TargetResource @testParams + Assert-MockCalled New-SPConfigurationDatabase -ParameterFilter { $LocalServerRole -eq "WebFrontEnd" } + } + $testParams.Remove("ServerRole") + } + } + + if ($majorBuildNumber -eq 15) { + $testParams.Add("ServerRole", "WebFrontEnd") + + Context "only valid parameters for SharePoint 2013 are used" { + It "throws if server role is used in the get method" { + { Get-TargetResource @testParams } | Should Throw + } + + It "throws if server role is used in the test method" { + { Test-TargetResource @testParams } | Should Throw + } + + It "throws if server role is used in the set method" { + { Set-TargetResource @testParams } | Should Throw + } + } + + $testParams.Remove("ServerRole") } Context "no farm is configured locally and an unsupported version of SharePoint is installed on the server" { From a5ce00c7848183911a8c03837ffc7543fc33f3e9 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sat, 3 Oct 2015 21:24:45 +1000 Subject: [PATCH 143/146] Fixes for distributed cache timeout issues --- .../MSFT_xSPDistributedCacheService.psm1 | 46 +++++++++++-------- ...Point.xSPDistributedCacheService.Tests.ps1 | 1 + 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 index f8a2dd321..c18bac757 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 @@ -29,7 +29,7 @@ function Get-TargetResource if ($null -eq $cacheHost) { return $nullReturnValue } $computerName = ([System.Net.Dns]::GetHostByName($env:computerName)).HostName - $cacheHostConfig = Get-AFCacheHostConfiguration -ComputerName $computerName -CachePort $cacheHost.PortNo -ErrorAction SilentlyContinue + $cacheHostConfig = Get-AFCacheHostConfiguration -ComputerName $computerName -CachePort ($cacheHost | Where-Object { $_.HostName -eq $computerName }).PortNo -ErrorAction SilentlyContinue $windowsService = Get-WmiObject "win32_service" -Filter "Name='AppFabricCachingService'" $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distributed Cache" -ErrorAction SilentlyContinue @@ -65,13 +65,6 @@ function Set-TargetResource ) $CurrentState = Get-TargetResource @PSBoundParameters - - $isLocalAdmin = Test-xSharePointUserIsLocalAdmin -UserName $ServiceAccount - - if (!$isLocalAdmin) - { - Add-xSharePointUserToLocalAdmin -UserName $ServiceAccount - } if ($Ensure -eq "Present") { Write-Verbose -Message "Adding the distributed cache to the server" @@ -99,16 +92,37 @@ function Set-TargetResource $params = $args[0] Add-SPDistributedCacheServiceInstance + + Get-SPServiceInstance | Where-Object { $_.TypeName -eq "Distributed Cache" } | Stop-SPServiceInstance -Confirm:$false + + $count = 0 + $maxCount = 30 + while (($count -lt $maxCount) -and ((Get-SPServiceInstance | ? { $_.TypeName -eq "Distributed Cache" -and $_.Status -ne "Disabled" }) -ne $null)) { + Start-Sleep -Seconds 60 + $count++ + } + Update-SPDistributedCacheSize -CacheSizeInMB $params.CacheSizeInMB + Get-SPServiceInstance | Where-Object { $_.TypeName -eq "Distributed Cache" } | Start-SPServiceInstance + + $count = 0 + $maxCount = 30 + while (($count -lt $maxCount) -and ((Get-SPServiceInstance | ? { $_.TypeName -eq "Distributed Cache" -and $_.Status -ne "Online" }) -ne $null)) { + Start-Sleep -Seconds 60 + $count++ + } + $farm = Get-SPFarm $cacheService = $farm.Services | Where-Object { $_.Name -eq "AppFabricCachingService" } - $cacheService.ProcessIdentity.CurrentIdentityType = "SpecificUser" - $account = Get-SPManagedAccount -Identity $params.ServiceAccount - $cacheService.ProcessIdentity.ManagedAccount = $account - $cacheService.ProcessIdentity.Update() - $cacheService.ProcessIdentity.Deploy() + if ($cacheService.ProcessIdentity.ManagedAccount.Username -ne $params.ServiceAccount) { + $cacheService.ProcessIdentity.CurrentIdentityType = "SpecificUser" + $account = Get-SPManagedAccount -Identity $params.ServiceAccount + $cacheService.ProcessIdentity.ManagedAccount = $account + $cacheService.ProcessIdentity.Update() + $cacheService.ProcessIdentity.Deploy() + } } } } else { @@ -130,12 +144,6 @@ function Set-TargetResource } Write-Verbose -Message "Distributed cache removed." } - - # Remove the FarmAccount from the local Administrators group, if it was added above - if (!$isLocalAdmin) - { - Remove-xSharePointUserToLocalAdmin -UserName $ServiceAccount - } } function Test-TargetResource diff --git a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 index 5b39ed05f..668ee24db 100644 --- a/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 +++ b/Tests/xSharePoint/xSharePoint.xSPDistributedCacheService.Tests.ps1 @@ -43,6 +43,7 @@ Describe "xSPDistributedCacheService" { Mock Add-xSharePointUserToLocalAdmin { } Mock Test-xSharePointUserIsLocalAdmin { return $false } Mock Remove-xSharePointUserToLocalAdmin { } + Mock Restart-Service { } Mock Get-SPFarm { return @{ Services = @(@{ Name = "AppFabricCachingService" From f9d910a06c5d7bbea892b6e6315153ca03f2f7ed Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 6 Oct 2015 13:47:48 +1100 Subject: [PATCH 144/146] Added MinRole to join farm command, updated readme --- .../MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 | 23 +++++++++++++++---- .../MSFT_xSPJoinFarm.schema.mof | 1 + README.md | 4 +++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 index 15007c946..4006ca092 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 @@ -7,11 +7,16 @@ function Get-TargetResource [parameter(Mandatory = $true)] [System.String] $FarmConfigDatabaseName, [parameter(Mandatory = $true)] [System.String] $DatabaseServer, [parameter(Mandatory = $true)] [System.String] $Passphrase, - [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $false)] [ValidateSet("Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd")] $ServerRole ) Write-Verbose -Message "Checking for local SP Farm" + if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { + throw [Exception] "Server role is only supported in SharePoint 2016." + } + $result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] @@ -45,11 +50,16 @@ function Set-TargetResource [parameter(Mandatory = $true)] [System.String] $FarmConfigDatabaseName, [parameter(Mandatory = $true)] [System.String] $DatabaseServer, [parameter(Mandatory = $true)] [System.String] $Passphrase, - [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $false)] [ValidateSet("Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd")] $ServerRole ) Write-Verbose -Message "Joining existing farm configuration database" + if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { + throw [Exception] "Server role is only supported in SharePoint 2016." + } + Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] @@ -102,11 +112,16 @@ function Test-TargetResource [parameter(Mandatory = $true)] [System.String] $FarmConfigDatabaseName, [parameter(Mandatory = $true)] [System.String] $DatabaseServer, [parameter(Mandatory = $true)] [System.String] $Passphrase, - [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount + [parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount, + [parameter(Mandatory = $false)] [ValidateSet("Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd")] $ServerRole ) + if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { + throw [Exception] "Server role is only supported in SharePoint 2016." + } + $CurrentValues = Get-TargetResource @PSBoundParameters - Write-Verbose "Checking for local farm presence" + Write-Verbose "Testing for local farm presence" return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters -ValuesToCheck @("FarmConfigDatabaseName") } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof index da712b9ea..fbb84c6aa 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof @@ -5,5 +5,6 @@ class MSFT_xSPJoinFarm : OMI_BaseResource [Key] string DatabaseServer; [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Required] string Passphrase; + [Write, ValueMap{"Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd"}, Values{"Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd"}] string ServerRole; }; diff --git a/README.md b/README.md index 8ba0bfcb2..73190c936 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,9 @@ Additional detailed documentation is included on the wiki on GitHub. ### 0.7.0.0 - * Bug fixes and stability improvements + * Support for MinRole options in SharePoint 2016 + * Fix to distributed cache deployment of more than one server + * Additional bug fixes and stability improvements ### 0.6.0.0 From bfac64b48e27c3201ba5f30aac680122618b2519 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 6 Oct 2015 13:50:19 +1100 Subject: [PATCH 145/146] Formatting fixes --- .../DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof index fbb84c6aa..0284a63fa 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.schema.mof @@ -5,6 +5,6 @@ class MSFT_xSPJoinFarm : OMI_BaseResource [Key] string DatabaseServer; [Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Required] string Passphrase; - [Write, ValueMap{"Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd"}, Values{"Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd"}] string ServerRole; + [Write, ValueMap{"Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd"}, Values{"Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd"}] string ServerRole; }; From 7977c1c0cfbdfd3ecc2cf3c5b3598d705f7c9b23 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 6 Oct 2015 13:50:34 +1100 Subject: [PATCH 146/146] Formatting fixes --- .../DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 index 4006ca092..cc99c4c1c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 @@ -13,7 +13,7 @@ function Get-TargetResource Write-Verbose -Message "Checking for local SP Farm" - if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { + if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { throw [Exception] "Server role is only supported in SharePoint 2016." } @@ -56,7 +56,7 @@ function Set-TargetResource Write-Verbose -Message "Joining existing farm configuration database" - if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { + if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { throw [Exception] "Server role is only supported in SharePoint 2016." } @@ -116,7 +116,7 @@ function Test-TargetResource [parameter(Mandatory = $false)] [ValidateSet("Application","Custom","DistributedCache","Search","SingleServer","SingleServerFarm","SpecialLoad","WebFrontEnd")] $ServerRole ) - if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { + if ($null -ne $ServerRole -and (Get-xSharePointInstalledProductVersion).FileMajorPart -ne 16) { throw [Exception] "Server role is only supported in SharePoint 2016." }