diff --git a/CHANGELOG.md b/CHANGELOG.md index 16046ea1e..55a3ec8e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,62 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- SharePointDsc + - Added support for SharePoint Server Subscription Edition in Util module and unit tests stubs + - Added SPSE unit tests to the Azure pipeline definitions +- SPCertificate + - New resource for SharePoint Server Subscription Edition +- SPCertificateSettings + - New resource for SharePoint Server Subscription Edition +- SPDatabaseAAG + - Added support for SharePoint Server Subscription Edition +- SPDistributedCacheService + - Added support for SharePoint Server Subscription Edition +- SPFarm + - Added support for SharePoint Server Subscription Edition +- SPInstall + - Added support for SharePoint Server Subscription Edition +- SPInstallPrereqs + - Added support for SharePoint Server Subscription Edition +- SPOfficeOnlineServerSupressionSettings + - New resource +- SPSearchServiceApp + - Added possibility to configure Search Index Deletion Policies settings +- SPWebApplication + - Added possibility to manage the SiteDataServers property + - Added support for configuring AllowLegacyEncryption, CertificateThumbprint and UseServerNameIndication +- SPWebApplicationExtension + - Added support for configuring AllowLegacyEncryption, CertificateThumbprint and UseServerNameIndication + ### Changed - ReverseDsc - Changed form Size to dynamic Width - Change column width to calc /3 of Form. - Export form is now more dynamic / responsive +- SPAccessServiceApp + - Service app no longer exists in SharePoint Server Subscription Edition. Added logic to check for SPSE. +- SPAccessServices2010 + - Service app no longer exists in SharePoint Server Subscription Edition. Added logic to check for SPSE. +- SPPerformancePointServiceApp + - Service app no longer exists in SharePoint Server Subscription Edition. Added logic to check for SPSE. +- SPWebApplicationExtension + - Updated so it infers the UseSSL value from the URL, just like the SPWebApplication resouce + +### Fixed + +- SPLogLevel + - Corrected issue in creating ReverseDsc export + +### Removed + +- SharePointDsc + - [BREAKING CHANGE] Removed PowerShell v4.0 support by removing the InstallAccount parameter + from all resources. +- SPWebApplicationExtension + - [BREAKING CHANGE] Removed UseSSL parameter ## [4.9.0] - 2021-11-06 @@ -192,159 +242,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Removed the ReverseDsc dependency for the SharePointDsc module since the module is only required when performing an export -## [4.5.1] - 2021-02-05 - -### Fixed - -- SharePointDsc - - Fixed regression in v4.5 - -## [4.5.0] - 2021-01-30 - -### Added - -- SharePointDsc - - Added native support for ReverseDsc -- SPDocIcon - - New resource -- SPUserProfileSyncConnection - - Added ability to update UseSSL and UseDisabledFilter parameters -- SPWordAutomationServiceApp - - Added ability to specify that the new service app should be added - to the default proxy group - -### Changed - -- SharePointDsc - - Updated pipeline build scripts -- SPProjectServerConnector - - Updated logic to check to required DLL file -- SPFarmAdministrators - - Update the event log messages so they are better formatted -- SPQuotaTemplate - - Updated resource to prevent errors when specified limits are conflicting - configured values. E.g. new warning is high than the current max limit. -- SPTrustedIdentityTokenIssuer - - Do not set property ProviderSignOutUri in SharePoint 2013 as it does - not exist -- SPUserProfileServiceApp - - Changed MySiteHostLocation to not be mandatory - - Added validation to Set function for testing if SiteNamingConflictResolution parameter - is defined then also MySiteHostLocation parameters has to be because it is a mandatory - parameter in the parameter set of New-SPProfileServiceApplication when - SiteNamingConflictResolution is used. - - Added "MySiteHostLocation" to Test-SPDscParameterState function in Test-TargetResource - -### Fixed - -- SPBlobCacheSettings - - Fixed issue where the Get method threw an error when the zone didn't exist. -- SPTrustedIdentityTokenIssuer - - Do not set property ProviderSignOutUri in SharePoint 2013 as it does - not exist -- SPWebAppPolicy - - Fixed a blocking issue introduced in version 4.4.0 when extracting cache - accounts - -### Removed - -- SharePointDsc - - Removed two old files from the previous CD/CI system - -## [4.4.0] - 2020-11-14 - -### Added - -- SharePointDsc - - Added logging to the event log when the code throws an exception - - Added support for trusted domains to Test-SPDscIsADUser helper function -- SPInstall - - Added documentation about a SharePoint 2019 installer issue - -### Changed - -- SPAlternateUrl - - Fixed issue where trailing '/' cause Url not to be recognized. -- SharePointDsc - - Updated Convert-SPDscHashtableToString to output the username when - parameter is a PSCredential -- SPFarm - - Switched from creating a Lock database to a Lock table in the TempDB. - This to allow the use of precreated databases. - - Updated code to properly output used credential parameters to verbose - logging -- SPSite - - Added more explanation to documentation on which parameters are checked -- SPWeb - - Added more explanation to documentation on using this resource - -### Fixed - -- SPConfigWizard - - Fixes issue where a CU installation wasn't registered properly in the - config database. Added logic to run the Product Version timer job -- SPSearchTopology - - Fixes issue where applying a topology failed when the search service - instance was disabled instead of offline -- SPSecureStoreServiceApp - - Fixes issue where custom database name was no longer used since v4.3 -- SPShellAdmins - - Fixed issue with Get-DscConfiguration which threw an error when only one - item was returned by the Get method -- SPWordAutomationServiceApp - - Fixed issue where provisioning the service app requires a second run to - update all specified parameters -- SPWorkflowService - - Fixed issue configuring workflow service when no workflow service is - currently configured - -## [4.3.0] - 2020-09-30 - -### Added - -- SPProductUpdate - - Added extra logging when the setup file was not found -- SPSecureStoreServiceApp - - Added possibility to set the Master Key during creation of the service - application - -### Changed - -- SharePointDsc - - Changed ModuleBuilder module to latest version - - Update Pester tests to remove legacy Pester syntax -- SPFarm - - Added support for specifying port number in the CentralAdministrationUrl parameter. - If CentralAdministrationPort is also specified both port numbers must match. -- SPWebAppSuiteBar - - Unblocked usage on SharePoint 2019. Added verbose messages clarifying usage - scenarios on SharePoint 2019. - -### Fixed - -- SharePointDsc - - Fixed issue where Invoke-SPDscCommand wasn't available anymore for the script - resource -- SPContentDatabase - - Fixed issue where the set method didn't do anything when the Ensure parameter - wasn't specified -- SPFarm - - Fixed issue where the resource didn't support precreated databases. -- SPFarmAdministrators - - Fixed issue in SP2016 where an error was thrown in the Set method since v3.8 -- SPFarmSolution - - Fixed issue where web applications weren't compared properly when the desired - value didn't contain any slashes -- SPInstallLanguagePack - - Fixed issue with detection of Chinese language pack in SharePoint 2019 -- SPServiceAppSecurity - - Fixed incorrect example -- SPStateServiceApp - - Fixed issue where code failed because the State database already existed -- SPTrustedIdentityTokenIssuer - - Run Get-SPClaimProvider only if property ClaimProviderName is omitted/null/empty - - Property ClaimProviderName is never set -- SPWeb - - Fixed issue with incorrect detection of SPWeb that has to be absent - For older change log history see the [historic changelog](HISTORIC_CHANGELOG.md). diff --git a/HISTORIC_CHANGELOG.md b/HISTORIC_CHANGELOG.md index 4cf201da4..8188e7b2b 100644 --- a/HISTORIC_CHANGELOG.md +++ b/HISTORIC_CHANGELOG.md @@ -1,5 +1,160 @@ # Historic change log for SharePointDsc +## [4.5.1] - 2021-02-05 + +### Fixed + +- SharePointDsc + - Fixed regression in v4.5 + +## [4.5.0] - 2021-01-30 + +### Added + +- SharePointDsc + - Added native support for ReverseDsc +- SPDocIcon + - New resource +- SPUserProfileSyncConnection + - Added ability to update UseSSL and UseDisabledFilter parameters +- SPWordAutomationServiceApp + - Added ability to specify that the new service app should be added + to the default proxy group + +### Changed + +- SharePointDsc + - Updated pipeline build scripts +- SPProjectServerConnector + - Updated logic to check to required DLL file +- SPFarmAdministrators + - Update the event log messages so they are better formatted +- SPQuotaTemplate + - Updated resource to prevent errors when specified limits are conflicting + configured values. E.g. new warning is high than the current max limit. +- SPTrustedIdentityTokenIssuer + - Do not set property ProviderSignOutUri in SharePoint 2013 as it does + not exist +- SPUserProfileServiceApp + - Changed MySiteHostLocation to not be mandatory + - Added validation to Set function for testing if SiteNamingConflictResolution parameter + is defined then also MySiteHostLocation parameters has to be because it is a mandatory + parameter in the parameter set of New-SPProfileServiceApplication when + SiteNamingConflictResolution is used. + - Added "MySiteHostLocation" to Test-SPDscParameterState function in Test-TargetResource + +### Fixed + +- SPBlobCacheSettings + - Fixed issue where the Get method threw an error when the zone didn't exist. +- SPTrustedIdentityTokenIssuer + - Do not set property ProviderSignOutUri in SharePoint 2013 as it does + not exist +- SPWebAppPolicy + - Fixed a blocking issue introduced in version 4.4.0 when extracting cache + accounts + +### Removed + +- SharePointDsc + - Removed two old files from the previous CD/CI system + +## [4.4.0] - 2020-11-14 + +### Added + +- SharePointDsc + - Added logging to the event log when the code throws an exception + - Added support for trusted domains to Test-SPDscIsADUser helper function +- SPInstall + - Added documentation about a SharePoint 2019 installer issue + +### Changed + +- SPAlternateUrl + - Fixed issue where trailing '/' cause Url not to be recognized. +- SharePointDsc + - Updated Convert-SPDscHashtableToString to output the username when + parameter is a PSCredential +- SPFarm + - Switched from creating a Lock database to a Lock table in the TempDB. + This to allow the use of precreated databases. + - Updated code to properly output used credential parameters to verbose + logging +- SPSite + - Added more explanation to documentation on which parameters are checked +- SPWeb + - Added more explanation to documentation on using this resource + +### Fixed + +- SPConfigWizard + - Fixes issue where a CU installation wasn't registered properly in the + config database. Added logic to run the Product Version timer job +- SPSearchTopology + - Fixes issue where applying a topology failed when the search service + instance was disabled instead of offline +- SPSecureStoreServiceApp + - Fixes issue where custom database name was no longer used since v4.3 +- SPShellAdmins + - Fixed issue with Get-DscConfiguration which threw an error when only one + item was returned by the Get method +- SPWordAutomationServiceApp + - Fixed issue where provisioning the service app requires a second run to + update all specified parameters +- SPWorkflowService + - Fixed issue configuring workflow service when no workflow service is + currently configured + +## [4.3.0] - 2020-09-30 + +### Added + +- SPProductUpdate + - Added extra logging when the setup file was not found +- SPSecureStoreServiceApp + - Added possibility to set the Master Key during creation of the service + application + +### Changed + +- SharePointDsc + - Changed ModuleBuilder module to latest version + - Update Pester tests to remove legacy Pester syntax +- SPFarm + - Added support for specifying port number in the CentralAdministrationUrl parameter. + If CentralAdministrationPort is also specified both port numbers must match. +- SPWebAppSuiteBar + - Unblocked usage on SharePoint 2019. Added verbose messages clarifying usage + scenarios on SharePoint 2019. + +### Fixed + +- SharePointDsc + - Fixed issue where Invoke-SPDscCommand wasn't available anymore for the script + resource +- SPContentDatabase + - Fixed issue where the set method didn't do anything when the Ensure parameter + wasn't specified +- SPFarm + - Fixed issue where the resource didn't support precreated databases. +- SPFarmAdministrators + - Fixed issue in SP2016 where an error was thrown in the Set method since v3.8 +- SPFarmSolution + - Fixed issue where web applications weren't compared properly when the desired + value didn't contain any slashes +- SPInstallLanguagePack + - Fixed issue with detection of Chinese language pack in SharePoint 2019 +- SPServiceAppSecurity + - Fixed incorrect example +- SPStateServiceApp + - Fixed issue where code failed because the State database already existed +- SPTrustedIdentityTokenIssuer + - Run Get-SPClaimProvider only if property ClaimProviderName is omitted/null/empty + - Property ClaimProviderName is never set +- SPWeb + - Fixed issue with incorrect detection of SPWeb that has to be absent + ## [4.2.0] - 2020-06-12 ### Fixed diff --git a/Modules/SharePointDsc/DscResource.Tests b/Modules/SharePointDsc/DscResource.Tests deleted file mode 160000 index bc9a07d80..000000000 --- a/Modules/SharePointDsc/DscResource.Tests +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bc9a07d807c65bbc33d75cf36aa774a73345b809 diff --git a/README.md b/README.md index 61614fc75..6041d2fd7 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,8 @@ [![Build Status](https://dev.azure.com/dsccommunity/SharePointDsc/_apis/build/status/dsccommunity.SharePointDsc?branchName=master)](https://dev.azure.com/dsccommunity/SharePointDsc/_build/latest?definitionId=14&branchName=master) ![Azure DevOps coverage (branch)](https://img.shields.io/azure-devops/coverage/dsccommunity/SharePointDsc/14/master) [![Azure DevOps tests](https://img.shields.io/azure-devops/tests/dsccommunity/SharePointDsc/14/master)](https://dsccommunity.visualstudio.com/SharePointDsc/_test/analytics?definitionId=14&contextType=build) -[![PowerShell Gallery (with prereleases)](https://img.shields.io/powershellgallery/vpre/SharePointDsc?label=SharePointDsc%20Preview)](https://www.powershellgallery.com/packages/SharePointDsc/) -[![PowerShell Gallery](https://img.shields.io/powershellgallery/v/SharePointDsc?label=SharePointDsc)](https://www.powershellgallery.com/packages/SharePointDsc/) +[![PowerShell Gallery (with prereleases)](https://img.shields.io/powershellgallery/v/SharePointDsc.svg?include_prereleases&label=SharePointDsc%20Preview)](https://www.powershellgallery.com/packages/SharePointDsc/) +[![PowerShell Gallery](https://img.shields.io/powershellgallery/v/SharePointDsc.svg?&label=SharePointDsc)](https://www.powershellgallery.com/packages/SharePointDsc/) The SharePointDsc PowerShell module (formerly known as xSharePoint) provides DSC resources that can be used to deploy and manage a SharePoint farm. @@ -53,12 +53,10 @@ SharePoint DSC resoures available: ## Requirements -The minimum PowerShell version required is 4.0, which ships in Windows 8.1 -or Windows Server 2012R2 (or higher versions). The preferred version is -PowerShell 5.0 or higher, which ships with Windows 10 or Windows Server 2016. -This is discussed [on the SharePointDsc wiki](https://github.com/dsccommunity/SharePointDsc/wiki/Remote%20sessions%20and%20the%20InstallAccount%20variable), -but generally PowerShell 5 will run the SharePoint DSC resources faster and -with improved verbose level logging. +The minimum PowerShell version required is 5.0, available for all currently +supported operating systems. The preferred version is PowerShell 5.1, which +ships with Windows 10 or Windows Server 2016. This is discussed +[on the SharePointDsc wiki](https://github.com/dsccommunity/SharePointDsc/wiki/Remote%20sessions%20and%20the%20InstallAccount%20variable). ## Documentation and examples diff --git a/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.psm1 index 7c0be900b..e4c66e854 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.psm1 @@ -19,17 +19,26 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting Access Services service app '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $productVersion = Get-SPDscInstalledProductVersion + if ($productVersion.FileMajorPart -eq 16 ` + -and $productVersion.FileBuildPart -gt 13000) + { + $message = ("Since SharePoint Server Subscription Edition the Access Services does no longer " + ` + "exists. See https://docs.microsoft.com/en-us/sharepoint/what-s-new/what-s-deprecated-or-removed-from-sharepoint-server-2019#access-services-2013 " + ` + "for more info.") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -90,22 +99,31 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting Access Services service app '$Name'" + $productVersion = Get-SPDscInstalledProductVersion + if ($productVersion.FileMajorPart -eq 16 ` + -and $productVersion.FileBuildPart -gt 13000) + { + $message = ("Since SharePoint Server Subscription Edition the Access Services does no longer " + ` + "exists. See https://docs.microsoft.com/en-us/sharepoint/what-s-new/what-s-deprecated-or-removed-from-sharepoint-server-2019#access-services-2013" + ` + "for more info.") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + $result = Get-TargetResource @PSBoundParameters if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message "Creating Access Services Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -121,8 +139,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing Access Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -167,11 +184,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing for Access Service Application '$Name'" diff --git a/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.schema.mof b/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.schema.mof index 0539bc631..506e92ad4 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/MSFT_SPAccessServiceApp.schema.mof @@ -5,5 +5,4 @@ class MSFT_SPAccessServiceApp : OMI_BaseResource [Required, Description("The name of the application pool to run the service app in")] string ApplicationPool; [Required, Description("The name of the database server to host Access Services databases")] string DatabaseServer; [Write, Description("Present ensures service app exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/readme.md b/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/readme.md index a8d399ad8..4f09864eb 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/readme.md +++ b/SharePointDsc/DSCResources/MSFT_SPAccessServiceApp/readme.md @@ -9,3 +9,8 @@ Access Services Service Application. The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. + +**NOTE:** +Since SharePoint Server Subscription Edition the Access Services does no longer +exists. See [What's deprecated or removed from SharePoint Server 2019](https://docs.microsoft.com/en-us/sharepoint/what-s-new/what-s-deprecated-or-removed-from-sharepoint-server-2019#access-services-2013) +for more info. diff --git a/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.psm1 b/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.psm1 index ff44b82bb..8171e281e 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.psm1 @@ -15,17 +15,26 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting Access 2010 Service app '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $productVersion = Get-SPDscInstalledProductVersion + if ($productVersion.FileMajorPart -eq 16 ` + -and $productVersion.FileBuildPart -gt 13000) + { + $message = ("Since SharePoint Server Subscription Edition the Access Services 2010 does no longer " + ` + "exists. See https://docs.microsoft.com/en-us/sharepoint/what-s-new/what-s-deprecated-or-removed-from-sharepoint-server-2019#access-services-2013 " + ` + "for more info.") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication | Where-Object -FilterScript { @@ -78,21 +87,31 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting Access 2010 Services app '$Name'" + + $productVersion = Get-SPDscInstalledProductVersion + if ($productVersion.FileMajorPart -eq 16 ` + -and $productVersion.FileBuildPart -gt 13000) + { + $message = ("Since SharePoint Server Subscription Edition the Access Services 2010 does no longer " + ` + "exists. See https://docs.microsoft.com/en-us/sharepoint/what-s-new/what-s-deprecated-or-removed-from-sharepoint-server-2019#access-services-2013 " + ` + "for more info.") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + $result = Get-TargetResource @PSBoundParameters if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose "Creating Access 2010 Service Application '$Name'" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $accessApp = New-SPAccessServiceApplication -Name $params.Name ` @@ -102,8 +121,7 @@ function Set-TargetResource if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") { Write-Verbose "Updating Access 2010 service application '$Name'" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $apps = Get-SPServiceApplication | Where-Object -FilterScript { @@ -134,8 +152,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose "Removing Access 2010 service application '$Name'" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -177,11 +194,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing Access 2010 service app '$Name'" diff --git a/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.schema.mof b/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.schema.mof index 9d5e21e64..6b98c9a02 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/MSFT_SPAccessServices2010.schema.mof @@ -5,5 +5,4 @@ class MSFT_SPAccessServices2010 : OMI_BaseResource [Key, Description("The name of the service application")] String Name; [Required, Description("The name of the application pool to run the service app in")] String ApplicationPool; [Write, Description("Present ensures service app exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, EmbeddedInstance("MSFT_Credential"), Description("POWERSHELL 4 ONLY: The account to run thsi resource as, use PsDscRunAsCredential if using PowerShell 5")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/readme.md b/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/readme.md index a4004d08b..43d3a5616 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/readme.md +++ b/SharePointDsc/DSCResources/MSFT_SPAccessServices2010/readme.md @@ -9,3 +9,8 @@ configure the Access Services 2010 Service Application. The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. + +**NOTE:** +Since SharePoint Server Subscription Edition the Access Services 2010 does no longer +exists. See [What's deprecated or removed from SharePoint Server 2019](https://docs.microsoft.com/en-us/sharepoint/what-s-new/what-s-deprecated-or-removed-from-sharepoint-server-2019#access-services-2010) +for more info. diff --git a/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.psm1 b/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.psm1 index 0fafe2f40..3374ade59 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.psm1 @@ -24,17 +24,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting Alternate URL for $Zone in $WebAppName" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -95,11 +90,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) @@ -107,8 +98,7 @@ function Set-TargetResource if ($Ensure -eq "Present") { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -240,8 +230,7 @@ function Set-TargetResource } else { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $aam = Get-SPAlternateURL -Identity $params.Url ` @@ -278,11 +267,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) diff --git a/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.schema.mof b/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.schema.mof index 602999150..b8029dc37 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPAlternateUrl/MSFT_SPAlternateUrl.schema.mof @@ -6,6 +6,4 @@ class MSFT_SPAlternateUrl : OMI_BaseResource [Key, Description("The new alternate URL")] String Url; [Write, Description("Specifies if the URL has to be configured as internal")] Boolean Internal; [Write, Description("Present ensures the URL is set for this zone on this web app, Absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.psm1 index e23792dd5..3d9c656cd 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.psm1 @@ -31,17 +31,12 @@ function Get-TargetResource [Parameter()] [System.UInt16] - $NumberOfThreads, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $NumberOfThreads ) Write-Verbose -Message "Getting antivirus configuration settings" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -114,17 +109,12 @@ function Set-TargetResource [Parameter()] [System.UInt16] - $NumberOfThreads, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $NumberOfThreads ) Write-Verbose -Message "Setting antivirus configuration settings" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -210,11 +200,7 @@ function Test-TargetResource [Parameter()] [System.UInt16] - $NumberOfThreads, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $NumberOfThreads ) Write-Verbose -Message "Testing antivirus configuration settings" diff --git a/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.schema.mof index 3498c16f8..5f44dd942 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPAntivirusSettings/MSFT_SPAntivirusSettings.schema.mof @@ -8,6 +8,4 @@ class MSFT_SPAntivirusSettings : OMI_BaseResource [Write, Description("Should infected documents be handed to the AV engine to attempt cleaning")] Boolean AttemptToClean; [Write, Description("What is the timeout for an AV scan in seconds")] Uint16 TimeoutDuration; [Write, Description("How many concurrent threads should the AV engine be able to run on a server")] Uint16 NumberOfThreads; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.psm1 b/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.psm1 index 69436316b..4a7123b70 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.psm1 @@ -6,17 +6,12 @@ function Get-TargetResource ( [Parameter(Mandatory = $true)] [System.String] - $SiteUrl, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SiteUrl ) Write-Verbose -Message "Getting app catalog status of $SiteUrl" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -55,33 +50,30 @@ function Set-TargetResource ( [Parameter(Mandatory = $true)] [System.String] - $SiteUrl, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SiteUrl ) Write-Verbose -Message "Setting app catalog status of $SiteUrl" Write-Verbose -Message "Retrieving farm account" - $farmAccount = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $farmAccount = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { return Get-SPDscFarmAccount } - Write-Verbose -Message "Check if InstallAccount or PsDscRunAsCredential is the farm account" + Write-Verbose -Message "Check if PsDscRunAsCredential is the farm account" if ($null -ne $farmAccount) { - if ($PSBoundParameters.ContainsKey("InstallAccount") -eq $true) + # PSDSCRunAsCredential or System + if (-not $Env:USERNAME.Contains("$")) { - # InstallAccount used - if ($InstallAccount.UserName -eq $farmAccount.UserName) + # PSDSCRunAsCredential used + $localaccount = "$($Env:USERDOMAIN)\$($Env:USERNAME)" + if ($localaccount -eq $farmAccount.UserName) { - $message = ("Specified InstallAccount ($($InstallAccount.UserName)) is the Farm " + ` - "Account. Make sure the specified InstallAccount isn't the Farm Account " + ` - "and try again") + $message = ("Specified PSDSCRunAsCredential ($localaccount) is the Farm " + ` + "Account. Make sure the specified PSDSCRunAsCredential isn't the " + ` + "Farm Account and try again") Add-SPDscEvent -Message $message ` -EntryType 'Error' ` -EventID 100 ` @@ -89,26 +81,6 @@ function Set-TargetResource throw $message } } - else - { - # PSDSCRunAsCredential or System - if (-not $Env:USERNAME.Contains("$")) - { - # PSDSCRunAsCredential used - $localaccount = "$($Env:USERDOMAIN)\$($Env:USERNAME)" - if ($localaccount -eq $farmAccount.UserName) - { - $message = ("Specified PSDSCRunAsCredential ($localaccount) is the Farm " + ` - "Account. Make sure the specified PSDSCRunAsCredential isn't the " + ` - "Farm Account and try again") - Add-SPDscEvent -Message $message ` - -EntryType 'Error' ` - -EventID 100 ` - -Source $MyInvocation.MyCommand.Source - throw $message - } - } - } } else { @@ -148,8 +120,8 @@ function Set-TargetResource catch [System.UnauthorizedAccessException] { $message = ("This resource must be run as the farm account (not a setup account). " + ` - "Please ensure either the PsDscRunAsCredential or InstallAccount " + ` - "credentials are set to the farm account and run this resource again") + "Please ensure the PsDscRunAsCredential credentials are set " + ` + "to the farm account and run this resource again") Add-SPDscEvent -Message $message ` -EntryType 'Error' ` -EventID 100 ` @@ -180,11 +152,7 @@ function Test-TargetResource ( [Parameter(Mandatory = $true)] [System.String] - $SiteUrl, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SiteUrl ) Write-Verbose -Message "Testing app catalog status of $SiteUrl" diff --git a/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.schema.mof b/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.schema.mof index 8e7fb9af2..f521d4245 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPAppCatalog/MSFT_SPAppCatalog.schema.mof @@ -2,5 +2,4 @@ class MSFT_SPAppCatalog : OMI_BaseResource { [Key, Description("The URL of the site collection that will be the app catalog for the web app that it is in")] string SiteUrl; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.psm1 b/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.psm1 index 0704d12ff..42bd53eb6 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.psm1 @@ -10,17 +10,12 @@ function Get-TargetResource [Parameter(Mandatory = $true)] [System.String] - $Prefix, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Prefix ) Write-Verbose -Message "Getting app domain settings" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $appDomain = Get-SPAppDomain @@ -45,17 +40,12 @@ function Set-TargetResource [Parameter(Mandatory = $true)] [System.String] - $Prefix, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Prefix ) Write-Verbose -Message "Setting app domain settings" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -76,11 +66,7 @@ function Test-TargetResource [Parameter(Mandatory = $true)] [System.String] - $Prefix, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Prefix ) Write-Verbose -Message "Testing app domain settings" diff --git a/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.schema.mof b/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.schema.mof index 0820ecf25..20a5a399b 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPAppDomain/MSFT_SPAppDomain.schema.mof @@ -3,6 +3,5 @@ class MSFT_SPAppDomain : OMI_BaseResource { [Key, Description("The domain name for apps to use in this farm")] string AppDomain; [Required, Description("The prefix to go on to app URLs")] string Prefix; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.psm1 index 1192f7712..3b044aace 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.psm1 @@ -35,17 +35,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting App management service app '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -136,11 +131,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting App management service app '$Name'" @@ -152,8 +143,7 @@ function Set-TargetResource # The service app doesn't exist but should Write-Verbose -Message "Creating App management Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -204,8 +194,7 @@ function Set-TargetResource if ($result.ProxyName -eq "") { Write-Verbose -Message "Proxy not found, creating proxy" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -233,8 +222,7 @@ function Set-TargetResource if ($ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating Application Pool" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $appPool = Get-SPServiceApplicationPool -Identity $params.ApplicationPool @@ -253,8 +241,7 @@ function Set-TargetResource { # The service app should not exit Write-Verbose -Message "Removing App management Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -314,11 +301,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing App management service app '$Name'" diff --git a/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.schema.mof b/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.schema.mof index 9da405346..c81b7fb15 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPAppManagementServiceApp/MSFT_SPAppManagementServiceApp.schema.mof @@ -7,8 +7,6 @@ class MSFT_SPAppManagementServiceApp : OMI_BaseResource [Write, Description("The name of the database for the service application")] string DatabaseName; [Write, Description("The name of the server for the database")] String DatabaseServer; [Write, Description("Present ensures service app exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Write, Description("Should SQL Server authentication be used to connect to the database?")] Boolean UseSQLAuthentication; [Write, Description("If using SQL authentication, the SQL credentials to use to connect to the instance"), EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.psm1 index 85795e85b..2d3f8b1c5 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.psm1 @@ -14,17 +14,12 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $AllowAppsForOffice, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AllowAppsForOffice ) Write-Verbose -Message "Getting app store settings of $WebAppUrl" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -67,17 +62,12 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $AllowAppsForOffice, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AllowAppsForOffice ) Write-Verbose -Message "Setting app store settings of $WebAppUrl" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -133,11 +123,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $AllowAppsForOffice, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AllowAppsForOffice ) Write-Verbose -Message "Testing app store settings of $WebAppUrl" diff --git a/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.schema.mof index 90b3455c5..72ec4e3ee 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPAppStoreSettings/MSFT_SPAppStoreSettings.schema.mof @@ -4,5 +4,4 @@ class MSFT_SPAppStoreSettings : OMI_BaseResource [Key, Description("The URL of the web application")] string WebAppUrl; [Write, Description("Specifies if App Purchases from the SharePoint Store are allowed")] Boolean AllowAppPurchases; [Write, Description("Specifies if App Purchases for Office applications are allowed")] Boolean AllowAppsForOffice; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPAuthenticationRealm/MSFT_SPAuthenticationRealm.psm1 b/SharePointDsc/DSCResources/MSFT_SPAuthenticationRealm/MSFT_SPAuthenticationRealm.psm1 index 69f4008fd..bfed5045c 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAuthenticationRealm/MSFT_SPAuthenticationRealm.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPAuthenticationRealm/MSFT_SPAuthenticationRealm.psm1 @@ -2,7 +2,8 @@ function Get-TargetResource { [CmdletBinding()] [OutputType([System.Collections.HashTable])] - param ( + param + ( [Parameter(Mandatory = $true)] [ValidateSet('Yes')] [String] @@ -10,17 +11,12 @@ function Get-TargetResource [Parameter(Mandatory = $true)] [String] - $AuthenticationRealm, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AuthenticationRealm ) Write-Verbose -Message "Getting farm authentication realm" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -ScriptBlock { + $result = Invoke-SPDscCommand -ScriptBlock { $currentRealm = Get-SPAuthenticationRealm Write-Verbose -Message "Current farm authentication realm is '$currentRealm'" @@ -37,7 +33,8 @@ function Get-TargetResource function Set-TargetResource() { [CmdletBinding()] - param ( + param + ( [Parameter(Mandatory = $true)] [ValidateSet('Yes')] [String] @@ -45,17 +42,12 @@ function Set-TargetResource() [Parameter(Mandatory = $true)] [String] - $AuthenticationRealm, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AuthenticationRealm ) Write-Verbose -Message "Setting farm authentication realm to $AuthenticationRealm" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -68,7 +60,8 @@ function Test-TargetResource() [CmdletBinding()] [OutputType([System.Boolean])] [CmdletBinding()] - param ( + param + ( [Parameter(Mandatory = $true)] [ValidateSet('Yes')] [String] @@ -76,11 +69,7 @@ function Test-TargetResource() [Parameter(Mandatory = $true)] [String] - $AuthenticationRealm, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AuthenticationRealm ) Write-Verbose -Message "Testing farm authentication realm" diff --git a/SharePointDsc/DSCResources/MSFT_SPAuthenticationRealm/MSFT_SPAuthenticationRealm.schema.mof b/SharePointDsc/DSCResources/MSFT_SPAuthenticationRealm/MSFT_SPAuthenticationRealm.schema.mof index e073cb187..3f24206c2 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAuthenticationRealm/MSFT_SPAuthenticationRealm.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPAuthenticationRealm/MSFT_SPAuthenticationRealm.schema.mof @@ -3,5 +3,4 @@ class MSFT_SPAuthenticationRealm : OMI_BaseResource { [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; [Required, Description("The authentication realm to be set")] String AuthenticationRealm; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPAzureAccessControlServiceAppProxy/MSFT_SPAzureAccessControlServiceAppProxy.psm1 b/SharePointDsc/DSCResources/MSFT_SPAzureAccessControlServiceAppProxy/MSFT_SPAzureAccessControlServiceAppProxy.psm1 index 53f702b0c..390ace74c 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAzureAccessControlServiceAppProxy/MSFT_SPAzureAccessControlServiceAppProxy.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPAzureAccessControlServiceAppProxy/MSFT_SPAzureAccessControlServiceAppProxy.psm1 @@ -15,17 +15,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting ACS service app proxy '$Name'" - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -72,11 +67,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting ACS service app proxy '$Name'" @@ -87,8 +78,7 @@ function Set-TargetResource { # The service app proxy doesn't exist but should Write-Verbose -Message "Creating ACS service app proxy $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -103,8 +93,7 @@ function Set-TargetResource if ($MetadataServiceEndpointUri -ne $result.MetadataServiceEndpointUri) { Write-Verbose -Message "Recreating ACS service app proxy $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -127,8 +116,7 @@ function Set-TargetResource { # The service app proxy should not exit Write-Verbose -Message "Removing ACS service app proxy $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -159,11 +147,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing ACS service app proxy '$Name'" diff --git a/SharePointDsc/DSCResources/MSFT_SPAzureAccessControlServiceAppProxy/MSFT_SPAzureAccessControlServiceAppProxy.schema.mof b/SharePointDsc/DSCResources/MSFT_SPAzureAccessControlServiceAppProxy/MSFT_SPAzureAccessControlServiceAppProxy.schema.mof index b81d36beb..08462de05 100644 --- a/SharePointDsc/DSCResources/MSFT_SPAzureAccessControlServiceAppProxy/MSFT_SPAzureAccessControlServiceAppProxy.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPAzureAccessControlServiceAppProxy/MSFT_SPAzureAccessControlServiceAppProxy.schema.mof @@ -4,6 +4,4 @@ class MSFT_SPAzureAccessControlServiceAppProxy : OMI_BaseResource [Key, Description("The name of the Azure Access Control service application proxy")] string Name; [Write, Description("Present ensures service app proxy exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; [Required, Description("Specifies the URL of the Azure Access Control Service's metadata document.")] string MetadataServiceEndpointUri; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.psm1 index 8266f45d3..692e5bbb0 100644 --- a/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.psm1 @@ -35,17 +35,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting BCS service app '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -136,11 +131,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting BCS service app '$Name'" @@ -163,8 +154,7 @@ function Set-TargetResource { # The service app doesn't exist but should Write-Verbose -Message "Creating BCS Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -211,8 +201,7 @@ function Set-TargetResource if ($ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating BCS Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -231,8 +220,7 @@ function Set-TargetResource { # The service app should not exit Write-Verbose -Message "Removing BCS Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -292,11 +280,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing BCS service app '$Name'" @@ -362,10 +346,6 @@ function Export-TargetResource $params.Name = $bcsaInstance.DisplayName $results = Get-TargetResource @params - if ($results.Contains("InstallAccount")) - { - $results.Remove("InstallAccount") - } $results = Repair-Credentials -results $results Add-ConfigurationDataEntry -Node "NonNodeData" -Key "DatabaseServer" -Value $results.DatabaseServer -Description "Name of the Database Server associated with the destination SharePoint Farm;" diff --git a/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.schema.mof b/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.schema.mof index 24f277168..55a60ff7b 100644 --- a/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPBCSServiceApp/MSFT_SPBCSServiceApp.schema.mof @@ -7,8 +7,6 @@ class MSFT_SPBCSServiceApp : OMI_BaseResource [Write, Description("Name of the database to create for the service app")] string DatabaseName; [Write, Description("Name of the database server to host the database on")] String DatabaseServer; [Write, Description("Present ensures service app exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Write, Description("Should SQL Server authentication be used to connect to the database?")] Boolean UseSQLAuthentication; [Write, Description("If using SQL authentication, the SQL credentials to use to connect to the instance"), EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.psm1 index 3263f8bfa..9760368a3 100644 --- a/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.psm1 @@ -31,17 +31,12 @@ function Get-TargetResource [Parameter()] [System.String] - $FileTypes, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $FileTypes ) Write-Verbose -Message "Getting blob cache settings for $WebAppUrl" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -182,11 +177,7 @@ function Set-TargetResource [Parameter()] [System.String] - $FileTypes, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $FileTypes ) Write-Verbose -Message "Setting blob cache settings for $WebAppUrl" @@ -238,8 +229,7 @@ function Set-TargetResource if ($changes.Count -ne 0) { ## Perform changes - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $changes) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $changes) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -389,11 +379,7 @@ function Test-TargetResource [Parameter()] [System.String] - $FileTypes, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $FileTypes ) Write-Verbose -Message "Testing blob cache settings for $WebAppUrl" diff --git a/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.schema.mof index 66f2a30ae..2f59e67c2 100644 --- a/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPBlobCacheSettings/MSFT_SPBlobCacheSettings.schema.mof @@ -8,5 +8,4 @@ class MSFT_SPBlobCacheSettings : OMI_BaseResource [Write, Description("The maximum size (in GB) of disk space the blob cache is allowed to use")] Uint16 MaxSizeInGB; [Write, Description("The maximum age (in seconds) that a browser caches a blob")] Uint32 MaxAgeInSeconds; [Write, Description("Specify the file types that must be stored by the blob cache")] string FileTypes; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.psm1 b/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.psm1 index 23081f9f0..9fe6efed4 100644 --- a/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.psm1 @@ -18,17 +18,12 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $SetWebAppPolicy = $true, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SetWebAppPolicy = $true ) Write-Verbose -Message "Getting cache accounts for $WebAppUrl" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -156,18 +151,13 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $SetWebAppPolicy = $true, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount ) + $SetWebAppPolicy = $true ) Write-Verbose -Message "Setting cache accounts for $WebAppUrl" $PSBoundParameters.SetWebAppPolicy = $SetWebAppPolicy - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -266,11 +256,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $SetWebAppPolicy = $true, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount ) + $SetWebAppPolicy = $true ) Write-Verbose -Message "Testing cache accounts for $WebAppUrl" diff --git a/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.schema.mof b/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.schema.mof index c7583997c..6660921da 100644 --- a/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPCacheAccounts/MSFT_SPCacheAccounts.schema.mof @@ -5,6 +5,4 @@ class MSFT_SPCacheAccounts : OMI_BaseResource [Required, Description("The account name for the super user")] string SuperUserAlias; [Required, Description("The account name for the super reader")] string SuperReaderAlias; [Write, Description("Should the web app policy be set for these accounts?")] boolean SetWebAppPolicy; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPCertificate/MSFT_SPCertificate.psm1 b/SharePointDsc/DSCResources/MSFT_SPCertificate/MSFT_SPCertificate.psm1 new file mode 100644 index 000000000..e5e42a752 --- /dev/null +++ b/SharePointDsc/DSCResources/MSFT_SPCertificate/MSFT_SPCertificate.psm1 @@ -0,0 +1,555 @@ +function Get-TargetResource +{ + [CmdletBinding()] + [OutputType([System.Collections.Hashtable])] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $CertificateFilePath, + + [Parameter()] + [System.Management.Automation.PSCredential] + $CertificatePassword, + + [Parameter()] + [ValidateSet('EndEntity', 'Intermediate', 'Pending', 'Root')] + [System.String] + $Store = 'EndEntity', + + [Parameter()] + [System.Boolean] + $Exportable, + + [Parameter()] + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present" + ) + + Write-Verbose -Message "Getting certificate" + + $PSBoundParameters.Store = $Store + + $installedVersion = Get-SPDscInstalledProductVersion + if ($installedVersion.FileMajorPart -lt 16 -or ` + $installedVersion.ProductBuildPart -lt 13000) + { + $message = ("Certificate Management is not available in SharePoint 2019 or earlier") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + + if ((Test-Path -Path $PSBoundParameters.CertificateFilePath) -eq $false) + { + throw "CertificateFilePath '$($PSBoundParameters.CertificateFilePath)' not found" + } + + # Check for PFX or CER + $file = Get-ChildItem -Path $PSBoundParameters.CertificateFilePath + switch ($file.Extension) + { + ".cer" + { + Write-Verbose "Specified CertificateFilePath is a CER file" + if ($PSBoundParameters.ContainsKey("CertificatePassword")) + { + Write-Verbose "Specifying a CertificatePassword isn't required when CertificateFilePath is a CER file." + } + } + ".pfx" + { + Write-Verbose "Specified CertificateFilePath is a PFX file" + if ($PSBoundParameters.ContainsKey("CertificatePassword") -eq $false) + { + Write-Verbose ("CertificatePassword isn't specified, make sure '$PsDscRunAsCredential' " + ` + "has permissions to import the PFX file.") + } + } + default + { + throw "Unsupported file extension. Please specify a PFX or CER file" + } + } + + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` + -ScriptBlock { + $params = $args[0] + + try + { + $null = Get-SPFarm + } + catch + { + Write-Verbose -Message ("No local SharePoint farm was detected. Certificate " + ` + "will not be applied") + return @{ + CertificateFilePath = $params.CertificateFilePath + Ensure = "Absent" + } + } + + # Check for PFX or CER + $file = Get-ChildItem -Path $params.CertificateFilePath + switch ($file.Extension) + { + ".cer" + { + $isPFX = $false + $certificateObject = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList $params.CertificateFilePath + } + ".pfx" + { + $isPFX = $true + if ($params.ContainsKey("CertificatePassword")) + { + $certificateObject = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList $params.CertificateFilePath, $params.CertificatePassword.Password + } + else + { + $certificateObject = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList $params.CertificateFilePath + } + } + } + + $thumbprint = $certificateObject.Thumbprint + $spCertificate = Get-SPCertificate -Thumbprint $thumbprint -ErrorAction SilentlyContinue + + $result = @{ + CertificateFilePath = $params.CertificateFilePath + } + + if ($null -ne $spCertificate) + { + if ($spCertificate -isnot [Array]) + { + Write-Verbose "Certificate with thumbprint $thumbprint found in SharePoint" + if ($spCertificate.HasPrivateKey -eq $false -and $isPFX -eq $true) + { + Write-Verbose ("Discovered certificate does not have a private key and the " + ` + "specified CertificateFilePath is a PFX. Returning Absent.") + $result.Ensure = "Absent" + } + else + { + $result.CertificatePassword = $params.CertificatePassword + $result.Store = $spCertificate.StoreType + $result.Exportable = $spCertificate.Exportable + $result.Ensure = "Present" + } + } + else + { + Write-Verbose "Multiple certificates with thumbprint $thumbprint found in SharePoint" + Write-Verbose "Checking for correct certificate" + $spCertificate = $spCertificate | Where-Object -FilterScript { + $_.StoreType -eq $params.Store + } + + if ($null -eq $spCertificate) + { + Write-Verbose "Correct certificate not found, returning Absent" + $result.Ensure = "Absent" + } + else + { + if ($spCertificate.HasPrivateKey -eq $false -and $isPFX -eq $true) + { + Write-Verbose ("Discovered certificate does not have a private key and the " + ` + "specified CertificateFilePath is a PFX. Returning Absent.") + $result.Ensure = "Absent" + } + else + { + Write-Verbose "Correct certificate found, returning Present" + $result.Store = $spCertificate.StoreType + $result.Exportable = $spCertificate.Exportable + $result.Ensure = "Present" + } + } + } + } + else + { + Write-Verbose "Certificate with thumbprint $thumbprint not found in SharePoint" + $result.Ensure = "Absent" + } + + return $result + } + + return $result +} + +function Set-TargetResource +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $CertificateFilePath, + + [Parameter()] + [System.Management.Automation.PSCredential] + $CertificatePassword, + + [Parameter()] + [ValidateSet('EndEntity', 'Intermediate', 'Pending', 'Root')] + [System.String] + $Store = 'EndEntity', + + [Parameter()] + [System.Boolean] + $Exportable, + + [Parameter()] + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present" + ) + + Write-Verbose -Message "Setting certificate" + + $PSBoundParameters.Store = $Store + $PSBoundParameters.Ensure = $Ensure + + $installedVersion = Get-SPDscInstalledProductVersion + if ($installedVersion.FileMajorPart -lt 16 -or ` + $installedVersion.ProductBuildPart -lt 13000) + { + $message = ("Certificate Management is not available in SharePoint 2019 or earlier") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + + if ((Test-Path -Path $PSBoundParameters.CertificateFilePath) -eq $false) + { + $message = ("CertificateFilePath '$($PSBoundParameters.CertificateFilePath)' not found") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + + # Check for PFX or CER + $file = Get-ChildItem -Path $PSBoundParameters.CertificateFilePath + switch ($file.Extension) + { + ".cer" + { + Write-Verbose "Specified CertificateFilePath is a CER file" + if ($PSBoundParameters.ContainsKey("CertificatePassword")) + { + Write-Verbose ("Specifying a CertificatePassword isn't required when " + ` + "CertificateFilePath is a CER file.") + } + } + ".pfx" + { + Write-Verbose "Specified CertificateFilePath is a PFX file" + if ($PSBoundParameters.ContainsKey("CertificatePassword") -eq $false) + { + Write-Verbose ("CertificatePassword isn't specified, make sure '$PsDscRunAsCredential' " + ` + "has permissions to import the PFX file.") + } + } + default + { + $message = "Unsupported file extension. Please specify a PFX or CER file." + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + } + + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + -ScriptBlock { + $params = $args[0] + $eventSource = $args[1] + + try + { + $null = Get-SPFarm + } + catch + { + $message = "No local SharePoint farm was detected. Antivirus settings will not be applied" + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $eventSource + throw $message + } + + # Check for PFX or CER + Write-Verbose "Reading certificate thumbprint from CertificateFilePath" + $file = Get-ChildItem -Path $params.CertificateFilePath + switch ($file.Extension) + { + ".cer" + { + $isPFX = $false + $certificateObject = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList $params.CertificateFilePath + } + ".pfx" + { + $isPFX = $true + if ($params.ContainsKey("CertificatePassword")) + { + $certificateObject = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList $params.CertificateFilePath, $params.CertificatePassword.Password + } + else + { + $certificateObject = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList $params.CertificateFilePath + } + } + } + + $thumbprint = $certificateObject.Thumbprint + $spCertificate = Get-SPCertificate -Thumbprint $thumbprint -ErrorAction SilentlyContinue + + if ($params.Ensure -eq 'Present') + { + $runImport = $false + if ($null -ne $spCertificate) + { + if ($spCertificate -isnot [Array]) + { + Write-Verbose "Certificate with thumbprint $thumbprint found in SharePoint" + if ($isPFX) + { + if ($spCertificate.HasPrivateKey -eq $false) + { + Write-Verbose -Message ("Discovered certificate does not have a private " + ` + "key and the specified CertificateFilePath is a PFX. Importing PFX.") + $runImport = $true + } + elseif ($params.Store -ne $spCertificate.StoreType) + { + Write-Verbose -Message "Moving certificate to store $($params.Store)" + Move-SPCertificate -Identity $spCertificate -NewStore $params.Store + } + } + else + { + if ($params.Store -ne $spCertificate.StoreType) + { + if ($spCertificate.HasPrivateKey -eq $true) + { + Write-Verbose -Message ("Discovered certificate has a private key, the " + ` + "specified CertificateFilePath is a CER and specified store " + ` + "is different. Importing CER.") + $runImport = $true + } + else + { + Write-Verbose -Message "Moving certificate to store $($params.Store)" + Move-SPCertificate -Identity $spCertificate -NewStore $params.Store + } + } + } + } + else + { + Write-Verbose "Multiple certificates with thumbprint $thumbprint found in SharePoint" + Write-Verbose "Checking for correct certificate" + $spCertificate = $spCertificate | Where-Object -FilterScript { + $_.StoreType -eq $params.Store + } + + if ($null -eq $spCertificate) + { + Write-Verbose "Correct certificate not found, importing certificate" + $runImport = $true + } + else + { + Write-Verbose "Correct certificate found" + if ($spCertificate.HasPrivateKey -eq $false -and $isPFX -eq $true) + { + Write-Verbose ("Discovered certificate does not have a private key and the " + ` + "specified CertificateFilePath is a PFX. Importing PFX.") + $runImport = $true + } + } + } + } + else + { + Write-Verbose "Certificate with thumbprint $thumbprint not found in SharePoint. Importing file." + $runImport = $true + } + + if ($runImport -eq $true) + { + $certParams = @{ + Path = $params.CertificateFilePath + Store = $params.Store + } + + if ($params.ContainsKey("CertificatePassword")) + { + $certParams.Password = $params.CertificatePassword.Password + } + + if ($params.ContainsKey("Exportable")) + { + $certParams.Exportable = $params.Exportable + } + Write-Verbose "Running Import-SPCertificate with parameters: $(Convert-SPDscHashtableToString -Hashtable $certParams)" + Import-SPCertificate @certParams + } + } + else + { + if ($null -ne $spCertificate) + { + Write-Verbose "Certificate with thumbprint $thumbprint found. Removing certificate" + Write-Verbose "Checking for correct certificate store" + $spCertificate = $spCertificate | Where-Object -FilterScript { + $_.StoreType -eq $params.Store + } + + if ($null -ne $spCertificate) + { + Write-Verbose "Correct certificate found, removing certificate" + Remove-SPCertificate -Identity $spCertificate -Confirm:$false + } + else + { + Write-Verbose "Certificate with thumbprint $thumbprint NOT found." + } + } + } + } +} + +function Test-TargetResource +{ + [CmdletBinding()] + [OutputType([System.Boolean])] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $CertificateFilePath, + + [Parameter()] + [System.Management.Automation.PSCredential] + $CertificatePassword, + + [Parameter()] + [ValidateSet('EndEntity', 'Intermediate', 'Pending', 'Root')] + [System.String] + $Store = 'EndEntity', + + [Parameter()] + [System.Boolean] + $Exportable, + + [Parameter()] + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present" + ) + + Write-Verbose -Message "Testing certificate" + + $PSBoundParameters.Store = $Store + $PSBoundParameters.Ensure = $Ensure + + $CurrentValues = Get-TargetResource @PSBoundParameters + + Write-Verbose -Message "Current Values: $(Convert-SPDscHashtableToString -Hashtable $CurrentValues)" + Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" + + if ($Ensure -eq 'Present') + { + $result = Test-SPDscParameterState -CurrentValues $CurrentValues ` + -Source $($MyInvocation.MyCommand.Source) ` + -DesiredValues $PSBoundParameters ` + -ValuesToCheck ( + "Store", + "Ensure" + ) + } + else + { + $result = Test-SPDscParameterState -CurrentValues $CurrentValues ` + -Source $($MyInvocation.MyCommand.Source) ` + -DesiredValues $PSBoundParameters ` + -ValuesToCheck ( + "Ensure" + ) + } + + Write-Verbose -Message "Test-TargetResource returned $result" + + return $result +} + +function Export-TargetResource +{ + $VerbosePreference = "SilentlyContinue" + + $installedVersion = Get-SPDscInstalledProductVersion + if ($installedVersion.FileMajorPart -eq 16 -and ` + $installedVersion.ProductBuildPart -gt 13000) + { + $ParentModuleBase = Get-Module "SharePointDsc" -ListAvailable | Select-Object -ExpandProperty Modulebase + $module = Join-Path -Path $ParentModuleBase -ChildPath "\DSCResources\MSFT_SPCertificate\MSFT_SPCertificate.psm1" -Resolve + + $Content = '' + $params = Get-DSCFakeParameters -ModulePath $module + + $certificates = Get-SPCertificate + + $password = $global:spFarmAccount.Password + + foreach ($certificate in $certificates) + { + $exportPath = Join-Path -Path (Get-Location) -ChildPath ($certificate.Subject -replace 'CN=') + if ($certificate.HasPrivateKey -eq $true -and $certificate.Exportable -eq $true) + { + $exportFilePath = "$exportPath.pfx" + Export-SPCertificate -Identity $certificate -Password $password -Path $exportFilePath -Force + } + else + { + $exportFilePath = "$exportPath.cer" + Export-SPCertificate -Identity $certificate -Type 'Cert' -Path $exportFilePath -Force + } + + $params.CertificateFilePath = $exportFilePath + $params.Store = $certificate.StoreType + + $PartialContent = " SPCertificate " + [System.Guid]::NewGuid().ToString() + "`r`n" + $PartialContent += " {`r`n" + $results = Get-TargetResource @params + $results = Repair-Credentials -results $results + $results.CertificatePassword = Resolve-Credentials -UserName $global:spFarmAccount.UserName + $currentBlock = Get-DSCBlock -Params $results -ModulePath $module + $currentBlock = Convert-DSCStringParamToVariable -DSCBlock $currentBlock -ParameterName "CertificatePassword" + $currentBlock = Convert-DSCStringParamToVariable -DSCBlock $currentBlock -ParameterName "PsDscRunAsCredential" + $PartialContent += $currentBlock + $PartialContent += " }`r`n" + + $Content += $PartialContent + } + + return $Content + } +} + +Export-ModuleMember -Function *-TargetResource diff --git a/SharePointDsc/DSCResources/MSFT_SPCertificate/MSFT_SPCertificate.schema.mof b/SharePointDsc/DSCResources/MSFT_SPCertificate/MSFT_SPCertificate.schema.mof new file mode 100644 index 000000000..95879d77e --- /dev/null +++ b/SharePointDsc/DSCResources/MSFT_SPCertificate/MSFT_SPCertificate.schema.mof @@ -0,0 +1,9 @@ +[ClassVersion("1.0.0.0"), FriendlyName("SPCertificate")] +class MSFT_SPCertificate : OMI_BaseResource +{ + [Key, Description("Specifies path to the certificate file (PFX or CER)")] String CertificateFilePath; + [Write, Description("The password of the PFX file"), EmbeddedInstance("MSFT_Credential")] String CertificatePassword; + [Write, Description("Specifies the store in which the certificate should be placed"), ValueMap{"EndEntity","Intermediate","Pending","Root"}, Values{"EndEntity","Intermediate","Pending","Root"}] String Store; + [Write, Description("Specifies if the certificate should be exportable after import")] Boolean Exportable; + [Write, Description("Present ensures certificate exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; +}; diff --git a/SharePointDsc/DSCResources/MSFT_SPCertificate/readme.md b/SharePointDsc/DSCResources/MSFT_SPCertificate/readme.md new file mode 100644 index 000000000..d1d78b488 --- /dev/null +++ b/SharePointDsc/DSCResources/MSFT_SPCertificate/readme.md @@ -0,0 +1,20 @@ +# Description + +**Type:** Distributed +**Requires CredSSP:** No + +This resource is used to manage SSL certificate in the Certificate Management +solution build into SharePoint Server Subscription Edition. With this resource +you can import new certificates and remove certificates from the store. + +**IMPORTANT:** Certificate PFX files are protected by either a password +or an ACL. So when trying to import the PFX file, you either have to grant +the PsDscRunAsCredential permissions to import the PFX (specify the account +when exporting the certificate to a PFX) or specify the used password via +the CertificatePassword parameter. + +This resource does not check what option you used and will fail importing +the certicate when not using the correct option! + +Exporting a certificate to PFX and using a password: https://docs.microsoft.com/en-us/powershell/module/pki/export-pfxcertificate?view=windowsserver2019-ps#example-1 +Exporting a certificate to PFX and using ACL protection: https://docs.microsoft.com/en-us/powershell/module/pki/export-pfxcertificate?view=windowsserver2019-ps#example-4 diff --git a/SharePointDsc/DSCResources/MSFT_SPCertificateSettings/MSFT_SPCertificateSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPCertificateSettings/MSFT_SPCertificateSettings.psm1 new file mode 100644 index 000000000..5748ab2ea --- /dev/null +++ b/SharePointDsc/DSCResources/MSFT_SPCertificateSettings/MSFT_SPCertificateSettings.psm1 @@ -0,0 +1,425 @@ +function Get-TargetResource +{ + [CmdletBinding()] + [OutputType([System.Collections.Hashtable])] + param + ( + [Parameter(Mandatory = $true)] + [ValidateSet('Yes')] + [System.String] + $IsSingleInstance, + + [Parameter()] + [System.String] + $OrganizationalUnit, + + [Parameter()] + [System.String] + $Organization, + + [Parameter()] + [System.String] + $Locality, + + [Parameter()] + [System.String] + $State, + + [Parameter()] + [ValidateLength(2, 2)] + [System.String] + $Country, + + [Parameter()] + [ValidateSet('ECC', 'RSA')] + [System.String] + $KeyAlgorithm, + + [Parameter()] + [ValidateSet('0', '2048', '4096', '8192', '16384')] + [System.UInt16] + $KeySize, + + [Parameter()] + [ValidateSet('nistP256', 'nistP384', 'nistP521')] + [System.String] + $EllipticCurve, + + [Parameter()] + [ValidateSet('SHA256', 'SHA384', 'SHA512')] + [System.String] + $HashAlgorithm, + + [Parameter()] + [ValidateSet('Pkcs1', 'Pss')] + [System.String] + $RsaSignaturePadding, + + [Parameter()] + [System.UInt32] + $CertificateExpirationAttentionThreshold, + + [Parameter()] + [System.UInt32] + $CertificateExpirationWarningThreshold, + + [Parameter()] + [System.UInt32] + $CertificateExpirationErrorThreshold, + + [Parameter()] + [System.String[]] + $CertificateNotificationContacts + ) + + Write-Verbose -Message "Getting certificate configuration settings" + + $installedVersion = Get-SPDscInstalledProductVersion + if ($installedVersion.FileMajorPart -lt 16 -or ` + $installedVersion.ProductBuildPart -lt 13000) + { + $message = ("Certificate Management is not available in SharePoint 2019 or earlier") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` + -ScriptBlock { + $params = $args[0] + + try + { + $spFarm = Get-SPFarm + } + catch + { + Write-Verbose -Message ("No local SharePoint farm was detected. Certificate " + ` + "settings will not be applied") + return @{ + IsSingleInstance = "Yes" + } + } + + # Get a reference to the Administration WebService + $spCertSettings = Get-SPCertificateSettings + + return @{ + IsSingleInstance = "Yes" + OrganizationalUnit = $spCertSettings.DefaultOrganizationalUnit + Organization = $spCertSettings.DefaultOrganization + Locality = $spCertSettings.DefaultLocality + State = $spCertSettings.DefaultState + Country = $spCertSettings.DefaultCountry + KeyAlgorithm = $spCertSettings.DefaultKeyAlgorithm + KeySize = $spCertSettings.DefaultRsaKeySize + EllipticCurve = $spCertSettings.DefaultEllipticCurve + HashAlgorithm = $spCertSettings.DefaultHashAlgorithm + RsaSignaturePadding = $spCertSettings.DefaultRsaSignaturePadding + CertificateExpirationAttentionThreshold = $spCertSettings.CertificateExpirationAttentionThresholdDays + CertificateExpirationWarningThreshold = $spCertSettings.CertificateExpirationWarningThresholdDays + CertificateExpirationErrorThreshold = $spCertSettings.CertificateExpirationErrorThresholdDays + CertificateNotificationContacts = [array]$spCertSettings.CertificateNotificationContacts.Address + } + } + return $result +} + +function Set-TargetResource +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [ValidateSet('Yes')] + [System.String] + $IsSingleInstance, + + [Parameter()] + [System.String] + $OrganizationalUnit, + + [Parameter()] + [System.String] + $Organization, + + [Parameter()] + [System.String] + $Locality, + + [Parameter()] + [System.String] + $State, + + [Parameter()] + [System.String] + [ValidateLength(2, 2)] + $Country, + + [Parameter()] + [ValidateSet('ECC', 'RSA')] + [System.String] + $KeyAlgorithm, + + [Parameter()] + [ValidateSet('0', '2048', '4096', '8192', '16384')] + [System.UInt16] + $KeySize, + + [Parameter()] + [ValidateSet('nistP256', 'nistP384', 'nistP521')] + [System.String] + $EllipticCurve, + + [Parameter()] + [ValidateSet('SHA256', 'SHA384', 'SHA512')] + [System.String] + $HashAlgorithm, + + [Parameter()] + [ValidateSet('Pkcs1', 'Pss')] + [System.String] + $RsaSignaturePadding, + + [Parameter()] + [System.UInt32] + $CertificateExpirationAttentionThreshold, + + [Parameter()] + [System.UInt32] + $CertificateExpirationWarningThreshold, + + [Parameter()] + [System.UInt32] + $CertificateExpirationErrorThreshold, + + [Parameter()] + [System.String[]] + $CertificateNotificationContacts + ) + + Write-Verbose -Message "Setting certificate configuration settings" + + $installedVersion = Get-SPDscInstalledProductVersion + if ($installedVersion.FileMajorPart -lt 16 -or ` + $installedVersion.ProductBuildPart -lt 13000) + { + $message = ("Certificate Management is not available in SharePoint 2019 or earlier") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + + $CurrentValues = Get-TargetResource @PSBoundParameters + if ($PSBoundParameters.ContainsKey("CertificateExpirationAttentionThreshold")) + { + $certExpAttTheshold = $CertificateExpirationAttentionThreshold + Write-Verbose "Desired CertificateExpirationAttentionThreshold: $certExpAttTheshold" + } + else + { + $certExpAttTheshold = $CurrentValues.CertificateExpirationAttentionThreshold + Write-Verbose "Current CertificateExpirationWarningThreshold: $certExpAttTheshold" + } + + if ($PSBoundParameters.ContainsKey("CertificateExpirationWarningThreshold")) + { + $certExpWarTheshold = $CertificateExpirationWarningThreshold + Write-Verbose "Desired CertificateExpirationWarningThreshold: $certExpWarTheshold" + } + else + { + $certExpWarTheshold = $CurrentValues.CertificateExpirationWarningThreshold + Write-Verbose "Current CertificateExpirationWarningThreshold: $certExpWarTheshold" + } + + if ($certExpAttTheshold -lt $certExpWarTheshold) + { + $message = ("CertificateExpirationAttentionThreshold should be larger " + ` + "than CertificateExpirationWarningThreshold") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + -ScriptBlock { + $params = $args[0] + $eventSource = $args[1] + + try + { + $spFarm = Get-SPFarm + } + catch + { + $message = "No local SharePoint farm was detected. Antivirus settings will not be applied" + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $eventSource + throw $message + } + + $contactsProvided = $false + if ($params.ContainsKey("IsSingleInstance")) + { + $params.Remove("IsSingleInstance") + } + if ($params.ContainsKey("CertificateNotificationContacts")) + { + $contactsProvided = $true + $desiredContacts = $params.CertificateNotificationContacts + $params.Remove("CertificateNotificationContacts") + } + + Write-Verbose "Updating Certificate Settings" + Set-SPCertificateSettings @params + + if ($contactsProvided) + { + Write-Verbose "Checking Certificate Notification Contacts" + $currentContacts = [array](Get-SPCertificateNotificationContact).Address + + $diffs = Compare-Object -ReferenceObject $desiredContacts -DifferenceObject $currentContacts + foreach ($diff in $diffs) + { + switch ($diff.SideIndicator) + { + "<=" + { + Write-Verbose "Adding $($diff.InputObject)" + $null = Add-SPCertificateNotificationContact -EmailAddress $diff.InputObject + } + "=>" + { + Write-Verbose "Removing $($diff.InputObject)" + $null = Remove-SPCertificateNotificationContact -EmailAddress $diff.InputObject -Confirm:$false + } + } + } + } + } +} + +function Test-TargetResource +{ + [CmdletBinding()] + [OutputType([System.Boolean])] + param + ( + [Parameter(Mandatory = $true)] + [ValidateSet('Yes')] + [System.String] + $IsSingleInstance, + + [Parameter()] + [System.String] + $OrganizationalUnit, + + [Parameter()] + [System.String] + $Organization, + + [Parameter()] + [System.String] + $Locality, + + [Parameter()] + [System.String] + $State, + + [Parameter()] + [ValidateLength(2, 2)] + [System.String] + $Country, + + [Parameter()] + [ValidateSet('ECC', 'RSA')] + [System.String] + $KeyAlgorithm, + + [Parameter()] + [ValidateSet('0', '2048', '4096', '8192', '16384')] + [System.UInt16] + $KeySize, + + [Parameter()] + [ValidateSet('nistP256', 'nistP384', 'nistP521')] + [System.String] + $EllipticCurve, + + [Parameter()] + [ValidateSet('SHA256', 'SHA384', 'SHA512')] + [System.String] + $HashAlgorithm, + + [Parameter()] + [ValidateSet('Pkcs1', 'Pss')] + [System.String] + $RsaSignaturePadding, + + [Parameter()] + [System.UInt32] + $CertificateExpirationAttentionThreshold, + + [Parameter()] + [System.UInt32] + $CertificateExpirationWarningThreshold, + + [Parameter()] + [System.UInt32] + $CertificateExpirationErrorThreshold, + + [Parameter()] + [System.String[]] + $CertificateNotificationContacts + ) + + Write-Verbose -Message "Testing certificate configuration settings" + + $CurrentValues = Get-TargetResource @PSBoundParameters + + Write-Verbose -Message "Current Values: $(Convert-SPDscHashtableToString -Hashtable $CurrentValues)" + Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" + + $result = Test-SPDscParameterState -CurrentValues $CurrentValues ` + -Source $($MyInvocation.MyCommand.Source) ` + -DesiredValues $PSBoundParameters + + Write-Verbose -Message "Test-TargetResource returned $result" + + return $result +} + +function Export-TargetResource +{ + $VerbosePreference = "SilentlyContinue" + $ParentModuleBase = Get-Module "SharePointDsc" -ListAvailable | Select-Object -ExpandProperty Modulebase + $module = Join-Path -Path $ParentModuleBase -ChildPath "\DSCResources\MSFT_SPCertificateSettings\MSFT_SPCertificateSettings.psm1" -Resolve + + $Content = '' + $params = Get-DSCFakeParameters -ModulePath $module + $params.Country = "US" + + $PartialContent = " SPCertificateSettings CertificateSettings`r`n" + $PartialContent += " {`r`n" + $results = Get-TargetResource @params + $results = Repair-Credentials -results $results + $currentBlock = Get-DSCBlock -Params $results -ModulePath $module + $currentBlock = Convert-DSCStringParamToVariable -DSCBlock $currentBlock -ParameterName "PsDscRunAsCredential" + $PartialContent += $currentBlock + $PartialContent += " }`r`n" + + $Content += $PartialContent + + return $Content +} + +Export-ModuleMember -Function *-TargetResource diff --git a/SharePointDsc/DSCResources/MSFT_SPCertificateSettings/MSFT_SPCertificateSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPCertificateSettings/MSFT_SPCertificateSettings.schema.mof new file mode 100644 index 000000000..71182e132 --- /dev/null +++ b/SharePointDsc/DSCResources/MSFT_SPCertificateSettings/MSFT_SPCertificateSettings.schema.mof @@ -0,0 +1,19 @@ +[ClassVersion("1.0.0.0"), FriendlyName("SPCertificateSettings")] +class MSFT_SPCertificateSettings : OMI_BaseResource +{ + [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; + [Write, Description("Specifies the default organizational unit")] String OrganizationalUnit; + [Write, Description("Specifies the default organization")] String Organization; + [Write, Description("Specifies the default locality")] String Locality; + [Write, Description("Specifies the default state")] String State; + [Write, Description("Specifies the default country")] String Country; + [Write, Description("Specifies the default key algorithm"), ValueMap{"ECC","RSA"}, Values{"ECC","RSA"}] String KeyAlgorithm; + [Write, Description("Specifies the default key size (Default=2048)"), ValueMap{"0","2048","4096","8192","16384"}, Values{"0","2048","4096","8192","16384"}] Uint16 KeySize; + [Write, Description("Specifies the default elliptic curve (Default=nistP256)"), ValueMap{"nistP256","nistP384","nistP521"}, Values{"nistP256","nistP384","nistP521"}] String EllipticCurve; + [Write, Description("Specifies the default hash algorithm (Default=SHA256"), ValueMap{"SHA256","SHA384","SHA512"}, Values{"SHA256","SHA384","SHA512"}] String HashAlgorithm; + [Write, Description("Specifies the default RSA signature padding (Default=Pkcs1)"), ValueMap{"Pkcs1","Pss"}, Values{"Pkcs1","Pss"}] String RsaSignaturePadding; + [Write, Description("Specifies the certificate expiration attention threshold")] Uint32 CertificateExpirationAttentionThreshold; + [Write, Description("Specifies the certificate expiration warning threshold")] Uint32 CertificateExpirationWarningThreshold; + [Write, Description("Specifies the certificate expiration error threshold")] Uint32 CertificateExpirationErrorThreshold; + [Write, Description("Specifies the certificate notification contacts")] String CertificateNotificationContacts[]; +}; diff --git a/SharePointDsc/DSCResources/MSFT_SPCertificateSettings/readme.md b/SharePointDsc/DSCResources/MSFT_SPCertificateSettings/readme.md new file mode 100644 index 000000000..94a7b319d --- /dev/null +++ b/SharePointDsc/DSCResources/MSFT_SPCertificateSettings/readme.md @@ -0,0 +1,8 @@ +# Description + +**Type:** Distributed +**Requires CredSSP:** No + +This resource is used to set the global certificate settings for the local farm. +These settings will be used by the Certificate Management solution when creating +new certificates. diff --git a/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.psm1 b/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.psm1 index c2f4d1fbf..ac70570e9 100644 --- a/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.psm1 @@ -21,11 +21,7 @@ function Get-TargetResource [Parameter()] [System.String] - $DatabaseUpgradeTime, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DatabaseUpgradeTime ) Write-Verbose -Message "Getting status of Configuration Wizard" @@ -88,11 +84,7 @@ function Set-TargetResource [Parameter()] [System.String] - $DatabaseUpgradeTime, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DatabaseUpgradeTime ) Write-Verbose -Message "Setting status of Configuration Wizard" @@ -112,8 +104,7 @@ function Set-TargetResource # Getting the servers patch status from SharePoint # https://docs.microsoft.com/en-us/dotnet/api/microsoft.sharepoint.administration.spserverproductinfo.statustype - $statusType = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $statusType = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { return Get-SPDscServerPatchStatus } @@ -249,8 +240,7 @@ function Set-TargetResource # Start wizard Write-Verbose -Message "Starting Configuration Wizard" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $psconfigExe ` + $result = Invoke-SPDscCommand -Arguments $psconfigExe ` -ScriptBlock { $psconfigExe = $args[0] @@ -344,11 +334,7 @@ function Test-TargetResource [Parameter()] [System.String] - $DatabaseUpgradeTime, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DatabaseUpgradeTime ) Write-Verbose -Message "Testing status of Configuration Wizard" diff --git a/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.schema.mof b/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.schema.mof index 4b9ea8c21..712b41f66 100644 --- a/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPConfigWizard/MSFT_SPConfigWizard.schema.mof @@ -5,6 +5,4 @@ class MSFT_SPConfigWizard : OMI_BaseResource [Write, Description("Present to run the Configuration Wizard. Absent is currently not supported"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; [Write, Description("Specify on which dates running the Configuration Wizard is allowed"), ValueMap{"mon","tue","wed","thu","fri","sat","sun"}, Values{"mon","tue","wed","thu","fri","sat","sun"}] String DatabaseUpgradeDays[]; [Write, Description("Specify in which time frame running the Configuration Wizard is allowed")] String DatabaseUpgradeTime; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.psm1 b/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.psm1 index 4a0fa2e42..98d08ad60 100644 --- a/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.psm1 @@ -39,17 +39,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting content database configuration settings" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -140,19 +135,14 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting content database configuration settings" $PSBoundParameters.Ensure = $Ensure - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -205,7 +195,7 @@ function Set-TargetResource $newParams = @{ } foreach ($param in $params.GetEnumerator()) { - $skipParams = @("Enabled", "Ensure", "InstallAccount", "MaximumSiteCount", "WebAppUrl") + $skipParams = @("Enabled", "Ensure", "MaximumSiteCount", "WebAppUrl") if ($skipParams -notcontains $param.Key) { @@ -306,7 +296,7 @@ function Set-TargetResource $newParams = @{ } foreach ($param in $params.GetEnumerator()) { - $skipParams = @("Enabled", "Ensure", "InstallAccount", "MaximumSiteCount", "WebAppUrl") + $skipParams = @("Enabled", "Ensure", "MaximumSiteCount", "WebAppUrl") if ($skipParams -notcontains $param.Key) { @@ -420,11 +410,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing content database configuration settings" diff --git a/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.schema.mof b/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.schema.mof index b41f15993..99ec06743 100644 --- a/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPContentDatabase/MSFT_SPContentDatabase.schema.mof @@ -8,8 +8,6 @@ class MSFT_SPContentDatabase : OMI_BaseResource [Write, Description("Specify the site collection warning limit for the content database")] Uint16 WarningSiteCount; [Write, Description("Specify the site collection maximum limit for the content database")] Uint16 MaximumSiteCount; [Write, Description("Present to create this database, absent to ensure it does not exist"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Write, Description("Should SQL Server authentication be used to connect to the database?")] Boolean UseSQLAuthentication; [Write, Description("If using SQL authentication, the SQL credentials to use to connect to the instance"), EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.psm1 b/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.psm1 index 79145fddf..a411cae43 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.psm1 @@ -19,11 +19,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting AAG configuration for $DatabaseName" @@ -45,8 +41,7 @@ function Get-TargetResource if ($Ensure -eq "Present") { Write-Verbose -Message "Database(s) must be included in AAG $AGName" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments ($PSBoundParameters) ` + $result = Invoke-SPDscCommand -Arguments ($PSBoundParameters) ` -ScriptBlock { $params = $args[0] @@ -91,8 +86,7 @@ function Get-TargetResource else { Write-Verbose -Message "Database(s) must not be included in an AAG $AGName" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -150,11 +144,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting AAG configuration for $DatabaseName" @@ -176,12 +166,24 @@ function Set-TargetResource if ($Ensure -eq "Present") { Write-Verbose -Message "Checking AAG settings for $DatabaseName" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] + # Check for SPSE, where cmdlets are renamed + if ((Get-SPDscInstalledProductVersion).FileMajorPart -eq 16 -and ` + (Get-SPDscInstalledProductVersion).FileBuildPart -gt 13000) + { + $addCmd = 'Add-SPDatabaseToAvailabilityGroup' + $removeCmd = 'Remove-SPDatabaseFromAvailabilityGroup' + } + else + { + $addCmd = 'Add-DatabaseToAvailabilityGroup' + $removeCmd = 'Remove-DatabaseFromAvailabilityGroup' + } + $databases = Get-SPDatabase | Where-Object -FilterScript { $_.Name -like $params.DatabaseName } @@ -196,7 +198,7 @@ function Set-TargetResource if ($ag.Name -ne $params.AGName) { # Remove it from the current AAG first - Remove-DatabaseFromAvailabilityGroup -AGName $params.AGName ` + &$removeCmd -AGName $params.AGName ` -DatabaseName $database.Name ` -Force @@ -209,7 +211,7 @@ function Set-TargetResource { $addParams.Add("FileShare", $params.FileShare) } - Add-DatabaseToAvailabilityGroup @addParams + &$addCmd @addParams } } else @@ -223,7 +225,7 @@ function Set-TargetResource { $cmdParams.Add("FileShare", $params.FileShare) } - Add-DatabaseToAvailabilityGroup @cmdParams + &$addCmd @cmdParams } } } @@ -241,12 +243,22 @@ function Set-TargetResource else { Write-Verbose -Message "Removing $DatabaseName from $AGName" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] + # Check for SPSE, where cmdlets are renamed + if ((Get-SPDscInstalledProductVersion).FileMajorPart -eq 16 -and ` + (Get-SPDscInstalledProductVersion).FileBuildPart -gt 13000) + { + $removeCmd = 'Remove-SPDatabaseFromAvailabilityGroup' + } + else + { + $removeCmd = 'Remove-DatabaseFromAvailabilityGroup' + } + $databases = Get-SPDatabase | Where-Object -FilterScript { $_.Name -like $params.DatabaseName } @@ -255,7 +267,7 @@ function Set-TargetResource { foreach ($database in $databases) { - Remove-DatabaseFromAvailabilityGroup -AGName $params.AGName ` + &$removeCmd -AGName $params.AGName ` -DatabaseName $database.Name ` -Force } @@ -294,11 +306,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing AAG configuration for $DatabaseName" diff --git a/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.schema.mof b/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.schema.mof index 48373c974..b02cfa3eb 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPDatabaseAAG/MSFT_SPDatabaseAAG.schema.mof @@ -5,6 +5,4 @@ class MSFT_SPDatabaseAAG : OMI_BaseResource [Required, Description("Name of the AlwaysOn group on the SQL server - this must already exist")] string AGName; [Write, Description("The fileshare to use for the SQL backup when adding to the group")] string FileShare; [Write, Description("Present if the database should be in this AlwaysOn group, or Absent if it should not be in the group"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.psm1 index 9b42d9e9e..c74807785 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.psm1 @@ -39,11 +39,7 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $AllowSaveDeclarativeWorkflowAsTemplate, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AllowSaveDeclarativeWorkflowAsTemplate ) Write-Verbose -Message "Getting SharePoint Designer configuration settings" @@ -52,8 +48,7 @@ function Get-TargetResource { "WebApplication" { - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -115,80 +110,64 @@ function Get-TargetResource } "SiteCollection" { - if ((Test-SPDscRunAsCredential -Credential $InstallAccount) -eq $true) - { - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` - -ScriptBlock { - $params = $args[0] - - $nullReturn = @{ - WebAppUrl = $params.WebAppUrl - SettingsScope = $params.SettingsScope - AllowSharePointDesigner = $null - AllowDetachPagesFromDefinition = $null - AllowCustomiseMasterPage = $null - AllowManageSiteURLStructure = $null - AllowCreateDeclarativeWorkflow = $null - AllowSavePublishDeclarativeWorkflow = $null - AllowSaveDeclarativeWorkflowAsTemplate = $null - } + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` + -ScriptBlock { + $params = $args[0] - try - { - $null = Get-SPFarm - } - catch - { - Write-Verbose -Message ("No local SharePoint farm was detected. " + ` - "SharePoint Designer settings will not be applied") - return $nullReturn - } + $nullReturn = @{ + WebAppUrl = $params.WebAppUrl + SettingsScope = $params.SettingsScope + AllowSharePointDesigner = $null + AllowDetachPagesFromDefinition = $null + AllowCustomiseMasterPage = $null + AllowManageSiteURLStructure = $null + AllowCreateDeclarativeWorkflow = $null + AllowSavePublishDeclarativeWorkflow = $null + AllowSaveDeclarativeWorkflowAsTemplate = $null + } - # Check if site collections exists - $site = Get-SPSite -Identity $params.WebAppUrl -ErrorAction SilentlyContinue - if ($null -eq $site) - { - Write-Verbose -Message ("Site collection not found. SharePoint " + ` - "Designer settings will not be applied") - return $nullReturn - } - else - { - return @{ - # Set the SPD settings - WebAppUrl = $params.WebAppUrl - SettingsScope = $params.SettingsScope - AllowSharePointDesigner = $site.AllowDesigner - AllowDetachPagesFromDefinition = $site.AllowRevertFromTemplate - AllowCustomiseMasterPage = $site.AllowMasterPageEditing - AllowManageSiteURLStructure = $site.ShowURLStructure - AllowCreateDeclarativeWorkflow = $site.AllowCreateDeclarativeWorkflow - AllowSavePublishDeclarativeWorkflow = ` - $site.AllowSavePublishDeclarativeWorkflow - AllowSaveDeclarativeWorkflowAsTemplate = ` - $site.AllowSaveDeclarativeWorkflowAsTemplate - } + try + { + $null = Get-SPFarm + } + catch + { + Write-Verbose -Message ("No local SharePoint farm was detected. " + ` + "SharePoint Designer settings will not be applied") + return $nullReturn + } + + # Check if site collections exists + $site = Get-SPSite -Identity $params.WebAppUrl -ErrorAction SilentlyContinue + if ($null -eq $site) + { + Write-Verbose -Message ("Site collection not found. SharePoint " + ` + "Designer settings will not be applied") + return $nullReturn + } + else + { + return @{ + # Set the SPD settings + WebAppUrl = $params.WebAppUrl + SettingsScope = $params.SettingsScope + AllowSharePointDesigner = $site.AllowDesigner + AllowDetachPagesFromDefinition = $site.AllowRevertFromTemplate + AllowCustomiseMasterPage = $site.AllowMasterPageEditing + AllowManageSiteURLStructure = $site.ShowURLStructure + AllowCreateDeclarativeWorkflow = $site.AllowCreateDeclarativeWorkflow + AllowSavePublishDeclarativeWorkflow = ` + $site.AllowSavePublishDeclarativeWorkflow + AllowSaveDeclarativeWorkflowAsTemplate = ` + $site.AllowSaveDeclarativeWorkflowAsTemplate } } } - else - { - $message = ("A known issue exists that prevents these settings from being managed " + ` - "when InstallAccount is used instead of PsDscRunAsAccount. See " + ` - "http://aka.ms/SharePointDscRemoteIssues for details.") - Add-SPDscEvent -Message $message ` - -EntryType 'Error' ` - -EventID 100 ` - -Source $MyInvocation.MyCommand.Source - throw $message - } } } return $result } - function Set-TargetResource { [CmdletBinding()] @@ -229,11 +208,7 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $AllowSaveDeclarativeWorkflowAsTemplate, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AllowSaveDeclarativeWorkflowAsTemplate ) Write-Verbose -Message "Setting SharePoint Designer configuration settings" @@ -242,8 +217,7 @@ function Set-TargetResource { "WebApplication" { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -319,96 +293,79 @@ function Set-TargetResource } "SiteCollection" { - if ((Test-SPDscRunAsCredential -Credential $InstallAccount) -eq $true) - { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` - -ScriptBlock { - $params = $args[0] - $eventSource = $args[1] - - try + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + -ScriptBlock { + $params = $args[0] + $eventSource = $args[1] + + try + { + $null = Get-SPFarm + } + catch + { + $message = ("No local SharePoint farm was detected. SharePoint Designer " + ` + "settings will not be applied") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $eventSource + throw $message + } + + Write-Verbose -Message "Start update SPD site collection settings" + + # Check if site collection exists + $site = Get-SPSite -Identity $params.WebAppUrl -ErrorAction SilentlyContinue + if ($null -eq $site) + { + $message = ("Site collection not found. SharePoint Designer settings " + ` + "will not be applied") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $eventSource + throw $message + } + else + { + # Set the SharePoint Designer settings + if ($params.ContainsKey("AllowSharePointDesigner")) { - $null = Get-SPFarm + $site.AllowDesigner = $params.AllowSharePointDesigner } - catch + if ($params.ContainsKey("AllowDetachPagesFromDefinition")) { - $message = ("No local SharePoint farm was detected. SharePoint Designer " + ` - "settings will not be applied") - Add-SPDscEvent -Message $message ` - -EntryType 'Error' ` - -EventID 100 ` - -Source $eventSource - throw $message + $site.AllowRevertFromTemplate = $params.AllowDetachPagesFromDefinition } - - Write-Verbose -Message "Start update SPD site collection settings" - - # Check if site collection exists - $site = Get-SPSite -Identity $params.WebAppUrl -ErrorAction SilentlyContinue - if ($null -eq $site) + if ($params.ContainsKey("AllowCustomiseMasterPage")) + { + $site.AllowMasterPageEditing = $params.AllowCustomiseMasterPage + } + if ($params.ContainsKey("AllowManageSiteURLStructure")) + { + $site.ShowURLStructure = $params.AllowManageSiteURLStructure + } + if ($params.ContainsKey("AllowCreateDeclarativeWorkflow")) { - $message = ("Site collection not found. SharePoint Designer settings " + ` - "will not be applied") - Add-SPDscEvent -Message $message ` - -EntryType 'Error' ` - -EventID 100 ` - -Source $eventSource - throw $message + $site.AllowCreateDeclarativeWorkflow = ` + $params.AllowCreateDeclarativeWorkflow } - else + if ($params.ContainsKey("AllowSavePublishDeclarativeWorkflow")) { - # Set the SharePoint Designer settings - if ($params.ContainsKey("AllowSharePointDesigner")) - { - $site.AllowDesigner = $params.AllowSharePointDesigner - } - if ($params.ContainsKey("AllowDetachPagesFromDefinition")) - { - $site.AllowRevertFromTemplate = $params.AllowDetachPagesFromDefinition - } - if ($params.ContainsKey("AllowCustomiseMasterPage")) - { - $site.AllowMasterPageEditing = $params.AllowCustomiseMasterPage - } - if ($params.ContainsKey("AllowManageSiteURLStructure")) - { - $site.ShowURLStructure = $params.AllowManageSiteURLStructure - } - if ($params.ContainsKey("AllowCreateDeclarativeWorkflow")) - { - $site.AllowCreateDeclarativeWorkflow = ` - $params.AllowCreateDeclarativeWorkflow - } - if ($params.ContainsKey("AllowSavePublishDeclarativeWorkflow")) - { - $site.AllowSavePublishDeclarativeWorkflow = ` - $params.AllowSavePublishDeclarativeWorkflow - } - if ($params.ContainsKey("AllowSaveDeclarativeWorkflowAsTemplate")) - { - $site.AllowSaveDeclarativeWorkflowAsTemplate = ` - $params.AllowSaveDeclarativeWorkflowAsTemplate - } + $site.AllowSavePublishDeclarativeWorkflow = ` + $params.AllowSavePublishDeclarativeWorkflow + } + if ($params.ContainsKey("AllowSaveDeclarativeWorkflowAsTemplate")) + { + $site.AllowSaveDeclarativeWorkflowAsTemplate = ` + $params.AllowSaveDeclarativeWorkflowAsTemplate } } } - else - { - $message = ("A known issue exists that prevents these settings from being " + ` - "managed when InstallAccount is used instead of PsDscRunAsAccount. " + ` - "See http://aka.ms/SharePointDscRemoteIssues for details.") - Add-SPDscEvent -Message $message ` - -EntryType 'Error' ` - -EventID 100 ` - -Source $MyInvocation.MyCommand.Source - throw $message - } } } } - - function Test-TargetResource { [CmdletBinding()] @@ -450,11 +407,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $AllowSaveDeclarativeWorkflowAsTemplate, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AllowSaveDeclarativeWorkflowAsTemplate ) Write-Verbose -Message "Testing SharePoint Designer configuration settings" diff --git a/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.schema.mof index 766282c01..6924c3b92 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/MSFT_SPDesignerSettings.schema.mof @@ -10,6 +10,4 @@ class MSFT_SPDesignerSettings : OMI_BaseResource [Write, Description("Allow users to create declarative workflows with SharePoint Designer")] Boolean AllowCreateDeclarativeWorkflow; [Write, Description("Allow users to save and re-publish declarative workflows with SharePoint Designer")] Boolean AllowSavePublishDeclarativeWorkflow; [Write, Description("Allow users to save declarative workflows as a template from SharePoint Designer")] Boolean AllowSaveDeclarativeWorkflowAsTemplate; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/Readme.md b/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/Readme.md index c75b80844..0133714cd 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/Readme.md +++ b/SharePointDsc/DSCResources/MSFT_SPDesignerSettings/Readme.md @@ -12,10 +12,3 @@ Designer to connect to the farm. Settings can be applied against an entire web application, or a specific site collection. Use the "SettingsScope" property to set it to either "WebApplication" or "SiteCollection" to define which you are targetting. - -Known issue: -When using PowerShell v4 or PowerShell v5 with the InstallAccount switch -(instead of PsDscRunAsCredential), you cannot use the SettingsScope -"SiteCollection". Due to an issue with Remote PowerShell and SharePoint, -changing the Site Collection settings results in an Access Denied error. -Consider implementing PowerShell v5 and switching to the PsDscRunAsCredential diff --git a/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.psm1 index 652f41899..50b88509a 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.psm1 @@ -79,17 +79,12 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $ScriptErrorReportingRequireAuth, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ScriptErrorReportingRequireAuth ) Write-Verbose -Message "Getting diagnostic configuration settings" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -228,17 +223,12 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $ScriptErrorReportingRequireAuth, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ScriptErrorReportingRequireAuth ) Write-Verbose -Message "Setting diagnostic configuration settings" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -247,10 +237,6 @@ function Set-TargetResource $params.Remove("IsSingleInstance") | Out-Null } - if ($params.ContainsKey("InstallAccount")) - { - $params.Remove("InstallAccount") | Out-Null - } $params = $params | Rename-SPDscParamValue -OldName "LogPath" ` -NewName "LogLocation" ` | Rename-SPDscParamValue -OldName "LogSpaceInGB" ` @@ -341,11 +327,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $ScriptErrorReportingRequireAuth, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ScriptErrorReportingRequireAuth ) Write-Verbose -Message "Testing diagnostic configuration settings" diff --git a/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.schema.mof index 5686b2d3b..a77a1f827 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPDiagnosticLoggingSettings/MSFT_SPDiagnosticLoggingSettings.schema.mof @@ -20,6 +20,4 @@ class MSFT_SPDiagnosticLoggingSettings : OMI_BaseResource [Write, Description("What delay will be set before script error reporting is triggered")] uint32 ScriptErrorReportingDelay; [Write, Description("Is script error reporting enabled in this farm")] boolean ScriptErrorReportingEnabled; [Write, Description("Require users to be authenticated to allow script errors to be reported")] boolean ScriptErrorReportingRequireAuth; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPDiagnosticsProvider/MSFT_SPDiagnosticsProvider.psm1 b/SharePointDsc/DSCResources/MSFT_SPDiagnosticsProvider/MSFT_SPDiagnosticsProvider.psm1 index ffcac5d87..e02c66d54 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDiagnosticsProvider/MSFT_SPDiagnosticsProvider.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPDiagnosticsProvider/MSFT_SPDiagnosticsProvider.psm1 @@ -20,10 +20,6 @@ function Get-TargetResource [System.Boolean] $Enabled, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [ValidateSet("Present", "Absent")] [System.String] @@ -32,8 +28,7 @@ function Get-TargetResource Write-Verbose -Message "Getting the Diagnostics Provider" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -82,10 +77,6 @@ function Set-TargetResource [System.Boolean] $Enabled, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [ValidateSet("Present", "Absent")] [System.String] @@ -104,8 +95,7 @@ function Set-TargetResource throw $message } - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -167,10 +157,6 @@ function Test-TargetResource [System.Boolean] $Enabled, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [ValidateSet("Present", "Absent")] [System.String] diff --git a/SharePointDsc/DSCResources/MSFT_SPDiagnosticsProvider/MSFT_SPDiagnosticsProvider.schema.mof b/SharePointDsc/DSCResources/MSFT_SPDiagnosticsProvider/MSFT_SPDiagnosticsProvider.schema.mof index 1d7e4e5de..ae0bbe633 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDiagnosticsProvider/MSFT_SPDiagnosticsProvider.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPDiagnosticsProvider/MSFT_SPDiagnosticsProvider.schema.mof @@ -6,5 +6,4 @@ class MSFT_SPDiagnosticsProvider : OMI_BaseResource [Write, Description("Sets the maximum retention size in bytes")] Uint64 MaxTotalSizeInBytes; [Write, Description("True enables the Diagnostics Provider")] Boolean Enabled; [Write, Description("Present to configure the diagnostics provider"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.psm1 index 7461dd126..64fc72fd1 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.psm1 @@ -187,11 +187,7 @@ function Get-TargetResource [Parameter()] [System.UInt32] - $DHSCChannelOpenTimeOut, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DHSCChannelOpenTimeOut ) Write-Verbose -Message "Getting the Distributed Cache Client Settings" @@ -229,8 +225,7 @@ function Get-TargetResource } } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -548,11 +543,7 @@ function Set-TargetResource [Parameter()] [System.UInt32] - $DHSCChannelOpenTimeOut = 20, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DHSCChannelOpenTimeOut = 20 ) Write-Verbose -Message "Setting the Distributed Cache Client Settings" @@ -590,8 +581,7 @@ function Set-TargetResource } } - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -1032,11 +1022,7 @@ function Test-TargetResource [Parameter()] [System.UInt32] - $DHSCChannelOpenTimeOut, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DHSCChannelOpenTimeOut ) Write-Verbose -Message "Testing the Distributed Cache Client Settings" diff --git a/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.schema.mof index 852683162..90accdf0a 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPDistributedCacheClientSettings/MSFT_SPDistributedCacheClientSettings.schema.mof @@ -47,5 +47,4 @@ class MSFT_SPDistributedCacheClientSettings : OMI_BaseResource [Write, Description("Maximum number of connections to the Distributed Health Score Cache (SP2016 and above)")] UInt32 DHSCMaxConnectionsToServer; [Write, Description("Request timeout for the Distributed Health Score Cache (SP2016 and above)")] UInt32 DHSCRequestTimeout; [Write, Description("Channel timeout for the Distributed Health Score Cache (SP2016 and above)")] UInt32 DHSCChannelOpenTimeOut; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.psm1 b/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.psm1 index c796aa08e..c4a99c190 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.psm1 @@ -27,17 +27,12 @@ function Get-TargetResource [Parameter()] [System.String[]] - $ServerProvisionOrder, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ServerProvisionOrder ) Write-Verbose -Message "Getting the cache host information" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $nullReturnValue = @{ @@ -47,24 +42,38 @@ function Get-TargetResource try { - Use-CacheCluster -ErrorAction SilentlyContinue - $cacheHost = Get-CacheHost -ErrorAction SilentlyContinue + $productVersion = Get-SPDscInstalledProductVersion + if ($productVersion.FileMajorPart -eq 16 ` + -and $productVersion.FileBuildPart -gt 13000) + { + Write-Verbose -Message "'Use-CacheCluster' cmdlet not required for SPSE" + Write-Verbose -Message "Using newer 'Get-SPCacheHostConfig' cmdlet for SPSE" + $cacheHostConfig = Get-SPCacheHostConfig -HostName $env:COMPUTERNAME -ErrorAction SilentlyContinue + $cacheHost = Get-SPCacheHost -HostName $cacheHostConfig.HostName -CachePort $cacheHostConfig.CachePort + $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Caching Service (TCP-In)" ` + -ErrorAction SilentlyContinue + } + else + { + Use-CacheCluster -ErrorAction SilentlyContinue + $cacheHost = Get-CacheHost -ErrorAction SilentlyContinue + $computerName = ([System.Net.Dns]::GetHostByName($env:computerName)).HostName + $cachePort = ($cacheHost | Where-Object -FilterScript { + $_.HostName -eq $computerName + }).PortNo + $cacheHostConfig = Get-AFCacheHostConfiguration -ComputerName $computerName ` + -CachePort $cachePort ` + -ErrorAction SilentlyContinue + $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distributed Cache" ` + -ErrorAction SilentlyContinue + } if ($null -eq $cacheHost) { return $nullReturnValue } - $computerName = ([System.Net.Dns]::GetHostByName($env:computerName)).HostName - $cachePort = ($cacheHost | Where-Object -FilterScript { - $_.HostName -eq $computerName - }).PortNo - $cacheHostConfig = Get-AFCacheHostConfiguration -ComputerName $computerName ` - -CachePort $cachePort ` - -ErrorAction SilentlyContinue - - $windowsService = Get-CimInstance -Class Win32_Service -Filter "Name='AppFabricCachingService'" - $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distributed Cache" ` - -ErrorAction SilentlyContinue + + $windowsService = Get-CimInstance -Class Win32_Service -Filter "Name='AppFabricCachingService' OR Name='SPCache'" return @{ Name = $params.Name @@ -112,13 +121,8 @@ function Set-TargetResource [Parameter()] [System.String[]] - $ServerProvisionOrder, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ServerProvisionOrder ) - Write-Verbose -Message "Setting the cache host information" $CurrentState = Get-TargetResource @PSBoundParameters @@ -129,7 +133,7 @@ function Set-TargetResource if ($createFirewallRules -eq $true) { Write-Verbose -Message "Create a firewall rule for AppFabric" - Invoke-SPDscCommand -Credential $InstallAccount -ScriptBlock { + Invoke-SPDscCommand -ScriptBlock { $icmpRuleName = "File and Printer Sharing (Echo Request - ICMPv4-In)" $icmpFirewallRule = Get-NetFirewallRule -DisplayName $icmpRuleName ` -ErrorAction SilentlyContinue @@ -145,20 +149,29 @@ function Set-TargetResource } Enable-NetFirewallRule -DisplayName $icmpRuleName - $spRuleName = "SharePoint Distributed Cache" - $firewallRule = Get-NetFirewallRule -DisplayName $spRuleName ` - -ErrorAction SilentlyContinue - if ($null -eq $firewallRule) + $productVersion = Get-SPDscInstalledProductVersion + if ($productVersion.FileMajorPart -eq 16 ` + -and $productVersion.FileBuildPart -gt 13000) + { + Write-Verbose -Message 'Skipping Firewall Rule creation on SharePoint Server Subscription Edition because Add-SPDistributedCacheServiceInstance will add the Rule "SharePoint Caching Service (TCP-In)"' + } + else { - New-NetFirewallRule -Name "SPDistCache" ` - -DisplayName $spRuleName ` - -Protocol TCP ` - -LocalPort 22233-22236 ` - -Group "SharePoint" + $spRuleName = "SharePoint Distributed Cache" + $firewallRule = Get-NetFirewallRule -DisplayName $spRuleName ` + -ErrorAction SilentlyContinue + if ($null -eq $firewallRule) + { + New-NetFirewallRule -Name "SPDistCache" ` + -DisplayName $spRuleName ` + -Protocol TCP ` + -LocalPort 22233-22236 ` + -Group "SharePoint" + } + Enable-NetFirewallRule -DisplayName $spRuleName + Write-Verbose -Message "Firewall rule added" } - Enable-NetFirewallRule -DisplayName $spRuleName } - Write-Verbose -Message "Firewall rule added" } Write-Verbose -Message ("Current state is '$($CurrentState.Ensure)' " + ` @@ -167,8 +180,7 @@ function Set-TargetResource if ($CurrentState.Ensure -ne $Ensure) { Write-Verbose -Message "Enabling distributed cache service" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -316,7 +328,7 @@ function Set-TargetResource $farm = Get-SPFarm $cacheService = $farm.Services | Where-Object -FilterScript { - $_.Name -eq "AppFabricCachingService" + $_.Name -eq "AppFabricCachingService" -or $_.Name -eq "SPCache" } if ($cacheService.ProcessIdentity.ManagedAccount.Username -ne $params.ServiceAccount) @@ -342,13 +354,12 @@ function Set-TargetResource { if ($CurrentState.ServiceAccount -ne $ServiceAccount.UserName) { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $farm = Get-SPFarm $cacheService = $farm.Services | Where-Object -FilterScript { - $_.Name -eq "AppFabricCachingService" + $_.Name -eq "AppFabricCachingService" -or $_.Name -eq "SPCache" } if ($cacheService.ProcessIdentity.ManagedAccount.Username -ne $params.ServiceAccount) @@ -374,8 +385,7 @@ function Set-TargetResource if ($CurrentState.CacheSizeInMB -ne $CacheSizeInMB) { Write-Verbose -Message "Updating distributed cache service cache size" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -437,7 +447,7 @@ function Set-TargetResource else { Write-Verbose -Message "Removing distributed cache to the server" - Invoke-SPDscCommand -Credential $InstallAccount -ScriptBlock { + Invoke-SPDscCommand -ScriptBlock { Remove-SPDistributedCacheServiceInstance $serviceInstance = Get-SPServiceInstance -Server $env:computername ` @@ -461,7 +471,7 @@ function Set-TargetResource } if ($CreateFirewallRules -eq $true) { - Invoke-SPDscCommand -Credential $InstallAccount -ScriptBlock { + Invoke-SPDscCommand -ScriptBlock { $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distribute Cache" ` -ErrorAction SilentlyContinue if ($null -ne $firewallRule) @@ -504,11 +514,7 @@ function Test-TargetResource [Parameter()] [System.String[]] - $ServerProvisionOrder, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ServerProvisionOrder ) Write-Verbose -Message "Testing the cache host information" diff --git a/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.schema.mof b/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.schema.mof index 58ba7c76b..c9d6e747f 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPDistributedCacheService/MSFT_SPDistributedCacheService.schema.mof @@ -7,5 +7,4 @@ class MSFT_SPDistributedCacheService : OMI_BaseResource [Required, Description("The name of the service account to run the service as. This should already be registered as a managed account in SharePoint")] String ServiceAccount; [Write, Description("A list of servers which specifies the order they should provision the cache in to ensure that two servers do not do it at the same time")] String ServerProvisionOrder[]; [Required, Description("Should the Windows Firewall rules for distributed cache be created?")] Boolean CreateFirewallRules; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPDocIcon/MSFT_SPDocIcon.psm1 b/SharePointDsc/DSCResources/MSFT_SPDocIcon/MSFT_SPDocIcon.psm1 index 5581b0d24..22934a25e 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDocIcon/MSFT_SPDocIcon.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPDocIcon/MSFT_SPDocIcon.psm1 @@ -29,11 +29,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting status of $FileType in 'docicon.xml'" @@ -120,11 +116,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting status of $FileType in 'docicon.xml'" @@ -290,11 +282,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing status of $FileType in 'docicon.xml'" diff --git a/SharePointDsc/DSCResources/MSFT_SPDocIcon/MSFT_SPDocIcon.schema.mof b/SharePointDsc/DSCResources/MSFT_SPDocIcon/MSFT_SPDocIcon.schema.mof index f4f588a10..c04c97cfe 100644 --- a/SharePointDsc/DSCResources/MSFT_SPDocIcon/MSFT_SPDocIcon.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPDocIcon/MSFT_SPDocIcon.schema.mof @@ -6,5 +6,4 @@ class MSFT_SPDocIcon : OMI_BaseResource [Write, Description("Specifies the edit text for the file type")] String EditText; [Write, Description("Specifies the Open Control command for the file type")] String OpenControl; [Write, Description("Present to configure the file type. Absent is remove the file type"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.psm1 index 6d5045d89..8aa73e2d5 100644 --- a/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.psm1 @@ -111,11 +111,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting Excel Services Application '$Name'" @@ -134,8 +130,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $Script:ServiceAppObjectType) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $Script:ServiceAppObjectType) ` -ScriptBlock { $params = $args[0] $serviceAppObjectType = $args[1] @@ -307,11 +302,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting Excel Services Application '$Name'" @@ -334,8 +325,7 @@ function Set-TargetResource if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message "Creating Excel Services Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -348,8 +338,7 @@ function Set-TargetResource if ($Ensure -eq "Present") { Write-Verbose -Message "Updating settings for Excel Services Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -359,7 +348,7 @@ function Set-TargetResource foreach ($key in $params.Keys) { - if ($key -notin @("InstallAccount", "Ensure", "TrustedFileLocations", "Name", "ApplicationPool")) + if ($key -notin @("Ensure", "TrustedFileLocations", "Name", "ApplicationPool")) { $newParams.Add($key, $params.$key) } @@ -380,8 +369,7 @@ function Set-TargetResource if ($null -eq $matchingCurrentValue) { Write-Verbose -Message "Adding trusted location '$($desiredLocation.Address)' to service app" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $desiredLocation, $Script:TrustLocationProperties, $Script:ServiceAppObjectType) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $desiredLocation, $Script:TrustLocationProperties, $Script:ServiceAppObjectType) ` -ScriptBlock { $params = $args[0] $desiredLocation = $args[1] @@ -407,8 +395,7 @@ function Set-TargetResource else { Write-Verbose -Message "Updating trusted location '$($desiredLocation.Address)' in service app" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $desiredLocation, $Script:TrustLocationProperties, $Script:ServiceAppObjectType) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $desiredLocation, $Script:TrustLocationProperties, $Script:ServiceAppObjectType) ` -ScriptBlock { $params = $args[0] $desiredLocation = $args[1] @@ -443,8 +430,7 @@ function Set-TargetResource if ($null -eq $matchingDesiredValue) { Write-Verbose -Message "Removing trusted location '$($currentLocation.Address)' from service app" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($Name, $currentLocation) ` + Invoke-SPDscCommand -Arguments @($Name, $currentLocation) ` -ScriptBlock { $name = $args[0] $currentLocation = $args[1] @@ -459,8 +445,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing Excel Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $Script:ServiceAppObjectType) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $Script:ServiceAppObjectType) ` -ScriptBlock { $params = $args[0] $serviceAppObjectType = $args[1] @@ -572,11 +557,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing Excel Services Application '$Name'" diff --git a/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.schema.mof b/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.schema.mof index 1c447657a..76ace3bb9 100644 --- a/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPExcelServiceApp/MSFT_SPExcelServiceApp.schema.mof @@ -46,5 +46,4 @@ class MSFT_SPExcelServiceApp : OMI_BaseResource [Write, Description("Specifies the local file system location of the cache that is used to store workbooks that are used by Excel Services Application.")] String WorkbookCache; [Write, Description("Specifies the maximum allowable size, in megabytes, of an individual session.")] Uint32 WorkbookCacheSizeMax; [Write, Description("Present ensures service app exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 b/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 index 6febf38d3..f36ccc4db 100644 --- a/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.psm1 @@ -89,11 +89,7 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $SkipRegisterAsDistributedCacheHost = $true, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SkipRegisterAsDistributedCacheHost = $true ) Write-Verbose -Message "Getting the settings of the current local SharePoint Farm (if any)" @@ -138,20 +134,30 @@ function Get-TargetResource Write-Verbose -Message $message } - if ($installedVersion.ProductBuildPart.ToString().Length -eq 4) + $buildVersion = $installedVersion.ProductBuildPart + # SharePoint 2016 + if ($buildVersion -lt 10000) { Write-Verbose -Message "Detected installation of SharePoint 2016" } - else + # SharePoint 2019 + elseif ($buildVersion -ge 10000 -and + $buildVersion -le 12999) { Write-Verbose -Message "Detected installation of SharePoint 2019" $supportsSettingApplicationCredentialKey = $true } + # SharePoint Server Subscription Edition + elseif ($buildVersion -ge 13000) + { + Write-Verbose -Message "Detected installation of SharePoint Server Subscription Edition" + $supportsSettingApplicationCredentialKey = $true + } } default { $message = ("Detected an unsupported major version of SharePoint. SharePointDsc only " + - "supports SharePoint 2013, 2016 or 2019.") + "supports SharePoint 2013, 2016, 2019 and Subscription Edition.") Add-SPDscEvent -Message $message ` -EntryType 'Error' ` -EventID 100 ` @@ -164,7 +170,7 @@ function Get-TargetResource -not $supportsSettingApplicationCredentialKey) { $message = ("Specifying ApplicationCredentialKey is only supported " + - "on SharePoint 2019") + "on SharePoint 2019 and Subscription Edition") Add-SPDscEvent -Message $message ` -EntryType 'Error' ` -EventID 100 ` @@ -175,7 +181,7 @@ function Get-TargetResource if (($PSBoundParameters.ContainsKey("ServerRole") -eq $true) -and $installedVersion.FileMajorPart -ne 16) { - $message = "Server role is only supported in SharePoint 2016 and 2019." + $message = "Server role is only supported in SharePoint 2016, 2019 and Subscription Edition." Add-SPDscEvent -Message $message ` -EntryType 'Error' ` -EventID 100 ` @@ -187,7 +193,7 @@ function Get-TargetResource $installedVersion.FileMajorPart -eq 16 -and $installedVersion.FileBuildPart -lt 4456 -and ($ServerRole -eq "ApplicationWithSearch" -or - $ServerRole -eq "WebFrontEndWithDistributedCache")) + $ServerRole -eq "WebFrontEndWithDistributedCache")) { $message = ("ServerRole values of 'ApplicationWithSearch' or " + "'WebFrontEndWithDistributedCache' require the SharePoint 2016 " + @@ -209,8 +215,7 @@ function Get-TargetResource if ($null -ne $dsnValue) { Write-Verbose -Message "This node has already been connected to a farm" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -452,11 +457,7 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $SkipRegisterAsDistributedCacheHost = $true, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SkipRegisterAsDistributedCacheHost = $true ) Write-Verbose -Message "Setting local SP Farm settings" @@ -542,8 +543,7 @@ function Set-TargetResource if ($CurrentValues.RunCentralAdmin -ne $RunCentralAdmin) { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -626,8 +626,7 @@ function Set-TargetResource # match desired url and port Write-Verbose -Message "Updating Central Admin URL configuration" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -708,8 +707,7 @@ function Set-TargetResource elseif ($CurrentValues.CentralAdministrationPort -ne $CentralAdministrationPort) { Write-Verbose -Message "Updating CentralAdmin port to $CentralAdministrationPort" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -723,8 +721,7 @@ function Set-TargetResource { Write-Verbose -Message ("Updating CentralAdmin authentication method from " + ` "$($CurrentValues.CentralAdministrationAuth) to $CentralAdministrationAuth") - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -740,8 +737,7 @@ function Set-TargetResource if ($CurrentValues.DeveloperDashboard -ne $DeveloperDashboard) { Write-Verbose -Message "Updating DeveloperDashboard to $DeveloperDashboard" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -759,8 +755,7 @@ function Set-TargetResource { Write-Verbose -Message "Server not part of farm, creating or joining farm" - $actionResult = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot) ` + $actionResult = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -863,34 +858,56 @@ function Set-TargetResource { if ($params.ContainsKey("ServerRole") -eq $true) { - if ($installedVersion.ProductBuildPart.ToString().Length -eq 4) + $buildVersion = $installedVersion.ProductBuildPart + # SharePoint 2016 + if ($buildVersion -lt 10000) { Write-Verbose -Message ("Detected Version: SharePoint 2016 - " + "configuring server as $($params.ServerRole)") } - else + # SharePoint 2019 + elseif ($buildVersion -ge 10000 -and + $buildVersion -le 12999) { Write-Verbose -Message ("Detected Version: SharePoint 2019 - " + "configuring server as $($params.ServerRole)") $supportsSettingApplicationCredentialKey = $true } + # SharePoint Server Subscription Edition + elseif ($buildVersion -ge 13000) + { + Write-Verbose -Message ("Detected Version: SharePoint Server Subscription Edition - " + + "configuring server as $($params.ServerRole)") + $supportsSettingApplicationCredentialKey = $true + } $executeArgs.Add("LocalServerRole", $params.ServerRole) } else { - if ($installedVersion.ProductBuildPart.ToString().Length -eq 4) + $buildVersion = $installedVersion.ProductBuildPart + # SharePoint 2016 + if ($buildVersion -lt 10000) { Write-Verbose -Message ("Detected Version: SharePoint 2016 - no server " + "role provided, configuring server without a " + "specific role") } - else + # SharePoint 2019 + elseif ($buildVersion -ge 10000 -and + $buildVersion -le 12999) { Write-Verbose -Message ("Detected Version: SharePoint 2019 - no server " + "role provided, configuring server without a " + "specific role") $supportsSettingApplicationCredentialKey = $true } + # SharePoint Server Subscription Edition + elseif ($buildVersion -ge 13000) + { + Write-Verbose -Message ("Detected Version: SharePoint Server Subscription Edition - " + + "configuring server as $($params.ServerRole)") + $supportsSettingApplicationCredentialKey = $true + } $executeArgs.Add("ServerRoleOptional", $true) } } @@ -898,7 +915,7 @@ function Set-TargetResource { $message = ("An unknown version of SharePoint (Major version $_) " + "was detected. Only versions 15 (SharePoint 2013) and" + - "16 (SharePoint 2016 or SharePoint 2019) are supported.") + "16 (SharePoint 2016, 2019 or Subscription Edition) are supported.") Add-SPDscEvent -Message $message ` -EntryType 'Error' ` -EventID 100 ` @@ -911,7 +928,7 @@ function Set-TargetResource -not $supportsSettingApplicationCredentialKey) { $message = ("Specifying ApplicationCredentialKey is only supported " + - "on SharePoint 2019") + "on SharePoint 2019 or Subscription Edition") Add-SPDscEvent -Message $message ` -EntryType 'Error' ` -EventID 100 ` @@ -993,16 +1010,16 @@ function Set-TargetResource try { Write-Verbose -Message "Connecting to existing Config database" - Write-Verbose -Message "executeArgs is:" + Write-Verbose -Message "Used parameters are:" foreach ($arg in $executeArgs.Keys) { if ($executeArgs.$arg -is [System.Management.Automation.PSCredential]) { - Write-Verbose -Message "$arg : $($executeArgs.$arg.UserName)" + Write-Verbose -Message " $arg : $($executeArgs.$arg.UserName)" } else { - Write-Verbose -Message "$arg : $($executeArgs.$arg)" + Write-Verbose -Message " $arg : $($executeArgs.$arg)" } } @@ -1315,11 +1332,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $SkipRegisterAsDistributedCacheHost = $true, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SkipRegisterAsDistributedCacheHost = $true ) Write-Verbose -Message "Testing local SP Farm settings" @@ -1418,12 +1431,6 @@ function Export-TargetResource $params.Remove("ApplicationCredentialKey") } - <# Can't have both the InstallAccount and PsDscRunAsCredential variables present. Remove InstallAccount if both are there. #> - if ($params.Contains("InstallAccount")) - { - $params.Remove("InstallAccount") - } - $params.FarmAccount = $Global:spFarmAccount $params.Passphrase = $Global:spFarmAccount $results = Get-TargetResource @params diff --git a/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.schema.mof b/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.schema.mof index 6caafee26..4e3fb936f 100644 --- a/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPFarm/MSFT_SPFarm.schema.mof @@ -16,7 +16,6 @@ class MSFT_SPFarm : OMI_BaseResource [Write, Description("Specifies the state of the Developer Dashboard ('OnDemand' is SP2013 only)"), ValueMap{"Off","On","OnDemand"}, Values{"Off","On","OnDemand"}] String DeveloperDashboard; [Write, Description("Specifies the application credential key on the local server. Only supported for SP2019."), EmbeddedInstance("MSFT_Credential")] String ApplicationCredentialKey; [Write, Description("Set to true to not register the server computer as a distributed cache host")] Boolean SkipRegisterAsDistributedCacheHost; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Write, Description("Should SQL Server authentication be used to connect to the database?")] Boolean UseSQLAuthentication; [Write, Description("If using SQL authentication, the SQL login to use to connect to the instance"), EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.psm1 b/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.psm1 index 030c6c8dd..4e0a1d73b 100644 --- a/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.psm1 @@ -19,11 +19,7 @@ function Get-TargetResource [Parameter()] [System.String[]] - $MembersToExclude, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $MembersToExclude ) Write-Verbose -Message "Getting Farm Administrators configuration" @@ -50,8 +46,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -115,11 +110,7 @@ function Set-TargetResource [Parameter()] [System.String[]] - $MembersToExclude, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $MembersToExclude ) Write-Verbose -Message "Setting Farm Administrators configuration" @@ -291,11 +282,7 @@ function Test-TargetResource [Parameter()] [System.String[]] - $MembersToExclude, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $MembersToExclude ) Write-Verbose -Message "Testing Farm Administrators configuration" @@ -418,8 +405,7 @@ function Merge-SPDscFarmAdminList $changeUsers ) - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($changeUsers, $MyInvocation.MyCommand.Source) ` + $null = Invoke-SPDscCommand -Arguments @($changeUsers, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $changeUsers = $args[0] $eventSource = $args[1] diff --git a/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.schema.mof b/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.schema.mof index 7d3c742d0..265b86f98 100644 --- a/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.schema.mof @@ -5,6 +5,4 @@ class MSFT_SPFarmAdministrators : OMI_BaseResource [Write, Description("A list of members to set the group to. Those not in this list will be removed")] String Members[]; [Write, Description("A list of members to add. Members not in this list will be left in the group")] String MembersToInclude[]; [Write, Description("A list of members to remove. Members not in this list will be left in the group")] String MembersToExclude[]; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.psm1 b/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.psm1 index 064b4335f..023b6b572 100644 --- a/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.psm1 @@ -15,17 +15,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = 'Present' ) Write-Verbose -Message "Looking for SPFarm property '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -90,17 +85,12 @@ function Set-TargetResource() [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = 'Present' ) Write-Verbose -Message "Setting SPFarm property '$Name'" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -159,11 +149,7 @@ function Test-TargetResource() [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = 'Present' ) Write-Verbose -Message "Testing SPFarm property '$Name'" diff --git a/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.schema.mof b/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.schema.mof index c9e5c8243..d5437dbf2 100644 --- a/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPFarmPropertyBag/MSFT_SPFarmPropertyBag.schema.mof @@ -4,5 +4,4 @@ class MSFT_SPFarmPropertyBag : OMI_BaseResource [Key, Description("The key of the SPFarm property bag")] string Key; [Write, Description("Value of the SPfarm property bag")] String Value; [Write, Description("Set to present to ensure the SPfarm property exists, or absent to ensure it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.psm1 b/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.psm1 index 8658fef58..08e6680ef 100644 --- a/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.psm1 @@ -32,17 +32,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("14", "15", "All")] [System.String] - $SolutionLevel, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SolutionLevel ) Write-Verbose -Message "Getting farm solution '$Name' settings" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -112,11 +107,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("14", "15", "All")] [System.String] - $SolutionLevel, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SolutionLevel ) Write-Verbose -Message "Setting farm solution '$Name' settings" @@ -133,8 +124,7 @@ function Set-TargetResource { Write-Verbose -Message "Upload solution to the farm." - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -162,8 +152,7 @@ function Set-TargetResource Write-Verbose -Message ("Remove current version " + ` "('$($CurrentValues.Version)') of solution...") - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -192,8 +181,7 @@ function Set-TargetResource Write-Verbose -Message ("Update solution from " + ` "'$($CurrentValues.Version)' to $Version...") - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -233,8 +221,7 @@ function Set-TargetResource if ($CurrentValues.Deployed) { # Retract Solution globally - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -272,8 +259,7 @@ function Set-TargetResource else { # Deploy solution - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -343,15 +329,14 @@ function Set-TargetResource if ($Ensure -eq "Present") { Write-Verbose -Message "Waiting for farm solution '$Name' job" - Wait-SPDscSolutionJob -SolutionName $Name -InstallAccount $InstallAccount + Wait-SPDscSolutionJob -SolutionName $Name } if ($Ensure -eq "Absent" -and $CurrentValues.Ensure -ne "Absent") { Write-Verbose -Message "Removing farm solution '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -401,11 +386,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("14", "15", "All")] [System.String] - $SolutionLevel, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SolutionLevel ) Write-Verbose -Message "Testing farm solution '$Name' settings" @@ -449,11 +430,7 @@ function Wait-SPDscSolutionJob ( [Parameter(Mandatory = $true)] [string] - $SolutionName, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SolutionName ) Start-Sleep -Seconds 5 @@ -462,8 +439,7 @@ function Wait-SPDscSolutionJob Name = $SolutionName } - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $args ` + $null = Invoke-SPDscCommand -Arguments $args ` -ScriptBlock { $params = $args[0] diff --git a/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.schema.mof b/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.schema.mof index 866f6a411..d36e824c0 100644 --- a/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPFarmSolution/MSFT_SPFarmSolution.schema.mof @@ -8,5 +8,4 @@ class MSFT_SPFarmSolution : OMI_BaseResource [Write, Description("The version of the package that is being modified")] string Version; [Write, Description("Should the solution be deployed to the farm, or just installed to the farm")] Boolean Deployed; [Write, Description("What compatability level should the WSP be deployed as?"), ValueMap{"14","15","All"}, Values{"14","15","All"}] string SolutionLevel; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.psm1 b/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.psm1 index 84419f6b3..26b2267a2 100644 --- a/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.psm1 @@ -17,10 +17,6 @@ function Get-TargetResource [System.String] $FeatureScope, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [ValidateSet("Present", "Absent")] [System.String] @@ -33,8 +29,7 @@ function Get-TargetResource Write-Verbose -Message "Getting feature $Name at $FeatureScope scope" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -90,10 +85,6 @@ function Set-TargetResource [System.String] $FeatureScope, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [ValidateSet("Present", "Absent")] [System.String] @@ -113,8 +104,7 @@ function Set-TargetResource if ($Ensure -eq "Present") { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $currentValues = $params["CurrentValues"] @@ -144,8 +134,7 @@ function Set-TargetResource } if ($Ensure -eq "Absent") { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -187,10 +176,6 @@ function Test-TargetResource [System.String] $FeatureScope, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [ValidateSet("Present", "Absent")] [System.String] @@ -271,12 +256,6 @@ function Export-TargetResource $partialContent = " SPFeature " + [System.Guid]::NewGuid().ToString() + "`r`n" $partialContent += " {`r`n" - <# Manually add the InstallAccount param due to a bug in 1.6.0.0 that returns a param named InstalAccount (typo) instead. - https://github.com/PowerShell/SharePointDsc/issues/481 #> - if ($results.ContainsKey("InstalAccount")) - { - $results.Remove("InstalAccount") - } $results = Repair-Credentials -results $results if ($DependsOn) { diff --git a/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.schema.mof b/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.schema.mof index fa7f3eb87..e7d798d7b 100644 --- a/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPFeature/MSFT_SPFeature.schema.mof @@ -6,5 +6,4 @@ class MSFT_SPFeature : OMI_BaseResource [Key, Description("The URL to change the feature at")] string Url; [Write, Description("Present if the feature is to be enabled, Absent if it is to be disabled"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; [Write, Description("The version of the feature to check against")] string Version; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.psm1 b/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.psm1 index 6586d6f30..7c05d1bf3 100644 --- a/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.psm1 @@ -24,17 +24,12 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $FixAutomatically, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $FixAutomatically ) Write-Verbose -Message "Getting Health Rule configuration settings" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -145,17 +140,12 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $FixAutomatically, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $FixAutomatically ) Write-Verbose -Message "Setting Health Analyzer Rule configuration settings" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -276,11 +266,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $FixAutomatically, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $FixAutomatically ) Write-Verbose -Message "Testing Health Analyzer rule configuration settings" diff --git a/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.schema.mof b/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.schema.mof index 8f9ab1b75..2158e4c35 100644 --- a/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPHealthAnalyzerRuleState/MSFT_SPHealthAnalyzerRuleState.schema.mof @@ -6,5 +6,4 @@ class MSFT_SPHealthAnalyzerRuleState : OMI_BaseResource [Write, Description("What is the scope of this rule"), ValueMap{"All Servers","Any Server"}, Values{"All Servers","Any Server"}] String RuleScope; [Write, Description("How often should the rule check"), ValueMap{"Hourly","Daily","Weekly","Monthly","OnDemandOnly"}, Values{"Hourly","Daily","Weekly","Monthly","OnDemandOnly"}] String Schedule; [Write, Description("Should the rule fix itself automatically")] Boolean FixAutomatically; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPIncomingEmailSettings/MSFT_SPIncomingEmailSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPIncomingEmailSettings/MSFT_SPIncomingEmailSettings.psm1 index 7da154121..c5ff69e0a 100644 --- a/SharePointDsc/DSCResources/MSFT_SPIncomingEmailSettings/MSFT_SPIncomingEmailSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPIncomingEmailSettings/MSFT_SPIncomingEmailSettings.psm1 @@ -49,17 +49,12 @@ function Get-TargetResource [Parameter()] [ValidateNotNullOrEmpty()] [System.String] - $DropFolder, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DropFolder ) Write-Verbose -Message "Getting SharePoint Incoming Email Settings" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -ScriptBlock { + $result = Invoke-SPDscCommand -ScriptBlock { $spEmailServiceInstance = (Get-SPServiceInstance | Where-Object { $_.GetType().FullName -eq "Microsoft.SharePoint.Administration.SPIncomingEmailServiceInstance" }) | Select-Object -First 1 $spEmailService = $spEmailServiceInstance.service @@ -187,11 +182,7 @@ function Set-TargetResource [Parameter()] [ValidateNotNullOrEmpty()] [System.String] - $DropFolder, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DropFolder ) Write-Verbose -Message "Setting SharePoint Incoming Email Settings" @@ -250,8 +241,7 @@ function Set-TargetResource } } - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -393,11 +383,7 @@ function Test-TargetResource [Parameter()] [ValidateNotNullOrEmpty()] [System.String] - $DropFolder, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DropFolder ) Write-Verbose -Message "Testing SharePoint Incoming Email Settings" diff --git a/SharePointDsc/DSCResources/MSFT_SPIncomingEmailSettings/MSFT_SPIncomingEmailSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPIncomingEmailSettings/MSFT_SPIncomingEmailSettings.schema.mof index 34684edc1..e343e7b62 100644 --- a/SharePointDsc/DSCResources/MSFT_SPIncomingEmailSettings/MSFT_SPIncomingEmailSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPIncomingEmailSettings/MSFT_SPIncomingEmailSettings.schema.mof @@ -12,5 +12,4 @@ class MSFT_SPIncomingEmailSettings : OMI_BaseResource [Write, Description("Allow creation of distribution groups from within SharePoint")] Boolean DistributionGroupsEnabled; [Write, Description("Email server display address 'mylist@example.com'")] String ServerDisplayAddress; [Write, Description("Path to email drop folder if not using Automatic Settings")] String DropFolder; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPInfoPathFormsServiceConfig/MSFT_SPInfoPathFormsServiceConfig.psm1 b/SharePointDsc/DSCResources/MSFT_SPInfoPathFormsServiceConfig/MSFT_SPInfoPathFormsServiceConfig.psm1 index 794b8065e..f0acdaf4b 100644 --- a/SharePointDsc/DSCResources/MSFT_SPInfoPathFormsServiceConfig/MSFT_SPInfoPathFormsServiceConfig.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPInfoPathFormsServiceConfig/MSFT_SPInfoPathFormsServiceConfig.psm1 @@ -68,17 +68,12 @@ function Get-TargetResource [Parameter()] [System.UInt16] - $MaxSizeOfUserFormState, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $MaxSizeOfUserFormState ) Write-Verbose -Message "Getting InfoPath Forms Service Configuration" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -197,11 +192,7 @@ function Set-TargetResource [Parameter()] [System.UInt16] - $MaxSizeOfUserFormState, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $MaxSizeOfUserFormState ) Write-Verbose -Message "Setting InfoPath Forms Service Configuration" @@ -217,8 +208,7 @@ function Set-TargetResource throw $message } - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $config = Get-SPInfoPathFormsService @@ -367,11 +357,7 @@ function Test-TargetResource [Parameter()] [System.UInt16] - $MaxSizeOfUserFormState, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $MaxSizeOfUserFormState ) Write-Verbose -Message "Testing the InfoPath Form Services Configuration" diff --git a/SharePointDsc/DSCResources/MSFT_SPInfoPathFormsServiceConfig/MSFT_SPInfoPathFormsServiceConfig.schema.mof b/SharePointDsc/DSCResources/MSFT_SPInfoPathFormsServiceConfig/MSFT_SPInfoPathFormsServiceConfig.schema.mof index d20524425..b32cbfaea 100644 --- a/SharePointDsc/DSCResources/MSFT_SPInfoPathFormsServiceConfig/MSFT_SPInfoPathFormsServiceConfig.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPInfoPathFormsServiceConfig/MSFT_SPInfoPathFormsServiceConfig.schema.mof @@ -17,5 +17,4 @@ class MSFT_SPInfoPathFormsServiceConfig : OMI_BaseResource [Write, Description("Maximum number of actions that can be triggered per postback")] Uint16 MaxUserActionsPerPostback; [Write, Description("Timeout in minutes for active sessions")] Uint16 ActiveSessionsTimeout; [Write, Description("Maximum size of user session data")] Uint16 MaxSizeOfUserFormState; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPInstall/MSFT_SPInstall.psm1 b/SharePointDsc/DSCResources/MSFT_SPInstall/MSFT_SPInstall.psm1 index 48a65a22a..194b722da 100644 --- a/SharePointDsc/DSCResources/MSFT_SPInstall/MSFT_SPInstall.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPInstall/MSFT_SPInstall.psm1 @@ -114,7 +114,7 @@ function Get-TargetResource $installedItems = $installedItemsX86 + $installedItemsX64 $installedItems = $installedItems.DisplayName | Select-Object -Unique $spInstall = $installedItems | Where-Object -FilterScript { - $_ -match "^Microsoft SharePoint Server (2013|2016|2019)$" + $_ -match "^Microsoft SharePoint Server (2013|2016|2019|Subscription Edition)$" } if ($spInstall) @@ -211,7 +211,8 @@ function Set-TargetResource throw $message } - $majorVersion = (Get-SPDscAssemblyVersion -PathToAssembly $InstallerPath) + $majorVersion = Get-SPDscAssemblyVersion -PathToAssembly $InstallerPath + $buildVersion = Get-SPDscBuildVersion -PathToAssembly $InstallerPath if ($majorVersion -eq 15) { $svrsetupDll = Join-Path -Path $BinaryDir -ChildPath "updates\svrsetup.dll" @@ -373,8 +374,16 @@ function Set-TargetResource $setupExe = Join-Path -Path $BinaryDir -ChildPath "setup.exe" + $args = "/config `"$configPath`"" + if ($majorVersion -eq 16 -and $buildVersion -ge 13000) + { + $args += ' /IAcceptTheLicenseTerms' + } + + Write-Verbose -Message "Calling the SharePoint installer" + Write-Verbose -Message "Args for SharePoint installer are: $args" $setup = Start-Process -FilePath $setupExe ` - -ArgumentList "/config `"$configPath`"" ` + -ArgumentList $args ` -Wait ` -PassThru @@ -426,6 +435,15 @@ function Set-TargetResource throw $message } } + 30203 + { + $message = "SharePoint install failed, license terms are not accepted." + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } Default { $message = "SharePoint install failed, exit code was $($setup.ExitCode)" diff --git a/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 b/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 index 482275928..01e37f753 100644 --- a/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 @@ -20,11 +20,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting install status of SharePoint Language Pack" @@ -313,11 +309,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting install status of SharePoint Language Pack" @@ -614,11 +606,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing install status of SharePoint Language Pack" diff --git a/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.schema.mof b/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.schema.mof index aa9bdac47..395cf5b3e 100644 --- a/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.schema.mof @@ -5,6 +5,4 @@ class MSFT_SPInstallLanguagePack : OMI_BaseResource [Write, Description("Specify on which dates the installation is allowed"), ValueMap{"mon","tue","wed","thu","fri","sat","sun"}, Values{"mon","tue","wed","thu","fri","sat","sun"}] String BinaryInstallDays[]; [Write, Description("Specify in which time frame the installation is allowed")] String BinaryInstallTime; [Write, Description("Present to install SharePoint. Absent is currently not supported"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.psm1 b/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.psm1 index de70a7dbc..027c4de0f 100644 --- a/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.psm1 @@ -93,6 +93,18 @@ $Script:SP2019Win19Features = @("Web-Server", "Web-WebServer", "Windows-Identity-Foundation", "WAS", "WAS-Process-Model", "WAS-NET-Environment", "WAS-Config-APIs", "XPS-Viewer") +$Script:SPSEFeatures = @("NET-WCF-Pipe-Activation45", + "NET-WCF-HTTP-Activation45", "NET-WCF-TCP-Activation45", + "Web-Server", "Web-WebServer", "Web-Common-Http", + "Web-Static-Content", "Web-Default-Doc", "Web-Dir-Browsing", + "Web-Http-Errors", "Web-App-Dev", "Web-Asp-Net45", "Web-Net-Ext45", + "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-Performance", "Web-Stat-Compression", "Web-Dyn-Compression", + "WAS", "WAS-Process-Model", "WAS-Config-APIs", "Web-Mgmt-Console", + "Web-Mgmt-Tools") + function Get-TargetResource { [CmdletBinding()] @@ -172,6 +184,10 @@ function Get-TargetResource [System.String] $MSVCRT141, + [Parameter()] + [System.String] + $MSVCRT142, + [Parameter()] [System.String] $KB3092423, @@ -188,6 +204,10 @@ function Get-TargetResource [System.String] $DotNet472, + [Parameter()] + [System.String] + $DotNet48, + [Parameter()] [ValidateSet("Present", "Absent")] [System.String] @@ -265,14 +285,19 @@ function Get-TargetResource } if ($majorVersion -eq 16) { - if ($buildVersion -lt 5000) + if ($buildVersion -lt 10000) { Write-Verbose -Message "Version: SharePoint 2016" } - elseif ($buildVersion -ge 5000) + elseif ($buildVersion -ge 10000 -and + $buildVersion -le 12999) { Write-Verbose -Message "Version: SharePoint 2019" } + elseif ($buildVersion -ge 13000) + { + Write-Verbose -Message "Version: SharePoint Server Subscription Edition" + } } Write-Verbose -Message "Getting installed windows features" @@ -294,7 +319,7 @@ function Get-TargetResource } elseif ($majorVersion -eq 16) { - if ($buildVersion -lt 5000) + if ($buildVersion -lt 10000) { if ($osVersion.Major -eq 10) { @@ -325,7 +350,8 @@ function Get-TargetResource } } # SharePoint 2019 - elseif ($buildVersion -ge 5000) + elseif ($buildVersion -ge 10000 -and + $buildVersion -le 12999) { if ($osVersion.Major -eq 10) { @@ -350,6 +376,41 @@ function Get-TargetResource throw $message } } + # SharePoint Server Subscription Edition + elseif ($buildVersion -ge 13000) + { + if ($osVersion.Major -eq 10) + { + if ($osVersion.Build -eq 17763) + { + Write-Verbose -Message "OS Version: Windows Server 2019" + $WindowsFeatures = Get-WindowsFeature -Name $Script:SPSEFeatures + } + elseif ($osVersion.Build -ge 20000) + { + Write-Verbose -Message "OS Version: Windows Server 2022" + $WindowsFeatures = Get-WindowsFeature -Name $Script:SPSEFeatures + } + else + { + $message = "SharePoint Server Subscription Edition only supports Windows Server 2019 or Windows Server 2022" + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + } + else + { + $message = "SharePoint Server Subscription Edition only supports Windows Server 2019 or Windows Server 2022" + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + } } $windowsFeaturesInstalled = $true @@ -372,74 +433,90 @@ function Get-TargetResource $installedItems = $installedItemsX86 + $installedItemsX64 | Select-Object -Property DisplayName, BundleUpgradeCode, DisplayVersion -Unique - # Common prereqs - $prereqsToTest = @( - [PSObject]@{ - Name = "AppFabric 1.1 for Windows Server" - SearchType = "Equals" - SearchValue = "AppFabric 1.1 for Windows Server" - }, - [PSObject]@{ - Name = "Microsoft CCR and DSS Runtime 2008 R3" - SearchType = "Equals" - SearchValue = "Microsoft CCR and DSS Runtime 2008 R3" - }, - [PSObject]@{ - Name = "Microsoft Identity Extensions" - SearchType = "Equals" - SearchValue = "Microsoft Identity Extensions" - }, - [PSObject]@{ - Name = "Microsoft Sync Framework Runtime v1.0 SP1 (x64)" - SearchType = "Equals" - SearchValue = "Microsoft Sync Framework Runtime v1.0 SP1 (x64)" - }, - [PSObject]@{ - Name = "WCF Data Services 5.6.0 Runtime" - SearchType = "Equals" - SearchValue = "WCF Data Services 5.6.0 Runtime" - } - ) - #SP2013 prereqs if ($majorVersion -eq 15) { - $prereqsToTest += @( + $prereqsToTest = @( [PSObject]@{ Name = "Active Directory Rights Management Services Client 2.*" SearchType = "Like" SearchValue = "Active Directory Rights Management Services Client 2.*" }, + [PSObject]@{ + Name = "AppFabric 1.1 for Windows Server" + SearchType = "Equals" + SearchValue = "AppFabric 1.1 for Windows Server" + }, + [PSObject]@{ + Name = "Microsoft CCR and DSS Runtime 2008 R3" + SearchType = "Equals" + SearchValue = "Microsoft CCR and DSS Runtime 2008 R3" + }, + [PSObject]@{ + Name = "Microsoft Identity Extensions" + SearchType = "Equals" + SearchValue = "Microsoft Identity Extensions" + }, [PSObject]@{ Name = "Microsoft SQL Server Native Client (2008 R2 or 2012)" SearchType = "Match" SearchValue = "SQL Server (2008 R2|2012) Native Client" }, + [PSObject]@{ + Name = "Microsoft Sync Framework Runtime v1.0 SP1 (x64)" + SearchType = "Equals" + SearchValue = "Microsoft Sync Framework Runtime v1.0 SP1 (x64)" + }, [PSObject]@{ Name = "WCF Data Services 5.0 (for OData v3) Primary Components" SearchType = "Equals" SearchValue = "WCF Data Services 5.0 (for OData v3) Primary Components" + }, + [PSObject]@{ + Name = "WCF Data Services 5.6.0 Runtime" + SearchType = "Equals" + SearchValue = "WCF Data Services 5.6.0 Runtime" } ) } - #SP2016/SP2019 prereqs + #SP2016/SP2019/SE prereqs if ($majorVersion -eq 16) { - if ($buildVersion -lt 5000) + if ($buildVersion -lt 10000) { #SP2016 prereqs - $prereqsToTest += @( + $prereqsToTest = @( [PSObject]@{ Name = "Active Directory Rights Management Services Client 2.1" SearchType = "Equals" SearchValue = "Active Directory Rights Management Services Client 2.1" }, + [PSObject]@{ + Name = "AppFabric 1.1 for Windows Server" + SearchType = "Equals" + SearchValue = "AppFabric 1.1 for Windows Server" + }, + [PSObject]@{ + Name = "Microsoft CCR and DSS Runtime 2008 R3" + SearchType = "Equals" + SearchValue = "Microsoft CCR and DSS Runtime 2008 R3" + }, + [PSObject]@{ + Name = "Microsoft Identity Extensions" + SearchType = "Equals" + SearchValue = "Microsoft Identity Extensions" + }, [PSObject]@{ Name = "Microsoft SQL Server 2012 Native Client" SearchType = "Equals" SearchValue = "Microsoft SQL Server 2012 Native Client" }, + [PSObject]@{ + Name = "Microsoft Sync Framework Runtime v1.0 SP1 (x64)" + SearchType = "Equals" + SearchValue = "Microsoft Sync Framework Runtime v1.0 SP1 (x64)" + }, [PSObject]@{ Name = "Microsoft ODBC Driver 11 for SQL Server" SearchType = "Equals" @@ -460,28 +537,71 @@ function Get-TargetResource SearchType = "BundleUpgradeCode" SearchValue = "{C146EF48-4D31-3C3D-A2C5-1E91AF8A0A9B}" MinimumRequiredVersion = "14.0.23026.0" + }, + [PSObject]@{ + Name = "WCF Data Services 5.6.0 Runtime" + SearchType = "Equals" + SearchValue = "WCF Data Services 5.6.0 Runtime" } ) } - elseif ($buildVersion -ge 5000) + elseif ($buildVersion -ge 10000 -and + $buildVersion -le 12999) { #SP2019 prereqs - $prereqsToTest += @( + $prereqsToTest = @( [PSObject]@{ Name = "Active Directory Rights Management Services Client 2.1" SearchType = "Equals" SearchValue = "Active Directory Rights Management Services Client 2.1" }, + [PSObject]@{ + Name = "AppFabric 1.1 for Windows Server" + SearchType = "Equals" + SearchValue = "AppFabric 1.1 for Windows Server" + }, + [PSObject]@{ + Name = "Microsoft CCR and DSS Runtime 2008 R3" + SearchType = "Equals" + SearchValue = "Microsoft CCR and DSS Runtime 2008 R3" + }, + [PSObject]@{ + Name = "Microsoft Identity Extensions" + SearchType = "Equals" + SearchValue = "Microsoft Identity Extensions" + }, [PSObject]@{ Name = "Microsoft SQL Server 2012 Native Client" SearchType = "Equals" SearchValue = "Microsoft SQL Server 2012 Native Client" }, + [PSObject]@{ + Name = "Microsoft Sync Framework Runtime v1.0 SP1 (x64)" + SearchType = "Equals" + SearchValue = "Microsoft Sync Framework Runtime v1.0 SP1 (x64)" + }, [PSObject]@{ Name = "Microsoft Visual C++ 2017 Redistributable (x64)" SearchType = "BundleUpgradeCode" SearchValue = "{C146EF48-4D31-3C3D-A2C5-1E91AF8A0A9B}" MinimumRequiredVersion = "14.13.26020.0" + }, + [PSObject]@{ + Name = "WCF Data Services 5.6.0 Runtime" + SearchType = "Equals" + SearchValue = "WCF Data Services 5.6.0 Runtime" + } + ) + } + elseif ($buildVersion -ge 13000) + { + #SharePoint Server Subscription Edition prereqs + $prereqsToTest = @( + [PSObject]@{ + Name = "Microsoft Visual C++ 2015-2019 Redistributable (x64)" + SearchType = "BundleUpgradeCode" + SearchValue = "{C146EF48-4D31-3C3D-A2C5-1E91AF8A0A9B}" + MinimumRequiredVersion = "14.29.30133.0" } ) } @@ -512,6 +632,7 @@ function Get-TargetResource ODBC = $ODBC DotNetFx = $DotNetFx DotNet472 = $DotNet472 + DotNet48 = $DotNet48 } if ($prereqsInstalled -eq $true -and $windowsFeaturesInstalled -eq $true) @@ -606,6 +727,10 @@ function Set-TargetResource [System.String] $MSVCRT141, + [Parameter()] + [System.String] + $MSVCRT142, + [Parameter()] [System.String] $KB3092423, @@ -622,6 +747,10 @@ function Set-TargetResource [System.String] $DotNet472, + [Parameter()] + [System.String] + $DotNet48, + [Parameter()] [ValidateSet("Present", "Absent")] [System.String] @@ -736,10 +865,14 @@ function Set-TargetResource { Write-Verbose -Message "Operating System: Windows Server 2016" } - else + elseif ($osVersion.Build -eq 17763) { Write-Verbose -Message "Operating System: Windows Server 2019" } + else + { + Write-Verbose -Message "Operating System: Windows Server 2022" + } } } @@ -805,7 +938,7 @@ function Set-TargetResource } elseif ($majorVersion -eq 16) { - if ($buildVersion -lt 5000) + if ($buildVersion -lt 10000) { Write-Verbose -Message "Version: SharePoint 2016" $requiredParams = @("SQLNCli", "Sync", "AppFabric", "IDFX11", "MSIPCClient", "KB3092423", @@ -839,7 +972,8 @@ function Set-TargetResource } } # SharePoint 2019 - elseif ($buildVersion -ge 5000) + elseif ($buildVersion -ge 10000 -and + $buildVersion -le 12999) { Write-Verbose -Message "Version: SharePoint 2019" $requiredParams = @("SQLNCli", "Sync", "AppFabric", "IDFX11", "MSIPCClient", "KB3092423", @@ -868,6 +1002,44 @@ function Set-TargetResource throw $message } } + # SharePoint Server Subscription Edition + elseif ($buildVersion -ge 13000) + { + Write-Verbose -Message "Version: SharePoint Server Subscription Edition" + $requiredParams = @("DotNet48", "MSVCRT142") + + if ($osVersion.Major -eq 10) + { + if ($osVersion.Build -eq 17763) + { + # Server 2019 + $WindowsFeatures = Get-WindowsFeature -Name $Script:SPSEFeatures + } + elseif ($osVersion.Build -ge 20000) + { + # Server 2022 + $WindowsFeatures = Get-WindowsFeature -Name $Script:SPSEFeatures + } + else + { + $message = "SharePoint Server Subscription Edition only supports Windows Server 2019 or Windows Server 2022" + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + } + else + { + $message = "SharePoint Server Subscription Edition only supports Windows Server 2019 or Windows Server 2022" + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + } } # SXSstore for feature install specified, we will manually install features from the @@ -1121,6 +1293,10 @@ function Test-TargetResource [System.String] $MSVCRT141, + [Parameter()] + [System.String] + $MSVCRT142, + [Parameter()] [System.String] $KB3092423, @@ -1137,6 +1313,10 @@ function Test-TargetResource [System.String] $DotNet472, + [Parameter()] + [System.String] + $DotNet48, + [Parameter()] [ValidateSet("Present", "Absent")] [System.String] diff --git a/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.schema.mof b/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.schema.mof index cff318ff0..dfc645288 100644 --- a/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPInstallPrereqs/MSFT_SPInstallPrereqs.schema.mof @@ -22,6 +22,8 @@ class MSFT_SPInstallPrereqs : OMI_BaseResource [Write, Description("The path to the installer for this prerequisite (SP2016 only)")] String ODBC; [Write, Description("The path to the installer for this prerequisite (SP2016 only)")] String DotNetFx; [Write, Description("The path to the installer for this prerequisite (SP2019 only)")] String DotNet472; + [Write, Description("The path to the installer for this prerequisite (SP Subscription Edition only)")] String DotNet48; [Write, Description("The path to the installer for this prerequisite (SP2019 only)")] String MSVCRT141; + [Write, Description("The path to the installer for this prerequisite (SP Subscription Edition only)")] String MSVCRT142; [Write, Description("Present to install the prerequisites. Absent is currently not supported"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.psm1 index b278a6d92..39b1ac0ee 100644 --- a/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.psm1 @@ -20,17 +20,12 @@ function Get-TargetResource [Parameter()] [System.String] - $RMSserver, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $RMSserver ) Write-Verbose "Getting SharePoint IRM Settings" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -94,17 +89,12 @@ function Set-TargetResource [Parameter()] [System.String] - $RMSserver, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $RMSserver ) Write-Verbose "Setting SharePoint IRM Settings" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -178,11 +168,7 @@ function Test-TargetResource [Parameter()] [System.String] - $RMSserver, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $RMSserver ) Write-Verbose "Testing SharePoint IRM settings" diff --git a/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.schema.mof index 09fe3d328..c9e03bf86 100644 --- a/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPIrmSettings/MSFT_SPIrmSettings.schema.mof @@ -5,5 +5,4 @@ class MSFT_SPIrmSettings : OMI_BaseResource [Write, Description("Enable or Disable IRM on this farm"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; [Write, Description("Use the RMS server published in this farm's Active Directory")] Boolean UseADRMS; [Write, Description("Use the specified RMS server, must provide in URL format")] String RMSserver; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPLogLevel/MSFT_SPLogLevel.psm1 b/SharePointDsc/DSCResources/MSFT_SPLogLevel/MSFT_SPLogLevel.psm1 index 15e82b781..8839ddedc 100644 --- a/SharePointDsc/DSCResources/MSFT_SPLogLevel/MSFT_SPLogLevel.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPLogLevel/MSFT_SPLogLevel.psm1 @@ -10,11 +10,7 @@ function Get-TargetResource [Parameter(Mandatory = $true)] [Microsoft.Management.Infrastructure.CimInstance[]] - $SPLogLevelSetting, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SPLogLevelSetting ) @@ -68,8 +64,7 @@ function Get-TargetResource Write-Verbose -Message "Getting SP Log Level Settings for provided Areas" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -155,11 +150,7 @@ function Set-TargetResource [Parameter(Mandatory = $true)] [Microsoft.Management.Infrastructure.CimInstance[]] - $SPLogLevelSetting, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SPLogLevelSetting ) foreach ($DesiredSetting in $SPLogLevelSetting) @@ -217,8 +208,7 @@ function Set-TargetResource Write-Verbose -Message "Setting SP Log Level settings for the provided areas" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -287,11 +277,7 @@ function Test-TargetResource [Parameter(Mandatory = $true)] [Microsoft.Management.Infrastructure.CimInstance[]] - $SPLogLevelSetting, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SPLogLevelSetting ) Write-Verbose -Message "Testing SP Log Level settings for the provided areas" @@ -419,7 +405,7 @@ function Export-TargetResource $currentBlock = Convert-DSCStringParamToVariable -DSCBlock $currentBlock -ParameterName "PsDscRunAsCredential" # Change hashtable format into CIM Instance format - $currentBlock = $currentBlock -replace "@{", "`r`n MSFT_SPLogLevelItem {" -replace "}", "}," -replace ",\);", "`r`n );" -replace "=", "=`"" -replace "; ", "`"; " -replace "}", "`"}" + $currentBlock = $currentBlock -replace "@{", "`r`n MSFT_SPLogLevelItem {" -replace '}', '},' -replace ',\);', "`r`n );" -replace '(\w+)=', '$1="' -replace '; ', '"; ' -replace '}', '"}' $PartialContent += $currentBlock $PartialContent += " }`r`n" diff --git a/SharePointDsc/DSCResources/MSFT_SPLogLevel/MSFT_SPLogLevel.schema.mof b/SharePointDsc/DSCResources/MSFT_SPLogLevel/MSFT_SPLogLevel.schema.mof index 413dea9fc..9d75900d8 100644 --- a/SharePointDsc/DSCResources/MSFT_SPLogLevel/MSFT_SPLogLevel.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPLogLevel/MSFT_SPLogLevel.schema.mof @@ -12,5 +12,4 @@ class MSFT_SPLogLevel : OMI_BaseResource { [Key, Description("Friendly Name used to reference this collection of log level settings")] String Name; [Required, Description("Collection of SPLogLevelItems to set"), EmbeddedInstance("MSFT_SPLogLevelItem")] String SPLogLevelSetting[]; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.psm1 index 116a9e8b6..ff87d80d2 100644 --- a/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.psm1 @@ -35,16 +35,11 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting Machine Translation Service Application '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -138,11 +133,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose "Setting Machine Translation Service Application." @@ -152,8 +143,7 @@ function Set-TargetResource { Write-Verbose "Resetting Machine Translation Service Application." - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] if ($params.UseSQLAuthentication -eq $true) @@ -186,8 +176,7 @@ function Set-TargetResource { Write-Verbose "Creating Machine Translation Service Application." - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -232,8 +221,7 @@ function Set-TargetResource { Write-Verbose "Removing Machine Translation Service Application." - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -288,11 +276,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose "Test Machine Translation Service Application." diff --git a/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.schema.mof b/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.schema.mof index 22b2b480b..6b86466bf 100644 --- a/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPMachineTranslationServiceApp/MSFT_SPMachineTranslationServiceApp.schema.mof @@ -8,8 +8,6 @@ class MSFT_SPMachineTranslationServiceApp : OMI_BaseResource [Required, Description("Specifies the name of the database server for the service application.")] String DatabaseServer; [Required, Description("Specifies the application pool to use with the service application.")] String ApplicationPool; [Write, Description("Present ensures service app exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, EmbeddedInstance("MSFT_Credential"), Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5")] String InstallAccount; [Write, Description("Should SQL Server authentication be used to connect to the database?")] Boolean UseSQLAuthentication; [Write, Description("If using SQL authentication, the SQL credentials to use to connect to the instance"), EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.psm1 b/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.psm1 index 4bd79b9df..d691a0704 100644 --- a/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.psm1 @@ -13,10 +13,6 @@ function Get-TargetResource [System.String] $Ensure = "Present", - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [System.UInt32] $EmailNotification, @@ -36,8 +32,7 @@ function Get-TargetResource Write-Verbose -Message "Getting managed account $AccountName" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -82,10 +77,6 @@ function Set-TargetResource [System.String] $Ensure = "Present", - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [System.UInt32] $EmailNotification, @@ -121,8 +112,7 @@ function Set-TargetResource { Write-Verbose -Message ("Managed account does not exist but should, creating " + ` "the managed account") - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] New-SPManagedAccount -Credential $params.Account @@ -132,8 +122,7 @@ function Set-TargetResource if ($Ensure -eq "Present") { Write-Verbose -Message "Updating settings for managed account" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -158,8 +147,7 @@ function Set-TargetResource else { Write-Verbose -Message "Removing managed account" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] Remove-SPManagedAccount -Identity $params.AccountName -Confirm:$false @@ -182,10 +170,6 @@ function Test-TargetResource [System.String] $Ensure = "Present", - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [System.UInt32] $EmailNotification, diff --git a/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.schema.mof b/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.schema.mof index 881fa8e9c..2aef5b0fa 100644 --- a/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPManagedAccount/MSFT_SPManagedAccount.schema.mof @@ -7,5 +7,4 @@ class MSFT_SPManagedAccount : OMI_BaseResource [Write, Description("How many days before a password expires should it be changed")] Uint32 PreExpireDays; [Write, Description("What is the schedule for the password reset")] string Schedule; [Write, Description("Present ensures managed account exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.psm1 index 7264021f2..4f0c86a87 100644 --- a/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.psm1 @@ -59,17 +59,12 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $ContentTypeSyndicationEnabled, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ContentTypeSyndicationEnabled ) Write-Verbose -Message "Getting managed metadata service application $Name" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -333,11 +328,7 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $ContentTypeSyndicationEnabled, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ContentTypeSyndicationEnabled ) Write-Verbose -Message "Setting managed metadata service application $Name" @@ -358,8 +349,7 @@ function Set-TargetResource if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message "Creating Managed Metadata Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments ($PSBoundParameters, $pName) ` + Invoke-SPDscCommand -Arguments ($PSBoundParameters, $pName) ` -ScriptBlock { $params = $args[0] $pName = $args[1] @@ -404,8 +394,7 @@ function Set-TargetResource $ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating application pool of Managed Metadata Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -422,8 +411,7 @@ function Set-TargetResource if ($pName -ne $result.ProxyName) { Write-Verbose -Message "Updating Managed Metadata Service Application Proxy" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $pName) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $pName) ` -ScriptBlock { $params = $args[0] $pName = $args[1] @@ -464,8 +452,7 @@ function Set-TargetResource -and ($ContentTypeHubUrl.TrimEnd('/') -ne $result.ContentTypeHubUrl.TrimEnd('/'))) { Write-Verbose -Message "Updating Content type hub for Managed Metadata Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -483,8 +470,7 @@ function Set-TargetResource { Write-Verbose -Message "Updating the term store administrators" # Update the term store administrators - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $result, $pName) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $result, $pName) ` -ScriptBlock { $params = $args[0] @@ -567,8 +553,7 @@ function Set-TargetResource { # The lanauge settings should be set to default Write-Verbose -Message "Updating the default language for Managed Metadata Service Application Proxy '$pName'" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $pName) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $pName) ` -ScriptBlock { $params = $args[0] @@ -617,8 +602,7 @@ function Set-TargetResource { Write-Verbose -Message "Updating working languages for Managed Metadata Service Application Proxy '$pName'" # Update the term store working languages - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $result, $pName) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $result, $pName) ` -ScriptBlock { $params = $args[0] @@ -694,8 +678,7 @@ function Set-TargetResource -and ($ContentTypePushdownEnabled -ne $result.ContentTypePushdownEnabled) ) { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $pName) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $pName) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -723,8 +706,7 @@ function Set-TargetResource -and ($ContentTypeSyndicationEnabled -ne $result.ContentTypeSyndicationEnabled) ) { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $pName) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $pName) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -753,8 +735,7 @@ function Set-TargetResource { # The service app should not exit Write-Verbose -Message "Removing Managed Metadata Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -838,11 +819,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $ContentTypeSyndicationEnabled, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ContentTypeSyndicationEnabled ) Write-Verbose -Message "Testing managed metadata service application $Name" diff --git a/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.schema.mof b/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.schema.mof index f165b7728..92634dd84 100644 --- a/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.schema.mof @@ -13,7 +13,6 @@ class MSFT_SPManagedMetaDataServiceApp : OMI_BaseResource [Write, Description("The LCIDs of the working languages (only set when the app is provisioned)")] UInt32 Languages[]; [Write, Description("Specifies that existing instances of changed content types in subsites and libraries will be updated.")] boolean ContentTypePushdownEnabled; [Write, Description("Specifies that this connection will provide access to the content types that are associated with the managed metadata service application.")] boolean ContentTypeSyndicationEnabled; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Write, Description("Should SQL Server authentication be used to connect to the database?")] Boolean UseSQLAuthentication; [Write, Description("If using SQL authentication, the SQL credentials to use to connect to the instance"), EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceAppDefault/MSFT_SPManagedMetadataServiceAppDefault.psm1 b/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceAppDefault/MSFT_SPManagedMetadataServiceAppDefault.psm1 index 14c09eec2..ccbc38fa6 100644 --- a/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceAppDefault/MSFT_SPManagedMetadataServiceAppDefault.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceAppDefault/MSFT_SPManagedMetadataServiceAppDefault.psm1 @@ -14,17 +14,12 @@ function Get-TargetResource [Parameter(Mandatory = $true)] [System.String] - $DefaultKeywordProxyName, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DefaultKeywordProxyName ) Write-Verbose -Message "Getting the default site collection and keyword term store settings" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] @@ -135,17 +130,12 @@ function Set-TargetResource [Parameter(Mandatory = $true)] [System.String] - $DefaultKeywordProxyName, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DefaultKeywordProxyName ) Write-Verbose -Message "Setting the default site collection and keyword term store settings" - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $null = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] @@ -235,11 +225,7 @@ function Test-TargetResource [Parameter(Mandatory = $true)] [System.String] - $DefaultKeywordProxyName, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DefaultKeywordProxyName ) Write-Verbose -Message "Testing the default site collection and keyword term store settings" diff --git a/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceAppDefault/MSFT_SPManagedMetadataServiceAppDefault.schema.mof b/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceAppDefault/MSFT_SPManagedMetadataServiceAppDefault.schema.mof index 2f1da420a..67cf5922e 100644 --- a/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceAppDefault/MSFT_SPManagedMetadataServiceAppDefault.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceAppDefault/MSFT_SPManagedMetadataServiceAppDefault.schema.mof @@ -4,5 +4,4 @@ class MSFT_SPManagedMetaDataServiceAppDefault : OMI_BaseResource [Key, Description("Specifies the Service Application Proxy Group for which to configure the defaults. Use 'default' or the name of the proxy group.")] String ServiceAppProxyGroup; [Required, Description("The name of the managed metadata service application proxy used as default column terms set")] String DefaultSiteCollectionProxyName; [Required, Description("The name of the managed metadata service application proxy used as default keyword terms set")] String DefaultKeywordProxyName; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.psm1 b/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.psm1 index b0baba989..29439ac60 100644 --- a/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.psm1 @@ -23,17 +23,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting managed path $RelativeUrl in $WebAppUrl" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -95,11 +90,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting managed path $RelativeUrl in $WebAppUrl" @@ -109,8 +100,7 @@ function Set-TargetResource if ($CurrentResults.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message "Creating the managed path $RelativeUrl in $WebAppUrl" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -133,8 +123,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing the managed path $RelativeUrl from $WebAppUrl" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -180,11 +169,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing managed path $RelativeUrl in $WebAppUrl" @@ -239,11 +224,7 @@ function Export-TargetResource $params.RelativeUrl = $spManagedPath.Name } $params.WebAppUrl = $spWebApp.Url - $params.HostHeader = $false; - if ($params.Contains("InstallAccount")) - { - $params.Remove("InstallAccount") - } + $params.HostHeader = $false $results = Get-TargetResource @params $results = Repair-Credentials -results $results diff --git a/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.schema.mof b/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.schema.mof index 8964ea01c..cff26c35b 100644 --- a/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPManagedPath/MSFT_SPManagedPath.schema.mof @@ -6,5 +6,4 @@ class MSFT_SPManagedPath : OMI_BaseResource [Required, Description("Should the host header be explicit? If false then it is a wildcard")] boolean Explicit; [Required, Description("Is this a host header web application?")] boolean HostHeader; [Write, Description("Present ensures managed path exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPMinRoleCompliance/MSFT_SPMinRoleCompliance.psm1 b/SharePointDsc/DSCResources/MSFT_SPMinRoleCompliance/MSFT_SPMinRoleCompliance.psm1 index e9b59a942..ec32618f5 100644 --- a/SharePointDsc/DSCResources/MSFT_SPMinRoleCompliance/MSFT_SPMinRoleCompliance.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPMinRoleCompliance/MSFT_SPMinRoleCompliance.psm1 @@ -12,11 +12,7 @@ function Get-TargetResource [Parameter(Mandatory = $true)] [ValidateSet("Compliant", "NonCompliant")] [System.String] - $State, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $State ) Write-Verbose -Message "Getting MinRole compliance for the current farm" @@ -24,7 +20,7 @@ function Get-TargetResource $installedVersion = Get-SPDscInstalledProductVersion if ($installedVersion.FileMajorPart -ne 16) { - $message = "MinRole is only supported in SharePoint 2016 and 2019." + $message = "MinRole is only supported in SharePoint 2016, 2019 and Subscription Edition." Add-SPDscEvent -Message $message ` -EntryType 'Error' ` -EventID 100 ` @@ -32,8 +28,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $nonCompliantServices = Get-SPService | Where-Object -FilterScript { $_.CompliantWithMinRole -eq $false @@ -79,11 +74,7 @@ function Set-TargetResource [Parameter(Mandatory = $true)] [ValidateSet("Compliant", "NonCompliant")] [System.String] - $State, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $State ) Write-Verbose -Message "Setting MinRole compliance for the current farm" @@ -91,7 +82,7 @@ function Set-TargetResource $installedVersion = Get-SPDscInstalledProductVersion if ($installedVersion.FileMajorPart -ne 16) { - $message = "MinRole is only supported in SharePoint 2016 and 2019." + $message = "MinRole is only supported in SharePoint 2016, 2019 and Subscription Edition." Add-SPDscEvent -Message $message ` -EntryType 'Error' ` -EventID 100 ` @@ -110,8 +101,7 @@ function Set-TargetResource throw $message } - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $method = Get-SPDscRoleTestMethod @@ -153,11 +143,7 @@ function Test-TargetResource [Parameter(Mandatory = $true)] [ValidateSet("Compliant", "NonCompliant")] [System.String] - $State, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $State ) Write-Verbose -Message "Testing MinRole compliance for the current farm" diff --git a/SharePointDsc/DSCResources/MSFT_SPMinRoleCompliance/MSFT_SPMinRoleCompliance.schema.mof b/SharePointDsc/DSCResources/MSFT_SPMinRoleCompliance/MSFT_SPMinRoleCompliance.schema.mof index 9c0a4c06f..dee7964fc 100644 --- a/SharePointDsc/DSCResources/MSFT_SPMinRoleCompliance/MSFT_SPMinRoleCompliance.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPMinRoleCompliance/MSFT_SPMinRoleCompliance.schema.mof @@ -3,5 +3,4 @@ class MSFT_SPMinRoleCompliance : OMI_BaseResource { [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; [Required, Description("Should the state be set to compliant"), ValueMap{"Compliant", "NonCompliant"}, Values{"Compliant", "NonCompliant"}] string State; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPOAppPrincipalMgmtServiceAppProxy/MSFT_SPOAppPrincipalMgmtServiceAppProxy.psm1 b/SharePointDsc/DSCResources/MSFT_SPOAppPrincipalMgmtServiceAppProxy/MSFT_SPOAppPrincipalMgmtServiceAppProxy.psm1 index fb4e97fae..b4cb44b46 100644 --- a/SharePointDsc/DSCResources/MSFT_SPOAppPrincipalMgmtServiceAppProxy/MSFT_SPOAppPrincipalMgmtServiceAppProxy.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPOAppPrincipalMgmtServiceAppProxy/MSFT_SPOAppPrincipalMgmtServiceAppProxy.psm1 @@ -15,17 +15,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting SPO application principal management service app proxy '$Name'" - $result = Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -72,11 +67,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting SPO application principal management service app proxy '$Name'" @@ -87,8 +78,7 @@ function Set-TargetResource { # The service app proxy doesn't exist but should Write-Verbose -Message "Creating SPO application principal management service app proxy $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -103,8 +93,7 @@ function Set-TargetResource if ($OnlineTenantUri -ne $result.OnlineTenantUri) { Write-Verbose -Message "Recreating SPO application principal management service app proxy $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -127,8 +116,7 @@ function Set-TargetResource { # The service app proxy should not exit Write-Verbose -Message "Removing SPO application principal management service app proxy $Name" - Invoke-SPDSCCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -159,11 +147,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing SPO application principal management service app proxy '$Name'" diff --git a/SharePointDsc/DSCResources/MSFT_SPOAppPrincipalMgmtServiceAppProxy/MSFT_SPOAppPrincipalMgmtServiceAppProxy.schema.mof b/SharePointDsc/DSCResources/MSFT_SPOAppPrincipalMgmtServiceAppProxy/MSFT_SPOAppPrincipalMgmtServiceAppProxy.schema.mof index ad674c1ad..e21b4706b 100644 --- a/SharePointDsc/DSCResources/MSFT_SPOAppPrincipalMgmtServiceAppProxy/MSFT_SPOAppPrincipalMgmtServiceAppProxy.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPOAppPrincipalMgmtServiceAppProxy/MSFT_SPOAppPrincipalMgmtServiceAppProxy.schema.mof @@ -4,6 +4,4 @@ class MSFT_SPOAppPrincipalMgmtServiceAppProxy : OMI_BaseResource [Key, Description("The name of the SPO application principal management service application proxy")] string Name; [Write, Description("Present ensures service app proxy exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; [Required, Description("URL to SharePoint Online Tenant")] string OnlineTenantUri; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.psm1 b/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.psm1 index 811b1449e..ed1ae4f6b 100644 --- a/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.psm1 @@ -16,17 +16,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting Office Online Server details for '$Zone' zone" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -70,11 +65,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting Office Online Server details for '$Zone' zone" @@ -90,16 +81,14 @@ function Set-TargetResource { Write-Verbose -Message ("Removing bindings for zone '$Zone' so new bindings " + ` "can be added") - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] Get-SPWOPIBinding -WOPIZone $params.Zone | Remove-SPWOPIBinding -Confirm:$false } } Write-Verbose -Message "Creating new bindings for '$DnsName' and setting zone to '$Zone'" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -119,8 +108,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing bindings for zone '$Zone'" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] Get-SPWOPIBinding -WOPIZone $params.Zone | Remove-SPWOPIBinding -Confirm:$false @@ -146,11 +134,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing Office Online Server details for '$Zone' zone" diff --git a/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.schema.mof b/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.schema.mof index 0cb157e00..91c876720 100644 --- a/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerBinding/MSFT_SPOfficeOnlineServerBinding.schema.mof @@ -1,20 +1,7 @@ -/* - -**Example** - - SPOfficeOnlineServerBinding OosBinding - { - Zone = "internal-https" - DnsName = "webapps.contoso.com" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } -*/ [ClassVersion("1.0.0.0"), FriendlyName("SPOfficeOnlineServerBinding")] class MSFT_SPOfficeOnlineServerBinding : OMI_BaseResource { [Key, Description("The zone for this binding"), ValueMap{"Internal-HTTP","Internal-HTTPS","External-HTTP","External-HTTPS"}, Values{"Internal-HTTP","Internal-HTTPS","External-HTTP","External-HTTPS"}] string Zone; [Required, Description("The DNS name of the server/s that are running Office Web Apps")] string DnsName; [Write, Description("Present ensures the binding for this zone exists, absent ensures it doesn't"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerSupressionSettings/MSFT_SPOfficeOnlineServerSupressionSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerSupressionSettings/MSFT_SPOfficeOnlineServerSupressionSettings.psm1 new file mode 100644 index 000000000..5525a8d77 --- /dev/null +++ b/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerSupressionSettings/MSFT_SPOfficeOnlineServerSupressionSettings.psm1 @@ -0,0 +1,231 @@ +function Get-TargetResource +{ + [CmdletBinding()] + [OutputType([System.Collections.Hashtable])] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Extension, + + [Parameter()] + [ValidateSet("attend", "attendservice", "convert", "edit", "editnew", "embedview", "formedit", "formsubmit", "imagepreview", "interactivepreview", "legacywebservice", "mobileView", "preloadedit", "preloadview", "present", "presentservice", "rest", "rtc", "syndicate", "view")] + [System.String[]] + $Actions, + + [Parameter()] + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present" + ) + + Write-Verbose -Message "Getting Office Online Server suppression settings" + + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` + -ScriptBlock { + $params = $args[0] + + $nullreturn = @{ + Extension = $params.Extension + Actions = $null + Ensure = "Absent" + } + + $allSupressed = Get-SPWOPISuppressionSetting + + if ($null -eq $allSupressed) + { + return $nullreturn + } + else + { + $supressedForExtension = $allSupressed | Where-Object -FilterScript { + $_ -like "$($params.Extension) *" + } + + if ($null -eq $supressedForExtension) + { + return $nullreturn + } + + $extensionActions = $supressedForExtension -replace "$($params.Extension) " + return @{ + Extension = $params.Extension + Actions = $extensionActions + Ensure = "Present" + } + } + } + return $result +} + +function Set-TargetResource +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Extension, + + [Parameter()] + [ValidateSet("attend", "attendservice", "convert", "edit", "editnew", "embedview", "formedit", "formsubmit", "imagepreview", "interactivepreview", "legacywebservice", "mobileView", "preloadedit", "preloadview", "present", "presentservice", "rest", "rtc", "syndicate", "view")] + [System.String[]] + $Actions, + + [Parameter()] + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present" + ) + + Write-Verbose -Message "Setting Office Online Server suppression settings" + + $CurrentResults = Get-TargetResource @PSBoundParameters + + if ($Ensure -eq "Present") + { + if ($PSBoundParameters.ContainsKey("Actions") -eq $false) + { + $message = ("You have to specify the Actions parameter if Ensure is not set to Absent") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + + Write-Verbose -Message "Updating supression settings" + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $CurrentResults) ` + -ScriptBlock { + $params = $args[0] + $currentResults = $args[1] + + foreach ($action in $params.Actions) + { + if ($action -notin $currentResults.Actions) + { + Write-Verbose "Adding action $action" + $null = New-SPWOPISuppressionSetting -Extension $params.Extension ` + -Action $action + } + } + + foreach ($action in $currentResults.Actions) + { + if ($action -notin $params.Actions) + { + Write-Verbose "Removing action $action" + Remove-SPWOPISuppressionSetting -Extension $params.Extension ` + -Action $action ` + -Confirm:$false + } + } + } + } + + if ($Ensure -eq "Absent") + { + Write-Verbose -Message "Removing bindings for zone '$Zone'" + Invoke-SPDscCommand -Arguments $CurrentResults ` + -ScriptBlock { + $currentResults = $args[0] + + foreach ($action in $currentResults.Actions) + { + Write-Verbose "Removing action $action" + Remove-SPWOPISuppressionSetting -Extension $currentResults.Extension ` + -Action $action ` + -Confirm:$false + } + } + } +} + +function Test-TargetResource +{ + [CmdletBinding()] + [OutputType([System.Boolean])] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $Extension, + + [Parameter()] + [ValidateSet("attend", "attendservice", "convert", "edit", "editnew", "embedview", "formedit", "formsubmit", "imagepreview", "interactivepreview", "legacywebservice", "mobileView", "preloadedit", "preloadview", "present", "presentservice", "rest", "rtc", "syndicate", "view")] + [System.String[]] + $Actions, + + [Parameter()] + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present" + ) + + Write-Verbose -Message "Testing Office Online Server suppression settings" + + $PSBoundParameters.Ensure = $Ensure + + $CurrentValues = Get-TargetResource @PSBoundParameters + + Write-Verbose -Message "Current Values: $(Convert-SPDscHashtableToString -Hashtable $CurrentValues)" + Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" + + $paramsToCheck = @("Ensure") + if ($Ensure -eq "Present") + { + $paramsToCheck += @("Actions") + } + $result = Test-SPDscParameterState -CurrentValues $CurrentValues ` + -Source $($MyInvocation.MyCommand.Source) ` + -DesiredValues $PSBoundParameters ` + -ValuesToCheck $paramsToCheck + + Write-Verbose -Message "Test-TargetResource returned $result" + + return $result +} + +function Export-TargetResource +{ + $VerbosePreference = "SilentlyContinue" + $allSupressed = Get-SPWOPISuppressionSetting + + $extensions = $allSupressed | ForEach-Object -Process { + ($_ -split " ")[0] + } | Sort-Object -Unique + + try + { + if ($null -ne $allSupressed) + { + $ParentModuleBase = Get-Module "SharePointDsc" -ListAvailable | Select-Object -ExpandProperty Modulebase + $module = Join-Path -Path $ParentModuleBase -ChildPath "\DSCResources\MSFT_SPOfficeOnlineServerSupressionSettings\MSFT_SPOfficeOnlineServerSupressionSettings.psm1" -Resolve + $Content = '' + $params = Get-DSCFakeParameters -ModulePath $module + + foreach ($extension in $extensions) + { + $PartialContent = " SPOfficeOnlineServerSupressionSettings '$extension'`r`n" + $PartialContent += " {`r`n" + $params.Extension = $extension + $results = Get-TargetResource @params + $results = Repair-Credentials -results $results + $currentBlock = Get-DSCBlock -Params $results -ModulePath $module + $currentBlock = Convert-DSCStringParamToVariable -DSCBlock $currentBlock -ParameterName "PsDscRunAsCredential" + $PartialContent += $currentBlock + $PartialContent += " }`r`n" + $Content += $PartialContent + } + } + } + catch + { + $Global:ErrorLog += "[Office Online Server Supression Settings]`r`n" + $Global:ErrorLog += "$_`r`n`r`n" + } + return $Content +} + +Export-ModuleMember -Function *-TargetResource diff --git a/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerSupressionSettings/MSFT_SPOfficeOnlineServerSupressionSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerSupressionSettings/MSFT_SPOfficeOnlineServerSupressionSettings.schema.mof new file mode 100644 index 000000000..a55553745 --- /dev/null +++ b/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerSupressionSettings/MSFT_SPOfficeOnlineServerSupressionSettings.schema.mof @@ -0,0 +1,7 @@ +[ClassVersion("1.0.0.0"), FriendlyName("SPOfficeOnlineServerSupressionSettings")] +class MSFT_SPOfficeOnlineServerSupressionSettings : OMI_BaseResource +{ + [Key, Description("The file extension that needs to be supressed")] string Extension; + [Write, Description("The action that needs to be supressed"), ValueMap{"attend", "attendservice", "convert", "edit", "editnew", "embedview", "formedit", "formsubmit", "imagepreview", "interactivepreview", "legacywebservice", "mobileView", "preloadedit", "preloadview", "present", "presentservice", "rest", "rtc", "syndicate", "view"}, Values{"attend", "attendservice", "convert", "edit", "editnew", "embedview", "formedit", "formsubmit", "imagepreview", "interactivepreview", "legacywebservice", "mobileView", "preloadedit", "preloadview", "present", "presentservice", "rest", "rtc", "syndicate", "view"}] string Actions[]; + [Write, Description("Present ensures the supression for this extension exists, absent ensures it doesn't"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; +}; diff --git a/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerSupressionSettings/readme.md b/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerSupressionSettings/readme.md new file mode 100644 index 000000000..02b05fdab --- /dev/null +++ b/SharePointDsc/DSCResources/MSFT_SPOfficeOnlineServerSupressionSettings/readme.md @@ -0,0 +1,11 @@ +# Description + +**Type:** Distributed +**Requires CredSSP:** No + +This resource will configured the supression settings for Office Online Server +(formerly known as Office Web Apps). With these setting you can specify for +which extensions should Office Online Server not be used to open the file. + +The default value for the Ensure parameter is Present. When not specifying this +parameter, the supression settings are configured. diff --git a/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.psm1 index 63ebe5521..96b42e624 100644 --- a/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.psm1 @@ -30,11 +30,7 @@ function Get-TargetResource [Parameter()] [System.UInt32] - $SMTPPort, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SMTPPort ) Write-Verbose -Message "Getting outgoing email settings configuration for $WebAppUrl" @@ -62,8 +58,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $webApp = Get-SPWebApplication -Identity $params.WebAppUrl ` @@ -134,11 +129,7 @@ function Set-TargetResource [Parameter()] [System.UInt32] - $SMTPPort, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SMTPPort ) Write-Verbose -Message "Setting outgoing email settings configuration for $WebAppUrl" @@ -166,8 +157,7 @@ function Set-TargetResource throw $message } - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $null = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -269,11 +259,7 @@ function Test-TargetResource [Parameter()] [System.UInt32] - $SMTPPort, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SMTPPort ) Write-Verbose -Message "Getting outgoing email settings configuration for $WebAppUrl" diff --git a/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.schema.mof index 25fb7527c..ca5f48172 100644 --- a/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPOutgoingEmailSettings/MSFT_SPOutgoingEmailSettings.schema.mof @@ -8,6 +8,4 @@ class MSFT_SPOutgoingEmailSettings : OMI_BaseResource [Required, Description("The character set to use on messages")] string CharacterSet; [Write, Description("Use TLS when connecting to the SMTP server (SharePoint 2016 and 2019 only)")] boolean UseTLS; [Write, Description("The port which is used to connect to the SMTP server (SharePoint 2016 and 2019 only)")] uint32 SMTPPort; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.psm1 index f9fdebf13..5b10e3eef 100644 --- a/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.psm1 @@ -26,17 +26,12 @@ function Get-TargetResource [Parameter()] [ValidateRange(0, 99)] [System.UInt32] - $NumberOfRetries, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $NumberOfRetries ) Write-Verbose -Message "Getting farm wide automatic password change settings" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $farm = Get-SPFarm if ($null -eq $farm ) @@ -88,17 +83,12 @@ function Set-TargetResource [Parameter()] [ValidateRange(0, 99)] [System.UInt32] - $NumberOfRetries, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $NumberOfRetries ) Write-Verbose -Message "Setting farm wide automatic password change settings" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $farm = Get-SPFarm -ErrorAction Continue @@ -153,11 +143,7 @@ function Test-TargetResource [Parameter()] [ValidateRange(0, 99)] [System.UInt32] - $NumberOfRetries, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $NumberOfRetries ) Write-Verbose -Message "Testing farm wide automatic password change settings" diff --git a/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.schema.mof index a2a93adbb..5bfb38c37 100644 --- a/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPPasswordChangeSettings/MSFT_SPPasswordChangeSettings.schema.mof @@ -6,5 +6,4 @@ class MSFT_SPPasswordChangeSettings : OMI_BaseResource [Write, Description("The number of days before password expiry to send send emails")] Uint32 DaysBeforeExpiry; [Write, Description("The duration that a password reset will wait for before it times out")] Uint32 PasswordChangeWaitTimeSeconds; [Write, Description("How many retries if the password change fails")] Uint32 NumberOfRetries; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.psm1 index e23af5754..77c0125de 100644 --- a/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.psm1 @@ -35,17 +35,26 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting for PerformancePoint Service Application '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $productVersion = Get-SPDscInstalledProductVersion + if ($productVersion.FileMajorPart -eq 16 ` + -and $productVersion.FileBuildPart -gt 13000) + { + $message = ("Since SharePoint Server Subscription Edition the Performance Point Services " + ` + "does no longer exists. See https://docs.microsoft.com/en-us/sharepoint/what-s-new/what-s-deprecated-or-removed-from-sharepoint-server-2019#access-services-2013 " + ` + "for more info.") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -132,22 +141,31 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting PerformancePoint Service Application '$Name'" + $productVersion = Get-SPDscInstalledProductVersion + if ($productVersion.FileMajorPart -eq 16 ` + -and $productVersion.FileBuildPart -gt 13000) + { + $message = ("Since SharePoint Server Subscription Edition the Performance Point Services " + ` + "does no longer exists. See https://docs.microsoft.com/en-us/sharepoint/what-s-new/what-s-deprecated-or-removed-from-sharepoint-server-2019#access-services-2013 " + ` + "for more info.") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + $result = Get-TargetResource @PSBoundParameters if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message "Creating PerformancePoint Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -194,8 +212,7 @@ function Set-TargetResource if ($ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating PerformancePoint Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -211,8 +228,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing PerformancePoint Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -272,11 +288,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing PerformancePoint Service Application '$Name'" @@ -318,10 +330,6 @@ function Export-TargetResource $PartialContent += " {`r`n" $results = Get-TargetResource @params - if ($results.Contains("InstallAccount")) - { - $results.Remove("InstallAccount") - } $results = Repair-Credentials -results $results Add-ConfigurationDataEntry -Node "NonNodeData" -Key "DatabaseServer" -Value $results.DatabaseServer -Description "Name of the Database Server associated with the destination SharePoint Farm;" diff --git a/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.schema.mof b/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.schema.mof index 7e7f6928a..8c6691be1 100644 --- a/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPPerformancePointServiceApp/MSFT_SPPerformancePointServiceApp.schema.mof @@ -7,7 +7,6 @@ class MSFT_SPPerformancePointServiceApp : OMI_BaseResource [Write, Description("The name of the database for the service app")] string DatabaseName; [Write, Description("The name of the database server to host the database")] string DatabaseServer; [Write, Description("Present ensures service app exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Write, Description("Should SQL Server authentication be used to connect to the database?")] Boolean UseSQLAuthentication; [Write, Description("If using SQL authentication, the SQL credentials to use to connect to the instance"), EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.psm1 index 5c1004be2..8ebb0aee1 100644 --- a/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.psm1 @@ -39,11 +39,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting PowerPoint Automation service app '$Name'" @@ -75,8 +71,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication | Where-Object -FilterScript { @@ -173,11 +168,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting PowerPoint Automation service app '$Name'" @@ -212,8 +203,7 @@ function Set-TargetResource if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message "Creating PowerPoint Automation Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -266,8 +256,7 @@ function Set-TargetResource if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") { Write-Verbose -Message "Updating PowerPoint Automation Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $result) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $result) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -353,7 +342,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing PowerPoint Automation Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Invoke-SPDscCommand -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] $serviceApps = Get-SPServiceApplication | Where-Object -FilterScript { @@ -425,11 +414,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure ) Write-Verbose -Message "Testing PowerPoint Automation service app '$Name'" diff --git a/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.schema.mof b/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.schema.mof index 275d6d545..496c7e65a 100644 --- a/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPPowerPointAutomationServiceApp/MSFT_SPPowerPointAutomationServiceApp.schema.mof @@ -10,5 +10,4 @@ class MSFT_SPPowerPointAutomationServiceApp : OMI_BaseResource [Write, Description("Specifies the number of active instances of the conversion worker process on each back-end. This value must be less than the Windows Communication Foundation (WCF) connection limit for this computer. The default value is 3.")] Uint32 WorkerProcessCount; [Write, Description("Specifies the maximum time, in seconds, that a conversion worker process is given for any single conversion. The default is 300 seconds (5 minutes).")] Uint32 WorkerTimeoutInSeconds; [Write, Description("Ensure the crawl rule is Present or Absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, EmbeddedInstance("MSFT_Credential"), Description("POWERSHELL 4 ONLY: The account to run thsi resource as, use PsDscRunAsCredential if using PowerShell 5")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.psm1 b/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.psm1 index 1269a3463..6ef1b7569 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.psm1 @@ -24,11 +24,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) if ($Ensure -eq "Absent") @@ -295,11 +291,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting install status of SP Update binaries" @@ -473,8 +465,7 @@ function Set-TargetResource Write-Verbose -Message "Try to load local Farm" - $farmIsAvailable = Invoke-SPDscCommand -Credential $InstallAccount ` - -ScriptBlock { + $farmIsAvailable = Invoke-SPDscCommand -ScriptBlock { try { $null = Get-SPFarm @@ -506,8 +497,7 @@ function Set-TargetResource $osearchSvc = Get-Service -Name $searchServiceName $hostControllerSvc = Get-Service -Name "SPSearchHostController" - Invoke-SPDscCommand -Credential $InstallAccount ` - -ScriptBlock { + Invoke-SPDscCommand -ScriptBlock { $searchSAs = Get-SPEnterpriseSearchServiceApplication foreach ($searchSA in $searchSAs) { @@ -560,8 +550,7 @@ function Set-TargetResource Write-Verbose -Message "Beginning installation of the SharePoint update" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($SetupFile, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($SetupFile, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $setupFile = $args[0] $eventSource = $args[1] @@ -671,8 +660,7 @@ function Set-TargetResource if ($searchPaused -eq $true) { # Resuming Search Service Application if paused### - Invoke-SPDscCommand -Credential $InstallAccount ` - -ScriptBlock { + Invoke-SPDscCommand -ScriptBlock { $searchSAs = Get-SPEnterpriseSearchServiceApplication foreach ($searchSA in $searchSAs) { @@ -714,11 +702,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing install status of SP Update binaries" diff --git a/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.schema.mof b/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.schema.mof index 6ef8eb628..7145792e3 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPProductUpdate/MSFT_SPProductUpdate.schema.mof @@ -6,6 +6,4 @@ class MSFT_SPProductUpdate : OMI_BaseResource [Write, Description("Specify on which dates the installation is allowed"), ValueMap{"mon","tue","wed","thu","fri","sat","sun"}, Values{"mon","tue","wed","thu","fri","sat","sun"}] String BinaryInstallDays[]; [Write, Description("Specify in which time frame the installation is allowed")] String BinaryInstallTime; [Write, Description("Present to install SharePoint. Absent is currently not supported"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerADResourcePoolSync/MSFT_SPProjectServerADResourcePoolSync.psm1 b/SharePointDsc/DSCResources/MSFT_SPProjectServerADResourcePoolSync/MSFT_SPProjectServerADResourcePoolSync.psm1 index 8151fcacd..97ade72f4 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerADResourcePoolSync/MSFT_SPProjectServerADResourcePoolSync.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerADResourcePoolSync/MSFT_SPProjectServerADResourcePoolSync.psm1 @@ -19,11 +19,7 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $AutoReactivateUsers = $false, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AutoReactivateUsers = $false ) Write-Verbose -Message "Getting AD Resource Pool Sync settings for $Url" @@ -39,8 +35,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -123,11 +118,7 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $AutoReactivateUsers = $false, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AutoReactivateUsers = $false ) Write-Verbose -Message "Setting AD Resource Pool Sync settings for $Url" @@ -145,8 +136,7 @@ function Set-TargetResource if ($Ensure -eq "Present") { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -179,8 +169,7 @@ function Set-TargetResource } else { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -212,11 +201,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $AutoReactivateUsers = $false, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AutoReactivateUsers = $false ) Write-Verbose -Message "Testing AD Resource Pool Sync settings for $Url" diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerADResourcePoolSync/MSFT_SPProjectServerADResourcePoolSync.schema.mof b/SharePointDsc/DSCResources/MSFT_SPProjectServerADResourcePoolSync/MSFT_SPProjectServerADResourcePoolSync.schema.mof index 0c0f531e6..937afa5bd 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerADResourcePoolSync/MSFT_SPProjectServerADResourcePoolSync.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerADResourcePoolSync/MSFT_SPProjectServerADResourcePoolSync.schema.mof @@ -5,5 +5,4 @@ class MSFT_SPProjectServerADResourcePoolSync : OMI_BaseResource [Write, Description("The names of groups in the current domain to sync resources from")] string GroupNames[]; [Write, Description("Should the resource sync process be present or absent for this site?"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; [Write, Description("Should inactive users found in sync be automatically reactiviated?")] boolean AutoReactivateUsers; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerAdditionalSettings/MSFT_SPProjectServerAdditionalSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPProjectServerAdditionalSettings/MSFT_SPProjectServerAdditionalSettings.psm1 index d8e6c85d9..a403d7d10 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerAdditionalSettings/MSFT_SPProjectServerAdditionalSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerAdditionalSettings/MSFT_SPProjectServerAdditionalSettings.psm1 @@ -18,11 +18,7 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $EnforceServerCurrency, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $EnforceServerCurrency ) Write-Verbose -Message "Getting additional settings for $Url" @@ -38,8 +34,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -93,11 +88,7 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $EnforceServerCurrency, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $EnforceServerCurrency ) Write-Verbose -Message "Setting additional settings for $Url" @@ -113,8 +104,7 @@ function Set-TargetResource throw $message } - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -174,11 +164,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $EnforceServerCurrency, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $EnforceServerCurrency ) Write-Verbose -Message "Testing additional settings for $Url" diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerAdditionalSettings/MSFT_SPProjectServerAdditionalSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPProjectServerAdditionalSettings/MSFT_SPProjectServerAdditionalSettings.schema.mof index f0fd20782..1c109aef2 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerAdditionalSettings/MSFT_SPProjectServerAdditionalSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerAdditionalSettings/MSFT_SPProjectServerAdditionalSettings.schema.mof @@ -5,5 +5,4 @@ class MSFT_SPProjectServerAdditionalSettings : OMI_BaseResource [Write, Description("What is the minimum build number for the Project Professional client that can connect?")] string ProjectProfessionalMinBuildNumber; [Write, Description("What is the default server currency?")] string ServerCurrency; [Write, Description("Should all projects be forced to use the server currency?")] boolean EnforceServerCurrency; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerGlobalPermissions/MSFT_SPProjectServerGlobalPermissions.psm1 b/SharePointDsc/DSCResources/MSFT_SPProjectServerGlobalPermissions/MSFT_SPProjectServerGlobalPermissions.psm1 index 710f26cfe..0e8aeb38d 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerGlobalPermissions/MSFT_SPProjectServerGlobalPermissions.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerGlobalPermissions/MSFT_SPProjectServerGlobalPermissions.psm1 @@ -23,11 +23,7 @@ function Get-TargetResource [Parameter()] [System.String[]] - $DenyPermissions, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DenyPermissions ) Write-Verbose -Message "Getting global permissions for $EntityType '$EntityName' at '$Url'" @@ -43,8 +39,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -148,19 +143,14 @@ function Set-TargetResource [Parameter()] [System.String[]] - $DenyPermissions, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DenyPermissions ) Write-Verbose -Message "Setting global permissions for $EntityType '$EntityName' at '$Url'" $currentValues = Get-TargetResource @PSBoundParameters - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot, $currentValues) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $PSScriptRoot, $currentValues) ` -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -345,11 +335,7 @@ function Test-TargetResource [Parameter()] [System.String[]] - $DenyPermissions, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DenyPermissions ) Write-Verbose -Message "Testing global permissions for $EntityType '$EntityName' at '$Url'" diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerGlobalPermissions/MSFT_SPProjectServerGlobalPermissions.schema.mof b/SharePointDsc/DSCResources/MSFT_SPProjectServerGlobalPermissions/MSFT_SPProjectServerGlobalPermissions.schema.mof index 9ae9ed01b..0204b0c8e 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerGlobalPermissions/MSFT_SPProjectServerGlobalPermissions.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerGlobalPermissions/MSFT_SPProjectServerGlobalPermissions.schema.mof @@ -6,5 +6,4 @@ class MSFT_SPProjectServerGlobalPermissions : OMI_BaseResource [Key, Description("What type of entity are you setting permissions for?"), ValueMap{"User","Group"}, Values{"User","Group"}] string EntityType; [Write, Description("What permissions should be allowed for this entity?")] string AllowPermissions[]; [Write, Description("What permissions should be denied for this entity?")] string DenyPermissions[]; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerGroup/MSFT_SPProjectServerGroup.psm1 b/SharePointDsc/DSCResources/MSFT_SPProjectServerGroup/MSFT_SPProjectServerGroup.psm1 index efa4ad9dc..25066ae96 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerGroup/MSFT_SPProjectServerGroup.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerGroup/MSFT_SPProjectServerGroup.psm1 @@ -35,11 +35,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting group settings for '$Name' at '$Url'" @@ -82,8 +78,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -214,11 +209,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting group settings for '$Name' at '$Url'" @@ -227,8 +218,7 @@ function Set-TargetResource if ($Ensure -eq "Present") { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot, $currentSettings) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $PSScriptRoot, $currentSettings) ` -ScriptBlock { $params = $args[0] @@ -331,8 +321,7 @@ function Set-TargetResource } else { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] @@ -400,11 +389,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing group settings for '$Name' at '$Url'" diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerGroup/MSFT_SPProjectServerGroup.schema.mof b/SharePointDsc/DSCResources/MSFT_SPProjectServerGroup/MSFT_SPProjectServerGroup.schema.mof index e132e17e1..536103ec2 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerGroup/MSFT_SPProjectServerGroup.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerGroup/MSFT_SPProjectServerGroup.schema.mof @@ -9,5 +9,4 @@ class MSFT_SPProjectServerGroup : OMI_BaseResource [Write, Description("A list of members to ensure are in this group, cannot be used with ADGroup or Members")] string MembersToInclude[]; [Write, Description("A list of members to ensure are not in this group, cannot be used with ADGroup or Members")] string MembersToExclude[]; [Write, Description("Present if the service app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerLicense/MSFT_SPProjectServerLicense.psm1 b/SharePointDsc/DSCResources/MSFT_SPProjectServerLicense/MSFT_SPProjectServerLicense.psm1 index 322f391be..7786213ec 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerLicense/MSFT_SPProjectServerLicense.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerLicense/MSFT_SPProjectServerLicense.psm1 @@ -16,11 +16,7 @@ function Get-TargetResource [Parameter()] [System.String] - $ProductKey, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ProductKey ) Write-Verbose -Message "Getting license status for Project Server" @@ -36,8 +32,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -115,11 +110,7 @@ function Set-TargetResource [Parameter()] [System.String] - $ProductKey, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ProductKey ) Write-Verbose -Message "Setting Project Server License status" @@ -152,8 +143,7 @@ function Set-TargetResource # License status does not match if ($Ensure -eq "Present") { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -162,8 +152,7 @@ function Set-TargetResource } if ($Ensure -eq "Absent") { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { Disable-ProjectServerLicense @@ -191,11 +180,7 @@ function Test-TargetResource [Parameter()] [System.String] - $ProductKey, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ProductKey ) Write-Verbose -Message "Testing Project Server License status" diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerLicense/MSFT_SPProjectServerLicense.schema.mof b/SharePointDsc/DSCResources/MSFT_SPProjectServerLicense/MSFT_SPProjectServerLicense.schema.mof index eb2660b09..8849adc01 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerLicense/MSFT_SPProjectServerLicense.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerLicense/MSFT_SPProjectServerLicense.schema.mof @@ -4,5 +4,4 @@ class MSFT_SPProjectServerLicense : OMI_BaseResource [Key, Description("Specifies the resource is a single instance, the value must be 'Yes'"), ValueMap{"Yes"}, Values{"Yes"}] String IsSingleInstance; [Write, Description("Should a Project Server license be enabled or disabled"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; [Write, Description("What is the product key for Project Server")] string ProductKey; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerPermissionMode/MSFT_SPProjectServerPermissionMode.psm1 b/SharePointDsc/DSCResources/MSFT_SPProjectServerPermissionMode/MSFT_SPProjectServerPermissionMode.psm1 index ffd404b95..ffa46457f 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerPermissionMode/MSFT_SPProjectServerPermissionMode.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerPermissionMode/MSFT_SPProjectServerPermissionMode.psm1 @@ -11,11 +11,7 @@ function Get-TargetResource [Parameter(Mandatory = $true)] [ValidateSet("SharePoint", "ProjectServer")] [System.String] - $PermissionMode, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $PermissionMode ) Write-Verbose -Message "Getting Project Server permission mode for site '$Url'" @@ -31,8 +27,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -65,11 +60,7 @@ function Set-TargetResource [Parameter(Mandatory = $true)] [ValidateSet("SharePoint", "ProjectServer")] [System.String] - $PermissionMode, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $PermissionMode ) Write-Verbose -Message "Setting Project Server permission mode for site '$Url'" @@ -85,8 +76,7 @@ function Set-TargetResource throw $message } - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -107,11 +97,7 @@ function Test-TargetResource [Parameter(Mandatory = $true)] [ValidateSet("SharePoint", "ProjectServer")] [System.String] - $PermissionMode, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $PermissionMode ) Write-Verbose -Message "Testing Project Server permission mode for site '$Url'" diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerPermissionMode/MSFT_SPProjectServerPermissionMode.schema.mof b/SharePointDsc/DSCResources/MSFT_SPProjectServerPermissionMode/MSFT_SPProjectServerPermissionMode.schema.mof index ea017f713..94665de89 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerPermissionMode/MSFT_SPProjectServerPermissionMode.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerPermissionMode/MSFT_SPProjectServerPermissionMode.schema.mof @@ -3,5 +3,4 @@ class MSFT_SPProjectServerPermissionMode : OMI_BaseResource { [Key, Description("The default zone URL of the Project site to set permissions for")] string Url; [Required, Description("What permission mode should PWA use"), ValueMap{"SharePoint","ProjectServer"}, Values{"SharePoint","ProjectServer"}] string PermissionMode; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerServiceApp/MSFT_SPProjectServerServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPProjectServerServiceApp/MSFT_SPProjectServerServiceApp.psm1 index 7c86aa7ec..d736dc316 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerServiceApp/MSFT_SPProjectServerServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerServiceApp/MSFT_SPProjectServerServiceApp.psm1 @@ -19,11 +19,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting Project Server service app '$Name'" @@ -39,8 +35,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -111,11 +106,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting Project Server service app '$Name'" @@ -136,8 +127,7 @@ function Set-TargetResource if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message "Creating Project Server Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -163,8 +153,7 @@ function Set-TargetResource if ($ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating Project Server Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -181,14 +170,13 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing Project Server service application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $app = Get-SPServiceApplication | Where-Object -FilterScript { $_.Name -eq $params.Name -and ` - $_.GetType().FullName -eq "Microsoft.Office.Project.Server.Administration.PsiServiceApplication" + $_.GetType().FullName -eq "Microsoft.Office.Project.Server.Administration.PsiServiceApplication" } $proxies = Get-SPServiceApplicationProxy @@ -226,11 +214,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing Project Server service app '$Name'" diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerServiceApp/MSFT_SPProjectServerServiceApp.schema.mof b/SharePointDsc/DSCResources/MSFT_SPProjectServerServiceApp/MSFT_SPProjectServerServiceApp.schema.mof index 8721b4a22..48546092d 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerServiceApp/MSFT_SPProjectServerServiceApp.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerServiceApp/MSFT_SPProjectServerServiceApp.schema.mof @@ -5,5 +5,4 @@ class MSFT_SPProjectServerServiceApp : OMI_BaseResource [Required, Description("The name of the application pool to run the service app in")] string ApplicationPool; [Write, Description("The name of the Project Server Service Application Proxy")] string ProxyName; [Write, Description("Present if the service app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerTimeSheetSettings/MSFT_SPProjectServerTimeSheetSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPProjectServerTimeSheetSettings/MSFT_SPProjectServerTimeSheetSettings.psm1 index 41fa53cb4..c4ca42070 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerTimeSheetSettings/MSFT_SPProjectServerTimeSheetSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerTimeSheetSettings/MSFT_SPProjectServerTimeSheetSettings.psm1 @@ -86,11 +86,7 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $ForceTrackingModeForAllProjects, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ForceTrackingModeForAllProjects ) Write-Verbose -Message "Getting Timesheet settings for $Url" @@ -106,8 +102,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -345,11 +340,7 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $ForceTrackingModeForAllProjects, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ForceTrackingModeForAllProjects ) Write-Verbose -Message "Setting Timesheet settings for $Url" @@ -365,8 +356,7 @@ function Set-TargetResource throw $message } - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -613,11 +603,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $ForceTrackingModeForAllProjects, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ForceTrackingModeForAllProjects ) Write-Verbose -Message "Testing Timesheet settings for $Url" diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerTimeSheetSettings/MSFT_SPProjectServerTimeSheetSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPProjectServerTimeSheetSettings/MSFT_SPProjectServerTimeSheetSettings.schema.mof index a47dd316b..e1998c9ba 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerTimeSheetSettings/MSFT_SPProjectServerTimeSheetSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerTimeSheetSettings/MSFT_SPProjectServerTimeSheetSettings.schema.mof @@ -21,7 +21,4 @@ class MSFT_SPProjectServerTimeSheetSettings : OMI_BaseResource [Write, Description("Enable single entry mode?")] boolean SingleEntryMode; [Write, Description("What is the default tracking mode for tasks?"), ValueMap{"PercentComplete","ActualDoneAndRemaining","HoursPerPeriod","FreeForm"}, Values{"PercentComplete","ActualDoneAndRemaining","HoursPerPeriod","FreeForm"}] string DefaultTrackingMode; [Write, Description("Force project managers to use the specified tracking mode for each project?")] boolean ForceTrackingModeForAllProjects; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - - diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerUserSyncSettings/MSFT_SPProjectServerUserSyncSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPProjectServerUserSyncSettings/MSFT_SPProjectServerUserSyncSettings.psm1 index 9df4e658a..aa71bd709 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerUserSyncSettings/MSFT_SPProjectServerUserSyncSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerUserSyncSettings/MSFT_SPProjectServerUserSyncSettings.psm1 @@ -18,11 +18,7 @@ function Get-TargetResource [Parameter(Mandatory = $true)] [System.Boolean] - $EnableProjectSiteSyncForSPTaskLists, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $EnableProjectSiteSyncForSPTaskLists ) Write-Verbose -Message "Getting User Sync settings for $Url" @@ -38,8 +34,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -106,17 +101,12 @@ function Set-TargetResource [Parameter(Mandatory = $true)] [System.Boolean] - $EnableProjectSiteSyncForSPTaskLists, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $EnableProjectSiteSyncForSPTaskLists ) Write-Verbose -Message "Setting User Sync settings for $Url" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -169,11 +159,7 @@ function Test-TargetResource [Parameter(Mandatory = $true)] [System.Boolean] - $EnableProjectSiteSyncForSPTaskLists, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $EnableProjectSiteSyncForSPTaskLists ) Write-Verbose -Message "Testing User Sync settings for $Url" diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerUserSyncSettings/MSFT_SPProjectServerUserSyncSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPProjectServerUserSyncSettings/MSFT_SPProjectServerUserSyncSettings.schema.mof index ebd1a91db..894dd50c0 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerUserSyncSettings/MSFT_SPProjectServerUserSyncSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerUserSyncSettings/MSFT_SPProjectServerUserSyncSettings.schema.mof @@ -5,5 +5,4 @@ class MSFT_SPProjectServerUserSyncSettings : OMI_BaseResource [Required, Description("Enable Project Web App Sync")] boolean EnableProjectWebAppSync; [Required, Description("Enable Project Site Sync")] boolean EnableProjectSiteSync; [Required, Description("Enable Project Site Sync for SharePoint Task List Projects")] boolean EnableProjectSiteSyncForSPTaskLists; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerWssSettings/MSFT_SPProjectServerWssSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPProjectServerWssSettings/MSFT_SPProjectServerWssSettings.psm1 index b18d2caf1..67d75c9f3 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerWssSettings/MSFT_SPProjectServerWssSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerWssSettings/MSFT_SPProjectServerWssSettings.psm1 @@ -11,11 +11,7 @@ function Get-TargetResource [Parameter(Mandatory = $true)] [ValidateSet("AutoCreate", "UserChoice", "DontCreate")] [System.String] - $CreateProjectSiteMode, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $CreateProjectSiteMode ) Write-Verbose -Message "Getting WSS settings for $Url" @@ -31,8 +27,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -96,17 +91,12 @@ function Set-TargetResource [Parameter(Mandatory = $true)] [ValidateSet("AutoCreate", "UserChoice", "DontCreate")] [System.String] - $CreateProjectSiteMode, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $CreateProjectSiteMode ) Write-Verbose -Message "Setting WSS settings for $Url" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -157,11 +147,7 @@ function Test-TargetResource [Parameter(Mandatory = $true)] [ValidateSet("AutoCreate", "UserChoice", "DontCreate")] [System.String] - $CreateProjectSiteMode, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $CreateProjectSiteMode ) Write-Verbose -Message "Testing WSS settings for $Url" diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerWssSettings/MSFT_SPProjectServerWssSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPProjectServerWssSettings/MSFT_SPProjectServerWssSettings.schema.mof index 0e49d904d..38552433d 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerWssSettings/MSFT_SPProjectServerWssSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerWssSettings/MSFT_SPProjectServerWssSettings.schema.mof @@ -3,5 +3,4 @@ class MSFT_SPProjectServerWssSettings : OMI_BaseResource { [Key, Description("The default zone URL of the Project site to set WSS settings for")] string Url; [Required, Description("How should new SharePoint sites be created?"), ValueMap{"AutoCreate","UserChoice","DontCreate"}, Values{"AutoCreate","UserChoice","DontCreate"}] string CreateProjectSiteMode; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPProjectServerWssSettings/readme.md b/SharePointDsc/DSCResources/MSFT_SPProjectServerWssSettings/readme.md index fe6546141..ea67b9c80 100644 --- a/SharePointDsc/DSCResources/MSFT_SPProjectServerWssSettings/readme.md +++ b/SharePointDsc/DSCResources/MSFT_SPProjectServerWssSettings/readme.md @@ -7,7 +7,7 @@ This resource is used to control settings that relate to the SharePoint sites that are linked to projects in Project Server. NOTE: -The account you use to run this resource (through either the InstallAccount -or PsDscRunAsCredential properties) needs to have elevated rights to execute -this resource. It is recommended to use the SharePoint Farm Account for this -purpose to avoid receiving a "GeneralSecurityAccessDenied" error. +The account you use to run this resource (through PsDscRunAsCredential +properties) needs to have elevated rights to execute this resource. It +is recommended to use the SharePoint Farm Account for this purpose to +avoid receiving a "GeneralSecurityAccessDenied" error. diff --git a/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.psm1 b/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.psm1 index 1d77757f5..0b8da1771 100644 --- a/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.psm1 @@ -8,10 +8,6 @@ function Get-TargetResource [System.String] $Name, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [ValidateSet("Present", "Absent")] [System.String] @@ -20,8 +16,7 @@ function Get-TargetResource Write-Verbose -Message "Getting service application publish status '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -71,10 +66,6 @@ function Set-TargetResource [System.String] $Name, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [ValidateSet("Present", "Absent")] [System.String] @@ -83,8 +74,7 @@ function Set-TargetResource Write-Verbose -Message "Setting service application publish status '$Name'" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -139,10 +129,6 @@ function Test-TargetResource [System.String] $Name, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [ValidateSet("Present", "Absent")] [System.String] diff --git a/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.schema.mof b/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.schema.mof index 791dfe587..def506297 100644 --- a/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPPublishServiceApplication/MSFT_SPPublishServiceApplication.schema.mof @@ -3,5 +3,4 @@ class MSFT_SPPublishServiceApplication : OMI_BaseResource { [Key, Description("The name of the service application to publish")] string Name; [Write, Description("Present to ensure it runs on this server, or absent to ensure it is stopped"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.psm1 b/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.psm1 index e8886a73d..28b0c574f 100644 --- a/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.psm1 @@ -27,11 +27,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting Quota Template settings for quota $Name" @@ -57,8 +53,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -136,11 +131,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting Quota Template settings for quota $Name" @@ -175,8 +166,7 @@ function Set-TargetResource "Present" { Write-Verbose "Ensure is set to Present - Add or update template" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -382,8 +372,7 @@ function Set-TargetResource throw $message } - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -444,11 +433,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing Quota Template settings for quota $Name" diff --git a/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.schema.mof b/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.schema.mof index 991d4a68b..1a1522fd7 100644 --- a/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPQuotaTemplate/MSFT_SPQuotaTemplate.schema.mof @@ -7,5 +7,4 @@ class MSFT_SPQuotaTemplate : OMI_BaseResource [Write, Description("The maximum number of performance points for sandbox solutions for this template")] uint32 MaximumUsagePointsSolutions; [Write, Description("The warning number of performance points for sandbox solutions for this template")] uint32 WarningUsagePointsSolutions; [Write, Description("Present to create this template, absent to ensure it does not exist"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.psm1 b/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.psm1 index 0a93745cf..62406651b 100644 --- a/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.psm1 @@ -18,17 +18,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] - [System.String] $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + [System.String] $Ensure = "Present" ) Write-Verbose -Message "Getting remote farm trust '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -85,11 +80,7 @@ function Set-TargetResource() [Parameter()] [ValidateSet("Present", "Absent")] - [System.String] $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + [System.String] $Ensure = "Present" ) Write-Verbose -Message "Setting remote farm trust '$Name'" @@ -98,8 +89,7 @@ function Set-TargetResource() { Write-Verbose -Message "Adding remote farm trust '$Name'" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $remoteWebApp = $params.RemoteWebAppUrl.TrimEnd('/') @@ -149,8 +139,7 @@ function Set-TargetResource() { Write-Verbose -Message "Removing remote farm trust '$Name'" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -197,11 +186,7 @@ function Test-TargetResource() [Parameter()] [ValidateSet("Present", "Absent")] - [System.String] $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + [System.String] $Ensure = "Present" ) Write-Verbose -Message "Testing remote farm trust '$Name'" diff --git a/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.schema.mof b/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.schema.mof index d5c7ed3b4..2dde30ad0 100644 --- a/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPRemoteFarmTrust/MSFT_SPRemoteFarmTrust.schema.mof @@ -5,5 +5,4 @@ class MSFT_SPRemoteFarmTrust : OMI_BaseResource [Required, Description("The URL of a web app in the remote farm, must use HTTPS")] string RemoteWebAppUrl; [Required, Description("The URL of a local web app to connect the remote farm to")] string LocalWebAppUrl; [Write, Description("Set to present to ensure the trust exists, or absent to ensure it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.psm1 b/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.psm1 index 389e6d225..e38e92f54 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.psm1 @@ -25,17 +25,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure ) Write-Verbose -Message "Getting Authoratative Page Setting for '$Path'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -130,11 +125,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure ) Write-Verbose -Message "Setting Authoratative Page Settings for '$Path'" @@ -143,8 +134,7 @@ function Set-TargetResource if ($CurrentResults.Ensure -eq "Absent" -and $Ensure -eq "Present") { - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $null = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -177,8 +167,7 @@ function Set-TargetResource } if ($CurrentResults.Ensure -eq "Present" -and $Ensure -eq "Present") { - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $null = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -208,8 +197,7 @@ function Set-TargetResource } if ($Ensure -eq "Absent") { - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $null = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -273,11 +261,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure ) Write-Verbose -Message "Testing Authoratative Page Settings '$Path'" diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.schema.mof index 894d1f50f..a683684ce 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSearchAuthoritativePage/MSFT_SPSearchAuthoritativePage.schema.mof @@ -6,5 +6,4 @@ class MSFT_SPSearchAuthoritativePage : OMI_BaseResource [Write, Description("Level of Authoratitive Page, values between 0.0 and 2.0")] Real32 Level; [Write, Description("The resource will either make the page authoritative or demoted based on this value"), ValueMap{"Authoratative","Demoted"}, Values{"Authoratative","Demoted"}] String Action; [Write, Description("Ensure the Authoritative is Present or Absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, EmbeddedInstance("MSFT_Credential"), Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.psm1 b/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.psm1 index 456ac6275..fa03ff17c 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.psm1 @@ -62,17 +62,12 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $Force, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Force ) Write-Verbose -Message "Getting Content Source Setting for '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -289,11 +284,7 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $Force, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Force ) Write-Verbose -Message "Setting Content Source Setting for '$Name'" @@ -436,8 +427,7 @@ function Set-TargetResource -or ($Ensure -eq "Absent" -and $CurrentValues.Ensure -ne $Ensure)) { # Remove the existing content source - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters) ` -ScriptBlock { $params = $args[0] Remove-SPEnterpriseSearchCrawlContentSource -Identity $params.Name ` @@ -449,8 +439,7 @@ function Set-TargetResource if ($Ensure -eq "Present") { # Create the new content source and then apply settings to it - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -844,11 +833,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $Force, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Force ) Write-Verbose -Message "Testing Content Source Setting for '$Name'" diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.schema.mof index df8b98896..b301bdfc9 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSearchContentSource/MSFT_SPSearchContentSource.schema.mof @@ -28,5 +28,4 @@ class MSFT_SPSearchContentSource : OMI_BaseResource [Write, Description("Line of Business System and System Instance names")] String LOBSystemSet[]; [Write, Description("Present if the source should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; [Write, Description("Specify true if DSC is allowed to delete and recreate a content source to apply the correct settings, otherwise false will just report errors if a change can not be applied.")] Boolean Force; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.psm1 b/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.psm1 index c70dae2af..4d9cc934d 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.psm1 @@ -19,17 +19,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting Search Crawl Mapping for '$Url'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -110,11 +105,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting Search Crawl Mapping Rule '$Url'" $result = Get-TargetResource @PSBoundParameters @@ -123,8 +114,7 @@ function Set-TargetResource { Write-Verbose "Adding the Crawl Mapping '$Url'" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -148,8 +138,7 @@ function Set-TargetResource if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") { Write-Verbose "Updating the Crawl Mapping '$Url'" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -164,8 +153,7 @@ function Set-TargetResource if ($result.Ensure -eq "Present" -and $Ensure -eq "Absent") { Write-Verbose "Removing the Crawl Mapping '$Url'" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -199,11 +187,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing Search Crawl Mapping for '$Url'" diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.schema.mof index d62f23d89..9ffa48f59 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSearchCrawlMapping/MSFT_SPSearchCrawlMapping.schema.mof @@ -6,5 +6,4 @@ class MSFT_SPSearchCrawlMapping : OMI_BaseResource [Key, Description("Source URI for the crawl mapping")] String Url; [Required, Description("Target URI for the crawl mapping")] String Target; [Write, Description("Ensure the crawl mapping is Present or Absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, EmbeddedInstance("MSFT_Credential"), Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.psm1 b/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.psm1 index ee9231dc2..ec6759d26 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.psm1 @@ -46,11 +46,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting Search Crawl Rule '$Path'" @@ -137,8 +133,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -300,11 +295,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting Search Crawl Rule '$Path'" @@ -396,8 +387,7 @@ function Set-TargetResource if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message "Creating Crawl Rule $Path" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -444,7 +434,7 @@ function Set-TargetResource if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") { Write-Verbose -Message "Updating Crawl Rule $Path" - Invoke-SPDscCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Invoke-SPDscCommand -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] $crawlRule = Get-SPEnterpriseSearchCrawlRule ` @@ -498,8 +488,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing Crawl Rule $Path" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -558,11 +547,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing Search Crawl Rule '$Path'" diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.schema.mof index 0df36c22b..0d90b377b 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSearchCrawlRule/MSFT_SPSearchCrawlRule.schema.mof @@ -9,6 +9,4 @@ class MSFT_SPSearchCrawlRule : OMI_BaseResource [Write, Description("The credentials used for this crawl rule (used for types BasicAccountRuleAccess and NTLMAccountRuleAccess)"), EmbeddedInstance("MSFT_Credential")] String AuthenticationCredentials; [Write, Description("The certificate used for this crawl rule (used for type CertificateRuleAccess)")] string CertificateName; [Write, Description("Present if the crawl rule should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.psm1 b/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.psm1 index 5b7310cfe..96a260f5b 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.psm1 @@ -23,11 +23,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting Crawler Impact Rule Setting for '$Name'" @@ -42,8 +38,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -123,11 +118,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) @@ -148,8 +139,7 @@ function Set-TargetResource if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message "Creating Crawler Impact Rule $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -186,8 +176,7 @@ function Set-TargetResource if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") { Write-Verbose -Message "Updating Crawler Impact Rule $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -229,8 +218,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing Crawler Impact Rule $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -279,11 +267,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing Crawler Impact Rule Setting for '$Name'" diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.schema.mof index 5b1062a49..f93ea6f19 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSearchCrawlerImpactRule/MSFT_SPSearchCrawlerImpactRule.schema.mof @@ -8,6 +8,4 @@ class MSFT_SPSearchCrawlerImpactRule : OMI_BaseResource [Write, Description("The RequestLimit setting for the crawl impact rule")] UInt32 RequestLimit; [Write, Description("The WaitTime setting for the crawl impact rule")] UInt32 WaitTime; [Write, Description("Ensure the crawl rule is Present or Absent"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, EmbeddedInstance("MSFT_Credential"), Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.psm1 b/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.psm1 index fb2f16457..b39e66721 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.psm1 @@ -27,11 +27,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting Search File Type '$FileType'" @@ -49,8 +45,7 @@ function Get-TargetResource return $nullReturn } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -137,11 +132,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting Search File Type '$FileType'" @@ -163,8 +154,7 @@ function Set-TargetResource $result = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Checking if Service Application '$ServiceAppName' exists" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -201,8 +191,7 @@ function Set-TargetResource if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message "Creating File Type $FileType" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -230,7 +219,7 @@ function Set-TargetResource if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") { Write-Verbose -Message "Updating File Type $FileType" - Invoke-SPDscCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Invoke-SPDscCommand -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] $fileType = Get-SPEnterpriseSearchFileFormat ` @@ -277,8 +266,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing Crawl Rule $Path" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -318,11 +306,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing Search File Type '$FileType'" diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.schema.mof index 06d07da6a..30987cbcf 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSearchFileType/MSFT_SPSearchFileType.schema.mof @@ -7,6 +7,4 @@ class MSFT_SPSearchFileType : OMI_BaseResource [Write, Description("The mime type of the file type")] string MimeType; [Write, Description("The state of the file type")] boolean Enabled; [Write, Description("Present if the file type should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.psm1 b/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.psm1 index a99183613..e199bc338 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.psm1 @@ -18,17 +18,12 @@ function Get-TargetResource [Parameter(Mandatory = $true)] [System.String] - $ServiceAppName, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ServiceAppName ) Write-Verbose -Message "Getting Search Index Partition '$Index' settings" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $ConfirmPreference = 'None' @@ -81,19 +76,14 @@ function Set-TargetResource [Parameter(Mandatory = $true)] [System.String] - $ServiceAppName, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ServiceAppName ) Write-Verbose -Message "Setting Search Index Partition '$Index' settings" $CurrentValues = Get-TargetResource @PSBoundParameters - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $CurrentValues) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $CurrentValues) ` -ScriptBlock { $params = $args[0] $CurrentValues = $args[1] @@ -218,88 +208,87 @@ function Set-TargetResource -and ($_.ServerName -eq $componentToRemove) ` -and ($_.IndexPartitionOrdinal -eq $params.Index) } - if ($null -ne $component) - { - $component | Remove-SPEnterpriseSearchComponent -SearchTopology $newTopology ` - -Confirm:$false - } + + if ($null -ne $component) + { + $component | Remove-SPEnterpriseSearchComponent -SearchTopology $newTopology ` + -Confirm:$false } } - - # Apply the new topology - Set-SPEnterpriseSearchTopology -Identity $newTopology } - } - function Test-TargetResource - { - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.UInt32] - $Index, + # Apply the new topology + Set-SPEnterpriseSearchTopology -Identity $newTopology + } +} - [Parameter(Mandatory = $true)] - [System.String[]] - $Servers, +function Test-TargetResource +{ + [CmdletBinding()] + [OutputType([System.Boolean])] + param + ( + [Parameter(Mandatory = $true)] + [System.UInt32] + $Index, - [Parameter()] - [System.String] - $RootDirectory, + [Parameter(Mandatory = $true)] + [System.String[]] + $Servers, - [Parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, + [Parameter()] + [System.String] + $RootDirectory, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount - ) + [Parameter(Mandatory = $true)] + [System.String] + $ServiceAppName + ) - Write-Verbose -Message "Testing Search Index Partition '$Index' settings" + Write-Verbose -Message "Testing Search Index Partition '$Index' settings" - $CurrentValues = Get-TargetResource @PSBoundParameters + $CurrentValues = Get-TargetResource @PSBoundParameters - Write-Verbose -Message "Current Values: $(Convert-SPDscHashtableToString -Hashtable $CurrentValues)" - Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" + Write-Verbose -Message "Current Values: $(Convert-SPDscHashtableToString -Hashtable $CurrentValues)" + Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" - $result = Test-SPDscParameterState -CurrentValues $CurrentValues ` - -Source $($MyInvocation.MyCommand.Source) ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Servers") + $result = Test-SPDscParameterState -CurrentValues $CurrentValues ` + -Source $($MyInvocation.MyCommand.Source) ` + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @("Servers") - Write-Verbose -Message "Test-TargetResource returned $result" + Write-Verbose -Message "Test-TargetResource returned $result" - return $result - } + return $result +} - function Export-TargetResource - { - $VerbosePreference = "SilentlyContinue" - $ParentModuleBase = Get-Module "SharePointDsc" -ListAvailable | Select-Object -ExpandProperty Modulebase - $module = Join-Path -Path $ParentModuleBase -ChildPath "\DSCResources\MSFT_SPSearchIndexPartition\MSFT_SPSearchIndexPartition.psm1" -Resolve - $Content = '' - $params = Get-DSCFakeParameters -ModulePath $module +function Export-TargetResource +{ + $VerbosePreference = "SilentlyContinue" + $ParentModuleBase = Get-Module "SharePointDsc" -ListAvailable | Select-Object -ExpandProperty Modulebase + $module = Join-Path -Path $ParentModuleBase -ChildPath "\DSCResources\MSFT_SPSearchIndexPartition\MSFT_SPSearchIndexPartition.psm1" -Resolve + $Content = '' + $params = Get-DSCFakeParameters -ModulePath $module - $ssas = Get-SPServiceApplication | Where-Object -FilterScript { $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" } + $ssas = Get-SPServiceApplication | Where-Object -FilterScript { $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" } - $i = 1 - $total = $ssas.Length - foreach ($ssa in $ssas) + $i = 1 + $total = $ssas.Length + foreach ($ssa in $ssas) + { + try { - try + if ($null -ne $ssa) { - if ($null -ne $ssa) - { - $serviceName = $ssa.DisplayName - Write-Host "Scanning Index Partitions for Search Service Application [$i/$total] {$serviceName}" - - $ssa = Get-SPEnterpriseSearchServiceApplication -Identity $ssa - $currentTopology = $ssa.ActiveTopology - $indexComponents = Get-SPEnterpriseSearchComponent -SearchTopology $currentTopology | ` - Where-Object -FilterScript { $_.GetType().Name -eq "IndexComponent" } + $serviceName = $ssa.DisplayName + Write-Host "Scanning Index Partitions for Search Service Application [$i/$total] {$serviceName}" + + $ssa = Get-SPEnterpriseSearchServiceApplication -Identity $ssa + $currentTopology = $ssa.ActiveTopology + $indexComponents = Get-SPEnterpriseSearchComponent -SearchTopology $currentTopology | ` + Where-Object -FilterScript { + $_.GetType().Name -eq "IndexComponent" + } [System.Collections.ArrayList]$indexesAlreadyScanned = @() $j = 1 diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.schema.mof index 3ba702ed7..7932abec8 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSearchIndexPartition/MSFT_SPSearchIndexPartition.schema.mof @@ -5,5 +5,4 @@ class MSFT_SPSearchIndexPartition : OMI_BaseResource [Required, Description("A list of the servers that this partition should exist on")] String Servers[]; [Write, Description("The directory that the index should use locally on each server to store data")] String RootDirectory; [Key, Description("The name of the search service application")] String ServiceAppName; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchManagedProperty/MSFT_SPSearchManagedProperty.psm1 b/SharePointDsc/DSCResources/MSFT_SPSearchManagedProperty/MSFT_SPSearchManagedProperty.psm1 index a65aa71c6..9c293d592 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchManagedProperty/MSFT_SPSearchManagedProperty.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSearchManagedProperty/MSFT_SPSearchManagedProperty.psm1 @@ -68,17 +68,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting Managed Property Setting for '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -217,11 +212,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting Managed Property Setting for '$Name'" @@ -230,8 +221,7 @@ function Set-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters # Validate that the specified crawled properties are all valid and existing - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $CurrentValues) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $CurrentValues) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -442,11 +432,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing Managed Property Setting for '$Name'" diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchManagedProperty/MSFT_SPSearchManagedProperty.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSearchManagedProperty/MSFT_SPSearchManagedProperty.schema.mof index f89ef97ef..8dd07c20e 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchManagedProperty/MSFT_SPSearchManagedProperty.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSearchManagedProperty/MSFT_SPSearchManagedProperty.schema.mof @@ -17,5 +17,4 @@ class MSFT_SPSearchManagedProperty : OMI_BaseResource [Write, Description("Should the property be mapped to all crawled properties")] Boolean IncludeAllCrawledProperties; [Write, Description("List of crawled properties that the property is mapped with")] String CrawledProperties[]; [Write, Description("Present if the source should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchMetadataCategory/MSFT_SPSearchMetadataCategory.psm1 b/SharePointDsc/DSCResources/MSFT_SPSearchMetadataCategory/MSFT_SPSearchMetadataCategory.psm1 index eb9c4e12d..27d8aceac 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchMetadataCategory/MSFT_SPSearchMetadataCategory.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSearchMetadataCategory/MSFT_SPSearchMetadataCategory.psm1 @@ -27,17 +27,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting Metadata Category Setting for '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -110,18 +105,13 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting Metadata Category Setting for '$Name'" # Validate that the specified crawled properties are all valid and existing - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -205,11 +195,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing Metadata Category Setting for '$Name'" diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchMetadataCategory/MSFT_SPSearchMetadataCategory.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSearchMetadataCategory/MSFT_SPSearchMetadataCategory.schema.mof index f41adced1..4b076fddf 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchMetadataCategory/MSFT_SPSearchMetadataCategory.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSearchMetadataCategory/MSFT_SPSearchMetadataCategory.schema.mof @@ -7,5 +7,4 @@ class MSFT_SPSearchMetadataCategory : OMI_BaseResource [Write, Description("Specifies that if there are unknown properties in this category, these new properties are discovered during a crawl.")] Boolean DiscoverNewProperties; [Write, Description("Specifies that all crawled properties of type string are mapped to corresponding managed properties of this category.")] Boolean MapToContents; [Write, Description("Present if the result source should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.psm1 b/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.psm1 index 3eb7b42a7..d23d485a5 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.psm1 @@ -38,17 +38,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting search result source '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] [void] [Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.Search") @@ -160,11 +155,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting search result source '$Name'" @@ -174,8 +165,7 @@ function Set-TargetResource if ($CurrentValues.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message "Creating search result source $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -240,7 +230,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing search result source $Name" - Invoke-SPDscCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Invoke-SPDscCommand -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] [void] [Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.Search") @@ -307,11 +297,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing search result source '$Name'" diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.schema.mof index 51d9e4837..c14a9bda4 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.schema.mof @@ -9,5 +9,4 @@ class MSFT_SPSearchResultSource : OMI_BaseResource [Required, Description("The provider type to use for the result source")] String ProviderType; [Write, Description("The URI to connect to the remote location")] String ConnectionUrl; [Write, Description("Present if the result source should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.psm1 index cd5fafe2d..28988a7f0 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.psm1 @@ -61,14 +61,37 @@ function Get-TargetResource $DefaultContentAccessAccount, [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + [System.UInt16] + $ErrorDeleteCountAllowed, + + [Parameter()] + [System.UInt16] + $ErrorDeleteIntervalAllowed, + + [Parameter()] + [System.UInt16] + $ErrorCountAllowed, + + [Parameter()] + [System.UInt16] + $ErrorIntervalAllowed, + + [Parameter()] + [System.UInt16] + $DeleteUnvisitedMethod, + + [Parameter()] + [System.UInt16] + $RecrawlErrorCount, + + [Parameter()] + [System.UInt16] + $RecrawlErrorInterval ) Write-Verbose -Message "Getting Search service application '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -230,6 +253,13 @@ function Get-TargetResource CloudIndex = $cloudIndex AlertsEnabled = $serviceApp.AlertsEnabled FixFarmAccountPermissions = $farmAccountPermissionsNeedCorrecting + ErrorDeleteCountAllowed = $serviceApp.GetProperty("ErrorDeleteCountAllowed") + ErrorDeleteIntervalAllowed = $serviceApp.GetProperty("ErrorDeleteIntervalAllowed") + ErrorCountAllowed = $serviceApp.GetProperty("ErrorCountAllowed") + ErrorIntervalAllowed = $serviceApp.GetProperty("ErrorIntervalAllowed") + DeleteUnvisitedMethod = $serviceApp.GetProperty("DeleteUnvisitedMethod") + RecrawlErrorCount = $serviceApp.GetProperty("RecrawlErrorCount") + RecrawlErrorInterval = $serviceApp.GetProperty("RecrawlErrorInterval") } return $returnVal } @@ -296,8 +326,32 @@ function Set-TargetResource $DefaultContentAccessAccount, [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + [System.UInt16] + $ErrorDeleteCountAllowed, + + [Parameter()] + [System.UInt16] + $ErrorDeleteIntervalAllowed, + + [Parameter()] + [System.UInt16] + $ErrorCountAllowed, + + [Parameter()] + [System.UInt16] + $ErrorIntervalAllowed, + + [Parameter()] + [System.UInt16] + $DeleteUnvisitedMethod, + + [Parameter()] + [System.UInt16] + $RecrawlErrorCount, + + [Parameter()] + [System.UInt16] + $RecrawlErrorInterval ) Write-Verbose -Message "Setting Search service application '$Name'" @@ -320,8 +374,7 @@ function Set-TargetResource { # Create the service app as it doesn't exist Write-Verbose -Message "Creating Search Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -416,27 +469,8 @@ function Set-TargetResource Set-SPEnterpriseSearchServiceApplication @setParams } - if ($params.ContainsKey("SearchCenterUrl") -eq $true) - { - Write-Verbose -Message "Setting SearchCenterUrl to $($params.SearchCenterUrl)" - $serviceApp = Get-SPServiceApplication | Where-Object -FilterScript { - $_.Name -eq $params.Name -and ` - $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - } - $serviceApp.SearchCenterUrl = $params.SearchCenterUrl - $serviceApp.Update() - } - - if ($params.ContainsKey("AlertsEnabled") -eq $true) - { - Write-Verbose -Message "Setting AlertsEnabled to $($params.AlertsEnabled)" - $serviceApp = Get-SPServiceApplication | Where-Object -FilterScript { - $_.Name -eq $params.Name -and ` - $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" - } - $serviceApp.AlertsEnabled = $params.AlertsEnabled - $serviceApp.Update() - } + Write-Verbose -Message ("NOTE: Don't forget to configure a Search topology " + ` + "using the SPSearchTopology resource!") } } } @@ -445,8 +479,7 @@ function Set-TargetResource { # Update the service app that already exists Write-Verbose -Message "Updating Search Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $result) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $result) ` -ScriptBlock { $params = $args[0] $result = $args[1] @@ -510,121 +543,188 @@ function Set-TargetResource { Set-SPEnterpriseSearchServiceApplication @setParams } + } + } + + # Only check and correct when Ensure=Present, FixFarmAccountPermissions=True and the permissions are incorrect + if ($Ensure -eq "Present") + { + if ($FixFarmAccountPermissions -eq $true -and ` + $result.FixFarmAccountPermissions -eq $true) + { + Write-Verbose -Message "Fixing database permissions for Search Service Application $Name" + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $PSScriptRoot) ` + -ScriptBlock { + $params = $args[0] + $scriptRoot = $args[1] + + $modulePath = "..\..\Modules\SharePointDsc.Search\SPSearchServiceApp.psm1" + Import-Module -Name (Join-Path -Path $scriptRoot -ChildPath $modulePath -Resolve) -Verbose:$false - if ($params.ContainsKey("SearchCenterUrl") -eq $true -and ` - $result.SearchCenterUrl -ne $params.SearchCenterUrl) - { - Write-Verbose -Message "Updating SearchCenterUrl to $($params.SearchCenterUrl)" $serviceApp = Get-SPServiceApplication | Where-Object -FilterScript { $_.Name -eq $params.Name -and ` $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" } - $serviceApp.SearchCenterUrl = $params.SearchCenterUrl - $serviceApp.Update() - } - if ($params.ContainsKey("AlertsEnabled") -eq $true -and ` - $result.AlertsEnabled -ne $params.AlertsEnabled) - { - Write-Verbose -Message "Updating AlertsEnabled to $($params.AlertsEnabled)" - $serviceApp = Get-SPServiceApplication | Where-Object -FilterScript { - $_.Name -eq $params.Name -and ` - $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" + $farmAccount = (Get-SPFarm).DefaultServiceAccount.Name + $dbServer = $serviceApp.SearchAdminDatabase.NormalizedDataSource + + Write-Verbose -Message "Checking and correcting Admin Database" + $adminDB = $serviceApp.SearchAdminDatabase.Name + if ((Confirm-UserIsDBOwner -SQLServer $dbServer ` + -Database $adminDB ` + -User $farmAccount ` + -DatabaseCredentials $params.DatabaseCredentials) -eq $false) + { + Set-UserAsDBOwner -SQLServer $dbServer ` + -Database $adminDB ` + -User $farmAccount ` + -DatabaseCredentials $params.DatabaseCredentials + } + + Write-Verbose -Message "Checking and correcting Analytics reporting Database" + foreach ($database in $serviceApp.AnalyticsReportingDatabases) + { + $analyticsDB = $database.Name + if ((Confirm-UserIsDBOwner -SQLServer $dbServer ` + -Database $analyticsDB ` + -User $farmAccount ` + -DatabaseCredentials $params.DatabaseCredentials) -eq $false) + { + Set-UserAsDBOwner -SQLServer $dbServer ` + -Database $analyticsDB ` + -User $farmAccount ` + -DatabaseCredentials $params.DatabaseCredentials + } + } + + Write-Verbose -Message "Checking and correcting Crawl Database(s)" + foreach ($database in (Get-SPEnterpriseSearchCrawlDatabase -SearchApplication $serviceApp)) + { + $crawlDB = $database.Database.Name + Write-Verbose -Message " * Processing $crawlDB" + + $dbServer = $database.Database.NormalizedDataSource + if ((Confirm-UserIsDBOwner -SQLServer $dbServer ` + -Database $crawlDB ` + -User $farmAccount ` + -DatabaseCredentials $params.DatabaseCredentials) -eq $false) + { + Set-UserAsDBOwner -SQLServer $dbServer ` + -Database $crawlDB ` + -User $farmAccount ` + -DatabaseCredentials $params.DatabaseCredentials + } + } + + Write-Verbose -Message "Checking and correcting Links Database(s)" + foreach ($database in (Get-SPEnterpriseSearchLinksDatabase -SearchApplication $serviceApp)) + { + $linksDB = $database.Database.Name + Write-Verbose -Message " * Processing $linksDB" + + $dbServer = $database.Database.NormalizedDataSource + if ((Confirm-UserIsDBOwner -SQLServer $dbServer ` + -Database $linksDB ` + -User $farmAccount ` + -DatabaseCredentials $params.DatabaseCredentials) -eq $false) + { + Set-UserAsDBOwner -SQLServer $dbServer ` + -Database $linksDB ` + -User $farmAccount ` + -DatabaseCredentials $params.DatabaseCredentials + } } - $serviceApp.AlertsEnabled = $params.AlertsEnabled - $serviceApp.Update() } } - } - # Only check and correct when Ensure=Present, FixFarmAccountPermissions=True and the permissions are incorrect - if ($Ensure -eq "Present" -and ` - $FixFarmAccountPermissions -eq $true -and ` - $result.FixFarmAccountPermissions -eq $true) - { - Write-Verbose -Message "Fixing database permissions for Search Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` + Write-Verbose -Message "Updating settings of Search Service Application $Name" + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $result) ` -ScriptBlock { $params = $args[0] - $scriptRoot = $args[1] - - $modulePath = "..\..\Modules\SharePointDsc.Search\SPSearchServiceApp.psm1" - Import-Module -Name (Join-Path -Path $scriptRoot -ChildPath $modulePath -Resolve) -Verbose:$false + $result = $args[1] $serviceApp = Get-SPServiceApplication | Where-Object -FilterScript { $_.Name -eq $params.Name -and ` $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" } - $farmAccount = (Get-SPFarm).DefaultServiceAccount.Name - $dbServer = $serviceApp.SearchAdminDatabase.NormalizedDataSource + $runUpdate = $false + if ($params.ContainsKey("SearchCenterUrl") -eq $true -and ` + $result.SearchCenterUrl -ne $params.SearchCenterUrl) + { + Write-Verbose -Message "Updating SearchCenterUrl to $($params.SearchCenterUrl)" + $serviceApp.SearchCenterUrl = $params.SearchCenterUrl + $runUpdate = $true + } - Write-Verbose -Message "Checking and correcting Admin Database" - $adminDB = $serviceApp.SearchAdminDatabase.Name - if ((Confirm-UserIsDBOwner -SQLServer $dbServer ` - -Database $adminDB ` - -User $farmAccount ` - -DatabaseCredentials $params.DatabaseCredentials) -eq $false) + if ($params.ContainsKey("AlertsEnabled") -eq $true -and ` + $result.AlertsEnabled -ne $params.AlertsEnabled) { - Set-UserAsDBOwner -SQLServer $dbServer ` - -Database $adminDB ` - -User $farmAccount ` - -DatabaseCredentials $params.DatabaseCredentials + Write-Verbose -Message "Updating AlertsEnabled to $($params.AlertsEnabled)" + $serviceApp.AlertsEnabled = $params.AlertsEnabled + $runUpdate = $true } - Write-Verbose -Message "Checking and correcting Analytics reporting Database" - foreach ($database in $serviceApp.AnalyticsReportingDatabases) + if ($params.ContainsKey("ErrorDeleteCountAllowed") -eq $true -and ` + $result.ErrorDeleteCountAllowed -ne $params.ErrorDeleteCountAllowed) { - $analyticsDB = $database.Name - if ((Confirm-UserIsDBOwner -SQLServer $dbServer ` - -Database $analyticsDB ` - -User $farmAccount ` - -DatabaseCredentials $params.DatabaseCredentials) -eq $false) - { - Set-UserAsDBOwner -SQLServer $dbServer ` - -Database $analyticsDB ` - -User $farmAccount ` - -DatabaseCredentials $params.DatabaseCredentials - } + Write-Verbose -Message "Updating ErrorDeleteCountAllowed to $($params.ErrorDeleteCountAllowed)" + $serviceApp.SetProperty("ErrorDeleteCountAllowed", $params.ErrorDeleteCountAllowed) + $runUpdate = $true } - Write-Verbose -Message "Checking and correcting Crawl Database(s)" - foreach ($database in (Get-SPEnterpriseSearchCrawlDatabase -SearchApplication $serviceApp)) + if ($params.ContainsKey("ErrorDeleteIntervalAllowed") -eq $true -and ` + $result.ErrorDeleteIntervalAllowed -ne $params.ErrorDeleteIntervalAllowed) { - $crawlDB = $database.Database.Name - Write-Verbose -Message " * Processing $crawlDB" + Write-Verbose -Message "Updating ErrorDeleteIntervalAllowed to $($params.ErrorDeleteIntervalAllowed)" + $serviceApp.SetProperty("ErrorDeleteIntervalAllowed", $params.ErrorDeleteIntervalAllowed) + $runUpdate = $true + } - $dbServer = $database.Database.NormalizedDataSource - if ((Confirm-UserIsDBOwner -SQLServer $dbServer ` - -Database $crawlDB ` - -User $farmAccount ` - -DatabaseCredentials $params.DatabaseCredentials) -eq $false) - { - Set-UserAsDBOwner -SQLServer $dbServer ` - -Database $crawlDB ` - -User $farmAccount ` - -DatabaseCredentials $params.DatabaseCredentials - } + if ($params.ContainsKey("ErrorCountAllowed") -eq $true -and ` + $result.ErrorCountAllowed -ne $params.ErrorCountAllowed) + { + Write-Verbose -Message "Updating ErrorCountAllowed to $($params.ErrorCountAllowed)" + $serviceApp.SetProperty("ErrorCountAllowed", $params.ErrorCountAllowed) + $runUpdate = $true } - Write-Verbose -Message "Checking and correcting Links Database(s)" - foreach ($database in (Get-SPEnterpriseSearchLinksDatabase -SearchApplication $serviceApp)) + if ($params.ContainsKey("ErrorIntervalAllowed") -eq $true -and ` + $result.ErrorIntervalAllowed -ne $params.ErrorIntervalAllowed) { - $linksDB = $database.Database.Name - Write-Verbose -Message " * Processing $linksDB" + Write-Verbose -Message "Updating ErrorIntervalAllowed to $($params.ErrorIntervalAllowed)" + $serviceApp.SetProperty("ErrorIntervalAllowed", $params.ErrorIntervalAllowed) + $runUpdate = $true + } - $dbServer = $database.Database.NormalizedDataSource - if ((Confirm-UserIsDBOwner -SQLServer $dbServer ` - -Database $linksDB ` - -User $farmAccount ` - -DatabaseCredentials $params.DatabaseCredentials) -eq $false) - { - Set-UserAsDBOwner -SQLServer $dbServer ` - -Database $linksDB ` - -User $farmAccount ` - -DatabaseCredentials $params.DatabaseCredentials - } + if ($params.ContainsKey("DeleteUnvisitedMethod") -eq $true -and ` + $result.DeleteUnvisitedMethod -ne $params.DeleteUnvisitedMethod) + { + Write-Verbose -Message "Updating DeleteUnvisitedMethod to $($params.DeleteUnvisitedMethod)" + $serviceApp.SetProperty("DeleteUnvisitedMethod", $params.DeleteUnvisitedMethod) + $runUpdate = $true + } + + if ($params.ContainsKey("RecrawlErrorCount") -eq $true -and ` + $result.RecrawlErrorCount -ne $params.RecrawlErrorCount) + { + Write-Verbose -Message "Updating RecrawlErrorCount to $($params.RecrawlErrorCount)" + $serviceApp.SetProperty("RecrawlErrorCount", $params.RecrawlErrorCount) + $runUpdate = $true + } + + if ($params.ContainsKey("RecrawlErrorInterval") -eq $true -and ` + $result.RecrawlErrorInterval -ne $params.RecrawlErrorInterval) + { + Write-Verbose -Message "Updating RecrawlErrorInterval to $($params.RecrawlErrorInterval)" + $serviceApp.SetProperty("RecrawlErrorInterval", $params.RecrawlErrorInterval) + $runUpdate = $true + } + + if ($runUpdate -eq $true) + { + $serviceApp.Update() } } } @@ -633,8 +733,7 @@ function Set-TargetResource { # The service app should not exit Write-Verbose -Message "Removing Search Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -717,8 +816,32 @@ function Test-TargetResource $DefaultContentAccessAccount, [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + [System.UInt16] + $ErrorDeleteCountAllowed, + + [Parameter()] + [System.UInt16] + $ErrorDeleteIntervalAllowed, + + [Parameter()] + [System.UInt16] + $ErrorCountAllowed, + + [Parameter()] + [System.UInt16] + $ErrorIntervalAllowed, + + [Parameter()] + [System.UInt16] + $DeleteUnvisitedMethod, + + [Parameter()] + [System.UInt16] + $RecrawlErrorCount, + + [Parameter()] + [System.UInt16] + $RecrawlErrorInterval ) Write-Verbose -Message "Testing Search service application '$Name'" @@ -779,7 +902,15 @@ function Test-TargetResource "ApplicationPool", "SearchCenterUrl", "ProxyName", - "AlertsEnabled") + "AlertsEnabled", + "ErrorDeleteCountAllowed", + "ErrorDeleteIntervalAllowed", + "ErrorCountAllowed", + "ErrorIntervalAllowed", + "DeleteUnvisitedMethod", + "RecrawlErrorCount", + "RecrawlErrorInterval" + ) } else { @@ -825,11 +956,6 @@ function Export-TargetResource $results.Remove("CloudIndex") } - if ($results.Contains("InstallAccount")) - { - $results.Remove("InstallAccount") - } - if ($null -eq $results.SearchCenterUrl) { $results.Remove("SearchCenterUrl") diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.schema.mof index 277086f54..9b10610f5 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/MSFT_SPSearchServiceApp.schema.mof @@ -7,12 +7,18 @@ class MSFT_SPSearchServiceApp : OMI_BaseResource [Write, Description("The URL of the enterprise search center site collection")] string SearchCenterUrl; [Write, Description("The name of the database (noting that some search databases will use this as a prefix)")] string DatabaseName; [Write, Description("The server that host the databases for this service application")] string DatabaseServer; + [Write, Description("Should SQL Server authentication be used to connect to the database?")] Boolean UseSQLAuthentication; + [Write, Description("If using SQL authentication, the SQL credentials to use to connect to the instance"), EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; [Write, Description("The default content access account for this search service app"), EmbeddedInstance("MSFT_Credential")] String DefaultContentAccessAccount; [Write, Description("Should this search service application be a cloud based service app")] boolean CloudIndex; [Write, Description("Should alerts be enabled for this search service application")] boolean AlertsEnabled; [Write, Description("Should the permissions for the Farm account on the Search databases be corrected")] boolean FixFarmAccountPermissions; [Write, Description("Present if the service app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; - [Write, Description("Should SQL Server authentication be used to connect to the database?")] Boolean UseSQLAuthentication; - [Write, Description("If using SQL authentication, the SQL credentials to use to connect to the instance"), EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; + [Write, Description("Specifies the number of consecutive crawls where Access Denied or File Not Found errors were encountered before the item is deleted from the index")] uint16 ErrorDeleteCountAllowed; + [Write, Description("Specifies the number of hours since the first Access Denied or File Not Found errors were encountered in a crawl before the item is deleted from the index")] uint16 ErrorDeleteIntervalAllowed; + [Write, Description("Specifies the number of consecutive crawls where other errors were encountered before the item is deleted from the index")] uint16 ErrorCountAllowed; + [Write, Description("Specifies the number of hours since the first other errors were encountered in a crawl before the item is deleted from the index")] uint16 ErrorIntervalAllowed; + [Write, Description("Specifies what items get deleted: 0 - All unvisited items, 1 - (Default) All unvisited items that have the same host as the start address, 2 - None of the unvisited items. You can specify the following three values:")] uint16 DeleteUnvisitedMethod; + [Write, Description("Specifies the number of consecutive crawls in which errors were encountered while fetching changes from the SharePoint content database")] uint16 RecrawlErrorCount; + [Write, Description("Specifies the number of hours since the first error were encountered while fetching changes from the SharePoint content database")] uint16 RecrawlErrorInterval; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/readme.md b/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/readme.md index afe5d8ec4..a132ea197 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/readme.md +++ b/SharePointDsc/DSCResources/MSFT_SPSearchServiceApp/readme.md @@ -14,11 +14,14 @@ the admin database which matches the name, and then The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. -NOTE: The WindowsServiceAccount parameter is deprecated and no longer does -anything. The functionality for changing this account has been moved to -SPSearchServiceSettings. +For more information about the Deletion Policy settings, check the following +article: +https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-server-2010/hh127009(v=office.14)?redirectedfrom=MSDN -NOTE2: The resource is also able to add the Farm account as db_owner to all +**NOTE:** Don't forget to configure a Search topology using the SPSearchTopology +resource! + +**NOTE2:** The resource is also able to add the Farm account as db_owner to all Search databases, to prevent the issue described here: https://www.techmikael.com/2014/10/caution-if-you-have-used.html Use the FixFarmAccountPermissions parameter to implement this fix (default diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchServiceSettings/MSFT_SPSearchServiceSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPSearchServiceSettings/MSFT_SPSearchServiceSettings.psm1 index 55423ed90..55a8ccb0b 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchServiceSettings/MSFT_SPSearchServiceSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSearchServiceSettings/MSFT_SPSearchServiceSettings.psm1 @@ -23,11 +23,7 @@ function Get-TargetResource [Parameter()] [System.Management.Automation.PSCredential] - $WindowsServiceAccount, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $WindowsServiceAccount ) Write-Verbose -Message "Getting Search service settings" @@ -43,12 +39,10 @@ function Get-TargetResource PerformanceLevel = $null ContactEmail = $null WindowsServiceAccount = $null - InstallAccount = $InstallAccount } } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -106,11 +100,7 @@ function Set-TargetResource [Parameter()] [System.Management.Automation.PSCredential] - $WindowsServiceAccount, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $WindowsServiceAccount ) Write-Verbose -Message "Setting Search service settings" @@ -131,8 +121,7 @@ function Set-TargetResource $result = Get-TargetResource @PSBoundParameters # Update the service app that already exists - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $result) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $result) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -207,11 +196,7 @@ function Test-TargetResource [Parameter()] [System.Management.Automation.PSCredential] - $WindowsServiceAccount, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $WindowsServiceAccount ) Write-Verbose -Message "Testing Search service settings" diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchServiceSettings/MSFT_SPSearchServiceSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSearchServiceSettings/MSFT_SPSearchServiceSettings.schema.mof index bdc3b0060..5402af775 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchServiceSettings/MSFT_SPSearchServiceSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSearchServiceSettings/MSFT_SPSearchServiceSettings.schema.mof @@ -5,5 +5,4 @@ class MSFT_SPSearchServiceSettings : OMI_BaseResource [Write, Description("Specifies the performance level of the crawler"), ValueMap{"Reduced","PartlyReduced","Maximum"}, Values{"Reduced","PartlyReduced","Maximum"}] string PerformanceLevel; [Write, Description("Specifies the contact email used by the crawler")] string ContactEmail; [Write, Description("Sets the windows services for search to run as this account"), EmbeddedInstance("MSFT_Credential")] string WindowsServiceAccount; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.psm1 b/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.psm1 index 133645939..65a8c09be 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.psm1 @@ -34,17 +34,12 @@ function Get-TargetResource [Parameter(Mandatory = $true)] [System.String] - $FirstPartitionDirectory, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $FirstPartitionDirectory ) Write-Verbose -Message "Getting Search Topology for '$ServiceAppName'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $ConfirmPreference = 'None' @@ -225,19 +220,14 @@ function Set-TargetResource [Parameter(Mandatory = $true)] [System.String] - $FirstPartitionDirectory, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $FirstPartitionDirectory ) Write-Verbose -Message "Setting Search Topology for '$ServiceAppName'" $CurrentValues = Get-TargetResource @PSBoundParameters - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $CurrentValues) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $CurrentValues) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -486,24 +476,24 @@ function Set-TargetResource -or ($_.ServerName -eq ($ComponentToRemove -replace $domain))) ` -and ($_.IndexPartitionOrdinal -eq 0) } - } - else - { - $component = Get-SPEnterpriseSearchComponent -SearchTopology $newTopology | ` - Where-Object -FilterScript { - ($_.GetType().Name -eq $componentTypes.$CurrentSearchProperty) ` - -and (($_.ServerName -eq $ComponentToRemove) ` - -or ($_.ServerName -eq ($ComponentToRemove -replace $domain))) - } + } + else + { + $component = Get-SPEnterpriseSearchComponent -SearchTopology $newTopology | ` + Where-Object -FilterScript { + ($_.GetType().Name -eq $componentTypes.$CurrentSearchProperty) ` + -and (($_.ServerName -eq $ComponentToRemove) ` + -or ($_.ServerName -eq ($ComponentToRemove -replace $domain))) } + } - if ($null -ne $component) - { - $component | Remove-SPEnterpriseSearchComponent -SearchTopology $newTopology ` - -Confirm:$false - } - } + if ($null -ne $component) + { + $component | Remove-SPEnterpriseSearchComponent -SearchTopology $newTopology ` + -Confirm:$false } + } + } # Look for components that have no server name and remove them $idsWithNoName = (Get-SPEnterpriseSearchComponent -SearchTopology $newTopology | ` @@ -515,158 +505,153 @@ function Set-TargetResource Get-SPEnterpriseSearchComponent -SearchTopology $newTopology | ` Where-Object -FilterScript { $_.ComponentId -eq $id - } | ` - Remove-SPEnterpriseSearchComponent -SearchTopology $newTopology ` + } | Remove-SPEnterpriseSearchComponent -SearchTopology $newTopology ` -Confirm:$false - } - - # Apply the new topology to the farm - Write-Verbose -Message "Applying new Search topology" - Set-SPEnterpriseSearchTopology -Identity $newTopology - } } - function Test-TargetResource - { - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter(Mandatory = $true)] - [System.String] - $ServiceAppName, - - [Parameter(Mandatory = $true)] - [System.String[]] - $Admin, - - [Parameter(Mandatory = $true)] - [System.String[]] - $Crawler, - - [Parameter(Mandatory = $true)] - [System.String[]] - $ContentProcessing, - - [Parameter(Mandatory = $true)] - [System.String[]] - $AnalyticsProcessing, - - [Parameter(Mandatory = $true)] - [System.String[]] - $QueryProcessing, - - [Parameter(Mandatory = $true)] - [System.String[]] - $IndexPartition, - - [Parameter(Mandatory = $true)] - [System.String] - $FirstPartitionDirectory, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount - ) - - Write-Verbose -Message "Testing Search Topology for '$ServiceAppName'" - - $CurrentValues = Get-TargetResource @PSBoundParameters - - $domain = "." + (Get-CimInstance -ClassName Win32_ComputerSystem).Domain - $PSBoundParameters.Admin = $PSBoundParameters.Admin -replace $domain - $PSBoundParameters.Crawler = $PSBoundParameters.Crawler -replace $domain - $PSBoundParameters.ContentProcessing = $PSBoundParameters.ContentProcessing -replace $domain - $PSBoundParameters.AnalyticsProcessing = $PSBoundParameters.AnalyticsProcessing -replace $domain - $PSBoundParameters.QueryProcessing = $PSBoundParameters.QueryProcessing -replace $domain - $PSBoundParameters.IndexPartition = $PSBoundParameters.IndexPartition -replace $domain - - Write-Verbose -Message "Current Values: $(Convert-SPDscHashtableToString -Hashtable $CurrentValues)" - Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" - - $result = Test-SPDscParameterState -CurrentValues $CurrentValues ` - -Source $($MyInvocation.MyCommand.Source) ` - -DesiredValues $PSBoundParameters ` - -ValuesToCheck @( - "Admin", - "Crawler", - "ContentProcessing", - "AnalyticsProcessing", - "QueryProcessing", - "IndexPartition" - ) - - Write-Verbose -Message "Test-TargetResource returned $result" - - return $result - } + # Apply the new topology to the farm + Write-Verbose -Message "Applying new Search topology" + Set-SPEnterpriseSearchTopology -Identity $newTopology + } +} - function Export-TargetResource - { - $VerbosePreference = "SilentlyContinue" - $ParentModuleBase = Get-Module "SharePointDsc" -ListAvailable | Select-Object -ExpandProperty Modulebase - $module = Join-Path -Path $ParentModuleBase -ChildPath "\DSCResources\MSFT_SPSearchTopology\MSFT_SPSearchTopology.psm1" -Resolve - $Content = '' - $params = Get-DSCFakeParameters -ModulePath $module +function Test-TargetResource +{ + [CmdletBinding()] + [OutputType([System.Boolean])] + param + ( + [Parameter(Mandatory = $true)] + [System.String] + $ServiceAppName, - $ssas = Get-SPServiceApplication | Where-Object -FilterScript { $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" } + [Parameter(Mandatory = $true)] + [System.String[]] + $Admin, - $i = 1 - $total = $ssas.Length - foreach ($ssa in $ssas) - { - try - { - if ($null -ne $ssa) - { - $serviceName = $ssa.DisplayName - Write-Host "Scanning Search Topology for Service Application [$i/$total] {$serviceName}" - $PartialContent = " SPSearchTopology " + [System.Guid]::NewGuid().ToString() + "`r`n" - $PartialContent += " {`r`n" - $params.ServiceAppName = $serviceName - $results = Get-TargetResource @params + [Parameter(Mandatory = $true)] + [System.String[]] + $Crawler, - Add-ConfigurationDataEntry -Node "NonNodeData" -Key "SearchContentProcessingServers" -Value $results.ContentProcessing -Description "List of servers that will act as Search Content Processors;" - $results.ContentProcessing = "`$ConfigurationData.NonNodeData.SearchContentProcessingServers" + [Parameter(Mandatory = $true)] + [System.String[]] + $ContentProcessing, - Add-ConfigurationDataEntry -Node "NonNodeData" -Key "SearchAnalyticsProcessingServers" -Value $results.AnalyticsProcessing -Description "List of servers that will act as Search Analytics Processors;" - $results.AnalyticsProcessing = "`$ConfigurationData.NonNodeData.SearchAnalyticsProcessingServers" + [Parameter(Mandatory = $true)] + [System.String[]] + $AnalyticsProcessing, - Add-ConfigurationDataEntry -Node "NonNodeData" -Key "SearchIndexPartitionServers" -Value $results.IndexPartition -Description "List of servers that will host the Search Index Partitions;" - $results.IndexPartition = "`$ConfigurationData.NonNodeData.SearchIndexPartitionServers" + [Parameter(Mandatory = $true)] + [System.String[]] + $QueryProcessing, - Add-ConfigurationDataEntry -Node "NonNodeData" -Key "SearchCrawlerServers" -Value $results.Crawler -Description "List of servers that will act as Search Crawlers;" - $results.Crawler = "`$ConfigurationData.NonNodeData.SearchCrawlerServers" + [Parameter(Mandatory = $true)] + [System.String[]] + $IndexPartition, - Add-ConfigurationDataEntry -Node "NonNodeData" -Key "SearchAdminServers" -Value $results.Admin -Description "List of servers that will host the Search Admin Components;" - $results.Admin = "`$ConfigurationData.NonNodeData.SearchAdminServers" + [Parameter(Mandatory = $true)] + [System.String] + $FirstPartitionDirectory + ) - Add-ConfigurationDataEntry -Node "NonNodeData" -Key "QueryProcessingServers" -Value $results.QueryProcessing -Description "List of servers that will host the Search Query Components;" - $results.QueryProcessing = "`$ConfigurationData.NonNodeData.QueryProcessingServers" + Write-Verbose -Message "Testing Search Topology for '$ServiceAppName'" - if ($results.FirstPartitionDirectory.Length -gt 1) - { - $results.FirstPartitionDirectory = $results.FirstPartitionDirectory - } + $CurrentValues = Get-TargetResource @PSBoundParameters - $results = Repair-Credentials -results $results + $domain = "." + (Get-CimInstance -ClassName Win32_ComputerSystem).Domain + $PSBoundParameters.Admin = $PSBoundParameters.Admin -replace $domain + $PSBoundParameters.Crawler = $PSBoundParameters.Crawler -replace $domain + $PSBoundParameters.ContentProcessing = $PSBoundParameters.ContentProcessing -replace $domain + $PSBoundParameters.AnalyticsProcessing = $PSBoundParameters.AnalyticsProcessing -replace $domain + $PSBoundParameters.QueryProcessing = $PSBoundParameters.QueryProcessing -replace $domain + $PSBoundParameters.IndexPartition = $PSBoundParameters.IndexPartition -replace $domain + + Write-Verbose -Message "Current Values: $(Convert-SPDscHashtableToString -Hashtable $CurrentValues)" + Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" + + $result = Test-SPDscParameterState -CurrentValues $CurrentValues ` + -Source $($MyInvocation.MyCommand.Source) ` + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @( + "Admin", + "Crawler", + "ContentProcessing", + "AnalyticsProcessing", + "QueryProcessing", + "IndexPartition" + ) - $currentBlock = Get-DSCBlock -Params $results -ModulePath $module - $currentBlock = Convert-DSCStringParamToVariable -DSCBlock $currentBlock -ParameterName "PsDscRunAsCredential" - $PartialContent += $currentBlock - $PartialContent += " }`r`n" - $Content += $PartialContent - $i++ - } - } - catch + Write-Verbose -Message "Test-TargetResource returned $result" + + return $result +} + +function Export-TargetResource +{ + $VerbosePreference = "SilentlyContinue" + $ParentModuleBase = Get-Module "SharePointDsc" -ListAvailable | Select-Object -ExpandProperty Modulebase + $module = Join-Path -Path $ParentModuleBase -ChildPath "\DSCResources\MSFT_SPSearchTopology\MSFT_SPSearchTopology.psm1" -Resolve + $Content = '' + $params = Get-DSCFakeParameters -ModulePath $module + + $ssas = Get-SPServiceApplication | Where-Object -FilterScript { $_.GetType().FullName -eq "Microsoft.Office.Server.Search.Administration.SearchServiceApplication" } + + $i = 1 + $total = $ssas.Length + foreach ($ssa in $ssas) + { + try + { + if ($null -ne $ssa) + { + $serviceName = $ssa.DisplayName + Write-Host "Scanning Search Topology for Service Application [$i/$total] {$serviceName}" + $PartialContent = " SPSearchTopology " + [System.Guid]::NewGuid().ToString() + "`r`n" + $PartialContent += " {`r`n" + $params.ServiceAppName = $serviceName + $results = Get-TargetResource @params + + Add-ConfigurationDataEntry -Node "NonNodeData" -Key "SearchContentProcessingServers" -Value $results.ContentProcessing -Description "List of servers that will act as Search Content Processors;" + $results.ContentProcessing = "`$ConfigurationData.NonNodeData.SearchContentProcessingServers" + + Add-ConfigurationDataEntry -Node "NonNodeData" -Key "SearchAnalyticsProcessingServers" -Value $results.AnalyticsProcessing -Description "List of servers that will act as Search Analytics Processors;" + $results.AnalyticsProcessing = "`$ConfigurationData.NonNodeData.SearchAnalyticsProcessingServers" + + Add-ConfigurationDataEntry -Node "NonNodeData" -Key "SearchIndexPartitionServers" -Value $results.IndexPartition -Description "List of servers that will host the Search Index Partitions;" + $results.IndexPartition = "`$ConfigurationData.NonNodeData.SearchIndexPartitionServers" + + Add-ConfigurationDataEntry -Node "NonNodeData" -Key "SearchCrawlerServers" -Value $results.Crawler -Description "List of servers that will act as Search Crawlers;" + $results.Crawler = "`$ConfigurationData.NonNodeData.SearchCrawlerServers" + + Add-ConfigurationDataEntry -Node "NonNodeData" -Key "SearchAdminServers" -Value $results.Admin -Description "List of servers that will host the Search Admin Components;" + $results.Admin = "`$ConfigurationData.NonNodeData.SearchAdminServers" + + Add-ConfigurationDataEntry -Node "NonNodeData" -Key "QueryProcessingServers" -Value $results.QueryProcessing -Description "List of servers that will host the Search Query Components;" + $results.QueryProcessing = "`$ConfigurationData.NonNodeData.QueryProcessingServers" + + if ($results.FirstPartitionDirectory.Length -gt 1) { - $_ - $Global:ErrorLog += "[Search Topology]" + $ssa.DisplayName + "`r`n" - $Global:ErrorLog += "$_`r`n`r`n" + $results.FirstPartitionDirectory = $results.FirstPartitionDirectory } + + $results = Repair-Credentials -results $results + + $currentBlock = Get-DSCBlock -Params $results -ModulePath $module + $currentBlock = Convert-DSCStringParamToVariable -DSCBlock $currentBlock -ParameterName "PsDscRunAsCredential" + $PartialContent += $currentBlock + $PartialContent += " }`r`n" + $Content += $PartialContent + $i++ } - return $Content } + catch + { + $_ + $Global:ErrorLog += "[Search Topology]" + $ssa.DisplayName + "`r`n" + $Global:ErrorLog += "$_`r`n`r`n" + } + } + return $Content +} - Export-ModuleMember -Function *-TargetResource +Export-ModuleMember -Function *-TargetResource diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.schema.mof index 661fae08f..2f21bdfa0 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSearchTopology/MSFT_SPSearchTopology.schema.mof @@ -9,5 +9,4 @@ class MSFT_SPSearchTopology : OMI_BaseResource [Required, Description("A list of servers that will run the query processing component")] String QueryProcessing[]; [Required, Description("A list of servers that will host the first (0) index partition")] String IndexPartition[]; [Required, Description("The local directory servers will use to store the first index partition")] String FirstPartitionDirectory; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.psm1 index c6f77500c..0b65b900e 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.psm1 @@ -59,17 +59,12 @@ function Get-TargetResource [Parameter()] [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DatabaseCredentials ) Write-Verbose -Message "Getting secure store service application '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -202,11 +197,7 @@ function Set-TargetResource [Parameter()] [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DatabaseCredentials ) Write-Verbose -Message "Setting secure store service application '$Name'" @@ -217,8 +208,7 @@ function Set-TargetResource if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message "Creating Secure Store Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $params ` + Invoke-SPDscCommand -Arguments $params ` -ScriptBlock { $params = $args[0] @@ -293,8 +283,7 @@ function Set-TargetResource -and $ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating Secure Store Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -312,8 +301,7 @@ function Set-TargetResource { # The service app should not exit Write-Verbose -Message "Removing Secure Store Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -398,11 +386,7 @@ function Test-TargetResource [Parameter()] [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DatabaseCredentials ) Write-Verbose -Message "Testing secure store service application $Name" @@ -478,11 +462,6 @@ function Export-TargetResource $PartialContent += " {`r`n" $results = Get-TargetResource @params - if ($results.Contains("InstallAccount")) - { - $results.Remove("InstallAccount") - } - $results = Repair-Credentials -results $results $foundFailOver = $false diff --git a/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.schema.mof index 607fd8673..832a4dd7e 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSecureStoreServiceApp/MSFT_SPSecureStoreServiceApp.schema.mof @@ -14,7 +14,5 @@ class MSFT_SPSecureStoreServiceApp : OMI_BaseResource [Write, Description("Is sharing enabled for this service app")] boolean Sharing; [Write, Description("Specify the Master Key to be used to encrypt the secrets. Only used during creation of the Service Application"), EmbeddedInstance("MSFT_Credential")] String MasterKey; [Write, Description("Present if the service app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Write, Description("Should SQL Server authentication be used to connect to the database?")] Boolean UseSQLAuthentication; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPSecurityTokenServiceConfig/MSFT_SPSecurityTokenServiceConfig.psm1 b/SharePointDsc/DSCResources/MSFT_SPSecurityTokenServiceConfig/MSFT_SPSecurityTokenServiceConfig.psm1 index 5eb784718..5d2b967dc 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSecurityTokenServiceConfig/MSFT_SPSecurityTokenServiceConfig.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSecurityTokenServiceConfig/MSFT_SPSecurityTokenServiceConfig.psm1 @@ -41,10 +41,6 @@ function Get-TargetResource [System.UInt32] $LogonTokenCacheExpirationWindow, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [ValidateSet("Present", "Absent")] [System.String] @@ -83,8 +79,7 @@ function Get-TargetResource } } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -166,10 +161,6 @@ function Set-TargetResource [System.UInt32] $LogonTokenCacheExpirationWindow, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [ValidateSet("Present", "Absent")] [System.String] @@ -219,8 +210,7 @@ function Set-TargetResource } } - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $config = Get-SPSecurityTokenServiceConfig @@ -330,10 +320,6 @@ function Test-TargetResource [System.UInt32] $LogonTokenCacheExpirationWindow, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [ValidateSet("Present", "Absent")] [System.String] diff --git a/SharePointDsc/DSCResources/MSFT_SPSecurityTokenServiceConfig/MSFT_SPSecurityTokenServiceConfig.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSecurityTokenServiceConfig/MSFT_SPSecurityTokenServiceConfig.schema.mof index 8dac9329c..b3f7ef973 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSecurityTokenServiceConfig/MSFT_SPSecurityTokenServiceConfig.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSecurityTokenServiceConfig/MSFT_SPSecurityTokenServiceConfig.schema.mof @@ -11,5 +11,4 @@ class MSFT_SPSecurityTokenServiceConfig : OMI_BaseResource [Write, Description("Timespan in minutes to set WindowsTokenLifetime")] UInt32 WindowsTokenLifetime; [Write, Description("Timespan in minutes to set LogonTokenCacheExpirationWindow")] UInt32 LogonTokenCacheExpirationWindow; [Write, Description("Present ensures the configurations are applied"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPSelfServiceSiteCreation/MSFT_SPSelfServiceSiteCreation.psm1 b/SharePointDsc/DSCResources/MSFT_SPSelfServiceSiteCreation/MSFT_SPSelfServiceSiteCreation.psm1 index 23a59ae73..de0f20d6e 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSelfServiceSiteCreation/MSFT_SPSelfServiceSiteCreation.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSelfServiceSiteCreation/MSFT_SPSelfServiceSiteCreation.psm1 @@ -56,11 +56,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Modern", "Classic", "Latest")] [System.String] - $UserExperienceVersion, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $UserExperienceVersion ) Write-Verbose -Message "Getting self service site creation settings for Web Application '$WebAppUrl'" @@ -112,8 +108,7 @@ function Get-TargetResource } } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -245,11 +240,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Modern", "Classic", "Latest")] [System.String] - $UserExperienceVersion, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $UserExperienceVersion ) Write-Verbose -Message "Setting self service site creation settings for Web Application '$WebAppUrl'" @@ -306,8 +297,7 @@ function Set-TargetResource } } - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -545,11 +535,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Modern", "Classic", "Latest")] [System.String] - $UserExperienceVersion, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $UserExperienceVersion ) Write-Verbose -Message "Testing self service site creation settings for Web Application '$WebAppUrl'" diff --git a/SharePointDsc/DSCResources/MSFT_SPSelfServiceSiteCreation/MSFT_SPSelfServiceSiteCreation.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSelfServiceSiteCreation/MSFT_SPSelfServiceSiteCreation.schema.mof index 82f2b4136..a578a824e 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSelfServiceSiteCreation/MSFT_SPSelfServiceSiteCreation.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSelfServiceSiteCreation/MSFT_SPSelfServiceSiteCreation.schema.mof @@ -14,5 +14,4 @@ class MSFT_SPSelfServiceSiteCreation : OMI_BaseResource [Write, Description("Specifies the managed path in which site collections have to be created (SP2019 only)")] string ManagedPath; [Write, Description("Specifies the URL of the web application in which site collections have to be created (SP2019 only)")] string AlternateUrl; [Write, Description("Specifies the if the site collection has to be created as modern or classic site (SP2019 only)"), ValueMap{"Modern","Classic","Latest"}, Values{"Modern","Classic","Latest"}] string UserExperienceVersion; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPService/MSFT_SPService.psm1 b/SharePointDsc/DSCResources/MSFT_SPService/MSFT_SPService.psm1 index b548e860d..7ba42f346 100644 --- a/SharePointDsc/DSCResources/MSFT_SPService/MSFT_SPService.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPService/MSFT_SPService.psm1 @@ -11,11 +11,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting status for service '$Name'" @@ -31,8 +27,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters) ` -ScriptBlock { $params = $args[0] @@ -75,11 +70,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting status for service '$Name'" @@ -96,8 +87,7 @@ function Set-TargetResource } $invokeArgs = @{ - Credential = $InstallAccount - Arguments = @($PSBoundParameters, $MyInvocation.MyCommand.Source) + Arguments = @($PSBoundParameters, $MyInvocation.MyCommand.Source) } if ($Ensure -eq "Present") @@ -193,11 +183,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing status for service '$Name'" diff --git a/SharePointDsc/DSCResources/MSFT_SPService/MSFT_SPService.schema.mof b/SharePointDsc/DSCResources/MSFT_SPService/MSFT_SPService.schema.mof index 296865300..14fb5d6a5 100644 --- a/SharePointDsc/DSCResources/MSFT_SPService/MSFT_SPService.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPService/MSFT_SPService.schema.mof @@ -3,5 +3,4 @@ class MSFT_SPService : OMI_BaseResource { [Key, Description("The name of the service instance to manage")] string Name; [Write, Description("Present to ensure the service runs in the farm, or absent to ensure it is stopped"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.psm1 b/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.psm1 index 8ded46aef..edad64d42 100644 --- a/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.psm1 @@ -15,17 +15,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting service application pool '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -64,11 +59,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting service application pool '$Name'" @@ -78,8 +69,7 @@ function Set-TargetResource if ($CurrentValues.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message "Creating Service Application Pool $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -101,8 +91,7 @@ function Set-TargetResource if ($CurrentValues.Ensure -eq "Present" -and $Ensure -eq "Present") { Write-Verbose -Message "Updating Service Application Pool $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -118,8 +107,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing Service Application Pool $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] Remove-SPServiceApplicationPool -Identity $params.Name -Confirm:$false @@ -144,11 +132,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing service application pool '$Name'" diff --git a/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.schema.mof b/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.schema.mof index a562ae7fb..726c32a21 100644 --- a/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPServiceAppPool/MSFT_SPServiceAppPool.schema.mof @@ -4,6 +4,4 @@ class MSFT_SPServiceAppPool : OMI_BaseResource [Key, Description("The name of application pool")] string Name; [Required, Description("The name of the managed account to run this service account as")] string ServiceAccount; [Write, Description("Present if the service app pool should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.psm1 b/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.psm1 index c766dc153..261192cb6 100644 --- a/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.psm1 @@ -23,11 +23,7 @@ function Get-TargetResource [Parameter()] [System.String[]] - $ServiceAppProxiesToExclude, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ServiceAppProxiesToExclude ) Write-Verbose -Message "Getting Service Application Proxy Group $Name" @@ -61,8 +57,7 @@ function Get-TargetResource return $nullReturn } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -123,11 +118,7 @@ function Set-TargetResource [Parameter()] [System.String[]] - $ServiceAppProxiesToExclude, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ServiceAppProxiesToExclude ) Write-Verbose -Message "Setting Service Application Proxy Group $Name" @@ -161,8 +152,7 @@ function Set-TargetResource throw $message } - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -415,11 +405,7 @@ function Test-TargetResource [Parameter()] [System.String[]] - $ServiceAppProxiesToExclude, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ServiceAppProxiesToExclude ) Write-Verbose -Message "Testing Service Application Proxy Group $Name" diff --git a/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.schema.mof b/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.schema.mof index cfb861d69..0e5742230 100644 --- a/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPServiceAppProxyGroup/MSFT_SPServiceAppProxyGroup.schema.mof @@ -6,5 +6,4 @@ class MSFT_SPServiceAppProxyGroup : OMI_BaseResource [Write, Description("List of service application proxies that belong in this proxy group, all others will be removed")] String ServiceAppProxies[]; [Write, Description("List of service application proxies to add to this proxy group, existing proxies will remain")] String ServiceAppProxiesToInclude[]; [Write, Description("List of service application proxies to remove from this proxy grop, all others will remain")] String ServiceAppProxiesToExclude[]; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.psm1 b/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.psm1 index d6fd7366d..1ba5c2dcd 100644 --- a/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.psm1 @@ -23,11 +23,7 @@ function Get-TargetResource [Parameter()] [System.String[]] - $MembersToExclude, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $MembersToExclude ) Write-Verbose -Message "Getting all security options for $SecurityType in $ServiceAppName" @@ -54,8 +50,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -232,11 +227,7 @@ function Set-TargetResource [Parameter()] [System.String[]] - $MembersToExclude, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $MembersToExclude ) Write-Verbose -Message "Setting all security options for $SecurityType in $ServiceAppName" @@ -265,8 +256,7 @@ function Set-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $CurrentValues) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $CurrentValues) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -550,11 +540,7 @@ function Test-TargetResource [Parameter()] [System.String[]] - $MembersToExclude, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $MembersToExclude ) Write-Verbose -Message "Testing all security options for $SecurityType in $ServiceAppName" @@ -574,8 +560,7 @@ function Test-TargetResource return $false } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $CurrentValues, $PSScriptRoot, $MyInvocation.MyCommand.Source) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $CurrentValues, $PSScriptRoot, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $CurrentValues = $args[1] diff --git a/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.schema.mof b/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.schema.mof index 03e6bc77b..96acaad96 100644 --- a/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPServiceAppSecurity/MSFT_SPServiceAppSecurity.schema.mof @@ -12,5 +12,4 @@ class MSFT_SPServiceAppSecurity : OMI_BaseResource [Write, Description("A list of members to set the group to. Those not in this list will be removed"), EmbeddedInstance("MSFT_SPServiceAppSecurityEntry")] String Members[]; [Write, Description("A list of members to add. Members not in this list will be left in the group"), EmbeddedInstance("MSFT_SPServiceAppSecurityEntry")] String MembersToInclude[]; [Write, Description("A list of members to remove. Members not in this list will be left in the group")] String MembersToExclude[]; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPServiceIdentity/MSFT_SPServiceIdentity.psm1 b/SharePointDsc/DSCResources/MSFT_SPServiceIdentity/MSFT_SPServiceIdentity.psm1 index e89e49039..86ad1a613 100644 --- a/SharePointDsc/DSCResources/MSFT_SPServiceIdentity/MSFT_SPServiceIdentity.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPServiceIdentity/MSFT_SPServiceIdentity.psm1 @@ -8,10 +8,6 @@ function Get-TargetResource [System.String] $Name, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter(Mandatory = $true)] [System.String] $ManagedAccount @@ -19,7 +15,7 @@ function Get-TargetResource Write-Verbose -Message "Getting identity for service instance '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] if ($params.Name -eq "SharePoint Server Search") @@ -78,10 +74,6 @@ function Set-TargetResource [System.String] $Name, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter(Mandatory = $true)] [System.String] $ManagedAccount @@ -89,8 +81,7 @@ function Set-TargetResource Write-Verbose -Message "Setting service instance '$Name' to '$ManagedAccount'" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -166,10 +157,6 @@ function Test-TargetResource [System.String] $Name, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter(Mandatory = $true)] [System.String] $ManagedAccount diff --git a/SharePointDsc/DSCResources/MSFT_SPServiceIdentity/MSFT_SPServiceIdentity.schema.mof b/SharePointDsc/DSCResources/MSFT_SPServiceIdentity/MSFT_SPServiceIdentity.schema.mof index eb1e61307..dbb93cc6e 100644 --- a/SharePointDsc/DSCResources/MSFT_SPServiceIdentity/MSFT_SPServiceIdentity.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPServiceIdentity/MSFT_SPServiceIdentity.schema.mof @@ -3,5 +3,4 @@ class MSFT_SPServiceIdentity : OMI_BaseResource { [Key, Description("The name of the service instance to manage")] string Name; [Required, Description("The user name of a managed account, LocalService, LocalSystem or NetworkService that will be used to run the service") ] string ManagedAccount; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.psm1 b/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.psm1 index a670975a4..446fe95de 100644 --- a/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.psm1 @@ -8,10 +8,6 @@ function Get-TargetResource [System.String] $Name, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [ValidateSet("Present", "Absent")] [System.String] @@ -23,8 +19,7 @@ function Get-TargetResource $newName = (Get-SPDscServiceTypeName -DisplayName $Name) $invokeArgs = @{ - Credential = $InstallAccount - Arguments = @($PSBoundParameters, $newName) + Arguments = @($PSBoundParameters, $newName) } $result = Invoke-SPDscCommand @invokeArgs -ScriptBlock { $params = $args[0] @@ -80,10 +75,6 @@ function Set-TargetResource [System.String] $Name, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [ValidateSet("Present", "Absent")] [System.String] @@ -94,8 +85,7 @@ function Set-TargetResource $newName = (Get-SPDscServiceTypeName -DisplayName $Name) $invokeArgs = @{ - Credential = $InstallAccount - Arguments = @($PSBoundParameters, $MyInvocation.MyCommand.Source, $newName) + Arguments = @($PSBoundParameters, $MyInvocation.MyCommand.Source, $newName) } if ($Ensure -eq "Present") @@ -227,10 +217,6 @@ function Test-TargetResource [System.String] $Name, - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [ValidateSet("Present", "Absent")] [System.String] diff --git a/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.schema.mof b/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.schema.mof index 875823de5..518f20d76 100644 --- a/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPServiceInstance/MSFT_SPServiceInstance.schema.mof @@ -3,5 +3,4 @@ class MSFT_SPServiceInstance : OMI_BaseResource { [Key, Description("The name of the service instance to manage")] string Name; [Write, Description("Present to ensure it runs on this server, or absent to ensure it is stopped"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.psm1 b/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.psm1 index 0a4274530..0965c01f2 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.psm1 @@ -27,17 +27,12 @@ function Get-TargetResource [Parameter()] [System.UInt32] - $SessionTimeout, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SessionTimeout ) Write-Verbose -Message "Getting SPSessionStateService info" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $svc = Get-SPSessionStateService $Ensure = "Absent" @@ -83,11 +78,7 @@ function Set-TargetResource [Parameter()] [System.UInt32] - $SessionTimeout, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SessionTimeout ) Write-Verbose -Message "Setting SPSessionStateService info" @@ -99,8 +90,7 @@ function Set-TargetResource if ($Ensure -eq "Present") { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -136,8 +126,7 @@ function Set-TargetResource } if ($Ensure -eq "Absent") { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $svc = Get-SPSessionStateService if ($svc.SessionStateEnabled) @@ -182,11 +171,7 @@ function Test-TargetResource [Parameter()] [System.UInt32] - $SessionTimeout, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SessionTimeout ) Write-Verbose -Message "Testing SPSessionStateService info" diff --git a/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.schema.mof index 77489023d..a160040b1 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSessionStateService/MSFT_SPSessionStateService.schema.mof @@ -5,8 +5,6 @@ class MSFT_SPSessionStateService : OMI_BaseResource [Key, Description("The name of the database server for the database")] string DatabaseServer; [Write, Description("Present is the state service should be enabled, absent if it should be disabled"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; [Write, Description("What is the timeout on sessions")] uint32 SessionTimeout; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Write, Description("Should SQL Server authentication be used to connect to the database?")] Boolean UseSQLAuthentication; [Write, Description("If using SQL authentication, the SQL credentials to use to connect to the instance"), EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.psm1 b/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.psm1 index 585a72b79..1146067c9 100644 --- a/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.psm1 @@ -31,11 +31,7 @@ function Get-TargetResource [Parameter()] [System.String[]] - $ExcludeDatabases, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ExcludeDatabases ) Write-Verbose -Message "Getting Shell Admins config" @@ -102,8 +98,7 @@ function Get-TargetResource return $nullreturn } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] $scriptRoot = $args[1] @@ -189,11 +184,7 @@ function Set-TargetResource [Parameter()] [System.String[]] - $ExcludeDatabases, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ExcludeDatabases ) Write-Verbose -Message "Setting Shell Admin config" @@ -277,8 +268,7 @@ function Set-TargetResource throw $message } - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot) ` + $null = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -867,11 +857,7 @@ function Test-TargetResource [Parameter()] [System.String[]] - $ExcludeDatabases, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ExcludeDatabases ) Write-Verbose -Message "Testing Shell Admin settings" diff --git a/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.schema.mof b/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.schema.mof index be91a5c86..bfb570c64 100644 --- a/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPShellAdmins/MSFT_SPShellAdmins.schema.mof @@ -16,6 +16,4 @@ class MSFT_SPShellAdmins : OMI_BaseResource [Write, Description("Shell Admin configuration of Databases"), EmbeddedInstance("MSFT_SPDatabasePermissions")] String Databases[]; [Write, Description("Specify if all databases must get the same config as the general config")] Boolean AllDatabases; [Write, Description("Specify all databases that must be excluded from AllDatabases")] String ExcludeDatabases[]; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.psm1 b/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.psm1 index 9119f4812..839039954 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.psm1 @@ -63,17 +63,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("TenantAdministration", "None")] [System.String] - $AdministrationSiteType, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AdministrationSiteType ) Write-Verbose -Message "Getting site collection $Url" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $site = $null @@ -261,11 +256,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("TenantAdministration", "None")] [System.String] - $AdministrationSiteType, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AdministrationSiteType ) Write-Verbose -Message "Setting site collection $Url" @@ -277,16 +268,13 @@ function Set-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $CurrentValues) ` + $null = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $CurrentValues) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] $CurrentValues = $args[2] $doCreateDefaultGroups = $false - $params.Remove("InstallAccount") | Out-Null - $CreateDefaultGroups = $params.CreateDefaultGroups $params.Remove("CreateDefaultGroups") | Out-Null @@ -541,11 +529,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("TenantAdministration", "None")] [System.String] - $AdministrationSiteType, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AdministrationSiteType ) Write-Verbose -Message "Testing site collection $Url" diff --git a/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.schema.mof index f562260cb..3bb7b978b 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.schema.mof @@ -16,6 +16,4 @@ class MSFT_SPSite : OMI_BaseResource [Write, Description("The template to apply to the site collection")] string Template; [Write, Description("Create the default site groups in the site collection")] boolean CreateDefaultGroups; [Write, Description("Specifies the type of the site collection: Regular site or tenant administration site"), ValueMap{"TenantAdministration","None"}, Values{"TenantAdministration","None"}] string AdministrationSiteType; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPSitePropertyBag/MSFT_SPSitePropertyBag.psm1 b/SharePointDsc/DSCResources/MSFT_SPSitePropertyBag/MSFT_SPSitePropertyBag.psm1 index d43666af6..d3f68ae12 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSitePropertyBag/MSFT_SPSitePropertyBag.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSitePropertyBag/MSFT_SPSitePropertyBag.psm1 @@ -19,17 +19,12 @@ function Get-TargetResource [Parameter()] [ValidateSet('Present', 'Absent')] [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = 'Present' ) Write-Verbose -Message "Looking for SPSite property '$Key'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -88,17 +83,12 @@ function Set-TargetResource() [Parameter()] [ValidateSet('Present', 'Absent')] [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = 'Present' ) Write-Verbose -Message "Setting SPSite property '$Key'" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -166,11 +156,7 @@ function Test-TargetResource() [Parameter()] [ValidateSet('Present', 'Absent')] [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = 'Present' ) Write-Verbose -Message "Testing SPSite property '$Key'" diff --git a/SharePointDsc/DSCResources/MSFT_SPSitePropertyBag/MSFT_SPSitePropertyBag.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSitePropertyBag/MSFT_SPSitePropertyBag.schema.mof index cf99ea52f..618c2da72 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSitePropertyBag/MSFT_SPSitePropertyBag.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSitePropertyBag/MSFT_SPSitePropertyBag.schema.mof @@ -5,5 +5,4 @@ class MSFT_SPSitePropertyBag : OMI_BaseResource [Key, Description("The key of the SPSite property")] string Key; [Write, Description("Value of the SPSite property")] String Value; [Write, Description("Set to present to ensure the SPSite property exists, or absent to ensure it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPSitePropertyBag/readme.md b/SharePointDsc/DSCResources/MSFT_SPSitePropertyBag/readme.md index 60a5ede1c..26c792ab2 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSitePropertyBag/readme.md +++ b/SharePointDsc/DSCResources/MSFT_SPSitePropertyBag/readme.md @@ -4,8 +4,8 @@ **Requires CredSSP:** No This resource is used to work with SharePoint Property Bags at the site -collection level. The account that runs this resource (PsDscRunAsCredential -or InstallAccount) must be a site collection administrator. +collection level. The account that runs this resource (PsDscRunAsCredential) +must be a site collection administrator. The default value for the Ensure parameter is Present. When not specifying this parameter, the property bag is configured. diff --git a/SharePointDsc/DSCResources/MSFT_SPSiteUrl/MSFT_SPSiteUrl.psm1 b/SharePointDsc/DSCResources/MSFT_SPSiteUrl/MSFT_SPSiteUrl.psm1 index 6d3fa3390..f616d2463 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSiteUrl/MSFT_SPSiteUrl.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSiteUrl/MSFT_SPSiteUrl.psm1 @@ -22,11 +22,7 @@ function Get-TargetResource [Parameter()] [System.String] - $Custom, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Custom ) Write-Verbose -Message "Getting site collection url for $Url" @@ -39,8 +35,7 @@ function Get-TargetResource Write-Verbose -Message "No zone is specified" } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -134,11 +129,7 @@ function Set-TargetResource [Parameter()] [System.String] - $Custom, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Custom ) Write-Verbose -Message "Setting site collection url for $Url" @@ -156,8 +147,7 @@ function Set-TargetResource throw $message } - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -331,11 +321,7 @@ function Test-TargetResource [Parameter()] [System.String] - $Custom, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Custom ) Write-Verbose -Message "Testing site collection url for $Url" diff --git a/SharePointDsc/DSCResources/MSFT_SPSiteUrl/MSFT_SPSiteUrl.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSiteUrl/MSFT_SPSiteUrl.schema.mof index 99073b701..110715f48 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSiteUrl/MSFT_SPSiteUrl.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSiteUrl/MSFT_SPSiteUrl.schema.mof @@ -6,6 +6,4 @@ class MSFT_SPSiteUrl : OMI_BaseResource [Write, Description("The URL of the Internet zone")] string Internet; [Write, Description("The URL of the Extranet zone")] string Extranet; [Write, Description("The URL of the Custom zone")] string Custom; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.psm1 index 898446b95..4dee042ef 100644 --- a/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.psm1 @@ -31,17 +31,12 @@ function Get-TargetResource [Parameter()] [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DatabaseCredentials ) Write-Verbose -Message "Getting state service application '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -113,11 +108,7 @@ function Set-TargetResource [Parameter()] [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DatabaseCredentials ) @@ -126,8 +117,7 @@ function Set-TargetResource if ($Ensure -eq "Present") { Write-Verbose -Message "Creating State Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -171,7 +161,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing State Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Invoke-SPDscCommand -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] $serviceApp = Get-SPStateServiceApplication -Name $params.Name @@ -225,11 +215,7 @@ function Test-TargetResource [Parameter()] [System.Management.Automation.PSCredential] - $DatabaseCredentials, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DatabaseCredentials ) Write-Verbose -Message "Testing for state service application $Name" diff --git a/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.schema.mof b/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.schema.mof index de40be44b..9ea43d23c 100644 --- a/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPStateServiceApp/MSFT_SPStateServiceApp.schema.mof @@ -7,6 +7,5 @@ class MSFT_SPStateServiceApp : OMI_BaseResource [Required, Description("The name of the database for the service app")] string DatabaseName; [Write, Description("The name of the database server")] string DatabaseServer; [Write, Description("Present if the service app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Write, Description("Should SQL Server authentication be used to connect to the database (unlikely, unless using an Azure SQL Managed Instance)?")] Boolean UseSQLAuthentication; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.psm1 index 28cbb27a6..abd650eb8 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.psm1 @@ -31,17 +31,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting Subscription Settings Service '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -124,11 +119,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting Subscription Settings Service '$Name'" @@ -138,8 +129,7 @@ function Set-TargetResource if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message "Creating Subscription Settings Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -171,8 +161,7 @@ function Set-TargetResource if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") { Write-Verbose -Message "Checking proxy for Subscription Settings Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -204,8 +193,7 @@ function Set-TargetResource if ($ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating Subscription Settings Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -222,8 +210,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing Subscription Settings Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -269,11 +256,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing Subscription Settings Service '$Name'" @@ -289,8 +272,7 @@ function Test-TargetResource { if ($CurrentValues.Ensure -eq "Present") { - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] diff --git a/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.schema.mof index 716b5783f..d11822f95 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSubscriptionSettingsServiceApp/MSFT_SPSubscriptionSettingsServiceApp.schema.mof @@ -6,8 +6,6 @@ class MSFT_SPSubscriptionSettingsServiceApp : OMI_BaseResource [Write, Description("The name of the database for the service app")] string DatabaseName; [Write, Description("The name of the database server")] String DatabaseServer; [Write, Description("Present if the service app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Write, Description("Should SQL Server authentication be used to connect to the database?")] Boolean UseSQLAuthentication; [Write, Description("If using SQL authentication, the SQL credentials to use to connect to the instance"), EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.psm1 b/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.psm1 index b23917c98..452780f04 100644 --- a/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.psm1 @@ -18,11 +18,7 @@ function Get-TargetResource [Parameter()] [System.String] - $Schedule, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Schedule ) Write-Verbose -Message "Getting timer job settings for job '$TypeName'" @@ -38,8 +34,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -146,11 +141,7 @@ function Set-TargetResource [Parameter()] [System.String] - $Schedule, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Schedule ) Write-Verbose -Message "Setting timer job settings for job '$TypeName'" @@ -166,8 +157,7 @@ function Set-TargetResource throw $message } - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -413,11 +403,7 @@ function Test-TargetResource [Parameter()] [System.String] - $Schedule, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Schedule ) Write-Verbose -Message "Testing timer job settings for job '$TypeName'" @@ -482,10 +468,6 @@ function Export-TargetResource $PartialContent += " {`r`n" $results = Get-TargetResource @params - if ($results.Contains("InstallAccount")) - { - $results.Remove("InstallAccount") - } $results = Repair-Credentials -results $results $currentBlock = Get-DSCBlock -Params $results -ModulePath $module $currentBlock = Convert-DSCStringParamToVariable -DSCBlock $currentBlock -ParameterName "PsDscRunAsCredential" diff --git a/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.schema.mof b/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.schema.mof index 210e8234e..1fe5b3ee8 100644 --- a/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPTimerJobState/MSFT_SPTimerJobState.schema.mof @@ -5,6 +5,4 @@ class MSFT_SPTimerJobState : OMI_BaseResource [Key, Description("The URL of the web application that the timer job belongs to. Use the value 'N/A' if no web application is applicable")] String WebAppUrl; [Write, Description("Should the timer job be enabled or not")] Boolean Enabled; [Write, Description("The schedule for the timer job to execute on")] String Schedule; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 b/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 index ffbc3a8cf..697a5a64c 100644 --- a/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.psm1 @@ -51,17 +51,12 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $UseWReplyParameter = $false, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $UseWReplyParameter = $false ) Write-Verbose -Message "Getting SPTrustedIdentityTokenIssuer '$Name' settings" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -171,11 +166,7 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $UseWReplyParameter = $false, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $UseWReplyParameter = $false ) Write-Verbose -Message "Setting SPTrustedIdentityTokenIssuer '$Name' settings" @@ -210,8 +201,7 @@ function Set-TargetResource } Write-Verbose -Message "Creating SPTrustedIdentityTokenIssuer '$Name'" - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $null = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -356,8 +346,7 @@ function Set-TargetResource else { Write-Verbose "Removing SPTrustedIdentityTokenIssuer '$Name'" - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $null = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $Name = $params.Name @@ -458,11 +447,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $UseWReplyParameter = $false, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $UseWReplyParameter = $false ) Write-Verbose -Message "Testing SPTrustedIdentityTokenIssuer '$Name' settings" @@ -568,10 +553,6 @@ function Export-TargetResource $results.Remove("SigningCertificateFilePath") } - if ($results.Contains("InstallAccount")) - { - $results.Remove("InstallAccount") - } $results = Repair-Credentials -results $results $currentBlock = Get-DSCBlock -Params $results -ModulePath $module $currentBlock = Convert-DSCStringParamToVariable -DSCBlock $currentBlock -ParameterName "PsDscRunAsCredential" diff --git a/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.schema.mof b/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.schema.mof index 02d68693c..289b50cf1 100644 --- a/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuer/MSFT_SPTrustedIdentityTokenIssuer.schema.mof @@ -23,5 +23,4 @@ class MSFT_SPTrustedIdentityTokenIssuer : OMI_BaseResource [Write, Description("Sign-out URL")] String ProviderSignOutUri; [Write, Description("WReply parameter allows SharePoint to specify the return URL to the 3rd party STS upon successful authentication")] Boolean UseWReplyParameter; [Write, Description("Present if the SPTrustedIdentityTokenIssuer should be created, or Absent if it should be removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, EmbeddedInstance("MSFT_Credential"), Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuerProviderRealms/MSFT_SPTrustedIdentityTokenIssuerProviderRealms.psm1 b/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuerProviderRealms/MSFT_SPTrustedIdentityTokenIssuerProviderRealms.psm1 index 8bc0f08b5..aae67acad 100644 --- a/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuerProviderRealms/MSFT_SPTrustedIdentityTokenIssuerProviderRealms.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuerProviderRealms/MSFT_SPTrustedIdentityTokenIssuerProviderRealms.psm1 @@ -22,11 +22,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) if ($ProviderRealms.Count -gt 0 -and ($ProviderRealmsToInclude.Count -gt 0 -or $ProviderRealmsToExclude.Count -gt 0)) @@ -78,8 +74,7 @@ function Get-TargetResource Write-Verbose -Message "Getting SPTrustedIdentityTokenIssuer ProviderRealms" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $currentRealms = @{ } @@ -155,11 +150,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) $CurrentValues = Get-TargetResource @PSBoundParameters @@ -169,8 +160,7 @@ function Set-TargetResource $PSBoundParameters.Add('RealmsToAdd', $CurrentValues.RealmsToAdd) Write-Verbose -Message "Setting SPTrustedIdentityTokenIssuer provider realms" - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $null = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -223,11 +213,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing SPTrustedIdentityTokenIssuer provider realms" diff --git a/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuerProviderRealms/MSFT_SPTrustedIdentityTokenIssuerProviderRealms.schema.mof b/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuerProviderRealms/MSFT_SPTrustedIdentityTokenIssuerProviderRealms.schema.mof index 376d3756b..4f40bc683 100644 --- a/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuerProviderRealms/MSFT_SPTrustedIdentityTokenIssuerProviderRealms.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPTrustedIdentityTokenIssuerProviderRealms/MSFT_SPTrustedIdentityTokenIssuerProviderRealms.schema.mof @@ -12,5 +12,4 @@ class MSFT_SPTrustedIdentityTokenIssuerProviderRealms : OMI_BaseResource [Write, EmbeddedInstance("MSFT_SPProviderRealm"), Description("Realms to add. Realms not in this list will be left")] String ProviderRealmsToInclude[]; [Write, EmbeddedInstance("MSFT_SPProviderRealm"), Description("Realms to remove. Realms not in this list will be left")] String ProviderRealmsToExclude[]; [Write, Description("Present if the ProviderRealms should be created, or Absent if it should be removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.psm1 b/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.psm1 index c9d0c7cf1..1f437ff96 100644 --- a/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.psm1 @@ -19,11 +19,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose "Getting Trusted Root Authority with name '$Name'" @@ -49,8 +45,7 @@ function Get-TargetResource } } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -103,11 +98,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting SPTrustedRootAuthority '$Name'" @@ -142,8 +133,7 @@ function Set-TargetResource if ($Ensure -eq "Present" -and $CurrentValues.Ensure -eq "Present") { Write-Verbose -Message "Updating SPTrustedRootAuthority '$Name'" - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $null = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -223,8 +213,7 @@ function Set-TargetResource if ($Ensure -eq "Present" -and $CurrentValues.Ensure -eq "Absent") { Write-Verbose -Message "Adding SPTrustedRootAuthority '$Name'" - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $null = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -303,8 +292,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing SPTrustedRootAuthority '$Name'" - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $null = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] Remove-SPTrustedRootAuthority -Identity $params.Name ` @@ -334,11 +322,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing SPTrustedRootAuthority '$Name'" diff --git a/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.schema.mof b/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.schema.mof index 456d711da..c1ad456fb 100644 --- a/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPTrustedRootAuthority/MSFT_SPTrustedRootAuthority.schema.mof @@ -6,5 +6,4 @@ class MSFT_SPTrustedRootAuthority : OMI_BaseResource [Write, Description("Specifies the X.509 certificate of the trusted root authority, as a certificate thumbprint.")] String CertificateThumbprint; [Write, Description("Specify the file path to the certificate if it is not stored in the local certificate store already. Private key should not be present.")] String CertificateFilePath; [Write, Description("Present ensures the trusted root authority exists, absent ensures it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, EmbeddedInstance("MSFT_Credential"), Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPTrustedSecurityTokenIssuer/MSFT_SPTrustedSecurityTokenIssuer.psm1 b/SharePointDsc/DSCResources/MSFT_SPTrustedSecurityTokenIssuer/MSFT_SPTrustedSecurityTokenIssuer.psm1 index 4d78062ff..1939f3e57 100644 --- a/SharePointDsc/DSCResources/MSFT_SPTrustedSecurityTokenIssuer/MSFT_SPTrustedSecurityTokenIssuer.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPTrustedSecurityTokenIssuer/MSFT_SPTrustedSecurityTokenIssuer.psm1 @@ -39,17 +39,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting SPTrustedSecurityTokenIssuer '$Name' settings" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -187,11 +182,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting SPTrustedSecurityTokenIssuer '$Name' settings" @@ -262,8 +253,7 @@ function Set-TargetResource $PSBoundParameters.Add("CurrentValues", $CurrentValues) - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $null = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -385,8 +375,7 @@ function Set-TargetResource if ($CurrentValues.Ensure -eq "Present") { Write-Verbose "Removing SPTrustedSecurityTokenIssuer '$Name'" - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $null = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -441,11 +430,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing SPTrustedSecurityTokenIssuer '$Name' settings" diff --git a/SharePointDsc/DSCResources/MSFT_SPTrustedSecurityTokenIssuer/MSFT_SPTrustedSecurityTokenIssuer.schema.mof b/SharePointDsc/DSCResources/MSFT_SPTrustedSecurityTokenIssuer/MSFT_SPTrustedSecurityTokenIssuer.schema.mof index d23a44096..accd3fcd7 100644 --- a/SharePointDsc/DSCResources/MSFT_SPTrustedSecurityTokenIssuer/MSFT_SPTrustedSecurityTokenIssuer.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPTrustedSecurityTokenIssuer/MSFT_SPTrustedSecurityTokenIssuer.schema.mof @@ -10,5 +10,4 @@ class MSFT_SPTrustedSecurityTokenIssuer : OMI_BaseResource [Write, Description("URL that SharePoint will reach to download the JSON metadata file of the issuer")] String MetadataEndPoint; [Write, Description("Specifies whether the trust is established with a self-issuer partner app")] Boolean IsTrustBroker; [Write, Description("Present if the SPTrustedSecurityTokenIssuer should be created, or Absent if it should be removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure; - [Write, EmbeddedInstance("MSFT_Credential"), Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.psm1 b/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.psm1 index 73b962569..45cd50f24 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.psm1 @@ -13,10 +13,6 @@ function Get-TargetResource [System.String] $Ensure = "Present", - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [System.String] $DatabaseName, @@ -52,8 +48,7 @@ function Get-TargetResource Write-Verbose -Message "Getting usage application '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -122,10 +117,6 @@ function Set-TargetResource [System.String] $Ensure = "Present", - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [System.String] $DatabaseName, @@ -165,8 +156,7 @@ function Set-TargetResource if ($CurrentState.Ensure -eq "Absent" -and $Ensure -eq "Present") { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -202,8 +192,7 @@ function Set-TargetResource if ($Ensure -eq "Present") { Write-Verbose -Message "Configuring usage application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -241,8 +230,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing usage application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -270,10 +258,6 @@ function Test-TargetResource [System.String] $Ensure = "Present", - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount, - [Parameter()] [System.String] $DatabaseName, diff --git a/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.schema.mof b/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.schema.mof index a97fbf15f..abcadf30f 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPUsageApplication/MSFT_SPUsageApplication.schema.mof @@ -11,5 +11,4 @@ class MSFT_SPUsageApplication : OMI_BaseResource [Write, Description("The maximum file size for log files in KB")] uint32 UsageLogMaxFileSizeKB; [Write, Description("The total space of all log files on disk in GB")] uint32 UsageLogMaxSpaceGB; [Write, Description("Present if the service app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPUsageDefinition/MSFT_SPUsageDefinition.psm1 b/SharePointDsc/DSCResources/MSFT_SPUsageDefinition/MSFT_SPUsageDefinition.psm1 index 6f07038f1..2e90b48ec 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUsageDefinition/MSFT_SPUsageDefinition.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPUsageDefinition/MSFT_SPUsageDefinition.psm1 @@ -32,17 +32,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting configuration for Usage Definition {$Name}" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -107,11 +102,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting configuration for Usage Definition {$Name}" @@ -153,8 +144,7 @@ function Set-TargetResource throw $message } - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -238,11 +228,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing configuration for Usage Definition {$Name}" diff --git a/SharePointDsc/DSCResources/MSFT_SPUsageDefinition/MSFT_SPUsageDefinition.schema.mof b/SharePointDsc/DSCResources/MSFT_SPUsageDefinition/MSFT_SPUsageDefinition.schema.mof index 5b098d43f..0ac127e96 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUsageDefinition/MSFT_SPUsageDefinition.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPUsageDefinition/MSFT_SPUsageDefinition.schema.mof @@ -8,5 +8,4 @@ class MSFT_SPUsageDefinition : OMI_BaseResource [Write, Description("True enables the Usage Definition")] Boolean Enabled; [Write, Description("True enables logging to the Usage database(SP2016 and above only)")] Boolean UsageDatabaseEnabled; [Write, Description("Present to configure the diagnostics provider"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.psm1 b/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.psm1 index f9c5def78..f5b143e65 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.psm1 @@ -109,11 +109,7 @@ function Get-TargetResource [Parameter()] [System.string] - $TermSet, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $TermSet ) Write-Verbose -Message "Getting user profile property $Name" @@ -142,8 +138,7 @@ function Get-TargetResource } } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -430,11 +425,7 @@ function Set-TargetResource [Parameter()] [System.string] - $TermSet, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $TermSet ) # Note for integration test: CA can take a couple of minutes to notice the change. don't try @@ -466,8 +457,7 @@ function Set-TargetResource $PSBoundParameters.Ensure = $Ensure - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -895,11 +885,7 @@ function Test-TargetResource [Parameter()] [System.string] - $TermSet, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $TermSet ) diff --git a/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.schema.mof b/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.schema.mof index 44d9504d6..4bc27232b 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPUserProfileProperty/MSFT_SPUserProfileProperty.schema.mof @@ -31,5 +31,4 @@ class MSFT_SPUserProfileProperty : OMI_BaseResource [Write, Description("The name of the term store to look up managed terms from")] string TermStore; [Write, Description("The name of the term store group that terms are in for this field")] string TermGroup; [Write, Description("The name of the term set to allow values to be selected from")] string TermSet; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.psm1 b/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.psm1 index 7ae126df1..0c0f1aa1e 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.psm1 @@ -23,17 +23,12 @@ function Get-TargetResource [Parameter()] [System.uint32] - $DisplayOrder, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DisplayOrder ) Write-Verbose -Message "Getting user profile section $Name" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -102,11 +97,7 @@ function Set-TargetResource [Parameter()] [System.uint32] - $DisplayOrder, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DisplayOrder ) # note for integration test: CA can take a couple of minutes to notice the change. @@ -115,8 +106,7 @@ function Set-TargetResource $PSBoundParameters.Ensure = $Ensure - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -216,11 +206,7 @@ function Test-TargetResource [Parameter()] [System.uint32] - $DisplayOrder, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DisplayOrder ) diff --git a/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.schema.mof b/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.schema.mof index 2908ffc7c..babf6603b 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPUserProfileSection/MSFT_SPUserProfileSection.schema.mof @@ -6,5 +6,4 @@ class MSFT_SPUserProfileSection : OMI_BaseResource [Required, Description("The name of the user profile service application this section exists in")] string UserProfileService; [Write, Description("The display name of the section")] string DisplayName; [Write, Description("A number used to sort sections by")] uint32 DisplayOrder; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 index b2e35af85..86df443c1 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 @@ -76,11 +76,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting user profile service application $Name" @@ -94,41 +90,22 @@ function Get-TargetResource Write-Verbose -Message $message } - $farmAccount = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $farmAccount = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { return Get-SPDscFarmAccount } if ($null -ne $farmAccount) { - if ($PSBoundParameters.ContainsKey("InstallAccount") -eq $true) - { - # InstallAccount used - if ($InstallAccount.UserName -eq $farmAccount.UserName) - { - $message = ("Specified InstallAccount ($($InstallAccount.UserName)) is the Farm " + ` - "Account. Make sure the specified InstallAccount isn't the Farm Account " + ` - "and try again") - Add-SPDscEvent -Message $message ` - -EntryType 'Error' ` - -EventID 100 ` - -Source $MyInvocation.MyCommand.Source - throw $message - } - } - else + # PSDSCRunAsCredential or System + if (-not $Env:USERNAME.Contains("$")) { - # PSDSCRunAsCredential or System - if (-not $Env:USERNAME.Contains("$")) + # PSDSCRunAsCredential used + $localaccount = "$($Env:USERDOMAIN)\$($Env:USERNAME)" + if ($localaccount -eq $farmAccount.UserName) { - # PSDSCRunAsCredential used - $localaccount = "$($Env:USERDOMAIN)\$($Env:USERNAME)" - if ($localaccount -eq $farmAccount.UserName) - { - Write-Verbose -Message ("The current user ($localaccount) is the Farm " + ` - "Account. Please note that this will cause issues when applying the configuration.") - } + Write-Verbose -Message ("The current user ($localaccount) is the Farm " + ` + "Account. Please note that this will cause issues when applying the configuration.") } } } @@ -142,8 +119,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -343,11 +319,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting user profile service application $Name" @@ -370,50 +342,30 @@ function Set-TargetResource $PSBoundParameters.UpdateProxyGroup = $UpdateProxyGroup - $farmAccount = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $farmAccount = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { return Get-SPDscFarmAccount } if ($null -ne $farmAccount) { - if ($PSBoundParameters.ContainsKey("InstallAccount") -eq $true) + # PSDSCRunAsCredential or System + if (-not $Env:USERNAME.Contains("$")) { - # InstallAccount used - if ($InstallAccount.UserName -eq $farmAccount.UserName) + # PSDSCRunAsCredential used + $localaccount = "$($Env:USERDOMAIN)\$($Env:USERNAME)" + if ($localaccount -eq $farmAccount.UserName) { - $message = ("Specified InstallAccount ($($InstallAccount.UserName)) is the Farm " + ` - "Account. Make sure the specified InstallAccount isn't the Farm Account " + ` - "and try again") + $message = ("Specified PSDSCRunAsCredential ($localaccount) is the Farm " + ` + "Account. Make sure the specified PSDSCRunAsCredential isn't the " + ` + "Farm Account and try again") Add-SPDscEvent -Message $message ` -EntryType 'Error' ` -EventID 100 ` -Source $MyInvocation.MyCommand.Source throw $message } - $setupAccount = $InstallAccount.UserName - } - else - { - # PSDSCRunAsCredential or System - if (-not $Env:USERNAME.Contains("$")) - { - # PSDSCRunAsCredential used - $localaccount = "$($Env:USERDOMAIN)\$($Env:USERNAME)" - if ($localaccount -eq $farmAccount.UserName) - { - $message = ("Specified PSDSCRunAsCredential ($localaccount) is the Farm " + ` - "Account. Make sure the specified PSDSCRunAsCredential isn't the " + ` - "Farm Account and try again") - Add-SPDscEvent -Message $message ` - -EntryType 'Error' ` - -EventID 100 ` - -Source $MyInvocation.MyCommand.Source - throw $message - } - $setupAccount = $localaccount - } + $setupAccount = $localaccount } } else @@ -477,10 +429,6 @@ function Set-TargetResource $params.Remove("SiteNamingConflictResolution") | Out-Null } - if ($params.ContainsKey("InstallAccount")) - { - $params.Remove("InstallAccount") | Out-Null - } if ($params.ContainsKey("Ensure")) { $params.Remove("Ensure") | Out-Null @@ -620,7 +568,7 @@ function Set-TargetResource } } - # Remove the InstallAccount from the local Administrators group, if it was added above + # Remove the FarmAccount from the local Administrators group, if it was added above if (!$isLocalAdmin) { Write-Verbose -Message "Removing farm account from Local Administrators group" @@ -637,15 +585,14 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing user profile service application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $app = Get-SPServiceApplication | Where-Object -FilterScript { $_.Name -eq $params.Name -and ` - $_.GetType().FullName -eq "Microsoft.Office.Server.Administration.UserProfileApplication" + $_.GetType().FullName -eq "Microsoft.Office.Server.Administration.UserProfileApplication" } $proxies = Get-SPServiceApplicationProxy @@ -740,11 +687,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing for user profile service application $Name" @@ -866,21 +809,12 @@ function Export-TargetResource $currentBlock = " SPUserProfileServiceApp " + ($serviceName -replace " ", "") + "`r`n" $currentBlock += " {`r`n" - if ($null -eq $params.InstallAccount) - { - $params.Remove("InstallAccount") - } - $results = Get-TargetResource @params if ($results.Contains("MySiteHostLocation") -and $results.Get_Item("MySiteHostLocation") -eq "*") { $results.Remove("MySiteHostLocation") } - if ($results.Contains("InstallAccount")) - { - $results.Remove("InstallAccount") - } $results = Repair-Credentials -results $results Add-ConfigurationDataEntry -Node "NonNodeData" -Key "SyncDBServer" -Value $results.SyncDBServer -Description "Name of the User Profile Service Sync Database Server;" diff --git a/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.schema.mof b/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.schema.mof index 53249f9cf..9a5bf1e48 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.schema.mof @@ -17,7 +17,6 @@ class MSFT_SPUserProfileServiceApp : OMI_BaseResource [Write, Description("Specifies which SiteNamingConflictResolution should be used"), ValueMap{"Username_CollisionError","Username_CollisionDomain","Domain_Username"}, Values{"Username_CollisionError","Username_CollisionDomain","Domain_Username"}] string SiteNamingConflictResolution; [Write, Description("Specifies if an issue with Service App Proxy Groups should be automatically corrected (see wiki for more info). Default value is true.")] boolean UpdateProxyGroup; [Write, Description("Present if the service app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; [Write, Description("Should SQL Server authentication be used to connect to the database?")] Boolean UseSQLAuthentication; [Write, Description("If using SQL authentication, the SQL credentials to use to connect to the instance"), EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/readme.md b/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/readme.md index e9d38ab2d..801f65c2c 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/readme.md +++ b/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/readme.md @@ -7,8 +7,8 @@ This resource will provision an instance of the user profile service to the farm. It creates the required databases using the parameters that are passed in to it (although these are only used during the initial provisioning). -The specified InstallAccount or PSDSCRunAsCredential cannot be the Farm Account. -The resource will throw an error when it is. +The specified PSDSCRunAsCredential cannot be the Farm Account. The resource +will throw an error when it is. To allow successful provisioning, the farm account must be in the local administrators group, however it is not best practice to leave this account in diff --git a/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.psm1 b/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.psm1 index 05ee3d3de..3e13a698c 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.psm1 @@ -18,18 +18,14 @@ function Get-TargetResource [Parameter()] [System.String[]] - $UseTagsAndNotes, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $UseTagsAndNotes ) Write-Verbose -Message "Getting permissions for user profile service proxy '$ProxyName" Confirm-SPDscUpaPermissionsConfig -Parameters $PSBoundParameters - $result = Invoke-SPDscCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] $proxy = Get-SPServiceApplicationProxy | Where-Object { $_.DisplayName -eq $params.ProxyName } @@ -127,11 +123,7 @@ function Set-TargetResource [Parameter()] [System.String[]] - $UseTagsAndNotes, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $UseTagsAndNotes ) Write-Verbose -Message "Setting permissions for user profile service proxy '$ProxyName" @@ -148,7 +140,7 @@ function Set-TargetResource "'NT AUTHORITY\Authenticated Users'. This will be removed as " + ` "identies on service app proxy permissions should be claims based.") - Invoke-SPDscCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Invoke-SPDscCommand -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] $proxy = Get-SPServiceApplicationProxy | Where-Object { $_.DisplayName -eq $params.ProxyName } @@ -164,8 +156,7 @@ function Set-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters } - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $CurrentValues) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $CurrentValues) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -325,11 +316,7 @@ function Test-TargetResource [Parameter()] [System.String[]] - $UseTagsAndNotes, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $UseTagsAndNotes ) Write-Verbose -Message "Testing permissions for user profile service proxy '$ProxyName" diff --git a/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.schema.mof b/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.schema.mof index 6fdd05ad8..b97f6961b 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceAppPermissions/MSFT_SPUserProfileServiceAppPermissions.schema.mof @@ -5,5 +5,4 @@ class MSFT_SPUserProfileServiceAppPermissions : OMI_BaseResource [Write, Description("A list of user principals that will have the Create personal site permission")] string CreatePersonalSite[]; [Write, Description("A list of user principals that will have the Follow users and edit profile permission")] string FollowAndEditProfile[]; [Write, Description("A list of user principals that will have the Use tags and notes permission")] string UseTagsAndNotes[]; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.psm1 b/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.psm1 index 1ceb65d5c..6251f9458 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.psm1 @@ -56,17 +56,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting user profile service sync connection $Name" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -274,11 +269,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting user profile service sync connection $Name" @@ -328,8 +319,7 @@ function Set-TargetResource } } - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] @@ -338,10 +328,6 @@ function Set-TargetResource Import-Module -Name (Join-Path -Path $scriptRoot -ChildPath "MSFT_SPUserProfileSyncConnection.psm1") - if ($params.ContainsKey("InstallAccount")) - { - $params.Remove("InstallAccount") | Out-Null - } $ups = Get-SPServiceApplication | Where-Object -FilterScript { $_.Name -eq $params.UserProfileService } @@ -622,11 +608,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing for user profile service sync connection $Name" diff --git a/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.schema.mof b/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.schema.mof index cebd081ea..cd708c19f 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncConnection/MSFT_SPUserProfileSyncConnection.schema.mof @@ -14,5 +14,4 @@ class MSFT_SPUserProfileSyncConnection : OMI_BaseResource [Write, Description("Set to true to run the set method on every call to this resource. Only has effect on SharePoint 2013")] boolean Force; [Write, Description("The type of the connection - currently only Active Directory is supported"), ValueMap{"ActiveDirectory","BusinessDataCatalog"}, Values{"ActiveDirectory","BusinessDataCatalog"}] string ConnectionType; [Write, Description("Present if the connection should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.psm1 b/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.psm1 index f78564806..07626f985 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.psm1 @@ -14,11 +14,7 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $RunOnlyWhenWriteable, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $RunOnlyWhenWriteable ) Write-Verbose -Message "Getting user profile sync service for $UserProfileServiceAppName" @@ -34,22 +30,23 @@ function Get-TargetResource throw $message } - $farmAccount = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $farmAccount = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { return Get-SPDscFarmAccount } if ($null -ne $farmAccount) { - if ($PSBoundParameters.ContainsKey("InstallAccount") -eq $true) + # PSDSCRunAsCredential or System + if (-not $Env:USERNAME.Contains("$")) { - # InstallAccount used - if ($InstallAccount.UserName -eq $farmAccount.UserName) + # PSDSCRunAsCredential used + $localaccount = "$($Env:USERDOMAIN)\$($Env:USERNAME)" + if ($localaccount -eq $farmAccount.UserName) { - $message = ("Specified InstallAccount ($($InstallAccount.UserName)) is the Farm " + ` - "Account. Make sure the specified InstallAccount isn't the Farm Account " + ` - "and try again") + $message = ("Specified PSDSCRunAsCredential ($localaccount) is the Farm " + ` + "Account. Make sure the specified PSDSCRunAsCredential isn't the " + ` + "Farm Account and try again") Add-SPDscEvent -Message $message ` -EntryType 'Error' ` -EventID 100 ` @@ -57,26 +54,6 @@ function Get-TargetResource throw $message } } - else - { - # PSDSCRunAsCredential or System - if (-not $Env:USERNAME.Contains("$")) - { - # PSDSCRunAsCredential used - $localaccount = "$($Env:USERDOMAIN)\$($Env:USERNAME)" - if ($localaccount -eq $farmAccount.UserName) - { - $message = ("Specified PSDSCRunAsCredential ($localaccount) is the Farm " + ` - "Account. Make sure the specified PSDSCRunAsCredential isn't the " + ` - "Farm Account and try again") - Add-SPDscEvent -Message $message ` - -EntryType 'Error' ` - -EventID 100 ` - -Source $MyInvocation.MyCommand.Source - throw $message - } - } - } } else { @@ -88,8 +65,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -168,11 +144,7 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $RunOnlyWhenWriteable, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $RunOnlyWhenWriteable ) Write-Verbose -Message "Setting user profile sync service for $UserProfileServiceAppName" @@ -190,22 +162,23 @@ function Set-TargetResource throw $message } - $farmAccount = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $farmAccount = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { return Get-SPDscFarmAccount } if ($null -ne $farmAccount) { - if ($PSBoundParameters.ContainsKey("InstallAccount") -eq $true) + # PSDSCRunAsCredential or System + if (-not $Env:USERNAME.Contains("$")) { - # InstallAccount used - if ($InstallAccount.UserName -eq $farmAccount.UserName) + # PSDSCRunAsCredential used + $localaccount = "$($Env:USERDOMAIN)\$($Env:USERNAME)" + if ($localaccount -eq $farmAccount.UserName) { - $message = ("Specified InstallAccount ($($InstallAccount.UserName)) is the Farm " + ` - "Account. Make sure the specified InstallAccount isn't the Farm Account " + ` - "and try again") + $message = ("Specified PSDSCRunAsCredential ($localaccount) is the Farm " + ` + "Account. Make sure the specified PSDSCRunAsCredential isn't the " + ` + "Farm Account and try again") Add-SPDscEvent -Message $message ` -EntryType 'Error' ` -EventID 100 ` @@ -213,26 +186,6 @@ function Set-TargetResource throw $message } } - else - { - # PSDSCRunAsCredential or System - if (-not $Env:USERNAME.Contains("$")) - { - # PSDSCRunAsCredential used - $localaccount = "$($Env:USERDOMAIN)\$($Env:USERNAME)" - if ($localaccount -eq $farmAccount.UserName) - { - $message = ("Specified PSDSCRunAsCredential ($localaccount) is the Farm " + ` - "Account. Make sure the specified PSDSCRunAsCredential isn't the " + ` - "Farm Account and try again") - Add-SPDscEvent -Message $message ` - -EntryType 'Error' ` - -EventID 100 ` - -Source $MyInvocation.MyCommand.Source - throw $message - } - } - } } else { @@ -247,8 +200,7 @@ function Set-TargetResource if ($PSBoundParameters.ContainsKey("RunOnlyWhenWriteable") -eq $true) { $databaseReadOnly = Test-SPDscUserProfileDBReadOnly ` - -UserProfileServiceAppName $UserProfileServiceAppName ` - -InstallAccount $InstallAccount + -UserProfileServiceAppName $UserProfileServiceAppName if ($databaseReadOnly) { @@ -412,11 +364,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $RunOnlyWhenWriteable, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $RunOnlyWhenWriteable ) Write-Verbose -Message "Testing user profile sync service for $UserProfileServiceAppName" @@ -442,8 +390,7 @@ function Test-TargetResource if ($PSBoundParameters.ContainsKey("RunOnlyWhenWriteable") -eq $true) { $databaseReadOnly = Test-SPDscUserProfileDBReadOnly ` - -UserProfileServiceAppName $UserProfileServiceAppName ` - -InstallAccount $InstallAccount + -UserProfileServiceAppName $UserProfileServiceAppName if ($databaseReadOnly) { @@ -473,15 +420,10 @@ function Test-SPDscUserProfileDBReadOnly() ( [Parameter(Mandatory = $true)] [String] - $UserProfileServiceAppName, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $UserProfileServiceAppName ) - $databaseReadOnly = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($UserProfileServiceAppName, $MyInvocation.MyCommand.Source) ` + $databaseReadOnly = Invoke-SPDscCommand -Arguments @($UserProfileServiceAppName, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $UserProfileServiceAppName = $args[0] $eventSource = $args[1] @@ -578,20 +520,13 @@ function Export-TargetResource $Content = '' $params = Get-DSCFakeParameters -ModulePath $module $params.Ensure = $ensureValue - if ($null -eq $params.InstallAccount) - { - $params.Remove("InstallAccount") - } + $results = Get-TargetResource @params if ($ensureValue -eq "Present") { $PartialContent = " SPUserProfileSyncService " + $serviceTypeName.Replace(" ", "") + "Instance`r`n" $PartialContent += " {`r`n" - if ($results.Contains("InstallAccount")) - { - $results.Remove("InstallAccount") - } $results = Repair-Credentials -results $results $currentBlock = Get-DSCBlock -Params $results -ModulePath $module $currentBlock = Convert-DSCStringParamToVariable -DSCBlock $currentBlock -ParameterName "PsDscRunAsCredential" diff --git a/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.schema.mof b/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.schema.mof index 1ece559ce..cdbb04bd9 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/MSFT_SPUserProfileSyncService.schema.mof @@ -4,5 +4,4 @@ class MSFT_SPUserProfileSyncService : OMI_BaseResource [Key, Description("The name of the user profile service for this sync instance")] string UserProfileServiceAppName; [Write, Description("Present to ensure the service is running, absent to ensure it is not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; [Write, Description("Should the sync service only run when the user profile database is in a writeable state?")] Boolean RunOnlyWhenWriteable; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/readme.md b/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/readme.md index 535c6bbbc..b0aae9cc4 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/readme.md +++ b/SharePointDsc/DSCResources/MSFT_SPUserProfileSyncService/readme.md @@ -7,8 +7,8 @@ This resource is responsible for ensuring that the user profile sync service has been provisioned (Ensure = "Present") or is not running (Ensure = "Absent") on the current server. -The specified InstallAccount or PSDSCRunAsCredential cannot be the Farm Account. -The resource will throw an error when it is. +The specified PSDSCRunAsCredential cannot be the Farm Account. The resource +will throw an error when it is. To allow successful provisioning, the farm account must be in the local administrators group, however it is not best practice to leave this account in diff --git a/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.psm1 index 2931c17e6..fb5162006 100644 --- a/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.psm1 @@ -19,17 +19,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting Visio Graphics service app '$Name'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -99,11 +94,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting Visio Graphics service app '$Name'" @@ -113,8 +104,7 @@ function Set-TargetResource if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message "Creating Visio Graphics Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -143,8 +133,7 @@ function Set-TargetResource if ($ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating Visio Graphics Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -161,8 +150,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing Visio service application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -206,11 +194,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing Visio Graphics service app '$Name'" @@ -258,10 +242,6 @@ function Export-TargetResource $PartialContent += " {`r`n" $results = Get-TargetResource @params - if ($results.Contains("InstallAccount")) - { - $results.Remove("InstallAccount") - } $results = Repair-Credentials -results $results $currentBlock = Get-DSCBlock -Params $results -ModulePath $module $currentBlock = Convert-DSCStringParamToVariable -DSCBlock $currentBlock -ParameterName "PsDscRunAsCredential" diff --git a/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.schema.mof b/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.schema.mof index a6f716584..7fceee75f 100644 --- a/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPVisioServiceApp/MSFT_SPVisioServiceApp.schema.mof @@ -5,5 +5,4 @@ class MSFT_SPVisioServiceApp : OMI_BaseResource [Required, Description("The name of the application pool to run the service app in")] string ApplicationPool; [Write, Description("The name of the Visio Service Application Proxy")] string ProxyName; [Write, Description("Present if the service app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.psm1 b/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.psm1 index cf7929faa..eec1dd9bb 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.psm1 @@ -47,17 +47,12 @@ function Get-TargetResource [Parameter()] [System.String] - $RequestAccessEmail, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $RequestAccessEmail ) Write-Verbose -Message "Getting SPWeb '$Url'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -137,30 +132,18 @@ function Set-TargetResource [Parameter()] [System.String] - $RequestAccessEmail, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $RequestAccessEmail ) Write-Verbose -Message "Setting SPWeb '$Url'" $PSBoundParameters.Ensure = $Ensure - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] - if ($null -eq $params.InstallAccount) - { - $currentUserName = "$env:USERDOMAIN\$env:USERNAME" - } - else - { - $currentUserName = $params.InstallAccount.UserName - } + $currentUserName = "$env:USERDOMAIN\$env:USERNAME" Write-Verbose "Grant user '$currentUserName' Access To Process Identity for '$($params.Url)'..." $site = New-Object -Type Microsoft.SharePoint.SPSite -ArgumentList $params.Url @@ -170,7 +153,7 @@ function Set-TargetResource if ($null -eq $web) { - @("InstallAccount", "Ensure", "RequestAccessEmail") | + @("Ensure", "RequestAccessEmail") | ForEach-Object -Process { if ($params.ContainsKey($_) -eq $true) { @@ -294,11 +277,7 @@ function Test-TargetResource [Parameter()] [System.String] - $RequestAccessEmail, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $RequestAccessEmail ) Write-Verbose -Message "Testing SPWeb '$Url'" diff --git a/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.schema.mof index a52286e4e..7a4ae5fe9 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWeb/MSFT_SPWeb.schema.mof @@ -12,5 +12,4 @@ class MSFT_SPWeb : OMI_BaseResource [Write, Description("True if the web should be in the quick launch of the parent web, otherwise false.")] Boolean AddToQuickLaunch; [Write, Description("True if the web should be added to the top nav bar of the parent web, otherwise false.")] Boolean AddToTopNav; [Write, Description("The e-mail address to which requests for access are sent. Set to emtpy string to disable access requests.")] string RequestAccessEmail; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppAuthentication/MSFT_SPWebAppAuthentication.psm1 b/SharePointDsc/DSCResources/MSFT_SPWebAppAuthentication/MSFT_SPWebAppAuthentication.psm1 index ec7a73378..132136116 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppAuthentication/MSFT_SPWebAppAuthentication.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppAuthentication/MSFT_SPWebAppAuthentication.psm1 @@ -46,11 +46,7 @@ function Get-TargetResource [Parameter()] [Microsoft.Management.Infrastructure.CimInstance] - $CustomSettings, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $CustomSettings ) Write-Verbose -Message "Getting web application authentication for '$WebAppUrl'" @@ -129,8 +125,7 @@ function Get-TargetResource } } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -310,11 +305,7 @@ function Set-TargetResource [Parameter()] [Microsoft.Management.Infrastructure.CimInstance] - $CustomSettings, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $CustomSettings ) Write-Verbose -Message "Setting web application authentication for '$WebAppUrl'" @@ -366,8 +357,7 @@ function Set-TargetResource } # Get current authentication method - $authMethod = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $authMethod = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -713,11 +703,7 @@ function Test-TargetResource [Parameter()] [Microsoft.Management.Infrastructure.CimInstance] - $CustomSettings, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $CustomSettings ) Write-Verbose -Message "Testing web application authentication for '$WebAppUrl'" @@ -1276,8 +1262,7 @@ function Set-ZoneConfiguration() $DesiredConfig ) - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -1352,8 +1337,7 @@ function Set-ZoneSettings() $DesiredSettings ) - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppAuthentication/MSFT_SPWebAppAuthentication.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWebAppAuthentication/MSFT_SPWebAppAuthentication.schema.mof index c27762d54..9dea07db5 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppAuthentication/MSFT_SPWebAppAuthentication.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppAuthentication/MSFT_SPWebAppAuthentication.schema.mof @@ -30,5 +30,4 @@ class MSFT_SPWebAppAuthentication : OMI_BaseResource [Write, Description("Specifies the zone settings for the Internet zone."), EmbeddedInstance("MSFT_SPWebAppZoneSettings")] string InternetSettings; [Write, Description("Specifies the zone settings for the Extranet zone."), EmbeddedInstance("MSFT_SPWebAppZoneSettings")] string ExtranetSettings; [Write, Description("Specifies the zone settings for the Custom zone."), EmbeddedInstance("MSFT_SPWebAppZoneSettings")] string CustomSettings; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.psm1 b/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.psm1 index c95548616..72bad80c4 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.psm1 @@ -18,17 +18,12 @@ function Get-TargetResource [Parameter()] [System.String[]] - $EnsureAllowed, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $EnsureAllowed ) Write-Verbose -Message "Getting web application '$WebAppUrl' blocked file types" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] $ScriptRoot = $args[1] @@ -74,17 +69,12 @@ function Set-TargetResource [Parameter()] [System.String[]] - $EnsureAllowed, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $EnsureAllowed ) Write-Verbose -Message "Setting web application '$WebAppUrl' blocked file types" - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot) ` + $null = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -129,11 +119,7 @@ function Test-TargetResource [Parameter()] [System.String[]] - $EnsureAllowed, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $EnsureAllowed ) Write-Verbose -Message "Testing for web application '$WebAppUrl' blocked file types" diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.schema.mof index 1895ceed2..b9cca37d7 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppBlockedFileTypes/MSFT_SPWebAppBlockedFileTypes.schema.mof @@ -5,5 +5,4 @@ class MSFT_SPWebAppBlockedFileTypes : OMI_BaseResource [write, Description("This is a fixed list to use for blocked file types in this web app")] string Blocked[]; [write, Description("This list of file types that will always be added to the list for this web app. Types not in this list will be left in the list")] string EnsureBlocked[]; [write, Description("This list of file types that will always be removedfrom the list for this web app. Types not in this list will be left in the list")] string EnsureAllowed[]; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppClientCallableSettings/MSFT_SPWebAppClientCallableSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPWebAppClientCallableSettings/MSFT_SPWebAppClientCallableSettings.psm1 index 5727132ea..7bf5730f7 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppClientCallableSettings/MSFT_SPWebAppClientCallableSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppClientCallableSettings/MSFT_SPWebAppClientCallableSettings.psm1 @@ -54,11 +54,7 @@ function Get-TargetResource [Parameter()] [Boolean] - $LogActionsIfHasRequestException, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $LogActionsIfHasRequestException ) Write-Verbose -Message "Getting web application '$WebAppUrl' client callable settings" @@ -74,8 +70,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters) ` -ScriptBlock { $params = $args[0] @@ -200,11 +195,7 @@ function Set-TargetResource [Parameter()] [Boolean] - $LogActionsIfHasRequestException, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $LogActionsIfHasRequestException ) Write-Verbose -Message "Setting web application '$WebAppUrl' client callable settings" @@ -220,8 +211,7 @@ function Set-TargetResource throw $message } - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -470,11 +460,7 @@ function Test-TargetResource [Parameter()] [Boolean] - $LogActionsIfHasRequestException, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $LogActionsIfHasRequestException ) Write-Verbose -Message "Testing for web application '$WebAppUrl' client callable settings" diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppClientCallableSettings/MSFT_SPWebAppClientCallableSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWebAppClientCallableSettings/MSFT_SPWebAppClientCallableSettings.schema.mof index 42a66e0b5..d07de7372 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppClientCallableSettings/MSFT_SPWebAppClientCallableSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppClientCallableSettings/MSFT_SPWebAppClientCallableSettings.schema.mof @@ -20,5 +20,4 @@ class MSFT_SPWebAppClientCallableSettings : OMI_BaseResource [write, Description("Sets the threshold in milliseconds for logging csom request usage data ")] UInt32 RequestUsageExecutionTimeThreshold; [write, Description("Sets a Boolean value that specifies whether to log usage data or not")] Boolean EnableRequestUsage; [write, Description("Sets a Boolean value that specifies whether to log usage data when request has an exception or not")] Boolean LogActionsIfHasRequestException; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.psm1 index 0aaee8a65..4108820d0 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.psm1 @@ -87,17 +87,12 @@ function Get-TargetResource [Parameter()] [System.String] - $DefaultQuotaTemplate, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DefaultQuotaTemplate ) Write-Verbose -Message "Getting web application '$WebAppUrl' general settings" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $PSScriptRoot) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] $ScriptRoot = $args[1] @@ -228,17 +223,12 @@ function Set-TargetResource [Parameter()] [System.String] - $DefaultQuotaTemplate, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DefaultQuotaTemplate ) Write-Verbose -Message "Setting web application '$WebAppUrl' general settings" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -368,11 +358,7 @@ function Test-TargetResource [Parameter()] [System.String] - $DefaultQuotaTemplate, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $DefaultQuotaTemplate ) Write-Verbose -Message "Testing web application '$WebAppUrl' general settings" diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.schema.mof index 544a63cb9..28e7a41bd 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppGeneralSettings/MSFT_SPWebAppGeneralSettings.schema.mof @@ -22,5 +22,4 @@ class MSFT_SPWebAppGeneralSettings : OMI_BaseResource [Write, Description("Should Self Service Site Creation be enabled")] boolean SelfServiceSiteCreationEnabled; [Write, Description("Is Skype for Business presence enabled for this web app")] boolean PresenceEnabled; [Write, Description("What is the default quota template for this web app")] string DefaultQuotaTemplate; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppHttpThrottlingMonitor/MSFT_SPWebAppHttpThrottlingMonitor.psm1 b/SharePointDsc/DSCResources/MSFT_SPWebAppHttpThrottlingMonitor/MSFT_SPWebAppHttpThrottlingMonitor.psm1 index 454b0173e..0bd05b5b7 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppHttpThrottlingMonitor/MSFT_SPWebAppHttpThrottlingMonitor.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppHttpThrottlingMonitor/MSFT_SPWebAppHttpThrottlingMonitor.psm1 @@ -31,11 +31,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting web application '$WebAppUrl' HTTP Throttling Monitoring settings" @@ -70,8 +66,7 @@ function Get-TargetResource $PSBoundParameters.IsDescending = $IsDescending $PSBoundParameters.CounterInstance = $CounterInstance - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -175,11 +170,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting web application '$WebAppUrl' HTTP Throttling Monitoring settings" @@ -216,8 +207,7 @@ function Set-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $CurrentValues) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $CurrentValues) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -317,11 +307,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing web application '$WebAppUrl' HTTP Throttling Monitoring settings" diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppHttpThrottlingMonitor/MSFT_SPWebAppHttpThrottlingMonitor.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWebAppHttpThrottlingMonitor/MSFT_SPWebAppHttpThrottlingMonitor.schema.mof index 76e7eba61..0c37bac08 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppHttpThrottlingMonitor/MSFT_SPWebAppHttpThrottlingMonitor.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppHttpThrottlingMonitor/MSFT_SPWebAppHttpThrottlingMonitor.schema.mof @@ -8,5 +8,4 @@ class MSFT_SPWebAppHttpThrottlingMonitor : OMI_BaseResource [Write, Description("Specifies the instance of the performance counter")] string CounterInstance; [Write, Description("Specifies that this counter is interpreted in descending order")] boolean IsDescending; [Write, Description("Present if the throttling monitor should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppPeoplePickerSettings/MSFT_SPWebAppPeoplePickerSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPWebAppPeoplePickerSettings/MSFT_SPWebAppPeoplePickerSettings.psm1 index e62ef6d41..6bf43fbbc 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppPeoplePickerSettings/MSFT_SPWebAppPeoplePickerSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppPeoplePickerSettings/MSFT_SPWebAppPeoplePickerSettings.psm1 @@ -26,17 +26,12 @@ function Get-TargetResource [Parameter()] [Microsoft.Management.Infrastructure.CimInstance[]] - $SearchActiveDirectoryDomains, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SearchActiveDirectoryDomains ) Write-Verbose -Message "Getting People Picker Settings for $WebAppUrl" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -105,18 +100,13 @@ function Set-TargetResource [Parameter()] [Microsoft.Management.Infrastructure.CimInstance[]] - $SearchActiveDirectoryDomains, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SearchActiveDirectoryDomains ) Write-Verbose -Message "Setting People Picker Settings for $WebAppUrl" ## Perform changes - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -262,11 +252,7 @@ function Test-TargetResource [Parameter()] [Microsoft.Management.Infrastructure.CimInstance[]] - $SearchActiveDirectoryDomains, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SearchActiveDirectoryDomains ) Write-Verbose -Message "Testing People Picker Settings for $WebAppUrl" diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppPeoplePickerSettings/MSFT_SPWebAppPeoplePickerSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWebAppPeoplePickerSettings/MSFT_SPWebAppPeoplePickerSettings.schema.mof index 71802e28d..d11075c76 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppPeoplePickerSettings/MSFT_SPWebAppPeoplePickerSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppPeoplePickerSettings/MSFT_SPWebAppPeoplePickerSettings.schema.mof @@ -14,5 +14,4 @@ class MSFT_SPWebAppPeoplePickerSettings : OMI_BaseResource [Write, Description("Sets the time-out in seconds when a query is issued to Active Directory")] Uint16 ActiveDirectorySearchTimeout; [Write, Description("Specifies whether to search only the current site collection")] Boolean OnlySearchWithinSiteCollection; [Write, Description("List of all domains/forests that must be searched"), EmbeddedInstance("MSFT_SPWebAppPPSearchDomain")] String SearchActiveDirectoryDomains[]; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.psm1 b/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.psm1 index e172be475..d74f56868 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.psm1 @@ -34,19 +34,14 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $AllPermissions, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AllPermissions ) Write-Verbose -Message "Getting permissions for Web Application '$WebAppUrl'" Test-SPDscInput @PSBoundParameters - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -261,11 +256,7 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $AllPermissions, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AllPermissions ) Write-Verbose -Message "Setting permissions for Web Application '$WebAppUrl'" @@ -276,8 +267,7 @@ function Set-TargetResource if ($AllPermissions) { - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -301,8 +291,7 @@ function Set-TargetResource } else { - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + $result = Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -515,11 +504,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $AllPermissions, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AllPermissions ) Write-Verbose -Message "Testing permissions for Web Application '$WebAppUrl'" @@ -633,11 +618,7 @@ function Test-SPDscInput() [Parameter()] [System.Boolean] - $AllPermissions, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AllPermissions ) if ($AllPermissions) @@ -935,11 +916,6 @@ function Export-TargetResource $PartialContent += " {`r`n" $results = Get-TargetResource @params - if ($results.Contains("InstallAccount")) - { - $results.Remove("InstallAccount") - } - <# Fix an issue with SP DSC (forward) 1.6.0.0 #> if ($results.WebAppUrl -eq "url") { diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.schema.mof index 98e8979a4..03a1f40a8 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppPermissions/MSFT_SPWebAppPermissions.schema.mof @@ -6,6 +6,4 @@ class MSFT_SPWebAppPermissions : OMI_BaseResource [Write, Description("Site permissions that need to be configured"), ValueMap{"Manage Permissions","View Web Analytics Data","Create Subsites","Manage Web Site","Add and Customize Pages","Apply Themes and Borders","Apply Style Sheets","Create Groups","Browse Directories","Use Self-Service Site Creation","View Pages","Enumerate Permissions","Browse User Information","Manage Alerts","Use Remote Interfaces","Use Client Integration Features","Open","Edit Personal User Information"}, Values{"Manage Permissions","View Web Analytics Data","Create Subsites","Manage Web Site","Add and Customize Pages","Apply Themes and Borders","Apply Style Sheets","Create Groups","Browse Directories","Use Self-Service Site Creation","View Pages","Enumerate Permissions","Browse User Information","Manage Alerts","Use Remote Interfaces","Use Client Integration Features","Open","Edit Personal User Information"}] string SitePermissions[]; [Write, Description("Personal permissions that need to be configured"), ValueMap{"Manage Personal Views","Add/Remove Personal Web Parts","Update Personal Web Parts"}, Values{"Manage Personal Views","Add/Remove Personal Web Parts","Update Personal Web Parts"}] string PersonalPermissions[]; [Write, Description("Set all permissions")] boolean AllPermissions; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.psm1 b/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.psm1 index 0ea2a6251..9617a6af4 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.psm1 @@ -22,11 +22,7 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $SetCacheAccountsPolicy, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SetCacheAccountsPolicy ) Write-Verbose -Message "Getting web app policy for $WebAppUrl" @@ -76,8 +72,7 @@ function Get-TargetResource } } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -217,11 +212,7 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $SetCacheAccountsPolicy, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SetCacheAccountsPolicy ) Write-Verbose -Message "Setting web app policy for $WebAppUrl" @@ -311,8 +302,7 @@ function Set-TargetResource } # Determine the default identity type to use for entries that do not have it specified - $defaultIdentityType = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $defaultIdentityType = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -448,8 +438,7 @@ function Set-TargetResource } ## Perform changes - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot, $changeUsers) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot, $changeUsers) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -665,11 +654,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $SetCacheAccountsPolicy, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SetCacheAccountsPolicy ) Write-Verbose -Message "Testing web app policy for $WebAppUrl" @@ -709,8 +694,7 @@ function Test-TargetResource } # Determine the default identity type to use for entries that do not have it specified - $defaultIdentityType = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $defaultIdentityType = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -948,8 +932,7 @@ function Get-SPDscCacheAccountConfiguration() $WebApplicationUrl ) - $cacheAccounts = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($WebApplicationUrl, $MyInvocation.MyCommand.Source) ` + $cacheAccounts = Invoke-SPDscCommand -Arguments @($WebApplicationUrl, $MyInvocation.MyCommand.Source) ` -ScriptBlock { Write-Verbose -Message "Retrieving CacheAccounts" $webApplicationUrl = $args[0] diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.schema.mof index 0f10cf83d..551d2208f 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppPolicy/MSFT_SPWebAppPolicy.schema.mof @@ -14,5 +14,4 @@ class MSFT_SPWebAppPolicy : OMI_BaseResource [Write, Description("List of all accounts that must be in the Web Policy group"), EmbeddedInstance("MSFT_SPWebPolicyPermissions")] String MembersToInclude[]; [Write, Description("List of all accounts that are not allowed to have any Web Policy permissions"), EmbeddedInstance("MSFT_SPWebPolicyPermissions")] String MembersToExclude[]; [Write, Description("Include the Cache Accounts in the policy or not")] Boolean SetCacheAccountsPolicy; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppPropertyBag/MSFT_SPWebAppPropertyBag.psm1 b/SharePointDsc/DSCResources/MSFT_SPWebAppPropertyBag/MSFT_SPWebAppPropertyBag.psm1 index ecc158a5c..4cf4f3b51 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppPropertyBag/MSFT_SPWebAppPropertyBag.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppPropertyBag/MSFT_SPWebAppPropertyBag.psm1 @@ -19,17 +19,12 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = 'Present' ) Write-Verbose -Message "Looking for SPWebApplication property '$Key'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -87,17 +82,12 @@ function Set-TargetResource() [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = 'Present' ) Write-Verbose -Message "Setting SPWebApplication property '$Key'" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -139,11 +129,7 @@ function Test-TargetResource() [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = 'Present', - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = 'Present' ) Write-Verbose -Message "Testing SPWebApplication property '$Key'" diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppPropertyBag/MSFT_SPWebAppPropertyBag.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWebAppPropertyBag/MSFT_SPWebAppPropertyBag.schema.mof index 3d8afd80f..996aeb8ed 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppPropertyBag/MSFT_SPWebAppPropertyBag.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppPropertyBag/MSFT_SPWebAppPropertyBag.schema.mof @@ -5,5 +5,4 @@ class MSFT_SPWebAppPropertyBag : OMI_BaseResource [Key, Description("The key of the SPWebApplication property")] string Key; [Write, Description("Value of the SPWebApplication property")] String Value; [Write, Description("Set to present to ensure the SPWebApplication property exists, or absent to ensure it is removed"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.psm1 b/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.psm1 index 734837a63..6eecd55e5 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.psm1 @@ -10,17 +10,12 @@ function Get-TargetResource [Parameter(Mandatory = $true)] [System.String] - $ServiceAppProxyGroup, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ServiceAppProxyGroup ) Write-Verbose -Message "Getting $WebAppUrl Service Proxy Group Association" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -62,17 +57,12 @@ function Set-TargetResource [Parameter(Mandatory = $true)] [System.String] - $ServiceAppProxyGroup, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ServiceAppProxyGroup ) Write-Verbose -Message "Setting $WebAppUrl Service Proxy Group Association" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -98,11 +88,7 @@ function Test-TargetResource [Parameter(Mandatory = $true)] [System.String] - $ServiceAppProxyGroup, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $ServiceAppProxyGroup ) Write-Verbose -Message "Testing $WebAppUrl Service Proxy Group Association" @@ -162,10 +148,6 @@ function Export-TargetResource $PartialContent += " {`r`n" $results = Get-TargetResource @params - if ($results.Contains("InstallAccount")) - { - $results.Remove("InstallAccount") - } $results = Repair-Credentials -results $results $currentBlock = Get-DSCBlock -Params $results -ModulePath $module $currentBlock = Convert-DSCStringParamToVariable -DSCBlock $currentBlock -ParameterName "PsDscRunAsCredential" diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.schema.mof index b0b39e756..9de6f651c 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppProxyGroup/MSFT_SPWebAppProxyGroup.schema.mof @@ -3,5 +3,4 @@ class MSFT_SPWebAppProxyGroup : OMI_BaseResource { [Key, Description("URL of the web application")] String WebAppUrl; [Required, Description("Name of the Service Application Proxy Group")] string ServiceAppProxyGroup; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.psm1 b/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.psm1 index 2f1c40b8c..517664059 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.psm1 @@ -23,17 +23,12 @@ function Get-TargetResource [Parameter()] [ValidateRange(2, 168)] [System.UInt32] - $UnusedSiteNotificationsBeforeDeletion, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $UnusedSiteNotificationsBeforeDeletion ) Write-Verbose -Message "Getting web application '$WebAppUrl' site use and deletion settings" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -101,17 +96,12 @@ function Set-TargetResource [Parameter()] [ValidateRange(2, 168)] [System.UInt32] - $UnusedSiteNotificationsBeforeDeletion, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $UnusedSiteNotificationsBeforeDeletion ) Write-Verbose -Message "Setting web application '$WebAppUrl' Site Use and Deletion settings" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -255,11 +245,7 @@ function Test-TargetResource [Parameter()] [ValidateRange(2, 168)] [System.UInt32] - $UnusedSiteNotificationsBeforeDeletion, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $UnusedSiteNotificationsBeforeDeletion ) Write-Verbose -Message "Testing web application '$WebAppUrl' site use and deletion settings" @@ -298,10 +284,6 @@ function Export-TargetResource $PartialContent += " {`r`n" $results = Get-TargetResource @params - if ($results.Contains("InstallAccount")) - { - $results.Remove("InstallAccount") - } $results = Repair-Credentials -results $results $currentBlock = Get-DSCBlock -Params $results -ModulePath $module $currentBlock = Convert-DSCStringParamToVariable -DSCBlock $currentBlock -ParameterName "PsDscRunAsCredential" diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.schema.mof index a6e68c30c..c2d35f3f7 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppSiteUseAndDeletion/MSFT_SPWebAppSiteUseAndDeletion.schema.mof @@ -6,5 +6,4 @@ class MSFT_SPWebAppSiteUseAndDeletion : OMI_BaseResource [Write, Description("How many days should pass before a site is flagged as unused")] uint32 UnusedSiteNotificationPeriod; [Write, Description("Should unused site collection be automatically deleted")] boolean AutomaticallyDeleteUnusedSiteCollections; [Write, Description("How many days before an unused site is deleted should an email be sent to the owner")] uint32 UnusedSiteNotificationsBeforeDeletion; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppSuiteBar/MSFT_SPWebAppSuiteBar.psm1 b/SharePointDsc/DSCResources/MSFT_SPWebAppSuiteBar/MSFT_SPWebAppSuiteBar.psm1 index 5a13a0e23..462301108 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppSuiteBar/MSFT_SPWebAppSuiteBar.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppSuiteBar/MSFT_SPWebAppSuiteBar.psm1 @@ -26,17 +26,12 @@ function Get-TargetResource [Parameter()] [System.String] - $SuiteBarBrandingElementHtml, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SuiteBarBrandingElementHtml ) Write-Verbose -Message "Getting web app suite bar properties for $WebAppUrl" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -106,11 +101,7 @@ function Set-TargetResource [Parameter()] [System.String] - $SuiteBarBrandingElementHtml, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SuiteBarBrandingElementHtml ) Write-Verbose -Message "Setting web app suite bar properties for $WebAppUrl" @@ -207,8 +198,7 @@ function Set-TargetResource } ## Perform changes - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -273,11 +263,7 @@ function Test-TargetResource [Parameter()] [System.String] - $SuiteBarBrandingElementHtml, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SuiteBarBrandingElementHtml ) Write-Verbose -Message "Testing web app suite bar properties for $WebAppUrl" diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppSuiteBar/MSFT_SPWebAppSuiteBar.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWebAppSuiteBar/MSFT_SPWebAppSuiteBar.schema.mof index 59e9709eb..2c7a639f5 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppSuiteBar/MSFT_SPWebAppSuiteBar.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppSuiteBar/MSFT_SPWebAppSuiteBar.schema.mof @@ -7,5 +7,4 @@ class MSFT_SPWebAppSuiteBar : OMI_BaseResource [Write, Description("SP2016+: URL of the logo for the Suite Bar. This only works on classic pages for SP2019 and newer.")] String SuiteNavBrandingLogoUrl; [Write, Description("SP2016+: Text to display at the left hand side of the suite bar. No built in support of showing this on web pages in SP2019 and newer.")] String SuiteNavBrandingText; [Write, Description("SP2013+: HTML to inject in the left hand-side of the Suite Bar. Only works in classic pages with a SharePoint 2013 master page in SharePoint 2016 and newer.")] String SuiteBarBrandingElementHtml; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.psm1 index 7dd5619ad..ab0ddc2b1 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.psm1 @@ -50,17 +50,13 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $EventHandlersEnabled, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $EventHandlersEnabled ) Write-Verbose -Message "Getting web application '$WebAppUrl' throttling settings" $paramArgs = @($PSBoundParameters, $PSScriptRoot) - $result = Invoke-SPDscCommand -Credential $InstallAccount -Arguments $paramArgs -ScriptBlock { + $result = Invoke-SPDscCommand -Arguments $paramArgs -ScriptBlock { $params = $args[0] $ScriptRoot = $args[1] @@ -144,19 +140,14 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $EventHandlersEnabled, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $EventHandlersEnabled ) Write-Verbose -Message "Setting web application '$WebAppUrl' throttling settings" $paramArgs = @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot) - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $paramArgs ` + $null = Invoke-SPDscCommand -Arguments $paramArgs ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -242,11 +233,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $EventHandlersEnabled, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $EventHandlersEnabled ) Write-Verbose -Message "Testing web application '$WebAppUrl' throttling settings" @@ -287,10 +274,6 @@ function Export-TargetResource $PartialContent += " {`r`n" $results = Get-TargetResource @params - if ($results.Contains("InstallAccount")) - { - $results.Remove("InstallAccount") - } $results.HappyHour = Get-SPDscWebAppHappyHour -params $results.HappyHour $results = Repair-Credentials -results $results $currentBlock = Get-DSCBlock -Params $results -ModulePath $module diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.schema.mof index 364f6ef3b..7c6237abd 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppThrottlingSettings/MSFT_SPWebAppThrottlingSettings.schema.mof @@ -21,5 +21,4 @@ class MSFT_SPWebAppThrottlingSettings : OMI_BaseResource [Write, Description("Is the change log enabled for this web app")] boolean ChangeLogEnabled; [Write, Description("How many days does the change log store data for")] uint32 ChangeLogExpiryDays; [Write, Description("Are event handlers enabled in the web application")] boolean EventHandlersEnabled; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.psm1 b/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.psm1 index 8d438ba41..fa926a02b 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.psm1 @@ -18,18 +18,13 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $EmailToNoPermissionWorkflowParticipantsEnable, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $EmailToNoPermissionWorkflowParticipantsEnable ) Write-Verbose -Message "Getting web application '$WebAppUrl' workflow settings" $paramArgs = @($PSBoundParameters, $PSScriptRoot) - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $paramArgs ` + $result = Invoke-SPDscCommand -Arguments $paramArgs ` -ScriptBlock { $params = $args[0] $ScriptRoot = $args[1] @@ -75,18 +70,13 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $EmailToNoPermissionWorkflowParticipantsEnable, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $EmailToNoPermissionWorkflowParticipantsEnable ) Write-Verbose -Message "Setting web application '$WebAppUrl' workflow settings" $paramArgs = @($PSBoundParameters, $MyInvocation.MyCommand.Source, $PSScriptRoot) - $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $paramArgs ` + $null = Invoke-SPDscCommand -Arguments $paramArgs ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -129,11 +119,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $EmailToNoPermissionWorkflowParticipantsEnable, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $EmailToNoPermissionWorkflowParticipantsEnable ) Write-Verbose -Message "Testing web application '$WebAppUrl' workflow settings" @@ -174,10 +160,6 @@ function Export-TargetResource $PartialContent += " {`r`n" $results = Get-TargetResource @params - if ($results.Contains("InstallAccount")) - { - $results.Remove("InstallAccount") - } $results = Repair-Credentials -results $results $currentBlock = Get-DSCBlock -Params $results -ModulePath $module $currentBlock = Convert-DSCStringParamToVariable -DSCBlock $currentBlock -ParameterName "PsDscRunAsCredential" diff --git a/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.schema.mof index edfb2811b..a1523fdd5 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWebAppWorkflowSettings/MSFT_SPWebAppWorkflowSettings.schema.mof @@ -5,5 +5,4 @@ class MSFT_SPWebAppWorkflowSettings : OMI_BaseResource [Write, Description("Are external workflow participants enabled in the web app")] boolean ExternalWorkflowParticipantsEnabled; [Write, Description("Are user defined workflows enabled in this web app")] boolean UserDefinedWorkflowsEnabled; [Write, Description("Are documents sent via email to external participants of workflow")] boolean EmailToNoPermissionWorkflowParticipantsEnable; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.psm1 b/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.psm1 index cb3019e15..3acd52cd3 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.psm1 @@ -10,66 +10,113 @@ function Get-TargetResource [Parameter(Mandatory = $true)] [System.String] - $ApplicationPool, + $WebAppUrl, [Parameter(Mandatory = $true)] [System.String] - $ApplicationPoolAccount, + $ApplicationPool, [Parameter(Mandatory = $true)] [System.String] - $WebAppUrl, + $ApplicationPoolAccount, [Parameter()] - [System.Boolean] - $AllowAnonymous, + [System.String] + $Port, [Parameter()] [System.String] - $DatabaseName, + $HostHeader, [Parameter()] [System.String] - $DatabaseServer, + $CertificateThumbprint, [Parameter()] [System.Boolean] - $UseSQLAuthentication, + $UseServerNameIndication, [Parameter()] - [System.Management.Automation.PSCredential] - $DatabaseCredentials, + [System.Boolean] + $AllowLegacyEncryption, [Parameter()] [System.String] - $HostHeader, + $Path, [Parameter()] [System.String] - $Path, + $DatabaseName, [Parameter()] [System.String] - $Port, + $DatabaseServer, + + [Parameter()] + [System.Boolean] + $UseSQLAuthentication, + + [Parameter()] + [System.Management.Automation.PSCredential] + $DatabaseCredentials, + + [Parameter()] + [System.Boolean] + $AllowAnonymous, [Parameter()] [System.Boolean] $UseClassic = $false, [Parameter()] - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", + [Microsoft.Management.Infrastructure.CimInstance[]] + $SiteDataServers, [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present" ) Write-Verbose -Message "Getting web application '$Name' config" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $osVersion = Get-SPDscOSVersion + if ($PSBoundParameters.ContainsKey("AllowLegacyEncryption") -and ` + ($osVersion.Major -ne 10 -or $osVersion.Build -ne 20348)) + { + Write-Verbose ("You cannot specify the AllowLegacyEncryption parameter when using " + ` + "Windows Server 2019 or earlier.") + + return @{ + Name = $Name + WebAppUrl = $WebAppUrl + ApplicationPool = $ApplicationPool + ApplicationPoolAccount = $ApplicationPoolAccount + } + } + + if ($PSBoundParameters.ContainsKey("CertificateThumbprint") -or ` + $PSBoundParameters.ContainsKey("UseServerNameIndication") -or ` + $PSBoundParameters.ContainsKey("AllowLegacyEncryption")) + { + $productVersion = Get-SPDscInstalledProductVersion + if ($productVersion.FileMajorPart -ne 16 -or ` + $productVersion.FileBuildPart -lt 13000) + { + Write-Verbose ("The parameters AllowLegacyEncryption, CertificateThumbprint or " + ` + "UseServerNameIndication are only supported with SharePoint Server " + ` + "Subscription Edition.") + + return @{ + Name = $Name + WebAppUrl = $WebAppUrl + ApplicationPool = $ApplicationPool + ApplicationPoolAccount = $ApplicationPoolAccount + } + } + } + + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -93,7 +140,9 @@ function Get-TargetResource $classicAuth = $true } - $IISPath = $wa.IisSettings[0].Path + $iisSettings = $wa.IisSettings[0] + + $IISPath = $iisSettings.Path if (-not [System.String]::IsNullOrEmpty($IISPath)) { $IISPath = $IISPath.ToString() @@ -108,19 +157,32 @@ function Get-TargetResource $contentDb = $wa.ContentDatabases[0] } + $currSiteDataServers = @() + foreach ($entry in $wa.SiteDataServers.GetEnumerator()) + { + $sdsEntry = @{ + $entry.Key.ToString() = $entry.Value.AbsoluteUri.TrimEnd("/") + } + $currSiteDataServers += $sdsEntry + } + return @{ - Name = $wa.DisplayName - ApplicationPool = $wa.ApplicationPool.Name - ApplicationPoolAccount = $wa.ApplicationPool.Username - WebAppUrl = $wa.Url - AllowAnonymous = $authProvider.AllowAnonymous - DatabaseName = $contentDb.Name - DatabaseServer = $contentDb.Server - HostHeader = (New-Object -TypeName System.Uri $wa.Url).Host - Path = $IISPath - Port = (New-Object -TypeName System.Uri $wa.Url).Port - UseClassic = $classicAuth - Ensure = "Present" + Name = $wa.DisplayName + WebAppUrl = $wa.Url + ApplicationPool = $wa.ApplicationPool.Name + ApplicationPoolAccount = $wa.ApplicationPool.Username + Port = (New-Object -TypeName System.Uri $wa.Url).Port + HostHeader = (New-Object -TypeName System.Uri $wa.Url).Host + CertificateThumbprint = $iisSettings.SecureBindings[0].Certificate.Thumbprint + UseServerNameIndication = $iisSettings.SecureBindings[0].UseServerNameIndication + AllowLegacyEncryption = -not $iisSettings.SecureBindings[0].DisableLegacyTls + Path = $IISPath + DatabaseName = $contentDb.Name + DatabaseServer = $contentDb.Server + AllowAnonymous = $authProvider.AllowAnonymous + UseClassic = $classicAuth + SiteDataServers = $currSiteDataServers + Ensure = "Present" } } return $result @@ -138,70 +200,118 @@ function Set-TargetResource [Parameter(Mandatory = $true)] [System.String] - $ApplicationPool, + $WebAppUrl, [Parameter(Mandatory = $true)] [System.String] - $ApplicationPoolAccount, + $ApplicationPool, [Parameter(Mandatory = $true)] [System.String] - $WebAppUrl, + $ApplicationPoolAccount, [Parameter()] - [System.Boolean] - $AllowAnonymous, + [System.String] + $Port, [Parameter()] [System.String] - $DatabaseName, + $HostHeader, [Parameter()] [System.String] - $DatabaseServer, + $CertificateThumbprint, [Parameter()] [System.Boolean] - $UseSQLAuthentication, + $UseServerNameIndication, [Parameter()] - [System.Management.Automation.PSCredential] - $DatabaseCredentials, + [System.Boolean] + $AllowLegacyEncryption, [Parameter()] [System.String] - $HostHeader, + $Path, [Parameter()] [System.String] - $Path, + $DatabaseName, [Parameter()] [System.String] - $Port, + $DatabaseServer, + + [Parameter()] + [System.Boolean] + $UseSQLAuthentication, + + [Parameter()] + [System.Management.Automation.PSCredential] + $DatabaseCredentials, + + [Parameter()] + [System.Boolean] + $AllowAnonymous, [Parameter()] [System.Boolean] $UseClassic = $false, [Parameter()] - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", + [Microsoft.Management.Infrastructure.CimInstance[]] + $SiteDataServers, [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present" ) Write-Verbose -Message "Setting web application '$Name' config" $PSBoundParameters.UseClassic = $UseClassic + if ($PSBoundParameters.ContainsKey("Port") -eq $false) + { + $PSBoundParameters.Port = (New-Object -TypeName System.Uri $WebAppUrl).Port + } + + $osVersion = Get-SPDscOSVersion + if ($PSBoundParameters.ContainsKey("AllowLegacyEncryption") -and ` + ($osVersion.Major -ne 10 -or $osVersion.Build -ne 20348)) + { + $message = ("You cannot specify the AllowLegacyEncryption parameter when using " + ` + "Windows Server 2019 or earlier.") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + + if ($PSBoundParameters.ContainsKey("CertificateThumbprint") -or ` + $PSBoundParameters.ContainsKey("UseServerNameIndication") -or ` + $PSBoundParameters.ContainsKey("AllowLegacyEncryption")) + { + $productVersion = Get-SPDscInstalledProductVersion + if ($productVersion.FileMajorPart -ne 16 -or ` + $productVersion.FileBuildPart -lt 13000) + { + $message = ("The parameters AllowLegacyEncryption, CertificateThumbprint or " + ` + "UseServerNameIndication are only supported with SharePoint Server " + ` + "Subscription Edition.") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + } + if ($Ensure -eq "Present") { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -267,6 +377,30 @@ function Set-TargetResource { $newWebAppParams.Add("AllowAnonymousAccess", $params.AllowAnonymous) } + if ($params.ContainsKey("CertificateThumbprint") -eq $true) + { + $cert = Get-SPCertificate -Thumbprint $params.CertificateThumbprint -Store "EndEntity" + if ($null -eq $cert) + { + $message = ("No certificate found with the specified thumbprint: " + ` + "$($params.CertificateThumbprint). Make sure the certificate " + ` + "is added to Certificate Management first!") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $eventSource + throw $message + } + $newWebAppParams.Add("Certificate", $cert) + } + if ($params.ContainsKey("UseServerNameIndication") -eq $true) + { + $newWebAppParams.Add("UseServerNameIndication", $params.UseServerNameIndication) + } + if ($params.ContainsKey("AllowLegacyEncryption") -eq $true) + { + $newWebAppParams.Add("AllowLegacyEncryption", $params.AllowLegacyEncryption) + } if ($params.ContainsKey("DatabaseName") -eq $true) { $newWebAppParams.Add("DatabaseName", $params.DatabaseName) @@ -307,6 +441,8 @@ function Set-TargetResource else { Write-Verbose -Message "Update existing web application" + $updateWebApplication = $false + if ($params.ContainsKey("DatabaseName") -eq $true) { Write-Verbose -Message "Checking content database '$($params.DatabaseName)'" @@ -393,17 +529,124 @@ function Set-TargetResource Write-Verbose -Message "Applying new application pool" $wa.ApplicationPool = $newAppPool + $updateWebApplication = $true + } + + if ($params.ContainsKey("SiteDataServers") -eq $true) + { + $currentSiteDataServers = $wa.SiteDataServers + $currentZones = [array]$currentSiteDataServers.Keys + foreach ($currentSDServerZone in $currentZones) + { + $targetSDServers = $params.SiteDataServers | Where-Object -FilterScript { + $_.Zone -eq $currentSDServerZone + } + + if ($null -eq $targetSDServers) + { + $null = $currentSiteDataServers.Remove($currentSDServerZone) + } + } + + foreach ($targetSDServer in $params.SiteDataServers) + { + $zone = [Microsoft.SharePoint.Administration.SPUrlZone]$targetSDServer.Zone #Specify zone name + if ($currentSiteDataServers.ContainsKey($zone)) + { + # Zone exists, check value + if ($null -ne (Compare-Object -ReferenceObject $currentSiteDataServers[$zone].AbsoluteUri.TrimEnd("/") -DifferenceObject $targetSDServer.Uri)) + { + $null = $currentSiteDataServers.Remove($zone) + + $uriList = New-Object System.Collections.Generic.List[System.Uri](1) + foreach ($uri in $targetSDServer.Uri) + { + $target = New-Object System.Uri($uri) + $uriList.Add($target) + } + $currentSiteDataServers.Add($zone, $uriList) + } + } + else + { + # Zone does not exist, add value + $uriList = New-Object System.Collections.Generic.List[System.Uri](1) + foreach ($uri in $targetSDServer.Uri) + { + $target = New-Object System.Uri($uri) + $uriList.Add($target) + } + $currentSiteDataServers.Add($zone, $uriList) + } + } + + $updateWebApplication = $true + } + + if ($updateWebApplication -eq $true) + { $wa.Update() $wa.ProvisionGlobally() } + + $updateWebAppParams = @{ + Identity = $params.WebAppUrl + Zone = 'Default' + } + + if ($params.ContainsKey("CertificateThumbprint") -eq $true) + { + $cert = Get-SPCertificate -Thumbprint $params.CertificateThumbprint -Store "EndEntity" + if ($null -eq $cert) + { + $message = ("No certificate found with the specified thumbprint: " + ` + "$($params.CertificateThumbprint). Make sure the certificate " + ` + "is added to Certificate Management first!") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $eventSource + throw $message + } + $updateWebAppParams.Add("Certificate", $cert) + } + if ($params.ContainsKey("UseServerNameIndication") -eq $true) + { + $updateWebAppParams.Add("UseServerNameIndication", $params.UseServerNameIndication) + } + if ($params.ContainsKey("AllowLegacyEncryption") -eq $true) + { + $updateWebAppParams.Add("AllowLegacyEncryption", $params.AllowLegacyEncryption) + } + if ((New-Object -TypeName System.Uri $params.WebAppUrl).Scheme -eq "https") + { + $updateWebAppParams.Add("SecureSocketsLayer", $true) + } + + $productVersion = Get-SPDscInstalledProductVersion + if ($productVersion.FileMajorPart -eq 16 -and ` + $productVersion.FileBuildPart -ge 13000) + { + if ($params.ContainsKey("HostHeader") -eq $true) + { + $updateWebAppParams.Add("HostHeader", $params.HostHeader) + } + + if ($params.ContainsKey("Port") -eq $true) + { + $updateWebAppParams.Add("Port", $params.Port) + } + } + + Write-Verbose -Message "Updating web application with these parameters: $(Convert-SPDscHashtableToString -Hashtable $updateWebAppParams)" + Set-SPWebApplication @updateWebAppParams | Out-Null } } } if ($Ensure -eq "Absent") { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -429,60 +672,72 @@ function Test-TargetResource [Parameter(Mandatory = $true)] [System.String] - $ApplicationPool, + $WebAppUrl, [Parameter(Mandatory = $true)] [System.String] - $ApplicationPoolAccount, + $ApplicationPool, [Parameter(Mandatory = $true)] [System.String] - $WebAppUrl, + $ApplicationPoolAccount, [Parameter()] - [System.Boolean] - $AllowAnonymous, + [System.String] + $Port, [Parameter()] [System.String] - $DatabaseName, + $HostHeader, [Parameter()] [System.String] - $DatabaseServer, + $CertificateThumbprint, [Parameter()] [System.Boolean] - $UseSQLAuthentication, + $UseServerNameIndication, [Parameter()] - [System.Management.Automation.PSCredential] - $DatabaseCredentials, + [System.Boolean] + $AllowLegacyEncryption, [Parameter()] [System.String] - $HostHeader, + $Path, [Parameter()] [System.String] - $Path, + $DatabaseName, [Parameter()] [System.String] - $Port, + $DatabaseServer, + + [Parameter()] + [System.Boolean] + $UseSQLAuthentication, + + [Parameter()] + [System.Management.Automation.PSCredential] + $DatabaseCredentials, + + [Parameter()] + [System.Boolean] + $AllowAnonymous, [Parameter()] [System.Boolean] $UseClassic = $false, [Parameter()] - [ValidateSet("Present", "Absent")] - [System.String] - $Ensure = "Present", + [Microsoft.Management.Infrastructure.CimInstance[]] + $SiteDataServers, [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present" ) Write-Verbose -Message "Testing for web application '$Name' config" @@ -494,10 +749,52 @@ function Test-TargetResource Write-Verbose -Message "Current Values: $(Convert-SPDscHashtableToString -Hashtable $CurrentValues)" Write-Verbose -Message "Target Values: $(Convert-SPDscHashtableToString -Hashtable $PSBoundParameters)" + if ($PSBoundParameters.ContainsKey("SiteDataServers")) + { + $inDesiredState = $true + + $currentSiteDataServers = $CurrentValues.SiteDataServers + foreach ($currentSDServerZone in $currentSiteDataServers.Keys) + { + $targetSDServers = $PSBoundParameters.SiteDataServers | Where-Object { $_.Zone -eq $currentSDServerZone } + if ($null -eq $targetSDServers) + { + $inDesiredState = $false + } + } + + foreach ($targetSDServer in $PSBoundParameters.SiteDataServers) + { + $currentZone = $currentSiteDataServers | Where-Object { $_.GetEnumerator().Name -eq $targetSDServer.Zone } + if ($null -ne $currentZone) + { + if ($null -ne (Compare-Object -ReferenceObject $currentZone.($targetSDServer.Zone) -DifferenceObject $targetSDServer.Uri)) + { + $inDesiredState = $false + } + } + else + { + $inDesiredState = $false + } + } + + Write-Verbose -Message "Test-TargetResource returned $inDesiredState" + + return $inDesiredState + } + $result = Test-SPDscParameterState -CurrentValues $CurrentValues ` -Source $($MyInvocation.MyCommand.Source) ` -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("ApplicationPool", "DatabaseName", "Ensure") + -ValuesToCheck @( + "AllowLegacyEncryption", + "ApplicationPool", + "CertificateThumbprint", + "DatabaseName", + "Ensure", + "UseServerNameIndication" + ) Write-Verbose -Message "Test-TargetResource returned $result" @@ -542,6 +839,11 @@ function Export-TargetResource $results.Remove("AllowAnonymous") } + if ($results.SiteDataServers.Count -ne 0) + { + $results.SiteDataServers = Convert-SPDscArrayToCIMInstanceString -Params $results.SiteDataServers -CIMInstanceName "MSFT_SPWebAppSiteDataServers" + } + Add-ConfigurationDataEntry -Node "NonNodeData" -Key "DatabaseServer" -Value $results.DatabaseServer -Description "Name of the Database Server associated with the destination SharePoint Farm;" $results.DatabaseServer = "`$ConfigurationData.NonNodeData.DatabaseServer" $results["Path"] = $results["Path"].ToString() @@ -551,7 +853,9 @@ function Export-TargetResource $currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "ApplicationPoolAccount" } $currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "DatabaseServer" + $currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "SiteDataServers" -IsCIMArray $true $currentDSCBlock = Convert-DSCStringParamToVariable -DSCBlock $currentDSCBlock -ParameterName "PsDscRunAsCredential" + $partialContent += $currentDSCBlock $partialContent += " }`r`n" diff --git a/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.schema.mof index 172926537..689a524c0 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWebApplication/MSFT_SPWebApplication.schema.mof @@ -1,20 +1,28 @@ +[ClassVersion("1.0.0.0")] +Class MSFT_SPWebAppSiteDataServers +{ + [Required, Description("Specifies the zone for which the URI has to be configured"), ValueMap{"Default","Intranet","Internet","Extranet","Custom"}, Values{"Default","Intranet","Internet","Extranet","Custom"}] String Zone; + [Write, Description("The URI to be used by the Search crawlers")] String Uri[]; +}; [ClassVersion("1.1.0.0"), FriendlyName("SPWebApplication")] class MSFT_SPWebApplication : OMI_BaseResource { [Key, Description("The name of the web application")] string Name; + [Required, Description("The URL of the web application")] string WebAppUrl; [Required, Description("The name of the application pool to run this site in")] string ApplicationPool; [Required, Description("The name of the managed account to run the app pool with")] string ApplicationPoolAccount; - [Required, Description("The URL of the web application")] string WebAppUrl; - [Write, Description("Should anonymous access be enabled for this web app")] boolean AllowAnonymous; - [Write, Description("Create the web application with Classic authentication (only used during creation of a new web application)")] boolean UseClassic; - [Write, Description("The name of the first content database to be created with this web app")] string DatabaseName; - [Write, Description("The name of the database server to host the default content DB")] string DatabaseServer; + [Write, Description("The port to run the site on")] string Port; [Write, Description("The host header to use for the web app")] string HostHeader; + [Write, Description("Specifies the certificate thumbprint of the SSL certificate to be used. Make sure the certificate is added to Certificate Management (SPSE only)")] String CertificateThumbprint; + [Write, Description("Specifies that the Secure Sockets Layer (SSL) binding of this IIS website should use Server Name Indication (SNI) (SPSE only)")] Boolean UseServerNameIndication; + [Write, Description("Specifies that older SSL and TLS protocol versions and cipher suites are allowed to be used with this IIS website (SPSE only and requires Windows Server 2022)")] Boolean AllowLegacyEncryption; [Write, Description("The path on the local servers to host the IIS web site from")] string Path; - [Write, Description("The port to run the site on")] string Port; - [Write, Description("Present if the web app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; + [Write, Description("The name of the first content database to be created with this web app")] string DatabaseName; + [Write, Description("The name of the database server to host the default content DB")] string DatabaseServer; [Write, Description("Should SQL Server authentication be used to connect to the database?")] Boolean UseSQLAuthentication; [Write, Description("If using SQL authentication, the SQL credentials to use to connect to the instance"), EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; + [Write, Description("Should anonymous access be enabled for this web app")] boolean AllowAnonymous; + [Write, Description("Create the web application with Classic authentication (only used during creation of a new web application)")] boolean UseClassic; + [Write, Description("Configure target URIs for the Search crawlers"), EmbeddedInstance("MSFT_SPWebAppSiteDataServers")] string SiteDataServers[]; + [Write, Description("Present if the web app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.psm1 b/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.psm1 index c450a5b50..bde1f41ef 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.psm1 @@ -23,17 +23,12 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $SSL, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SSL ) Write-Verbose -Message "Getting app domain settings for '$AppDomain'" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] $webAppAppDomain = Get-SPWebApplicationAppDomain -WebApplication $params.WebAppUrl ` @@ -87,19 +82,14 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $SSL, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SSL ) Write-Verbose -Message "Setting app domain settings for '$AppDomain'" $CurrentValues = Get-TargetResource @PSBoundParameters - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $CurrentValues) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $CurrentValues) ` -ScriptBlock { $params = $args[0] $CurrentValues = $args[1] @@ -154,11 +144,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $SSL, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $SSL ) Write-Verbose -Message "Testing app domain settings for '$AppDomain'" diff --git a/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.schema.mof index 65c1259c3..a126d3e0a 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWebApplicationAppDomain/MSFT_SPWebApplicationAppDomain.schema.mof @@ -6,5 +6,4 @@ class MSFT_SPWebApplicationAppDomain : OMI_BaseResource [Required, Description("The domain for apps in this web app zone")] string AppDomain; [Write, Description("The port to run apps on")] string Port; [Write, Description("Should apps run under SSL")] boolean SSL; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.psm1 b/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.psm1 index e399e650b..91f0d8cf2 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.psm1 @@ -9,21 +9,21 @@ function Get-TargetResource $WebAppUrl, [Parameter(Mandatory = $true)] + [ValidateSet("Default", "Intranet", "Internet", "Extranet", "Custom")] [System.String] - $Name, + $Zone, [Parameter(Mandatory = $true)] [System.String] - $Url, + $Name, [Parameter(Mandatory = $true)] - [ValidateSet("Default", "Intranet", "Internet", "Extranet", "Custom")] [System.String] - $Zone, + $Url, [Parameter()] - [System.Boolean] - $AllowAnonymous, + [System.String] + $Port, [Parameter()] [System.String] @@ -31,30 +31,65 @@ function Get-TargetResource [Parameter()] [System.String] - $Path, + $CertificateThumbprint, [Parameter()] - [System.String] - $Port, + [System.Boolean] + $UseServerNameIndication, [Parameter()] [System.Boolean] - $UseSSL, + $AllowLegacyEncryption, [Parameter()] - [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", + $Path, + + [Parameter()] + [System.Boolean] + $AllowAnonymous, [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present" ) Write-Verbose -Message "Getting web application extension '$Name' config" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $osVersion = Get-SPDscOSVersion + if ($PSBoundParameters.ContainsKey("AllowLegacyEncryption") -and ` + ($osVersion.Major -ne 10 -or $osVersion.Build -ne 20348)) + { + Write-Verbose ("You cannot specify the AllowLegacyEncryption parameter when using " + ` + "Windows Server 2019 or earlier.") + + return @{ + WebAppUrl = $WebAppUrl + Zone = $Zone + } + } + + if ($PSBoundParameters.ContainsKey("CertificateThumbprint") -or ` + $PSBoundParameters.ContainsKey("UseServerNameIndication") -or ` + $PSBoundParameters.ContainsKey("AllowLegacyEncryption")) + { + $productVersion = Get-SPDscInstalledProductVersion + if ($productVersion.FileMajorPart -ne 16 -or ` + $productVersion.FileBuildPart -lt 13000) + { + Write-Verbose ("The parameters AllowLegacyEncryption, CertificateThumbprint or " + ` + "UseServerNameIndication are only supported with SharePoint Server " + ` + "Subscription Edition.") + + return @{ + WebAppUrl = $WebAppUrl + Zone = $Zone + } + } + } + + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -94,13 +129,11 @@ function Get-TargetResource { $HostHeader = $waExt.SecureBindings.HostHeader $Port = $waExt.SecureBindings.Port - $UseSSL = $true } else { $HostHeader = $waExt.ServerBindings.HostHeader $Port = $waExt.ServerBindings.Port - $UseSSL = $false } $waExtPath = $waExt.Path @@ -108,17 +141,20 @@ function Get-TargetResource { $waExtPath = $waExtPath.ToString() } + return @{ - WebAppUrl = $params.WebAppUrl - Name = $waExt.ServerComment - Url = $PublicURL - AllowAnonymous = $waExt.AllowAnonymous - HostHeader = $HostHeader - Path = $waExtPath - Port = $Port - Zone = $params.zone - UseSSL = $UseSSL - Ensure = "Present" + WebAppUrl = $params.WebAppUrl + Zone = $params.zone + Name = $waExt.ServerComment + Url = $PublicURL + Port = $Port + HostHeader = $HostHeader + CertificateThumbprint = $waExt.SecureBindings[0].Certificate.Thumbprint + UseServerNameIndication = $waExt.SecureBindings[0].UseServerNameIndication + AllowLegacyEncryption = -not $waExt.SecureBindings[0].DisableLegacyTls + Path = $waExtPath + AllowAnonymous = $waExt.AllowAnonymous + Ensure = "Present" } } return $result @@ -135,21 +171,21 @@ function Set-TargetResource $WebAppUrl, [Parameter(Mandatory = $true)] + [ValidateSet("Default", "Intranet", "Internet", "Extranet", "Custom")] [System.String] - $Name, + $Zone, [Parameter(Mandatory = $true)] [System.String] - $Url, + $Name, [Parameter(Mandatory = $true)] - [ValidateSet("Default", "Intranet", "Internet", "Extranet", "Custom")] [System.String] - $Zone, + $Url, [Parameter()] - [System.Boolean] - $AllowAnonymous, + [System.String] + $Port, [Parameter()] [System.String] @@ -157,32 +193,72 @@ function Set-TargetResource [Parameter()] [System.String] - $Path, + $CertificateThumbprint, [Parameter()] - [System.String] - $Port, + [System.Boolean] + $UseServerNameIndication, [Parameter()] [System.Boolean] - $UseSSL, + $AllowLegacyEncryption, [Parameter()] - [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", + $Path, + + [Parameter()] + [System.Boolean] + $AllowAnonymous, [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present" ) Write-Verbose -Message "Setting web application extension '$Name' config" + if ($PSBoundParameters.ContainsKey("Port") -eq $false) + { + $PSBoundParameters.Port = (New-Object -TypeName System.Uri $WebAppUrl).Port + } + + $osVersion = Get-SPDscOSVersion + if ($PSBoundParameters.ContainsKey("AllowLegacyEncryption") -and ` + ($osVersion.Major -ne 10 -or $osVersion.Build -ne 20348)) + { + $message = ("You cannot specify the AllowLegacyEncryption parameter when using " + ` + "Windows Server 2019 or earlier.") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + + if ($PSBoundParameters.ContainsKey("CertificateThumbprint") -or ` + $PSBoundParameters.ContainsKey("UseServerNameIndication") -or ` + $PSBoundParameters.ContainsKey("AllowLegacyEncryption")) + { + $productVersion = Get-SPDscInstalledProductVersion + if ($productVersion.FileMajorPart -ne 16 -or ` + $productVersion.FileBuildPart -lt 13000) + { + $message = ("The parameters AllowLegacyEncryption, CertificateThumbprint or " + ` + "UseServerNameIndication are only supported with SharePoint Server " + ` + "Subscription Edition.") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $MyInvocation.MyCommand.Source + throw $message + } + } + if ($Ensure -eq "Present") { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -214,6 +290,30 @@ function Set-TargetResource { $newWebAppExtParams.Add("AllowAnonymousAccess", $params.AllowAnonymous) } + if ($params.ContainsKey("CertificateThumbprint") -eq $true) + { + $cert = Get-SPCertificate -Thumbprint $params.CertificateThumbprint -Store "EndEntity" + if ($null -eq $cert) + { + $message = ("No certificate found with the specified thumbprint: " + ` + "$($params.CertificateThumbprint). Make sure the certificate " + ` + "is added to Certificate Management first!") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $eventSource + throw $message + } + $newWebAppExtParams.Add("Certificate", $cert) + } + if ($params.ContainsKey("UseServerNameIndication") -eq $true) + { + $newWebAppExtParams.Add("UseServerNameIndication", $params.UseServerNameIndication) + } + if ($params.ContainsKey("AllowLegacyEncryption") -eq $true) + { + $newWebAppExtParams.Add("AllowLegacyEncryption", $params.AllowLegacyEncryption) + } if ($params.ContainsKey("HostHeader") -eq $true) { $newWebAppExtParams.Add("HostHeader", $params.HostHeader) @@ -226,9 +326,9 @@ function Set-TargetResource { $newWebAppExtParams.Add("Port", $params.Port) } - if ($params.ContainsKey("UseSSL") -eq $true) + if ((New-Object -TypeName System.Uri $params.Url).Scheme -eq "https") { - $newWebAppExtParams.Add("SecureSocketsLayer", $params.UseSSL) + $newWebAppExtParams.Add("SecureSocketsLayer", $true) } $wa | New-SPWebApplicationExtension @newWebAppExtParams | Out-Null @@ -238,16 +338,68 @@ function Set-TargetResource if ($params.ContainsKey("AllowAnonymous") -eq $true) { $waExt.AllowAnonymous = $params.AllowAnonymous - $wa.update() + $wa.Update() + } + + $updateWebAppParams = @{ + Identity = $params.WebAppUrl + Zone = $params.Zone + } + + if ($params.ContainsKey("CertificateThumbprint") -eq $true) + { + $cert = Get-SPCertificate -Thumbprint $params.CertificateThumbprint -Store "EndEntity" + if ($null -eq $cert) + { + $message = ("No certificate found with the specified thumbprint: " + ` + "$($params.CertificateThumbprint). Make sure the certificate " + ` + "is added to Certificate Management first!") + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $eventSource + throw $message + } + $updateWebAppParams.Add("Certificate", $cert) + } + if ($params.ContainsKey("UseServerNameIndication") -eq $true) + { + $updateWebAppParams.Add("UseServerNameIndication", $params.UseServerNameIndication) + } + if ($params.ContainsKey("AllowLegacyEncryption") -eq $true) + { + $updateWebAppParams.Add("AllowLegacyEncryption", $params.AllowLegacyEncryption) + } + + if ((New-Object -TypeName System.Uri $params.Url).Scheme -eq "https") + { + $updateWebAppParams.Add("SecureSocketsLayer", $true) + } + + $productVersion = Get-SPDscInstalledProductVersion + if ($productVersion.FileMajorPart -eq 16 -and ` + $productVersion.FileBuildPart -ge 13000) + { + if ($params.ContainsKey("HostHeader") -eq $true) + { + $updateWebAppParams.Add("HostHeader", $params.HostHeader) + } + + if ($params.ContainsKey("Port") -eq $true) + { + $updateWebAppParams.Add("Port", $params.Port) + } } + + Write-Verbose -Message "Updating web application extension with these parameters: $(Convert-SPDscHashtableToString -Hashtable $updateWebAppParams)" + Set-SPWebApplication @updateWebAppParams | Out-Null } } } if ($Ensure -eq "Absent") { - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -282,21 +434,21 @@ function Test-TargetResource $WebAppUrl, [Parameter(Mandatory = $true)] + [ValidateSet("Default", "Intranet", "Internet", "Extranet", "Custom")] [System.String] - $Name, + $Zone, [Parameter(Mandatory = $true)] [System.String] - $Url, + $Name, [Parameter(Mandatory = $true)] - [ValidateSet("Default", "Intranet", "Internet", "Extranet", "Custom")] [System.String] - $Zone, + $Url, [Parameter()] - [System.Boolean] - $AllowAnonymous, + [System.String] + $Port, [Parameter()] [System.String] @@ -304,24 +456,28 @@ function Test-TargetResource [Parameter()] [System.String] - $Path, + $CertificateThumbprint, [Parameter()] - [System.String] - $Port, + [System.Boolean] + $UseServerNameIndication, [Parameter()] [System.Boolean] - $UseSSL, + $AllowLegacyEncryption, [Parameter()] - [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", + $Path, + + [Parameter()] + [System.Boolean] + $AllowAnonymous, [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + [ValidateSet("Present", "Absent")] + [System.String] + $Ensure = "Present" ) Write-Verbose -Message "Testing for web application extension '$Name'config" @@ -336,7 +492,13 @@ function Test-TargetResource $result = Test-SPDscParameterState -CurrentValues $CurrentValues ` -Source $($MyInvocation.MyCommand.Source) ` -DesiredValues $PSBoundParameters ` - -ValuesToCheck @("Ensure", "AllowAnonymous") + -ValuesToCheck @( + "AllowAnonymous", + "AllowLegacyEncryption", + "CertificateThumbprint", + "Ensure", + "UseServerNameIndication" + ) Write-Verbose -Message "Test-TargetResource returned $result" @@ -369,10 +531,6 @@ function Export-TargetResource $PartialContent += " {`r`n" $results = Get-TargetResource @params - if ($results.Contains("InstallAccount")) - { - $results.Remove("InstallAccount") - } if ("" -eq $results.HostHeader) { $results.Remove("HostHeader") diff --git a/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.schema.mof index f777fd794..912c2b3bf 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWebApplicationExtension/MSFT_SPWebApplicationExtension.schema.mof @@ -5,12 +5,12 @@ class MSFT_SPWebApplicationExtension : OMI_BaseResource [Required, Description("The name of the web application extension")] string Name; [Required, Description("The URL of the web application extension")] string Url; [Key, Description("Specifies one of the five zones with which the internal URL of this new extension is to be associated."),ValueMap{"Default","Intranet","Internet","Extranet","Custom"}, Values{"Default","Intranet","Internet","Extranet","Custom"}] string Zone; - [Write, Description("Should anonymous access be enabled for this web app extension")] boolean AllowAnonymous; + [Write, Description("The port to run the site on")] string Port; [Write, Description("The host header to use for the web app extension")] string HostHeader; + [Write, Description("Specifies the certificate thumbprint of the SSL certificate to be used. Make sure the certificate is added to Certificate Management (SPSE only)")] String CertificateThumbprint; + [Write, Description("Specifies that the Secure Sockets Layer (SSL) binding of this IIS website should use Server Name Indication (SNI) (SPSE only)")] Boolean UseServerNameIndication; + [Write, Description("Specifies that older SSL and TLS protocol versions and cipher suites are allowed to be used with this IIS website (SPSE only and requires Windows Server 2022)")] Boolean AllowLegacyEncryption; [Write, Description("The path on the local servers to host the IIS web site from")] string Path; - [Write, Description("The port to run the site on")] string Port; - [Write, Description("Should this web app extension use SSL")] boolean UseSSL; + [Write, Description("Should anonymous access be enabled for this web app extension")] boolean AllowAnonymous; [Write, Description("Present if the web app should exist, absent if it should not"), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; }; - diff --git a/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.psm1 index ef19560a8..acc8d6b30 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.psm1 @@ -97,11 +97,7 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $AddToDefault = $false, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AddToDefault = $false ) Write-Verbose -Message "Getting Word Automation service app '$Name'" @@ -145,8 +141,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -320,11 +315,7 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $AddToDefault = $false, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AddToDefault = $false ) Write-Verbose -Message "Setting Word Automation service app '$Name'" @@ -373,8 +364,7 @@ function Set-TargetResource if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message "Creating Word Automation Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -432,8 +422,7 @@ function Set-TargetResource if ($result.Ensure -eq "Present" -and $Ensure -eq "Present") { Write-Verbose -Message "Updating Word Automation Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -590,7 +579,7 @@ function Set-TargetResource if ($Ensure -eq "Absent") { Write-Verbose -Message "Removing Word Automation Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock { + Invoke-SPDscCommand -Arguments $PSBoundParameters -ScriptBlock { $params = $args[0] $serviceApp = Get-SPServiceApplication | Where-Object -FilterScript { @@ -714,11 +703,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $AddToDefault = $false, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AddToDefault = $false ) Write-Verbose -Message "Testing Word Automation service app '$Name'" @@ -822,10 +807,6 @@ function Export-TargetResource $PartialContent += " {`r`n" $results = Get-TargetResource @params - if ($results.Contains("InstallAccount")) - { - $results.Remove("InstallAccount") - } $results = Repair-Credentials -results $results Add-ConfigurationDataEntry -Node "NonNodeData" -Key "DatabaseServer" -Value $results.DatabaseServer -Description "Name of the Database Server associated with the destination SharePoint Farm;" diff --git a/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.schema.mof index c1376b6ab..42c889d40 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.schema.mof @@ -22,5 +22,4 @@ class MSFT_SPWordAutomationServiceApp : OMI_BaseResource [Write, Description("Should the service application be added to the default proxy group?")] Boolean AddToDefault; [Write, Description("Should SQL Server authentication be used to connect to the database?")] Boolean UseSQLAuthentication; [Write, Description("If using SQL authentication, the SQL credentials to use to connect to the instance"), EmbeddedInstance("MSFT_Credential")] String DatabaseCredentials; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] string InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/readme.md b/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/readme.md index 90b19bebe..610455bdb 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/readme.md +++ b/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/readme.md @@ -10,8 +10,7 @@ Service Application administration page are configurable using this resource. Important: When you specify Ensure=Present, the Application Pool and DatabaseName parameters are required. When you specify Ensure=Absent, no other parameters -are allowed (with the exception of Name, InstallAccount or -PsDscRunAsCredential). +are allowed (with the exception of Name and PsDscRunAsCredential). The default value for the Ensure parameter is Present. When not specifying this parameter, the service application is provisioned. diff --git a/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.psm1 index a8e73f539..99edd1581 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.psm1 @@ -43,11 +43,7 @@ function Get-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Getting Work management service app '$Name'" @@ -65,8 +61,7 @@ function Get-TargetResource throw $message } - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -167,11 +162,7 @@ function Set-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Setting Work management service app '$Name'" @@ -205,18 +196,13 @@ function Set-TargetResource if ($result.Ensure -eq "Absent" -and $Ensure -eq "Present") { Write-Verbose -Message "Creating work management Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] if ($params.ContainsKey("Ensure")) { $params.Remove("Ensure") | Out-Null } - if ($params.ContainsKey("InstallAccount")) - { - $params.Remove("InstallAccount") | Out-Null - } $pName = "$($params.Name) Proxy" @@ -243,8 +229,7 @@ function Set-TargetResource -and $ApplicationPool -ne $result.ApplicationPool) { Write-Verbose -Message "Updating Application Pool of Work Management Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -258,8 +243,7 @@ function Set-TargetResource } Write-Verbose -Message "Updating Application Pool of Work Management Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -324,8 +308,7 @@ function Set-TargetResource { # The service app should not exit Write-Verbose -Message "Removing Work Management Service Application $Name" - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -393,11 +376,7 @@ function Test-TargetResource [Parameter()] [ValidateSet("Present", "Absent")] [System.String] - $Ensure = "Present", - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $Ensure = "Present" ) Write-Verbose -Message "Testing Work management service app '$Name'" @@ -470,10 +449,6 @@ function Export-TargetResource $PartialContent += " {`r`n" $results = Get-TargetResource @params - if ($results.Contains("InstallAccount")) - { - $results.Remove("InstallAccount") - } $results = Repair-Credentials -results $results $currentBlock = Get-DSCBlock -Params $results -ModulePath $module $currentBlock = Convert-DSCStringParamToVariable -DSCBlock $currentBlock -ParameterName "PsDscRunAsCredential" diff --git a/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.schema.mof index dd6c2e86f..2f0e328e2 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWorkManagementServiceApp/MSFT_SPWorkManagementServiceApp.schema.mof @@ -11,5 +11,4 @@ class MSFT_SPWorkManagementServiceApp : OMI_BaseResource [Write, Description("The number of subscription syncronisations per EWS sync run")] uint32 NumberOfSubscriptionSyncsPerEwsSyncRun; [Write, Description("How many users will EWS calls include at once")] uint32 NumberOfUsersEwsSyncWillProcessAtOnce; [Write, Description("How many users are included in a batch for EWS")] uint32 NumberOfUsersPerEwsSyncBatch; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.psm1 b/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.psm1 index d81c707e5..6fce23e51 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.psm1 @@ -18,17 +18,12 @@ function Get-TargetResource [Parameter()] [System.Boolean] - $AllowOAuthHttp, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AllowOAuthHttp ) Write-Verbose -Message "Getting the current Workflow Service Configuration(s)" - $result = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments $PSBoundParameters ` + $result = Invoke-SPDscCommand -Arguments $PSBoundParameters ` -ScriptBlock { $params = $args[0] @@ -91,18 +86,13 @@ function Set-TargetResource [Parameter()] [System.Boolean] - $AllowOAuthHttp, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AllowOAuthHttp ) Write-Verbose -Message "Registering the Workflow Service" ## Perform changes - Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` + Invoke-SPDscCommand -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source) ` -ScriptBlock { $params = $args[0] $eventSource = $args[1] @@ -156,11 +146,7 @@ function Test-TargetResource [Parameter()] [System.Boolean] - $AllowOAuthHttp, - - [Parameter()] - [System.Management.Automation.PSCredential] - $InstallAccount + $AllowOAuthHttp ) Write-Verbose -Message "Testing Workflow Service" diff --git a/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.schema.mof b/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.schema.mof index a4a66c506..5d8ddfe83 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPWorkflowService/MSFT_SPWorkflowService.schema.mof @@ -5,5 +5,4 @@ class MSFT_SPWorkflowService : OMI_BaseResource [Key, Description("The URL of the Site Collection to associate with the Workflow Service Proxy")] String SPSiteUrl; [Write, Description("Specify scope name. If not specified SharePoint will use the default scope name 'SharePoint'")] String ScopeName; [Write, Description("Specify whether or not to allow connection to the Workflow Service over Http")] Boolean AllowOAuthHttp; - [Write, Description("POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5"), EmbeddedInstance("MSFT_Credential")] String InstallAccount; }; diff --git a/SharePointDsc/Examples/Resources/SPCertificate/1-ImportPFXCertificate.ps1 b/SharePointDsc/Examples/Resources/SPCertificate/1-ImportPFXCertificate.ps1 new file mode 100644 index 000000000..f6c74ae28 --- /dev/null +++ b/SharePointDsc/Examples/Resources/SPCertificate/1-ImportPFXCertificate.ps1 @@ -0,0 +1,70 @@ + +<#PSScriptInfo + +.VERSION 1.0.0 + +.GUID 80d306fa-8bd4-4a8d-9f7a-bf40df95e661 + +.AUTHOR DSC Community + +.COMPANYNAME DSC Community + +.COPYRIGHT DSC Community contributors. All rights reserved. + +.TAGS + +.LICENSEURI https://github.com/dsccommunity/SharePointDsc/blob/master/LICENSE + +.PROJECTURI https://github.com/dsccommunity/SharePointDsc + +.ICONURI https://dsccommunity.org/images/DSC_Logo_300p.png + +.EXTERNALMODULEDEPENDENCIES + +.REQUIREDSCRIPTS + +.EXTERNALSCRIPTDEPENDENCIES + +.RELEASENOTES +Updated author, copyright notice, and URLs. + +.PRIVATEDATA + +#> + +<# + +.DESCRIPTION + This example shows how to import a PFX certificate into the My store of + the local computer. + +#> + +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount, + + [Parameter(Mandatory = $true)] + [PSCredential] + $CertificatePassword + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost + { + SPCertificate IntranetCertificate + { + CertificateFilePath = 'C:\Certificates\Intranet.pfx' + CertificatePassword = $CertificatePassword + Store = 'EndEntity' + Exportable = $false + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount + } + } +} diff --git a/SharePointDsc/Examples/Resources/SPCertificate/2-ImportCERCertificate.ps1 b/SharePointDsc/Examples/Resources/SPCertificate/2-ImportCERCertificate.ps1 new file mode 100644 index 000000000..9d7aa60af --- /dev/null +++ b/SharePointDsc/Examples/Resources/SPCertificate/2-ImportCERCertificate.ps1 @@ -0,0 +1,68 @@ + +<#PSScriptInfo + +.VERSION 1.0.0 + +.GUID 80d306fa-8bd4-4a8d-9f7a-bf40df95e661 + +.AUTHOR DSC Community + +.COMPANYNAME DSC Community + +.COPYRIGHT DSC Community contributors. All rights reserved. + +.TAGS + +.LICENSEURI https://github.com/dsccommunity/SharePointDsc/blob/master/LICENSE + +.PROJECTURI https://github.com/dsccommunity/SharePointDsc + +.ICONURI https://dsccommunity.org/images/DSC_Logo_300p.png + +.EXTERNALMODULEDEPENDENCIES + +.REQUIREDSCRIPTS + +.EXTERNALSCRIPTDEPENDENCIES + +.RELEASENOTES +Updated author, copyright notice, and URLs. + +.PRIVATEDATA + +#> + +<# + +.DESCRIPTION + This example shows how to import a CER certificate into the Root store of + the local computer. + +#> + +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount, + + [Parameter(Mandatory = $true)] + [PSCredential] + $CertificatePassword + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost + { + SPCertificate RootCACertificate + { + CertificateFilePath = 'C:\Certificates\RootCA.cer' + Store = 'Root' + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount + } + } +} diff --git a/SharePointDsc/Examples/Resources/SPCertificate/3-RemovePFXCertificate.ps1 b/SharePointDsc/Examples/Resources/SPCertificate/3-RemovePFXCertificate.ps1 new file mode 100644 index 000000000..334806cfa --- /dev/null +++ b/SharePointDsc/Examples/Resources/SPCertificate/3-RemovePFXCertificate.ps1 @@ -0,0 +1,68 @@ + +<#PSScriptInfo + +.VERSION 1.0.0 + +.GUID 80d306fa-8bd4-4a8d-9f7a-bf40df95e661 + +.AUTHOR DSC Community + +.COMPANYNAME DSC Community + +.COPYRIGHT DSC Community contributors. All rights reserved. + +.TAGS + +.LICENSEURI https://github.com/dsccommunity/SharePointDsc/blob/master/LICENSE + +.PROJECTURI https://github.com/dsccommunity/SharePointDsc + +.ICONURI https://dsccommunity.org/images/DSC_Logo_300p.png + +.EXTERNALMODULEDEPENDENCIES + +.REQUIREDSCRIPTS + +.EXTERNALSCRIPTDEPENDENCIES + +.RELEASENOTES +Updated author, copyright notice, and URLs. + +.PRIVATEDATA + +#> + +<# + +.DESCRIPTION + This example shows how to remove a PFX certificate from Certificate + Management. + +#> + +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount, + + [Parameter(Mandatory = $true)] + [PSCredential] + $CertificatePassword + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost + { + SPCertificate IntranetCertificate + { + CertificateFilePath = 'C:\Certificates\Intranet.pfx' + CertificatePassword = $CertificatePassword + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount + } + } +} diff --git a/SharePointDsc/Examples/Resources/SPCertificateSettings/1-SetCertificateConfig.ps1 b/SharePointDsc/Examples/Resources/SPCertificateSettings/1-SetCertificateConfig.ps1 new file mode 100644 index 000000000..148ba432e --- /dev/null +++ b/SharePointDsc/Examples/Resources/SPCertificateSettings/1-SetCertificateConfig.ps1 @@ -0,0 +1,74 @@ + +<#PSScriptInfo + +.VERSION 1.0.0 + +.GUID 80d306fa-8bd4-4a8d-9f7a-bf40df95e661 + +.AUTHOR DSC Community + +.COMPANYNAME DSC Community + +.COPYRIGHT DSC Community contributors. All rights reserved. + +.TAGS + +.LICENSEURI https://github.com/dsccommunity/SharePointDsc/blob/master/LICENSE + +.PROJECTURI https://github.com/dsccommunity/SharePointDsc + +.ICONURI https://dsccommunity.org/images/DSC_Logo_300p.png + +.EXTERNALMODULEDEPENDENCIES + +.REQUIREDSCRIPTS + +.EXTERNALSCRIPTDEPENDENCIES + +.RELEASENOTES +Updated author, copyright notice, and URLs. + +.PRIVATEDATA + +#> + +<# + +.DESCRIPTION + This example shows how to apply default certificate settings to the farm + +#> + +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost + { + SPCertificateSettings CertificateSettings + { + IsSingleInstance = 'Yes' + OrganizationalUnit = 'IT' + Organization = 'Contoso' + Locality = 'Seattle' + State = 'Washington' + Country = 'US' + KeyAlgorithm = 'RSA' + KeySize = 2048 + EllipticCurve = 'nistP256' + HashAlgorithm = 'SHA256' + RsaSignaturePadding = 'Pkcs1' + CertificateExpirationAttentionThreshold = 60 + CertificateExpirationWarningThreshold = 15 + CertificateExpirationErrorThreshold = 15 + PsDscRunAsCredential = $SetupAccount + } + } +} diff --git a/SharePointDsc/Examples/Resources/SPCertificateSettings/2-SetCertificateContacts.ps1 b/SharePointDsc/Examples/Resources/SPCertificateSettings/2-SetCertificateContacts.ps1 new file mode 100644 index 000000000..795281a5b --- /dev/null +++ b/SharePointDsc/Examples/Resources/SPCertificateSettings/2-SetCertificateContacts.ps1 @@ -0,0 +1,62 @@ + +<#PSScriptInfo + +.VERSION 1.0.0 + +.GUID 80d306fa-8bd4-4a8d-9f7a-bf40df95e661 + +.AUTHOR DSC Community + +.COMPANYNAME DSC Community + +.COPYRIGHT DSC Community contributors. All rights reserved. + +.TAGS + +.LICENSEURI https://github.com/dsccommunity/SharePointDsc/blob/master/LICENSE + +.PROJECTURI https://github.com/dsccommunity/SharePointDsc + +.ICONURI https://dsccommunity.org/images/DSC_Logo_300p.png + +.EXTERNALMODULEDEPENDENCIES + +.REQUIREDSCRIPTS + +.EXTERNALSCRIPTDEPENDENCIES + +.RELEASENOTES +Updated author, copyright notice, and URLs. + +.PRIVATEDATA + +#> + +<# + +.DESCRIPTION + This example shows how to apply certificate notification contacts to the farm + +#> + +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost + { + SPCertificateSettings CertificateSettings + { + IsSingleInstance = 'Yes' + CertificateNotificationContacts = @('admin@contoso.com', 'certificates@contoso.com') + PsDscRunAsCredential = $SetupAccount + } + } +} diff --git a/SharePointDsc/Examples/Resources/SPInstall/1-InstallToDefaultPath.ps1 b/SharePointDsc/Examples/Resources/SPInstall/1-InstallToDefaultPath.ps1 index 43f95692a..e17ca5a67 100644 --- a/SharePointDsc/Examples/Resources/SPInstall/1-InstallToDefaultPath.ps1 +++ b/SharePointDsc/Examples/Resources/SPInstall/1-InstallToDefaultPath.ps1 @@ -54,7 +54,7 @@ Configuration Example node localhost { - SPInstall InstallBinaries + SPInstall 'InstallBinaries' { IsSingleInstance = "Yes" BinaryDir = "C:\SPInstall" diff --git a/SharePointDsc/Examples/Resources/SPInstallPrereqs/1-OnlineInstall.ps1 b/SharePointDsc/Examples/Resources/SPInstallPrereqs/1-OnlineInstall.ps1 index a2c80c9d2..3c96691c8 100644 --- a/SharePointDsc/Examples/Resources/SPInstallPrereqs/1-OnlineInstall.ps1 +++ b/SharePointDsc/Examples/Resources/SPInstallPrereqs/1-OnlineInstall.ps1 @@ -53,7 +53,7 @@ Configuration Example node localhost { - SPInstallPrereqs InstallPrerequisites + SPInstallPrereqs 'InstallPrerequisitesOnline' { IsSingleInstance = "Yes" InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe" diff --git a/SharePointDsc/Examples/Resources/SPInstallPrereqs/2-OfflineInstall_SP2013.ps1 b/SharePointDsc/Examples/Resources/SPInstallPrereqs/2-OfflineInstall_SP2013.ps1 index f90c2daa2..f45f45a2b 100644 --- a/SharePointDsc/Examples/Resources/SPInstallPrereqs/2-OfflineInstall_SP2013.ps1 +++ b/SharePointDsc/Examples/Resources/SPInstallPrereqs/2-OfflineInstall_SP2013.ps1 @@ -53,7 +53,7 @@ Configuration Example node localhost { - SPInstallPrereqs InstallPrerequisites + SPInstallPrereqs 'InstallPrerequisites2013' { IsSingleInstance = "Yes" InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe" diff --git a/SharePointDsc/Examples/Resources/SPInstallPrereqs/3-OfflineInstall_SP2016.ps1 b/SharePointDsc/Examples/Resources/SPInstallPrereqs/3-OfflineInstall_SP2016.ps1 index cb8a68ace..85ae80d19 100644 --- a/SharePointDsc/Examples/Resources/SPInstallPrereqs/3-OfflineInstall_SP2016.ps1 +++ b/SharePointDsc/Examples/Resources/SPInstallPrereqs/3-OfflineInstall_SP2016.ps1 @@ -53,7 +53,7 @@ Configuration Example node localhost { - SPInstallPrereqs InstallPrerequisites + SPInstallPrereqs 'InstallPrerequisites2016' { IsSingleInstance = "Yes" InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe" diff --git a/SharePointDsc/Examples/Resources/SPInstallPrereqs/4-OfflineInstall_SP2019.ps1 b/SharePointDsc/Examples/Resources/SPInstallPrereqs/4-OfflineInstall_SP2019.ps1 new file mode 100644 index 000000000..f8965c51b --- /dev/null +++ b/SharePointDsc/Examples/Resources/SPInstallPrereqs/4-OfflineInstall_SP2019.ps1 @@ -0,0 +1,74 @@ + +<#PSScriptInfo + +.VERSION 1.0.0 + +.GUID 80d306fa-8bd4-4a8d-9f7a-bf40df95e661 + +.AUTHOR DSC Community + +.COMPANYNAME DSC Community + +.COPYRIGHT DSC Community contributors. All rights reserved. + +.TAGS + +.LICENSEURI https://github.com/dsccommunity/SharePointDsc/blob/master/LICENSE + +.PROJECTURI https://github.com/dsccommunity/SharePointDsc + +.ICONURI https://dsccommunity.org/images/DSC_Logo_300p.png + +.EXTERNALMODULEDEPENDENCIES + +.REQUIREDSCRIPTS + +.EXTERNALSCRIPTDEPENDENCIES + +.RELEASENOTES +Updated author, copyright notice, and URLs. + +.PRIVATEDATA + +#> + +<# + +.DESCRIPTION + This module will install the prerequisites for SharePoint 2016/2019. This resource will run in + offline mode, running all prerequisite installations from the specified paths. + +#> + +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost + { + SPInstallPrereqs 'InstallPrerequisites2019' + { + IsSingleInstance = "Yes" + InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe" + OnlineMode = $false + SXSpath = "C:\SPInstall\Windows2012r2-SXS" + AppFabric = 'C:\SPInstall\prerequisiteinstallerfiles\WindowsServerAppFabricSetup_x64.exe' + DotNet472 = 'C:\SPInstall\prerequisiteinstallerfiles\NDP472-KB4054530-x86-x64-AllOS-ENU.exe' + KB3092423 = 'C:\SPInstall\prerequisiteinstallerfiles\AppFabric-KB3092423-x64-ENU.exe' + IDFX11 = 'C:\SPInstall\prerequisiteinstallerfiles\MicrosoftIdentityExtensions-64.msi' + MSIPCClient = 'C:\SPInstall\prerequisiteinstallerfiles\setup_msipc_x64.exe' + MSVCRT11 = 'C:\SPInstall\prerequisiteinstallerfiles\vcredist_x64.exe' + MSVCRT141 = 'C:\SPInstall\prerequisiteinstallerfiles\vc_redist.x64.exe' + SQLNCli = 'C:\SPInstall\prerequisiteinstallerfiles\sqlncli.msi' + Sync = 'C:\SPInstall\prerequisiteinstallerfiles\Synchronization.msi' + WCFDataServices56 = 'C:\SPInstall\prerequisiteinstallerfiles\WcfDataServices.exe' + } + } +} diff --git a/SharePointDsc/Examples/Resources/SPInstallPrereqs/5-OfflineInstall_SPSE.ps1 b/SharePointDsc/Examples/Resources/SPInstallPrereqs/5-OfflineInstall_SPSE.ps1 new file mode 100644 index 000000000..d5b0d0d64 --- /dev/null +++ b/SharePointDsc/Examples/Resources/SPInstallPrereqs/5-OfflineInstall_SPSE.ps1 @@ -0,0 +1,66 @@ + +<#PSScriptInfo + +.VERSION 1.0.0 + +.GUID 80d306fa-8bd4-4a8d-9f7a-bf40df95e661 + +.AUTHOR DSC Community + +.COMPANYNAME DSC Community + +.COPYRIGHT DSC Community contributors. All rights reserved. + +.TAGS + +.LICENSEURI https://github.com/dsccommunity/SharePointDsc/blob/master/LICENSE + +.PROJECTURI https://github.com/dsccommunity/SharePointDsc + +.ICONURI https://dsccommunity.org/images/DSC_Logo_300p.png + +.EXTERNALMODULEDEPENDENCIES + +.REQUIREDSCRIPTS + +.EXTERNALSCRIPTDEPENDENCIES + +.RELEASENOTES +Updated author, copyright notice, and URLs. + +.PRIVATEDATA + +#> + +<# + +.DESCRIPTION + This module will install the prerequisites for SharePoint 2016/2019. This resource will run in + offline mode, running all prerequisite installations from the specified paths. + +#> + +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost + { + SPInstallPrereqs 'InstallPrerequisitesSPSE' + { + IsSingleInstance = "Yes" + InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe" + OnlineMode = $false + SXSpath = "C:\SPInstall\Windows2012r2-SXS" + DotNet48 = 'C:\SPInstall\ndp48-x86-x64-allos-enu.exe' + MSVCRT142 = 'C:\SPInstall\VC_redist.x64.exe' + } + } +} diff --git a/SharePointDsc/Examples/Resources/SPOfficeOnlineServerSupressionSettings/1-AddSetting.ps1 b/SharePointDsc/Examples/Resources/SPOfficeOnlineServerSupressionSettings/1-AddSetting.ps1 new file mode 100644 index 000000000..b9adc6ae2 --- /dev/null +++ b/SharePointDsc/Examples/Resources/SPOfficeOnlineServerSupressionSettings/1-AddSetting.ps1 @@ -0,0 +1,64 @@ + +<#PSScriptInfo + +.VERSION 1.0.0 + +.GUID 80d306fa-8bd4-4a8d-9f7a-bf40df95e661 + +.AUTHOR DSC Community + +.COMPANYNAME DSC Community + +.COPYRIGHT DSC Community contributors. All rights reserved. + +.TAGS + +.LICENSEURI https://github.com/dsccommunity/SharePointDsc/blob/master/LICENSE + +.PROJECTURI https://github.com/dsccommunity/SharePointDsc + +.ICONURI https://dsccommunity.org/images/DSC_Logo_300p.png + +.EXTERNALMODULEDEPENDENCIES + +.REQUIREDSCRIPTS + +.EXTERNALSCRIPTDEPENDENCIES + +.RELEASENOTES +Updated author, copyright notice, and URLs. + +.PRIVATEDATA + +#> + +<# + +.DESCRIPTION + This example shows how to configure OOS supression settings for the + local SharePoint farm. + +#> + +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost + { + SPOfficeOnlineServerSupressionSettings 'PDF' + { + Extension = "pdf" + Actions = "view", "edit" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount + } + } +} diff --git a/SharePointDsc/Examples/Resources/SPOfficeOnlineServerSupressionSettings/2-RemoveSetting.ps1 b/SharePointDsc/Examples/Resources/SPOfficeOnlineServerSupressionSettings/2-RemoveSetting.ps1 new file mode 100644 index 000000000..60fa8c8f6 --- /dev/null +++ b/SharePointDsc/Examples/Resources/SPOfficeOnlineServerSupressionSettings/2-RemoveSetting.ps1 @@ -0,0 +1,63 @@ + +<#PSScriptInfo + +.VERSION 1.0.0 + +.GUID 80d306fa-8bd4-4a8d-9f7a-bf40df95e661 + +.AUTHOR DSC Community + +.COMPANYNAME DSC Community + +.COPYRIGHT DSC Community contributors. All rights reserved. + +.TAGS + +.LICENSEURI https://github.com/dsccommunity/SharePointDsc/blob/master/LICENSE + +.PROJECTURI https://github.com/dsccommunity/SharePointDsc + +.ICONURI https://dsccommunity.org/images/DSC_Logo_300p.png + +.EXTERNALMODULEDEPENDENCIES + +.REQUIREDSCRIPTS + +.EXTERNALSCRIPTDEPENDENCIES + +.RELEASENOTES +Updated author, copyright notice, and URLs. + +.PRIVATEDATA + +#> + +<# + +.DESCRIPTION + This example shows how to remove OOS supression settings for the + local SharePoint farm. + +#> + +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost + { + SPOfficeOnlineServerSupressionSettings 'PDF' + { + Extension = "pdf" + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount + } + } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchServiceApp/3-ServiceAppParameters.ps1 b/SharePointDsc/Examples/Resources/SPSearchServiceApp/3-ServiceAppParameters.ps1 new file mode 100644 index 000000000..35cb9f995 --- /dev/null +++ b/SharePointDsc/Examples/Resources/SPSearchServiceApp/3-ServiceAppParameters.ps1 @@ -0,0 +1,74 @@ + +<#PSScriptInfo + +.VERSION 1.0.0 + +.GUID 80d306fa-8bd4-4a8d-9f7a-bf40df95e661 + +.AUTHOR DSC Community + +.COMPANYNAME DSC Community + +.COPYRIGHT DSC Community contributors. All rights reserved. + +.TAGS + +.LICENSEURI https://github.com/dsccommunity/SharePointDsc/blob/master/LICENSE + +.PROJECTURI https://github.com/dsccommunity/SharePointDsc + +.ICONURI https://dsccommunity.org/images/DSC_Logo_300p.png + +.EXTERNALMODULEDEPENDENCIES + +.REQUIREDSCRIPTS + +.EXTERNALSCRIPTDEPENDENCIES + +.RELEASENOTES +Updated author, copyright notice, and URLs. + +.PRIVATEDATA + +#> + +<# + +.DESCRIPTION + This example creates a new search service app in the local farm + +#> + +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost + { + SPSearchServiceApp SearchServiceApp + { + Name = "Search Service Application" + DatabaseName = "SP_Search" + ApplicationPool = "SharePoint Service Applications" + ProxyName = "Search Service Application Proxy" + SearchCenterUrl = "https://intranet.contoso.com/sites/search" + AlertsEnabled = $true + ErrorDeleteCountAllowed = 10 + ErrorDeleteIntervalAllowed = 240 + ErrorCountAllowed = 15 + ErrorIntervalAllowed = 360 + DeleteUnvisitedMethod = 1 + RecrawlErrorCount = 5 + RecrawlErrorInterval = 120 + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount + } + } +} diff --git a/SharePointDsc/Examples/Resources/SPWebApplication/2-Example.ps1 b/SharePointDsc/Examples/Resources/SPWebApplication/2-Example.ps1 new file mode 100644 index 000000000..12fabdcd5 --- /dev/null +++ b/SharePointDsc/Examples/Resources/SPWebApplication/2-Example.ps1 @@ -0,0 +1,80 @@ + +<#PSScriptInfo + +.VERSION 1.0.0 + +.GUID 80d306fa-8bd4-4a8d-9f7a-bf40df95e661 + +.AUTHOR DSC Community + +.COMPANYNAME DSC Community + +.COPYRIGHT DSC Community contributors. All rights reserved. + +.TAGS + +.LICENSEURI https://github.com/dsccommunity/SharePointDsc/blob/master/LICENSE + +.PROJECTURI https://github.com/dsccommunity/SharePointDsc + +.ICONURI https://dsccommunity.org/images/DSC_Logo_300p.png + +.EXTERNALMODULEDEPENDENCIES + +.REQUIREDSCRIPTS + +.EXTERNALSCRIPTDEPENDENCIES + +.RELEASENOTES +Updated author, copyright notice, and URLs. + +.PRIVATEDATA + +#> + +<# + +.DESCRIPTION + This example shows how to configure Site Data Servers for + a new web application in the local farm + +#> + +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost + { + SPWebApplication HostNameSiteCollectionWebApp + { + Name = "SharePoint Sites" + WebAppUrl = "http://example.contoso.local" + ApplicationPool = "SharePoint Sites" + ApplicationPoolAccount = "CONTOSO\svcSPWebApp" + Port = 80 + DatabaseName = "SP_Content_01" + DatabaseServer = "SQL.contoso.local\SQLINSTANCE" + AllowAnonymous = $false + SiteDataServers = @( + MSFT_SPWebAppSiteDataServers { + Zone = "Default" + Uri = "http://spbackend" + } + MSFT_SPWebAppSiteDataServers { + Zone = "Intranet" + Uri = "http://spbackend2" + } + ) + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount + } + } +} diff --git a/SharePointDsc/Examples/Resources/SPWebApplication/3-Example.ps1 b/SharePointDsc/Examples/Resources/SPWebApplication/3-Example.ps1 new file mode 100644 index 000000000..977ad402f --- /dev/null +++ b/SharePointDsc/Examples/Resources/SPWebApplication/3-Example.ps1 @@ -0,0 +1,73 @@ + +<#PSScriptInfo + +.VERSION 1.0.0 + +.GUID 80d306fa-8bd4-4a8d-9f7a-bf40df95e661 + +.AUTHOR DSC Community + +.COMPANYNAME DSC Community + +.COPYRIGHT DSC Community contributors. All rights reserved. + +.TAGS + +.LICENSEURI https://github.com/dsccommunity/SharePointDsc/blob/master/LICENSE + +.PROJECTURI https://github.com/dsccommunity/SharePointDsc + +.ICONURI https://dsccommunity.org/images/DSC_Logo_300p.png + +.EXTERNALMODULEDEPENDENCIES + +.REQUIREDSCRIPTS + +.EXTERNALSCRIPTDEPENDENCIES + +.RELEASENOTES +Updated author, copyright notice, and URLs. + +.PRIVATEDATA + +#> + +<# + +.DESCRIPTION + This example shows how to configure SharePoint Subscription Edition + Certificate Management settings for a new web application in the local farm + +#> + +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost + { + SPWebApplication HTTPSWebApp + { + Name = "SharePoint Sites" + WebAppUrl = "http://example.contoso.local" + ApplicationPool = "SharePoint Sites" + ApplicationPoolAccount = "CONTOSO\svcSPWebApp" + Port = 80 + DatabaseName = "SP_Content_01" + DatabaseServer = "SQL.contoso.local\SQLINSTANCE" + AllowAnonymous = $false + AllowLegacyEncryption = $true + CertificateThumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + UseServerNameIndication = $false + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount + } + } +} diff --git a/SharePointDsc/Examples/Resources/SPWebApplicationExtension/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPWebApplicationExtension/1-Example.ps1 index 4ba4d3260..c5e5a205b 100644 --- a/SharePointDsc/Examples/Resources/SPWebApplicationExtension/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebApplicationExtension/1-Example.ps1 @@ -61,7 +61,6 @@ Configuration Example Zone = "Intranet" HostHeader = "intranet.contoso.local" Path = "c:\inetpub\wwwroot\wss\VirtualDirectories\intranet" - UseSSL = $false Port = 80 Ensure = "Present" PsDscRunAsCredential = $SetupAccount diff --git a/SharePointDsc/Examples/Resources/SPWebApplicationExtension/2-Example.ps1 b/SharePointDsc/Examples/Resources/SPWebApplicationExtension/2-Example.ps1 new file mode 100644 index 000000000..08bf454e5 --- /dev/null +++ b/SharePointDsc/Examples/Resources/SPWebApplicationExtension/2-Example.ps1 @@ -0,0 +1,73 @@ + +<#PSScriptInfo + +.VERSION 1.0.0 + +.GUID 80d306fa-8bd4-4a8d-9f7a-bf40df95e661 + +.AUTHOR DSC Community + +.COMPANYNAME DSC Community + +.COPYRIGHT DSC Community contributors. All rights reserved. + +.TAGS + +.LICENSEURI https://github.com/dsccommunity/SharePointDsc/blob/master/LICENSE + +.PROJECTURI https://github.com/dsccommunity/SharePointDsc + +.ICONURI https://dsccommunity.org/images/DSC_Logo_300p.png + +.EXTERNALMODULEDEPENDENCIES + +.REQUIREDSCRIPTS + +.EXTERNALSCRIPTDEPENDENCIES + +.RELEASENOTES +Updated author, copyright notice, and URLs. + +.PRIVATEDATA + +#> + +<# + +.DESCRIPTION + This example shows how to configure SharePoint Subscription Edition Certificate + Management settings for a new web application extension in the local farm + +#> + +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost + { + SPWebApplicationExtension IntranetZone + { + WebAppUrl = "http://example.contoso.local" + Name = "Contoso Intranet Zone" + AllowAnonymous = $false + Url = "http://intranet.contoso.local" + Zone = "Intranet" + HostHeader = "intranet.contoso.local" + Path = "c:\inetpub\wwwroot\wss\VirtualDirectories\intranet" + Port = 80 + AllowLegacyEncryption = $true + CertificateThumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + UseServerNameIndication = $false + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount + } + } +} diff --git a/SharePointDsc/Modules/SharePointDsc.ContentDatabase/SPContentDatabase.psm1 b/SharePointDsc/Modules/SharePointDsc.ContentDatabase/SPContentDatabase.psm1 index 3a81f0532..cc50df67d 100644 --- a/SharePointDsc/Modules/SharePointDsc.ContentDatabase/SPContentDatabase.psm1 +++ b/SharePointDsc/Modules/SharePointDsc.ContentDatabase/SPContentDatabase.psm1 @@ -21,11 +21,6 @@ function Mount-SPDscContentDatabase() $params.Remove("Ensure") } - if ($params.ContainsKey("InstallAccount")) - { - $params.Remove("InstallAccount") - } - if ($params.ContainsKey("MaximumSiteCount")) { $params.MaxSiteCount = $params.MaximumSiteCount diff --git a/SharePointDsc/Modules/SharePointDsc.Reverse/SharePointDsc.Reverse.psm1 b/SharePointDsc/Modules/SharePointDsc.Reverse/SharePointDsc.Reverse.psm1 index 5c572c18d..0b9283604 100644 --- a/SharePointDsc/Modules/SharePointDsc.Reverse/SharePointDsc.Reverse.psm1 +++ b/SharePointDsc/Modules/SharePointDsc.Reverse/SharePointDsc.Reverse.psm1 @@ -669,12 +669,6 @@ function Repair-Credentials ) if ($null -ne $results) { - <## Cleanup the InstallAccount param first (even if we may be adding it back) #> - if ($null -ne $results.ContainsKey("InstallAccount")) - { - $results.Remove("InstallAccount") - } - if ($null -ne $results.ContainsKey("PsDscRunAsCredential")) { $results.Remove("PsDscRunAsCredential") @@ -847,6 +841,84 @@ function Get-SPWebPolicyPermissions return $permission } +function Convert-SPDscHashtableToCIMInstanceString +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.Collections.Hashtable] + $Params, + + [Parameter(Mandatory = $true)] + [System.String] + $CIMInstanceName + ) + $cimString = "`r`n $CIMInstanceName {`r`n" + foreach ($key in $params.Keys) + { + try + { + $isCredentials = $false + <# + if ($key.ToLower() -eq "username") + { + if (!($params[$key].ToUpper() -like "NT AUTHORITY*")) + { + $memberUserName = Get-Credentials -UserName $params[$key] + if ($memberUserName) + { + $isCredentials = $true + } + } + } + #> + + if (($params[$key].ToString().ToLower() -eq "false" -or $params[$key].ToString().ToLower() -eq "true") -and !$isCredentials) + { + $cimString += " " + $key + " = `$" + $params[$key] + "`r`n" + } + elseif (!$isCredentials) + { + $cimString += " " + $key + " = '" + $params[$key] + "'`r`n" + } + else + { + $cimString += " " + $key + " = " + (Resolve-Credentials -UserName $params[$key]) + ".UserName`r`n" + } + } + catch + { + $Global:ErrorLog += "[$CIMInstanceName]" + $key + "`r`n" + $Global:ErrorLog += "$_`r`n`r`n" + } + } + $cimString += " }" + return $cimString +} + +function Convert-SPDscArrayToCIMInstanceString +{ + [CmdletBinding()] + param + ( + [Parameter(Mandatory = $true)] + [System.Array] + $Params, + + [Parameter(Mandatory = $true)] + [System.String] + $CIMInstanceName + ) + + $cimArray = @() + foreach ($param in $Params) + { + $cimArray += Convert-SPDscHashtableToCIMInstanceString -Params $param -CIMInstanceName $CIMInstanceName + } + return $cimArray +} + function Get-SPDscDBForAlias() { [CmdletBinding()] @@ -1522,17 +1594,17 @@ function DisplayGUI() #region Global $Global:liteComponents = @() $Global:defaultComponents = @() - $padding=20 + $padding = 20 $form = New-Object System.Windows.Forms.Form $screens = [System.Windows.Forms.Screen]::AllScreens $form.Width = ($screens[0].Bounds.Width) $form.Height = ($screens[0].Bounds.Height) #$form.WindowState = [System.Windows.Forms.FormWindowState]::Maximized - $firstColumnLeft = 1+$padding + $firstColumnLeft = 1 + $padding - $secondColumnLeft = (($screens[0].Bounds.Width) /3)+$firstColumnLeft +$padding - $thirdColumnLeft = (($screens[0].Bounds.Width) /3)+$secondColumnLeft +$padding + $secondColumnLeft = (($screens[0].Bounds.Width) / 3) + $firstColumnLeft + $padding + $thirdColumnLeft = (($screens[0].Bounds.Width) / 3) + $secondColumnLeft + $padding $topBannerHeight = 70 $panelMain = New-Object System.Windows.Forms.Panel @@ -1554,7 +1626,7 @@ function DisplayGUI() $panelInformationArchitecture.Left = $firstColumnLeft $panelInformationArchitecture.AutoSize = $true $panelInformationArchitecture.Height = 80 - $panelInformationArchitecture.Width = (($screens[0].Bounds.Width)/3) -$padding + $panelInformationArchitecture.Width = (($screens[0].Bounds.Width) / 3) - $padding $panelInformationArchitecture.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle $align = 0 @@ -1598,7 +1670,7 @@ function DisplayGUI() $panelSecurity.Top = $panelInformationArchitecture.Top + $panelInformationArchitecture.Height + 40 $panelSecurity.Left = $firstColumnLeft $panelSecurity.AutoSize = $true - $panelSecurity.Width = (($screens[0].Bounds.Width)/3) -$padding + $panelSecurity.Width = (($screens[0].Bounds.Width) / 3) - $padding $panelSecurity.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle $align = 0 @@ -1643,7 +1715,7 @@ function DisplayGUI() $panelSA.Top = $panelSecurity.Top + $panelSecurity.Height + 40 $panelSA.Left = $firstColumnLeft $panelSA.AutoSize = $true - $panelSA.Width = (($screens[0].Bounds.Width)/3) -$padding + $panelSA.Width = (($screens[0].Bounds.Width) / 3) - $padding $panelSA.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle $align = 0 @@ -1688,7 +1760,7 @@ function DisplayGUI() $panelSearch.Top = 30 + $topBannerHeight $panelSearch.Left = $secondColumnLeft $panelSearch.AutoSize = $true - $panelSearch.Width = (($screens[0].Bounds.Width)/3) -$padding + $panelSearch.Width = (($screens[0].Bounds.Width) / 3) - $padding $panelSearch.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle $align = 0 @@ -1733,7 +1805,7 @@ function DisplayGUI() $panelWebApp.Top = $panelSearch.Top + $panelSearch.Height + 40 $panelWebApp.Left = $secondColumnLeft $panelWebApp.AutoSize = $true - $panelWebApp.Width = (($screens[0].Bounds.Width)/3) -$padding + $panelWebApp.Width = (($screens[0].Bounds.Width) / 3) - $padding $panelWebApp.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle $align = 0 @@ -1779,7 +1851,7 @@ function DisplayGUI() $panelCustomization.Left = $secondColumnLeft $panelCustomization.AutoSize = $true $panelCustomization.Height = 80 - $panelCustomization.Width = (($screens[0].Bounds.Width)/3) -$padding + $panelCustomization.Width = (($screens[0].Bounds.Width) / 3) - $padding $panelCustomization.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle $align = 0 @@ -1824,7 +1896,7 @@ function DisplayGUI() $panelConfig.Top = 30 + $topBannerHeight $panelConfig.Left = $thirdColumnLeft $panelConfig.AutoSize = $true - $panelConfig.Width = (($screens[0].Bounds.Width)/3) -$padding + $panelConfig.Width = (($screens[0].Bounds.Width) / 3) - $padding $panelConfig.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle $align = 0 @@ -1869,7 +1941,7 @@ function DisplayGUI() $panelUPS.Top = $panelConfig.Top + $panelConfig.Height + 40 $panelUPS.Left = $thirdColumnLeft $panelUPS.AutoSize = $true - $panelUPS.Width = (($screens[0].Bounds.Width)/3) -$padding + $panelUPS.Width = (($screens[0].Bounds.Width) / 3) - $padding $panelUPS.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle $align = 0 diff --git a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psd1 b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psd1 index 2d4486b2b..4ef42bf7a 100644 --- a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psd1 +++ b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psd1 @@ -70,7 +70,6 @@ 'Test-SPDscIsADUser', 'Test-SPDscObjectHasProperty', 'Test-SPDscParameterState', - 'Test-SPDscRunAsCredential', 'Test-SPDscRunningAsFarmAccount', 'Test-SPDscUserIsLocalAdmin' ) diff --git a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 index e3e9bdcc1..4616e9901 100644 --- a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 +++ b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 @@ -615,13 +615,24 @@ function Invoke-SPDscCommand $VerbosePreference = 'Continue' - $baseScript = @" - if (`$null -eq (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue)) - { - Add-PSSnapin Microsoft.SharePoint.PowerShell - } + $installedVersion = Get-SPDscInstalledProductVersion + if ($installedVersion.ProductMajorPart -eq 15 -or $installedVersion.ProductBuildPart -le 12999) + { + $baseScript = @" + if (`$null -eq (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue)) + { + Add-PSSnapin Microsoft.SharePoint.PowerShell + } + +"@ + } + else + { + $baseScript = @" + Import-Module SharePointServer -Verbose:`$false -WarningAction SilentlyContinue "@ + } $invokeArgs = @{ ScriptBlock = [ScriptBlock]::Create($baseScript + $ScriptBlock.ToString()) @@ -885,34 +896,13 @@ function Test-SPDscObjectHasProperty return $false } -function Test-SPDscRunAsCredential -{ - [CmdletBinding()] - [OutputType([System.Boolean])] - param - ( - [Parameter()] - [System.Management.Automation.PSCredential] - $Credential - ) - - # If no specific credential is passed and it's not the machine account, it must be - # PsDscRunAsCredential - if (($null -eq $Credential) -and ($Env:USERNAME.Contains("$") -eq $false)) - { - return $true - } - # return false for all other scenarios - return $false -} - function Test-SPDscRunningAsFarmAccount { [CmdletBinding()] [OutputType([System.Boolean])] param ( [Parameter()] - [pscredential] + [System.Management.Automation.PSCredential] $InstallAccount ) diff --git a/SharePointDsc/SharePointDsc.psd1 b/SharePointDsc/SharePointDsc.psd1 index c09c2e780..b23d28db9 100644 --- a/SharePointDsc/SharePointDsc.psd1 +++ b/SharePointDsc/SharePointDsc.psd1 @@ -120,7 +120,6 @@ 'Test-SPDscIsADUser', 'Test-SPDscObjectHasProperty', 'Test-SPDscParameterState', - 'Test-SPDscRunAsCredential', 'Test-SPDscRunningAsFarmAccount', 'Test-SPDscUserIsLocalAdmin' ) @@ -149,6 +148,8 @@ 'SPBCSServiceApp', 'SPBlobCacheSettings', 'SPCacheAccounts', + 'SPCertificate', + 'SPCertificateSettings', 'SPConfigWizard', 'SPContentDatabase', 'SPDatabaseAAG', diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1e1cdf692..17888fab6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -195,12 +195,48 @@ stages: artifactName: 'CodeCoverage_2019' parallel: true + - job: Test_Unit_SPSE + displayName: 'Unit SPSE' + pool: + vmImage: 'windows-2022' + timeoutInMinutes: 0 + steps: + - task: DownloadPipelineArtifact@2 + displayName: 'Download Pipeline Artifact' + inputs: + buildType: 'current' + artifactName: $(buildArtifactName) + targetPath: '$(Build.SourcesDirectory)/$(buildArtifactName)' + - task: PowerShell@2 + name: test + displayName: 'Run Unit Test for SPSE' + inputs: + filePath: './build.ps1' + arguments: "-Tasks test -PesterScript @(@{ Path = '$(Build.SourcesDirectory)/Tests/Unit'; Parameters = @{SharePointCmdletModule = '$(Build.SourcesDirectory)/Tests/Unit/Stubs/SharePoint/16.0.14326.20450/SharePointServer.psm1' }})" + pwsh: false + + - task: PublishTestResults@2 + displayName: 'Publish Test Results' + condition: succeededOrFailed() + inputs: + testResultsFormat: 'NUnit' + testResultsFiles: '$(buildFolderName)/$(testResultFolderName)/NUnit*.xml' + testRunTitle: 'Unit (SPSE)' + + - task: PublishPipelineArtifact@1 + displayName: 'Publish CodeCoverage Artifact' + inputs: + targetPath: '$(buildFolderName)/$(testResultFolderName)/' + artifactName: 'CodeCoverage_SPSE' + parallel: true + - job: Code_Coverage displayName: 'Publish Code Coverage' dependsOn: - 'Test_Unit_2013' - 'Test_Unit_2016' - 'Test_Unit_2019' + - 'Test_Unit_SPSE' pool: vmImage: 'ubuntu-18.04' timeoutInMinutes: 0 @@ -220,26 +256,33 @@ stages: targetPath: '$(Build.SourcesDirectory)/$(buildArtifactName)' - task: DownloadPipelineArtifact@2 - displayName: 'Download Test Artifact' + displayName: 'Download Test Artifact SP2013' inputs: buildType: 'current' artifactName: 'CodeCoverage_2013' targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)/CodeCov2013' - task: DownloadPipelineArtifact@2 - displayName: 'Download Test Artifact' + displayName: 'Download Test Artifact SP2016' inputs: buildType: 'current' artifactName: 'CodeCoverage_2016' targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)/CodeCov2016' - task: DownloadPipelineArtifact@2 - displayName: 'Download Test Artifact' + displayName: 'Download Test Artifact SP2019' inputs: buildType: 'current' artifactName: 'CodeCoverage_2019' targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)/CodeCov2019' + - task: DownloadPipelineArtifact@2 + displayName: 'Download Test Artifact SPSE' + inputs: + buildType: 'current' + artifactName: 'CodeCoverage_SPSE' + targetPath: '$(Build.SourcesDirectory)/$(buildFolderName)/$(testResultFolderName)/CodeCovSPSE' + - task: PowerShell@2 name: merge displayName: 'Merge Code Coverage files' diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPAccessServiceApp.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPAccessServiceApp.Tests.ps1 index 42f53e849..c1c54c966 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.SPAccessServiceApp.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPAccessServiceApp.Tests.ps1 @@ -50,247 +50,255 @@ try InModuleScope -ModuleName $script:DSCResourceFullName -ScriptBlock { Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { BeforeAll { - Invoke-Command -Scriptblock $Global:SPDscHelper.InitializeScript -NoNewScope + Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope - # Initialize tests - $getTypeFullName = "Microsoft.Office.Access.Services.MossHost.AccessServicesWebServiceApplication" + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15 -or + ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -lt 13000)) + { + # Initialize tests + $getTypeFullName = "Microsoft.Office.Access.Services.MossHost.AccessServicesWebServiceApplication" - # Mocks for all contexts - Mock -CommandName New-SPAccessServicesApplication -MockWith { } - Mock -CommandName Set-SPAccessServicesApplication -MockWith { } - Mock -CommandName Remove-SPServiceApplication -MockWith { } + # Mocks for all contexts + Mock -CommandName New-SPAccessServicesApplication -MockWith { } + Mock -CommandName Set-SPAccessServicesApplication -MockWith { } + Mock -CommandName Remove-SPServiceApplication -MockWith { } - try - { - [Microsoft.SharePoint.SPServiceContext] - } - catch - { - $CsharpCode2 = @" + try + { + [Microsoft.SharePoint.SPServiceContext] + } + catch + { + $CsharpCode2 = @" namespace Microsoft.SharePoint { public enum SPSiteSubscriptionIdentifier { Default }; public class SPServiceContext { public static string GetContext(System.Object[] serviceApplicationProxyGroup, SPSiteSubscriptionIdentifier siteSubscriptionId) { - return ""; + return "context"; } } } "@ - Add-Type -TypeDefinition $CsharpCode2 + Add-Type -TypeDefinition $CsharpCode2 + } } } # Test contexts - Context -Name "When no service applications exist in the current farm" -Fixture { - BeforeAll { - $testParams = @{ - Name = "Test Access Services App" - DatabaseServer = "SQL.contoso.local" - ApplicationPool = "Test App Pool" - } + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15 -or + ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -lt 13000)) + { + Context -Name "When no service applications exist in the current farm" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Test Access Services App" + DatabaseServer = "SQL.contoso.local" + ApplicationPool = "Test App Pool" + } - Mock -CommandName Get-SPServiceApplication -MockWith { - return $null + Mock -CommandName Get-SPServiceApplication -MockWith { + return $null + } } - } - It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should -Be "Absent" - } - - It "Should return false when the Test method is called" { - Test-TargetResource @testParams | Should -Be $false - } + It "Should return absent from the Get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Absent" + } - It "Should create a new service application in the set method" { - Set-TargetResource @testParams - Assert-MockCalled New-SPAccessServicesApplication - } - } + It "Should return false when the Test method is called" { + Test-TargetResource @testParams | Should -Be $false + } - Context -Name "When service applications exist in the current farm but the specific Access Services app does not" -Fixture { - BeforeAll { - $testParams = @{ - Name = "Test Access Services App" - DatabaseServer = "SQL.contoso.local" - ApplicationPool = "Test App Pool" + It "Should create a new service application in the set method" { + Set-TargetResource @testParams + Assert-MockCalled New-SPAccessServicesApplication } + } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name + Context -Name "When service applications exist in the current farm but the specific Access Services app does not" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Test Access Services App" + DatabaseServer = "SQL.contoso.local" + ApplicationPool = "Test App Pool" } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "Microsoft.Office.UnKnownWebServiceApplication" + + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + DisplayName = $testParams.Name } - } -PassThru -Force - return $spServiceApp + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + return @{ + FullName = "Microsoft.Office.UnKnownWebServiceApplication" + } + } -PassThru -Force + return $spServiceApp + } } - } - It "Should return null from the Get method" { - (Get-TargetResource @testParams).Ensure | Should -Be "Absent" + It "Should return null from the Get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Absent" + } } - } - Context -Name "When a service application exists and is configured correctly" -Fixture { - BeforeAll { - $testParams = @{ - Name = "Test Access Services App" - DatabaseServer = "SQL.contoso.local" - ApplicationPool = "Test App Pool" - } + Context -Name "When a service application exists and is configured correctly" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Test Access Services App" + DatabaseServer = "SQL.contoso.local" + ApplicationPool = "Test App Pool" + } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - TypeName = "Access Services Web Service Application" - DisplayName = $testParams.Name - Name = $testParams.Name - DatabaseServer = $testParams.DatabaseServer - ApplicationPool = @{ Name = $testParams.ApplicationPool } + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + TypeName = "Access Services Web Service Application" + DisplayName = $testParams.Name + Name = $testParams.Name + DatabaseServer = $testParams.DatabaseServer + ApplicationPool = @{ Name = $testParams.ApplicationPool } + } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + return @{ + FullName = $getTypeFullName + } + } -PassThru -Force + return $spServiceApp } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { + + Mock -CommandName Get-SPAccessServicesDatabaseServer -MockWith { return @{ - FullName = $getTypeFullName + ServerName = $testParams.DatabaseServer } - } -PassThru -Force - return $spServiceApp - } - - Mock -CommandName Get-SPAccessServicesDatabaseServer -MockWith { - return @{ - ServerName = $testParams.DatabaseServer } } - } - It "Should return Present from the get method" { - (Get-TargetResource @testParams).Ensure | Should -Be "Present" - } + It "Should return Present from the get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Present" + } - It "Should return true when the Test method is called" { - Test-TargetResource @testParams | Should -Be $true + It "Should return true when the Test method is called" { + Test-TargetResource @testParams | Should -Be $true + } } - } - Context -Name "When the service application exists but it shouldn't" -Fixture { - BeforeAll { - $testParams = @{ - Name = "Test App" - ApplicationPool = "-" - DatabaseServer = "-" - Ensure = "Absent" - } + Context -Name "When the service application exists but it shouldn't" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Test App" + ApplicationPool = "-" + DatabaseServer = "-" + Ensure = "Absent" + } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - TypeName = "Access Services Web Service Application" - DisplayName = $testParams.Name - Name = $testParams.Name - DatabaseServer = $testParams.DatabaseServer - ApplicationPool = @{ Name = $testParams.ApplicationPool } + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + TypeName = "Access Services Web Service Application" + DisplayName = $testParams.Name + Name = $testParams.Name + DatabaseServer = $testParams.DatabaseServer + ApplicationPool = @{ Name = $testParams.ApplicationPool } + } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + return @{ + FullName = $getTypeFullName + } + } -PassThru -Force + return $spServiceApp } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { + + Mock -CommandName Get-SPAccessServicesDatabaseServer -MockWith { return @{ - FullName = $getTypeFullName + ServerName = $testParams.DatabaseServer } - } -PassThru -Force - return $spServiceApp + } } - Mock -CommandName Get-SPAccessServicesDatabaseServer -MockWith { - return @{ - ServerName = $testParams.DatabaseServer - } + It "Should return present from the Get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Present" } - } - It "Should return present from the Get method" { - (Get-TargetResource @testParams).Ensure | Should -Be "Present" - } + It "Should return false when the Test method is called" { + Test-TargetResource @testParams | Should -Be $false + } - It "Should return false when the Test method is called" { - Test-TargetResource @testParams | Should -Be $false + It "Should call the remove service application cmdlet in the set method" { + Set-TargetResource @testParams + Assert-MockCalled Remove-SPServiceApplication + } } - It "Should call the remove service application cmdlet in the set method" { - Invoke-Command -ScriptBlock $Global:SPDscHelper.CleanupScript -NoNewScope - Set-TargetResource @testParams - Assert-MockCalled Remove-SPServiceApplication - } - } + Context -Name "When the service application doesn't exist and it shouldn't" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Test App" + ApplicationPool = "-" + DatabaseServer = "-" + Ensure = "Absent" + } - Context -Name "When the service application doesn't exist and it shouldn't" -Fixture { - BeforeAll { - $testParams = @{ - Name = "Test App" - ApplicationPool = "-" - DatabaseServer = "-" - Ensure = "Absent" + Mock -CommandName Get-SPServiceApplication -MockWith { + return $null + } } - Mock -CommandName Get-SPServiceApplication -MockWith { - return $null + It "Should return absent from the Get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Absent" } - } - - It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should -Be "Absent" - } - It "Should return true when the Test method is called" { - Test-TargetResource @testParams | Should -Be $true + It "Should return true when the Test method is called" { + Test-TargetResource @testParams | Should -Be $true + } } - } - Context -Name "Running ReverseDsc Export" -Fixture { - BeforeAll { - Import-Module (Join-Path -Path (Split-Path -Path (Get-Module SharePointDsc -ListAvailable).Path -Parent) -ChildPath "Modules\SharePointDSC.Reverse\SharePointDSC.Reverse.psm1") + Context -Name "Running ReverseDsc Export" -Fixture { + BeforeAll { + Import-Module (Join-Path -Path (Split-Path -Path (Get-Module SharePointDsc -ListAvailable).Path -Parent) -ChildPath "Modules\SharePointDSC.Reverse\SharePointDSC.Reverse.psm1") - Mock -CommandName Write-Host -MockWith { } + Mock -CommandName Write-Host -MockWith { } - Mock -CommandName Get-TargetResource -MockWith { - return @{ - Name = "Access Services Service Application" - DatabaseServer = "SQL01" - ApplicationPool = "Service App Pool" - Ensure = "Present" + Mock -CommandName Get-TargetResource -MockWith { + return @{ + Name = "Access Services Service Application" + DatabaseServer = "SQL01" + ApplicationPool = "Service App Pool" + Ensure = "Present" + } } - } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - TypeName = "Access Services Web Service Application" - DisplayName = "Access Services Service Application" - Name = "Access Services Service Application" - DatabaseServer = "SQL01" - ApplicationPool = "Service App Pool" - } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = $getTypeFullName + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + TypeName = "Access Services Web Service Application" + DisplayName = "Access Services Service Application" + Name = "Access Services Service Application" + DatabaseServer = "SQL01" + ApplicationPool = "Service App Pool" } - } -PassThru -Force - return $spServiceApp - } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + return @{ + FullName = $getTypeFullName + } + } -PassThru -Force + return $spServiceApp + } - if ($null -eq (Get-Variable -Name 'spFarmAccount' -ErrorAction SilentlyContinue)) - { - $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force - $Global:spFarmAccount = New-Object -TypeName System.Management.Automation.PSCredential ("contoso\spfarm", $mockPassword) - } + if ($null -eq (Get-Variable -Name 'spFarmAccount' -ErrorAction SilentlyContinue)) + { + $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force + $Global:spFarmAccount = New-Object -TypeName System.Management.Automation.PSCredential ("contoso\spfarm", $mockPassword) + } - $result = @' + $result = @' SPAccessServiceApp AccessServicesServiceApplication { ApplicationPool = "Service App Pool"; @@ -301,10 +309,37 @@ try } '@ + } + + It "Should return valid DSC block from the Export method" { + Export-TargetResource | Should -Be $result + } } + } - It "Should return valid DSC block from the Export method" { - Export-TargetResource | Should -Be $result + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + Context -Name "All methods throw exceptions as Access Services no longer exists in SharePoint Server Subscription Edition" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Test Access Services App" + DatabaseServer = "SQL.contoso.local" + ApplicationPool = "Test App Pool" + } + } + + It "Should throw on the get method" { + { Get-TargetResource @testParams } | Should -Throw "Since SharePoint Server Subscription Edition the Access Services does no longer exists." + } + + It "Should throw on the test method" { + { Test-TargetResource @testParams } | Should -Throw "Since SharePoint Server Subscription Edition the Access Services does no longer exists." + } + + It "Should throw on the set method" { + { Set-TargetResource @testParams } | Should -Throw "Since SharePoint Server Subscription Edition the Access Services does no longer exists." + } } } } diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPAccessServices2010.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPAccessServices2010.Tests.ps1 index 01b6ee528..58768f3fc 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.SPAccessServices2010.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPAccessServices2010.Tests.ps1 @@ -51,189 +51,225 @@ try BeforeAll { Invoke-Command -Scriptblock $Global:SPDscHelper.InitializeScript -NoNewScope - # Initialize tests - $getTypeFullName = "Microsoft.Office.Access.Server.MossHost.AccessServerWebServiceApplication" + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15 -or + ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -lt 13000)) + { + # Initialize tests + $getTypeFullName = "Microsoft.Office.Access.Server.MossHost.AccessServerWebServiceApplication" - # Mocks for all contexts - Mock -CommandName Get-SPServiceApplication -MockWith { } - Mock -CommandName New-SPAccessServiceApplication -MockWith { } - Mock -CommandName Remove-SPServiceApplication -MockWith { } + # Mocks for all contexts + Mock -CommandName Get-SPServiceApplication -MockWith { } + Mock -CommandName New-SPAccessServiceApplication -MockWith { } + Mock -CommandName Remove-SPServiceApplication -MockWith { } + } } # Test contexts - Context -Name "When Access 2010 Services doesn't exists and should exist" -Fixture { - BeforeAll { - $testParams = @{ - Name = "Access 2010 Services Service Application" - ApplicationPool = "SharePoint Service Applications" - Ensure = "Present" - } - - Mock -CommandName Remove-SPServiceApplication -MockWith { } - Mock -CommandName New-SPAccessServiceApplication -MockWith { } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15 -or + ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -lt 13000)) + { + Context -Name "When Access 2010 Services doesn't exists and should exist" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Access 2010 Services Service Application" + ApplicationPool = "SharePoint Service Applications" + Ensure = "Present" } - $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "$($getTypeFullName).other" + + Mock -CommandName Remove-SPServiceApplication -MockWith { } + Mock -CommandName New-SPAccessServiceApplication -MockWith { } + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + DisplayName = $testParams.Name } - } -PassThru -Force - return @($spServiceApp) + $spServiceApp | Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + return @{ + FullName = "$($getTypeFullName).other" + } + } -PassThru -Force + return @($spServiceApp) + } } - } - It "Should return absent from the get method" { - (Get-TargetResource @testParams).Ensure | Should -Be "Absent" - } - It "Should return true when the Test method is called" { - Test-TargetResource @testParams | Should -Be $false - } - It "Should call Methods on Set-TargetResource" { - Set-TargetResource @testParams - Assert-MockCalled Get-SPServiceApplication - Assert-MockCalled New-SPAccessServiceApplication -Times 1 - Assert-MockCalled Remove-SPServiceApplication -Times 0 - } - } - Context -Name "When Access 2010 Services exists and should exist" -Fixture { - BeforeAll { - $testParams = @{ - Name = "Access 2010 Services Service Application" - ApplicationPool = "SharePoint Service Applications" - Ensure = "Present" + It "Should return absent from the get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Absent" + } + It "Should return true when the Test method is called" { + Test-TargetResource @testParams | Should -Be $false } + It "Should call Methods on Set-TargetResource" { + Set-TargetResource @testParams + Assert-MockCalled Get-SPServiceApplication + Assert-MockCalled New-SPAccessServiceApplication -Times 1 + Assert-MockCalled Remove-SPServiceApplication -Times 0 + } + } + Context -Name "When Access 2010 Services exists and should exist" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Access 2010 Services Service Application" + ApplicationPool = "SharePoint Service Applications" + Ensure = "Present" + } - Mock -CommandName Remove-SPServiceApplication -MockWith { } - Mock -CommandName New-SPAccessServiceApplication -MockWith { } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - Name = $testParams.Name - ApplicationPool = [PSCustomObject]@{ - Name = $testParams.ApplicationPool + Mock -CommandName Remove-SPServiceApplication -MockWith { } + Mock -CommandName New-SPAccessServiceApplication -MockWith { } + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + DisplayName = $testParams.Name + Name = $testParams.Name + ApplicationPool = [PSCustomObject]@{ + Name = $testParams.ApplicationPool + } } + $spServiceApp | Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + return @{ + FullName = "$($getTypeFullName)" + } + } -PassThru -Force + return @($spServiceApp) } - $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "$($getTypeFullName)" - } - } -PassThru -Force - return @($spServiceApp) } - } - It "Should return present from the get method" { - (Get-TargetResource @testParams).Ensure | Should -Be "Present" - } - It "Should return true when the Test method is called" { - Test-TargetResource @testParams | Should -Be $true - } - It "Should call Remove - Get - New on Set-TargetResource" { - Set-TargetResource @testParams - Assert-MockCalled Get-SPServiceApplication + It "Should return present from the get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Present" + } + It "Should return true when the Test method is called" { + Test-TargetResource @testParams | Should -Be $true + } + It "Should call Remove - Get - New on Set-TargetResource" { + Set-TargetResource @testParams + Assert-MockCalled Get-SPServiceApplication + } } - } - Context -Name "When Access 2010 Services exists and shouldn't exist" -Fixture { - BeforeAll { - $testParams = @{ - Name = "Access 2010 Services Service Application" - ApplicationPool = "SharePoint Service Applications" - Ensure = "Absent" - } + Context -Name "When Access 2010 Services exists and shouldn't exist" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Access 2010 Services Service Application" + ApplicationPool = "SharePoint Service Applications" + Ensure = "Absent" + } - Mock -CommandName Remove-SPServiceApplication -MockWith { } - Mock -CommandName New-SPAccessServiceApplication -MockWith { } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - Name = $testParams.Name - ApplicationPool = [PSCustomObject]@{ - Name = $testParams.ApplicationPool + Mock -CommandName Remove-SPServiceApplication -MockWith { } + Mock -CommandName New-SPAccessServiceApplication -MockWith { } + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + DisplayName = $testParams.Name + Name = $testParams.Name + ApplicationPool = [PSCustomObject]@{ + Name = $testParams.ApplicationPool + } } + $spServiceApp | Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + return @{ + FullName = "$($getTypeFullName)" + } + } -PassThru -Force + return @($spServiceApp) } - $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "$($getTypeFullName)" - } - } -PassThru -Force - return @($spServiceApp) } - } - It "Should return present from the get method" { - (Get-TargetResource @testParams).Ensure | Should -Be "Present" - } - It "Should return false when the Test method is called" { - Test-TargetResource @testParams | Should -Be $false - } - It "Should call Remove - Get - New on Set-TargetResource" { - Set-TargetResource @testParams - Assert-MockCalled Remove-SPServiceApplication - Assert-MockCalled Get-SPServiceApplication + It "Should return present from the get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Present" + } + It "Should return false when the Test method is called" { + Test-TargetResource @testParams | Should -Be $false + } + It "Should call Remove - Get - New on Set-TargetResource" { + Set-TargetResource @testParams + Assert-MockCalled Remove-SPServiceApplication + Assert-MockCalled Get-SPServiceApplication + } } - } - Context -Name "When Access 2010 Services doesn't exists and should exist" -Fixture { - BeforeAll { - $testParams = @{ - Name = "Access 2010 Services Service Application" - ApplicationPool = "SharePoint Service Applications" - Ensure = "Present" + Context -Name "When Access 2010 Services doesn't exists and should exist" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Access 2010 Services Service Application" + ApplicationPool = "SharePoint Service Applications" + Ensure = "Present" + } + + Mock -CommandName Remove-SPServiceApplication -MockWith { } + Mock -CommandName New-SPAccessServiceApplication -MockWith { } + Mock -CommandName Get-SPServiceApplication -MockWith { + return $null + } } - Mock -CommandName Remove-SPServiceApplication -MockWith { } - Mock -CommandName New-SPAccessServiceApplication -MockWith { } - Mock -CommandName Get-SPServiceApplication -MockWith { - return $null + It "Should return absent from the get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Absent" + } + It "Should return false when the Test method is called" { + Test-TargetResource @testParams | Should -Be $false + } + It "Should call New on Set-TargetResource" { + Set-TargetResource @testParams + Assert-MockCalled New-SPAccessServiceApplication } } - It "Should return absent from the get method" { - (Get-TargetResource @testParams).Ensure | Should -Be "Absent" - } - It "Should return false when the Test method is called" { - Test-TargetResource @testParams | Should -Be $false - } - It "Should call New on Set-TargetResource" { - Set-TargetResource @testParams - Assert-MockCalled New-SPAccessServiceApplication + Context -Name "When Access 2010 Services doesn't exists and shouldn't exist" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Access 2010 Services Service Application" + ApplicationPool = "SharePoint Service Applications" + Ensure = "Absent" + } + + Mock -CommandName Remove-SPServiceApplication -MockWith { } + Mock -CommandName New-SPAccessServiceApplication -MockWith { } + Mock -CommandName Get-SPServiceApplication -MockWith { + return $null + } + } + + It "Should return absent from the get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Absent" + } + It "Should return true when the Test method is called" { + Test-TargetResource @testParams | Should -Be $true + } + It "Should call New on Set-TargetResource" { + Set-TargetResource @testParams + Assert-MockCalled Get-SPServiceApplication + } } } - Context -Name "When Access 2010 Services doesn't exists and shouldn't exist" -Fixture { - BeforeAll { - $testParams = @{ - Name = "Access 2010 Services Service Application" - ApplicationPool = "SharePoint Service Applications" - Ensure = "Absent" + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + Context -Name "All methods throw exceptions as Access Services 2010 no longer exists in SharePoint Server Subscription Edition" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Access 2010 Services Service Application" + ApplicationPool = "SharePoint Service Applications" + Ensure = "Present" + } + } + + It "Should throw on the get method" { + { Get-TargetResource @testParams } | Should -Throw "Since SharePoint Server Subscription Edition the Access Services 2010 does no longer exists." } - Mock -CommandName Remove-SPServiceApplication -MockWith { } - Mock -CommandName New-SPAccessServiceApplication -MockWith { } - Mock -CommandName Get-SPServiceApplication -MockWith { - return $null + It "Should throw on the test method" { + { Test-TargetResource @testParams } | Should -Throw "Since SharePoint Server Subscription Edition the Access Services 2010 does no longer exists." } - } - It "Should return absent from the get method" { - (Get-TargetResource @testParams).Ensure | Should -Be "Absent" - } - It "Should return true when the Test method is called" { - Test-TargetResource @testParams | Should -Be $true - } - It "Should call New on Set-TargetResource" { - Set-TargetResource @testParams - Assert-MockCalled Get-SPServiceApplication + It "Should throw on the set method" { + { Set-TargetResource @testParams } | Should -Throw "Since SharePoint Server Subscription Edition the Access Services 2010 does no longer exists." + } } } } diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPAppCatalog.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPAppCatalog.Tests.ps1 index 7aa0d286c..282c7bc2a 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.SPAppCatalog.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPAppCatalog.Tests.ps1 @@ -50,7 +50,7 @@ try InModuleScope -ModuleName $script:DSCResourceFullName -ScriptBlock { Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { BeforeAll { - Invoke-Command -Scriptblock $Global:SPDscHelper.InitializeScript -NoNewScope + Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope $mockSiteId = [Guid]::NewGuid() @@ -262,8 +262,8 @@ try It "Should throw an exception in the set method" { { Set-TargetResource @testParams } | Should -Throw ` ("This resource must be run as the farm account (not a setup account). " + ` - "Please ensure either the PsDscRunAsCredential or InstallAccount " + ` - "credentials are set to the farm account and run this resource again") + "Please ensure the PsDscRunAsCredential credentials are set " + ` + "to the farm account and run this resource again") } } diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPCertificate.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPCertificate.Tests.ps1 new file mode 100644 index 000000000..83a0247f3 --- /dev/null +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPCertificate.Tests.ps1 @@ -0,0 +1,1019 @@ +[CmdletBinding()] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")] +param +( + [Parameter()] + [string] + $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) +) + +$script:DSCModuleName = 'SharePointDsc' +$script:DSCResourceName = 'SPCertificate' +$script:DSCResourceFullName = 'MSFT_' + $script:DSCResourceName + +function Invoke-TestSetup +{ + try + { + Import-Module -Name DscResource.Test -Force + + Import-Module -Name (Join-Path -Path $PSScriptRoot ` + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) + + $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` + -DscResource $script:DSCResourceName + } + catch [System.IO.FileNotFoundException] + { + throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -Tasks build" first.' + } + + $script:testEnvironment = Initialize-TestEnvironment ` + -DSCModuleName $script:DSCModuleName ` + -DSCResourceName $script:DSCResourceFullName ` + -ResourceType 'Mof' ` + -TestType 'Unit' +} + +function Invoke-TestCleanup +{ + Restore-TestEnvironment -TestEnvironment $script:testEnvironment +} + +Invoke-TestSetup + +try +{ + InModuleScope -ModuleName $script:DSCResourceFullName -ScriptBlock { + Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { + BeforeAll { + Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope + + Mock -CommandName Test-Path -MockWith { + return $true + } + + $mockPassword = ConvertTo-SecureString -String 'password' -AsPlainText -Force + $mockCertPassword = New-Object -TypeName "System.Management.Automation.PSCredential" ` + -ArgumentList @('CertPassword', $mockPassword) + function Add-SPDscEvent + { + param ( + [Parameter(Mandatory = $true)] + [System.String] + $Message, + + [Parameter(Mandatory = $true)] + [System.String] + $Source, + + [Parameter()] + [ValidateSet('Error', 'Information', 'FailureAudit', 'SuccessAudit', 'Warning')] + [System.String] + $EntryType, + + [Parameter()] + [System.UInt32] + $EventID + ) + } + } + + # Test contexts + switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) + { + 15 + { + Context -Name "All methods throw exceptions as Certificate Management doesn't exist in 2019 and earlier" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.pfx' + } + } + + It "Should throw on the get method" { + { Get-TargetResource @testParams } | Should -Throw "Certificate Management is not available in SharePoint 2019 or earlier" + } + + It "Should throw on the test method" { + { Test-TargetResource @testParams } | Should -Throw "Certificate Management is not available in SharePoint 2019 or earlier" + } + + It "Should throw on the set method" { + { Set-TargetResource @testParams } | Should -Throw "Certificate Management is not available in SharePoint 2019 or earlier" + } + } + } + 16 + { + if ($Global:SPDscHelper.CurrentStubBuildNumber.Build -lt 13000) + { + Context -Name "All methods throw exceptions as Certificate Management doesn't exist in 2019 and earlier" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.pfx' + } + } + + It "Should throw on the get method" { + { Get-TargetResource @testParams } | Should -Throw "Certificate Management is not available in SharePoint 2019 or earlier" + } + + It "Should throw on the test method" { + { Test-TargetResource @testParams } | Should -Throw "Certificate Management is not available in SharePoint 2019 or earlier" + } + + It "Should throw on the set method" { + { Set-TargetResource @testParams } | Should -Throw "Certificate Management is not available in SharePoint 2019 or earlier" + } + } + } + else + { + Context -Name "CertificateFilePath does not exist" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.pfx' + } + + Mock -CommandName Test-Path -MockWith { + return $false + } + } + + It "Should throw an exception in the get method" { + { Get-TargetResource @testParams } | Should -Throw "CertificateFilePath '$($testParams.CertificateFilePath)' not found" + } + + It "Should throw an exception in the set method" { + { Set-TargetResource @testParams } | Should -Throw "CertificateFilePath '$($testParams.CertificateFilePath)' not found" + } + } + + Context -Name "CertificateFilePath is not a PFX or CER" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.abc' + } + + Mock -CommandName Get-ChildItem -MockWith { + return @{ + Extension = ".abc" + } + } + } + + It "Should throw an exception in the get method" { + { Get-TargetResource @testParams } | Should -Throw "Unsupported file extension. Please specify a PFX or CER file" + } + + It "Should throw an exception in the set method" { + { Set-TargetResource @testParams } | Should -Throw "Unsupported file extension. Please specify a PFX or CER file" + } + } + + Context -Name "The server is not part of SharePoint farm" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.pfx' + CertificatePassword = $mockCertPassword + Ensure = 'Present' + } + + Mock -CommandName Get-ChildItem -MockWith { + return @{ + Extension = ".pfx" + } + } + + Mock -CommandName Get-SPFarm -MockWith { + throw + } + } + + It "Should return Ensure=Absent from the get method" { + $result = Get-TargetResource @testParams + $result.Ensure | Should -Be 'Absent' + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should throw an exception in the set method to say there is no local farm" { + { Set-TargetResource @testParams } | Should -Throw "No local SharePoint farm was detected" + } + } + + Context -Name "PFX cert is specified, Ensure=Absent and certificate does not exist in SharePoint" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.pfx' + CertificatePassword = $mockCertPassword + Store = 'EndEntity' + Ensure = 'Absent' + } + + Mock -CommandName Get-ChildItem -MockWith { + return @{ + Extension = ".pfx" + } + } + + Mock -CommandName Get-SPFarm -MockWith { + return "" + } + + Mock -CommandName New-Object -MockWith { + return @( + @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + ) + } -ParameterFilter { $TypeName -eq "System.Security.Cryptography.X509Certificates.X509Certificate2" } + + Mock -CommandName Get-SPCertificate -MockWith { + } + } + + It "Should return Ensure=Absent from the get method" { + $result = Get-TargetResource @testParams + $result.Ensure | Should -Be 'Absent' + } + + It "Should return true from the test method" { + Test-TargetResource @testParams | Should -Be $true + } + } + + Context -Name "CER cert is specified, Ensure=Absent and certificate does not exist in SharePoint" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.cer' + Store = 'Root' + Ensure = 'Absent' + } + + Mock -CommandName Get-ChildItem -MockWith { + return @{ + Extension = ".cer" + } + } + + Mock -CommandName Get-SPFarm -MockWith { + return "" + } + + Mock -CommandName New-Object -MockWith { + return @( + @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + ) + } -ParameterFilter { $TypeName -eq "System.Security.Cryptography.X509Certificates.X509Certificate2" } + + Mock -CommandName Get-SPCertificate -MockWith { + } + } + + It "Should return Ensure=Absent from the get method" { + $result = Get-TargetResource @testParams + $result.Ensure | Should -Be 'Absent' + } + + It "Should return true from the test method" { + Test-TargetResource @testParams | Should -Be $true + } + } + + Context -Name "PFX cert is specified, Ensure=Present and certificate does not exist in SharePoint" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.pfx' + CertificatePassword = $mockCertPassword + Store = 'EndEntity' + Ensure = 'Present' + } + + Mock -CommandName Get-ChildItem -MockWith { + return @{ + Extension = ".pfx" + } + } + + Mock -CommandName Get-SPFarm -MockWith { + return "" + } + + Mock -CommandName New-Object -MockWith { + return @( + @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + ) + } -ParameterFilter { $TypeName -eq "System.Security.Cryptography.X509Certificates.X509Certificate2" } + + Mock -CommandName Get-SPCertificate -MockWith { } + + Mock -CommandName Import-SPCertificate -MockWith { } + } + + It "Should return Ensure=Absent from the get method" { + $result = Get-TargetResource @testParams + $result.Ensure | Should -Be 'Absent' + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should import certificate from the set method" { + Set-TargetResource @testParams + Assert-MockCalled Import-SPCertificate + } + } + + Context -Name "CER cert is specified, Ensure=Present and certificate does not exist in SharePoint" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.cer' + CertificatePassword = $mockCertPassword + Store = 'Root' + Ensure = 'Present' + } + + Mock -CommandName Get-ChildItem -MockWith { + return @{ + Extension = ".cer" + } + } + + Mock -CommandName Get-SPFarm -MockWith { + return "" + } + + Mock -CommandName New-Object -MockWith { + return @( + @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + ) + } -ParameterFilter { $TypeName -eq "System.Security.Cryptography.X509Certificates.X509Certificate2" } + + Mock -CommandName Get-SPCertificate -MockWith { } + + Mock -CommandName Import-SPCertificate -MockWith { } + } + + It "Should return Ensure=Absent from the get method" { + $result = Get-TargetResource @testParams + $result.Ensure | Should -Be 'Absent' + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should import certificate from the set method" { + Set-TargetResource @testParams + Assert-MockCalled Import-SPCertificate + } + } + + Context -Name "PFX cert is specified, Ensure=Present and CER certificate does exist in SharePoint" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.pfx' + CertificatePassword = $mockCertPassword + Store = 'EndEntity' + Exportable = $true + Ensure = 'Present' + } + + Mock -CommandName Get-ChildItem -MockWith { + return @{ + Extension = ".pfx" + } + } + + Mock -CommandName Get-SPFarm -MockWith { + return "" + } + + Mock -CommandName New-Object -MockWith { + return @( + @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + ) + } -ParameterFilter { $TypeName -eq "System.Security.Cryptography.X509Certificates.X509Certificate2" } + + Mock -CommandName Get-SPCertificate -MockWith { + return @{ + HasPrivateKey = $false + StoreType = 'Root' + } + } + + Mock -CommandName Import-SPCertificate -MockWith { } + } + + It "Should return Ensure=Absent from the get method" { + $result = Get-TargetResource @testParams + $result.Ensure | Should -Be 'Absent' + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should import certificate from the set method" { + Set-TargetResource @testParams + Assert-MockCalled Import-SPCertificate + } + } + + Context -Name "CER cert is specified, Ensure=Present and PFX certificate does exist in SharePoint" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.cer' + CertificatePassword = $mockCertPassword + Store = 'Root' + Ensure = 'Present' + } + + Mock -CommandName Get-ChildItem -MockWith { + return @{ + Extension = ".cer" + } + } + + Mock -CommandName Get-SPFarm -MockWith { + return "" + } + + Mock -CommandName New-Object -MockWith { + return @( + @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + ) + } -ParameterFilter { $TypeName -eq "System.Security.Cryptography.X509Certificates.X509Certificate2" } + + Mock -CommandName Get-SPCertificate -MockWith { + return @{ + HasPrivateKey = $true + StoreType = 'EndEntity' + } + } + + Mock -CommandName Import-SPCertificate -MockWith { } + } + + It "Should return Ensure=Absent from the get method" { + $result = Get-TargetResource @testParams + $result.Ensure | Should -Be 'Present' + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should import certificate from the set method" { + Set-TargetResource @testParams + Assert-MockCalled Import-SPCertificate + } + } + + Context -Name "PFX cert is specified, Ensure=Present and PFX certificate does exist in SharePoint in wrong store" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.pfx' + CertificatePassword = $mockCertPassword + Store = 'EndEntity' + Ensure = 'Present' + } + + Mock -CommandName Get-ChildItem -MockWith { + return @{ + Extension = ".pfx" + } + } + + Mock -CommandName Get-SPFarm -MockWith { + return "" + } + + Mock -CommandName New-Object -MockWith { + return @( + @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + ) + } -ParameterFilter { $TypeName -eq "System.Security.Cryptography.X509Certificates.X509Certificate2" } + + Mock -CommandName Get-SPCertificate -MockWith { + return @{ + HasPrivateKey = $true + StoreType = 'Root' + } + } + + Mock -CommandName Move-SPCertificate -MockWith { } + } + + It "Should return Ensure=Absent from the get method" { + $result = Get-TargetResource @testParams + $result.Ensure | Should -Be 'Present' + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should import certificate from the set method" { + Set-TargetResource @testParams + Assert-MockCalled Move-SPCertificate + } + } + + Context -Name "CER cert is specified, Ensure=Present and CER certificate does exist in SharePoint in wrong store" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.cer' + Store = 'Root' + Ensure = 'Present' + } + + Mock -CommandName Get-ChildItem -MockWith { + return @{ + Extension = ".cer" + } + } + + Mock -CommandName Get-SPFarm -MockWith { + return "" + } + + Mock -CommandName New-Object -MockWith { + return @( + @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + ) + } -ParameterFilter { $TypeName -eq "System.Security.Cryptography.X509Certificates.X509Certificate2" } + + Mock -CommandName Get-SPCertificate -MockWith { + return @{ + HasPrivateKey = $false + StoreType = 'EndEntity' + } + } + + Mock -CommandName Move-SPCertificate -MockWith { } + } + + It "Should return Ensure=Absent from the get method" { + $result = Get-TargetResource @testParams + $result.Ensure | Should -Be 'Present' + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should move certificate from the set method" { + Set-TargetResource @testParams + Assert-MockCalled Move-SPCertificate + } + } + + Context -Name "PFX cert is specified, Ensure=Present and multiple certificates exist in SharePoint" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.pfx' + CertificatePassword = $mockCertPassword + Store = 'EndEntity' + Ensure = 'Present' + } + + Mock -CommandName Get-ChildItem -MockWith { + return @{ + Extension = ".pfx" + } + } + + Mock -CommandName Get-SPFarm -MockWith { + return "" + } + + Mock -CommandName New-Object -MockWith { + return @( + @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + ) + } -ParameterFilter { $TypeName -eq "System.Security.Cryptography.X509Certificates.X509Certificate2" } + + Mock -CommandName Get-SPCertificate -MockWith { + return @( + @{ + HasPrivateKey = $false + StoreType = 'Root' + } + @{ + HasPrivateKey = $true + StoreType = 'Intermediate' + } + ) + } + + Mock -CommandName Import-SPCertificate -MockWith { } + } + + It "Should return Ensure=Absent from the get method" { + $result = Get-TargetResource @testParams + $result.Ensure | Should -Be 'Absent' + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should import certificate from the set method" { + Set-TargetResource @testParams + Assert-MockCalled Import-SPCertificate + } + } + + Context -Name "CER cert is specified, Ensure=Present and multiple certificates exist in SharePoint" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.cer' + Store = 'Root' + Ensure = 'Present' + } + + Mock -CommandName Get-ChildItem -MockWith { + return @{ + Extension = ".cer" + } + } + + Mock -CommandName Get-SPFarm -MockWith { + return "" + } + + Mock -CommandName New-Object -MockWith { + return @( + @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + ) + } -ParameterFilter { $TypeName -eq "System.Security.Cryptography.X509Certificates.X509Certificate2" } + + Mock -CommandName Get-SPCertificate -MockWith { + return @( + @{ + HasPrivateKey = $false + StoreType = 'Root' + } + @{ + HasPrivateKey = $true + StoreType = 'Intermediate' + } + ) + } + + Mock -CommandName Import-SPCertificate -MockWith { } + } + + It "Should return Ensure=Absent from the get method" { + $result = Get-TargetResource @testParams + $result.Ensure | Should -Be 'Present' + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $true + } + } + + Context -Name "CER cert is specified, Ensure=Present and PFX certificate does exist in SharePoint" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.cer' + Store = 'Root' + Ensure = 'Present' + } + + Mock -CommandName Get-ChildItem -MockWith { + return @{ + Extension = ".cer" + } + } + + Mock -CommandName Get-SPFarm -MockWith { + return "" + } + + Mock -CommandName New-Object -MockWith { + return @( + @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + ) + } -ParameterFilter { $TypeName -eq "System.Security.Cryptography.X509Certificates.X509Certificate2" } + + Mock -CommandName Get-SPCertificate -MockWith { + return @( + @{ + HasPrivateKey = $false + StoreType = 'Intermediate' + } + @{ + HasPrivateKey = $true + StoreType = 'EndEntity' + } + ) + } + + Mock -CommandName Import-SPCertificate -MockWith { } + } + + It "Should return Ensure=Absent from the get method" { + $result = Get-TargetResource @testParams + $result.Ensure | Should -Be 'Absent' + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should import certificate from the set method" { + Set-TargetResource @testParams + Assert-MockCalled Import-SPCertificate + } + } + + Context -Name "PFX cert is specified, Ensure=Present and multiple certificates exist, but cert does not have private key" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.pfx' + CertificatePassword = $mockCertPassword + Store = 'EndEntity' + Ensure = 'Present' + } + + Mock -CommandName Get-ChildItem -MockWith { + return @{ + Extension = ".pfx" + } + } + + Mock -CommandName Get-SPFarm -MockWith { + return "" + } + + Mock -CommandName New-Object -MockWith { + return @( + @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + ) + } -ParameterFilter { $TypeName -eq "System.Security.Cryptography.X509Certificates.X509Certificate2" } + + Mock -CommandName Get-SPCertificate -MockWith { + return @( + @{ + HasPrivateKey = $false + StoreType = 'EndEntity' + } + @{ + HasPrivateKey = $false + StoreType = 'Root' + } + ) + } + + Mock -CommandName Import-SPCertificate -MockWith { } + } + + It "Should return Ensure=Absent from the get method" { + $result = Get-TargetResource @testParams + $result.Ensure | Should -Be 'Absent' + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should import certificate from the set method" { + Set-TargetResource @testParams + Assert-MockCalled Import-SPCertificate + } + } + Context -Name "PFX cert is specified, Ensure=Absent, but certificate does exist in SharePoint" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.pfx' + CertificatePassword = $mockCertPassword + Store = 'EndEntity' + Ensure = 'Absent' + } + + Mock -CommandName Get-ChildItem -MockWith { + return @{ + Extension = ".pfx" + } + } + + Mock -CommandName Get-SPFarm -MockWith { + return "" + } + + Mock -CommandName New-Object -MockWith { + return @( + @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + ) + } -ParameterFilter { $TypeName -eq "System.Security.Cryptography.X509Certificates.X509Certificate2" } + + Mock -CommandName Get-SPCertificate -MockWith { + return @( + @{ + HasPrivateKey = $true + StoreType = 'EndEntity' + } + ) + } + + Mock -CommandName Remove-SPCertificate -MockWith { } + } + + It "Should return Ensure=Absent from the get method" { + $result = Get-TargetResource @testParams + $result.Ensure | Should -Be 'Present' + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should remove the certificate from the set method" { + Set-TargetResource @testParams + Assert-MockCalled Remove-SPCertificate + } + } + + Context -Name "CER cert is specified, Ensure=Absent, but certificate does exist in SharePoint" -Fixture { + BeforeAll { + $testParams = @{ + CertificateFilePath = 'C:\Certificate\Intranet.cer' + CertificatePassword = $mockCertPassword + Store = 'Root' + Ensure = 'Absent' + } + + Mock -CommandName Get-ChildItem -MockWith { + return @{ + Extension = ".cer" + } + } + + Mock -CommandName Get-SPFarm -MockWith { + return "" + } + + Mock -CommandName New-Object -MockWith { + return @( + @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + ) + } -ParameterFilter { $TypeName -eq "System.Security.Cryptography.X509Certificates.X509Certificate2" } + + Mock -CommandName Get-SPCertificate -MockWith { + return @( + @{ + HasPrivateKey = $false + StoreType = 'Root' + } + ) + } + + Mock -CommandName Remove-SPCertificate -MockWith { } + } + + It "Should return Ensure=Absent from the get method" { + $result = Get-TargetResource @testParams + $result.Ensure | Should -Be 'Present' + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should remove the certificate from the set method" { + Set-TargetResource @testParams + Assert-MockCalled Remove-SPCertificate + } + } + + Context -Name "Running ReverseDsc Export" -Fixture { + BeforeAll { + Import-Module (Join-Path -Path (Split-Path -Path (Get-Module SharePointDsc -ListAvailable).Path -Parent) -ChildPath "Modules\SharePointDSC.Reverse\SharePointDSC.Reverse.psm1") + + Mock -CommandName Write-Host -MockWith { } + + Mock -CommandName Get-SPCertificate -MockWith { + return @( + @{ + Subject = "intranet.contoso.com" + HasPrivateKey = $true + Exportable = $true + StoreType = "EndEntity" + }, + @{ + Subject = "root.contoso.com" + HasPrivateKey = $false + Exportable = $false + StoreType = "Root" + } + ) + } + + Mock -CommandName Export-SPCertificate -MockWith { } + + Mock -CommandName Get-TargetResource -MockWith { + if ($global:SPDscCertCounter -eq 1) + { + $global:SPDscCertCounter++ + return @{ + CertificateFilePath = 'C:\Certificates\Intranet.pfx' + CertificatePassword = $mockCertPassword + Store = 'EndEntity' + Exportable = $false + Ensure = "Present" + } + } + else + { + $global:SPDscCertCounter++ + return @{ + CertificateFilePath = 'C:\Certificates\Intranet.cer' + CertificatePassword = $mockCertPassword + Store = 'Root' + Exportable = $false + Ensure = "Present" + } + } + } + + if ($null -eq (Get-Variable -Name 'spFarmAccount' -ErrorAction SilentlyContinue)) + { + $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force + $Global:spFarmAccount = New-Object -TypeName System.Management.Automation.PSCredential ("contoso\spfarm", $mockPassword) + } + + $result = @' + SPCertificate [0-9A-Fa-f]{8}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{12} + { + CertificateFilePath = "C:\\Certificates\\Intranet.pfx"; + CertificatePassword = \$Credsspfarm; + Ensure = "Present"; + Exportable = \$False; + PsDscRunAsCredential = \$Credsspfarm; + Store = "EndEntity"; + } + SPCertificate [0-9A-Fa-f]{8}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{4}[-][0-9A-Fa-f]{12} + { + CertificateFilePath = "C:\\Certificates\\Intranet.cer"; + CertificatePassword = \$Credsspfarm; + Ensure = "Present"; + Exportable = \$False; + PsDscRunAsCredential = \$Credsspfarm; + Store = "Root"; + } + +'@ + } + + It "Should return valid DSC block from the Export method" { + $global:SPDscCertCounter = 1 + Export-TargetResource | Should -Match $result + } + } + } + } + } + } + } +} +finally +{ + Invoke-TestCleanup +} diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPCertificateSettings.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPCertificateSettings.Tests.ps1 new file mode 100644 index 000000000..d633bc560 --- /dev/null +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPCertificateSettings.Tests.ps1 @@ -0,0 +1,418 @@ +[CmdletBinding()] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")] +param +( + [Parameter()] + [string] + $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) +) + +$script:DSCModuleName = 'SharePointDsc' +$script:DSCResourceName = 'SPCertificateSettings' +$script:DSCResourceFullName = 'MSFT_' + $script:DSCResourceName + +function Invoke-TestSetup +{ + try + { + Import-Module -Name DscResource.Test -Force + + Import-Module -Name (Join-Path -Path $PSScriptRoot ` + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) + + $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` + -DscResource $script:DSCResourceName + } + catch [System.IO.FileNotFoundException] + { + throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -Tasks build" first.' + } + + $script:testEnvironment = Initialize-TestEnvironment ` + -DSCModuleName $script:DSCModuleName ` + -DSCResourceName $script:DSCResourceFullName ` + -ResourceType 'Mof' ` + -TestType 'Unit' +} + +function Invoke-TestCleanup +{ + Restore-TestEnvironment -TestEnvironment $script:testEnvironment +} + +Invoke-TestSetup + +try +{ + InModuleScope -ModuleName $script:DSCResourceFullName -ScriptBlock { + Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { + BeforeAll { + Invoke-Command -Scriptblock $Global:SPDscHelper.InitializeScript -NoNewScope + + function Add-SPDscEvent + { + param ( + [Parameter(Mandatory = $true)] + [System.String] + $Message, + + [Parameter(Mandatory = $true)] + [System.String] + $Source, + + [Parameter()] + [ValidateSet('Error', 'Information', 'FailureAudit', 'SuccessAudit', 'Warning')] + [System.String] + $EntryType, + + [Parameter()] + [System.UInt32] + $EventID + ) + } + } + + # Test contexts + switch ($Global:SPDscHelper.CurrentStubBuildNumber.Major) + { + 15 + { + Context -Name "All methods throw exceptions as Certificate Management doesn't exist in 2019 and earlier" -Fixture { + BeforeAll { + $testParams = @{ + IsSingleInstance = 'Yes' + } + } + + It "Should throw on the get method" { + { Get-TargetResource @testParams } | Should -Throw "Certificate Management is not available in SharePoint 2019 or earlier" + } + + It "Should throw on the test method" { + { Test-TargetResource @testParams } | Should -Throw "Certificate Management is not available in SharePoint 2019 or earlier" + } + + It "Should throw on the set method" { + { Set-TargetResource @testParams } | Should -Throw "Certificate Management is not available in SharePoint 2019 or earlier" + } + } + } + 16 + { + if ($Global:SPDscHelper.CurrentStubBuildNumber.Build -lt 13000) + { + Context -Name "All methods throw exceptions as Certificate Management doesn't exist in 2019 and earlier" -Fixture { + BeforeAll { + $testParams = @{ + IsSingleInstance = 'Yes' + } + } + + It "Should throw on the get method" { + { Get-TargetResource @testParams } | Should -Throw "Certificate Management is not available in SharePoint 2019 or earlier" + } + + It "Should throw on the test method" { + { Test-TargetResource @testParams } | Should -Throw "Certificate Management is not available in SharePoint 2019 or earlier" + } + + It "Should throw on the set method" { + { Set-TargetResource @testParams } | Should -Throw "Certificate Management is not available in SharePoint 2019 or earlier" + } + } + } + else + { + Context -Name "CertificateExpirationAttentionThreshold is lower than CertificateExpirationWarningThreshold" -Fixture { + BeforeAll { + $testParams = @{ + IsSingleInstance = 'Yes' + CertificateExpirationAttentionThreshold = 10 + CertificateExpirationWarningThreshold = 15 + } + } + + It "Should throw an exception in the set method" { + { Set-TargetResource @testParams } | Should -Throw "CertificateExpirationAttentionThreshold should be larger than CertificateExpirationWarningThreshold" + } + } + + Context -Name "The server is not part of SharePoint farm" -Fixture { + BeforeAll { + $testParams = @{ + IsSingleInstance = 'Yes' + OrganizationalUnit = 'IT' + Organization = 'Contoso' + Locality = 'Seattle' + State = 'Washington' + Country = 'US' + KeyAlgorithm = 'RSA' + KeySize = 2048 + EllipticCurve = 'nistP256' + HashAlgorithm = 'SHA256' + RsaSignaturePadding = 'Pkcs1' + CertificateExpirationAttentionThreshold = 60 + CertificateExpirationWarningThreshold = 15 + CertificateExpirationErrorThreshold = 15 + } + + Mock -CommandName Get-SPFarm -MockWith { + throw "Unable to detect local farm" + } + + Mock -CommandName Set-SPCertificateSettings -MockWith {} + } + + It "Should return null from the get method" { + $result = Get-TargetResource @testParams + $result.Count | Should -Be 1 + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should throw an exception in the set method to say there is no local farm" { + { Set-TargetResource @testParams } | Should -Throw "No local SharePoint farm was detected" + } + } + + Context -Name "The server is in a farm and the incorrect settings have been applied" -Fixture { + BeforeAll { + $testParams = @{ + IsSingleInstance = 'Yes' + OrganizationalUnit = 'IT' + Organization = 'Contoso' + Locality = 'Seattle' + State = 'Washington' + Country = 'US' + KeyAlgorithm = 'RSA' + KeySize = 2048 + EllipticCurve = 'nistP256' + HashAlgorithm = 'SHA256' + RsaSignaturePadding = 'Pkcs1' + CertificateExpirationAttentionThreshold = 60 + CertificateExpirationWarningThreshold = 15 + CertificateExpirationErrorThreshold = 15 + } + + Mock -CommandName Get-SPCertificateSettings -MockWith { + $returnVal = @{ + DefaultOrganizationalUnit = '' + DefaultOrganization = '' + DefaultLocality = '' + DefaultState = '' + DefaultCountry = '' + DefaultKeyAlgorithm = 'RSA' + DefaultRsaKeySize = 2048 + DefaultEllipticCurve = 'nistP256' + DefaultHashAlgorithm = 'SHA256' + DefaultRsaSignaturePadding = 'Pkcs1' + CertificateExpirationAttentionThresholdDays = 60 + CertificateExpirationWarningThresholdDays = 15 + CertificateExpirationErrorThresholdDays = 15 + } + return $returnVal + } + Mock -CommandName Get-SPFarm -MockWith { return @{ } } + Mock -CommandName Set-SPCertificateSettings -MockWith {} + } + + It "Should return values from the get method" { + $result = Get-TargetResource @testParams + $result.KeySize | Should -Be 2048 + $result.OrganizationalUnit | Should -BeNullOrEmpty + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should update the certificate settings" { + Set-TargetResource @testParams + Assert-MockCalled Set-SPCertificateSettings + } + } + + Context -Name "The server is in a farm and the incorrect contacts have been applied" -Fixture { + BeforeAll { + $testParams = @{ + IsSingleInstance = 'Yes' + CertificateNotificationContacts = 'admin@contoso.com' + } + + Mock -CommandName Get-SPCertificateSettings -MockWith { + $returnVal = @{ + DefaultOrganizationalUnit = '' + DefaultOrganization = '' + DefaultLocality = '' + DefaultState = '' + DefaultCountry = '' + DefaultKeyAlgorithm = 'RSA' + DefaultRsaKeySize = 2048 + DefaultEllipticCurve = 'nistP256' + DefaultHashAlgorithm = 'SHA256' + DefaultRsaSignaturePadding = 'Pkcs1' + CertificateExpirationAttentionThresholdDays = 60 + CertificateExpirationWarningThresholdDays = 15 + CertificateExpirationErrorThresholdDays = 15 + CertificateNotificationContacts = @( + @{ + Address = 'wrong@contoso.com' + } + ) + } + return $returnVal + } + Mock -CommandName Get-SPFarm -MockWith { return @{ } } + Mock -CommandName Get-SPCertificateNotificationContact -MockWith { + return @( + @{ + Address = 'wrong@contoso.com' + } + ) + } + Mock -CommandName Add-SPCertificateNotificationContact -MockWith {} + Mock -CommandName Remove-SPCertificateNotificationContact -MockWith {} + } + + It "Should return values from the get method" { + $result = Get-TargetResource @testParams + $result.CertificateNotificationContacts.Count | Should -Be 1 + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should update the certificate settings" { + Set-TargetResource @testParams + Assert-MockCalled Add-SPCertificateNotificationContact + Assert-MockCalled Remove-SPCertificateNotificationContact + } + } + + Context -Name "The server is in a farm and the correct settings have been applied" -Fixture { + BeforeAll { + $testParams = @{ + IsSingleInstance = 'Yes' + OrganizationalUnit = 'IT' + Organization = 'Contoso' + Locality = 'Seattle' + State = 'Washington' + Country = 'US' + KeyAlgorithm = 'RSA' + KeySize = 2048 + EllipticCurve = 'nistP256' + HashAlgorithm = 'SHA256' + RsaSignaturePadding = 'Pkcs1' + CertificateExpirationAttentionThreshold = 60 + CertificateExpirationWarningThreshold = 15 + CertificateExpirationErrorThreshold = 15 + } + + Mock -CommandName Get-SPCertificateSettings -MockWith { + $returnVal = @{ + DefaultOrganizationalUnit = 'IT' + DefaultOrganization = 'Contoso' + DefaultLocality = 'Seattle' + DefaultState = 'Washington' + DefaultCountry = 'US' + DefaultKeyAlgorithm = 'RSA' + DefaultRsaKeySize = 2048 + DefaultEllipticCurve = 'nistP256' + DefaultHashAlgorithm = 'SHA256' + DefaultRsaSignaturePadding = 'Pkcs1' + CertificateExpirationAttentionThresholdDays = 60 + CertificateExpirationWarningThresholdDays = 15 + CertificateExpirationErrorThresholdDays = 15 + } + return $returnVal + } + Mock -CommandName Get-SPFarm -MockWith { return @{ } } + } + + It "Should return values from the get method" { + $result = Get-TargetResource @testParams + $result.KeySize | Should -Be 2048 + $result.OrganizationalUnit | Should -Be 'IT' + } + + It "Should return true from the test method" { + Test-TargetResource @testParams | Should -Be $true + } + } + + Context -Name "Running ReverseDsc Export" -Fixture { + BeforeAll { + Import-Module (Join-Path -Path (Split-Path -Path (Get-Module SharePointDsc -ListAvailable).Path -Parent) -ChildPath "Modules\SharePointDSC.Reverse\SharePointDSC.Reverse.psm1") + + Mock -CommandName Write-Host -MockWith { } + + Mock -CommandName Get-TargetResource -MockWith { + return @{ + IsSingleInstance = 'Yes' + OrganizationalUnit = 'IT' + Organization = 'Contoso' + Locality = 'Seattle' + State = 'Washington' + Country = 'US' + KeyAlgorithm = 'RSA' + KeySize = 2048 + EllipticCurve = 'nistP256' + HashAlgorithm = 'SHA256' + RsaSignaturePadding = 'Pkcs1' + CertificateExpirationAttentionThreshold = 60 + CertificateExpirationWarningThreshold = 15 + CertificateExpirationErrorThreshold = 15 + CertificateNotificationContacts = 'admin@contoso.com' + } + } + + if ($null -eq (Get-Variable -Name 'spFarmAccount' -ErrorAction SilentlyContinue)) + { + $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force + $Global:spFarmAccount = New-Object -TypeName System.Management.Automation.PSCredential ("contoso\spfarm", $mockPassword) + } + + $result = @' + SPCertificateSettings CertificateSettings + { + CertificateExpirationAttentionThreshold = 60; + CertificateExpirationErrorThreshold = 15; + CertificateExpirationWarningThreshold = 15; + CertificateNotificationContacts = "admin@contoso.com"; + Country = "US"; + EllipticCurve = "nistP256"; + HashAlgorithm = "SHA256"; + IsSingleInstance = "Yes"; + KeyAlgorithm = "RSA"; + KeySize = 2048; + Locality = "Seattle"; + Organization = "Contoso"; + OrganizationalUnit = "IT"; + PsDscRunAsCredential = $Credsspfarm; + RsaSignaturePadding = "Pkcs1"; + State = "Washington"; + } + +'@ + } + + It "Should return valid DSC block from the Export method" { + Export-TargetResource | Should -Be $result + } + } + } + } + } + } + } +} +finally +{ + Invoke-TestCleanup +} diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPDatabaseAAG.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPDatabaseAAG.Tests.ps1 index 1d0861fae..e242e2c86 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.SPDatabaseAAG.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPDatabaseAAG.Tests.ps1 @@ -53,8 +53,19 @@ try Invoke-Command -Scriptblock $Global:SPDscHelper.InitializeScript -NoNewScope # Mocks for all contexts - Mock -CommandName Add-DatabaseToAvailabilityGroup -MockWith { } - Mock -CommandName Remove-DatabaseFromAvailabilityGroup -MockWith { } + # Check for SPSE, where cmdlets are renamed + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + Mock -CommandName Add-SPDatabaseToAvailabilityGroup -MockWith { } + Mock -CommandName Remove-SPDatabaseFromAvailabilityGroup -MockWith { } + } + else + { + Mock -CommandName Add-DatabaseToAvailabilityGroup -MockWith { } + Mock -CommandName Remove-DatabaseFromAvailabilityGroup -MockWith { } + } + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15) { Mock -CommandName Get-SPDscInstalledProductVersion { @@ -117,7 +128,16 @@ try It "Should call the add cmdlet in the set method" { Set-TargetResource @testParams - Assert-MockCalled Add-DatabaseToAvailabilityGroup + # Check for SPSE, where cmdlets are renamed + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + Assert-MockCalled Add-SPDatabaseToAvailabilityGroup + } + else + { + Assert-MockCalled Add-DatabaseToAvailabilityGroup + } } } @@ -153,7 +173,16 @@ try It "Should call the add cmdlet in the set method" { Set-TargetResource @testParams - Assert-MockCalled Add-DatabaseToAvailabilityGroup + # Check for SPSE, where cmdlets are renamed + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + Assert-MockCalled Add-SPDatabaseToAvailabilityGroup + } + else + { + Assert-MockCalled Add-DatabaseToAvailabilityGroup + } } } @@ -191,7 +220,16 @@ try It "Should call the add cmdlet in the set method" { Set-TargetResource @testParams - Assert-MockCalled Add-DatabaseToAvailabilityGroup + # Check for SPSE, where cmdlets are renamed + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + Assert-MockCalled Add-SPDatabaseToAvailabilityGroup + } + else + { + Assert-MockCalled Add-DatabaseToAvailabilityGroup + } } } @@ -347,7 +385,16 @@ try It "Should call the remove cmdlet in the set method" { Set-TargetResource @testParams - Assert-MockCalled Remove-DatabaseFromAvailabilityGroup + # Check for SPSE, where cmdlets are renamed + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + Assert-MockCalled Remove-SPDatabaseFromAvailabilityGroup + } + else + { + Assert-MockCalled Remove-DatabaseFromAvailabilityGroup + } } } @@ -387,7 +434,16 @@ try It "Should call the remove cmdlet in the set method" { Set-TargetResource @testParams - Assert-MockCalled Remove-DatabaseFromAvailabilityGroup + # Check for SPSE, where cmdlets are renamed + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + Assert-MockCalled Remove-SPDatabaseFromAvailabilityGroup + } + else + { + Assert-MockCalled Remove-DatabaseFromAvailabilityGroup + } } } @@ -427,7 +483,16 @@ try It "Should call the remove cmdlet in the set method" { Set-TargetResource @testParams - Assert-MockCalled Remove-DatabaseFromAvailabilityGroup + # Check for SPSE, where cmdlets are renamed + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + Assert-MockCalled Remove-SPDatabaseFromAvailabilityGroup + } + else + { + Assert-MockCalled Remove-DatabaseFromAvailabilityGroup + } } } @@ -461,8 +526,18 @@ try It "Should call the remove and add cmdlets in the set method" { Set-TargetResource @testParams - Assert-MockCalled Remove-DatabaseFromAvailabilityGroup - Assert-MockCalled Add-DatabaseToAvailabilityGroup + # Check for SPSE, where cmdlets are renamed + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + Assert-MockCalled Remove-SPDatabaseFromAvailabilityGroup + Assert-MockCalled Add-SPDatabaseToAvailabilityGroup + } + else + { + Assert-MockCalled Remove-DatabaseFromAvailabilityGroup + Assert-MockCalled Add-DatabaseToAvailabilityGroup + } } } @@ -502,8 +577,18 @@ try It "Should call the remove and add cmdlets in the set method" { Set-TargetResource @testParams - Assert-MockCalled Remove-DatabaseFromAvailabilityGroup - Assert-MockCalled Add-DatabaseToAvailabilityGroup + # Check for SPSE, where cmdlets are renamed + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + Assert-MockCalled Remove-SPDatabaseFromAvailabilityGroup + Assert-MockCalled Add-SPDatabaseToAvailabilityGroup + } + else + { + Assert-MockCalled Remove-DatabaseFromAvailabilityGroup + Assert-MockCalled Add-DatabaseToAvailabilityGroup + } } } diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPDesignerSettings.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPDesignerSettings.Tests.ps1 index 4d4913155..74afdbaeb 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.SPDesignerSettings.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPDesignerSettings.Tests.ps1 @@ -192,8 +192,6 @@ try AllowSaveDeclarativeWorkflowAsTemplate = $true } } - - Mock -CommandName Test-SPDscRunAsCredential { return $true } } It "Should return values from the get method" { @@ -209,47 +207,6 @@ try } } - Context -Name "The server is in a farm, target site collection and InstallAccount is used" -Fixture { - BeforeAll { - $testParams = @{ - WebAppUrl = "https://intranet.sharepoint.contoso.com" - SettingsScope = "SiteCollection" - AllowSharePointDesigner = $false - AllowDetachPagesFromDefinition = $false - AllowCustomiseMasterPage = $false - AllowManageSiteURLStructure = $false - AllowCreateDeclarativeWorkflow = $false - AllowSavePublishDeclarativeWorkflow = $false - AllowSaveDeclarativeWorkflowAsTemplate = $false - } - Mock -CommandName Get-SPSite -MockWith { - return @{ - Url = "https://intranet.sharepoint.contoso.com" - AllowDesigner = $true - AllowRevertFromTemplate = $true - AllowMasterPageEditing = $true - ShowURLStructure = $true - AllowCreateDeclarativeWorkflow = $true - AllowSavePublishDeclarativeWorkflow = $true - AllowSaveDeclarativeWorkflowAsTemplate = $true - } - } - Mock -CommandName Test-SPDscRunAsCredential { return $false } - } - - It "Should throw an exception in the get method to say that this is not supported" { - { Get-TargetResource @testParams } | Should -Throw "http://aka.ms/SharePointDscRemoteIssues" - } - - It "Should throw an exception in the test method to say that this is not supported" { - { Test-TargetResource @testParams } | Should -Throw "http://aka.ms/SharePointDscRemoteIssues" - } - - It "Should throw an exception in the set method to say that this is not supported" { - { Set-TargetResource @testParams } | Should -Throw "http://aka.ms/SharePointDscRemoteIssues" - } - } - Context -Name "The server is in a farm, target is web application and the correct settings have been applied" -Fixture { BeforeAll { $testParams = @{ @@ -281,8 +238,6 @@ try return $returnVal } - Mock -CommandName Test-SPDscRunAsCredential { return $true } - Mock -CommandName Get-SPWebApplication -MockWith { $result = @{ } $result.DisplayName = "Test" @@ -331,8 +286,6 @@ try } -PassThru return $returnVal } - - Mock -CommandName Test-SPDscRunAsCredential -MockWith { return $true } } It "Should return values from the get method" { diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPDiagnosticLoggingSettings.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPDiagnosticLoggingSettings.Tests.ps1 index 2de0e9725..e468eadea 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.SPDiagnosticLoggingSettings.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPDiagnosticLoggingSettings.Tests.ps1 @@ -263,11 +263,8 @@ try } } - Context -Name "Diagnostic configuration needs updating and the InstallAccount option is used" { + Context -Name "Diagnostic configuration needs updating" { BeforeAll { - $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force - $mockAccount = New-Object -TypeName "System.Management.Automation.PSCredential" ` - -ArgumentList @("username", $mockPassword) $testParams = @{ IsSingleInstance = "Yes" LogPath = "L:\ULSLogs" @@ -288,7 +285,6 @@ try EventLogFloodProtectionTriggerPeriod = 5 EventLogFloodProtectionQuietPeriod = 5 EventLogFloodProtectionNotifyInterval = 5 - InstallAccount = $mockAccount } Mock -CommandName Get-SPDiagnosticConfig -MockWith { diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheService.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheService.Tests.ps1 index 69a40fdd0..d255622e4 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheService.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPDistributedCacheService.Tests.ps1 @@ -51,7 +51,7 @@ try InModuleScope -ModuleName $script:DSCResourceFullName -ScriptBlock { Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { BeforeAll { - Invoke-Command -Scriptblock $Global:SPDscHelper.InitializeScript -NoNewScope + Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope # Mocks for all contexts Mock -CommandName Use-CacheCluster -MockWith { } @@ -424,14 +424,36 @@ try $Global:SPDscDCacheOnline = $true - Mock -CommandName Get-AFCacheHostConfiguration -MockWith { - return @{ - Size = $testParams.CacheSizeInMB + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + # SPSE mocks + Mock -CommandName Get-SPCacheHostConfig -MockWith { + return @{ + Size = $testParams.CacheSizeInMB + HostName = $env:COMPUTERNAME + CachePort = 22233 + } + } + + Mock -CommandName Get-SPCacheHost -MockWith { + return @{ + PortNo = 22233 + } } } - Mock -CommandName Get-CacheHost -MockWith { - return @{ - PortNo = 22233 + else + { + # Pre SPSE mocks + Mock -CommandName Get-AFCacheHostConfiguration -MockWith { + return @{ + Size = $testParams.CacheSizeInMB + } + } + Mock -CommandName Get-CacheHost -MockWith { + return @{ + PortNo = 22233 + } } } @@ -459,14 +481,36 @@ try $Global:SPDscDCacheOnline = $true - Mock -CommandName Get-AFCacheHostConfiguration -MockWith { - return @{ - Size = $testParams.CacheSizeInMB + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + # SPSE mocks + Mock -CommandName Get-SPCacheHostConfig -MockWith { + return @{ + Size = $testParams.CacheSizeInMB + HostName = $env:COMPUTERNAME + CachePort = 22233 + } + } + + Mock -CommandName Get-SPCacheHost -MockWith { + return @{ + PortNo = 22233 + } } } - Mock -CommandName Get-CacheHost -MockWith { - return @{ - PortNo = 22233 + else + { + # Pre SPSE mocks + Mock -CommandName Get-AFCacheHostConfiguration -MockWith { + return @{ + Size = $testParams.CacheSizeInMB + } + } + Mock -CommandName Get-CacheHost -MockWith { + return @{ + PortNo = 22233 + } } } @@ -504,16 +548,39 @@ try $Global:SPDscDCacheOnline = $true - Mock -CommandName Get-AFCacheHostConfiguration -MockWith { - return @{ - Size = 2048 + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + # SPSE mocks + Mock -CommandName Get-SPCacheHostConfig -MockWith { + return @{ + Size = 2048 + HostName = $env:COMPUTERNAME + CachePort = 22233 + } + } + + Mock -CommandName Get-SPCacheHost -MockWith { + return @{ + PortNo = 22233 + } } } - Mock -CommandName Get-CacheHost -MockWith { - return @{ - PortNo = 22233 + else + { + # Pre SPSE mocks + Mock -CommandName Get-AFCacheHostConfiguration -MockWith { + return @{ + Size = 2048 + } + } + Mock -CommandName Get-CacheHost -MockWith { + return @{ + PortNo = 22233 + } } } + Mock -CommandName Start-Sleep -MockWith { } Mock -CommandName Get-SPServiceInstance -MockWith { @@ -639,16 +706,39 @@ try $Global:SPDscDCacheOnline = $true - Mock -CommandName Get-AFCacheHostConfiguration -MockWith { - return @{ - Size = $testParams.CacheSizeInMB + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + # SPSE mocks + Mock -CommandName Get-SPCacheHostConfig -MockWith { + return @{ + Size = $testParams.CacheSizeInMB + HostName = $env:COMPUTERNAME + CachePort = 22233 + } + } + + Mock -CommandName Get-SPCacheHost -MockWith { + return @{ + PortNo = 22233 + } } } - Mock -CommandName Get-CacheHost -MockWith { - return @{ - PortNo = 22233 + else + { + # Pre SPSE mocks + Mock -CommandName Get-AFCacheHostConfiguration -MockWith { + return @{ + Size = $testParams.CacheSizeInMB + } + } + Mock -CommandName Get-CacheHost -MockWith { + return @{ + PortNo = 22233 + } } } + Mock -CommandName Get-NetFirewallRule -MockWith { return @{ } } diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPInstallPrereqs.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPInstallPrereqs.Tests.ps1 index 1e6dba2d6..bbf4c61a2 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.SPInstallPrereqs.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPInstallPrereqs.Tests.ps1 @@ -49,7 +49,7 @@ try InModuleScope -ModuleName $script:DSCResourceFullName -ScriptBlock { Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { BeforeAll { - Invoke-Command -Scriptblock $Global:SPDscHelper.InitializeScript -NoNewScope + Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope # Initialize tests function New-SPDscMockPrereq @@ -136,10 +136,11 @@ try if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 10000) { - # SharePoint 2019 + # SharePoint 2019 / SPSE return @{ Major = 10 Minor = 0 + Build = 17763 } } else @@ -304,7 +305,7 @@ try ) } } - else + elseif ($Global:SPDscHelper.CurrentStubBuildNumber.Build -lt 13000) { # SharePoint 2019 Mock -CommandName Get-ItemProperty -ParameterFilter { @@ -322,6 +323,17 @@ try ) } } + else + { + # SharePoint SE + Mock -CommandName Get-ItemProperty -ParameterFilter { + $Path -eq "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*" + } -MockWith { + return @( + (New-SPDscMockPrereq -Name "Microsoft Visual C++ 2015-2019 Redistributable (x64)" -BundleUpgradeCode @("{C146EF48-4D31-3C3D-A2C5-1E91AF8A0A9B}") -DisplayVersion "14.29.30133.0") + ) + } + } } Default { @@ -535,11 +547,16 @@ try # SharePoint 2016 $requiredParams = @("SQLNCli", "Sync", "AppFabric", "IDFX11", "MSIPCClient", "KB3092423", "WCFDataServices56", "DotNetFx", "MSVCRT11", "MSVCRT14", "ODBC") } - else + elseif ($Global:SPDscHelper.CurrentStubBuildNumber.Build -lt 13000) { # SharePoint 2019 $requiredParams = @("SQLNCli", "Sync", "AppFabric", "IDFX11", "MSIPCClient", "KB3092423", "WCFDataServices56", "DotNet472", "MSVCRT11", "MSVCRT141") } + else + { + # SharePoint SE + $requiredParams = @("DotNet48", "MSVCRT142") + } } Default { @@ -600,11 +617,16 @@ try # SharePoint 2016 $requiredParams = @("SQLNCli", "Sync", "AppFabric", "IDFX11", "MSIPCClient", "KB3092423", "WCFDataServices56", "DotNetFx", "MSVCRT11", "MSVCRT14", "ODBC") } - else + elseif ($Global:SPDscHelper.CurrentStubBuildNumber.Build -lt 13000) { # SharePoint 2019 $requiredParams = @("SQLNCli", "Sync", "AppFabric", "IDFX11", "MSIPCClient", "KB3092423", "WCFDataServices56", "DotNet472", "MSVCRT11", "MSVCRT141") } + else + { + # SharePoint SE + $requiredParams = @("DotNet48", "MSVCRT142") + } } Default { @@ -665,11 +687,16 @@ try # SharePoint 2016 $requiredParams = @("SQLNCli", "Sync", "AppFabric", "IDFX11", "MSIPCClient", "KB3092423", "WCFDataServices56", "DotNetFx", "MSVCRT11", "MSVCRT14", "ODBC") } - else + elseif ($Global:SPDscHelper.CurrentStubBuildNumber.Build -lt 13000) { # SharePoint 2019 $requiredParams = @("SQLNCli", "Sync", "AppFabric", "IDFX11", "MSIPCClient", "KB3092423", "WCFDataServices56", "DotNet472", "MSVCRT11", "MSVCRT141") } + else + { + # SharePoint SE + $requiredParams = @("DotNet48", "MSVCRT142") + } } Default { diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPLogLevel.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPLogLevel.Tests.ps1 index 4adeb0719..ac896144f 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.SPLogLevel.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPLogLevel.Tests.ps1 @@ -963,9 +963,9 @@ try $result = @' SPLogLevel AllLogLevels { - Name =" "Export"; - PsDscRunAsCredential =" $Credsspfarm; - SPLogLevelSetting =" @( + Name = "Export"; + PsDscRunAsCredential = $Credsspfarm; + SPLogLevelSetting = @( MSFT_SPLogLevelItem {TraceLevel="Default"; Name="Administration"; EventLevel="Default"; Area="Access Services"}, MSFT_SPLogLevelItem {TraceLevel="Default"; Name="General"; EventLevel="Default"; Area="SharePoint Server"} ); diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPOfficeOnlineServerSupressionSettings.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPOfficeOnlineServerSupressionSettings.Tests.ps1 new file mode 100644 index 000000000..cb14471e7 --- /dev/null +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPOfficeOnlineServerSupressionSettings.Tests.ps1 @@ -0,0 +1,265 @@ +[CmdletBinding()] +[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingConvertToSecureStringWithPlainText", "")] +param +( + [Parameter()] + [string] + $SharePointCmdletModule = (Join-Path -Path $PSScriptRoot ` + -ChildPath "..\Stubs\SharePoint\15.0.4805.1000\Microsoft.SharePoint.PowerShell.psm1" ` + -Resolve) +) + +$script:DSCModuleName = 'SharePointDsc' +$script:DSCResourceName = 'SPOfficeOnlineServerSupressionSettings' +$script:DSCResourceFullName = 'MSFT_' + $script:DSCResourceName + +function Invoke-TestSetup +{ + try + { + Import-Module -Name DscResource.Test -Force + + Import-Module -Name (Join-Path -Path $PSScriptRoot ` + -ChildPath "..\UnitTestHelper.psm1" ` + -Resolve) + + $Global:SPDscHelper = New-SPDscUnitTestHelper -SharePointStubModule $SharePointCmdletModule ` + -DscResource $script:DSCResourceName + } + catch [System.IO.FileNotFoundException] + { + throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -Tasks build" first.' + } + + $script:testEnvironment = Initialize-TestEnvironment ` + -DSCModuleName $script:DSCModuleName ` + -DSCResourceName $script:DSCResourceFullName ` + -ResourceType 'Mof' ` + -TestType 'Unit' +} + +function Invoke-TestCleanup +{ + Restore-TestEnvironment -TestEnvironment $script:testEnvironment +} + +Invoke-TestSetup + +try +{ + InModuleScope -ModuleName $script:DSCResourceFullName -ScriptBlock { + Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { + BeforeAll { + Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope + + # Mocks for all contexts + Mock -CommandName Remove-SPWOPISuppressionSetting -MockWith { } + Mock -CommandName New-SPWOPISuppressionSetting -MockWith { } + } + + # Test contexts + Context -Name "Supression settings do not exist, but they should be" -Fixture { + BeforeAll { + $testParams = @{ + Extension = "pdf" + Action = "view", "edit" + Ensure = "Present" + } + + Mock -CommandName Get-SPWOPISuppressionSetting -MockWith { + return $null + } + } + + It "Should return absent from the get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Absent" + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should create the bindings in the set method" { + Set-TargetResource @testParams + Assert-MockCalled New-SPWOPISuppressionSetting -Times 2 + } + } + + Context -Name "Suppression settings exist, but should not be" -Fixture { + BeforeAll { + $testParams = @{ + Extension = "pdf" + Ensure = "Absent" + } + + Mock -CommandName Get-SPWOPISuppressionSetting -MockWith { + return @( + "PDF VIEW", + "XLS VIEW", + "XLS EDIT", + "PDF EMBEDVIEW" + ) + } + } + + It "Should return present from the get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Present" + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should remove the old bindings and create the new bindings in the set method" { + Set-TargetResource @testParams + Assert-MockCalled Remove-SPWOPISuppressionSetting -Times 2 + } + } + + Context -Name "Suppression settings exist, but are incorrect" -Fixture { + BeforeAll { + $testParams = @{ + Extension = "pdf" + Action = "view", "edit" + Ensure = "Present" + } + + Mock -CommandName Get-SPWOPISuppressionSetting -MockWith { + return @( + "PDF VIEW", + "XLS VIEW", + "XLS EDIT", + "PDF EMBEDVIEW" + ) + } + } + + It "Should return present from the get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Present" + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should remove the old bindings and create the new bindings in the set method" { + Set-TargetResource @testParams + Assert-MockCalled New-SPWOPISuppressionSetting -Times 1 + Assert-MockCalled Remove-SPWOPISuppressionSetting -Times 1 + } + } + + Context -Name "Supression settings do not exists and should not be" -Fixture { + BeforeAll { + $testParams = @{ + Extension = "pdf" + Ensure = "Absent" + } + + Mock -CommandName Get-SPWOPISuppressionSetting -MockWith { + return @( + "XLS VIEW", + "XLS EDIT" + ) + } + } + + It "Should return present from the get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Absent" + } + + It "Should return true from the test method" { + Test-TargetResource @testParams | Should -Be $true + } + } + + Context -Name "Supression settings exist and are correct" -Fixture { + BeforeAll { + $testParams = @{ + Extension = "pdf" + Action = "view", "edit" + Ensure = "Present" + } + + Mock -CommandName Get-SPWOPISuppressionSetting -MockWith { + return @( + "PDF VIEW", + "XLS VIEW", + "XLS EDIT", + "PDF EDIT" + ) + } + } + + It "Should return present from the get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Present" + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $true + } + } + + Context -Name "Ensure is Present, but Actions parameter is missing" -Fixture { + BeforeAll { + $testParams = @{ + Extension = "pdf" + Ensure = "Present" + } + } + + It "Should throw an exception from the Set method" { + { Set-TargetResource @testParams } | Should -Throw "You have to specify the Actions parameter if Ensure is not set to Absent" + } + } + + Context -Name "Running ReverseDsc Export" -Fixture { + BeforeAll { + Import-Module (Join-Path -Path (Split-Path -Path (Get-Module SharePointDsc -ListAvailable).Path -Parent) -ChildPath "Modules\SharePointDSC.Reverse\SharePointDSC.Reverse.psm1") + + Mock -CommandName Write-Host -MockWith { } + + Mock -CommandName Get-TargetResource -MockWith { + return @{ + Extension = "pdf" + Action = "view", "edit" + Ensure = "Present" + } + } + + Mock -CommandName Get-SPWOPISuppressionSetting -MockWith { + return @( + "PDF VIEW", + "PDF EDIT" + ) + } + + if ($null -eq (Get-Variable -Name 'spFarmAccount' -ErrorAction SilentlyContinue)) + { + $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force + $Global:spFarmAccount = New-Object -TypeName System.Management.Automation.PSCredential ("contoso\spfarm", $mockPassword) + } + + $result = @' + SPOfficeOnlineServerSupressionSettings 'PDF' + { + Action = @("view","edit"); + Ensure = "Present"; + Extension = "pdf"; + PsDscRunAsCredential = $Credsspfarm; + } + +'@ + } + + It "Should return valid DSC block from the Export method" { + Export-TargetResource | Should -Be $result + } + } + } + } +} +finally +{ + Invoke-TestCleanup +} diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPPerformancePointServiceApp.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPPerformancePointServiceApp.Tests.ps1 index f49e29a2b..526f6d6e0 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.SPPerformancePointServiceApp.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPPerformancePointServiceApp.Tests.ps1 @@ -50,249 +50,258 @@ try InModuleScope -ModuleName $script:DSCResourceFullName -ScriptBlock { Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { BeforeAll { - Invoke-Command -Scriptblock $Global:SPDscHelper.InitializeScript -NoNewScope - - #Initialize tests - $getTypeFullName = "Microsoft.PerformancePoint.Scorecards.BIMonitoringServiceApplication" - - # Mocks for all contexts - Mock -CommandName Remove-SPServiceApplication -MockWith { } - Mock -CommandName Get-SPServiceApplication -MockWith { return $null } - Mock -CommandName New-SPPerformancePointServiceApplication -MockWith { } - Mock -CommandName New-SPPerformancePointServiceApplicationProxy -MockWith { } + Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope + + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15 -or + ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -lt 13000)) + { + #Initialize tests + $getTypeFullName = "Microsoft.PerformancePoint.Scorecards.BIMonitoringServiceApplication" + + # Mocks for all contexts + Mock -CommandName Remove-SPServiceApplication -MockWith { } + Mock -CommandName Get-SPServiceApplication -MockWith { return $null } + Mock -CommandName New-SPPerformancePointServiceApplication -MockWith { } + Mock -CommandName New-SPPerformancePointServiceApplicationProxy -MockWith { } + } } # Test contexts - Context -Name "When no service applications exist in the current farm" -Fixture { - BeforeAll { - $testParams = @{ - Name = "Test Performance Point App" - ApplicationPool = "Test App Pool" + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 15 -or + ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -lt 13000)) + { + Context -Name "When no service applications exist in the current farm" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Test Performance Point App" + ApplicationPool = "Test App Pool" + } } - } - It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should -Be "Absent" - } - - It "Should return false when the Test method is called" { - Test-TargetResource @testParams | Should -Be $false - } + It "Should return absent from the Get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Absent" + } - It "Should create a new service application in the set method" { - Set-TargetResource @testParams - Assert-MockCalled New-SPPerformancePointServiceApplication - } - } + It "Should return false when the Test method is called" { + Test-TargetResource @testParams | Should -Be $false + } - Context -Name "When service applications exist in the current farm but the specific Performance Point app does not" -Fixture { - BeforeAll { - $testParams = @{ - Name = "Test Performance Point App" - ApplicationPool = "Test App Pool" + It "Should create a new service application in the set method" { + Set-TargetResource @testParams + Assert-MockCalled New-SPPerformancePointServiceApplication } + } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - DisplayName = $testParams.Name - Name = $testParams.Name + Context -Name "When service applications exist in the current farm but the specific Performance Point app does not" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Test Performance Point App" + ApplicationPool = "Test App Pool" } - $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = "Microsoft.Office.UnKnownWebServiceApplication" + + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + DisplayName = $testParams.Name + Name = $testParams.Name } - } -PassThru -Force - return $spServiceApp + $spServiceApp | Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + return @{ + FullName = "Microsoft.Office.UnKnownWebServiceApplication" + } + } -PassThru -Force + return $spServiceApp + } } - } - It "Should return null from the Get method" { - (Get-TargetResource @testParams).Ensure | Should -Be "Absent" - } + It "Should return null from the Get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Absent" + } - It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should -Be "Absent" + It "Should return absent from the Get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Absent" + } } - } - Context -Name "When a service application exists and is configured correctly" -Fixture { - BeforeAll { - $testParams = @{ - Name = "Test Performance Point App" - ApplicationPool = "Test App Pool" - } + Context -Name "When a service application exists and is configured correctly" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Test Performance Point App" + ApplicationPool = "Test App Pool" + } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - TypeName = "PerformancePoint Service Application" - DisplayName = $testParams.Name - Name = $testParams.Name - ApplicationPool = @{ - Name = $testParams.ApplicationPool + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + TypeName = "PerformancePoint Service Application" + DisplayName = $testParams.Name + Name = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool + } } + $spServiceApp | Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + return @{ + FullName = $getTypeFullName + } + } -PassThru -Force + return $spServiceApp } - $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - FullName = $getTypeFullName - } - } -PassThru -Force - return $spServiceApp } - } - It "Should return present from the get method" { - (Get-TargetResource @testParams).Ensure | Should -Be "Present" - } + It "Should return present from the get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Present" + } - It "Should return true when the Test method is called" { - Test-TargetResource @testParams | Should -Be $true + It "Should return true when the Test method is called" { + Test-TargetResource @testParams | Should -Be $true + } } - } - Context -Name "When a service application exists and is not configured correctly" -Fixture { - BeforeAll { - $testParams = @{ - Name = "Test Performance Point App" - ApplicationPool = "Test App Pool" - } + Context -Name "When a service application exists and is not configured correctly" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Test Performance Point App" + ApplicationPool = "Test App Pool" + } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - TypeName = "Access Services Web Service Application" - DisplayName = $testParams.Name - Name = $testParams.Name - DatabaseServer = $testParams.DatabaseName - ApplicationPool = @{ Name = "Wrong app pool name" } + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + TypeName = "Access Services Web Service Application" + DisplayName = $testParams.Name + Name = $testParams.Name + DatabaseServer = $testParams.DatabaseName + ApplicationPool = @{ Name = "Wrong app pool name" } + } + $spServiceApp | Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + return @{ + FullName = $getTypeFullName + } + } -PassThru -Force + return $spServiceApp } - $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { + + Mock -CommandName Get-SPServiceApplicationPool -MockWith { return @{ - FullName = $getTypeFullName + Name = $testParams.ApplicationPool } - } -PassThru -Force - return $spServiceApp + } } - Mock -CommandName Get-SPServiceApplicationPool -MockWith { - return @{ - Name = $testParams.ApplicationPool - } + It "Should return false when the Test method is called" { + Test-TargetResource @testParams | Should -Be $false } - } - It "Should return false when the Test method is called" { - Test-TargetResource @testParams | Should -Be $false + It "Should call the update service app cmdlet from the set method" { + Set-TargetResource @testParams + Assert-MockCalled Get-SPServiceApplicationPool + } } - It "Should call the update service app cmdlet from the set method" { - Set-TargetResource @testParams - Assert-MockCalled Get-SPServiceApplicationPool - } - } + Context -Name "When the service application exists but it shouldn't" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Test App" + ApplicationPool = "-" + Ensure = "Absent" + } - Context -Name "When the service application exists but it shouldn't" -Fixture { - BeforeAll { - $testParams = @{ - Name = "Test App" - ApplicationPool = "-" - Ensure = "Absent" + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + TypeName = "PerformancePoint Service Application" + DisplayName = $testParams.Name + Name = $testParams.Name + ApplicationPool = @{ Name = "Wrong App Pool Name" } + } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } + } -PassThru -Force + return $spServiceApp + } } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - TypeName = "PerformancePoint Service Application" - DisplayName = $testParams.Name - Name = $testParams.Name - ApplicationPool = @{ Name = "Wrong App Pool Name" } - } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { - return @{ FullName = $getTypeFullName } - } -PassThru -Force - return $spServiceApp + It "Should return present from the Get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Present" } - } - It "Should return present from the Get method" { - (Get-TargetResource @testParams).Ensure | Should -Be "Present" - } + It "Should return false when the Test method is called" { + Test-TargetResource @testParams | Should -Be $false + } - It "Should return false when the Test method is called" { - Test-TargetResource @testParams | Should -Be $false + It "Should call the remove service application cmdlet in the set method" { + Set-TargetResource @testParams + Assert-MockCalled Remove-SPServiceApplication + } } - It "Should call the remove service application cmdlet in the set method" { - Set-TargetResource @testParams - Assert-MockCalled Remove-SPServiceApplication - } - } + Context -Name "When the serivce application doesn't exist and it shouldn't" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Test App" + ApplicationPool = "-" + Ensure = "Absent" + } - Context -Name "When the serivce application doesn't exist and it shouldn't" -Fixture { - BeforeAll { - $testParams = @{ - Name = "Test App" - ApplicationPool = "-" - Ensure = "Absent" + Mock -CommandName Get-SPServiceApplication -MockWith { + return $null + } } - Mock -CommandName Get-SPServiceApplication -MockWith { - return $null + It "Should return absent from the Get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Absent" } - } - - It "Should return absent from the Get method" { - (Get-TargetResource @testParams).Ensure | Should -Be "Absent" - } - It "Should return true when the Test method is called" { - Test-TargetResource @testParams | Should -Be $true + It "Should return true when the Test method is called" { + Test-TargetResource @testParams | Should -Be $true + } } - } - Context -Name "Running ReverseDsc Export" -Fixture { - BeforeAll { - Import-Module (Join-Path -Path (Split-Path -Path (Get-Module SharePointDsc -ListAvailable).Path -Parent) -ChildPath "Modules\SharePointDSC.Reverse\SharePointDSC.Reverse.psm1") + Context -Name "Running ReverseDsc Export" -Fixture { + BeforeAll { + Import-Module (Join-Path -Path (Split-Path -Path (Get-Module SharePointDsc -ListAvailable).Path -Parent) -ChildPath "Modules\SharePointDSC.Reverse\SharePointDSC.Reverse.psm1") - Mock -CommandName Write-Host -MockWith { } + Mock -CommandName Write-Host -MockWith { } - Mock -CommandName Get-TargetResource -MockWith { - return @{ - Name = "PerformancePoint Service Application" - ProxyName = "PerformancePoint Service Application Proxy" - ApplicationPool = "Service App Pool" - DatabaseName = "PerformancePointDB" - DatabaseServer = "SQL01" - Ensure = "Present" + Mock -CommandName Get-TargetResource -MockWith { + return @{ + Name = "PerformancePoint Service Application" + ProxyName = "PerformancePoint Service Application Proxy" + ApplicationPool = "Service App Pool" + DatabaseName = "PerformancePointDB" + DatabaseServer = "SQL01" + Ensure = "Present" + } } - } - Mock -CommandName Get-SPServiceApplication -MockWith { - $spServiceApp = [PSCustomObject]@{ - TypeName = "BIMonitoringServiceApplication" - DisplayName = "PerformancePoint Service Application" - Name = "PerformancePoint Service Application" - } - $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod ` - -Name GetType ` - -Value { - return @{ - Name = "BIMonitoringServiceApplication" + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + TypeName = "BIMonitoringServiceApplication" + DisplayName = "PerformancePoint Service Application" + Name = "PerformancePoint Service Application" } - } -PassThru -Force - return $spServiceApp - } + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod ` + -Name GetType ` + -Value { + return @{ + Name = "BIMonitoringServiceApplication" + } + } -PassThru -Force + return $spServiceApp + } - if ($null -eq (Get-Variable -Name 'spFarmAccount' -ErrorAction SilentlyContinue)) - { - $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force - $Global:spFarmAccount = New-Object -TypeName System.Management.Automation.PSCredential ("contoso\spfarm", $mockPassword) - } + if ($null -eq (Get-Variable -Name 'spFarmAccount' -ErrorAction SilentlyContinue)) + { + $mockPassword = ConvertTo-SecureString -String "password" -AsPlainText -Force + $Global:spFarmAccount = New-Object -TypeName System.Management.Automation.PSCredential ("contoso\spfarm", $mockPassword) + } - $result = @' + $result = @' SPPerformancePointServiceApp PerformancePointServiceApplication { ApplicationPool = "Service App Pool"; @@ -305,10 +314,37 @@ try } '@ + } + + It "Should return valid DSC block from the Export method" { + Export-TargetResource | Should -Be $result + } } + } + + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + Context -Name "All methods throw exceptions as Performance Point Services no longer exists in SharePoint Server Subscription Edition" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Test Performance Point App" + ApplicationPool = "Test App Pool" + Ensure = "Present" + } + } - It "Should return valid DSC block from the Export method" { - Export-TargetResource | Should -Be $result + It "Should throw on the get method" { + { Get-TargetResource @testParams } | Should -Throw "Since SharePoint Server Subscription Edition the Performance Point Services does no longer exists." + } + + It "Should throw on the test method" { + { Test-TargetResource @testParams } | Should -Throw "Since SharePoint Server Subscription Edition the Performance Point Services does no longer exists." + } + + It "Should throw on the set method" { + { Set-TargetResource @testParams } | Should -Throw "Since SharePoint Server Subscription Edition the Performance Point Services does no longer exists." + } } } } diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPSearchServiceApp.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPSearchServiceApp.Tests.ps1 index dca39b9f1..d4603294d 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.SPSearchServiceApp.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPSearchServiceApp.Tests.ps1 @@ -228,6 +228,9 @@ try $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { return @{ FullName = $getTypeFullName } } -PassThru -Force + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetProperty -Value { + return 0 + } -PassThru -Force $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name IsConnected -Value { return $true } -PassThru -Force @@ -255,9 +258,10 @@ try Context -Name "When service applications exist in the current farm but the specific search app does not" -Fixture { BeforeAll { $testParams = @{ - Name = "Search Service Application" - ApplicationPool = "SharePoint Search Services" - Ensure = "Present" + Name = "Search Service Application" + ApplicationPool = "SharePoint Search Services" + DefaultContentAccessAccount = $mockCredential + Ensure = "Present" } Mock Import-Module -MockWith { } -ParameterFilter { $_.Name -eq $ModuleName } @@ -326,6 +330,9 @@ try $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { return @{ FullName = $getTypeFullName } } -PassThru -Force + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetProperty -Value { + return 0 + } -PassThru -Force return $spServiceApp } @@ -379,6 +386,9 @@ try $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { return @{ FullName = $getTypeFullName } } -PassThru -Force + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetProperty -Value { + return 0 + } -PassThru -Force return $spServiceApp } } @@ -425,6 +435,9 @@ try $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name IsConnected -Value { return $true } -PassThru -Force + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetProperty -Value { + return 0 + } -PassThru -Force return $spServiceApp } @@ -486,6 +499,9 @@ try $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name IsConnected -Value { return $true } -PassThru -Force + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetProperty -Value { + return 0 + } -PassThru -Force return $spServiceApp } @@ -551,6 +567,9 @@ try $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name IsConnected -Value { return $false } -PassThru -Force + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetProperty -Value { + return 0 + } -PassThru -Force return $spServiceApp } @@ -608,6 +627,9 @@ try $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name IsConnected -Value { return $true } -PassThru -Force + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetProperty -Value { + return 0 + } -PassThru -Force return $spServiceApp } @@ -670,6 +692,9 @@ try $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { return @{ FullName = $getTypeFullName } } -PassThru -Force + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetProperty -Value { + return 0 + } -PassThru -Force return $spServiceApp } @@ -726,6 +751,9 @@ try $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name IsConnected -Value { return $true } -PassThru -Force + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetProperty -Value { + return 0 + } -PassThru -Force return $spServiceApp } @@ -750,6 +778,10 @@ try } } + It "Should return the current Deletion Policy Settings from the get method" { + (Get-TargetResource @testParams).SearchCenterUrl | Should -Be "http://wrong.url.here" + } + It "Should return false from the test method" { Test-TargetResource @testParams | Should -Be $false } @@ -799,6 +831,9 @@ try $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name IsConnected -Value { return $true } -PassThru -Force + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetProperty -Value { + return 0 + } -PassThru -Force return $spServiceApp } @@ -839,6 +874,7 @@ try Name = "Search Service Application" ApplicationPool = "SharePoint Search Services" DatabaseName = "SP_Search" + SearchCenterUrl = "http://search.sp.contoso.com" Ensure = "Present" } @@ -869,6 +905,9 @@ try $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { return @{ FullName = $getTypeFullName } } -PassThru -Force + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetProperty -Value { + return 0 + } -PassThru -Force return $spServiceApp } @@ -881,11 +920,100 @@ try } } + It "Should return the current Deletion Policy Settings from the get method" { + (Get-TargetResource @testParams).SearchCenterUrl | Should -Be "http://search.sp.contoso.com" + } + It "Should return true from the test method" { Test-TargetResource @testParams | Should -Be $true } } + Context -Name "When the Deletion Policy settings do not match" -Fixture { + BeforeAll { + $testParams = @{ + Name = "Search Service Application" + ApplicationPool = "SharePoint Search Services" + DatabaseName = "SP_Search" + ErrorDeleteCountAllowed = 10 + ErrorDeleteIntervalAllowed = 240 + ErrorCountAllowed = 15 + ErrorIntervalAllowed = 360 + DeleteUnvisitedMethod = 1 + RecrawlErrorCount = 5 + RecrawlErrorInterval = 120 + Ensure = "Present" + } + + Mock Import-Module -MockWith { } -ParameterFilter { $_.Name -eq $ModuleName } + + Mock -CommandName Get-SPServiceApplicationPool -MockWith { + return @{ + Name = $testParams.ApplicationPool + } + } + + Mock -CommandName Get-SPServiceApplication -MockWith { + $spServiceApp = [PSCustomObject]@{ + TypeName = "Search Service Application" + DisplayName = $testParams.Name + Name = $testParams.Name + ApplicationPool = @{ Name = $testParams.ApplicationPool } + SearchCenterUrl = "http://search.sp.contoso.com" + Database = @{ + Name = $testParams.DatabaseName + NormalizedDataSource = 'SQL01' + } + SearchAdminDatabase = @{ + Name = $testParams.DatabaseName + NormalizedDataSource = 'SQL01' + } + } + $spServiceApp = $spServiceApp | Add-Member ScriptMethod Update { + $Global:SPDscAlertsEnabledUpdated = $true + } -PassThru + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { + return @{ FullName = $getTypeFullName } + } -PassThru -Force + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetProperty -Value { + return 0 + } -PassThru -Force + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name SetProperty -Value { + } -PassThru -Force + return $spServiceApp + } + + Mock -CommandName New-Object { + return @{ + DefaultGatheringAccount = "Domain\username" + } + } -ParameterFilter { + $TypeName -eq "Microsoft.Office.Server.Search.Administration.Content" + } + } + + It "Should return the current Deletion Policy Settings from the get method" { + $result = Get-TargetResource @testParams + $result.ErrorDeleteCountAllowed | Should -Be 0 + $result.ErrorDeleteIntervalAllowed | Should -Be 0 + $result.ErrorCountAllowed | Should -Be 0 + $result.ErrorIntervalAllowed | Should -Be 0 + $result.DeleteUnvisitedMethod | Should -Be 0 + $result.RecrawlErrorCount | Should -Be 0 + $result.RecrawlErrorInterval | Should -Be 0 + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should update the service app Deletion Policy settings in the set method" { + $Global:SPDscAlertsEnabledUpdated = $false + Set-TargetResource @testParams + $Global:SPDscAlertsEnabledUpdated | Should -Be $true + } + } + Context -Name "When the service app exists but it shouldn't" -Fixture { BeforeAll { $testParams = @{ @@ -917,6 +1045,9 @@ try $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { return @{ FullName = $getTypeFullName } } -PassThru -Force + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetProperty -Value { + return 0 + } -PassThru -Force return $spServiceApp } } @@ -990,6 +1121,9 @@ try $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetType -Value { return @{ FullName = $getTypeFullName } } -PassThru -Force + $spServiceApp = $spServiceApp | Add-Member -MemberType ScriptMethod -Name GetProperty -Value { + return 0 + } -PassThru -Force return $spServiceApp } diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileServiceApp.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileServiceApp.Tests.ps1 index f18a7dadd..ed46952f9 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileServiceApp.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileServiceApp.Tests.ps1 @@ -50,7 +50,7 @@ try InModuleScope -ModuleName $script:DSCResourceFullName -ScriptBlock { Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { BeforeAll { - Invoke-Command -Scriptblock $Global:SPDscHelper.InitializeScript -NoNewScope + Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope # Initialize tests $getTypeFullName = "Microsoft.Office.Server.Administration.UserProfileApplication" @@ -299,47 +299,47 @@ try param($x) return @( (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SocialDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return @{ - Name = "SP_SocialDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SocialDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return @{ + Name = "SP_SocialDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ), (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "ProfileDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "ProfileDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ), (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SynchronizationDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileSyncDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SynchronizationDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileSyncDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ) ) } -PassThru @@ -374,36 +374,6 @@ try } } - Context -Name "When InstallAccount matches the Farm Account" -Fixture { - BeforeAll { - $testParams = @{ - Name = "User Profile Service App" - ApplicationPool = "SharePoint Service Applications" - Ensure = "Present" - MySiteHostLocation = "https://my.contoso.com" - InstallAccount = $mockFarmCredential - } - - Mock -CommandName Get-SPServiceApplication -MockWith { - return $null - } - - Mock -CommandName Restart-Service { } - } - - It "Should throw exception in the Get method" { - { Get-TargetResource @testParams } | Should -Throw "Specified InstallAccount " - } - - It "Should throw exception in the Test method" { - { Test-TargetResource @testParams } | Should -Throw "Specified InstallAccount " - } - - It "Should throw exception in the set method" { - { Set-TargetResource @testParams } | Should -Throw "Specified InstallAccount " - } - } - Context -Name "When no service applications exist in the current farm" -Fixture { BeforeAll { $testParams = @{ @@ -581,47 +551,47 @@ try param($x) return @( (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SocialDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return @{ - Name = "SP_SocialDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SocialDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return @{ + Name = "SP_SocialDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ), (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "ProfileDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "ProfileDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ), (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SynchronizationDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileSyncDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SynchronizationDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileSyncDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ) ) } -PassThru @@ -728,47 +698,47 @@ try param($x) return @( (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SocialDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return @{ - Name = "SP_SocialDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SocialDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return @{ + Name = "SP_SocialDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ), (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "ProfileDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "ProfileDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ), (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SynchronizationDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileSyncDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SynchronizationDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileSyncDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ) ) } -PassThru @@ -875,47 +845,47 @@ try param($x) return @( (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SocialDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return @{ - Name = "SP_SocialDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SocialDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return @{ + Name = "SP_SocialDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ), (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "ProfileDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "ProfileDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ), (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SynchronizationDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileSyncDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SynchronizationDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileSyncDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ) ) } -PassThru @@ -1026,47 +996,47 @@ try param($x) return @( (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SocialDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return @{ - Name = "SP_SocialDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SocialDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return @{ + Name = "SP_SocialDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ), (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "ProfileDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "ProfileDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ), (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SynchronizationDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileSyncDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SynchronizationDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileSyncDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ) ) } -PassThru @@ -1168,47 +1138,47 @@ try param($x) return @( (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SocialDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return @{ - Name = "SP_SocialDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SocialDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return @{ + Name = "SP_SocialDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ), (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "ProfileDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "ProfileDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ), (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SynchronizationDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileSyncDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SynchronizationDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileSyncDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ) ) } -PassThru @@ -1312,47 +1282,47 @@ try param($x) return @( (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SocialDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return @{ - Name = "SP_SocialDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SocialDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return @{ + Name = "SP_SocialDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ), (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "ProfileDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "ProfileDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ), (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SynchronizationDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileSyncDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SynchronizationDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileSyncDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ) ) } -PassThru @@ -1446,47 +1416,47 @@ try param($x) return @( (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SocialDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - param($x) - return @{ - Name = "SP_SocialDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SocialDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + param($x) + return @{ + Name = "SP_SocialDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ), (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "ProfileDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "ProfileDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ), (New-Object -TypeName "Object" | - Add-Member -MemberType NoteProperty ` - -Name Name ` - -Value "SynchronizationDatabase" ` - -PassThru | - Add-Member -MemberType ScriptMethod ` - -Name GetValue ` - -Value { - return @{ - Name = "SP_ProfileSyncDB" - NormalizedDataSource = "SQL.domain.local" - } - } -PassThru + Add-Member -MemberType NoteProperty ` + -Name Name ` + -Value "SynchronizationDatabase" ` + -PassThru | + Add-Member -MemberType ScriptMethod ` + -Name GetValue ` + -Value { + return @{ + Name = "SP_ProfileSyncDB" + NormalizedDataSource = "SQL.domain.local" + } + } -PassThru ) ) } -PassThru diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileSyncService.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileSyncService.Tests.ps1 index 0137420f3..8e3c2794a 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileSyncService.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPUserProfileSyncService.Tests.ps1 @@ -219,32 +219,6 @@ try } } - Context -Name "When InstallAccount is the Farm Account" -Fixture { - BeforeAll { - $testParams = @{ - UserProfileServiceAppName = "User Profile Service Service App" - Ensure = "Present" - InstallAccount = $mockFarmCredential - } - - Mock -CommandName Get-SPServiceInstance -MockWith { - return $null - } - } - - It "Should throw exception in the get method" { - { Get-TargetResource @testParams } | Should -Throw "Specified InstallAccount " - } - - It "Should throw exception in the test method" { - { Test-TargetResource @testParams } | Should -Throw "Specified InstallAccount " - } - - It "Should throw exception in the set method" { - { Set-TargetResource @testParams } | Should -Throw "Specified InstallAccount " - } - } - Context -Name "User profile sync service is not found locally" -Fixture { BeforeAll { $testParams = @{ diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPWebApplication.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPWebApplication.Tests.ps1 index 45fbe381d..71abe6c99 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.SPWebApplication.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPWebApplication.Tests.ps1 @@ -53,6 +53,18 @@ try Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope # Initialize tests + try + { + [Microsoft.SharePoint.Administration.SPUrlZone] + } + catch + { + Add-Type -TypeDefinition @" + namespace Microsoft.SharePoint.Administration { + public enum SPUrlZone { Default, Intranet, Internet, Custom, Extranet }; + } +"@ + } # Mocks for all contexts Mock -CommandName New-SPAuthenticationProvider -MockWith { } @@ -84,6 +96,61 @@ try } # Test contexts + Context -Name "AllowLegacyEncryption used with other OS than Windows Server 2022" -Fixture { + BeforeAll { + $testParams = @{ + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" + ApplicationPoolAccount = "DEMO\ServiceAccount" + WebAppUrl = "http://sites.sharepoint.com" + AllowLegacyEncryption = $true + Ensure = "Present" + } + + Mock -CommandName Get-SPDscOSVersion -MockWith { + return @{ + Major = 10 + Minor = 0 + Build = 17763 + } + } + } + + It "return AllowLegacyEncryption=Null from the get method" { + (Get-TargetResource @testParams).AllowLegacyEncryption | Should -BeNullOrEmpty + } + + It "throw an exception in the set method" { + { Set-TargetResource @testParams } | Should -Throw "You cannot specify the AllowLegacyEncryption parameter when using Windows Server 2019 or earlier." + } + } + + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 10000 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -lt 13000) + { + Context -Name "UseServerNameIndication used with SharePoint 2019" -Fixture { + BeforeAll { + $testParams = @{ + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" + ApplicationPoolAccount = "DEMO\ServiceAccount" + WebAppUrl = "http://sites.sharepoint.com" + UseServerNameIndication = $true + Ensure = "Present" + } + } + + It "return UseServerNameIndication=Null from the get method" { + (Get-TargetResource @testParams).UseServerNameIndication | Should -BeNullOrEmpty + } + + It "retrieving Managed Account fails in the set method" { + { Set-TargetResource @testParams } | Should -Throw "The parameters AllowLegacyEncryption, CertificateThumbprint or UseServerNameIndication are only supported with SharePoint Server Subscription Edition." + } + } + } + Context -Name "The specified Managed Account does not exist" -Fixture { BeforeAll { $testParams = @{ @@ -230,9 +297,21 @@ try } ) IisSettings = @( - @{ Path = "C:\inetpub\wwwroot\something" } + @{ + Path = "C:\inetpub\wwwroot\something" + SecureBindings = @( + @{ + Certificate = @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + UseServerNameIndication = $false + DisableLegacyTls = $true + } + ) + } ) Url = $testParams.WebAppUrl + SiteDataServers = @() }) } } @@ -275,9 +354,21 @@ try } ) IisSettings = @( - @{ Path = "C:\inetpub\wwwroot\something" } + @{ + Path = "C:\inetpub\wwwroot\something" + SecureBindings = @( + @{ + Certificate = @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + UseServerNameIndication = $false + DisableLegacyTls = $true + } + ) + } ) Url = $testParams.WebAppUrl + SiteDataServers = @() }) } } @@ -320,9 +411,21 @@ try } ) IisSettings = @( - @{ Path = "C:\inetpub\wwwroot\something" } + @{ + Path = "C:\inetpub\wwwroot\something" + SecureBindings = @( + @{ + Certificate = @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + UseServerNameIndication = $false + DisableLegacyTls = $true + } + ) + } ) Url = $testParams.WebAppUrl + SiteDataServers = @() }) } } @@ -366,9 +469,21 @@ try } ) IisSettings = @( - @{ Path = "C:\inetpub\wwwroot\something" } + @{ + Path = "C:\inetpub\wwwroot\something" + SecureBindings = @( + @{ + Certificate = @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + UseServerNameIndication = $false + DisableLegacyTls = $true + } + ) + } ) Url = $testParams.WebAppUrl + SiteDataServers = @() }) } } @@ -442,9 +557,21 @@ try } ) IisSettings = @( - @{ Path = "C:\inetpub\wwwroot\something" } + @{ + Path = "C:\inetpub\wwwroot\something" + SecureBindings = @( + @{ + Certificate = @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + UseServerNameIndication = $false + DisableLegacyTls = $true + } + ) + } ) Url = $testParams.WebAppUrl + SiteDataServers = @() } ) } } @@ -492,9 +619,21 @@ try } ) IisSettings = @( - @{ Path = "C:\inetpub\wwwroot\something" } + @{ + Path = "C:\inetpub\wwwroot\something" + SecureBindings = @( + @{ + Certificate = @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + UseServerNameIndication = $false + DisableLegacyTls = $true + } + ) + } ) Url = $testParams.WebAppUrl + SiteDataServers = @() } ) } } @@ -695,9 +834,21 @@ try } ) IisSettings = @( - @{ Path = "C:\inetpub\wwwroot\something" } + @{ + Path = "C:\inetpub\wwwroot\something" + SecureBindings = @( + @{ + Certificate = @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + UseServerNameIndication = $false + DisableLegacyTls = $true + } + ) + } ) Url = $testParams.WebAppUrl + SiteDataServers = @() } ) } } @@ -727,17 +878,19 @@ try } Mock -CommandName Get-SPDscContentService -MockWith { - ApplicationPools = @( - @{ - Name = $testParams.ApplicationPool - }, - @{ - Name = "Default App Pool" - }, - @{ - Name = "SharePoint Token Service App Pool" - } - ) + return @{ + ApplicationPools = @( + @{ + Name = $testParams.ApplicationPool + }, + @{ + Name = "Default App Pool" + }, + @{ + Name = "SharePoint Token Service App Pool" + } + ) + } } Mock -CommandName Get-SPAuthenticationProvider -MockWith { return @{ @@ -750,6 +903,9 @@ try Mock -CommandName Get-SPWebapplication -MockWith { return $null } + + Mock -CommandName New-SPWebapplication -MockWith { + } } It "Should return absent from the get method" { @@ -761,7 +917,8 @@ try } It "Should return false from the set method" { - Test-TargetResource @testParams | Should -Be $false + Set-TargetResource @testParams + Assert-MockCalled -CommandName New-SPWebApplication -Times 1 } } @@ -772,7 +929,18 @@ try ApplicationPool = "SharePoint Web Apps" ApplicationPoolAccount = "DEMO\ServiceAccount" DatabaseName = "SP_Content_00" + DatabaseServer = "SQL01" WebAppUrl = "http://sites.sharepoint.com" + SiteDataServers = @( + (New-CimInstance -ClassName MSFT_SPWebAppSiteDataServers -Property @{ + Zone = "Default" + Uri = "http://spwfe" + } -ClientOnly), + (New-CimInstance -ClassName MSFT_SPWebAppSiteDataServers -Property @{ + Zone = "Internet" + Uri = "http://spwfe" + } -ClientOnly) + ) Ensure = "Present" } @@ -824,6 +992,18 @@ try } Mock -CommandName Get-SPWebApplication -MockWith { + $sds = New-Object "System.Collections.Generic.Dictionary[[object],[System.Collections.Generic.List[System.Uri]]]" + + $uriList = New-Object System.Collections.Generic.List[System.Uri](1) + $target = New-Object System.Uri("http://spbackend") + $target2 = New-Object System.Uri("http://spbackend2") + $uriList.Add($target) + $uriList.Add($target2) + $defaultZone = [Microsoft.SharePoint.Administration.SPUrlZone]"Default" + $sds.Add($defaultZone, $uriList) + $intranetZone = [Microsoft.SharePoint.Administration.SPUrlZone]"Intranet" + $sds.Add($intranetZone, $uriList) + $returnval = @(@{ DisplayName = $testParams.Name ApplicationPool = @{ @@ -838,9 +1018,21 @@ try } ) IisSettings = @( - @{ Path = "C:\inetpub\wwwroot\something" } + @{ + Path = "C:\inetpub\wwwroot\something" + SecureBindings = @( + @{ + Certificate = @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + UseServerNameIndication = $false + DisableLegacyTls = $true + } + ) + } ) Url = $testParams.WebAppUrl + SiteDataServers = $sds } ) $returnval = $returnval | Add-Member -MemberType ScriptMethod ` @@ -895,6 +1087,776 @@ try } } + Context -Name "Mounting of new database fails" -Fixture { + BeforeAll { + $testParams = @{ + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" + ApplicationPoolAccount = "DEMO\ServiceAccount" + DatabaseName = "SP_Content_00" + DatabaseServer = "SQL01" + WebAppUrl = "http://sites.sharepoint.com" + SiteDataServers = @( + (New-CimInstance -ClassName MSFT_SPWebAppSiteDataServers -Property @{ + Zone = "Default" + Uri = "http://spwfe" + } -ClientOnly), + (New-CimInstance -ClassName MSFT_SPWebAppSiteDataServers -Property @{ + Zone = "Internet" + Uri = "http://spwfe" + } -ClientOnly) + ) + Ensure = "Present" + } + + try + { + [Microsoft.SharePoint.Administration.SPWebService] | Out-Null + } + catch + { + Add-Type -TypeDefinition @" + namespace Microsoft.SharePoint.Administration + { + public class SPWebService { + public SPWebService() { } + } + } +"@ + } + + try + { + [Microsoft.SharePoint.Administration.SPApplicationPool] | Out-Null + } + catch + { + Add-Type -TypeDefinition @" + namespace Microsoft.SharePoint.Administration + { + public class SPApplicationPool { + public SPApplicationPool(System.String account, System.Object service) { } + + public string CurrentIdentityType { get; set; } + public string Username { get; set; } + public void Update(bool force) { } + public void Provision() { } + } + } +"@ + } + + Mock -CommandName Get-SPAuthenticationProvider -MockWith { + return @{ + + DisplayName = "TestProvider" + LoginProviderName = "TestProvider" + ClaimProviderName = "TestClaimProvider" + AuthenticationRedirectUrl = "/_trust/default.aspx?trust=TestProvider" + } + } + + Mock -CommandName Get-SPWebApplication -MockWith { + $sds = New-Object "System.Collections.Generic.Dictionary[[object],[System.Collections.Generic.List[System.Uri]]]" + + $uriList = New-Object System.Collections.Generic.List[System.Uri](1) + $target = New-Object System.Uri("http://spbackend") + $target2 = New-Object System.Uri("http://spbackend2") + $uriList.Add($target) + $uriList.Add($target2) + $defaultZone = [Microsoft.SharePoint.Administration.SPUrlZone]"Default" + $sds.Add($defaultZone, $uriList) + $intranetZone = [Microsoft.SharePoint.Administration.SPUrlZone]"Intranet" + $sds.Add($intranetZone, $uriList) + + $returnval = @(@{ + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = "SharePoint Old AppPool" + Username = $testParams.ApplicationPoolAccount + } + UseClaimsAuthentication = $true + ContentDatabases = @( + @{ + Name = "SP_Content_01" + Server = "sql.domain.local" + } + ) + IisSettings = @( + @{ + Path = "C:\inetpub\wwwroot\something" + SecureBindings = @( + @{ + Certificate = @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + UseServerNameIndication = $false + DisableLegacyTls = $true + } + ) + } + ) + Url = $testParams.WebAppUrl + SiteDataServers = $sds + } + ) + $returnval = $returnval | Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { + $global:SPDscRanWebAppUpdate = $true + } -PassThru -Force | Add-Member -MemberType ScriptMethod ` + -Name ProvisionGlobally ` + -Value { + } -PassThru -Force + + return $returnVal + } + + Mock -CommandName Get-SPDscContentService -MockWith { + $returnVal = @{ + ApplicationPools = @( + @{ + Name = "SharePoint Old AppPool" + } + ) + } + $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name Update -Value { + $Global:SPDscAntivirusUpdated = $true + } -PassThru + return $returnVal + } + + Mock -CommandName Get-SPManagedAccount -MockWith { + return "" + } + + Mock -CommandName Mount-SPContentDatabase -MockWith { + throw + } + } + + It "Should throw exception from the set method" { + { Set-TargetResource @testParams } | Should -Throw "Error occurred while mounting content database. Content database is not mounted. Error details:" + } + } + + Context -Name "Specified Managed Account does not exist" -Fixture { + BeforeAll { + $testParams = @{ + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" + ApplicationPoolAccount = "DEMO\ServiceAccount" + DatabaseName = "SP_Content_00" + DatabaseServer = "SQL01" + WebAppUrl = "http://sites.sharepoint.com" + SiteDataServers = @( + (New-CimInstance -ClassName MSFT_SPWebAppSiteDataServers -Property @{ + Zone = "Default" + Uri = "http://spwfe" + } -ClientOnly), + (New-CimInstance -ClassName MSFT_SPWebAppSiteDataServers -Property @{ + Zone = "Internet" + Uri = "http://spwfe" + } -ClientOnly) + ) + Ensure = "Present" + } + + try + { + [Microsoft.SharePoint.Administration.SPWebService] | Out-Null + } + catch + { + Add-Type -TypeDefinition @" + namespace Microsoft.SharePoint.Administration + { + public class SPWebService { + public SPWebService() { } + } + } +"@ + } + + try + { + [Microsoft.SharePoint.Administration.SPApplicationPool] | Out-Null + } + catch + { + Add-Type -TypeDefinition @" + namespace Microsoft.SharePoint.Administration + { + public class SPApplicationPool { + public SPApplicationPool(System.String account, System.Object service) { } + + public string CurrentIdentityType { get; set; } + public string Username { get; set; } + public void Update(bool force) { } + public void Provision() { } + } + } +"@ + } + + Mock -CommandName Get-SPAuthenticationProvider -MockWith { + return @{ + + DisplayName = "TestProvider" + LoginProviderName = "TestProvider" + ClaimProviderName = "TestClaimProvider" + AuthenticationRedirectUrl = "/_trust/default.aspx?trust=TestProvider" + } + } + + Mock -CommandName Get-SPWebApplication -MockWith { + $sds = New-Object "System.Collections.Generic.Dictionary[[object],[System.Collections.Generic.List[System.Uri]]]" + + $uriList = New-Object System.Collections.Generic.List[System.Uri](1) + $target = New-Object System.Uri("http://spbackend") + $target2 = New-Object System.Uri("http://spbackend2") + $uriList.Add($target) + $uriList.Add($target2) + $defaultZone = [Microsoft.SharePoint.Administration.SPUrlZone]"Default" + $sds.Add($defaultZone, $uriList) + $intranetZone = [Microsoft.SharePoint.Administration.SPUrlZone]"Intranet" + $sds.Add($intranetZone, $uriList) + + $returnval = @(@{ + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = "SharePoint Old AppPool" + Username = $testParams.ApplicationPoolAccount + } + UseClaimsAuthentication = $true + ContentDatabases = @( + @{ + Name = "SP_Content_01" + Server = "sql.domain.local" + } + ) + IisSettings = @( + @{ + Path = "C:\inetpub\wwwroot\something" + SecureBindings = @( + @{ + Certificate = @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + UseServerNameIndication = $false + DisableLegacyTls = $true + } + ) + } + ) + Url = $testParams.WebAppUrl + SiteDataServers = $sds + } + ) + $returnval = $returnval | Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { + $global:SPDscRanWebAppUpdate = $true + } -PassThru -Force | Add-Member -MemberType ScriptMethod ` + -Name ProvisionGlobally ` + -Value { + } -PassThru -Force + + return $returnVal + } + + Mock -CommandName Get-SPDscContentService -MockWith { + $returnVal = @{ + ApplicationPools = @( + @{ + Name = "SharePoint Old AppPool" + } + ) + } + $returnVal = $returnVal | Add-Member -MemberType ScriptMethod -Name Update -Value { + $Global:SPDscAntivirusUpdated = $true + } -PassThru + return $returnVal + } + + Mock -CommandName Get-SPManagedAccount -MockWith { + return $null + } + + Mock -CommandName Mount-SPContentDatabase -MockWith { } + } + + It "Should throw exception from the set method" { + { Set-TargetResource @testParams } | Should -Throw "Specified ApplicationPoolAccount '$($testParams.ApplicationPoolAccount)' is not a managed account" + } + } + + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + Context -Name "The web application does not exist and uses the Certificate parameters (SPSE)" -Fixture { + BeforeAll { + $testParams = @{ + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" + ApplicationPoolAccount = "DEMO\ServiceAccount" + WebAppUrl = "https://sites.sharepoint.com" + DatabaseServer = "sql.domain.local" + DatabaseName = "SP_Content_01" + Port = 80 + HostHeader = "sites.sharepoint.com" + AllowLegacyEncryption = $true + CertificateThumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + UseServerNameIndication = $false + Path = "C:\inetpub\wwwroot\something" + Ensure = "Present" + } + + Mock -CommandName Get-SPDscOSVersion -MockWith { + return @{ + Major = 10 + Minor = 0 + Build = 20348 + } + } + + Mock -CommandName Get-SPDscContentService -MockWith { + return @{ + ApplicationPools = @( + @{ + Name = $testParams.ApplicationPool + }, + @{ + Name = "Default App Pool" + }, + @{ + Name = "SharePoint Token Service App Pool" + } + ) + } + } + Mock -CommandName Get-SPAuthenticationProvider -MockWith { + return @{ + DisplayName = "Windows Authentication" + DisableKerberos = $true + AllowAnonymous = $false + } + } + + Mock -CommandName Get-SPCertificate -MockWith { + return @{ + Thumbprint = $testParams.CertificateThumbprint + } + } + + Mock -CommandName Get-SPWebApplication -MockWith { + return $null + } + + Mock -CommandName New-SPWebApplication -MockWith { + } + } + + It "Should return absent from the get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Absent" + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should return false from the set method" { + Set-TargetResource @testParams + Assert-MockCalled -CommandName New-SPWebApplication -Times 1 + } + } + + Context -Name "Specified CertificateThumbprint is not found while creating new web app (SPSE)" -Fixture { + BeforeAll { + $testParams = @{ + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" + ApplicationPoolAccount = "DEMO\ServiceAccount" + WebAppUrl = "https://sites.sharepoint.com" + DatabaseServer = "sql.domain.local" + DatabaseName = "SP_Content_01" + Port = 80 + HostHeader = "sites.sharepoint.com" + AllowLegacyEncryption = $true + CertificateThumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + UseServerNameIndication = $false + Path = "C:\inetpub\wwwroot\something" + Ensure = "Present" + } + + Mock -CommandName Get-SPDscOSVersion -MockWith { + return @{ + Major = 10 + Minor = 0 + Build = 20348 + } + } + + Mock -CommandName Get-SPDscContentService -MockWith { + return @{ + ApplicationPools = @( + @{ + Name = $testParams.ApplicationPool + }, + @{ + Name = "Default App Pool" + }, + @{ + Name = "SharePoint Token Service App Pool" + } + ) + } + } + Mock -CommandName Get-SPAuthenticationProvider -MockWith { + return @{ + DisplayName = "Windows Authentication" + DisableKerberos = $true + AllowAnonymous = $false + } + } + + Mock -CommandName Get-SPCertificate -MockWith { + return $null + } + + Mock -CommandName Get-SPWebApplication -MockWith { + return $null + } + + Mock -CommandName New-SPWebApplication -MockWith { + } + } + + It "Should call the new SPWebApplication cmdlet from the set method" { + { Set-TargetResource @testParams } | Should -Throw "No certificate found with the specified thumbprint: $($testParams.CertificateThumbprint). Make sure the certificate is added to Certificate Management first!" + } + } + + Context -Name "Specified CertificateThumbprint is not found while updating web app (SPSE)" -Fixture { + BeforeAll { + $testParams = @{ + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" + ApplicationPoolAccount = "DEMO\ServiceAccount" + CertificateThumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198E' + DatabaseName = "SP_Content_00" + Port = 80 + AllowLegacyEncryption = $true + UseServerNameIndication = $true + WebAppUrl = "https://sites.sharepoint.com" + Ensure = "Present" + } + + try + { + [Microsoft.SharePoint.Administration.SPWebService] | Out-Null + } + catch + { + Add-Type -TypeDefinition @" + namespace Microsoft.SharePoint.Administration + { + public class SPWebService { + public SPWebService() { } + } + } +"@ + } + + try + { + [Microsoft.SharePoint.Administration.SPApplicationPool] | Out-Null + } + catch + { + Add-Type -TypeDefinition @" + namespace Microsoft.SharePoint.Administration + { + public class SPApplicationPool { + public SPApplicationPool(System.String account, System.Object service) { } + + public string CurrentIdentityType { get; set; } + public string Username { get; set; } + public void Update(bool force) { } + public void Provision() { } + } + } +"@ + } + + Mock -CommandName Get-SPDscOSVersion -MockWith { + return @{ + Major = 10 + Minor = 0 + Build = 20348 + } + } + + Mock -CommandName Get-SPAuthenticationProvider -MockWith { + return @{ + + DisplayName = "TestProvider" + LoginProviderName = "TestProvider" + ClaimProviderName = "TestClaimProvider" + AuthenticationRedirectUrl = "/_trust/default.aspx?trust=TestProvider" + } + } + + Mock -CommandName Get-SPWebApplication -MockWith { + $sds = New-Object "System.Collections.Generic.Dictionary[[object],[System.Collections.Generic.List[System.Uri]]]" + + $uriList = New-Object System.Collections.Generic.List[System.Uri](1) + $target = New-Object System.Uri("http://spbackend") + $target2 = New-Object System.Uri("http://spbackend2") + $uriList.Add($target) + $uriList.Add($target2) + $defaultZone = [Microsoft.SharePoint.Administration.SPUrlZone]"Default" + $sds.Add($defaultZone, $uriList) + $intranetZone = [Microsoft.SharePoint.Administration.SPUrlZone]"Intranet" + $sds.Add($intranetZone, $uriList) + + $returnval = @(@{ + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool + Username = $testParams.ApplicationPoolAccount + } + UseClaimsAuthentication = $true + ContentDatabases = @( + @{ + Name = "SP_Content_00" + Server = "sql.domain.local" + } + ) + IisSettings = @( + @{ + Path = "C:\inetpub\wwwroot\something" + SecureBindings = @( + @{ + Certificate = @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + UseServerNameIndication = $false + DisableLegacyTls = $true + } + ) + } + ) + Url = $testParams.WebAppUrl + SiteDataServers = $sds + } + ) + $returnval = $returnval | Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { + $global:SPDscRanWebAppUpdate = $true + } -PassThru -Force | Add-Member -MemberType ScriptMethod ` + -Name ProvisionGlobally ` + -Value { + } -PassThru -Force + + return $returnVal + } + + Mock -CommandName Get-SPDscContentService -MockWith { + $returnVal = @{ + ApplicationPools = @( + @{ + Name = "SharePoint Old AppPool" + } + ) + } + return $returnVal + } + + Mock -CommandName Get-SPManagedAccount -MockWith { + return "" + } + + Mock -CommandName Get-SPCertificate -MockWith { + return $null + } + + Mock -CommandName Set-SPWebApplication -MockWith { } + } + + It "Should call the new SPWebApplication cmdlet from the set method" { + { Set-TargetResource @testParams } | Should -Throw "No certificate found with the specified thumbprint: $($testParams.CertificateThumbprint). Make sure the certificate is added to Certificate Management first!" + } + } + + Context -Name "The web application does exist and should, but has incorrect settings (SPSE)" -Fixture { + BeforeAll { + $testParams = @{ + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Web Apps" + ApplicationPoolAccount = "DEMO\ServiceAccount" + CertificateThumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198E' + DatabaseName = "SP_Content_00" + Port = 80 + AllowLegacyEncryption = $true + UseServerNameIndication = $true + WebAppUrl = "https://sites.sharepoint.com" + Ensure = "Present" + } + + try + { + [Microsoft.SharePoint.Administration.SPWebService] | Out-Null + } + catch + { + Add-Type -TypeDefinition @" + namespace Microsoft.SharePoint.Administration + { + public class SPWebService { + public SPWebService() { } + } + } +"@ + } + + try + { + [Microsoft.SharePoint.Administration.SPApplicationPool] | Out-Null + } + catch + { + Add-Type -TypeDefinition @" + namespace Microsoft.SharePoint.Administration + { + public class SPApplicationPool { + public SPApplicationPool(System.String account, System.Object service) { } + + public string CurrentIdentityType { get; set; } + public string Username { get; set; } + public void Update(bool force) { } + public void Provision() { } + } + } +"@ + } + + Mock -CommandName Get-SPDscOSVersion -MockWith { + return @{ + Major = 10 + Minor = 0 + Build = 20348 + } + } + + Mock -CommandName Get-SPAuthenticationProvider -MockWith { + return @{ + + DisplayName = "TestProvider" + LoginProviderName = "TestProvider" + ClaimProviderName = "TestClaimProvider" + AuthenticationRedirectUrl = "/_trust/default.aspx?trust=TestProvider" + } + } + + Mock -CommandName Get-SPWebApplication -MockWith { + $sds = New-Object "System.Collections.Generic.Dictionary[[object],[System.Collections.Generic.List[System.Uri]]]" + + $uriList = New-Object System.Collections.Generic.List[System.Uri](1) + $target = New-Object System.Uri("http://spbackend") + $target2 = New-Object System.Uri("http://spbackend2") + $uriList.Add($target) + $uriList.Add($target2) + $defaultZone = [Microsoft.SharePoint.Administration.SPUrlZone]"Default" + $sds.Add($defaultZone, $uriList) + $intranetZone = [Microsoft.SharePoint.Administration.SPUrlZone]"Intranet" + $sds.Add($intranetZone, $uriList) + + $returnval = @(@{ + DisplayName = $testParams.Name + ApplicationPool = @{ + Name = $testParams.ApplicationPool + Username = $testParams.ApplicationPoolAccount + } + UseClaimsAuthentication = $true + ContentDatabases = @( + @{ + Name = "SP_Content_00" + Server = "sql.domain.local" + } + ) + IisSettings = @( + @{ + Path = "C:\inetpub\wwwroot\something" + SecureBindings = @( + @{ + Certificate = @{ + Thumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + } + UseServerNameIndication = $false + DisableLegacyTls = $true + } + ) + } + ) + Url = $testParams.WebAppUrl + SiteDataServers = $sds + } + ) + $returnval = $returnval | Add-Member -MemberType ScriptMethod ` + -Name Update ` + -Value { + $global:SPDscRanWebAppUpdate = $true + } -PassThru -Force | Add-Member -MemberType ScriptMethod ` + -Name ProvisionGlobally ` + -Value { + } -PassThru -Force + + return $returnVal + } + + Mock -CommandName Get-SPDscContentService -MockWith { + $returnVal = @{ + ApplicationPools = @( + @{ + Name = "SharePoint Old AppPool" + } + ) + } + return $returnVal + } + + Mock -CommandName Get-SPManagedAccount -MockWith { + return "" + } + + Mock -CommandName Get-SPCertificate -MockWith { + return "" + } + + Mock -CommandName Set-SPWebApplication -MockWith { } + } + + It "Should return present from the get method" { + $result = Get-TargetResource @testParams + $result.Ensure | Should -Be "Present" + $result.CertificateThumbprint | Should -Be "7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D" + $result.UseServerNameIndication | Should -Be $false + $result.AllowLegacyEncryption | Should -Be $false + } + + It "Should return true from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should call the new SPWebApplication cmdlet from the set method" { + Set-TargetResource @testParams + Assert-MockCalled Set-SPWebApplication + } + } + } + Context -Name "Running ReverseDsc Export" -Fixture { BeforeAll { Import-Module (Join-Path -Path (Split-Path -Path (Get-Module SharePointDsc -ListAvailable).Path -Parent) -ChildPath "Modules\SharePointDSC.Reverse\SharePointDSC.Reverse.psm1") @@ -902,19 +1864,42 @@ try Mock -CommandName Write-Host -MockWith { } Mock -CommandName Get-TargetResource -MockWith { + $currentSDS = @() + $currentSDS += New-Object -TypeName PSObject -Property @{ + Zone = "Default" + Uri = "http://spbackend" + } + $currentSDS += New-Object -TypeName PSObject -Property @{ + Zone = "Intranet" + Uri = "http://spfrontend" + } + return @{ - Name = "SharePoint Sites" - ApplicationPool = "SharePoint Sites" - ApplicationPoolAccount = "CONTOSO\svcSPWebApp" - AllowAnonymous = $false - DatabaseName = "SP_Content_01" - DatabaseServer = "SQL.contoso.local\SQLINSTANCE" - WebAppUrl = "http://example.contoso.local" - HostHeader = "http://example.contoso.local" - Path = "C:\InetPub\wwwroot" - Port = 80 - UseClassic = $false - Ensure = "Present" + Name = "SharePoint Sites" + ApplicationPool = "SharePoint Sites" + ApplicationPoolAccount = "CONTOSO\svcSPWebApp" + AllowAnonymous = $false + AllowLegacyEncryption = $true + CertificateThumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + DatabaseName = "SP_Content_01" + DatabaseServer = "SQL.contoso.local\SQLINSTANCE" + WebAppUrl = "http://example.contoso.local" + HostHeader = "http://example.contoso.local" + Path = "C:\InetPub\wwwroot" + Port = 80 + UseClassic = $false + UseServerNameIndication = $false + SiteDataServers = @( + @{ + Zone = "Default" + Uri = "http://spbackend" + } + @{ + Zone = "Intranet" + Uri = "http://spbackend2" + } + ) + Ensure = "Present" } } @@ -947,19 +1932,31 @@ try $result = @' SPWebApplication SharePointSites { - AllowAnonymous = $False; - ApplicationPool = "SharePoint Sites"; - ApplicationPoolAccount = "CONTOSO\svcSPWebApp"; - DatabaseName = "SP_Content_01"; - DatabaseServer = $ConfigurationData.NonNodeData.DatabaseServer; - Ensure = "Present"; - HostHeader = "http://example.contoso.local"; - Name = "SharePoint Sites"; - Path = "C:\InetPub\wwwroot"; - Port = 80; - PsDscRunAsCredential = $Credsspfarm; - UseClassic = $False; - WebAppUrl = "http://example.contoso.local"; + AllowAnonymous = $False; + AllowLegacyEncryption = $true; + ApplicationPool = "SharePoint Sites"; + ApplicationPoolAccount = "CONTOSO\svcSPWebApp"; + CertificateThumbprint = "7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D"; + DatabaseName = "SP_Content_01"; + DatabaseServer = $ConfigurationData.NonNodeData.DatabaseServer; + Ensure = "Present"; + HostHeader = "http://example.contoso.local"; + Name = "SharePoint Sites"; + Path = "C:\InetPub\wwwroot"; + Port = 80; + PsDscRunAsCredential = $Credsspfarm; + SiteDataServers = @( + MSFT_SPWebAppSiteDataServers { + Zone = 'Default' + Uri = 'http://spbackend' + }, + MSFT_SPWebAppSiteDataServers { + Zone = 'Intranet' + Uri = 'http://spbackend2' + }); + UseClassic = $False; + UseServerNameIndication = $false; + WebAppUrl = "http://example.contoso.local"; } '@ diff --git a/tests/Unit/SharePointDsc/SharePointDsc.SPWebApplicationExtension.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.SPWebApplicationExtension.Tests.ps1 index 165b83830..9ecf0393a 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.SPWebApplicationExtension.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.SPWebApplicationExtension.Tests.ps1 @@ -50,7 +50,7 @@ try InModuleScope -ModuleName $script:DSCResourceFullName -ScriptBlock { Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { BeforeAll { - Invoke-Command -Scriptblock $Global:SPDscHelper.InitializeScript -NoNewScope + Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope # Initialize tests @@ -74,6 +74,14 @@ try Mock -CommandName Get-SPTrustedIdentityTokenIssuer -MockWith { } Mock -CommandName Set-SPWebApplication -MockWith { } + Mock -CommandName Get-SPDscOSVersion -MockWith { + return @{ + Major = 10 + Minor = 0 + Build = 17763 + } + } + function Add-SPDscEvent { param ( @@ -98,6 +106,61 @@ try } # Test contexts + Context -Name "AllowLegacyEncryption used with other OS than Windows Server 2022" -Fixture { + BeforeAll { + $testParams = @{ + WebAppUrl = "http://nosuchwebapplication.sharepoint.com" + Name = "Intranet Zone" + Url = "http://intranet.sharepoint.com" + Zone = "Intranet" + AllowLegacyEncryption = $true + Ensure = "Present" + } + + Mock -CommandName Get-SPDscOSVersion -MockWith { + return @{ + Major = 10 + Minor = 0 + Build = 17763 + } + } + } + + It "return AllowLegacyEncryption=Null from the get method" { + (Get-TargetResource @testParams).AllowLegacyEncryption | Should -BeNullOrEmpty + } + + It "retrieving Managed Account fails in the set method" { + { Set-TargetResource @testParams } | Should -Throw "You cannot specify the AllowLegacyEncryption parameter when using Windows Server 2019 or earlier." + } + } + + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 10000 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -lt 13000) + { + Context -Name "AllowLegacyEncryption used with SharePoint 2019" -Fixture { + BeforeAll { + $testParams = @{ + WebAppUrl = "http://nosuchwebapplication.sharepoint.com" + Name = "Intranet Zone" + Url = "http://intranet.sharepoint.com" + Zone = "Intranet" + UseServerNameIndication = $true + Ensure = "Present" + } + } + + It "return UseServerNameIndication=Null from the get method" { + (Get-TargetResource @testParams).UseServerNameIndication | Should -BeNullOrEmpty + } + + It "retrieving Managed Account fails in the set method" { + { Set-TargetResource @testParams } | Should -Throw "The parameters AllowLegacyEncryption, CertificateThumbprint or UseServerNameIndication are only supported with SharePoint Server Subscription Edition." + } + } + } + Context -Name "The parent web application does not exist" -Fixture { BeforeAll { $testParams = @{ @@ -266,7 +329,6 @@ try Name = "Intranet Zone" Url = "https://intranet.sharepoint.com" HostHeader = "intranet.sharepoint.com" - UseSSL = $true Zone = "Intranet" Ensure = "Present" } @@ -526,6 +588,7 @@ try HostHeader = "intranet.sharepoint.com" Port = 80 } + Path = "C:\Inetpub\wwwroot" AllowAnonymous = $false }) @@ -636,6 +699,247 @@ try } } + if ($Global:SPDscHelper.CurrentStubBuildNumber.Major -eq 16 -and + $Global:SPDscHelper.CurrentStubBuildNumber.Build -gt 13000) + { + Context -Name "The web application extension doesn't exist but should (SPSE)" -Fixture { + BeforeAll { + $testParams = @{ + WebAppUrl = "http://company.sharepoint.com" + Name = "Intranet Zone" + Url = "https://intranet.sharepoint.com" + Zone = "Intranet" + HostHeader = "intranet.sharepoint.com" + AllowLegacyEncryption = $true + CertificateThumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + UseServerNameIndication = $false + Path = "C:\inetpub\wwwroot\something" + Ensure = "Present" + } + + Mock -CommandName Get-SPWebapplication -MockWith { + return @{ + DisplayName = "Company SharePoint" + URL = "http://company.sharepoint.com" + IISSettings = @() + } + } + + Mock -CommandName Get-SPDscOSVersion -MockWith { + return @{ + Major = 10 + Minor = 0 + Build = 20348 + } + } + + Mock -CommandName Get-SPCertificate -MockWith { + return @{ + Thumbprint = $testParams.CertificateThumbprint + } + } + } + + It "Should return absent from the get method" { + $result = Get-TargetResource @testParams + $result.Ensure | Should -Be "Absent" + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should call the new cmdlet from the set method" { + Set-TargetResource @testParams + Assert-MockCalled New-SPWebApplicationExtension + } + } + + Context -Name "The specified certificate does not exist in CertMgmt for web extension (SPSE)" -Fixture { + BeforeAll { + $testParams = @{ + WebAppUrl = "http://company.sharepoint.com" + Name = "Intranet Zone" + Url = "https://intranet.sharepoint.com" + Zone = "Intranet" + AllowLegacyEncryption = $true + CertificateThumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + UseServerNameIndication = $false + Ensure = "Present" + } + + Mock -CommandName Get-SPWebapplication -MockWith { + return @{ + DisplayName = "Company SharePoint" + URL = "http://company.sharepoint.com" + IISSettings = @() + } + } + + Mock -CommandName Get-SPDscOSVersion -MockWith { + return @{ + Major = 10 + Minor = 0 + Build = 20348 + } + } + + Mock -CommandName Get-SPCertificate -MockWith { + return $null + } + } + + It "Should throw an exception from the set method" { + { Set-TargetResource @testParams } | Should -Throw "No certificate found with the specified thumbprint: $($testParams.CertificateThumbprint). Make sure the certificate is added to Certificate Management first!" + } + } + + Context -Name "The web application extension does exist but has mismatched Certificate settings (SPSE)" -Fixture { + BeforeAll { + $testParams = @{ + WebAppUrl = "http://company.sharepoint.com" + Name = "Intranet Zone" + Url = "https://intranet.sharepoint.com" + HostHeader = "intranet.sharepoint.com" + Zone = "Intranet" + AllowLegacyEncryption = $true + CertificateThumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + UseServerNameIndication = $false + Ensure = "Present" + } + + Mock -CommandName Get-SPAuthenticationProvider -MockWith { + return @{ + DisplayName = "Windows Authentication" + DisableKerberos = $true + } + } + + Mock -CommandName Get-SPWebapplication -MockWith { + $IISSettings = @( + @{ } + @{ + SecureBindings = @{ } + ServerBindings = @{ + HostHeader = "intranet.sharepoint.com" + Port = 80 + } + Path = "C:\Inetpub\wwwroot" + AllowAnonymous = $false + }) + + return ( + @{ + DisplayName = "Company SharePoint" + URL = "http://company.sharepoint.com" + IISSettings = $IISSettings + } | Add-Member ScriptMethod Update { $Global:WebAppUpdateCalled = $true } -PassThru + ) + } + + Mock -CommandName Get-SPAlternateUrl -MockWith { + return @{ + PublicURL = $testParams.Url + } + } + + Mock -CommandName Get-SPDscOSVersion -MockWith { + return @{ + Major = 10 + Minor = 0 + Build = 20348 + } + } + + Mock -CommandName Get-SPCertificate -MockWith { + return @{ + Thumbprint = $testParams.CertificateThumbprint + } + } + } + + It "Should return present from the get method" { + (Get-TargetResource @testParams).Ensure | Should -Be "Present" + } + + It "Should return false from the test method" { + Test-TargetResource @testParams | Should -Be $false + } + + It "Should update the web application extension settings in the set method" { + Set-TargetResource @testParams + Assert-MockCalled -CommandName Set-SPWebApplication + } + } + + Context -Name "The specified certificate does not exist in CertMgmt for existing extension (SPSE)" -Fixture { + BeforeAll { + $testParams = @{ + WebAppUrl = "http://company.sharepoint.com" + Name = "Intranet Zone" + Url = "https://intranet.sharepoint.com" + HostHeader = "intranet.sharepoint.com" + Zone = "Intranet" + AllowLegacyEncryption = $true + CertificateThumbprint = '7CF9E91F141FCA1049F56AB96BE2A1D7D3F9198D' + UseServerNameIndication = $false + Ensure = "Present" + } + + Mock -CommandName Get-SPAuthenticationProvider -MockWith { + return @{ + DisplayName = "Windows Authentication" + DisableKerberos = $true + } + } + + Mock -CommandName Get-SPWebapplication -MockWith { + $IISSettings = @( + @{ } + @{ + SecureBindings = @{ } + ServerBindings = @{ + HostHeader = "intranet.sharepoint.com" + Port = 80 + } + Path = "C:\Inetpub\wwwroot" + AllowAnonymous = $false + }) + + return ( + @{ + DisplayName = "Company SharePoint" + URL = "http://company.sharepoint.com" + IISSettings = $IISSettings + } | Add-Member ScriptMethod Update { $Global:WebAppUpdateCalled = $true } -PassThru + ) + } + + Mock -CommandName Get-SPAlternateUrl -MockWith { + return @{ + PublicURL = $testParams.Url + } + } + + Mock -CommandName Get-SPDscOSVersion -MockWith { + return @{ + Major = 10 + Minor = 0 + Build = 20348 + } + } + + Mock -CommandName Get-SPCertificate -MockWith { + return $null + } + } + + It "Should throw an exception from the set method" { + { Set-TargetResource @testParams } | Should -Throw "No certificate found with the specified thumbprint: $($testParams.CertificateThumbprint). Make sure the certificate is added to Certificate Management first!" + } + } + } + Context -Name "Running ReverseDsc Export" -Fixture { BeforeAll { Import-Module (Join-Path -Path (Split-Path -Path (Get-Module SharePointDsc -ListAvailable).Path -Parent) -ChildPath "Modules\SharePointDSC.Reverse\SharePointDSC.Reverse.psm1") diff --git a/tests/Unit/Stubs/SharePoint/16.0.14326.20450/SharePointServer.psm1 b/tests/Unit/Stubs/SharePoint/16.0.14326.20450/SharePointServer.psm1 new file mode 100644 index 000000000..8eb1436e1 --- /dev/null +++ b/tests/Unit/Stubs/SharePoint/16.0.14326.20450/SharePointServer.psm1 @@ -0,0 +1,22773 @@ +function Add-SPAppDeniedEndpoint +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0)] + [ValidateNotNullOrEmpty()] + [string] + ${Endpoint}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Add-SPCertificateNotificationContact +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0)] + [string] + ${EmailAddress}, + + [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-SPDatabaseToAvailabilityGroup +{ + [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-SPDiagnosticsPerformanceCounter +{ + [CmdletBinding(DefaultParameterSetName = 'AddCounter', SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(ParameterSetName = 'AddCounter', Mandatory = $true, Position = 1, ValueFromPipelineByPropertyName = $true)] + [Parameter(ParameterSetName = 'AddInstance', Mandatory = $true, Position = 1, ValueFromPipelineByPropertyName = $true)] + [Parameter(ParameterSetName = 'AddMultipleCounters', Mandatory = $true, ValueFromPipelineByPropertyName = $true)] + [string] + ${Category}, + + [Parameter(ParameterSetName = 'AddCounter', Mandatory = $true, ValueFromPipelineByPropertyName = $true)] + [Parameter(ParameterSetName = 'AddInstance', 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 = 'AddCounter', ValueFromPipelineByPropertyName = $true)] + [Parameter(ParameterSetName = 'AddInstance', ValueFromPipelineByPropertyName = $true)] + [Parameter(ParameterSetName = 'AddMultipleCounters', ValueFromPipelineByPropertyName = $true)] + [switch] + ${DatabaseServer}, + + [Parameter(ParameterSetName = 'AddCounter', ValueFromPipelineByPropertyName = $true)] + [Parameter(ParameterSetName = 'AddInstance', ValueFromPipelineByPropertyName = $true)] + [Parameter(ParameterSetName = 'AddMultipleCounters', ValueFromPipelineByPropertyName = $true)] + [switch] + ${AllInstances}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Add-SPDistributedCacheServiceInstance +{ + [CmdletBinding(DefaultParameterSetName = 'NoArgumentsDefaultSet')] + param( + [Parameter(ParameterSetName = 'LocalServerRoleSet')] + [ValidateSet('DistributedCache', 'SingleServerFarm', 'WebFrontEndWithDistributedCache')] + [object] + ${Role}, + + [Parameter(ParameterSetName = 'CacheSizeSet')] + [ValidateRange(1, 2147483647)] + [int] + ${CacheSizeInMB}, + + [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-SPPeoplePickerDistributionListSearchDomain +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${DomainName}, + + [ValidateRange(0, 2147483647)] + [int] + ${Index}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Add-SPPeoplePickerSearchADDomain +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${DomainName}, + + [switch] + ${IsForest}, + + [ValidateRange(0, 2147483647)] + [int] + ${Index}, + + [pscredential] + ${Credential}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Add-SPPeoplePickerServiceAccountDirectoryPath +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${OrganizationalUnitName}, + + [ValidateRange(0, 2147483647)] + [int] + ${Index}, + + [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[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-SPCertificateNotificationContact +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] + param( + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Clear-SPContentDatabaseSyncData +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [ValidateRange(0, 2147483647)] + [int] + ${DaysSinceLastProfileSync}, + + [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-SPPeoplePickerDistributionListSearchDomain +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Clear-SPPeoplePickerSearchADDomain +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Clear-SPPeoplePickerServiceAccountDirectoryPath +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [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}, + + [string] + ${DatabaseFailOverPartner}, + + [ValidateSet('Application', 'ApplicationWithSearch', 'Custom', 'DistributedCache', 'Search', 'SingleServerFarm', 'WebFrontEnd', 'WebFrontEndWithDistributedCache')] + [object] + ${LocalServerRole}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Convert-SPWebApplication +{ + [CmdletBinding()] + param( + [Parameter(Mandatory = $true, ValueFromPipeline = $true)] + [ValidateNotNull()] + [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}, + + [switch] + ${Force}, + + [switch] + ${RetainPermissions}, + + [ValidateNotNullOrEmpty()] + [string] + ${SourceSkipList}, + + [Parameter(ParameterSetName = 'Claims')] + [Parameter(ParameterSetName = 'ClaimOnline', Mandatory = $true)] + [Parameter(ParameterSetName = 'ClaimOnlineToOnline', Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${MapList}, + + [switch] + ${SkipSites}, + + [switch] + ${SkipPolicies}, + + [ValidateNotNull()] + [object] + ${Database}, + + [Parameter(ParameterSetName = 'Claims')] + [ValidateNotNull()] + [object] + ${TrustedProvider}, + + [Parameter(ParameterSetName = 'Claims')] + [Parameter(ParameterSetName = 'ClaimOnline', Mandatory = $true)] + [Parameter(ParameterSetName = 'ClaimOnlineToOnline', Mandatory = $true)] + [guid] + ${SiteSubsriptionId}, + + [Parameter(ParameterSetName = 'ClaimOnlineToOnline', Mandatory = $true)] + [guid] + ${SourceSiteSubscriptionId}, + + [ValidateNotNullOrEmpty()] + [string] + ${LoggingDirectory}, + + [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-SPContentTypes +{ + [CmdletBinding()] + param( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [uri] + ${LocalSiteUrl}, + + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [string] + ${LocalTermStoreName}, + + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [uri] + ${RemoteSiteUrl}, + + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [string[]] + ${ContentTypeNames}, + + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [pscredential] + ${Credential}, + + [string] + ${AuthEndpoint}, + + [string] + ${GraphApiEndPoint}, + + [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 Copy-SPTaxonomyGroups +{ + [CmdletBinding()] + param( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [string] + ${LocalTermStoreName}, + + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [uri] + ${RemoteSiteUrl}, + + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [uri] + ${LocalSiteUrl}, + + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [string[]] + ${GroupNames}, + + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [pscredential] + ${Credential}, + + [string] + ${AuthEndpoint}, + + [string] + ${GraphApiEndpoint}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Disable-ProjectServerLicense +{ + [CmdletBinding()] + param( + [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-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()] + param( + [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-SPUserSolutionAllowList +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] + 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 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-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-ProjectServerLicense +{ + [CmdletBinding()] + param( + [Parameter(Mandatory = $true, Position = 0)] + [ValidateNotNullOrEmpty()] + [string] + ${Key}, + + [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-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()] + param( + [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-SPUserSolutionAllowList +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] + 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 Enable-SPWebTemplateForSiteMaster +{ + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [object] + ${Template}, + + [int] + ${CompatibilityLevel}, + + [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-SPCacheClusterConfig +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Export-SPCertificate +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(ParameterSetName = 'Pfx', Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [Parameter(ParameterSetName = 'Cert/Pkcs7', Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName = 'Pfx', Mandatory = $true)] + [ValidateNotNull()] + [securestring] + ${Password}, + + [Parameter(ParameterSetName = 'Cert/Pkcs7', Mandatory = $true)] + [ValidateSet('Cert', 'Pkcs7')] + [string] + ${Type}, + + [Parameter(ParameterSetName = 'Pfx')] + [ValidateSet('AES256', 'TripleDes')] + [string] + ${EncryptionType}, + + [Parameter(ParameterSetName = 'Pfx')] + [Parameter(ParameterSetName = 'Cert/Pkcs7')] + [switch] + ${IncludeAllCertificatesInCertificationPath}, + + [Parameter(ParameterSetName = 'Pfx')] + [switch] + ${NoExtendedProperties}, + + [Parameter(ParameterSetName = 'Pfx')] + [Parameter(ParameterSetName = 'Cert/Pkcs7')] + [string] + ${Path}, + + [Parameter(ParameterSetName = 'Pfx')] + [Parameter(ParameterSetName = 'Cert/Pkcs7')] + [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-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-ProjectServerLicense +{ + [CmdletBinding()] + param( + [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-SPAvailabilityGroupStatus +{ + [CmdletBinding()] + param( + [string] + ${Identity}, + + [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-SPCache +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Get-SPCacheClusterHealth +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Get-SPCacheClusterInfo +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Get-SPCacheHost +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${HostName}, + + [Parameter(Mandatory = $true)] + [ValidateRange(1024, 65535)] + [int] + ${CachePort}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Get-SPCacheHostConfig +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${HostName}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Get-SPCacheStatistics +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${CacheName}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Get-SPCertificate +{ + [CmdletBinding(DefaultParameterSetName = 'SearchFilters', SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(ParameterSetName = 'Identity', Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName = 'SearchFilters')] + [string] + ${DisplayName}, + + [Parameter(ParameterSetName = 'SearchFilters')] + [string] + ${Thumbprint}, + + [Parameter(ParameterSetName = 'SearchFilters')] + [string] + ${SerialNumber}, + + [Parameter(ParameterSetName = 'SearchFilters')] + [ValidateSet('EndEntity', 'Intermediate', 'Pending', 'Root')] + [string] + ${Store}, + + [Parameter(ParameterSetName = 'SearchFilters')] + [switch] + ${InUse}, + + [Parameter(ParameterSetName = 'SearchFilters')] + [ValidateRange(-1, 825)] + [int] + ${DaysToExpiration}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Get-SPCertificateAuthority +{ + [CmdletBinding()] + param( + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Get-SPCertificateNotificationContact +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Position = 0)] + [string] + ${EmailAddress}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Get-SPCertificateSettings +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + 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 = 'ContentDatabasesSinceLastProfileSync', Mandatory = $true, ValueFromPipeline = $true)] + [ValidateRange(0, 2147483647)] + [int] + ${DaysSinceLastProfileSync}, + + [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 = 'DefaultSet')] + [Parameter(ParameterSetName = 'AllContentDatabasesInWebApplication')] + [Parameter(ParameterSetName = 'ContentDatabasesSinceLastProfileSync')] + [switch] + ${NoStatusFilter}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Get-SPContentDatabaseOrphanedData +{ + [CmdletBinding()] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [ValidateNotNullOrEmpty()] + [object] + ${Identity}, + + [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}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${SearchTopology}, + + [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-SPFlightsInfo +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(HelpMessage = 'Enter the specific flight Id.')] + [string] + ${FlightId}, + + [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-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)] + [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}, + + [switch] + ${SkipSiteUpgradeActionInfo}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Get-SPPeoplePickerConfig +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Get-SPPeoplePickerDistributionListSearchDomain +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [ValidateNotNullOrEmpty()] + [string] + ${DomainName}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Get-SPPeoplePickerSearchADDomain +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(ParameterSetName = 'BasicParameterSet', Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [Parameter(ParameterSetName = 'SpecificDomainParameterSet', Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName = 'SpecificDomainParameterSet', Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${DomainName}, + + [Parameter(ParameterSetName = 'SpecificDomainParameterSet')] + [switch] + ${IsForest}, + + [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-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-SPProjectReportingTimephasedMode +{ + [CmdletBinding()] + param( + [Parameter(Mandatory = $true, Position = 0)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [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-SPRemoteShareBlobStore +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(ParameterSetName = 'DefaultSet', Position = 0, ValueFromPipeline = $true)] + [ValidateNotNullOrEmpty()] + [object] + ${RemoteShareBlobStore}, + + [Parameter(ParameterSetName = 'ContentDatabase', Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [ValidateNotNullOrEmpty()] + [object] + ${ContentDatabase}, + + [Parameter(ParameterSetName = 'ContentDatabase', Position = 1, ValueFromPipeline = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [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-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-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-SPUserSolutionAllowList +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] + param( + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [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-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-SPCacheClusterConfig +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0)] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Import-SPCertificate +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [ValidateNotNull()] + [string] + ${Path}, + + [ValidateNotNull()] + [securestring] + ${Password}, + + [ValidateSet('EndEntity', 'Intermediate', 'Pending', 'Root')] + [string] + ${Store}, + + [switch] + ${Exportable}, + + [switch] + ${Replace}, + + [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-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}, + + [switch] + ${PreserveDeletedUserMetadataReferences}, + + [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 = 'Deploy', Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [Parameter(ParameterSetName = 'Synchronize', 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 Invoke-SPProjectRedactUser +{ + [CmdletBinding()] + param( + [Parameter(ParameterSetName = 'ByResourceIdWithoutUpdateName', Mandatory = $true)] + [Parameter(ParameterSetName = 'ByResourceIdWithUpdateName', Mandatory = $true)] + [Parameter(ParameterSetName = 'ByClaimsAccountWithoutUpdateName', Mandatory = $true)] + [Parameter(ParameterSetName = 'ByClaimsAccountWithUpdateName', Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(ParameterSetName = 'ByResourceIdWithoutUpdateName', Mandatory = $true)] + [Parameter(ParameterSetName = 'ByResourceIdWithUpdateName', Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [guid] + ${ResourceId}, + + [Parameter(ParameterSetName = 'ByClaimsAccountWithoutUpdateName', Mandatory = $true)] + [Parameter(ParameterSetName = 'ByClaimsAccountWithUpdateName', Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${ClaimsAccount}, + + [Parameter(ParameterSetName = 'ByResourceIdWithUpdateName', Mandatory = $true)] + [Parameter(ParameterSetName = 'ByClaimsAccountWithUpdateName', Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${UpdateDisplayName}, + + [Parameter(ParameterSetName = 'ByResourceIdWithUpdateName', Mandatory = $true)] + [Parameter(ParameterSetName = 'ByClaimsAccountWithUpdateName', Mandatory = $true)] + [bool] + ${RedactTimesheet}, + + [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 Merge-SPUsageLog +{ + [CmdletBinding()] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [object] + ${Identity}, + + [datetime] + ${StartTime}, + + [datetime] + ${EndTime}, + + [string[]] + ${Servers}, + + [switch] + ${Partial}, + + [string] + ${DiagnosticLogPath}, + + [switch] + ${OverWrite}, + + [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-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}, + + [Alias('NoB2BSiteUpgrade')] + [switch] + ${SkipSiteUpgrade}, + + [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-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-SPCertificate +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + [ValidateSet('Default', 'EndEntity', 'Intermediate', 'Pending', 'Root')] + [string] + ${NewStore}, + + [switch] + ${Force}, + + [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-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}, + + [string] + ${DatabaseServer}, + + [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-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-SPCache +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0)] + [ValidateNotNullOrEmpty()] + [string] + ${CacheName}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function New-SPCentralAdministration +{ + [CmdletBinding()] + param( + [Parameter(ParameterSetName = 'SetIisWebSiteBinding', Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [int] + ${Port}, + + [Parameter(ParameterSetName = 'SetAuthProvider', Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [Parameter(ParameterSetName = 'SetIisWebSiteBinding', Position = 1, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateSet('Kerberos', 'NTLM')] + [string] + ${WindowsAuthProvider}, + + [Parameter(ParameterSetName = 'SetIisWebSiteBinding', Position = 2, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] + ${SecureSocketsLayer}, + + [Parameter(ParameterSetName = 'SetIisWebSiteBinding', ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [Alias('Host')] + [ValidateNotNullOrEmpty()] + [string] + ${HostHeader}, + + [Parameter(ParameterSetName = 'SetIisWebSiteBinding', ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [object] + ${Certificate}, + + [Parameter(ParameterSetName = 'SetIisWebSiteBinding', ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] + ${UseServerNameIndication}, + + [Parameter(ParameterSetName = 'SetIisWebSiteBinding', ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] + ${AllowLegacyEncryption}, + + [Parameter(ParameterSetName = 'SetIisWebSiteBinding', ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [string] + ${Url}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function New-SPCertificate +{ + [CmdletBinding(DefaultParameterSetName = 'Default', SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(ParameterSetName = 'Default', Mandatory = $true)] + [Parameter(ParameterSetName = 'RSA', Mandatory = $true)] + [Parameter(ParameterSetName = 'ECC', Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${FriendlyName}, + + [Parameter(ParameterSetName = 'Default', Mandatory = $true)] + [Parameter(ParameterSetName = 'RSA', Mandatory = $true)] + [Parameter(ParameterSetName = 'ECC', Mandatory = $true)] + [ValidateLength(1, 64)] + [string] + ${CommonName}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [ValidateNotNullOrEmpty()] + [string[]] + ${AlternativeNames}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [ValidateLength(0, 64)] + [AllowEmptyString()] + [string] + ${OrganizationalUnit}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [ValidateLength(0, 64)] + [AllowEmptyString()] + [string] + ${Organization}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [ValidateLength(0, 128)] + [AllowEmptyString()] + [string] + ${Locality}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [ValidateLength(0, 128)] + [AllowEmptyString()] + [string] + ${State}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [ValidateLength(0, 2)] + [AllowEmptyString()] + [string] + ${Country}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [switch] + ${Exportable}, + + [Parameter(ParameterSetName = 'RSA')] + [ValidateSet('0', '2048', '4096', '8192', '16384')] + [int] + ${KeySize}, + + [Parameter(ParameterSetName = 'ECC')] + [ValidateSet('Default', 'nistP256', 'nistP384', 'nistP521')] + [object] + ${EllipticCurve}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [ValidateSet('Default', 'SHA256', 'SHA384', 'SHA512')] + [string] + ${HashAlgorithm}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [switch] + ${Force}, + + [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}, + + [object] + ${TrustedTokenIssuer}, + + [switch] + ${Enabled}, + + [switch] + ${Default}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function New-SPClaimsPrincipal +{ + [CmdletBinding(DefaultParameterSetName = 'IdentityType')] + param( + [Parameter(ParameterSetName = 'TrustIdentity', Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [Parameter(ParameterSetName = 'IdentityType', 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, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [string] + ${DatabaseName}, + + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${DatabaseServer}, + + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${AdministrationContentDatabaseName}, + + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [pscredential] + ${DatabaseCredentials}, + + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [pscredential] + ${FarmCredentials}, + + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [securestring] + ${Passphrase}, + + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] + ${SkipRegisterAsDistributedCacheHost}, + + [Parameter(ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [string] + ${DatabaseFailOverServer}, + + [ValidateSet('Application', 'ApplicationWithSearch', 'Custom', 'DistributedCache', 'Search', 'SingleServerFarm', 'WebFrontEnd', 'WebFrontEndWithDistributedCache')] + [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('eps')] + [System.Nullable[bool]] + ${ExpandSegments}, + + [Alias('lnw')] + [System.Nullable[bool]] + ${LanguageNeutralWordBreaker}, + + [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')] + [Parameter(ParameterSetName = 'DatabasePlacement')] + [string] + ${DatabaseUsername}, + + [Parameter(ParameterSetName = 'DefaultParameterSet')] + [Parameter(ParameterSetName = 'DatabasePlacement')] + [securestring] + ${DatabasePassword}, + + [Parameter(ParameterSetName = 'DefaultParameterSet')] + [string] + ${FailoverDatabaseServer}, + + [Parameter(ParameterSetName = 'DefaultParameterSet')] + [Parameter(ParameterSetName = 'DatabasePlacement')] + [switch] + ${Partitioned}, + + [Parameter(ParameterSetName = 'DefaultParameterSet', Mandatory = $true)] + [object] + ${ApplicationPool}, + + [Parameter(ParameterSetName = 'DefaultParameterSet')] + [object] + ${AdminApplicationPool}, + + [Parameter(ParameterSetName = 'DatabasePlacement', Mandatory = $true)] + [hashtable] + ${ParametersForDatabases}, + + [Parameter(ParameterSetName = 'DefaultParameterSet')] + [Parameter(ParameterSetName = 'DatabasePlacement')] + [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 = 'Default', Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [Parameter(ParameterSetName = 'Quota', Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [Parameter(ParameterSetName = 'NoQuota', 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-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 = 'StandardParameterSet', Mandatory = $true, Position = 0)] + [Parameter(ParameterSetName = 'CustomPropertyParameterSet', Mandatory = $true, Position = 0)] + [AllowEmptyString()] + [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 = '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(Mandatory = $true)] + [object] + ${ApplicationPool}, + + [Parameter(Mandatory = $true)] + [switch] + ${AuditingEnabled}, + + [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}, + + [string] + ${Name}, + + [switch] + ${PartitionMode}, + + [switch] + ${Sharing}, + + [switch] + ${DeferUpgradeActions}, + + [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)] + [ValidateNotNull()] + [ValidateLength(0, 100)] + [AllowEmptyString()] + [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 = 'BasicParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'ActiveDirectoryBackedParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'UPABackedParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'OIDCParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'OIDCMetadataParameterSetName', Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${Name}, + + [Parameter(ParameterSetName = 'BasicParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'ActiveDirectoryBackedParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'UPABackedParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'OIDCParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'OIDCMetadataParameterSetName', Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${Description}, + + [Parameter(ParameterSetName = 'BasicParameterSet')] + [Parameter(ParameterSetName = 'ActiveDirectoryBackedParameterSet')] + [Parameter(ParameterSetName = 'UPABackedParameterSet')] + [Parameter(ParameterSetName = 'OIDCParameterSet', Mandatory = $true)] + [ValidateNotNull()] + [object] + #[System.Security.Cryptography.X509Certificates.X509Certificate2[]] + ${ImportTrustCertificate}, + + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'OIDCMetadataParameterSetName', Mandatory = $true)] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, + + [Parameter(ParameterSetName = 'BasicParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'UPABackedParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'OIDCParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'OIDCMetadataParameterSetName', Mandatory = $true)] + [ValidateNotNull()] + [object[]] + ${ClaimsMappings}, + + [Parameter(ParameterSetName = 'BasicParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'ActiveDirectoryBackedParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'UPABackedParameterSet', Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${SignInUrl}, + + [Parameter(ParameterSetName = 'BasicParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'UPABackedParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'OIDCParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'OIDCMetadataParameterSetName', Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${IdentifierClaim}, + + [Parameter(ParameterSetName = 'BasicParameterSet')] + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet')] + [Parameter(ParameterSetName = 'OIDCParameterSet')] + [Parameter(ParameterSetName = 'OIDCMetadataParameterSetName')] + [object] + ${ClaimProvider}, + + [Parameter(ParameterSetName = 'BasicParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'ActiveDirectoryBackedParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'UPABackedParameterSet', Mandatory = $true)] + [ValidateNotNull()] + [string] + ${Realm}, + + [Parameter(ParameterSetName = 'BasicParameterSet')] + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet')] + [Parameter(ParameterSetName = 'ActiveDirectoryBackedParameterSet')] + [Parameter(ParameterSetName = 'UPABackedParameterSet')] + [switch] + ${UseWReply}, + + [Parameter(ParameterSetName = 'ActiveDirectoryBackedParameterSet', Mandatory = $true)] + [switch] + ${UseDefaultConfiguration}, + + [Parameter(ParameterSetName = 'UPABackedParameterSet', Mandatory = $true)] + [switch] + ${UseUPABackedClaimProvider}, + + [Parameter(ParameterSetName = 'ActiveDirectoryBackedParameterSet')] + [ValidateSet('EMAIL', 'USER-PRINCIPAL-NAME', 'ACCOUNT-NAME')] + [string] + ${IdentifierClaimIs}, + + [Parameter(ParameterSetName = 'BasicParameterSet')] + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet')] + [Parameter(ParameterSetName = 'ActiveDirectoryBackedParameterSet')] + [Parameter(ParameterSetName = 'UPABackedParameterSet')] + [Parameter(ParameterSetName = 'OIDCParameterSet', Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${SignOutUrl}, + + [Parameter(ParameterSetName = 'BasicParameterSet')] + [Parameter(ParameterSetName = 'ActiveDirectoryBackedParameterSet')] + [Parameter(ParameterSetName = 'UPABackedParameterSet')] + [Parameter(ParameterSetName = 'OIDCParameterSet', Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${RegisteredIssuerName}, + + [Parameter(ParameterSetName = 'OIDCParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'OIDCMetadataParameterSetName', Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${DefaultClientIdentifier}, + + [Parameter(ParameterSetName = 'OIDCParameterSet', Mandatory = $true)] + [uri] + ${AuthorizationEndPointUri}, + + [Parameter(ParameterSetName = 'OIDCParameterSet')] + [System.Collections.Generic.List[string]] + ${ResponseTypesSupported}, + + [Parameter(ParameterSetName = 'OIDCParameterSet')] + [Parameter(ParameterSetName = 'OIDCMetadataParameterSetName')] + [ValidateNotNullOrEmpty()] + [string] + ${Scope}, + + [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()] + [object] + #[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()] + [object] + #[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()] + [object] + #[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')] + [ValidateNotNullOrEmpty()] + [ValidateLength(1, 128)] + [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-SPUserSolutionAllowList +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] + param( + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + [object] + ${Site}, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${ListTitle}, + + [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}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${Certificate}, + + [switch] + ${UseServerNameIndication}, + + [switch] + ${AllowLegacyEncryption}, + + [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}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${Certificate}, + + [switch] + ${UseServerNameIndication}, + + [switch] + ${AllowLegacyEncryption}, + + [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 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}, + + [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-SPRemoteShareBlobStore +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [ValidateNotNullOrEmpty()] + [object] + ${ContentDatabase}, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [ValidateLength(8, 128)] + [string] + ${Name}, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [ValidateLength(5, 256)] + [string] + ${Location}, + + [pscredential] + ${BlobStoreCredential}, + + [ValidateRange(1000, 10000)] + [int] + ${PoolCapacity}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Register-SPVssWriter +{ + [CmdletBinding()] + param( + [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-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-SPApplicationCredentialKey +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] + param( + [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-SPCentralAdministration +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] + param( + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Remove-SPCertificate +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Remove-SPCertificateNotificationContact +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] + param( + [Parameter(Mandatory = $true, Position = 0)] + [string] + ${EmailAddress}, + + [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( + [switch] + ${Force}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Remove-SPConfigurationObject +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [guid] + ${Identity}, + + [switch] + ${Force}, + + [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-SPDatabaseFromAvailabilityGroup +{ + [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-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-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-SPPeoplePickerDistributionListSearchDomain +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${DomainName}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Remove-SPPeoplePickerSearchADDomain +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${DomainName}, + + [switch] + ${IsForest}, + + [string] + ${UserName}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Remove-SPPeoplePickerServiceAccountDirectoryPath +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${OrganizationalUnitName}, + + [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}, + + [bool] + ${CheckComplianceFlags}, + + [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}, + + [bool] + ${CheckComplianceFlags}, + + [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-SPCertificate +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory = $true)] + [ValidateNotNull()] + [string] + ${NewFriendlyName}, + + [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 Renew-SPCertificate +{ + [CmdletBinding(DefaultParameterSetName = 'Default', SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(ParameterSetName = 'Default', Mandatory = $true, Position = 0)] + [Parameter(ParameterSetName = 'RSA', Mandatory = $true, Position = 0)] + [Parameter(ParameterSetName = 'ECC', Mandatory = $true, Position = 0)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName = 'Default', Mandatory = $true)] + [Parameter(ParameterSetName = 'RSA', Mandatory = $true)] + [Parameter(ParameterSetName = 'ECC', Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${FriendlyName}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [ValidateLength(1, 64)] + [string] + ${CommonName}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [ValidateNotNullOrEmpty()] + [string[]] + ${AlternativeNames}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [ValidateLength(0, 64)] + [AllowEmptyString()] + [string] + ${OrganizationalUnit}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [ValidateLength(0, 64)] + [AllowEmptyString()] + [string] + ${Organization}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [ValidateLength(0, 128)] + [AllowEmptyString()] + [string] + ${Locality}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [ValidateLength(0, 128)] + [AllowEmptyString()] + [string] + ${State}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [ValidateLength(0, 2)] + [AllowEmptyString()] + [string] + ${Country}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [switch] + ${Exportable}, + + [Parameter(ParameterSetName = 'RSA')] + [ValidateSet('0', '2048', '4096', '8192', '16384')] + [int] + ${KeySize}, + + [Parameter(ParameterSetName = 'ECC')] + [ValidateSet('Default', 'nistP256', 'nistP384', 'nistP521')] + [object] + ${EllipticCurve}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [ValidateSet('Default', 'SHA256', 'SHA384', 'SHA512')] + [string] + ${HashAlgorithm}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [ValidateNotNullOrEmpty()] + [string] + ${Path}, + + [Parameter(ParameterSetName = 'Default')] + [Parameter(ParameterSetName = 'RSA')] + [Parameter(ParameterSetName = 'ECC')] + [switch] + ${Force}, + + [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-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 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-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 = 'WebHostCredential', Mandatory = $true)] + [Parameter(ParameterSetName = 'WebHostSetup', 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-SPApplicationCredentialKey +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [ValidateNotNull()] + [securestring] + ${Password}, + + [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 = 'NameValue')] + [Parameter(ParameterSetName = 'NameRemove')] + [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}, + + [switch] + ${SecureSocketsLayer}, + + [ValidateNotNullOrEmpty()] + [string] + ${HostHeader}, + + [object] + ${Certificate}, + + [switch] + ${UseServerNameIndication}, + + [switch] + ${AllowLegacyEncryption}, + + [string] + ${Url}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Set-SPCertificateSettings +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [string] + ${OrganizationalUnit}, + + [string] + ${Organization}, + + [string] + ${Locality}, + + [string] + ${State}, + + [string] + ${Country}, + + [ValidateSet('ECC', 'RSA')] + [object] + ${KeyAlgorithm}, + + [ValidateSet('0', '2048', '4096', '8192', '16384')] + [int] + ${KeySize}, + + [ValidateSet('Default', 'nistP256', 'nistP384', 'nistP521')] + [object] + ${EllipticCurve}, + + [ValidateSet('Default', 'SHA256', 'SHA384', 'SHA512')] + [string] + ${HashAlgorithm}, + + [ValidateSet('Default', 'Pkcs1', 'Pss')] + [object] + ${RsaSignaturePadding}, + + [ValidateRange(0, 825)] + [int] + ${CertificateExpirationAttentionThreshold}, + + [ValidateRange(0, 825)] + [int] + ${CertificateExpirationWarningThreshold}, + + [ValidateRange(0, 825)] + [int] + ${CertificateExpirationErrorThreshold}, + + [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}, + + [ValidateRange(1, 2147483647)] + [int] + ${MaxSiteCount}, + + [ValidateRange(0, 2147483647)] + [int] + ${WarningSiteCount}, + + [object] + ${Status}, + + [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] + ${FarmTelemetryEnabled}, + + [Parameter(ValueFromPipelineByPropertyName = $true)] + [string] + ${FarmTelemetryEmailAddress}, + + [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 = 'Daily', Mandatory = $true)] + [Parameter(ParameterSetName = 'Weekly')] + [Parameter(ParameterSetName = 'MonthlyDate')] + [Parameter(ParameterSetName = 'RemoveSchedule')] + [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 = 'Daily')] + [Parameter(ParameterSetName = 'Weekly')] + [Parameter(ParameterSetName = 'MonthlyDate')] + [Alias('duration')] + [System.Nullable[int]] + ${CrawlScheduleRepeatDuration}, + + [Parameter(ParameterSetName = 'Daily')] + [Parameter(ParameterSetName = 'Weekly')] + [Parameter(ParameterSetName = 'MonthlyDate')] + [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('eps')] + [System.Nullable[bool]] + ${ExpandSegments}, + + [Alias('lnw')] + [System.Nullable[bool]] + ${LanguageNeutralWordBreaker}, + + [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-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()] + [object] + #[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-SPMachineKey +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, ValueFromPipeline = $true)] + [ValidateNotNullOrEmpty()] + [object] + ${WebApplication}, + + [string] + ${DecryptionKey}, + + [string] + ${ValidationKey}, + + [switch] + ${Local}, + + [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 = 'Default', Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [Parameter(ParameterSetName = 'Quota', Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [Parameter(ParameterSetName = 'NoQuota', 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(ValueFromPipelineByPropertyName = $true)] + [bool] + ${HybridAppLauncherEnabled}, + + [Parameter(ValueFromPipelineByPropertyName = $true)] + [bool] + ${OnedriveDefaultToCloudEnabled}, + + [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}, + + [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-SPPeoplePickerConfig +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNull()] + [object] + ${WebApplication}, + + [string] + ${ActiveDirectoryCustomFilter}, + + [string] + ${ActiveDirectoryCustomQuery}, + + [ValidateRange(1, 2147483647)] + [int] + ${ActiveDirectorySearchTimeout}, + + [switch] + ${PeopleEditorOnlyResolveWithinSiteCollection}, + + [switch] + ${OnlySearchWithinSiteCollection}, + + [switch] + ${NoWindowsAccountsForNonWindowsAuthenticationMode}, + + [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}, + + [string] + ${UserPrincipalName}, + + [int] + ${UserRights}, + + [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-SPProjectPCSSettings +{ + [CmdletBinding()] + param( + [Parameter(ValueFromPipeline = $true)] + [Alias('sa')] + [object] + ${ServiceApplication}, + + [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]] + ${ResponseSizeLimits}, + + [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)] + [ValidateNotNullOrEmpty()] + [ValidateSet('SharePoint', 'ProjectServer')] + [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-SPProjectReportingTimephasedMode +{ + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [uri] + ${Url}, + + [Parameter(Mandatory = $true)] + [ValidateSet('Disabled', 'Daily', 'Weekly', 'Monthly', 'FiscalYear')] + [ValidateNotNullOrEmpty()] + [string] + ${TimephasedMode}, + + [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-SPRemoteShareBlobStore +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [ValidateNotNullOrEmpty()] + [object] + ${RemoteShareBlobStore}, + + [ValidateNotNullOrEmpty()] + [ValidateLength(5, 256)] + [string] + ${Location}, + + [pscredential] + ${BlobStoreCredential}, + + [ValidateRange(1000, 10000)] + [int] + ${PoolCapacity}, + + [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}, + + [ValidateNotNull()] + [ValidateRange(1, 65535)] + [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}, + + [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(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()] + [object] + #[System.Security.Cryptography.X509Certificates.X509Certificate2] + ${ImportSigningCertificate}, + + [Parameter(ParameterSetName = 'SigningCertificateReference')] + [string] + ${SigningCertificateThumbprint}, + + [Parameter(ParameterSetName = 'SigningCertificateReference')] + [string] + ${SigningCertificateStoreName}, + + [Parameter(ParameterSetName = 'SigningCertificateQueue')] + [ValidateNotNull()] + [object] + #[System.Security.Cryptography.X509Certificates.X509Certificate2] + ${QueueSigningCertificate}, + + [Parameter(ParameterSetName = 'SigningCertificateReference')] + [string] + ${QueueSigningCertificateThumbprint}, + + [Parameter(ParameterSetName = 'SigningCertificateReference')] + [string] + ${QueueSigningCertificateStoreName}, + + [Parameter(ParameterSetName = 'SigningCertificateRevoke')] + [ValidateNotNull()] + [object] + #[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-SPServer +{ + [CmdletBinding()] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [Alias('Address')] + [object] + ${Identity}, + + [object] + ${Status}, + + [ValidateSet('Application', 'ApplicationWithSearch', 'Custom', 'DistributedCache', 'Search', 'SingleServerFarm', 'WebFrontEnd', 'WebFrontEndWithDistributedCache')] + [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)] + [Parameter(ParameterSetName = 'SslCertificateReferenceRunInProcess', 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 = 'SslCertificateReference')] + [Parameter(ParameterSetName = 'SslCertificateImport')] + [ValidateRange(1, 65535)] + [int] + ${NetTcpPort}, + + [Parameter(ParameterSetName = 'SslCertificateReference', Mandatory = $true)] + [Parameter(ParameterSetName = 'SslCertificateReferenceRunInProcess', Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${SslCertificateThumbprint}, + + [Parameter(ParameterSetName = 'SslCertificateReference')] + [Parameter(ParameterSetName = 'SslCertificateReferenceRunInProcess')] + [ValidateNotNullOrEmpty()] + [string] + ${SslCertificateStoreName}, + + [Parameter(ParameterSetName = 'SslCertificateImport')] + [ValidateNotNull()] + [object] + #[System.Security.Cryptography.X509Certificates.X509Certificate2] + ${ImportSslCertificate}, + + [Parameter(ParameterSetName = 'SslCertificateReference')] + [Parameter(ParameterSetName = 'SslCertificateImport')] + [switch] + ${AllowLegacyEncryption}, + + [Parameter(ParameterSetName = 'SslCertificateReference')] + [Parameter(ParameterSetName = 'SslCertificateImport')] + [switch] + ${NoWait}, + + [Parameter(ParameterSetName = 'SslCertificateReferenceRunInProcess', Mandatory = $true)] + [switch] + ${RunInProcess}, + + [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 = 'MetadataEndPointParameterSet', Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [Parameter(ParameterSetName = 'ImportCertificateParameterSet', Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [Parameter(ParameterSetName = 'OIDCParameterSet', Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(ParameterSetName = 'BasicParameterSet')] + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet')] + [Parameter(ParameterSetName = 'ImportCertificateParameterSet')] + [Parameter(ParameterSetName = 'OIDCParameterSet')] + [ValidateNotNullOrEmpty()] + [string] + ${Description}, + + [Parameter(ParameterSetName = 'ImportCertificateParameterSet', Mandatory = $true)] + [Parameter(ParameterSetName = 'OIDCParameterSet')] + [ValidateNotNull()] + [System.Security.Cryptography.X509Certificates.X509Certificate2[]] + ${ImportTrustCertificate}, + + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet', Mandatory = $true)] + [ValidateNotNull()] + [uri] + ${MetadataEndPoint}, + + [Parameter(ParameterSetName = 'BasicParameterSet')] + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet')] + [Parameter(ParameterSetName = 'ImportCertificateParameterSet')] + [Parameter(ParameterSetName = 'OIDCParameterSet')] + [object[]] + ${ClaimsMappings}, + + [Parameter(ParameterSetName = 'BasicParameterSet')] + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet')] + [Parameter(ParameterSetName = 'ImportCertificateParameterSet')] + [ValidateNotNullOrEmpty()] + [string] + ${SignInUrl}, + + [Parameter(ParameterSetName = 'BasicParameterSet')] + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet')] + [Parameter(ParameterSetName = 'ImportCertificateParameterSet')] + [Parameter(ParameterSetName = 'OIDCParameterSet')] + [ValidateNotNullOrEmpty()] + [string] + ${SignOutUrl}, + + [Parameter(ParameterSetName = 'BasicParameterSet')] + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet')] + [Parameter(ParameterSetName = 'ImportCertificateParameterSet')] + [Parameter(ParameterSetName = 'OIDCParameterSet')] + [object] + ${ClaimProvider}, + + [Parameter(ParameterSetName = 'BasicParameterSet')] + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet')] + [Parameter(ParameterSetName = 'ImportCertificateParameterSet')] + [string] + ${Realm}, + + [Parameter(ParameterSetName = 'BasicParameterSet')] + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet')] + [Parameter(ParameterSetName = 'ImportCertificateParameterSet')] + [switch] + ${UseWReply}, + + [Parameter(ParameterSetName = 'OIDCParameterSet', Mandatory = $true)] + [switch] + ${IsOpenIDConnect}, + + [Parameter(ParameterSetName = 'BasicParameterSet')] + [Parameter(ParameterSetName = 'MetadataEndPointParameterSet')] + [Parameter(ParameterSetName = 'ImportCertificateParameterSet')] + [Parameter(ParameterSetName = 'OIDCParameterSet')] + [string] + ${RegisteredIssuerName}, + + [Parameter(ParameterSetName = 'OIDCParameterSet')] + [ValidateNotNullOrEmpty()] + [string] + ${DefaultClientIdentifier}, + + [Parameter(ParameterSetName = 'OIDCParameterSet')] + [uri] + ${AuthorizationEndPointUri}, + + [Parameter(ParameterSetName = 'OIDCParameterSet')] + [System.Collections.Generic.List[string]] + ${ResponseTypesSupported}, + + [Parameter(ParameterSetName = 'OIDCParameterSet')] + [ValidateNotNullOrEmpty()] + [string] + ${Scope}, + + [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()] + [object] + #[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()] + [object] + #[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()] + [object] + #[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}, + + [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.')] + [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)] + [Parameter(ParameterSetName = 'UpdateIISSettings', Mandatory = $true)] + [object] + ${Zone}, + + [Parameter(ParameterSetName = 'UpdateGeneralSettings')] + [int] + ${DefaultTimeZone}, + + [Parameter(ParameterSetName = 'UpdateGeneralSettings')] + [string] + ${DefaultQuotaTemplate}, + + [Parameter(ParameterSetName = 'UpdateMailSettings', Mandatory = $true)] + [AllowNull()] + [string] + ${SMTPServer}, + + [Parameter(ParameterSetName = 'UpdateMailSettings')] + [int] + ${SMTPServerPort}, + + [Parameter(ParameterSetName = 'UpdateMailSettings')] + [string] + ${OutgoingEmailAddress}, + + [Parameter(ParameterSetName = 'UpdateMailSettings')] + [string] + ${ReplyToEmailAddress}, + + [Parameter(ParameterSetName = 'UpdateMailSettings')] + [pscredential] + ${SMTPCredentials}, + + [Parameter(ParameterSetName = 'UpdateMailSettings')] + [switch] + ${DisableSMTPEncryption}, + + [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}, + + [Parameter(ParameterSetName = 'UpdateClaimSettings')] + [switch] + ${Force}, + + [Parameter(ParameterSetName = 'UpdateIISSettings')] + [switch] + ${SecureSocketsLayer}, + + [Parameter(ParameterSetName = 'UpdateIISSettings')] + [ValidateNotNullOrEmpty()] + [string] + ${HostHeader}, + + [Parameter(ParameterSetName = 'UpdateIISSettings', ValueFromPipeline = $true)] + [Parameter(ParameterSetName = 'UpdateMailSettings', ValueFromPipeline = $true)] + [object] + ${Certificate}, + + [Parameter(ParameterSetName = 'UpdateIISSettings')] + [switch] + ${UseServerNameIndication}, + + [Parameter(ParameterSetName = 'UpdateIISSettings')] + [switch] + ${AllowLegacyEncryption}, + + [Parameter(ParameterSetName = 'UpdateIISSettings', Mandatory = $true)] + [ValidateRange(1, 65535)] + [int] + ${Port}, + + [Parameter(ParameterSetName = 'UpdateIISSettings')] + [string] + ${Url}, + + [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 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-SPCacheCluster +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [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}, + + [switch] + ${IncludeCustomServerRole}, + + [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-SPCacheCluster +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Stop-SPContentTypeReplication +{ + [CmdletBinding()] + param( + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Stop-SPDiagnosticsSession +{ + [CmdletBinding()] + param( + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Stop-SPDistributedCacheServiceInstance +{ + [CmdletBinding()] + param( + [Parameter(ValueFromPipeline = $true)] + [object] + ${Identity}, + + [Parameter(ParameterSetName = 'GracefulShutdown', Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [switch] + ${Graceful}, + + [Parameter(ParameterSetName = 'GracefulShutdown')] + [switch] + ${Force}, + + [Parameter(ParameterSetName = 'GracefulShutdown')] + [int] + ${Timeout}, + + [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}, + + [switch] + ${IncludeCustomServerRole}, + + [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 Stop-SPTaxonomyReplication +{ + [CmdletBinding()] + param( + [Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [pscredential] + ${Credential}, + + [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 Switch-SPBlobStorage +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(ParameterSetName = 'SQL', Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [ValidateNotNullOrEmpty()] + [object] + ${ContentDatabase}, + + [Parameter(ParameterSetName = 'SQL', Mandatory = $true)] + [switch] + ${SQL}, + + [Parameter(ParameterSetName = 'RemoteShareBlobStore', Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [object] + ${RemoteShareBlobStore}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Switch-SPCertificate +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [ValidateNotNull()] + [object] + ${Identity}, + + [Parameter(Mandatory = $true, Position = 1)] + [AllowNull()] + [object] + ${NewCertificate}, + + [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)] + [ValidateNotNullOrEmpty()] + [ValidateSet('Full', 'Incremental')] + [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-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-SPRemoteShareBlobStore +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [ValidateNotNullOrEmpty()] + [object] + ${ContentDatabase}, + + [ValidateNotNullOrEmpty()] + [string] + ${LogPath}, + + [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 Unregister-SPRemoteShareBlobStore +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')] + param( + [Parameter(Mandatory = $true, Position = 0, ValueFromPipeline = $true)] + [ValidateNotNullOrEmpty()] + [object] + ${RemoteShareBlobStore}, + + [switch] + ${Force}, + + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} + + +function Unregister-SPVssWriter +{ + [CmdletBinding()] + param( + [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-SPAzureBlobConfigLocatorEx1 +{ + [CmdletBinding()] + param( + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}, + + [Parameter(ParameterSetName = 'default', Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [byte[]] + ${Locator}) + + +} + + +function Update-SPDataRetrievalServiceConfig +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(ParameterSetName = 'WebApplication', Mandatory = $true, Position = 0, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] + [ValidateNotNullOrEmpty()] + [object] + ${WebApplication}, + + [Parameter(ParameterSetName = 'WebApplication')] + [switch] + ${Inherit}, + + [Parameter(ParameterSetName = 'Farm', Mandatory = $true, Position = 0)] + [switch] + ${Farm}, + + [bool] + ${Enable}, + + [ValidateRange(0, 100000)] + [int] + ${LimitResponseSize}, + + [bool] + ${EnableUpdateSupport}, + + [ValidateRange(1, 100000)] + [int] + ${DataSourceTimeout}, + + [bool] + ${EnableDataSourceControls}, + + [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-SPFlightsConfigFile +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, HelpMessage = 'Enter Flights config file path.')] + [string] + ${FilePath}, + + [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-SPMachineKey +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Mandatory = $true, ValueFromPipeline = $true)] + [ValidateNotNullOrEmpty()] + [object] + ${WebApplication}, + + [switch] + ${Local}, + + [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-SPProfileSync +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(Position = 0, ValueFromPipeline = $true)] + [ValidateNotNull()] + [string] + ${ExcludeWebApplications}, + + [Parameter(Position = 1, ValueFromPipeline = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${SynchronizationTiming}, + + [Parameter(Position = 2, ValueFromPipeline = $true)] + [ValidateNotNullOrEmpty()] + [string] + ${SweepTiming}, + + [Parameter(Position = 3, ValueFromPipeline = $true)] + [ValidateNotNullOrEmpty()] + [bool] + ${IgnoreIsActive}, + + [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 = 'Default', ValueFromPipeline = $true)] + [Parameter(ParameterSetName = 'FollowableList', Mandatory = $true, 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-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}, + + [Alias('NoB2BSiteUpgrade')] + [switch] + ${SkipSiteUpgrade}, + + [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}, + + [Alias('NoB2BSiteUpgrade')] + [switch] + ${SkipSiteUpgrade}, + + [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-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 Use-SPCacheCluster +{ + [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'Medium')] + param( + [Parameter(ValueFromPipeline = $true)] + [object] + ${AssignmentCollection}) + + +} diff --git a/tests/Unit/UnitTestHelper.psm1 b/tests/Unit/UnitTestHelper.psm1 index 7a003a314..f6c302317 100644 --- a/tests/Unit/UnitTestHelper.psm1 +++ b/tests/Unit/UnitTestHelper.psm1 @@ -137,10 +137,22 @@ function Write-SPDscStubFile $SharePointStubPath ) - Add-PSSnapin Microsoft.SharePoint.PowerShell + $installedVersion = Get-SPDscInstalledProductVersion + if ($installedVersion.ProductMajorPart -eq 15 -or $installedVersion.ProductBuildPart -le 12999) + { + # SharePoint 2013, 2016 or 2019 + Add-PSSnapin Microsoft.SharePoint.PowerShell + $sourceModule = "Microsoft.SharePoint.PowerShell" + } + else + { + # SharePoint Server Subscription Edition + $sourceModule = "SharePointServer" + Import-Module $sourceModule + } $SPStubContent = ((Get-Command | Where-Object -FilterScript { - $_.Source -eq "Microsoft.SharePoint.PowerShell" + $_.Source -eq $sourceModule } ) | ForEach-Object -Process { $signature = $null $command = $_ @@ -163,7 +175,8 @@ function Write-SPDscStubFile $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 = $line -replace "\[Microsoft\.[a-zA-Z.+0-9]+\[\]\]", "[object[]]" + $line = $line -replace "\[Microsoft\.[a-zA-Z.+0-9]+\]", "[object]" $line | Out-File -FilePath $SharePointStubPath -Encoding utf8 -Append }