From 7d9d1e0f578a811590d2307c415f3901bd2c6fed Mon Sep 17 00:00:00 2001 From: Yorick Kuijs Date: Thu, 4 Feb 2021 20:52:45 +0100 Subject: [PATCH 01/14] Add Export-SPDscDiagnosticData --- CHANGELOG.md | 2 + .../SharePointDsc.Util.psd1 | 1 + .../SharePointDsc.Util.psm1 | 155 ++++++++++++++++++ SharePointDsc/SharePointDsc.psd1 | 1 + 4 files changed, 159 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3840c251e..3f0737412 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - SharePointDsc - Fixed regression in v4.5 + - Added Export-SPDscDiagnosticData cmdlet to create a diagnostic package which can + easily be shared for troubleshooting ## [4.5.0] - 2021-01-30 diff --git a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psd1 b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psd1 index c9a014600..ed875413a 100644 --- a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psd1 +++ b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psd1 @@ -42,6 +42,7 @@ 'Convert-SPDscHashtableToString', 'ConvertTo-ReverseString', 'ConvertTo-TwoDigitFlipString', + 'Export-SPDscDiagnosticData', 'Format-OfficePatchGUID', 'Get-SPDscAssemblyVersion', 'Get-SPDscBuildVersion', diff --git a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 index f4b68e382..242d0d49b 100644 --- a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 +++ b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 @@ -1665,3 +1665,158 @@ function Start-SharePointDSCExtract Write-Host -Object " - We couldn't detect a SharePoint installation on this machine. Please execute the SharePoint ReverseDSC script on an existing SharePoint server." -BackgroundColor Red -ForegroundColor Black } } + +function Export-SPDscDiagnosticData +{ + [CmdletBinding(DefaultParametersetName = 'None')] + param + ( + [Parameter(Mandatory = $true, Position = 0)] + [System.String] + $ExportFilePath, + + [Parameter()] + [System.UInt32] + $NumberOfDays = 7, + + [Parameter(ParameterSetName = 'Anon')] + [Switch] + $Anonymize, + + [Parameter(ParameterSetName = 'Anon', Mandatory = $true)] + [System.String] + $Server, + + [Parameter(ParameterSetName = 'Anon', Mandatory = $true)] + [System.String] + $Domain, + + [Parameter(ParameterSetName = 'Anon', Mandatory = $true)] + [System.String] + $Url + ) + Write-Host 'Exporting logging information' -ForegroundColor Yellow + + if (([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") -eq $false) + { + Write-Host -Object "[ERROR] You need to run this cmdlet with Administrator privileges!" -ForegroundColor Red + return + } + + $afterDate = (Get-Date).AddDays(($NumberOfDays * -1)) + + # Create Temp folder + $guid = [Guid]::NewGuid() + $tempPath = Join-Path -Path $env:TEMP -ChildPath $guid + $null = New-Item -Path $tempPath -ItemType 'Directory' + + # Copy DSC Verbose Logs + Write-Host ' * Copying DSC Verbose Logs' -ForegroundColor Gray + $logPath = Join-Path -Path $tempPath -ChildPath 'DSCLogs' + $null = New-Item -Path $logPath -ItemType 'Directory' + + $sourceLogPath = Join-Path -Path $env:windir -ChildPath 'System32\Configuration\ConfigurationStatus' + $items = Get-ChildItem -Path "$sourceLogPath\*.json" | Where-Object { $_.LastWriteTime -gt $afterDate } + Copy-Item -Path $items -Destination $logPath -ErrorAction 'SilentlyContinue' #-ErrorVariable $err + + if ($Anonymize.IsPresent) + { + Write-Host ' * Anonymizing DSC Verbose Logs' -ForegroundColor Gray + foreach ($file in (Get-ChildItem -Path $logPath)) + { + $content = Get-Content -Path $file.FullName -Raw -Encoding Unicode + $content = $content -replace $Domain, '[DOMAIN]' -replace $Url, 'fqdn.com' -replace $Server, '[SERVER]' + Set-Content -Path $file.FullName -Value $content + } + } + + # Export SPDsc event log + Write-Host ' * Exporting DSC Event Log' -ForegroundColor Gray + $evtExportLog = Join-Path -Path $tempPath -ChildPath 'SPDsc.csv' + + try + { + Get-EventLog -LogName 'SPDsc' -After $afterDate | Export-Csv $evtExportLog -NoTypeInformation + if ($Anonymize.IsPresent) + { + Write-Host ' * Anonymizing DSC Event Log' -ForegroundColor Gray + $newLog = Import-Csv $evtExportLog + foreach ($entry in $newLog) + { + $entry.MachineName = "[SERVER]" + $entry.UserName = "[USER]" + $entry.Message = $entry.Message -replace $Domain, '[DOMAIN]' -replace $Url, 'fqdn.com' -replace $Server, '[SERVER]' + } + + $newLog | Export-Csv -Path $evtExportLog -NoTypeInformation + } + } + catch + { + $txtExportLog = Join-Path -Path $tempPath -ChildPath 'SPDsc.txt' + Add-Content -Value 'SPDsc event log does not exist!' -Path $txtExportLog + } + + # PowerShell Version + Write-Host ' * Exporting PowerShell Version info' -ForegroundColor Gray + $psInfoFile = Join-Path -Path $tempPath -ChildPath 'PSInfo.txt' + $PSVersionTable | Out-File -FilePath $psInfoFile + + # OS Version + Write-Host ' * Exporting OS Version info' -ForegroundColor Gray + $computerInfoFile = Join-Path -Path $tempPath -ChildPath 'OSInfo.txt' + + Get-ComputerInfo -Property @( + 'OsName', + 'OsOperatingSystemSKU', + 'OSArchitecture', + 'WindowsVersion', + 'WindowsBuildLabEx', + 'OsLanguage', + 'OsMuiLanguages') | Out-File -FilePath $computerInfoFile + + # LCM settings + Write-Host ' * Exporting LCM Configuration info' -ForegroundColor Gray + $lcmInfoFile = Join-Path -Path $tempPath -ChildPath 'LCMInfo.txt' + Get-DscLocalConfigurationManager | Out-File -FilePath $lcmInfoFile + + # Creating export package + Write-Host ' * Creating Zip file with all collected information' -ForegroundColor Gray + + if ((Split-Path -Path $ExportFilePath -Leaf) -like "*.*") + { + # ExportFilePath is file + if ($ExportFilePath -match ".zip$") + { + $exportFilename = $ExportFilePath + } + else + { + # ExportFilePath does not have zip extension, correct to zip + $exportFilename = $ExportFilePath -replace "\..*$", '.zip' + } + + $parentFolder = Split-Path -Path $ExportFilePath + if ((Test-Path -Path $parentFolder) -eq $false) + { + $null = New-Item -Path $parentFolder -ItemType Directory + } + } + else + { + # ExportFilePath is folder + $exportFilename = Join-Path -Path $ExportFilePath -ChildPath 'SPDsc.zip' + + if ((Test-Path -Path $ExportFilePath) -eq $false) + { + $null = New-Item -Path $ExportFilePath -ItemType Directory + } + } + Compress-Archive -Path $tempPath -DestinationPath $exportFilename -Force + + # Cleaning up temporary data + Write-Host ' * Removing temporary data' -ForegroundColor Gray + Remove-Item $tempPath -Recurse -Force -Confirm:$false + + Write-Host ('Completed with export. Information exported to {0}' -f $exportFilename) -ForegroundColor Yellow +} diff --git a/SharePointDsc/SharePointDsc.psd1 b/SharePointDsc/SharePointDsc.psd1 index 858d59f0b..dd775e831 100644 --- a/SharePointDsc/SharePointDsc.psd1 +++ b/SharePointDsc/SharePointDsc.psd1 @@ -81,6 +81,7 @@ 'Convert-SPDscHashtableToString', 'ConvertTo-ReverseString', 'ConvertTo-TwoDigitFlipString', + 'Export-SPDscDiagnosticData', 'Format-OfficePatchGUID', 'Get-SPDscDBForAlias', 'Get-SPDscAssemblyVersion', From 7b6344267fa17023c1172ae55e38fcd95d3813b3 Mon Sep 17 00:00:00 2001 From: Yorick Kuijs Date: Fri, 5 Feb 2021 12:56:47 +0100 Subject: [PATCH 02/14] Fixed issue #1268 --- CHANGELOG.md | 2 + .../MSFT_SPSearchResultSource.schema.mof | 2 +- .../MSFT_SPSearchResultSource/readme.md | 2 +- .../SPSearchResultSource/1-Example.ps1 | 63 ------------------ .../SPSearchResultSource/1-RemoteExample.ps1 | 65 ++++++++++++++++++ .../SPSearchResultSource/2-SSAExample.ps1 | 66 +++++++++++++++++++ 6 files changed, 135 insertions(+), 65 deletions(-) delete mode 100644 SharePointDsc/Examples/Resources/SPSearchResultSource/1-Example.ps1 create mode 100644 SharePointDsc/Examples/Resources/SPSearchResultSource/1-RemoteExample.ps1 create mode 100644 SharePointDsc/Examples/Resources/SPSearchResultSource/2-SSAExample.ps1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f0737412..5e244d77a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed regression in v4.5 - Added Export-SPDscDiagnosticData cmdlet to create a diagnostic package which can easily be shared for troubleshooting +- SPSearchResultSource + - Clarified the use of ScopeName and ScopeUrl with SSA as ScopeName and added examples ## [4.5.0] - 2021-01-30 diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.schema.mof index ad46ff438..a724a89b3 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.schema.mof @@ -3,7 +3,7 @@ class MSFT_SPSearchResultSource : OMI_BaseResource { [Key, Description("The name of the result source")] String Name; [Key, Description("The scope at which the Result Source will be created. Options are SSA, SPSite or SPWeb"), ValueMap{"SSA","SPSite","SPWeb"}, Values{"SSA","SPSite","SPWeb"}] String ScopeName; - [Key, Description("The URI of the site where to create the result source. Leave empty to have it created globally")] String ScopeUrl; + [Key, Description("The URI of the site where to create the result source. Use 'Global' is ScopeName is SSA")] String ScopeUrl; [Required, Description("The name of the search service application to associate this result source with")] String SearchServiceAppName; [Required, Description("The query to pass to the provider source")] String Query; [Required, Description("The provider type to use for the result source")] String ProviderType; diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/readme.md b/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/readme.md index 28fa3579c..34580447a 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/readme.md +++ b/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/readme.md @@ -23,7 +23,7 @@ The default value for the Ensure parameter is Present. When not specifying this parameter, the result source is created. To define a result source as global, use the value 'SSA' as the ScopeName -value. +value and 'Global' as the ScopeUrl value (the parameter needs to have a value). ## Script diff --git a/SharePointDsc/Examples/Resources/SPSearchResultSource/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPSearchResultSource/1-Example.ps1 deleted file mode 100644 index a15fdf9db..000000000 --- a/SharePointDsc/Examples/Resources/SPSearchResultSource/1-Example.ps1 +++ /dev/null @@ -1,63 +0,0 @@ - -<#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 create a remote sharepoint search result source - -#> - - Configuration Example - { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSearchResultSource RemoteSharePointFarm - { - Name = "External SharePoint results" - ScopeName = "SPSite" - ScopeUrl = "https://SharePoint.contoso.com" - SearchServiceAppName = "Search Service Application" - Query = "{searchTerms}" - ProviderType = "Remote SharePoint Provider" - PsDscRunAsCredential = $SetupAccount - } - } - } diff --git a/SharePointDsc/Examples/Resources/SPSearchResultSource/1-RemoteExample.ps1 b/SharePointDsc/Examples/Resources/SPSearchResultSource/1-RemoteExample.ps1 new file mode 100644 index 000000000..fc59bf36a --- /dev/null +++ b/SharePointDsc/Examples/Resources/SPSearchResultSource/1-RemoteExample.ps1 @@ -0,0 +1,65 @@ + +<#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 create a remote sharepoint search result source + +#> + +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + Import-DscResource -ModuleName SharePointDsc + + node localhost + { + SPSearchResultSource RemoteSharePointFarm + { + Name = "External SharePoint results" + ScopeName = "SPSite" + ScopeUrl = "https://SharePoint.contoso.com" + SearchServiceAppName = "Search Service Application" + Query = "{searchTerms}" + ProviderType = "Remote SharePoint Provider" + PsDscRunAsCredential = $SetupAccount + } + } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchResultSource/2-SSAExample.ps1 b/SharePointDsc/Examples/Resources/SPSearchResultSource/2-SSAExample.ps1 new file mode 100644 index 000000000..3428c1c5b --- /dev/null +++ b/SharePointDsc/Examples/Resources/SPSearchResultSource/2-SSAExample.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 example shows how to create a Search Service Application scoped + sharepoint search result source + +#> + +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + Import-DscResource -ModuleName SharePointDsc + + node localhost { + SPSearchResultSource Intranet + { + Name = "Intranet" + ScopeName = "SSA" + ScopeUrl = "Global" + SearchServiceAppName = "Search Service Application" + Query = '{searchTerms}' + ProviderType = "Local SharePoint Provider" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount + } + } +} From 30f418740f51c7d398747f8f209fd0ec0fb0b7e2 Mon Sep 17 00:00:00 2001 From: Yorick Kuijs Date: Fri, 5 Feb 2021 16:54:50 +0100 Subject: [PATCH 03/14] Implemented unit tests and updated examples identation --- .../SPAccessServiceApp/1-CreateServiceApp.ps1 | 7 +- .../SPAccessServiceApp/2-RemoveServiceApp.ps1 | 7 +- .../1-CreateServiceApp.ps1 | 33 ++--- .../2-RemoveServiceApp.ps1 | 35 ++--- .../SPAlternateUrl/1-CreateAlternateUrl.ps1 | 39 +++--- .../SPAlternateUrl/2-RemoveAlternateUrl.ps1 | 7 +- .../1-SetAntivirusConfig.ps1 | 41 +++--- .../SPAppCatalog/1-SetSiteAsAppCatalog.ps1 | 33 ++--- .../SPAppDomain/1-SetAppDomainDetails.ps1 | 33 ++--- .../1-CreateServiceApp.ps1 | 37 +++--- .../2-RemoveServiceApp.ps1 | 35 ++--- .../1-EnableSharePointAppStore.ps1 | 7 +- .../SPAppStoreSettings/2-EnableAppStores.ps1 | 35 ++--- .../SPAppStoreSettings/3-DisableAppStores.ps1 | 35 ++--- .../SPAuthenticationRealm/1-Example.ps1 | 33 ++--- .../1-CreateServiceApplicationProxy.ps1 | 8 +- .../SPBCSServiceApp/1-CreateServiceApp.ps1 | 37 +++--- .../SPBCSServiceApp/2-RemoveServiceApp.ps1 | 35 ++--- .../1-ApplyBlobCacheConfig.ps1 | 43 +++--- .../SPCacheAccounts/1-SetCacheAccounts.ps1 | 7 +- .../2-SetCacheAccountsNoPolicy.ps1 | 37 +++--- .../SPConfigWizard/1-RunConfigWizard.ps1 | 7 +- .../2-RunConfigWizardInWindow.ps1 | 35 ++--- .../1-AddContentDatabase.ps1 | 41 +++--- .../2-RemoveContentDatabase.ps1 | 37 +++--- .../Resources/SPDatabaseAAG/1-AddDBtoAAG.ps1 | 35 ++--- .../SPDatabaseAAG/2-AddMultipleDBstoAAG.ps1 | 35 ++--- .../SPDatabaseAAG/3-RemoveDBfromAAG.ps1 | 35 ++--- .../1-ApplyDesignerConfig.ps1 | 47 +++---- .../1-ApplyLoggingSettings.ps1 | 67 +++++----- .../SPDiagnosticsProvider/1-Configure.ps1 | 39 +++--- .../1-ConfigureClientSettings.ps1 | 91 ++++++------- .../2-ConfigureClientSettings 2016.ps1 | 121 ++++++++--------- .../1-SingleServerCache.ps1 | 37 +++--- .../2-CacheNoFirewall.ps1 | 37 +++--- .../3-MultiServerCache.ps1 | 112 ++++++++-------- .../SPDocIcon/1-ConfigureDocIcon.ps1 | 7 +- .../Resources/SPDocIcon/2-RemoveDocIcon.ps1 | 7 +- .../SPExcelServiceApp/1-CreateServiceApp.ps1 | 33 ++--- .../SPExcelServiceApp/2-RemoveServiceApp.ps1 | 35 ++--- .../Resources/SPFarm/1-CreateBasicFarm.ps1 | 59 +++++---- .../SPFarm/2-CreateCustomCentralAdmin.ps1 | 63 ++++----- .../SPFarm/3-CreateFarmWithServerRole.ps1 | 61 ++++----- ...eBasicFarmWithApplicationCredentialKey.ps1 | 30 ++--- .../1-SetSpecificAdmins.ps1 | 33 ++--- .../2-SetIncludeExcludeAdmins.ps1 | 35 ++--- .../SPFarmSolution/1-DeploySolution.ps1 | 39 +++--- .../Resources/SPFeature/1-EnableFeature.ps1 | 37 +++--- .../Resources/SPFeature/2-DisableFeature.ps1 | 9 +- .../1-DisableHealthRule.ps1 | 39 +++--- .../1-EnableAutomaticMode.ps1 | 17 ++- .../2-Enable-AdvancedMode.ps1 | 19 +-- .../1-Configure.ps1 | 55 ++++---- .../SPInstall/1-InstallToDefaultPath.ps1 | 33 ++--- .../SPInstall/2-InstallToCustomPath.ps1 | 37 +++--- .../SPInstall/3-InstallSPFoundation.ps1 | 39 +++--- .../1-InstallLanguagePack.ps1 | 31 +++-- .../2-InstallLanguagePackInWindow.ps1 | 35 ++--- .../SPInstallPrereqs/1-OnlineInstall.ps1 | 33 ++--- .../2-OfflineInstall_SP2013.ps1 | 57 ++++---- .../3-OfflineInstall_SP2016.ps1 | 57 ++++---- .../SPIrmSettings/1-ApplyIRMSConfig.ps1 | 33 ++--- .../1-SetAreaAndCategorytoCustomValue.ps1 | 19 +-- .../SPLogLevel/2-SetAreatoDefaultValue.ps1 | 19 +-- .../3-SetMultipleCategoriestoCustomValues.ps1 | 27 ++-- .../1-CreateServiceApp.ps1 | 19 +-- .../2-RemoveServiceApp.ps1 | 19 +-- .../SPManagedAccount/1-NewManagedAccount.ps1 | 43 +++--- .../2-NewManagedAccountWithSchedule.ps1 | 45 ++++--- .../1-CreateServiceApp.ps1 | 37 +++--- .../2-RemoveServiceApp.ps1 | 35 ++--- .../3-SetTermStoreAdmins.ps1 | 45 ++++--- .../4-SetLanguageSettings.ps1 | 49 +++---- .../5-SetContentTypeHubUrl.ps1 | 9 +- .../6-SetContentTypeSettings.ps1 | 9 +- .../1-SetManagedMetadataDefault.ps1 | 7 +- .../2-ConfigureCustomProxyGroup.ps1 | 73 ++++++----- .../SPManagedPath/1-ExplicitPath.ps1 | 7 +- .../SPManagedPath/2-WildcardPath.ps1 | 7 +- .../Resources/SPManagedPath/3-RemovePath.ps1 | 39 +++--- .../1-EnsureCompliance.ps1 | 33 ++--- .../1-CreateServiceApplicationProxy.ps1 | 7 +- .../1-AddBinding.ps1 | 33 ++--- .../2-RemoveBinding.ps1 | 35 ++--- .../SPOutgoingEmailSettings/1-WholeFarm.ps1 | 39 +++--- .../SPOutgoingEmailSettings/2-WebApp.ps1 | 39 +++--- .../SPPasswordChangeSettings/1-Example.ps1 | 39 +++--- .../1-NewServiceApp.ps1 | 33 ++--- .../1-RemoveServiceApp.ps1 | 35 ++--- .../1-NewServiceApp.ps1 | 47 +++---- .../2-RemoveServiceApp.ps1 | 33 ++--- .../Resources/SPProductUpdate/1-InstallCU.ps1 | 39 +++--- .../Resources/SPProductUpdate/2-InstallSP.ps1 | 39 +++--- .../SPProductUpdate/3-InstallLPSP.ps1 | 39 +++--- .../1-EnableSync.ps1 | 7 +- .../2-DisableSync.ps1 | 7 +- .../1-Example.ps1 | 4 +- .../1-Resource.ps1 | 14 +- .../2-Group.ps1 | 14 +- .../1-SpecificMembers.ps1 | 10 +- .../SPProjectServerGroup/2-ADGroup.ps1 | 10 +- .../1-EnableProjectServer.ps1 | 7 +- .../2-DisableProjectServer.ps1 | 7 +- .../1-SPMode.ps1 | 7 +- .../2-PSMode.ps1 | 7 +- .../1-NewServiceApp.ps1 | 33 ++--- .../2-RemoveServiceApp.ps1 | 35 ++--- .../1-Example.ps1 | 4 +- .../1-Example.ps1 | 4 +- .../SPProjectServerWssSettings/1-Example.ps1 | 4 +- .../1-PublishServiceApplication.ps1 | 33 ++--- .../2-UnpublishServiceApplication.ps1 | 33 ++--- .../Resources/SPQuotaTemplate/1-Example.ps1 | 39 +++--- .../Resources/SPRemoteFarmTrust/1-Example.ps1 | 33 ++--- .../1 - AuthoritativePage.ps1 | 39 +++--- .../2 - DemotedPage.ps1 | 37 +++--- .../1-SharePointSource.ps1 | 47 +++---- .../SPSearchContentSource/2-WebsiteSource.ps1 | 69 +++++----- .../SPSearchCrawlMapping/1-Example.ps1 | 39 +++--- .../SPSearchCrawlRule/1-BasicExample.ps1 | 41 +++--- .../2-CertificateExample.ps1 | 43 +++--- .../1-RequestLimit.ps1 | 37 +++--- .../SPSearchCrawlerImpactRule/2-WaitTime.ps1 | 37 +++--- .../SPSearchFileType/1-EnsureFileType.ps1 | 39 +++--- .../SPSearchFileType/2-DisableFileType.ps1 | 41 +++--- .../SPSearchIndexPartition/1-Example.ps1 | 37 +++--- .../1-EnsureProperty.ps1 | 41 +++--- .../1-EnsureMetadataCategory.ps1 | 41 +++--- .../SPSearchResultSource/2-SSAExample.ps1 | 3 +- .../SPSearchServiceApp/1-NewServiceApp.ps1 | 35 ++--- .../SPSearchServiceApp/2-RemoveServiceApp.ps1 | 35 ++--- .../1-ConfigureSettings.ps1 | 45 ++++--- .../Resources/SPSearchTopology/1-Example.ps1 | 45 ++++--- .../1-NewServiceApp.ps1 | 39 +++--- .../2-RemoveServiceApp.ps1 | 37 +++--- .../1-SetConfiguration.ps1 | 41 +++--- .../1-EnableSelfServiceSiteCreation.ps1 | 7 +- ...nableSelfServiceSiteCreationCustomForm.ps1 | 7 +- .../3-DisableSelfServiceSiteCreation.ps1 | 7 +- ...EnableSelfServiceSiteCreationForSP2019.ps1 | 37 +++--- .../Resources/SPServiceAppPool/1-Example.ps1 | 35 ++--- .../SPServiceAppProxyGroup/1-ProxyGroups.ps1 | 47 +++---- .../SPServiceAppSecurity/1-Example.ps1 | 7 +- .../SPServiceAppSecurity/2-Example.ps1 | 45 ++++--- .../Resources/SPServiceIdentity/1-Example.ps1 | 33 ++--- .../SPServiceInstance/1-StartService.ps1 | 33 ++--- .../SPServiceInstance/2-StopService.ps1 | 33 ++--- .../SPSessionStateService/1-Example.ps1 | 35 ++--- .../Resources/SPShellAdmins/1-FarmAdmins.ps1 | 33 ++--- .../Resources/SPShellAdmins/2-SpecificDBs.ps1 | 43 +++--- .../SPShellAdmins/3-ExcludeDatabases.ps1 | 36 +++--- .../Examples/Resources/SPSite/1-Example.ps1 | 39 +++--- .../Examples/Resources/SPSite/2-SiteQuota.ps1 | 41 +++--- .../SPSite/3-AdministrationSiteType.ps1 | 41 +++--- .../Resources/SPSiteUrl/1-Example.ps1 | 35 ++--- .../Resources/SPStateServiceApp/1-Example.ps1 | 35 ++--- .../1-NewServiceApp.ps1 | 37 +++--- .../2-RemoveServiceApp.ps1 | 35 ++--- .../Resources/SPTimerJobState/1-Example.ps1 | 37 +++--- .../1-SigningCertInFileCertificateStore.ps1 | 69 +++++----- .../2-SigningCertInFilePath.ps1 | 69 +++++----- .../1-Example.ps1 | 27 ++-- .../2-Example.ps1 | 28 ++-- .../3-Example.ps1 | 7 +- .../4-Example.ps1 | 7 +- .../1-AddRootAuthorityCertInCertStore.ps1 | 35 ++--- .../2-AddRootAuthorityCertInFilePath.ps1 | 35 ++--- .../3-RemoveRootAuthority.ps1 | 35 ++--- .../1-CreateUsingCertificateFilePath.ps1 | 7 +- .../2-CreateUsingCertificateThumbprint.ps1 | 7 +- .../3-CreateUsingMetadata.ps1 | 7 +- .../SPUsageApplication/1-Example.ps1 | 41 +++--- .../SPUserProfileProperty/1-Example.ps1 | 10 +- .../SPUserProfileSection/1-Example.ps1 | 39 +++--- .../SPUserProfileServiceApp/1-Example.ps1 | 51 ++++---- .../SPUserProfileServiceApp/2-NoILMUsed.ps1 | 53 ++++---- .../3-SiteNamingConflictResolution.ps1 | 53 ++++---- .../1-Example.ps1 | 37 +++--- .../SPUserProfileSyncConnection/1-Example.ps1 | 57 ++++---- .../SPUserProfileSyncService/1-Example.ps1 | 35 ++--- .../SPVisioServiceApp/1-NewServiceApp.ps1 | 33 ++--- .../SPVisioServiceApp/2-RemoveServiceApp.ps1 | 35 ++--- .../Examples/Resources/SPWeb/1-Example.ps1 | 43 +++--- .../SPWeb/2-EnableAccessRequests.ps1 | 47 +++---- .../SPWeb/3-DisableAccessRequests.ps1 | 45 ++++--- .../SPWebAppAuthentication/1-NTLMExample.ps1 | 4 +- .../2-KerberosExample.ps1 | 4 +- .../3-ClaimsExample.ps1 | 3 +- .../5-BasicAuthExample.ps1 | 4 +- .../SPWebAppBlockedFileTypes/1-Inclusion.ps1 | 35 ++--- .../2-SpecificList.ps1 | 33 ++--- .../1-SetClientCallableSettings.ps1 | 49 +++---- .../2-EnableTenantAdministration.ps1 | 45 ++++--- .../SPWebAppGeneralSettings/1-Example.ps1 | 37 +++--- .../1-Example.ps1 | 61 ++++----- .../1-LimitPermissions.ps1 | 37 +++--- .../SPWebAppPermissions/2-AllPermissions.ps1 | 33 ++--- .../SPWebAppPolicy/1-SpecificMembers.ps1 | 55 ++++---- .../SPWebAppPolicy/2-IncludeMembers.ps1 | 47 +++---- .../SPWebAppProxyGroup/1-Example.ps1 | 33 ++--- .../SPWebAppSiteUseAndDeletion/1-Example.ps1 | 39 +++--- .../1-ApplySuiteBarBranding2016.ps1 | 39 +++--- .../2-ApplySuiteBarBranding2013.ps1 | 33 ++--- .../SPWebAppThrottlingSettings/1-Example.ps1 | 45 ++++--- .../SPWebAppWorkflowSettings/1-Example.ps1 | 35 ++--- .../Resources/SPWebApplication/1-Example.ps1 | 47 +++---- .../SPWebApplicationAppDomain/1-Example.ps1 | 39 +++--- .../SPWebApplicationExtension/1-Example.ps1 | 49 +++---- .../1-NewServiceApp.ps1 | 7 +- .../2-NewServiceAppWithDefault.ps1 | 7 +- .../3-RemoveServiceApp.ps1 | 7 +- .../SPWorkManagementServiceApp/1-Example.ps1 | 35 ++--- .../1-RegisterWorkflowService.ps1 | 35 ++--- .../2-RegisterWorkflowService.ps1 | 37 +++--- .../SharePointDsc.Util.psm1 | 3 +- .../SharePointDsc.Util.Tests.ps1 | 122 +++++++++++++++++- 216 files changed, 3948 insertions(+), 3232 deletions(-) diff --git a/SharePointDsc/Examples/Resources/SPAccessServiceApp/1-CreateServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPAccessServiceApp/1-CreateServiceApp.ps1 index eb79bc94f..a8848e705 100644 --- a/SharePointDsc/Examples/Resources/SPAccessServiceApp/1-CreateServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPAccessServiceApp/1-CreateServiceApp.ps1 @@ -41,14 +41,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPAccessServiceApp AccessServices { Name = "Access Services Service Application" diff --git a/SharePointDsc/Examples/Resources/SPAccessServiceApp/2-RemoveServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPAccessServiceApp/2-RemoveServiceApp.ps1 index 0d1307966..823d3c4ad 100644 --- a/SharePointDsc/Examples/Resources/SPAccessServiceApp/2-RemoveServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPAccessServiceApp/2-RemoveServiceApp.ps1 @@ -44,14 +44,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPAccessServiceApp AccessServices { Name = "Access Services Service Application" diff --git a/SharePointDsc/Examples/Resources/SPAccessServices2010/1-CreateServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPAccessServices2010/1-CreateServiceApp.ps1 index 76a700ae7..20914ff4b 100644 --- a/SharePointDsc/Examples/Resources/SPAccessServices2010/1-CreateServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPAccessServices2010/1-CreateServiceApp.ps1 @@ -39,21 +39,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPAccessServices2010 Access2010Services - { - Name = "Access 2010 Services Service Application" - ApplicationPool = "SharePoint Service Applications" - PsDscRunAsCredential = $SetupAccount - } + SPAccessServices2010 Access2010Services + { + Name = "Access 2010 Services Service Application" + ApplicationPool = "SharePoint Service Applications" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPAccessServices2010/2-RemoveServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPAccessServices2010/2-RemoveServiceApp.ps1 index 1248633a0..d7af26334 100644 --- a/SharePointDsc/Examples/Resources/SPAccessServices2010/2-RemoveServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPAccessServices2010/2-RemoveServiceApp.ps1 @@ -42,22 +42,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPAccessServices2010 Access2010Services - { - Name = "Access 2010 Services Service Application" - ApplicationPool = "n/a" - Ensure = "Absent" - PsDscRunAsCredential = $SetupAccount - } + SPAccessServices2010 Access2010Services + { + Name = "Access 2010 Services Service Application" + ApplicationPool = "n/a" + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPAlternateUrl/1-CreateAlternateUrl.ps1 b/SharePointDsc/Examples/Resources/SPAlternateUrl/1-CreateAlternateUrl.ps1 index 7fd3bda73..78607bec2 100644 --- a/SharePointDsc/Examples/Resources/SPAlternateUrl/1-CreateAlternateUrl.ps1 +++ b/SharePointDsc/Examples/Resources/SPAlternateUrl/1-CreateAlternateUrl.ps1 @@ -39,24 +39,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPAlternateUrl CentralAdminAAM - { - WebAppName = "SharePoint - www.domain.com80" - Zone = "Intranet" - Url = "https://admin.sharepoint.contoso.com" - Internal = $false - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPAlternateUrl CentralAdminAAM + { + WebAppName = "SharePoint - www.domain.com80" + Zone = "Intranet" + Url = "https://admin.sharepoint.contoso.com" + Internal = $false + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPAlternateUrl/2-RemoveAlternateUrl.ps1 b/SharePointDsc/Examples/Resources/SPAlternateUrl/2-RemoveAlternateUrl.ps1 index c6c239db5..b149e7e0e 100644 --- a/SharePointDsc/Examples/Resources/SPAlternateUrl/2-RemoveAlternateUrl.ps1 +++ b/SharePointDsc/Examples/Resources/SPAlternateUrl/2-RemoveAlternateUrl.ps1 @@ -42,14 +42,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPAlternateUrl CentralAdminAAM { WebAppName = "SharePoint - www.domain.com80" diff --git a/SharePointDsc/Examples/Resources/SPAntivirusSettings/1-SetAntivirusConfig.ps1 b/SharePointDsc/Examples/Resources/SPAntivirusSettings/1-SetAntivirusConfig.ps1 index d1996fde3..0c45fa8cd 100644 --- a/SharePointDsc/Examples/Resources/SPAntivirusSettings/1-SetAntivirusConfig.ps1 +++ b/SharePointDsc/Examples/Resources/SPAntivirusSettings/1-SetAntivirusConfig.ps1 @@ -39,26 +39,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param - ( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPAntivirusSettings AVSettings - { - IsSingleInstance = "Yes" - ScanOnDownload = $true - ScanOnUpload = $true - AllowDownloadInfected = $false - AttemptToClean = $false - PsDscRunAsCredential = $SetupAccount - } + SPAntivirusSettings AVSettings + { + IsSingleInstance = "Yes" + ScanOnDownload = $true + ScanOnUpload = $true + AllowDownloadInfected = $false + AttemptToClean = $false + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPAppCatalog/1-SetSiteAsAppCatalog.ps1 b/SharePointDsc/Examples/Resources/SPAppCatalog/1-SetSiteAsAppCatalog.ps1 index 32ccbe139..83590a303 100644 --- a/SharePointDsc/Examples/Resources/SPAppCatalog/1-SetSiteAsAppCatalog.ps1 +++ b/SharePointDsc/Examples/Resources/SPAppCatalog/1-SetSiteAsAppCatalog.ps1 @@ -39,22 +39,23 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param - ( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPAppCatalog MainAppCatalog - { - SiteUrl = "https://content.sharepoint.contoso.com/sites/AppCatalog" - PsDscRunAsCredential = $SetupAccount - } + SPAppCatalog MainAppCatalog + { + SiteUrl = "https://content.sharepoint.contoso.com/sites/AppCatalog" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPAppDomain/1-SetAppDomainDetails.ps1 b/SharePointDsc/Examples/Resources/SPAppDomain/1-SetAppDomainDetails.ps1 index 8893dad6e..fbd214987 100644 --- a/SharePointDsc/Examples/Resources/SPAppDomain/1-SetAppDomainDetails.ps1 +++ b/SharePointDsc/Examples/Resources/SPAppDomain/1-SetAppDomainDetails.ps1 @@ -39,21 +39,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPAppDomain LocalFarmAppUrls - { - AppDomain = "contosointranetapps.com" - Prefix = "app" - PsDscRunAsCredential = $SetupAccount - } + SPAppDomain LocalFarmAppUrls + { + AppDomain = "contosointranetapps.com" + Prefix = "app" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPAppManagementServiceApp/1-CreateServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPAppManagementServiceApp/1-CreateServiceApp.ps1 index 10f681d22..b87c54453 100644 --- a/SharePointDsc/Examples/Resources/SPAppManagementServiceApp/1-CreateServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPAppManagementServiceApp/1-CreateServiceApp.ps1 @@ -40,23 +40,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPAppManagementServiceApp AppManagementServiceApp - { - Name = "App Management Service Application" - ApplicationPool = "SharePoint Service Applications" - DatabaseServer = "SQL01.contoso.com" - DatabaseName = "SP_AppManagement" - PsDscRunAsCredential = $SetupAccount - } + SPAppManagementServiceApp AppManagementServiceApp + { + Name = "App Management Service Application" + ApplicationPool = "SharePoint Service Applications" + DatabaseServer = "SQL01.contoso.com" + DatabaseName = "SP_AppManagement" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPAppManagementServiceApp/2-RemoveServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPAppManagementServiceApp/2-RemoveServiceApp.ps1 index 5167ab358..10bd5d86b 100644 --- a/SharePointDsc/Examples/Resources/SPAppManagementServiceApp/2-RemoveServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPAppManagementServiceApp/2-RemoveServiceApp.ps1 @@ -41,22 +41,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPAppManagementServiceApp AppManagementServiceApp - { - Name = "App Management Service Application" - ApplicationPool = "n/a" - Ensure = "Absent" - PsDscRunAsCredential = $SetupAccount - } + SPAppManagementServiceApp AppManagementServiceApp + { + Name = "App Management Service Application" + ApplicationPool = "n/a" + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPAppStoreSettings/1-EnableSharePointAppStore.ps1 b/SharePointDsc/Examples/Resources/SPAppStoreSettings/1-EnableSharePointAppStore.ps1 index 72d670d07..30b9cd1d9 100644 --- a/SharePointDsc/Examples/Resources/SPAppStoreSettings/1-EnableSharePointAppStore.ps1 +++ b/SharePointDsc/Examples/Resources/SPAppStoreSettings/1-EnableSharePointAppStore.ps1 @@ -41,14 +41,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPAppStoreSettings EnableSharePointAppStore { WebAppUrl = "https://sharepoint.contoso.com" diff --git a/SharePointDsc/Examples/Resources/SPAppStoreSettings/2-EnableAppStores.ps1 b/SharePointDsc/Examples/Resources/SPAppStoreSettings/2-EnableAppStores.ps1 index 23aeefeba..d0c98ed01 100644 --- a/SharePointDsc/Examples/Resources/SPAppStoreSettings/2-EnableAppStores.ps1 +++ b/SharePointDsc/Examples/Resources/SPAppStoreSettings/2-EnableAppStores.ps1 @@ -39,22 +39,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPAppStoreSettings EnableAppStores - { - WebAppUrl = "https://sharepoint.contoso.com" - AllowAppPurchases = $true - AllowAppsForOffice = $true - PsDscRunAsCredential = $SetupAccount - } + SPAppStoreSettings EnableAppStores + { + WebAppUrl = "https://sharepoint.contoso.com" + AllowAppPurchases = $true + AllowAppsForOffice = $true + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPAppStoreSettings/3-DisableAppStores.ps1 b/SharePointDsc/Examples/Resources/SPAppStoreSettings/3-DisableAppStores.ps1 index 7767e2ccc..9ce225535 100644 --- a/SharePointDsc/Examples/Resources/SPAppStoreSettings/3-DisableAppStores.ps1 +++ b/SharePointDsc/Examples/Resources/SPAppStoreSettings/3-DisableAppStores.ps1 @@ -39,22 +39,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPAppStoreSettings DisableAppStores - { - WebAppUrl = "https://sharepoint.contoso.com" - AllowAppPurchases = $false - AllowAppsForOffice = $false - PsDscRunAsCredential = $SetupAccount - } + SPAppStoreSettings DisableAppStores + { + WebAppUrl = "https://sharepoint.contoso.com" + AllowAppPurchases = $false + AllowAppsForOffice = $false + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPAuthenticationRealm/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPAuthenticationRealm/1-Example.ps1 index cd812602c..55e6a1eff 100644 --- a/SharePointDsc/Examples/Resources/SPAuthenticationRealm/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPAuthenticationRealm/1-Example.ps1 @@ -39,21 +39,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPAuthenticationRealm AuthenticationRealm - { - IsSingleInstance = "Yes" - AuthenticationRealm = "14757a87-4d74-4323-83b9-fb1e77e8f22f" - PsDscRunAsCredential = $SetupAccount - } + SPAuthenticationRealm AuthenticationRealm + { + IsSingleInstance = "Yes" + AuthenticationRealm = "14757a87-4d74-4323-83b9-fb1e77e8f22f" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPAzureAccessControlServiceAppProxy/1-CreateServiceApplicationProxy.ps1 b/SharePointDsc/Examples/Resources/SPAzureAccessControlServiceAppProxy/1-CreateServiceApplicationProxy.ps1 index e795828bd..87326a726 100644 --- a/SharePointDsc/Examples/Resources/SPAzureAccessControlServiceAppProxy/1-CreateServiceApplicationProxy.ps1 +++ b/SharePointDsc/Examples/Resources/SPAzureAccessControlServiceAppProxy/1-CreateServiceApplicationProxy.ps1 @@ -42,14 +42,17 @@ in the farm connecting to the contoso tenant. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPAzureAccessControlServiceAppProxy SPOACS { Name = "SPO ACS" @@ -58,4 +61,3 @@ Configuration Example } } } - diff --git a/SharePointDsc/Examples/Resources/SPBCSServiceApp/1-CreateServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPBCSServiceApp/1-CreateServiceApp.ps1 index b9168c576..07cda4e8a 100644 --- a/SharePointDsc/Examples/Resources/SPBCSServiceApp/1-CreateServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPBCSServiceApp/1-CreateServiceApp.ps1 @@ -40,23 +40,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPBCSServiceApp BCSServiceApp - { - Name = "BCS Service Application" - ApplicationPool = "SharePoint Service Applications" - DatabaseName = "SP_BCS" - DatabaseServer = "SQL.contoso.local\SQLINSTANCE" - PsDscRunAsCredential = $SetupAccount - } + SPBCSServiceApp BCSServiceApp + { + Name = "BCS Service Application" + ApplicationPool = "SharePoint Service Applications" + DatabaseName = "SP_BCS" + DatabaseServer = "SQL.contoso.local\SQLINSTANCE" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPBCSServiceApp/2-RemoveServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPBCSServiceApp/2-RemoveServiceApp.ps1 index 46108199b..7374f07e3 100644 --- a/SharePointDsc/Examples/Resources/SPBCSServiceApp/2-RemoveServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPBCSServiceApp/2-RemoveServiceApp.ps1 @@ -41,22 +41,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPBCSServiceApp BCSServiceApp - { - Name = "BCS Service Application" - ApplicationPool = "n/a" - Ensure = "Absent" - PsDscRunAsCredential = $SetupAccount - } + SPBCSServiceApp BCSServiceApp + { + Name = "BCS Service Application" + ApplicationPool = "n/a" + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPBlobCacheSettings/1-ApplyBlobCacheConfig.ps1 b/SharePointDsc/Examples/Resources/SPBlobCacheSettings/1-ApplyBlobCacheConfig.ps1 index b89f3d42b..2a93fd05d 100644 --- a/SharePointDsc/Examples/Resources/SPBlobCacheSettings/1-ApplyBlobCacheConfig.ps1 +++ b/SharePointDsc/Examples/Resources/SPBlobCacheSettings/1-ApplyBlobCacheConfig.ps1 @@ -40,27 +40,28 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param - ( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPBlobCacheSettings BlobCacheSettings - { - WebAppUrl = "http://intranet.contoso.com" - Zone = "Default" - EnableCache = $true - Location = "F:\BlobCache" - MaxSizeInGB = 10 - FileTypes = "\.(gif|jpg|png|css|js)$" - PsDscRunAsCredential = $SetupAccount - } + SPBlobCacheSettings BlobCacheSettings + { + WebAppUrl = "http://intranet.contoso.com" + Zone = "Default" + EnableCache = $true + Location = "F:\BlobCache" + MaxSizeInGB = 10 + FileTypes = "\.(gif|jpg|png|css|js)$" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPCacheAccounts/1-SetCacheAccounts.ps1 b/SharePointDsc/Examples/Resources/SPCacheAccounts/1-SetCacheAccounts.ps1 index c438fbc72..93da04c57 100644 --- a/SharePointDsc/Examples/Resources/SPCacheAccounts/1-SetCacheAccounts.ps1 +++ b/SharePointDsc/Examples/Resources/SPCacheAccounts/1-SetCacheAccounts.ps1 @@ -42,14 +42,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPCacheAccounts SetCacheAccounts { WebAppUrl = "http://sharepoint.contoso.com" diff --git a/SharePointDsc/Examples/Resources/SPCacheAccounts/2-SetCacheAccountsNoPolicy.ps1 b/SharePointDsc/Examples/Resources/SPCacheAccounts/2-SetCacheAccountsNoPolicy.ps1 index d51310219..4229c7163 100644 --- a/SharePointDsc/Examples/Resources/SPCacheAccounts/2-SetCacheAccountsNoPolicy.ps1 +++ b/SharePointDsc/Examples/Resources/SPCacheAccounts/2-SetCacheAccountsNoPolicy.ps1 @@ -41,23 +41,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPCacheAccounts SetCacheAccounts - { - WebAppUrl = "http://sharepoint.contoso.com" - SuperUserAlias = "DEMO\svcSPSuperUser" - SuperReaderAlias = "DEMO\svcSPReader" - SetWebAppPolicy = $false - PsDscRunAsCredential = $SetupAccount - } + SPCacheAccounts SetCacheAccounts + { + WebAppUrl = "http://sharepoint.contoso.com" + SuperUserAlias = "DEMO\svcSPSuperUser" + SuperReaderAlias = "DEMO\svcSPReader" + SetWebAppPolicy = $false + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPConfigWizard/1-RunConfigWizard.ps1 b/SharePointDsc/Examples/Resources/SPConfigWizard/1-RunConfigWizard.ps1 index 1ea6d435b..f9c6d4254 100644 --- a/SharePointDsc/Examples/Resources/SPConfigWizard/1-RunConfigWizard.ps1 +++ b/SharePointDsc/Examples/Resources/SPConfigWizard/1-RunConfigWizard.ps1 @@ -41,14 +41,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPConfigWizard RunConfigWizard { IsSingleInstance = "Yes" diff --git a/SharePointDsc/Examples/Resources/SPConfigWizard/2-RunConfigWizardInWindow.ps1 b/SharePointDsc/Examples/Resources/SPConfigWizard/2-RunConfigWizardInWindow.ps1 index de348886a..aa99247da 100644 --- a/SharePointDsc/Examples/Resources/SPConfigWizard/2-RunConfigWizardInWindow.ps1 +++ b/SharePointDsc/Examples/Resources/SPConfigWizard/2-RunConfigWizardInWindow.ps1 @@ -40,22 +40,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPConfigWizard RunConfigWizard - { - IsSingleInstance = "Yes" - DatabaseUpgradeDays = "sat", "sun" - DatabaseUpgradeTime = "3:00am to 5:00am" - PsDscRunAsCredential = $SetupAccount - } + SPConfigWizard RunConfigWizard + { + IsSingleInstance = "Yes" + DatabaseUpgradeDays = "sat", "sun" + DatabaseUpgradeTime = "3:00am to 5:00am" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPContentDatabase/1-AddContentDatabase.ps1 b/SharePointDsc/Examples/Resources/SPContentDatabase/1-AddContentDatabase.ps1 index 077630d01..d0fe1af86 100644 --- a/SharePointDsc/Examples/Resources/SPContentDatabase/1-AddContentDatabase.ps1 +++ b/SharePointDsc/Examples/Resources/SPContentDatabase/1-AddContentDatabase.ps1 @@ -39,25 +39,28 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPContentDatabase ContentDB - { - Name = "SharePoint_Content_01" - DatabaseServer = "SQL.contoso.local\SQLINSTANCE" - WebAppUrl = "http://sharepoint.contoso.com" - Enabled = $true - WarningSiteCount = 2000 - MaximumSiteCount = 5000 - PsDscRunAsCredential = $SetupAccount - } + SPContentDatabase ContentDB + { + Name = "SharePoint_Content_01" + DatabaseServer = "SQL.contoso.local\SQLINSTANCE" + WebAppUrl = "http://sharepoint.contoso.com" + Enabled = $true + WarningSiteCount = 2000 + MaximumSiteCount = 5000 + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPContentDatabase/2-RemoveContentDatabase.ps1 b/SharePointDsc/Examples/Resources/SPContentDatabase/2-RemoveContentDatabase.ps1 index 9879d3579..1b35397a4 100644 --- a/SharePointDsc/Examples/Resources/SPContentDatabase/2-RemoveContentDatabase.ps1 +++ b/SharePointDsc/Examples/Resources/SPContentDatabase/2-RemoveContentDatabase.ps1 @@ -41,23 +41,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPContentDatabase ContentDB - { - Name = "SharePoint_Content_01" - DatabaseServer = "SQL.contoso.local\SQLINSTANCE" - WebAppUrl = "http://sharepoint.contoso.com" - Ensure = "Absent" - PsDscRunAsCredential = $SetupAccount - } + SPContentDatabase ContentDB + { + Name = "SharePoint_Content_01" + DatabaseServer = "SQL.contoso.local\SQLINSTANCE" + WebAppUrl = "http://sharepoint.contoso.com" + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPDatabaseAAG/1-AddDBtoAAG.ps1 b/SharePointDsc/Examples/Resources/SPDatabaseAAG/1-AddDBtoAAG.ps1 index afcdce1ca..70317ab0e 100644 --- a/SharePointDsc/Examples/Resources/SPDatabaseAAG/1-AddDBtoAAG.ps1 +++ b/SharePointDsc/Examples/Resources/SPDatabaseAAG/1-AddDBtoAAG.ps1 @@ -40,22 +40,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPDatabaseAAG ConfigDBAAG - { - DatabaseName = "SP_Config" - AGName = "MyAvailabilityGroup" - FileShare = "\\SQL\Backups" - PsDscRunAsCredential = $SetupAccount - } + SPDatabaseAAG ConfigDBAAG + { + DatabaseName = "SP_Config" + AGName = "MyAvailabilityGroup" + FileShare = "\\SQL\Backups" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPDatabaseAAG/2-AddMultipleDBstoAAG.ps1 b/SharePointDsc/Examples/Resources/SPDatabaseAAG/2-AddMultipleDBstoAAG.ps1 index a96cef8c4..d0e09669f 100644 --- a/SharePointDsc/Examples/Resources/SPDatabaseAAG/2-AddMultipleDBstoAAG.ps1 +++ b/SharePointDsc/Examples/Resources/SPDatabaseAAG/2-AddMultipleDBstoAAG.ps1 @@ -40,22 +40,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPDatabaseAAG ConfigDBAAG - { - DatabaseName = "*Content*" - AGName = "MyAvailabilityGroup" - FileShare = "\\SQL\Backups" - PsDscRunAsCredential = $SetupAccount - } + SPDatabaseAAG ConfigDBAAG + { + DatabaseName = "*Content*" + AGName = "MyAvailabilityGroup" + FileShare = "\\SQL\Backups" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPDatabaseAAG/3-RemoveDBfromAAG.ps1 b/SharePointDsc/Examples/Resources/SPDatabaseAAG/3-RemoveDBfromAAG.ps1 index 4182425d1..226f6710a 100644 --- a/SharePointDsc/Examples/Resources/SPDatabaseAAG/3-RemoveDBfromAAG.ps1 +++ b/SharePointDsc/Examples/Resources/SPDatabaseAAG/3-RemoveDBfromAAG.ps1 @@ -39,22 +39,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPDatabaseAAG ConfigDBAAG - { - DatabaseName = "SP_Config" - AGName = "MyAvailabilityGroup" - Ensure = "Absent" - PsDscRunAsCredential = $SetupAccount - } + SPDatabaseAAG ConfigDBAAG + { + DatabaseName = "SP_Config" + AGName = "MyAvailabilityGroup" + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPDesignerSettings/1-ApplyDesignerConfig.ps1 b/SharePointDsc/Examples/Resources/SPDesignerSettings/1-ApplyDesignerConfig.ps1 index 8592010d2..6e81eab39 100644 --- a/SharePointDsc/Examples/Resources/SPDesignerSettings/1-ApplyDesignerConfig.ps1 +++ b/SharePointDsc/Examples/Resources/SPDesignerSettings/1-ApplyDesignerConfig.ps1 @@ -40,28 +40,31 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPDesignerSettings MainWebAppSPDSettings - { - WebAppUrl = "https://intranet.sharepoint.contoso.com" - SettingsScope = "WebApplication" - AllowSharePointDesigner = $false - AllowDetachPagesFromDefinition = $false - AllowCustomiseMasterPage = $false - AllowManageSiteURLStructure = $false - AllowCreateDeclarativeWorkflow = $false - AllowSavePublishDeclarativeWorkflow = $false - AllowSaveDeclarativeWorkflowAsTemplate = $false - PsDscRunAsCredential = $SetupAccount - } + SPDesignerSettings MainWebAppSPDSettings + { + WebAppUrl = "https://intranet.sharepoint.contoso.com" + SettingsScope = "WebApplication" + AllowSharePointDesigner = $false + AllowDetachPagesFromDefinition = $false + AllowCustomiseMasterPage = $false + AllowManageSiteURLStructure = $false + AllowCreateDeclarativeWorkflow = $false + AllowSavePublishDeclarativeWorkflow = $false + AllowSaveDeclarativeWorkflowAsTemplate = $false + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPDiagnosticLoggingSettings/1-ApplyLoggingSettings.ps1 b/SharePointDsc/Examples/Resources/SPDiagnosticLoggingSettings/1-ApplyLoggingSettings.ps1 index 167d1ae55..33a254f6f 100644 --- a/SharePointDsc/Examples/Resources/SPDiagnosticLoggingSettings/1-ApplyLoggingSettings.ps1 +++ b/SharePointDsc/Examples/Resources/SPDiagnosticLoggingSettings/1-ApplyLoggingSettings.ps1 @@ -41,38 +41,41 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPDiagnosticLoggingSettings ApplyDiagnosticLogSettings - { - IsSingleInstance = "Yes" - LogPath = "L:\ULSLogs" - LogSpaceInGB = 10 - AppAnalyticsAutomaticUploadEnabled = $false - CustomerExperienceImprovementProgramEnabled = $true - DaysToKeepLogs = 7 - DownloadErrorReportingUpdatesEnabled = $false - ErrorReportingAutomaticUploadEnabled = $false - ErrorReportingEnabled = $false - EventLogFloodProtectionEnabled = $true - EventLogFloodProtectionNotifyInterval = 5 - EventLogFloodProtectionQuietPeriod = 2 - EventLogFloodProtectionThreshold = 5 - EventLogFloodProtectionTriggerPeriod = 2 - LogCutInterval = 15 - LogMaxDiskSpaceUsageEnabled = $true - ScriptErrorReportingDelay = 30 - ScriptErrorReportingEnabled = $true - ScriptErrorReportingRequireAuth = $true - PsDscRunAsCredential = $SetupAccount - } + SPDiagnosticLoggingSettings ApplyDiagnosticLogSettings + { + IsSingleInstance = "Yes" + LogPath = "L:\ULSLogs" + LogSpaceInGB = 10 + AppAnalyticsAutomaticUploadEnabled = $false + CustomerExperienceImprovementProgramEnabled = $true + DaysToKeepLogs = 7 + DownloadErrorReportingUpdatesEnabled = $false + ErrorReportingAutomaticUploadEnabled = $false + ErrorReportingEnabled = $false + EventLogFloodProtectionEnabled = $true + EventLogFloodProtectionNotifyInterval = 5 + EventLogFloodProtectionQuietPeriod = 2 + EventLogFloodProtectionThreshold = 5 + EventLogFloodProtectionTriggerPeriod = 2 + LogCutInterval = 15 + LogMaxDiskSpaceUsageEnabled = $true + ScriptErrorReportingDelay = 30 + ScriptErrorReportingEnabled = $true + ScriptErrorReportingRequireAuth = $true + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPDiagnosticsProvider/1-Configure.ps1 b/SharePointDsc/Examples/Resources/SPDiagnosticsProvider/1-Configure.ps1 index 968aa9404..63ae66bc8 100644 --- a/SharePointDsc/Examples/Resources/SPDiagnosticsProvider/1-Configure.ps1 +++ b/SharePointDsc/Examples/Resources/SPDiagnosticsProvider/1-Configure.ps1 @@ -39,24 +39,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPDiagnosticsProvider BlockingQueryProvider - { - Ensure = "Present" - Name = "job-diagnostics-blocking-query-provider" - MaxTotalSizeInBytes = 10000000000000 - Retention = 14 - Enabled = $true - PSDscRunAsCredential = $SetupAccount - } + SPDiagnosticsProvider BlockingQueryProvider + { + Ensure = "Present" + Name = "job-diagnostics-blocking-query-provider" + MaxTotalSizeInBytes = 10000000000000 + Retention = 14 + Enabled = $true + PSDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPDistributedCacheClientSettings/1-ConfigureClientSettings.ps1 b/SharePointDsc/Examples/Resources/SPDistributedCacheClientSettings/1-ConfigureClientSettings.ps1 index ef6d9ad50..9e24c634e 100644 --- a/SharePointDsc/Examples/Resources/SPDistributedCacheClientSettings/1-ConfigureClientSettings.ps1 +++ b/SharePointDsc/Examples/Resources/SPDistributedCacheClientSettings/1-ConfigureClientSettings.ps1 @@ -39,50 +39,53 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPDistributedCacheClientSettings Settings - { - IsSingleInstance = "Yes" - DLTCMaxConnectionsToServer = 3 - DLTCRequestTimeout = 1000 - DLTCChannelOpenTimeOut = 1000 - DVSCMaxConnectionsToServer = 3 - DVSCRequestTimeout = 1000 - DVSCChannelOpenTimeOut = 1000 - DACMaxConnectionsToServer = 3 - DACRequestTimeout = 1000 - DACChannelOpenTimeOut = 1000 - DAFMaxConnectionsToServer = 3 - DAFRequestTimeout = 1000 - DAFChannelOpenTimeOut = 1000 - DAFCMaxConnectionsToServer = 3 - DAFCRequestTimeout = 1000 - DAFCChannelOpenTimeOut = 1000 - DBCMaxConnectionsToServer = 3 - DBCRequestTimeout = 1000 - DBCChannelOpenTimeOut = 1000 - DDCMaxConnectionsToServer = 3 - DDCRequestTimeout = 1000 - DDCChannelOpenTimeOut = 1000 - DSCMaxConnectionsToServer = 3 - DSCRequestTimeout = 1000 - DSCChannelOpenTimeOut = 1000 - DTCMaxConnectionsToServer = 3 - DTCRequestTimeout = 1000 - DTCChannelOpenTimeOut = 1000 - DSTACMaxConnectionsToServer = 3 - DSTACRequestTimeout = 1000 - DSTACChannelOpenTimeOut = 1000 - PsDscRunAscredential = $SetupAccount - } + SPDistributedCacheClientSettings Settings + { + IsSingleInstance = "Yes" + DLTCMaxConnectionsToServer = 3 + DLTCRequestTimeout = 1000 + DLTCChannelOpenTimeOut = 1000 + DVSCMaxConnectionsToServer = 3 + DVSCRequestTimeout = 1000 + DVSCChannelOpenTimeOut = 1000 + DACMaxConnectionsToServer = 3 + DACRequestTimeout = 1000 + DACChannelOpenTimeOut = 1000 + DAFMaxConnectionsToServer = 3 + DAFRequestTimeout = 1000 + DAFChannelOpenTimeOut = 1000 + DAFCMaxConnectionsToServer = 3 + DAFCRequestTimeout = 1000 + DAFCChannelOpenTimeOut = 1000 + DBCMaxConnectionsToServer = 3 + DBCRequestTimeout = 1000 + DBCChannelOpenTimeOut = 1000 + DDCMaxConnectionsToServer = 3 + DDCRequestTimeout = 1000 + DDCChannelOpenTimeOut = 1000 + DSCMaxConnectionsToServer = 3 + DSCRequestTimeout = 1000 + DSCChannelOpenTimeOut = 1000 + DTCMaxConnectionsToServer = 3 + DTCRequestTimeout = 1000 + DTCChannelOpenTimeOut = 1000 + DSTACMaxConnectionsToServer = 3 + DSTACRequestTimeout = 1000 + DSTACChannelOpenTimeOut = 1000 + PsDscRunAscredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPDistributedCacheClientSettings/2-ConfigureClientSettings 2016.ps1 b/SharePointDsc/Examples/Resources/SPDistributedCacheClientSettings/2-ConfigureClientSettings 2016.ps1 index 3d421ab31..843b25dd1 100644 --- a/SharePointDsc/Examples/Resources/SPDistributedCacheClientSettings/2-ConfigureClientSettings 2016.ps1 +++ b/SharePointDsc/Examples/Resources/SPDistributedCacheClientSettings/2-ConfigureClientSettings 2016.ps1 @@ -40,65 +40,68 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPDistributedCacheClientSettings Settings - { - IsSingleInstance = "Yes" - DLTCMaxConnectionsToServer = 3 - DLTCRequestTimeout = 1000 - DLTCChannelOpenTimeOut = 1000 - DVSCMaxConnectionsToServer = 3 - DVSCRequestTimeout = 1000 - DVSCChannelOpenTimeOut = 1000 - DACMaxConnectionsToServer = 3 - DACRequestTimeout = 1000 - DACChannelOpenTimeOut = 1000 - DAFMaxConnectionsToServer = 3 - DAFRequestTimeout = 1000 - DAFChannelOpenTimeOut = 1000 - DAFCMaxConnectionsToServer = 3 - DAFCRequestTimeout = 1000 - DAFCChannelOpenTimeOut = 1000 - DBCMaxConnectionsToServer = 3 - DBCRequestTimeout = 1000 - DBCChannelOpenTimeOut = 1000 - DDCMaxConnectionsToServer = 3 - DDCRequestTimeout = 1000 - DDCChannelOpenTimeOut = 1000 - DSCMaxConnectionsToServer = 3 - DSCRequestTimeout = 1000 - DSCChannelOpenTimeOut = 1000 - DTCMaxConnectionsToServer = 3 - DTCRequestTimeout = 1000 - DTCChannelOpenTimeOut = 1000 - DSTACMaxConnectionsToServer = 3 - DSTACRequestTimeout = 1000 - DSTACChannelOpenTimeOut = 1000 - DFLTCMaxConnectionsToServer = 3 - DFLTCRequestTimeout = 1000 - DFLTCChannelOpenTimeOut = 1000 - DSWUCMaxConnectionsToServer = 3 - DSWUCRequestTimeout = 1000 - DSWUCChannelOpenTimeOut = 1000 - DUGCMaxConnectionsToServer = 3 - DUGCRequestTimeout = 1000 - DUGCChannelOpenTimeOut = 1000 - DRTCMaxConnectionsToServer = 3 - DRTCRequestTimeout = 1000 - DRTCChannelOpenTimeOut = 1000 - DHSCMaxConnectionsToServer = 3 - DHSCRequestTimeout = 1000 - DHSCChannelOpenTimeOut = 1000 - PsDscRunAscredential = $SetupAccount - } + SPDistributedCacheClientSettings Settings + { + IsSingleInstance = "Yes" + DLTCMaxConnectionsToServer = 3 + DLTCRequestTimeout = 1000 + DLTCChannelOpenTimeOut = 1000 + DVSCMaxConnectionsToServer = 3 + DVSCRequestTimeout = 1000 + DVSCChannelOpenTimeOut = 1000 + DACMaxConnectionsToServer = 3 + DACRequestTimeout = 1000 + DACChannelOpenTimeOut = 1000 + DAFMaxConnectionsToServer = 3 + DAFRequestTimeout = 1000 + DAFChannelOpenTimeOut = 1000 + DAFCMaxConnectionsToServer = 3 + DAFCRequestTimeout = 1000 + DAFCChannelOpenTimeOut = 1000 + DBCMaxConnectionsToServer = 3 + DBCRequestTimeout = 1000 + DBCChannelOpenTimeOut = 1000 + DDCMaxConnectionsToServer = 3 + DDCRequestTimeout = 1000 + DDCChannelOpenTimeOut = 1000 + DSCMaxConnectionsToServer = 3 + DSCRequestTimeout = 1000 + DSCChannelOpenTimeOut = 1000 + DTCMaxConnectionsToServer = 3 + DTCRequestTimeout = 1000 + DTCChannelOpenTimeOut = 1000 + DSTACMaxConnectionsToServer = 3 + DSTACRequestTimeout = 1000 + DSTACChannelOpenTimeOut = 1000 + DFLTCMaxConnectionsToServer = 3 + DFLTCRequestTimeout = 1000 + DFLTCChannelOpenTimeOut = 1000 + DSWUCMaxConnectionsToServer = 3 + DSWUCRequestTimeout = 1000 + DSWUCChannelOpenTimeOut = 1000 + DUGCMaxConnectionsToServer = 3 + DUGCRequestTimeout = 1000 + DUGCChannelOpenTimeOut = 1000 + DRTCMaxConnectionsToServer = 3 + DRTCRequestTimeout = 1000 + DRTCChannelOpenTimeOut = 1000 + DHSCMaxConnectionsToServer = 3 + DHSCRequestTimeout = 1000 + DHSCChannelOpenTimeOut = 1000 + PsDscRunAscredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPDistributedCacheService/1-SingleServerCache.ps1 b/SharePointDsc/Examples/Resources/SPDistributedCacheService/1-SingleServerCache.ps1 index 9fc8753dd..59836cbcc 100644 --- a/SharePointDsc/Examples/Resources/SPDistributedCacheService/1-SingleServerCache.ps1 +++ b/SharePointDsc/Examples/Resources/SPDistributedCacheService/1-SingleServerCache.ps1 @@ -41,23 +41,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPDistributedCacheService EnableDistributedCache - { - Name = "AppFabricCachingService" - CacheSizeInMB = 8192 - ServiceAccount = "DEMO\ServiceAccount" - PsDscRunAsCredential = $SetupAccount - CreateFirewallRules = $true - } + SPDistributedCacheService EnableDistributedCache + { + Name = "AppFabricCachingService" + CacheSizeInMB = 8192 + ServiceAccount = "DEMO\ServiceAccount" + CreateFirewallRules = $true + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPDistributedCacheService/2-CacheNoFirewall.ps1 b/SharePointDsc/Examples/Resources/SPDistributedCacheService/2-CacheNoFirewall.ps1 index 99831849c..8cd20355f 100644 --- a/SharePointDsc/Examples/Resources/SPDistributedCacheService/2-CacheNoFirewall.ps1 +++ b/SharePointDsc/Examples/Resources/SPDistributedCacheService/2-CacheNoFirewall.ps1 @@ -42,23 +42,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPDistributedCacheService EnableDistributedCache - { - Name = "AppFabricCachingService" - CacheSizeInMB = 8192 - ServiceAccount = "DEMO\ServiceAccount" - PsDscRunAsCredential = $SetupAccount - CreateFirewallRules = $false - } + SPDistributedCacheService EnableDistributedCache + { + Name = "AppFabricCachingService" + CacheSizeInMB = 8192 + ServiceAccount = "DEMO\ServiceAccount" + CreateFirewallRules = $false + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPDistributedCacheService/3-MultiServerCache.ps1 b/SharePointDsc/Examples/Resources/SPDistributedCacheService/3-MultiServerCache.ps1 index 742ca6353..84e57f74c 100644 --- a/SharePointDsc/Examples/Resources/SPDistributedCacheService/3-MultiServerCache.ps1 +++ b/SharePointDsc/Examples/Resources/SPDistributedCacheService/3-MultiServerCache.ps1 @@ -46,69 +46,71 @@ Updated author, copyright notice, and URLs. #> - $ConfigurationData = @{ - AllNodes = @( - @{ - NodeName = 'Server1' - PSDscAllowPlainTextPassword = $true - }, - @{ - NodeName = 'Server2' - PSDscAllowPlainTextPassword = $true - }, - @{ - NodeName = 'Server3' - PSDscAllowPlainTextPassword = $true - } - ) - } +$ConfigurationData = @{ + AllNodes = @( + @{ + NodeName = 'Server1' + PSDscAllowPlainTextPassword = $true + }, + @{ + NodeName = 'Server2' + PSDscAllowPlainTextPassword = $true + }, + @{ + NodeName = 'Server3' + PSDscAllowPlainTextPassword = $true + } + ) +} + +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc - Configuration Example + node "Server1" { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node "Server1" + SPDistributedCacheService EnableDistributedCache { - SPDistributedCacheService EnableDistributedCache - { - Name = "AppFabricCachingService" - CacheSizeInMB = 8192 - ServiceAccount = "DEMO\ServiceAccount" - ServerProvisionOrder = @("Server1","Server2") - CreateFirewallRules = $true - PsDscRunAsCredential = $SetupAccount - } + Name = "AppFabricCachingService" + CacheSizeInMB = 8192 + ServiceAccount = "DEMO\ServiceAccount" + ServerProvisionOrder = @("Server1", "Server2") + CreateFirewallRules = $true + PsDscRunAsCredential = $SetupAccount } + } - node "Server2" + node "Server2" + { + SPDistributedCacheService EnableDistributedCache { - SPDistributedCacheService EnableDistributedCache - { - Name = "AppFabricCachingService" - CacheSizeInMB = 8192 - ServiceAccount = "DEMO\ServiceAccount" - ServerProvisionOrder = @("Server1","Server2") - CreateFirewallRules = $true - PsDscRunAsCredential = $SetupAccount - } + Name = "AppFabricCachingService" + CacheSizeInMB = 8192 + ServiceAccount = "DEMO\ServiceAccount" + ServerProvisionOrder = @("Server1", "Server2") + CreateFirewallRules = $true + PsDscRunAsCredential = $SetupAccount } + } - node "Server3" + node "Server3" + { + SPDistributedCacheService EnableDistributedCache { - SPDistributedCacheService EnableDistributedCache - { - Name = "AppFabricCachingService" - CacheSizeInMB = 8192 - ServiceAccount = "DEMO\ServiceAccount" - ServerProvisionOrder = @("Server1","Server2") - CreateFirewallRules = $true - Ensure = 'Absent' - PsDscRunAsCredential = $SetupAccount - } + Name = "AppFabricCachingService" + CacheSizeInMB = 8192 + ServiceAccount = "DEMO\ServiceAccount" + ServerProvisionOrder = @("Server1", "Server2") + CreateFirewallRules = $true + Ensure = 'Absent' + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPDocIcon/1-ConfigureDocIcon.ps1 b/SharePointDsc/Examples/Resources/SPDocIcon/1-ConfigureDocIcon.ps1 index e7757b3d6..0882a91f8 100644 --- a/SharePointDsc/Examples/Resources/SPDocIcon/1-ConfigureDocIcon.ps1 +++ b/SharePointDsc/Examples/Resources/SPDocIcon/1-ConfigureDocIcon.ps1 @@ -42,14 +42,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPDocIcon ConfigurePDFIcon { FileType = 'PDF' diff --git a/SharePointDsc/Examples/Resources/SPDocIcon/2-RemoveDocIcon.ps1 b/SharePointDsc/Examples/Resources/SPDocIcon/2-RemoveDocIcon.ps1 index d53b40f68..bc9ff8975 100644 --- a/SharePointDsc/Examples/Resources/SPDocIcon/2-RemoveDocIcon.ps1 +++ b/SharePointDsc/Examples/Resources/SPDocIcon/2-RemoveDocIcon.ps1 @@ -42,14 +42,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPDocIcon RemovePDFIcon { FileType = 'PDF' diff --git a/SharePointDsc/Examples/Resources/SPExcelServiceApp/1-CreateServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPExcelServiceApp/1-CreateServiceApp.ps1 index 0b8450913..076b0952f 100644 --- a/SharePointDsc/Examples/Resources/SPExcelServiceApp/1-CreateServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPExcelServiceApp/1-CreateServiceApp.ps1 @@ -39,21 +39,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPExcelServiceApp ExcelServices - { - Name = "Excel Services Service Application" - ApplicationPool = "SharePoint Service Applications" - PsDscRunAsCredential = $SetupAccount - } + SPExcelServiceApp ExcelServices + { + Name = "Excel Services Service Application" + ApplicationPool = "SharePoint Service Applications" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPExcelServiceApp/2-RemoveServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPExcelServiceApp/2-RemoveServiceApp.ps1 index de61b226b..3f82c6476 100644 --- a/SharePointDsc/Examples/Resources/SPExcelServiceApp/2-RemoveServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPExcelServiceApp/2-RemoveServiceApp.ps1 @@ -41,22 +41,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPExcelServiceApp ExcelServices - { - Name = "Excel Services Service Application" - ApplicationPool = "n/a" - Ensure = "Absent" - PsDscRunAsCredential = $SetupAccount - } + SPExcelServiceApp ExcelServices + { + Name = "Excel Services Service Application" + ApplicationPool = "n/a" + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPFarm/1-CreateBasicFarm.ps1 b/SharePointDsc/Examples/Resources/SPFarm/1-CreateBasicFarm.ps1 index ba49f4c5b..721fb9a17 100644 --- a/SharePointDsc/Examples/Resources/SPFarm/1-CreateBasicFarm.ps1 +++ b/SharePointDsc/Examples/Resources/SPFarm/1-CreateBasicFarm.ps1 @@ -42,34 +42,37 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $FarmAccount, + + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount, + + [Parameter(Mandatory = $true)] + [PSCredential] + $Passphrase + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $FarmAccount, - - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount, - - [Parameter(Mandatory = $true)] - [PSCredential] - $Passphrase - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPFarm SharePointFarm - { - IsSingleInstance = "Yes" - DatabaseServer = "SQL.contoso.local\SQLINSTANCE" - FarmConfigDatabaseName = "SP_Config" - AdminContentDatabaseName = "SP_AdminContent" - Passphrase = $Passphrase - FarmAccount = $FarmAccount - RunCentralAdmin = $true - PsDscRunAsCredential = $SetupAccount - } + SPFarm SharePointFarm + { + IsSingleInstance = "Yes" + DatabaseServer = "SQL.contoso.local\SQLINSTANCE" + FarmConfigDatabaseName = "SP_Config" + AdminContentDatabaseName = "SP_AdminContent" + Passphrase = $Passphrase + FarmAccount = $FarmAccount + RunCentralAdmin = $true + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPFarm/2-CreateCustomCentralAdmin.ps1 b/SharePointDsc/Examples/Resources/SPFarm/2-CreateCustomCentralAdmin.ps1 index db2e76630..b13bba9c7 100644 --- a/SharePointDsc/Examples/Resources/SPFarm/2-CreateCustomCentralAdmin.ps1 +++ b/SharePointDsc/Examples/Resources/SPFarm/2-CreateCustomCentralAdmin.ps1 @@ -42,36 +42,39 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $FarmAccount, + + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount, + + [Parameter(Mandatory = $true)] + [PSCredential] + $Passphrase + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $FarmAccount, - - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount, - - [Parameter(Mandatory = $true)] - [PSCredential] - $Passphrase - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPFarm SharePointFarm - { - IsSingleInstance = "Yes" - DatabaseServer = "SQL.contoso.local\SQLINSTANCE" - FarmConfigDatabaseName = "SP_Config" - AdminContentDatabaseName = "SP_AdminContent" - CentralAdministrationPort = 5000 - CentralAdministrationAuth = "Kerberos" - Passphrase = $Passphrase - FarmAccount = $FarmAccount - RunCentralAdmin = $true - PsDscRunAsCredential = $SetupAccount - } + SPFarm SharePointFarm + { + IsSingleInstance = "Yes" + DatabaseServer = "SQL.contoso.local\SQLINSTANCE" + FarmConfigDatabaseName = "SP_Config" + AdminContentDatabaseName = "SP_AdminContent" + CentralAdministrationPort = 5000 + CentralAdministrationAuth = "Kerberos" + Passphrase = $Passphrase + FarmAccount = $FarmAccount + RunCentralAdmin = $true + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPFarm/3-CreateFarmWithServerRole.ps1 b/SharePointDsc/Examples/Resources/SPFarm/3-CreateFarmWithServerRole.ps1 index 814061a9e..57cfeebb3 100644 --- a/SharePointDsc/Examples/Resources/SPFarm/3-CreateFarmWithServerRole.ps1 +++ b/SharePointDsc/Examples/Resources/SPFarm/3-CreateFarmWithServerRole.ps1 @@ -45,35 +45,38 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $FarmAccount, + + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount, + + [Parameter(Mandatory = $true)] + [PSCredential] + $Passphrase + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $FarmAccount, - - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount, - - [Parameter(Mandatory = $true)] - [PSCredential] - $Passphrase - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPFarm SharePointFarm - { - IsSingleInstance = "Yes" - DatabaseServer = "SQL.contoso.local\SQLINSTANCE" - FarmConfigDatabaseName = "SP_Config" - AdminContentDatabaseName = "SP_AdminContent" - ServerRole = "Application" - Passphrase = $Passphrase - FarmAccount = $FarmAccount - RunCentralAdmin = $true - PsDscRunAsCredential = $SetupAccount - } + SPFarm SharePointFarm + { + IsSingleInstance = "Yes" + DatabaseServer = "SQL.contoso.local\SQLINSTANCE" + FarmConfigDatabaseName = "SP_Config" + AdminContentDatabaseName = "SP_AdminContent" + ServerRole = "Application" + Passphrase = $Passphrase + FarmAccount = $FarmAccount + RunCentralAdmin = $true + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPFarm/4-CreateBasicFarmWithApplicationCredentialKey.ps1 b/SharePointDsc/Examples/Resources/SPFarm/4-CreateBasicFarmWithApplicationCredentialKey.ps1 index 7735ebb87..df05bde56 100644 --- a/SharePointDsc/Examples/Resources/SPFarm/4-CreateBasicFarmWithApplicationCredentialKey.ps1 +++ b/SharePointDsc/Examples/Resources/SPFarm/4-CreateBasicFarmWithApplicationCredentialKey.ps1 @@ -45,7 +45,8 @@ admin site in this example is provisioned to port 9999 using NTLM authentication Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $FarmAccount, @@ -62,25 +63,22 @@ Configuration Example [PSCredential] $ApplicationCredentialKey ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPFarm SharePointFarm { - IsSingleInstance = "Yes" - DatabaseServer = "SQL.contoso.local\SQLINSTANCE" - FarmConfigDatabaseName = "SP_Config" - AdminContentDatabaseName = "SP_AdminContent" - Passphrase = $Passphrase - FarmAccount = $FarmAccount - ApplicationCredentialKey = $ApplicationCredentialKey - RunCentralAdmin = $true - PsDscRunAsCredential = $SetupAccount + IsSingleInstance = "Yes" + DatabaseServer = "SQL.contoso.local\SQLINSTANCE" + FarmConfigDatabaseName = "SP_Config" + AdminContentDatabaseName = "SP_AdminContent" + Passphrase = $Passphrase + FarmAccount = $FarmAccount + ApplicationCredentialKey = $ApplicationCredentialKey + RunCentralAdmin = $true + PsDscRunAsCredential = $SetupAccount } } } - -<# -.EXAMPLE -#> - diff --git a/SharePointDsc/Examples/Resources/SPFarmAdministrators/1-SetSpecificAdmins.ps1 b/SharePointDsc/Examples/Resources/SPFarmAdministrators/1-SetSpecificAdmins.ps1 index 33084e4b9..0f5a8757e 100644 --- a/SharePointDsc/Examples/Resources/SPFarmAdministrators/1-SetSpecificAdmins.ps1 +++ b/SharePointDsc/Examples/Resources/SPFarmAdministrators/1-SetSpecificAdmins.ps1 @@ -40,21 +40,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPFarmAdministrators LocalFarmAdmins - { - IsSingleInstance = "Yes" - Members = @("CONTOSO\user1", "CONTOSO\user2") - PsDscRunAsCredential = $SetupAccount - } + SPFarmAdministrators LocalFarmAdmins + { + IsSingleInstance = "Yes" + Members = @("CONTOSO\user1", "CONTOSO\user2") + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPFarmAdministrators/2-SetIncludeExcludeAdmins.ps1 b/SharePointDsc/Examples/Resources/SPFarmAdministrators/2-SetIncludeExcludeAdmins.ps1 index bbe97072d..3c74e42b6 100644 --- a/SharePointDsc/Examples/Resources/SPFarmAdministrators/2-SetIncludeExcludeAdmins.ps1 +++ b/SharePointDsc/Examples/Resources/SPFarmAdministrators/2-SetIncludeExcludeAdmins.ps1 @@ -42,22 +42,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPFarmAdministrators LocalFarmAdmins - { - IsSingleInstance = "Yes" - MembersToInclude = @("CONTOSO\user1") - MembersToExclude = @("CONTOSO\user2") - PsDscRunAsCredential = $SetupAccount - } + SPFarmAdministrators LocalFarmAdmins + { + IsSingleInstance = "Yes" + MembersToInclude = @("CONTOSO\user1") + MembersToExclude = @("CONTOSO\user2") + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPFarmSolution/1-DeploySolution.ps1 b/SharePointDsc/Examples/Resources/SPFarmSolution/1-DeploySolution.ps1 index e7b44376a..900ab176a 100644 --- a/SharePointDsc/Examples/Resources/SPFarmSolution/1-DeploySolution.ps1 +++ b/SharePointDsc/Examples/Resources/SPFarmSolution/1-DeploySolution.ps1 @@ -39,24 +39,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPFarmSolution SampleWsp - { - Name = "MySolution.wsp" - LiteralPath = "C:\src\MySolution.wsp" - Ensure = "Present" - Version = "1.0.0" - WebAppUrls = @("http://collaboration", "http://mysites") - PsDscRunAsCredential = $SetupAccount - } + SPFarmSolution SampleWsp + { + Name = "MySolution.wsp" + LiteralPath = "C:\src\MySolution.wsp" + Ensure = "Present" + Version = "1.0.0" + WebAppUrls = @("http://collaboration", "http://mysites") + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPFeature/1-EnableFeature.ps1 b/SharePointDsc/Examples/Resources/SPFeature/1-EnableFeature.ps1 index c6f42b2e2..e4cdcd7a3 100644 --- a/SharePointDsc/Examples/Resources/SPFeature/1-EnableFeature.ps1 +++ b/SharePointDsc/Examples/Resources/SPFeature/1-EnableFeature.ps1 @@ -39,23 +39,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPFeature EnableViewFormsLockDown - { - Name = "ViewFormPagesLockDown" - Url = "http://www.contoso.com" - FeatureScope = "Site" - PsDscRunAsCredential = $SetupAccount - Version = "1.0.0.0" - } + SPFeature EnableViewFormsLockDown + { + Name = "ViewFormPagesLockDown" + Url = "http://www.contoso.com" + FeatureScope = "Site" + Version = "1.0.0.0" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPFeature/2-DisableFeature.ps1 b/SharePointDsc/Examples/Resources/SPFeature/2-DisableFeature.ps1 index db76a3340..33cc46599 100644 --- a/SharePointDsc/Examples/Resources/SPFeature/2-DisableFeature.ps1 +++ b/SharePointDsc/Examples/Resources/SPFeature/2-DisableFeature.ps1 @@ -41,22 +41,25 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPFeature EnableViewFormsLockDown { Name = "ViewFormPagesLockDown" Url = "http://www.contoso.com" FeatureScope = "Site" Ensure = "Absent" - PsDscRunAsCredential = $SetupAccount Version = "1.0.0.0" + PsDscRunAsCredential = $SetupAccount } } } diff --git a/SharePointDsc/Examples/Resources/SPHealthAnalyzerRuleState/1-DisableHealthRule.ps1 b/SharePointDsc/Examples/Resources/SPHealthAnalyzerRuleState/1-DisableHealthRule.ps1 index ee0290efa..a680c73cc 100644 --- a/SharePointDsc/Examples/Resources/SPHealthAnalyzerRuleState/1-DisableHealthRule.ps1 +++ b/SharePointDsc/Examples/Resources/SPHealthAnalyzerRuleState/1-DisableHealthRule.ps1 @@ -39,24 +39,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPHealthAnalyzerRuleState DisableDiskSpaceRule - { - Name = "Drives are at risk of running out of free space." - Enabled = $false - RuleScope = "All Servers" - Schedule = "Daily" - FixAutomatically = $false - PsDscRunAsCredential = $SetupAccount - } + SPHealthAnalyzerRuleState DisableDiskSpaceRule + { + Name = "Drives are at risk of running out of free space." + Enabled = $false + RuleScope = "All Servers" + Schedule = "Daily" + FixAutomatically = $false + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPIncomingEmailSettings/1-EnableAutomaticMode.ps1 b/SharePointDsc/Examples/Resources/SPIncomingEmailSettings/1-EnableAutomaticMode.ps1 index 4ae01a417..f236843b8 100644 --- a/SharePointDsc/Examples/Resources/SPIncomingEmailSettings/1-EnableAutomaticMode.ps1 +++ b/SharePointDsc/Examples/Resources/SPIncomingEmailSettings/1-EnableAutomaticMode.ps1 @@ -41,22 +41,25 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPIncomingEmailSettings AutomaticEmail { - IsSingleInstance = "Yes" - Ensure = "Present" - UseAutomaticSettings = $true + IsSingleInstance = "Yes" + Ensure = "Present" + UseAutomaticSettings = $true UseDirectoryManagementService = "No" - ServerDisplayAddress = "contoso.com" - PsDscRunAsCredential = $SetupAccount + ServerDisplayAddress = "contoso.com" + PsDscRunAsCredential = $SetupAccount } } } diff --git a/SharePointDsc/Examples/Resources/SPIncomingEmailSettings/2-Enable-AdvancedMode.ps1 b/SharePointDsc/Examples/Resources/SPIncomingEmailSettings/2-Enable-AdvancedMode.ps1 index 55400035e..e60165c29 100644 --- a/SharePointDsc/Examples/Resources/SPIncomingEmailSettings/2-Enable-AdvancedMode.ps1 +++ b/SharePointDsc/Examples/Resources/SPIncomingEmailSettings/2-Enable-AdvancedMode.ps1 @@ -41,23 +41,26 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPIncomingEmailSettings AutomaticEmail { - IsSingleInstance = "Yes" - Ensure = "Present" - UseAutomaticSettings = $false + IsSingleInstance = "Yes" + Ensure = "Present" + UseAutomaticSettings = $false UseDirectoryManagementService = "No" - ServerDisplayAddress = "contoso.com" - DropFolder = "\\MailServer\Pickup" - PsDscRunAsCredential = $SetupAccount + ServerDisplayAddress = "contoso.com" + DropFolder = "\\MailServer\Pickup" + PsDscRunAsCredential = $SetupAccount } } } diff --git a/SharePointDsc/Examples/Resources/SPInfoPathFormsServiceConfig/1-Configure.ps1 b/SharePointDsc/Examples/Resources/SPInfoPathFormsServiceConfig/1-Configure.ps1 index 1a00b7d07..e4a4a78c1 100644 --- a/SharePointDsc/Examples/Resources/SPInfoPathFormsServiceConfig/1-Configure.ps1 +++ b/SharePointDsc/Examples/Resources/SPInfoPathFormsServiceConfig/1-Configure.ps1 @@ -40,32 +40,35 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPInfoPathFormsServiceConfig InfoPathFormsServiceConfig - { - IsSingleInstance = "Yes" - AllowUserFormBrowserEnabling = $true - AllowUserFormBrowserRendering = $true - MaxDataConnectionTimeout = 20000 - DefaultDataConnectionTimeout = 10000 - MaxDataConnectionResponseSize = 1500 - RequireSslForDataConnections = $true - AllowEmbeddedSqlForDataConnections = $false - AllowUdcAuthenticationForDataConnections = $false - AllowUserFormCrossDomainDataConnections = $false - MaxPostbacksPerSession = 75 - MaxUserActionsPerPostback = 200 - ActiveSessionsTimeout = 1440 - MaxSizeOfUserFormState = 4096 - } + SPInfoPathFormsServiceConfig InfoPathFormsServiceConfig + { + IsSingleInstance = "Yes" + AllowUserFormBrowserEnabling = $true + AllowUserFormBrowserRendering = $true + MaxDataConnectionTimeout = 20000 + DefaultDataConnectionTimeout = 10000 + MaxDataConnectionResponseSize = 1500 + RequireSslForDataConnections = $true + AllowEmbeddedSqlForDataConnections = $false + AllowUdcAuthenticationForDataConnections = $false + AllowUserFormCrossDomainDataConnections = $false + MaxPostbacksPerSession = 75 + MaxUserActionsPerPostback = 200 + ActiveSessionsTimeout = 1440 + MaxSizeOfUserFormState = 4096 } } +} diff --git a/SharePointDsc/Examples/Resources/SPInstall/1-InstallToDefaultPath.ps1 b/SharePointDsc/Examples/Resources/SPInstall/1-InstallToDefaultPath.ps1 index db8c46b88..43f95692a 100644 --- a/SharePointDsc/Examples/Resources/SPInstall/1-InstallToDefaultPath.ps1 +++ b/SharePointDsc/Examples/Resources/SPInstall/1-InstallToDefaultPath.ps1 @@ -41,21 +41,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPInstall InstallBinaries - { - IsSingleInstance = "Yes" - BinaryDir = "C:\SPInstall" - ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" - } + SPInstall InstallBinaries + { + IsSingleInstance = "Yes" + BinaryDir = "C:\SPInstall" + ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" } } +} diff --git a/SharePointDsc/Examples/Resources/SPInstall/2-InstallToCustomPath.ps1 b/SharePointDsc/Examples/Resources/SPInstall/2-InstallToCustomPath.ps1 index 4f1b03ff6..d568ff6dc 100644 --- a/SharePointDsc/Examples/Resources/SPInstall/2-InstallToCustomPath.ps1 +++ b/SharePointDsc/Examples/Resources/SPInstall/2-InstallToCustomPath.ps1 @@ -40,23 +40,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPInstall InstallBinaries - { - IsSingleInstance = "Yes" - BinaryDir = "D:\SharePoint\Binaries" - InstallPath = "D:\SharePoint\Install" - DataPath = "D:\SharePoint\Data" - ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" - } + SPInstall InstallBinaries + { + IsSingleInstance = "Yes" + BinaryDir = "D:\SharePoint\Binaries" + InstallPath = "D:\SharePoint\Install" + DataPath = "D:\SharePoint\Data" + ProductKey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" } } +} diff --git a/SharePointDsc/Examples/Resources/SPInstall/3-InstallSPFoundation.ps1 b/SharePointDsc/Examples/Resources/SPInstall/3-InstallSPFoundation.ps1 index bf03e8247..ad851e57c 100644 --- a/SharePointDsc/Examples/Resources/SPInstall/3-InstallSPFoundation.ps1 +++ b/SharePointDsc/Examples/Resources/SPInstall/3-InstallSPFoundation.ps1 @@ -39,24 +39,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName PSDesiredStateConfiguration + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName PSDesiredStateConfiguration - - node localhost { - Package InstallSharePointFoundation - { - Ensure = "Present" - Name = "Microsoft SharePoint Foundation 2013 Core" - Path = "E:\SharePoint2013\Setup.exe" - Arguments = "/config E:\SharePoint2013\files\setupfarmsilent\config.xml" - ProductID = "90150000-1014-0000-1000-0000000FF1CE" - ReturnCode = 0 - } + Package InstallSharePointFoundation + { + Ensure = "Present" + Name = "Microsoft SharePoint Foundation 2013 Core" + Path = "E:\SharePoint2013\Setup.exe" + Arguments = "/config E:\SharePoint2013\files\setupfarmsilent\config.xml" + ProductID = "90150000-1014-0000-1000-0000000FF1CE" + ReturnCode = 0 } } +} diff --git a/SharePointDsc/Examples/Resources/SPInstallLanguagePack/1-InstallLanguagePack.ps1 b/SharePointDsc/Examples/Resources/SPInstallLanguagePack/1-InstallLanguagePack.ps1 index b2fbed43e..3a587e7fc 100644 --- a/SharePointDsc/Examples/Resources/SPInstallLanguagePack/1-InstallLanguagePack.ps1 +++ b/SharePointDsc/Examples/Resources/SPInstallLanguagePack/1-InstallLanguagePack.ps1 @@ -41,20 +41,23 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPInstallLanguagePack InstallLPBinaries - { - BinaryDir = "C:\SPInstall" - Ensure = "Present" - } + SPInstallLanguagePack InstallLPBinaries + { + BinaryDir = "C:\SPInstall" + Ensure = "Present" } } +} diff --git a/SharePointDsc/Examples/Resources/SPInstallLanguagePack/2-InstallLanguagePackInWindow.ps1 b/SharePointDsc/Examples/Resources/SPInstallLanguagePack/2-InstallLanguagePackInWindow.ps1 index dc6cb0102..5db8eed97 100644 --- a/SharePointDsc/Examples/Resources/SPInstallLanguagePack/2-InstallLanguagePackInWindow.ps1 +++ b/SharePointDsc/Examples/Resources/SPInstallLanguagePack/2-InstallLanguagePackInWindow.ps1 @@ -41,22 +41,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPInstallLanguagePack InstallLPBinaries - { - BinaryDir = "C:\SPInstall" - BinaryInstallDays = "sat", "sun" - BinaryInstallTime = "12:00am to 2:00am" - Ensure = "Present" - } + SPInstallLanguagePack InstallLPBinaries + { + BinaryDir = "C:\SPInstall" + BinaryInstallDays = "sat", "sun" + BinaryInstallTime = "12:00am to 2:00am" + Ensure = "Present" } } +} diff --git a/SharePointDsc/Examples/Resources/SPInstallPrereqs/1-OnlineInstall.ps1 b/SharePointDsc/Examples/Resources/SPInstallPrereqs/1-OnlineInstall.ps1 index aed4b0fbc..a2c80c9d2 100644 --- a/SharePointDsc/Examples/Resources/SPInstallPrereqs/1-OnlineInstall.ps1 +++ b/SharePointDsc/Examples/Resources/SPInstallPrereqs/1-OnlineInstall.ps1 @@ -40,21 +40,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPInstallPrereqs InstallPrerequisites - { - IsSingleInstance = "Yes" - InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe" - OnlineMode = $true - } + SPInstallPrereqs InstallPrerequisites + { + IsSingleInstance = "Yes" + InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe" + OnlineMode = $true } } +} diff --git a/SharePointDsc/Examples/Resources/SPInstallPrereqs/2-OfflineInstall_SP2013.ps1 b/SharePointDsc/Examples/Resources/SPInstallPrereqs/2-OfflineInstall_SP2013.ps1 index 9a5ad516a..f90c2daa2 100644 --- a/SharePointDsc/Examples/Resources/SPInstallPrereqs/2-OfflineInstall_SP2013.ps1 +++ b/SharePointDsc/Examples/Resources/SPInstallPrereqs/2-OfflineInstall_SP2013.ps1 @@ -40,33 +40,36 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPInstallPrereqs InstallPrerequisites - { - IsSingleInstance = "Yes" - InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe" - OnlineMode = $false - SXSpath = "c:\SPInstall\Windows2012r2-SXS" - SQLNCli = "C:\SPInstall\prerequisiteinstallerfiles\sqlncli.msi" - PowerShell = "C:\SPInstall\prerequisiteinstallerfiles\Windows6.1-KB2506143-x64.msu" - NETFX = "C:\SPInstall\prerequisiteinstallerfiles\dotNetFx45_Full_setup.exe" - IDFX = "C:\SPInstall\prerequisiteinstallerfiles\Windows6.1-KB974405-x64.msu" - Sync = "C:\SPInstall\prerequisiteinstallerfiles\Synchronization.msi" - AppFabric = "C:\SPInstall\prerequisiteinstallerfiles\WindowsServerAppFabricSetup_x64.exe" - IDFX11 = "C:\SPInstall\prerequisiteinstallerfiles\MicrosoftIdentityExtensions-64.msi" - MSIPCClient = "C:\SPInstall\prerequisiteinstallerfiles\setup_msipc_x64.msi" - WCFDataServices = "C:\SPInstall\prerequisiteinstallerfiles\WcfDataServices.exe" - KB2671763 = "C:\SPInstall\prerequisiteinstallerfiles\AppFabric1.1-RTM-KB2671763-x64-ENU.exe" - WCFDataServices56 = "C:\SPInstall\prerequisiteinstallerfiles\WcfDataServices56.exe" - } + SPInstallPrereqs InstallPrerequisites + { + IsSingleInstance = "Yes" + InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe" + OnlineMode = $false + SXSpath = "c:\SPInstall\Windows2012r2-SXS" + SQLNCli = "C:\SPInstall\prerequisiteinstallerfiles\sqlncli.msi" + PowerShell = "C:\SPInstall\prerequisiteinstallerfiles\Windows6.1-KB2506143-x64.msu" + NETFX = "C:\SPInstall\prerequisiteinstallerfiles\dotNetFx45_Full_setup.exe" + IDFX = "C:\SPInstall\prerequisiteinstallerfiles\Windows6.1-KB974405-x64.msu" + Sync = "C:\SPInstall\prerequisiteinstallerfiles\Synchronization.msi" + AppFabric = "C:\SPInstall\prerequisiteinstallerfiles\WindowsServerAppFabricSetup_x64.exe" + IDFX11 = "C:\SPInstall\prerequisiteinstallerfiles\MicrosoftIdentityExtensions-64.msi" + MSIPCClient = "C:\SPInstall\prerequisiteinstallerfiles\setup_msipc_x64.msi" + WCFDataServices = "C:\SPInstall\prerequisiteinstallerfiles\WcfDataServices.exe" + KB2671763 = "C:\SPInstall\prerequisiteinstallerfiles\AppFabric1.1-RTM-KB2671763-x64-ENU.exe" + WCFDataServices56 = "C:\SPInstall\prerequisiteinstallerfiles\WcfDataServices56.exe" } } +} diff --git a/SharePointDsc/Examples/Resources/SPInstallPrereqs/3-OfflineInstall_SP2016.ps1 b/SharePointDsc/Examples/Resources/SPInstallPrereqs/3-OfflineInstall_SP2016.ps1 index 1d71a7ef4..cb8a68ace 100644 --- a/SharePointDsc/Examples/Resources/SPInstallPrereqs/3-OfflineInstall_SP2016.ps1 +++ b/SharePointDsc/Examples/Resources/SPInstallPrereqs/3-OfflineInstall_SP2016.ps1 @@ -40,33 +40,36 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPInstallPrereqs InstallPrerequisites - { - IsSingleInstance = "Yes" - InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe" - OnlineMode = $false - SXSpath = "C:\SPInstall\Windows2012r2-SXS" - SQLNCli = "C:\SPInstall\prerequisiteinstallerfiles\sqlncli.msi" - Sync = "C:\SPInstall\prerequisiteinstallerfiles\Synchronization.msi" - AppFabric = "C:\SPInstall\prerequisiteinstallerfiles\WindowsServerAppFabricSetup_x64.exe" - IDFX11 = "C:\SPInstall\prerequisiteinstallerfiles\MicrosoftIdentityExtensions-64.msi" - MSIPCClient = "C:\SPInstall\prerequisiteinstallerfiles\setup_msipc_x64.msi" - WCFDataServices56 = "C:\SPInstall\prerequisiteinstallerfiles\WcfDataServices56.exe" - MSVCRT11 = "C:\SPInstall\prerequisiteinstallerfiles\vcredist_x64.exe" - MSVCRT14 = "C:\SPInstall\prerequisiteinstallerfiles\vc_redist.x64.exe" - KB3092423 = "C:\SPInstall\prerequisiteinstallerfiles\AppFabric-KB3092423-x64-ENU.exe" - ODBC = "C:\SPInstall\prerequisiteinstallerfiles\msodbcsql.msi" - DotNetFx = "C:\SPInstall\prerequisiteinstallerfiles\NDP46-KB3045557-x86-x64-AllOS-ENU.exe" - } + SPInstallPrereqs InstallPrerequisites + { + IsSingleInstance = "Yes" + InstallerPath = "C:\SPInstall\Prerequisiteinstaller.exe" + OnlineMode = $false + SXSpath = "C:\SPInstall\Windows2012r2-SXS" + SQLNCli = "C:\SPInstall\prerequisiteinstallerfiles\sqlncli.msi" + Sync = "C:\SPInstall\prerequisiteinstallerfiles\Synchronization.msi" + AppFabric = "C:\SPInstall\prerequisiteinstallerfiles\WindowsServerAppFabricSetup_x64.exe" + IDFX11 = "C:\SPInstall\prerequisiteinstallerfiles\MicrosoftIdentityExtensions-64.msi" + MSIPCClient = "C:\SPInstall\prerequisiteinstallerfiles\setup_msipc_x64.msi" + WCFDataServices56 = "C:\SPInstall\prerequisiteinstallerfiles\WcfDataServices56.exe" + MSVCRT11 = "C:\SPInstall\prerequisiteinstallerfiles\vcredist_x64.exe" + MSVCRT14 = "C:\SPInstall\prerequisiteinstallerfiles\vc_redist.x64.exe" + KB3092423 = "C:\SPInstall\prerequisiteinstallerfiles\AppFabric-KB3092423-x64-ENU.exe" + ODBC = "C:\SPInstall\prerequisiteinstallerfiles\msodbcsql.msi" + DotNetFx = "C:\SPInstall\prerequisiteinstallerfiles\NDP46-KB3045557-x86-x64-AllOS-ENU.exe" } } +} diff --git a/SharePointDsc/Examples/Resources/SPIrmSettings/1-ApplyIRMSConfig.ps1 b/SharePointDsc/Examples/Resources/SPIrmSettings/1-ApplyIRMSConfig.ps1 index 4ecc813ed..9aa9d5a63 100644 --- a/SharePointDsc/Examples/Resources/SPIrmSettings/1-ApplyIRMSConfig.ps1 +++ b/SharePointDsc/Examples/Resources/SPIrmSettings/1-ApplyIRMSConfig.ps1 @@ -40,21 +40,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPIrmSettings RMSSettings - { - IsSingleInstance = "Yes" - RMSserver = "https://rms.contoso.com" - PsDscRunAsCredential = $SetupAccount - } + SPIrmSettings RMSSettings + { + IsSingleInstance = "Yes" + RMSserver = "https://rms.contoso.com" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPLogLevel/1-SetAreaAndCategorytoCustomValue.ps1 b/SharePointDsc/Examples/Resources/SPLogLevel/1-SetAreaAndCategorytoCustomValue.ps1 index 0b21cc7bd..4d96795d3 100644 --- a/SharePointDsc/Examples/Resources/SPLogLevel/1-SetAreaAndCategorytoCustomValue.ps1 +++ b/SharePointDsc/Examples/Resources/SPLogLevel/1-SetAreaAndCategorytoCustomValue.ps1 @@ -40,23 +40,26 @@ Updated author, copyright notice, and URLs. #> Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPLogLevel SetUserProfileLogingtoVerbose { - Name = "SP_Database-Verbose" - SPLogLevelSetting = @( + Name = "SP_Database-Verbose" + SPLogLevelSetting = @( MSFT_SPLogLevelItem { - Area = "SharePoint Server" - Name = "Database" - TraceLevel = "Verbose" - EventLevel = "Verbose" + Area = "SharePoint Server" + Name = "Database" + TraceLevel = "Verbose" + EventLevel = "Verbose" } ) PsDscRunAsCredential = $SetupAccount diff --git a/SharePointDsc/Examples/Resources/SPLogLevel/2-SetAreatoDefaultValue.ps1 b/SharePointDsc/Examples/Resources/SPLogLevel/2-SetAreatoDefaultValue.ps1 index baaf03d6e..b3a101628 100644 --- a/SharePointDsc/Examples/Resources/SPLogLevel/2-SetAreatoDefaultValue.ps1 +++ b/SharePointDsc/Examples/Resources/SPLogLevel/2-SetAreatoDefaultValue.ps1 @@ -40,23 +40,26 @@ Updated author, copyright notice, and URLs. #> Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPLogLevel SetAllSPServerToDefault { - Name = "SPServer_defaults" - SPLogLevelSetting = @( + Name = "SPServer_defaults" + SPLogLevelSetting = @( MSFT_SPLogLevelItem { - Area = "SharePoint Server" - Name = "*" - TraceLevel = "Default" - EventLevel = "Default" + Area = "SharePoint Server" + Name = "*" + TraceLevel = "Default" + EventLevel = "Default" } ) PsDscRunAsCredential = $SetupAccount diff --git a/SharePointDsc/Examples/Resources/SPLogLevel/3-SetMultipleCategoriestoCustomValues.ps1 b/SharePointDsc/Examples/Resources/SPLogLevel/3-SetMultipleCategoriestoCustomValues.ps1 index 805f73e4b..a03ab50ae 100644 --- a/SharePointDsc/Examples/Resources/SPLogLevel/3-SetMultipleCategoriestoCustomValues.ps1 +++ b/SharePointDsc/Examples/Resources/SPLogLevel/3-SetMultipleCategoriestoCustomValues.ps1 @@ -40,29 +40,32 @@ Updated author, copyright notice, and URLs. #> Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPLogLevel SetCustomValues { - Name = "CustomLoggingSettings" - SPLogLevelSetting = @( + Name = "CustomLoggingSettings" + SPLogLevelSetting = @( MSFT_SPLogLevelItem { - Area = "SharePoint Server" - Name = "Database" - TraceLevel = "Verbose" - EventLevel = "Verbose" + Area = "SharePoint Server" + Name = "Database" + TraceLevel = "Verbose" + EventLevel = "Verbose" } MSFT_SPLogLevelItem { - Area = "Business Connectivity Services" - Name = "Business Data" - TraceLevel = "Unexpected" - EventLevel = "Error" + Area = "Business Connectivity Services" + Name = "Business Data" + TraceLevel = "Unexpected" + EventLevel = "Error" } ) PsDscRunAsCredential = $SetupAccount diff --git a/SharePointDsc/Examples/Resources/SPMachineTranslationServiceApp/1-CreateServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPMachineTranslationServiceApp/1-CreateServiceApp.ps1 index b8493e078..f21ff4f1e 100644 --- a/SharePointDsc/Examples/Resources/SPMachineTranslationServiceApp/1-CreateServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPMachineTranslationServiceApp/1-CreateServiceApp.ps1 @@ -41,22 +41,25 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPMachineTranslationServiceApp MachineTranslationServiceApp { - Name = "Translation Service Application" - ApplicationPool = "SharePoint Service Applications" - DatabaseServer = "SQL.contoso.local" - DatabaseName = "Translation" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount + Name = "Translation Service Application" + ApplicationPool = "SharePoint Service Applications" + DatabaseServer = "SQL.contoso.local" + DatabaseName = "Translation" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } } diff --git a/SharePointDsc/Examples/Resources/SPMachineTranslationServiceApp/2-RemoveServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPMachineTranslationServiceApp/2-RemoveServiceApp.ps1 index 2a85bcd3b..932e7276b 100644 --- a/SharePointDsc/Examples/Resources/SPMachineTranslationServiceApp/2-RemoveServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPMachineTranslationServiceApp/2-RemoveServiceApp.ps1 @@ -41,22 +41,25 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPMachineTranslationServiceApp MachineTranslationServiceApp { - Name = "Translation Service Application" - ApplicationPool = "SharePoint Service Applications" - DatabaseServer = "SQL.contoso.local" - DatabaseName = "Translation" - Ensure = "Absent" - PsDscRunAsCredential = $SetupAccount + Name = "Translation Service Application" + ApplicationPool = "SharePoint Service Applications" + DatabaseServer = "SQL.contoso.local" + DatabaseName = "Translation" + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } diff --git a/SharePointDsc/Examples/Resources/SPManagedAccount/1-NewManagedAccount.ps1 b/SharePointDsc/Examples/Resources/SPManagedAccount/1-NewManagedAccount.ps1 index ac2178e62..353a05038 100644 --- a/SharePointDsc/Examples/Resources/SPManagedAccount/1-NewManagedAccount.ps1 +++ b/SharePointDsc/Examples/Resources/SPManagedAccount/1-NewManagedAccount.ps1 @@ -39,26 +39,29 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount, + + [Parameter(Mandatory = $true)] + [PSCredential] + $ManagedAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount, - - [Parameter(Mandatory = $true)] - [PSCredential] - $ManagedAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPManagedAccount NewManagedAccount - { - AccountName = $ManagedAccount.UserName - Account = $ManagedAccount - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPManagedAccount NewManagedAccount + { + AccountName = $ManagedAccount.UserName + Account = $ManagedAccount + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPManagedAccount/2-NewManagedAccountWithSchedule.ps1 b/SharePointDsc/Examples/Resources/SPManagedAccount/2-NewManagedAccountWithSchedule.ps1 index 92c3a1e6b..8623c83e0 100644 --- a/SharePointDsc/Examples/Resources/SPManagedAccount/2-NewManagedAccountWithSchedule.ps1 +++ b/SharePointDsc/Examples/Resources/SPManagedAccount/2-NewManagedAccountWithSchedule.ps1 @@ -40,27 +40,30 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount, + + [Parameter(Mandatory = $true)] + [PSCredential] + $ManagedAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount, - - [Parameter(Mandatory = $true)] - [PSCredential] - $ManagedAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPManagedAccount NewManagedAccount - { - AccountName = $ManagedAccount.UserName - Account = $ManagedAccount - Ensure = "Present" - Schedule = "monthly between 7 02:00:00 and 7 03:00:00" - PsDscRunAsCredential = $SetupAccount - } + SPManagedAccount NewManagedAccount + { + AccountName = $ManagedAccount.UserName + Account = $ManagedAccount + Ensure = "Present" + Schedule = "monthly between 7 02:00:00 and 7 03:00:00" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/1-CreateServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/1-CreateServiceApp.ps1 index 2750258ea..266251828 100644 --- a/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/1-CreateServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/1-CreateServiceApp.ps1 @@ -39,23 +39,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPManagedMetaDataServiceApp ManagedMetadataServiceApp - { - Name = "Managed Metadata Service Application" - ApplicationPool = "SharePoint Service Applications" - DatabaseServer = "SQL.contoso.local" - DatabaseName = "SP_ManagedMetadata" - PsDscRunAsCredential = $SetupAccount - } + SPManagedMetaDataServiceApp ManagedMetadataServiceApp + { + Name = "Managed Metadata Service Application" + ApplicationPool = "SharePoint Service Applications" + DatabaseServer = "SQL.contoso.local" + DatabaseName = "SP_ManagedMetadata" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/2-RemoveServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/2-RemoveServiceApp.ps1 index 84ca9b8e4..1078deb20 100644 --- a/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/2-RemoveServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/2-RemoveServiceApp.ps1 @@ -42,22 +42,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPManagedMetaDataServiceApp ManagedMetadataServiceApp - { - Name = "Managed Metadata Service Application" - ApplicationPool = "none" - Ensure = "Absent" - PsDscRunAsCredential = $SetupAccount - } + SPManagedMetaDataServiceApp ManagedMetadataServiceApp + { + Name = "Managed Metadata Service Application" + ApplicationPool = "none" + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/3-SetTermStoreAdmins.ps1 b/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/3-SetTermStoreAdmins.ps1 index 67e805c23..0fa2637d8 100644 --- a/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/3-SetTermStoreAdmins.ps1 +++ b/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/3-SetTermStoreAdmins.ps1 @@ -40,27 +40,30 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPManagedMetaDataServiceApp ManagedMetadataServiceApp - { - Name = "Managed Metadata Service Application" - PsDscRunAsCredential = $SetupAccount - ApplicationPool = "SharePoint Service Applications" - DatabaseServer = "SQL.contoso.local" - DatabaseName = "SP_ManagedMetadata" - TermStoreAdministrators = @( - "CONTOSO\user1", - "CONTOSO\user2" - ) - } + SPManagedMetaDataServiceApp ManagedMetadataServiceApp + { + Name = "Managed Metadata Service Application" + PsDscRunAsCredential = $SetupAccount + ApplicationPool = "SharePoint Service Applications" + DatabaseServer = "SQL.contoso.local" + DatabaseName = "SP_ManagedMetadata" + TermStoreAdministrators = @( + "CONTOSO\user1", + "CONTOSO\user2" + ) } } +} diff --git a/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/4-SetLanguageSettings.ps1 b/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/4-SetLanguageSettings.ps1 index facc76d18..e695a5f8e 100644 --- a/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/4-SetLanguageSettings.ps1 +++ b/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/4-SetLanguageSettings.ps1 @@ -40,29 +40,32 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPManagedMetaDataServiceApp ManagedMetadataServiceApp - { - Name = "Managed Metadata Service Application" - ApplicationPool = "SharePoint Service Applications" - DatabaseServer = "SQL.contoso.local" - DatabaseName = "SP_ManagedMetadata" - TermStoreAdministrators = @( - "CONTOSO\user1", - "CONTOSO\user2" - ) - DefaultLanguage = 1033 - Languages = @(1031, 1033) - PsDscRunAsCredential = $SetupAccount - } + SPManagedMetaDataServiceApp ManagedMetadataServiceApp + { + Name = "Managed Metadata Service Application" + ApplicationPool = "SharePoint Service Applications" + DatabaseServer = "SQL.contoso.local" + DatabaseName = "SP_ManagedMetadata" + TermStoreAdministrators = @( + "CONTOSO\user1", + "CONTOSO\user2" + ) + DefaultLanguage = 1033 + Languages = @(1031, 1033) + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/5-SetContentTypeHubUrl.ps1 b/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/5-SetContentTypeHubUrl.ps1 index cdf26986e..f8a9d840a 100644 --- a/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/5-SetContentTypeHubUrl.ps1 +++ b/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/5-SetContentTypeHubUrl.ps1 @@ -42,22 +42,25 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPManagedMetaDataServiceApp ManagedMetadataServiceApp { Name = "Managed Metadata Service Application" - PSDscRunAsCredential = $SetupAccount ApplicationPool = "SharePoint Service Applications" DatabaseServer = "SQL.contoso.local" DatabaseName = "SP_ManagedMetadata" ContentTypeHubUrl = "http://contoso.sharepoint.com/sites/ct" + PSDscRunAsCredential = $SetupAccount } } } diff --git a/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/6-SetContentTypeSettings.ps1 b/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/6-SetContentTypeSettings.ps1 index c596e584e..3dd6953cd 100644 --- a/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/6-SetContentTypeSettings.ps1 +++ b/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceApp/6-SetContentTypeSettings.ps1 @@ -42,24 +42,27 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPManagedMetaDataServiceApp ManagedMetadataServiceApp { Name = "Managed Metadata Service Application" - PSDscRunAsCredential = $SetupAccount ApplicationPool = "SharePoint Service Applications" DatabaseServer = "SQL.contoso.local" DatabaseName = "SP_ManagedMetadata" ContentTypeHubUrl = "http://contoso.sharepoint.com/sites/ct" ContentTypePushdownEnabled = $true ContentTypeSyndicationEnabled = $true + PSDscRunAsCredential = $SetupAccount } } } diff --git a/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceAppDefault/1-SetManagedMetadataDefault.ps1 b/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceAppDefault/1-SetManagedMetadataDefault.ps1 index 94f3db6ee..f27afdfa9 100644 --- a/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceAppDefault/1-SetManagedMetadataDefault.ps1 +++ b/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceAppDefault/1-SetManagedMetadataDefault.ps1 @@ -42,14 +42,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPManagedMetaDataServiceAppDefault ManagedMetadataServiceAppDefault { ServiceAppProxyGroup = "Default" diff --git a/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceAppDefault/2-ConfigureCustomProxyGroup.ps1 b/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceAppDefault/2-ConfigureCustomProxyGroup.ps1 index 57d53ac9d..e924e1297 100644 --- a/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceAppDefault/2-ConfigureCustomProxyGroup.ps1 +++ b/SharePointDsc/Examples/Resources/SPManagedMetaDataServiceAppDefault/2-ConfigureCustomProxyGroup.ps1 @@ -1,60 +1,63 @@ -<# -.EXAMPLE - This example shows how to configure a custom proxy group and specify its default Managed - Metadata service app. -#> -Configuration Example -{ - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc +<#PSScriptInfo - node localhost { - SPServiceAppProxyGroup ProxyGroup1 - { - Name = "Proxy Group 1" - Ensure = "Present" - ServiceAppProxies = @("User Profile Service Application", "MMS Service Application", "State Service Application") - PsDscRunAsCredential = $SetupAccount - } +.VERSION 1.0.0 - SPManagedMetaDataServiceAppDefault ManagedMetadataServiceAppDefault - { - ServiceAppProxyGroup = "Proxy Group 1" - DefaultSiteCollectionProxyName = "MMS Service Application Proxy" - DefaultKeywordProxyName = "MMS Service Application Proxy" - PsDscRunAsCredential = $SetupAccount - } - } -} +.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 a custom proxy group and specify its default Managed - Metadata service app. +This example shows how to configure a custom proxy group and specify its default Managed +Metadata service app. #> Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPServiceAppProxyGroup ProxyGroup1 { Name = "Proxy Group 1" Ensure = "Present" - ServiceAppProxies = @("User Profile Service Application","MMS Service Application","State Service Application") + ServiceAppProxies = @("User Profile Service Application", "MMS Service Application", "State Service Application") PsDscRunAsCredential = $SetupAccount } diff --git a/SharePointDsc/Examples/Resources/SPManagedPath/1-ExplicitPath.ps1 b/SharePointDsc/Examples/Resources/SPManagedPath/1-ExplicitPath.ps1 index d9a78c6d1..a5ce668fd 100644 --- a/SharePointDsc/Examples/Resources/SPManagedPath/1-ExplicitPath.ps1 +++ b/SharePointDsc/Examples/Resources/SPManagedPath/1-ExplicitPath.ps1 @@ -41,14 +41,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPManagedPath TestManagedPath { WebAppUrl = "http://sharepoint.contoso.com" diff --git a/SharePointDsc/Examples/Resources/SPManagedPath/2-WildcardPath.ps1 b/SharePointDsc/Examples/Resources/SPManagedPath/2-WildcardPath.ps1 index fbbb39b9f..f2142ed30 100644 --- a/SharePointDsc/Examples/Resources/SPManagedPath/2-WildcardPath.ps1 +++ b/SharePointDsc/Examples/Resources/SPManagedPath/2-WildcardPath.ps1 @@ -41,14 +41,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPManagedPath TestManagedPath { WebAppUrl = "http://sharepoint.contoso.com" diff --git a/SharePointDsc/Examples/Resources/SPManagedPath/3-RemovePath.ps1 b/SharePointDsc/Examples/Resources/SPManagedPath/3-RemovePath.ps1 index 343149535..6fbf970e1 100644 --- a/SharePointDsc/Examples/Resources/SPManagedPath/3-RemovePath.ps1 +++ b/SharePointDsc/Examples/Resources/SPManagedPath/3-RemovePath.ps1 @@ -39,24 +39,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPManagedPath TestManagedPath - { - WebAppUrl = "http://sharepoint.contoso.com" - RelativeUrl = "teams" - Explicit = $false - HostHeader = $true - Ensure = "Absent" - PsDscRunAsCredential = $SetupAccount - } + SPManagedPath TestManagedPath + { + WebAppUrl = "http://sharepoint.contoso.com" + RelativeUrl = "teams" + Explicit = $false + HostHeader = $true + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPMinRoleCompliance/1-EnsureCompliance.ps1 b/SharePointDsc/Examples/Resources/SPMinRoleCompliance/1-EnsureCompliance.ps1 index 3ff8e8156..4a4f7bc2a 100644 --- a/SharePointDsc/Examples/Resources/SPMinRoleCompliance/1-EnsureCompliance.ps1 +++ b/SharePointDsc/Examples/Resources/SPMinRoleCompliance/1-EnsureCompliance.ps1 @@ -39,21 +39,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPMinRoleCompliance MinRoleCompliance - { - IsSingleInstance = "Yes" - State = "Compliant" - PSDscRunAsCredential = $SetupAccount - } + SPMinRoleCompliance MinRoleCompliance + { + IsSingleInstance = "Yes" + State = "Compliant" + PSDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPOAppPrincipalMgmtServiceAppProxy/1-CreateServiceApplicationProxy.ps1 b/SharePointDsc/Examples/Resources/SPOAppPrincipalMgmtServiceAppProxy/1-CreateServiceApplicationProxy.ps1 index 3633ac13a..7ad03466a 100644 --- a/SharePointDsc/Examples/Resources/SPOAppPrincipalMgmtServiceAppProxy/1-CreateServiceApplicationProxy.ps1 +++ b/SharePointDsc/Examples/Resources/SPOAppPrincipalMgmtServiceAppProxy/1-CreateServiceApplicationProxy.ps1 @@ -41,14 +41,17 @@ in the farm connecting to the contoso tenant. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPOAppPrincipalMgmtServiceAppProxy SPOAddInManagementProxy { Name = "SPO Add-in Management Proxy" diff --git a/SharePointDsc/Examples/Resources/SPOfficeOnlineServerBinding/1-AddBinding.ps1 b/SharePointDsc/Examples/Resources/SPOfficeOnlineServerBinding/1-AddBinding.ps1 index 5f1f2b97c..050f59854 100644 --- a/SharePointDsc/Examples/Resources/SPOfficeOnlineServerBinding/1-AddBinding.ps1 +++ b/SharePointDsc/Examples/Resources/SPOfficeOnlineServerBinding/1-AddBinding.ps1 @@ -40,21 +40,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPOfficeOnlineServerBinding OosBinding - { - Zone = "internal-https" - DnsName = "webapps.contoso.com" - PsDscRunAsCredential = $SetupAccount - } + SPOfficeOnlineServerBinding OosBinding + { + Zone = "internal-https" + DnsName = "webapps.contoso.com" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPOfficeOnlineServerBinding/2-RemoveBinding.ps1 b/SharePointDsc/Examples/Resources/SPOfficeOnlineServerBinding/2-RemoveBinding.ps1 index ce76a0e44..02873839e 100644 --- a/SharePointDsc/Examples/Resources/SPOfficeOnlineServerBinding/2-RemoveBinding.ps1 +++ b/SharePointDsc/Examples/Resources/SPOfficeOnlineServerBinding/2-RemoveBinding.ps1 @@ -40,22 +40,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPOfficeOnlineServerBinding OosBinding - { - Zone = "Internal-HTTP" - DnsName = "webapps.contoso.com" - PsDscRunAsCredential = $SetupAccount - Ensure = "Absent" - } + SPOfficeOnlineServerBinding OosBinding + { + Zone = "Internal-HTTP" + DnsName = "webapps.contoso.com" + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPOutgoingEmailSettings/1-WholeFarm.ps1 b/SharePointDsc/Examples/Resources/SPOutgoingEmailSettings/1-WholeFarm.ps1 index 2c3aa87bc..9f4c8e7b1 100644 --- a/SharePointDsc/Examples/Resources/SPOutgoingEmailSettings/1-WholeFarm.ps1 +++ b/SharePointDsc/Examples/Resources/SPOutgoingEmailSettings/1-WholeFarm.ps1 @@ -40,24 +40,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPOutgoingEmailSettings FarmWideEmailSettings - { - WebAppUrl = "http://sharepoint1:2013" - SMTPServer = "smtp.contoso.com" - FromAddress = "sharepoint`@contoso.com" - ReplyToAddress = "noreply`@contoso.com" - CharacterSet = "65001" - PsDscRunAsCredential = $SetupAccount - } + SPOutgoingEmailSettings FarmWideEmailSettings + { + WebAppUrl = "http://sharepoint1:2013" + SMTPServer = "smtp.contoso.com" + FromAddress = "sharepoint`@contoso.com" + ReplyToAddress = "noreply`@contoso.com" + CharacterSet = "65001" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPOutgoingEmailSettings/2-WebApp.ps1 b/SharePointDsc/Examples/Resources/SPOutgoingEmailSettings/2-WebApp.ps1 index 20704e886..9a7c4a8c2 100644 --- a/SharePointDsc/Examples/Resources/SPOutgoingEmailSettings/2-WebApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPOutgoingEmailSettings/2-WebApp.ps1 @@ -39,24 +39,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPOutgoingEmailSettings FarmWideEmailSettings - { - WebAppUrl = "http://site.contoso.com" - SMTPServer = "smtp.contoso.com" - FromAddress = "sharepoint`@contoso.com" - ReplyToAddress = "noreply`@contoso.com" - CharacterSet = "65001" - PsDscRunAsCredential = $SetupAccount - } + SPOutgoingEmailSettings FarmWideEmailSettings + { + WebAppUrl = "http://site.contoso.com" + SMTPServer = "smtp.contoso.com" + FromAddress = "sharepoint`@contoso.com" + ReplyToAddress = "noreply`@contoso.com" + CharacterSet = "65001" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPPasswordChangeSettings/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPPasswordChangeSettings/1-Example.ps1 index 923655622..f9cf6e39a 100644 --- a/SharePointDsc/Examples/Resources/SPPasswordChangeSettings/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPPasswordChangeSettings/1-Example.ps1 @@ -39,24 +39,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPPasswordChangeSettings ManagedAccountPasswordResetSettings - { - IsSingleInstance = "Yes" - MailAddress = "sharepoint@contoso.com" - DaysBeforeExpiry = "14" - PasswordChangeWaitTimeSeconds = "60" - NumberOfRetries = "3" - PsDscRunAsCredential = $SetupAccount - } + SPPasswordChangeSettings ManagedAccountPasswordResetSettings + { + IsSingleInstance = "Yes" + MailAddress = "sharepoint@contoso.com" + DaysBeforeExpiry = "14" + PasswordChangeWaitTimeSeconds = "60" + NumberOfRetries = "3" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPPerformancePointServiceApp/1-NewServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPPerformancePointServiceApp/1-NewServiceApp.ps1 index e7ad3b643..dd62a034c 100644 --- a/SharePointDsc/Examples/Resources/SPPerformancePointServiceApp/1-NewServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPPerformancePointServiceApp/1-NewServiceApp.ps1 @@ -39,21 +39,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPPerformancePointServiceApp PerformancePoint - { - Name = "Performance Point Service Application" - ApplicationPool = "SharePoint Web Services" - PsDscRunAsCredential = $SetupAccount - } + SPPerformancePointServiceApp PerformancePoint + { + Name = "Performance Point Service Application" + ApplicationPool = "SharePoint Web Services" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPPerformancePointServiceApp/1-RemoveServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPPerformancePointServiceApp/1-RemoveServiceApp.ps1 index 1401c0218..4414cca4e 100644 --- a/SharePointDsc/Examples/Resources/SPPerformancePointServiceApp/1-RemoveServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPPerformancePointServiceApp/1-RemoveServiceApp.ps1 @@ -41,22 +41,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPPerformancePointServiceApp PerformancePoint - { - Name = "Performance Point Service Application" - ApplicationPool = "n/a" - Ensure = "Absent" - PsDscRunAsCredential = $SetupAccount - } + SPPerformancePointServiceApp PerformancePoint + { + Name = "Performance Point Service Application" + ApplicationPool = "n/a" + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPPowerPointAutomationServiceApp/1-NewServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPPowerPointAutomationServiceApp/1-NewServiceApp.ps1 index 1ea238246..de2003793 100644 --- a/SharePointDsc/Examples/Resources/SPPowerPointAutomationServiceApp/1-NewServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPPowerPointAutomationServiceApp/1-NewServiceApp.ps1 @@ -39,28 +39,31 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPPowerPointAutomationServiceApp PowerPointAutomation - { - Name = "PowerPoint Automation Service Application" - ProxyName = "PowerPoint Automation Service Application Proxy" - CacheExpirationPeriodInSeconds = 600 - MaximumConversionsPerWorker = 5 - WorkerKeepAliveTimeoutInSeconds = 120 - WorkerProcessCount = 3 - WorkerTimeoutInSeconds = 300 - ApplicationPool = "SharePoint Web Services" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPPowerPointAutomationServiceApp PowerPointAutomation + { + Name = "PowerPoint Automation Service Application" + ProxyName = "PowerPoint Automation Service Application Proxy" + CacheExpirationPeriodInSeconds = 600 + MaximumConversionsPerWorker = 5 + WorkerKeepAliveTimeoutInSeconds = 120 + WorkerProcessCount = 3 + WorkerTimeoutInSeconds = 300 + ApplicationPool = "SharePoint Web Services" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPPowerPointAutomationServiceApp/2-RemoveServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPPowerPointAutomationServiceApp/2-RemoveServiceApp.ps1 index 8d26f4202..559965d29 100644 --- a/SharePointDsc/Examples/Resources/SPPowerPointAutomationServiceApp/2-RemoveServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPPowerPointAutomationServiceApp/2-RemoveServiceApp.ps1 @@ -39,21 +39,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPPowerPointAutomationServiceApp WordAutomation - { - Name = "PowerPoint Automation Service Application" - Ensure = "Absent" - PsDscRunAsCredential = $SetupAccount - } + SPPowerPointAutomationServiceApp WordAutomation + { + Name = "PowerPoint Automation Service Application" + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPProductUpdate/1-InstallCU.ps1 b/SharePointDsc/Examples/Resources/SPProductUpdate/1-InstallCU.ps1 index 37b0cefb6..c22c3a513 100644 --- a/SharePointDsc/Examples/Resources/SPProductUpdate/1-InstallCU.ps1 +++ b/SharePointDsc/Examples/Resources/SPProductUpdate/1-InstallCU.ps1 @@ -40,24 +40,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPProductUpdate InstallCUMay2016 - { - SetupFile = "C:\Install\CUMay2016\ubersrv2013-kb3115029-fullfile-x64-glb.exe" - ShutdownServices = $true - BinaryInstallDays = "sat", "sun" - BinaryInstallTime = "12:00am to 2:00am" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPProductUpdate InstallCUMay2016 + { + SetupFile = "C:\Install\CUMay2016\ubersrv2013-kb3115029-fullfile-x64-glb.exe" + ShutdownServices = $true + BinaryInstallDays = "sat", "sun" + BinaryInstallTime = "12:00am to 2:00am" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPProductUpdate/2-InstallSP.ps1 b/SharePointDsc/Examples/Resources/SPProductUpdate/2-InstallSP.ps1 index 73a5be910..0f6601088 100644 --- a/SharePointDsc/Examples/Resources/SPProductUpdate/2-InstallSP.ps1 +++ b/SharePointDsc/Examples/Resources/SPProductUpdate/2-InstallSP.ps1 @@ -40,24 +40,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPProductUpdate InstallCUMay2016 - { - SetupFile = "C:\Install\SP2013SP1\officeserversp2013-kb2880552-fullfile-x64-en-us.exe" - ShutdownServices = $true - BinaryInstallDays = "sat", "sun" - BinaryInstallTime = "12:00am to 2:00am" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPProductUpdate InstallCUMay2016 + { + SetupFile = "C:\Install\SP2013SP1\officeserversp2013-kb2880552-fullfile-x64-en-us.exe" + ShutdownServices = $true + BinaryInstallDays = "sat", "sun" + BinaryInstallTime = "12:00am to 2:00am" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPProductUpdate/3-InstallLPSP.ps1 b/SharePointDsc/Examples/Resources/SPProductUpdate/3-InstallLPSP.ps1 index 7818ebd22..1e0dc055a 100644 --- a/SharePointDsc/Examples/Resources/SPProductUpdate/3-InstallLPSP.ps1 +++ b/SharePointDsc/Examples/Resources/SPProductUpdate/3-InstallLPSP.ps1 @@ -40,24 +40,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPProductUpdate InstallCUMay2016 - { - SetupFile = "C:\Install\SP2013-LP_NL-SP1\serverlpksp2013-kb2880554-fullfile-x64-nl-nl.exe" - ShutdownServices = $true - BinaryInstallDays = "sat", "sun" - BinaryInstallTime = "12:00am to 2:00am" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPProductUpdate InstallCUMay2016 + { + SetupFile = "C:\Install\SP2013-LP_NL-SP1\serverlpksp2013-kb2880554-fullfile-x64-nl-nl.exe" + ShutdownServices = $true + BinaryInstallDays = "sat", "sun" + BinaryInstallTime = "12:00am to 2:00am" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPProjectServerADResourcePoolSync/1-EnableSync.ps1 b/SharePointDsc/Examples/Resources/SPProjectServerADResourcePoolSync/1-EnableSync.ps1 index e5aa25277..b7fb2837d 100644 --- a/SharePointDsc/Examples/Resources/SPProjectServerADResourcePoolSync/1-EnableSync.ps1 +++ b/SharePointDsc/Examples/Resources/SPProjectServerADResourcePoolSync/1-EnableSync.ps1 @@ -41,14 +41,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPProjectServerADResourcePoolSync EnableSync { Ensure = "Present" diff --git a/SharePointDsc/Examples/Resources/SPProjectServerADResourcePoolSync/2-DisableSync.ps1 b/SharePointDsc/Examples/Resources/SPProjectServerADResourcePoolSync/2-DisableSync.ps1 index 0f5accecc..c7e7ade71 100644 --- a/SharePointDsc/Examples/Resources/SPProjectServerADResourcePoolSync/2-DisableSync.ps1 +++ b/SharePointDsc/Examples/Resources/SPProjectServerADResourcePoolSync/2-DisableSync.ps1 @@ -41,14 +41,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPProjectServerADResourcePoolSync EnableSync { Ensure = "Absent" diff --git a/SharePointDsc/Examples/Resources/SPProjectServerAdditionalSettings/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPProjectServerAdditionalSettings/1-Example.ps1 index 6d0e06340..fc711faa9 100644 --- a/SharePointDsc/Examples/Resources/SPProjectServerAdditionalSettings/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPProjectServerAdditionalSettings/1-Example.ps1 @@ -41,11 +41,13 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc node localhost diff --git a/SharePointDsc/Examples/Resources/SPProjectServerGlobalPermissions/1-Resource.ps1 b/SharePointDsc/Examples/Resources/SPProjectServerGlobalPermissions/1-Resource.ps1 index bf478cd4f..eae1f6112 100644 --- a/SharePointDsc/Examples/Resources/SPProjectServerGlobalPermissions/1-Resource.ps1 +++ b/SharePointDsc/Examples/Resources/SPProjectServerGlobalPermissions/1-Resource.ps1 @@ -41,21 +41,23 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc node localhost { SPProjectServerGlobalPermissions Permissions { - Url = "http://projects.contoso.com" - EntityName = "Domain\user" - EntityType = "User" - AllowPermissions = @( + Url = "http://projects.contoso.com" + EntityName = "Domain\user" + EntityType = "User" + AllowPermissions = @( "LogOn", "NewTaskAssignment", "AccessProjectDataService", @@ -86,7 +88,7 @@ Configuration Example "ManageSiteWideExchangeSync", "ManageListsInProjectWebAccess" ) - DenyPermissions = @( + DenyPermissions = @( "NewProject" ) PSDscRunAsCredential = $SetupAccount diff --git a/SharePointDsc/Examples/Resources/SPProjectServerGlobalPermissions/2-Group.ps1 b/SharePointDsc/Examples/Resources/SPProjectServerGlobalPermissions/2-Group.ps1 index 6dfb2f095..b95f92379 100644 --- a/SharePointDsc/Examples/Resources/SPProjectServerGlobalPermissions/2-Group.ps1 +++ b/SharePointDsc/Examples/Resources/SPProjectServerGlobalPermissions/2-Group.ps1 @@ -41,21 +41,23 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc node localhost { SPProjectServerGlobalPermissions Permissions { - Url = "http://projects.contoso.com" - EntityName = "Group Name" - EntityType = "Group" - AllowPermissions = @( + Url = "http://projects.contoso.com" + EntityName = "Group Name" + EntityType = "Group" + AllowPermissions = @( "LogOn", "NewTaskAssignment", "AccessProjectDataService", @@ -86,7 +88,7 @@ Configuration Example "ManageSiteWideExchangeSync", "ManageListsInProjectWebAccess" ) - DenyPermissions = @( + DenyPermissions = @( "NewProject" ) PSDscRunAsCredential = $SetupAccount diff --git a/SharePointDsc/Examples/Resources/SPProjectServerGroup/1-SpecificMembers.ps1 b/SharePointDsc/Examples/Resources/SPProjectServerGroup/1-SpecificMembers.ps1 index 06e67db1d..96b9470cd 100644 --- a/SharePointDsc/Examples/Resources/SPProjectServerGroup/1-SpecificMembers.ps1 +++ b/SharePointDsc/Examples/Resources/SPProjectServerGroup/1-SpecificMembers.ps1 @@ -41,20 +41,22 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc node localhost { SPProjectServerGroup Group { - Url = "http://projects.contoso.com" - Name = "My group" - Members = @( + Url = "http://projects.contoso.com" + Name = "My group" + Members = @( "Domain\User1" "Domain\User2" ) diff --git a/SharePointDsc/Examples/Resources/SPProjectServerGroup/2-ADGroup.ps1 b/SharePointDsc/Examples/Resources/SPProjectServerGroup/2-ADGroup.ps1 index 8f61e72b4..49e5ae7f8 100644 --- a/SharePointDsc/Examples/Resources/SPProjectServerGroup/2-ADGroup.ps1 +++ b/SharePointDsc/Examples/Resources/SPProjectServerGroup/2-ADGroup.ps1 @@ -41,20 +41,22 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc node localhost { SPProjectServerGroup Group { - Url = "http://projects.contoso.com" - Name = "My group" - ADGroup = "Domain\Group" + Url = "http://projects.contoso.com" + Name = "My group" + ADGroup = "Domain\Group" PSDscRunAsCredential = $SetupAccount } } diff --git a/SharePointDsc/Examples/Resources/SPProjectServerLicense/1-EnableProjectServer.ps1 b/SharePointDsc/Examples/Resources/SPProjectServerLicense/1-EnableProjectServer.ps1 index 09a411e71..7bf1d0a6f 100644 --- a/SharePointDsc/Examples/Resources/SPProjectServerLicense/1-EnableProjectServer.ps1 +++ b/SharePointDsc/Examples/Resources/SPProjectServerLicense/1-EnableProjectServer.ps1 @@ -41,14 +41,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPProjectServerLicense ProjectLicense { IsSingleInstance = "Yes" diff --git a/SharePointDsc/Examples/Resources/SPProjectServerLicense/2-DisableProjectServer.ps1 b/SharePointDsc/Examples/Resources/SPProjectServerLicense/2-DisableProjectServer.ps1 index 926213306..650fac1dc 100644 --- a/SharePointDsc/Examples/Resources/SPProjectServerLicense/2-DisableProjectServer.ps1 +++ b/SharePointDsc/Examples/Resources/SPProjectServerLicense/2-DisableProjectServer.ps1 @@ -41,14 +41,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPProjectServerLicense ProjectLicense { IsSingleInstance = "Yes" diff --git a/SharePointDsc/Examples/Resources/SPProjectServerPermissionMode/1-SPMode.ps1 b/SharePointDsc/Examples/Resources/SPProjectServerPermissionMode/1-SPMode.ps1 index 8dcb03f46..be64ba8eb 100644 --- a/SharePointDsc/Examples/Resources/SPProjectServerPermissionMode/1-SPMode.ps1 +++ b/SharePointDsc/Examples/Resources/SPProjectServerPermissionMode/1-SPMode.ps1 @@ -41,14 +41,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPProjectServerPermissionMode PermissionMode { Url = "http://projects.contoso.com" diff --git a/SharePointDsc/Examples/Resources/SPProjectServerPermissionMode/2-PSMode.ps1 b/SharePointDsc/Examples/Resources/SPProjectServerPermissionMode/2-PSMode.ps1 index 59ff9a534..aeb0a9632 100644 --- a/SharePointDsc/Examples/Resources/SPProjectServerPermissionMode/2-PSMode.ps1 +++ b/SharePointDsc/Examples/Resources/SPProjectServerPermissionMode/2-PSMode.ps1 @@ -42,14 +42,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPProjectServerPermissionMode PermissionMode { Url = "http://projects.contoso.com" diff --git a/SharePointDsc/Examples/Resources/SPProjectServerServiceApp/1-NewServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPProjectServerServiceApp/1-NewServiceApp.ps1 index 6d59279d2..7ca94aede 100644 --- a/SharePointDsc/Examples/Resources/SPProjectServerServiceApp/1-NewServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPProjectServerServiceApp/1-NewServiceApp.ps1 @@ -40,21 +40,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPProjectServerServiceApp ProjectServiceApp - { - Name = "Project Server Service Application" - ApplicationPool = "SharePoint Web Services" - PsDscRunAsCredential = $SetupAccount - } + SPProjectServerServiceApp ProjectServiceApp + { + Name = "Project Server Service Application" + ApplicationPool = "SharePoint Web Services" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPProjectServerServiceApp/2-RemoveServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPProjectServerServiceApp/2-RemoveServiceApp.ps1 index f14ae17f9..1a4968570 100644 --- a/SharePointDsc/Examples/Resources/SPProjectServerServiceApp/2-RemoveServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPProjectServerServiceApp/2-RemoveServiceApp.ps1 @@ -41,22 +41,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPProjectServerServiceApp ProjectServiceApp - { - Name = "Project Server Service Application" - ApplicationPool = "n/a" - Ensure = "Absent" - PsDscRunAsCredential = $SetupAccount - } + SPProjectServerServiceApp ProjectServiceApp + { + Name = "Project Server Service Application" + ApplicationPool = "n/a" + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPProjectServerTimesheetSettings/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPProjectServerTimesheetSettings/1-Example.ps1 index 4fa8be269..b11510a27 100644 --- a/SharePointDsc/Examples/Resources/SPProjectServerTimesheetSettings/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPProjectServerTimesheetSettings/1-Example.ps1 @@ -42,11 +42,13 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc node localhost diff --git a/SharePointDsc/Examples/Resources/SPProjectServerUserSyncSettings/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPProjectServerUserSyncSettings/1-Example.ps1 index 54d495b22..c2e0fc6e2 100644 --- a/SharePointDsc/Examples/Resources/SPProjectServerUserSyncSettings/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPProjectServerUserSyncSettings/1-Example.ps1 @@ -41,11 +41,13 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc node localhost diff --git a/SharePointDsc/Examples/Resources/SPProjectServerWssSettings/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPProjectServerWssSettings/1-Example.ps1 index 3ae31e22c..8862129e8 100644 --- a/SharePointDsc/Examples/Resources/SPProjectServerWssSettings/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPProjectServerWssSettings/1-Example.ps1 @@ -41,11 +41,13 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc node localhost diff --git a/SharePointDsc/Examples/Resources/SPPublishServiceApplication/1-PublishServiceApplication.ps1 b/SharePointDsc/Examples/Resources/SPPublishServiceApplication/1-PublishServiceApplication.ps1 index 4fc16ae1f..1a0f5acae 100644 --- a/SharePointDsc/Examples/Resources/SPPublishServiceApplication/1-PublishServiceApplication.ps1 +++ b/SharePointDsc/Examples/Resources/SPPublishServiceApplication/1-PublishServiceApplication.ps1 @@ -40,21 +40,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPPublishServiceApplication PublishManagedMetadataServiceApp - { - Name = "Managed Metadata Service Application" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPPublishServiceApplication PublishManagedMetadataServiceApp + { + Name = "Managed Metadata Service Application" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPPublishServiceApplication/2-UnpublishServiceApplication.ps1 b/SharePointDsc/Examples/Resources/SPPublishServiceApplication/2-UnpublishServiceApplication.ps1 index 3787f0553..75c1ab4a9 100644 --- a/SharePointDsc/Examples/Resources/SPPublishServiceApplication/2-UnpublishServiceApplication.ps1 +++ b/SharePointDsc/Examples/Resources/SPPublishServiceApplication/2-UnpublishServiceApplication.ps1 @@ -40,21 +40,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPPublishServiceApplication UnpublishSecureStoreServiceApp - { - Name = "Secure Store Service Application" - Ensure = "Absent" - PsDscRunAsCredential = $SetupAccount - } + SPPublishServiceApplication UnpublishSecureStoreServiceApp + { + Name = "Secure Store Service Application" + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPQuotaTemplate/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPQuotaTemplate/1-Example.ps1 index b7f7a59f4..92c55f70f 100644 --- a/SharePointDsc/Examples/Resources/SPQuotaTemplate/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPQuotaTemplate/1-Example.ps1 @@ -39,24 +39,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPQuotaTemplate TeamsiteTemplate - { - Name = "Teamsite" - StorageMaxInMB = 1024 - StorageWarningInMB = 512 - MaximumUsagePointsSolutions = 1000 - WarningUsagePointsSolutions = 800 - Ensure = "Present" - } + SPQuotaTemplate TeamsiteTemplate + { + Name = "Teamsite" + StorageMaxInMB = 1024 + StorageWarningInMB = 512 + MaximumUsagePointsSolutions = 1000 + WarningUsagePointsSolutions = 800 + Ensure = "Present" } } +} diff --git a/SharePointDsc/Examples/Resources/SPRemoteFarmTrust/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPRemoteFarmTrust/1-Example.ps1 index cbed10ade..2733f7bc6 100644 --- a/SharePointDsc/Examples/Resources/SPRemoteFarmTrust/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPRemoteFarmTrust/1-Example.ps1 @@ -40,21 +40,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPRemoteFarmTrust TrustRemoteFarmForSearch - { - Name = "CentralSearchFarm" - RemoteWebAppUrl = "https://search.sharepoint.contoso.com" - LocalWebAppUrl = "https://local.sharepoint2.contoso.com" - } + SPRemoteFarmTrust TrustRemoteFarmForSearch + { + Name = "CentralSearchFarm" + RemoteWebAppUrl = "https://search.sharepoint.contoso.com" + LocalWebAppUrl = "https://local.sharepoint2.contoso.com" } } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchAuthoritativePage/1 - AuthoritativePage.ps1 b/SharePointDsc/Examples/Resources/SPSearchAuthoritativePage/1 - AuthoritativePage.ps1 index 6673bcd8f..47e173b0a 100644 --- a/SharePointDsc/Examples/Resources/SPSearchAuthoritativePage/1 - AuthoritativePage.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchAuthoritativePage/1 - AuthoritativePage.ps1 @@ -39,24 +39,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSearchAuthoritativePage AuthoratativePage - { - ServiceAppName = "Search Service Application" - Path = "http://site.sharepoint.com/Pages/authoritative.aspx" - Action = "Authoratative" - Level = 0.0 - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPSearchAuthoritativePage AuthoratativePage + { + ServiceAppName = "Search Service Application" + Path = "http://site.sharepoint.com/Pages/authoritative.aspx" + Action = "Authoratative" + Level = 0.0 + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchAuthoritativePage/2 - DemotedPage.ps1 b/SharePointDsc/Examples/Resources/SPSearchAuthoritativePage/2 - DemotedPage.ps1 index 7e63e0c8d..7aaf61b60 100644 --- a/SharePointDsc/Examples/Resources/SPSearchAuthoritativePage/2 - DemotedPage.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchAuthoritativePage/2 - DemotedPage.ps1 @@ -39,23 +39,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSearchAuthoritativePage AuthoratativePage - { - ServiceAppName = "Search Service Application" - Path = "http://site.sharepoint.com/Pages/demoted.aspx" - Action = "Demoted" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPSearchAuthoritativePage AuthoratativePage + { + ServiceAppName = "Search Service Application" + Path = "http://site.sharepoint.com/Pages/demoted.aspx" + Action = "Demoted" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchContentSource/1-SharePointSource.ps1 b/SharePointDsc/Examples/Resources/SPSearchContentSource/1-SharePointSource.ps1 index e5b96820d..6b7912dfa 100644 --- a/SharePointDsc/Examples/Resources/SPSearchContentSource/1-SharePointSource.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchContentSource/1-SharePointSource.ps1 @@ -39,28 +39,31 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSearchContentSource LocalSharePointSites - { - Name = "Local SharePoint Sites" - ServiceAppName = "Search Service Application" - ContentSourceType = "SharePoint" - Addresses = @("http://sharepointsite1.contoso.com", "http://sharepointsite2.contoso.com") - CrawlSetting = "CrawlSites" - ContinuousCrawl = $true - FullSchedule = $null - Priority = "Normal" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPSearchContentSource LocalSharePointSites + { + Name = "Local SharePoint Sites" + ServiceAppName = "Search Service Application" + ContentSourceType = "SharePoint" + Addresses = @("http://sharepointsite1.contoso.com", "http://sharepointsite2.contoso.com") + CrawlSetting = "CrawlSites" + ContinuousCrawl = $true + FullSchedule = $null + Priority = "Normal" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchContentSource/2-WebsiteSource.ps1 b/SharePointDsc/Examples/Resources/SPSearchContentSource/2-WebsiteSource.ps1 index 7517e2fe0..4b8a0d080 100644 --- a/SharePointDsc/Examples/Resources/SPSearchContentSource/2-WebsiteSource.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchContentSource/2-WebsiteSource.ps1 @@ -39,40 +39,43 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSearchContentSource WebsiteSource - { - Name = "Contoso website" - ServiceAppName = "Search Service Application" - ContentSourceType = "Website" - Addresses = @("http://www.contoso.com") - CrawlSetting = "Custom" - LimitPageDepth = 5 - IncrementalSchedule = MSFT_SPSearchCrawlSchedule{ - ScheduleType = "Daily" - StartHour = "0" - StartMinute = "0" - CrawlScheduleRepeatDuration = "1440" - CrawlScheduleRepeatInterval = "5" - } - FullSchedule = MSFT_SPSearchCrawlSchedule{ - ScheduleType = "Weekly" - CrawlScheduleDaysOfWeek = @("Monday", "Wednesday", "Friday") - StartHour = "3" - StartMinute = "0" - } - Priority = "Normal" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount + SPSearchContentSource WebsiteSource + { + Name = "Contoso website" + ServiceAppName = "Search Service Application" + ContentSourceType = "Website" + Addresses = @("http://www.contoso.com") + CrawlSetting = "Custom" + LimitPageDepth = 5 + IncrementalSchedule = MSFT_SPSearchCrawlSchedule { + ScheduleType = "Daily" + StartHour = "0" + StartMinute = "0" + CrawlScheduleRepeatDuration = "1440" + CrawlScheduleRepeatInterval = "5" } + FullSchedule = MSFT_SPSearchCrawlSchedule { + ScheduleType = "Weekly" + CrawlScheduleDaysOfWeek = @("Monday", "Wednesday", "Friday") + StartHour = "3" + StartMinute = "0" + } + Priority = "Normal" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchCrawlMapping/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPSearchCrawlMapping/1-Example.ps1 index 76a748161..d363b0109 100644 --- a/SharePointDsc/Examples/Resources/SPSearchCrawlMapping/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchCrawlMapping/1-Example.ps1 @@ -39,26 +39,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param - ( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSearchCrawlMapping IntranetCrawlMapping - { - ServiceAppName = "Search Service Application" - Url = "http://crawl.sharepoint.com" - Target = "http://site.sharepoint.com" - Ensure = "Present" - PsDScRunAsCredential = $SetupAccount - } + SPSearchCrawlMapping IntranetCrawlMapping + { + ServiceAppName = "Search Service Application" + Url = "http://crawl.sharepoint.com" + Target = "http://site.sharepoint.com" + Ensure = "Present" + PsDScRunAsCredential = $SetupAccount } } - - +} diff --git a/SharePointDsc/Examples/Resources/SPSearchCrawlRule/1-BasicExample.ps1 b/SharePointDsc/Examples/Resources/SPSearchCrawlRule/1-BasicExample.ps1 index 3406195ae..a7bad5e0b 100644 --- a/SharePointDsc/Examples/Resources/SPSearchCrawlRule/1-BasicExample.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchCrawlRule/1-BasicExample.ps1 @@ -39,25 +39,28 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSearchCrawlRule IntranetCrawlAccount - { - Path = "https://intranet.sharepoint.contoso.com" - ServiceAppName = "Search Service Application" - Ensure = "Present" - RuleType = "InclusionRule" - CrawlConfigurationRules = "FollowLinksNoPageCrawl","CrawlComplexUrls", "CrawlAsHTTP" - AuthenticationType = "DefaultRuleAccess" - PsDscRunAsCredential = $SetupAccount - } + SPSearchCrawlRule IntranetCrawlAccount + { + Path = "https://intranet.sharepoint.contoso.com" + ServiceAppName = "Search Service Application" + Ensure = "Present" + RuleType = "InclusionRule" + CrawlConfigurationRules = "FollowLinksNoPageCrawl", "CrawlComplexUrls", "CrawlAsHTTP" + AuthenticationType = "DefaultRuleAccess" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchCrawlRule/2-CertificateExample.ps1 b/SharePointDsc/Examples/Resources/SPSearchCrawlRule/2-CertificateExample.ps1 index 98a3d77b9..3a5d8cdb5 100644 --- a/SharePointDsc/Examples/Resources/SPSearchCrawlRule/2-CertificateExample.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchCrawlRule/2-CertificateExample.ps1 @@ -39,26 +39,29 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSearchCrawlRule IntranetCrawlAccountCertificate - { - Path = "https://intranet.sharepoint.contoso.com" - ServiceAppName = "Search Service Application" - Ensure = "Present" - RuleType = "InclusionRule" - CrawlConfigurationRules = "FollowLinksNoPageCrawl","CrawlComplexUrls", "CrawlAsHTTP" - AuthenticationType = "CertificateRuleAccess" - CertificateName = "Certificate Name" - PsDscRunAsCredential = $SetupAccount - } + SPSearchCrawlRule IntranetCrawlAccountCertificate + { + Path = "https://intranet.sharepoint.contoso.com" + ServiceAppName = "Search Service Application" + Ensure = "Present" + RuleType = "InclusionRule" + CrawlConfigurationRules = "FollowLinksNoPageCrawl", "CrawlComplexUrls", "CrawlAsHTTP" + AuthenticationType = "CertificateRuleAccess" + CertificateName = "Certificate Name" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchCrawlerImpactRule/1-RequestLimit.ps1 b/SharePointDsc/Examples/Resources/SPSearchCrawlerImpactRule/1-RequestLimit.ps1 index 5d26d68e6..d7a53d275 100644 --- a/SharePointDsc/Examples/Resources/SPSearchCrawlerImpactRule/1-RequestLimit.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchCrawlerImpactRule/1-RequestLimit.ps1 @@ -39,23 +39,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSearchCrawlerImpactRule IntranetCrawlerImpactRequestLimitRule - { - ServiceAppName = "Search Service Application" - Name = "https://intranet.sharepoint.contoso.com" - RequestLimit = 8 - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPSearchCrawlerImpactRule IntranetCrawlerImpactRequestLimitRule + { + ServiceAppName = "Search Service Application" + Name = "https://intranet.sharepoint.contoso.com" + RequestLimit = 8 + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchCrawlerImpactRule/2-WaitTime.ps1 b/SharePointDsc/Examples/Resources/SPSearchCrawlerImpactRule/2-WaitTime.ps1 index 5b6e564af..3d3463043 100644 --- a/SharePointDsc/Examples/Resources/SPSearchCrawlerImpactRule/2-WaitTime.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchCrawlerImpactRule/2-WaitTime.ps1 @@ -39,23 +39,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSearchCrawlerImpactRule IntranetCrawlerImpactWaitTimeRule - { - ServiceAppName = "Search Service Application" - Name = "https://intranet.sharepoint.contoso.com" - WaitTime = 60 - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPSearchCrawlerImpactRule IntranetCrawlerImpactWaitTimeRule + { + ServiceAppName = "Search Service Application" + Name = "https://intranet.sharepoint.contoso.com" + WaitTime = 60 + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchFileType/1-EnsureFileType.ps1 b/SharePointDsc/Examples/Resources/SPSearchFileType/1-EnsureFileType.ps1 index 705a5a688..dad0521e7 100644 --- a/SharePointDsc/Examples/Resources/SPSearchFileType/1-EnsureFileType.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchFileType/1-EnsureFileType.ps1 @@ -39,24 +39,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSearchFileType PDF - { - FileType = "pdf" - ServiceAppName = "Search Service Application" - Description = "PDF" - MimeType = "application/pdf" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPSearchFileType PDF + { + FileType = "pdf" + ServiceAppName = "Search Service Application" + Description = "PDF" + MimeType = "application/pdf" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchFileType/2-DisableFileType.ps1 b/SharePointDsc/Examples/Resources/SPSearchFileType/2-DisableFileType.ps1 index 417ee1126..b85f66ede 100644 --- a/SharePointDsc/Examples/Resources/SPSearchFileType/2-DisableFileType.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchFileType/2-DisableFileType.ps1 @@ -39,25 +39,28 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSearchFileType PDF - { - FileType = "pdf" - ServiceAppName = "Search Service Application" - Description = "PDF" - MimeType = "application/pdf" - Enabled = $false - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPSearchFileType PDF + { + FileType = "pdf" + ServiceAppName = "Search Service Application" + Description = "PDF" + MimeType = "application/pdf" + Enabled = $false + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchIndexPartition/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPSearchIndexPartition/1-Example.ps1 index 964039952..0ca7a539c 100644 --- a/SharePointDsc/Examples/Resources/SPSearchIndexPartition/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchIndexPartition/1-Example.ps1 @@ -39,23 +39,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSearchIndexPartition AdditionalPartition - { - Servers = @("Server2", "Server3") - Index = 1 - RootDirectory = "I:\SearchIndexes\1" - ServiceAppName = "Search Service Application" - PsDscRunAsCredential = $SetupAccount - } + SPSearchIndexPartition AdditionalPartition + { + Servers = @("Server2", "Server3") + Index = 1 + RootDirectory = "I:\SearchIndexes\1" + ServiceAppName = "Search Service Application" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchManagedProperty/1-EnsureProperty.ps1 b/SharePointDsc/Examples/Resources/SPSearchManagedProperty/1-EnsureProperty.ps1 index fe555ba8c..4a7713e22 100644 --- a/SharePointDsc/Examples/Resources/SPSearchManagedProperty/1-EnsureProperty.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchManagedProperty/1-EnsureProperty.ps1 @@ -39,25 +39,28 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSearchManagedProperty MyProperty - { - Name = "MyProperty" - ServiceAppName = "Search Service Application" - PropertyType = "Text" - Searchable = $true - IncludeAllCrawledProperties = $false - CrawledProperties = @("OWS_Notes, Personal:AboutMe") - PsDscRunAsCredential = $SetupAccount - } + SPSearchManagedProperty MyProperty + { + Name = "MyProperty" + ServiceAppName = "Search Service Application" + PropertyType = "Text" + Searchable = $true + IncludeAllCrawledProperties = $false + CrawledProperties = @("OWS_Notes, Personal:AboutMe") + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchMetadataCategory/1-EnsureMetadataCategory.ps1 b/SharePointDsc/Examples/Resources/SPSearchMetadataCategory/1-EnsureMetadataCategory.ps1 index b9f930e4a..1aef8fafa 100644 --- a/SharePointDsc/Examples/Resources/SPSearchMetadataCategory/1-EnsureMetadataCategory.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchMetadataCategory/1-EnsureMetadataCategory.ps1 @@ -39,25 +39,28 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSearchMetadataCategory NewCategory - { - Name = "My New category" - ServiceAppName = "Search Service Application" - AutoCreateNewManagedProperties = $true - DiscoverNewProperties = $true - MapToContents = $true - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPSearchMetadataCategory NewCategory + { + Name = "My New category" + ServiceAppName = "Search Service Application" + AutoCreateNewManagedProperties = $true + DiscoverNewProperties = $true + MapToContents = $true + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchResultSource/2-SSAExample.ps1 b/SharePointDsc/Examples/Resources/SPSearchResultSource/2-SSAExample.ps1 index 3428c1c5b..6daa602d5 100644 --- a/SharePointDsc/Examples/Resources/SPSearchResultSource/2-SSAExample.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchResultSource/2-SSAExample.ps1 @@ -50,7 +50,8 @@ Configuration Example ) Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPSearchResultSource Intranet { Name = "Intranet" diff --git a/SharePointDsc/Examples/Resources/SPSearchServiceApp/1-NewServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPSearchServiceApp/1-NewServiceApp.ps1 index 56e906105..ace57d584 100644 --- a/SharePointDsc/Examples/Resources/SPSearchServiceApp/1-NewServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchServiceApp/1-NewServiceApp.ps1 @@ -39,22 +39,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - 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" - PsDscRunAsCredential = $SetupAccount - } + SPSearchServiceApp SearchServiceApp + { + Name = "Search Service Application" + DatabaseName = "SP_Search" + ApplicationPool = "SharePoint Service Applications" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchServiceApp/2-RemoveServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPSearchServiceApp/2-RemoveServiceApp.ps1 index 8e327a379..df34d0142 100644 --- a/SharePointDsc/Examples/Resources/SPSearchServiceApp/2-RemoveServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchServiceApp/2-RemoveServiceApp.ps1 @@ -40,22 +40,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSearchServiceApp SearchServiceApp - { - Name = "Search Service Application" - Ensure = "Absent" - ApplicationPool = "n/a" - PsDscRunAsCredential = $SetupAccount - } + SPSearchServiceApp SearchServiceApp + { + Name = "Search Service Application" + Ensure = "Absent" + ApplicationPool = "n/a" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchServiceSettings/1-ConfigureSettings.ps1 b/SharePointDsc/Examples/Resources/SPSearchServiceSettings/1-ConfigureSettings.ps1 index f584eccb2..eeaf15590 100644 --- a/SharePointDsc/Examples/Resources/SPSearchServiceSettings/1-ConfigureSettings.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchServiceSettings/1-ConfigureSettings.ps1 @@ -39,27 +39,30 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount, + + [Parameter(Mandatory = $true)] + [PSCredential] + $SearchAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount, - - [Parameter(Mandatory = $true)] - [PSCredential] - $SearchAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSearchServiceSettings SearchServiceSettings - { - IsSingleInstance = "Yes" - PerformanceLevel = "Maximum" - ContactEmail = "sharepoint@contoso.com" - WindowsServiceAccount = $SearchAccount - PsDscRunAsCredential = $SetupAccount - } + SPSearchServiceSettings SearchServiceSettings + { + IsSingleInstance = "Yes" + PerformanceLevel = "Maximum" + ContactEmail = "sharepoint@contoso.com" + WindowsServiceAccount = $SearchAccount + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSearchTopology/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPSearchTopology/1-Example.ps1 index 3cbc053fa..d54a62d19 100644 --- a/SharePointDsc/Examples/Resources/SPSearchTopology/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPSearchTopology/1-Example.ps1 @@ -39,27 +39,30 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSearchTopology LocalSearchTopology - { - ServiceAppName = "Search Service Application" - Admin = @("Server1","Server2") - Crawler = @("Server1","Server2") - ContentProcessing = @("Server1","Server2") - AnalyticsProcessing = @("Server1","Server2") - QueryProcessing = @("Server3","Server4") - PsDscRunAsCredential = $SetupAccount - FirstPartitionDirectory = "I:\SearchIndexes\0" - IndexPartition = @("Server3","Server4") - } + SPSearchTopology LocalSearchTopology + { + ServiceAppName = "Search Service Application" + Admin = @("Server1", "Server2") + Crawler = @("Server1", "Server2") + ContentProcessing = @("Server1", "Server2") + AnalyticsProcessing = @("Server1", "Server2") + QueryProcessing = @("Server3", "Server4") + PsDscRunAsCredential = $SetupAccount + FirstPartitionDirectory = "I:\SearchIndexes\0" + IndexPartition = @("Server3", "Server4") } } +} diff --git a/SharePointDsc/Examples/Resources/SPSecureStoreServiceApp/1-NewServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPSecureStoreServiceApp/1-NewServiceApp.ps1 index 192a4408c..dfee7b005 100644 --- a/SharePointDsc/Examples/Resources/SPSecureStoreServiceApp/1-NewServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPSecureStoreServiceApp/1-NewServiceApp.ps1 @@ -39,24 +39,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSecureStoreServiceApp SecureStoreServiceApp - { - Name = "Secure Store Service Application" - ApplicationPool = "SharePoint Service Applications" - AuditingEnabled = $true - AuditlogMaxSize = 30 - DatabaseName = "SP_SecureStore" - PsDscRunAsCredential = $SetupAccount - } + SPSecureStoreServiceApp SecureStoreServiceApp + { + Name = "Secure Store Service Application" + ApplicationPool = "SharePoint Service Applications" + AuditingEnabled = $true + AuditlogMaxSize = 30 + DatabaseName = "SP_SecureStore" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSecureStoreServiceApp/2-RemoveServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPSecureStoreServiceApp/2-RemoveServiceApp.ps1 index bef57d435..2425ec257 100644 --- a/SharePointDsc/Examples/Resources/SPSecureStoreServiceApp/2-RemoveServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPSecureStoreServiceApp/2-RemoveServiceApp.ps1 @@ -41,23 +41,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSecureStoreServiceApp SecureStoreServiceApp - { - Name = "Secure Store Service Application" - ApplicationPool = "n/a" - AuditingEnabled = $false - Ensure = "Absent" - PsDscRunAsCredential = $SetupAccount - } + SPSecureStoreServiceApp SecureStoreServiceApp + { + Name = "Secure Store Service Application" + ApplicationPool = "n/a" + AuditingEnabled = $false + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSecurityTokenServiceConfig/1-SetConfiguration.ps1 b/SharePointDsc/Examples/Resources/SPSecurityTokenServiceConfig/1-SetConfiguration.ps1 index 119c01879..baf3b618b 100644 --- a/SharePointDsc/Examples/Resources/SPSecurityTokenServiceConfig/1-SetConfiguration.ps1 +++ b/SharePointDsc/Examples/Resources/SPSecurityTokenServiceConfig/1-SetConfiguration.ps1 @@ -39,25 +39,28 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSecurityTokenServiceConfig SecurityTokenService - { - IsSingleInstance = "Yes" - Name = "SPSecurityTokenService" - NameIdentifier = "00000003-0000-0ff1-ce00-000000000000@9f11c5ea-2df9-4950-8dcf-da8cd7aa4eff" - UseSessionCookies = $false - AllowOAuthOverHttp = $false - AllowMetadataOverHttp = $false - PsDscRunAsCredential = $SetupAccount - } + SPSecurityTokenServiceConfig SecurityTokenService + { + IsSingleInstance = "Yes" + Name = "SPSecurityTokenService" + NameIdentifier = "00000003-0000-0ff1-ce00-000000000000@9f11c5ea-2df9-4950-8dcf-da8cd7aa4eff" + UseSessionCookies = $false + AllowOAuthOverHttp = $false + AllowMetadataOverHttp = $false + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSelfServiceSiteCreation/1-EnableSelfServiceSiteCreation.ps1 b/SharePointDsc/Examples/Resources/SPSelfServiceSiteCreation/1-EnableSelfServiceSiteCreation.ps1 index ab88945e9..5ab12545d 100644 --- a/SharePointDsc/Examples/Resources/SPSelfServiceSiteCreation/1-EnableSelfServiceSiteCreation.ps1 +++ b/SharePointDsc/Examples/Resources/SPSelfServiceSiteCreation/1-EnableSelfServiceSiteCreation.ps1 @@ -41,14 +41,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPSelfServiceSiteCreation SSC { WebAppUrl = "http://example.contoso.local" diff --git a/SharePointDsc/Examples/Resources/SPSelfServiceSiteCreation/2-EnableSelfServiceSiteCreationCustomForm.ps1 b/SharePointDsc/Examples/Resources/SPSelfServiceSiteCreation/2-EnableSelfServiceSiteCreationCustomForm.ps1 index 18728dd90..3089e95e9 100644 --- a/SharePointDsc/Examples/Resources/SPSelfServiceSiteCreation/2-EnableSelfServiceSiteCreationCustomForm.ps1 +++ b/SharePointDsc/Examples/Resources/SPSelfServiceSiteCreation/2-EnableSelfServiceSiteCreationCustomForm.ps1 @@ -41,14 +41,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPSelfServiceSiteCreation SSC { WebAppUrl = "http://example.contoso.local" diff --git a/SharePointDsc/Examples/Resources/SPSelfServiceSiteCreation/3-DisableSelfServiceSiteCreation.ps1 b/SharePointDsc/Examples/Resources/SPSelfServiceSiteCreation/3-DisableSelfServiceSiteCreation.ps1 index 4b6869313..6e653922e 100644 --- a/SharePointDsc/Examples/Resources/SPSelfServiceSiteCreation/3-DisableSelfServiceSiteCreation.ps1 +++ b/SharePointDsc/Examples/Resources/SPSelfServiceSiteCreation/3-DisableSelfServiceSiteCreation.ps1 @@ -41,14 +41,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPSelfServiceSiteCreation SSC { WebAppUrl = "http://example.contoso.local" diff --git a/SharePointDsc/Examples/Resources/SPSelfServiceSiteCreation/4-EnableSelfServiceSiteCreationForSP2019.ps1 b/SharePointDsc/Examples/Resources/SPSelfServiceSiteCreation/4-EnableSelfServiceSiteCreationForSP2019.ps1 index a6e8143a8..9ed8a1be2 100644 --- a/SharePointDsc/Examples/Resources/SPSelfServiceSiteCreation/4-EnableSelfServiceSiteCreationForSP2019.ps1 +++ b/SharePointDsc/Examples/Resources/SPSelfServiceSiteCreation/4-EnableSelfServiceSiteCreationForSP2019.ps1 @@ -39,23 +39,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSelfServiceSiteCreation SSC - { - WebAppUrl = "http://example.contoso.local" - Enabled = $true - ManagedPath = "sites" - UserExperienceVersion = "Modern" - PsDscRunAsCredential = $SetupAccount - } + SPSelfServiceSiteCreation SSC + { + WebAppUrl = "http://example.contoso.local" + Enabled = $true + ManagedPath = "sites" + UserExperienceVersion = "Modern" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPServiceAppPool/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPServiceAppPool/1-Example.ps1 index 210c8ed4f..932ae7a31 100644 --- a/SharePointDsc/Examples/Resources/SPServiceAppPool/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPServiceAppPool/1-Example.ps1 @@ -39,22 +39,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPServiceAppPool MainServiceAppPool - { - Name = "SharePoint Service Applications" - ServiceAccount = "Demo\ServiceAccount" - PsDscRunAsCredential = $SetupAccount - Ensure = "Present" - } + SPServiceAppPool MainServiceAppPool + { + Name = "SharePoint Service Applications" + ServiceAccount = "Demo\ServiceAccount" + PsDscRunAsCredential = $SetupAccount + Ensure = "Present" } } +} diff --git a/SharePointDsc/Examples/Resources/SPServiceAppProxyGroup/1-ProxyGroups.ps1 b/SharePointDsc/Examples/Resources/SPServiceAppProxyGroup/1-ProxyGroups.ps1 index 1d9f98d2e..fa52a3a10 100644 --- a/SharePointDsc/Examples/Resources/SPServiceAppProxyGroup/1-ProxyGroups.ps1 +++ b/SharePointDsc/Examples/Resources/SPServiceAppProxyGroup/1-ProxyGroups.ps1 @@ -40,28 +40,31 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPServiceAppProxyGroup ProxyGroup1 - { - Name = "Proxy Group 1" - Ensure = "Present" - ServiceAppProxies = "Web 1 User Profile Service Application","Web 1 MMS Service Application","State Service Application" - } - - SPServiceAppProxyGroup ProxyGroup2 - { - Name = "Proxy Group 2" - Ensure = "Present" - ServiceAppProxiesToInclude = "Web 2 User Profile Service Application" - } + SPServiceAppProxyGroup ProxyGroup1 + { + Name = "Proxy Group 1" + Ensure = "Present" + ServiceAppProxies = "Web 1 User Profile Service Application", "Web 1 MMS Service Application", "State Service Application" + } + + SPServiceAppProxyGroup ProxyGroup2 + { + Name = "Proxy Group 2" + Ensure = "Present" + ServiceAppProxiesToInclude = "Web 2 User Profile Service Application" } } +} diff --git a/SharePointDsc/Examples/Resources/SPServiceAppSecurity/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPServiceAppSecurity/1-Example.ps1 index d1c9c29e5..4d368909c 100644 --- a/SharePointDsc/Examples/Resources/SPServiceAppSecurity/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPServiceAppSecurity/1-Example.ps1 @@ -44,14 +44,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { $membersToInclude = @() $membersToInclude += MSFT_SPServiceAppSecurityEntry { Username = "CONTOSO\SharePointFarmAccount" diff --git a/SharePointDsc/Examples/Resources/SPServiceAppSecurity/2-Example.ps1 b/SharePointDsc/Examples/Resources/SPServiceAppSecurity/2-Example.ps1 index cd4e8f4e5..970ab72ea 100644 --- a/SharePointDsc/Examples/Resources/SPServiceAppSecurity/2-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPServiceAppSecurity/2-Example.ps1 @@ -41,27 +41,30 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - $members = @() - $members += MSFT_SPServiceAppSecurityEntry { - Username = "{LocalFarm}" - AccessLevels = @("Full Control") - } - SPServiceAppSecurity UserProfileServiceSecurity - { - ServiceAppName = "User Profile Service Application" - SecurityType = "SharingPermissions" - Members = $members - PsDscRunAsCredential = $SetupAccount - } + $members = @() + $members += MSFT_SPServiceAppSecurityEntry { + Username = "{LocalFarm}" + AccessLevels = @("Full Control") + } + SPServiceAppSecurity UserProfileServiceSecurity + { + ServiceAppName = "User Profile Service Application" + SecurityType = "SharingPermissions" + Members = $members + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPServiceIdentity/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPServiceIdentity/1-Example.ps1 index 276477bc2..de02a6264 100644 --- a/SharePointDsc/Examples/Resources/SPServiceIdentity/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPServiceIdentity/1-Example.ps1 @@ -41,22 +41,23 @@ Updated author, copyright notice, and URLs. #> Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - - Import-DscResource -ModuleName SharePointDsc - - node localhost { - - SPServiceIdentity SandBoxUserAccount - { - Name = "Microsoft SharePoint Foundation Sandboxed Code Service" - ManagedAccount = "CONTOSO\SPUserCode" - PsDscRunAsCredential = $SetupAccount - } + SPServiceIdentity SandBoxUserAccount + { + Name = "Microsoft SharePoint Foundation Sandboxed Code Service" + ManagedAccount = "CONTOSO\SPUserCode" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPServiceInstance/1-StartService.ps1 b/SharePointDsc/Examples/Resources/SPServiceInstance/1-StartService.ps1 index 77bb75070..21d3e7ab2 100644 --- a/SharePointDsc/Examples/Resources/SPServiceInstance/1-StartService.ps1 +++ b/SharePointDsc/Examples/Resources/SPServiceInstance/1-StartService.ps1 @@ -40,21 +40,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPServiceInstance ManagedMetadataServiceInstance - { - Name = "Managed Metadata Web Service" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPServiceInstance ManagedMetadataServiceInstance + { + Name = "Managed Metadata Web Service" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPServiceInstance/2-StopService.ps1 b/SharePointDsc/Examples/Resources/SPServiceInstance/2-StopService.ps1 index a5719a651..6e424a391 100644 --- a/SharePointDsc/Examples/Resources/SPServiceInstance/2-StopService.ps1 +++ b/SharePointDsc/Examples/Resources/SPServiceInstance/2-StopService.ps1 @@ -40,21 +40,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPServiceInstance StopBCSServiceInstance - { - Name = "Business Data Connectivity Service" - Ensure = "Absent" - PsDscRunAsCredential = $SetupAccount - } + SPServiceInstance StopBCSServiceInstance + { + Name = "Business Data Connectivity Service" + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSessionStateService/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPSessionStateService/1-Example.ps1 index 0772623cf..15727d9ee 100644 --- a/SharePointDsc/Examples/Resources/SPSessionStateService/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPSessionStateService/1-Example.ps1 @@ -39,22 +39,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSessionStateService StateServiceApp - { - DatabaseName = "SP_StateService" - DatabaseServer = "SQL.test.domain" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPSessionStateService StateServiceApp + { + DatabaseName = "SP_StateService" + DatabaseServer = "SQL.test.domain" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPShellAdmins/1-FarmAdmins.ps1 b/SharePointDsc/Examples/Resources/SPShellAdmins/1-FarmAdmins.ps1 index e4db2c894..e85174171 100644 --- a/SharePointDsc/Examples/Resources/SPShellAdmins/1-FarmAdmins.ps1 +++ b/SharePointDsc/Examples/Resources/SPShellAdmins/1-FarmAdmins.ps1 @@ -40,21 +40,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPShellAdmins ShellAdmins - { - IsSingleInstance = "Yes" - Members = "CONTOSO\user1", "CONTOSO\user2" - AllDatabases = $true - } + SPShellAdmins ShellAdmins + { + IsSingleInstance = "Yes" + Members = "CONTOSO\user1", "CONTOSO\user2" + AllDatabases = $true } } +} diff --git a/SharePointDsc/Examples/Resources/SPShellAdmins/2-SpecificDBs.ps1 b/SharePointDsc/Examples/Resources/SPShellAdmins/2-SpecificDBs.ps1 index 3d617a1c2..acbea6f8a 100644 --- a/SharePointDsc/Examples/Resources/SPShellAdmins/2-SpecificDBs.ps1 +++ b/SharePointDsc/Examples/Resources/SPShellAdmins/2-SpecificDBs.ps1 @@ -40,30 +40,33 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPShellAdmins ShellAdmins - { - IsSingleInstance = "Yes" - Members = "CONTOSO\user1", "CONTOSO\user2" - Databases = @( - @(MSFT_SPDatabasePermissions { - Name = "SharePoint_Content_1" + SPShellAdmins ShellAdmins + { + IsSingleInstance = "Yes" + Members = "CONTOSO\user1", "CONTOSO\user2" + Databases = @( + @(MSFT_SPDatabasePermissions { + Name = "SharePoint_Content_1" Members = "CONTOSO\user2", "CONTOSO\user3" }) - @(MSFT_SPDatabasePermissions { - Name = "SharePoint_Content_2" + @(MSFT_SPDatabasePermissions { + Name = "SharePoint_Content_2" Members = "CONTOSO\user3", "CONTOSO\user4" }) - ) - } + ) } } +} diff --git a/SharePointDsc/Examples/Resources/SPShellAdmins/3-ExcludeDatabases.ps1 b/SharePointDsc/Examples/Resources/SPShellAdmins/3-ExcludeDatabases.ps1 index 6a382d4a5..e1fd6c0f3 100644 --- a/SharePointDsc/Examples/Resources/SPShellAdmins/3-ExcludeDatabases.ps1 +++ b/SharePointDsc/Examples/Resources/SPShellAdmins/3-ExcludeDatabases.ps1 @@ -41,22 +41,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPShellAdmins ShellAdmins - { - IsSingleInstance = "Yes" - Members = "CONTOSO\user1", "CONTOSO\user2" - AllDatabases = $true - ExcludeDatabases = "WSS_Content_Portal" - } + SPShellAdmins ShellAdmins + { + IsSingleInstance = "Yes" + Members = "CONTOSO\user1", "CONTOSO\user2" + AllDatabases = $true + ExcludeDatabases = "WSS_Content_Portal" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSite/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPSite/1-Example.ps1 index b92ad0af3..3a5fb848c 100644 --- a/SharePointDsc/Examples/Resources/SPSite/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPSite/1-Example.ps1 @@ -39,24 +39,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSite TeamSite - { - Url = "http://sharepoint.contoso.com" - OwnerAlias = "CONTOSO\ExampleUser" - HostHeaderWebApplication = "http://spsites.contoso.com" - Name = "Team Sites" - Template = "STS#0" - PsDscRunAsCredential = $SetupAccount - } + SPSite TeamSite + { + Url = "http://sharepoint.contoso.com" + OwnerAlias = "CONTOSO\ExampleUser" + HostHeaderWebApplication = "http://spsites.contoso.com" + Name = "Team Sites" + Template = "STS#0" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSite/2-SiteQuota.ps1 b/SharePointDsc/Examples/Resources/SPSite/2-SiteQuota.ps1 index b11387a8f..142f95a09 100644 --- a/SharePointDsc/Examples/Resources/SPSite/2-SiteQuota.ps1 +++ b/SharePointDsc/Examples/Resources/SPSite/2-SiteQuota.ps1 @@ -39,25 +39,28 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSite TeamSite - { - Url = "http://sharepoint.contoso.com" - OwnerAlias = "CONTOSO\ExampleUser" - HostHeaderWebApplication = "http://spsites.contoso.com" - Name = "Team Sites" - Template = "STS#0" - QuotaTemplate = "Teamsite" - PsDscRunAsCredential = $SetupAccount - } + SPSite TeamSite + { + Url = "http://sharepoint.contoso.com" + OwnerAlias = "CONTOSO\ExampleUser" + HostHeaderWebApplication = "http://spsites.contoso.com" + Name = "Team Sites" + Template = "STS#0" + QuotaTemplate = "Teamsite" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSite/3-AdministrationSiteType.ps1 b/SharePointDsc/Examples/Resources/SPSite/3-AdministrationSiteType.ps1 index 3a383b225..fe9e7d077 100644 --- a/SharePointDsc/Examples/Resources/SPSite/3-AdministrationSiteType.ps1 +++ b/SharePointDsc/Examples/Resources/SPSite/3-AdministrationSiteType.ps1 @@ -39,25 +39,28 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSite TeamSite - { - Url = "http://sharepoint.contoso.com" - OwnerAlias = "CONTOSO\ExampleUser" - HostHeaderWebApplication = "http://spsites.contoso.com" - Name = "Team Sites" - Template = "STS#0" - AdministrationSiteType = "TenantAdministration" - PsDscRunAsCredential = $SetupAccount - } + SPSite TeamSite + { + Url = "http://sharepoint.contoso.com" + OwnerAlias = "CONTOSO\ExampleUser" + HostHeaderWebApplication = "http://spsites.contoso.com" + Name = "Team Sites" + Template = "STS#0" + AdministrationSiteType = "TenantAdministration" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSiteUrl/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPSiteUrl/1-Example.ps1 index 2bc6c7aac..8aa957f57 100644 --- a/SharePointDsc/Examples/Resources/SPSiteUrl/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPSiteUrl/1-Example.ps1 @@ -40,22 +40,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSiteUrl TeamSite - { - Url = "http://sharepoint.contoso.intra" - Intranet = "http://sharepoint.contoso.com" - Internet = "https://sharepoint.contoso.com" - PsDscRunAsCredential = $SetupAccount - } + SPSiteUrl TeamSite + { + Url = "http://sharepoint.contoso.intra" + Intranet = "http://sharepoint.contoso.com" + Internet = "https://sharepoint.contoso.com" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPStateServiceApp/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPStateServiceApp/1-Example.ps1 index c99e4bd2a..6e536b273 100644 --- a/SharePointDsc/Examples/Resources/SPStateServiceApp/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPStateServiceApp/1-Example.ps1 @@ -39,22 +39,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPStateServiceApp StateServiceApp - { - Name = "State Service Application" - DatabaseName = "SP_State" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPStateServiceApp StateServiceApp + { + Name = "State Service Application" + DatabaseName = "SP_State" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSubscriptionSettingsServiceApp/1-NewServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPSubscriptionSettingsServiceApp/1-NewServiceApp.ps1 index 350a68c49..fe18da973 100644 --- a/SharePointDsc/Examples/Resources/SPSubscriptionSettingsServiceApp/1-NewServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPSubscriptionSettingsServiceApp/1-NewServiceApp.ps1 @@ -39,23 +39,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSubscriptionSettingsServiceApp SubscriptionSettingsServiceApp - { - Name = "Subscription Settings Service Application" - ApplicationPool = "SharePoint web services" - DatabaseServer = "SQL01.contoso.com" - DatabaseName = "SP_SubscriptionSettings" - PsDscRunAsCredential = $SetupAccount - } + SPSubscriptionSettingsServiceApp SubscriptionSettingsServiceApp + { + Name = "Subscription Settings Service Application" + ApplicationPool = "SharePoint web services" + DatabaseServer = "SQL01.contoso.com" + DatabaseName = "SP_SubscriptionSettings" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPSubscriptionSettingsServiceApp/2-RemoveServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPSubscriptionSettingsServiceApp/2-RemoveServiceApp.ps1 index 20c17e80d..ccbd81b31 100644 --- a/SharePointDsc/Examples/Resources/SPSubscriptionSettingsServiceApp/2-RemoveServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPSubscriptionSettingsServiceApp/2-RemoveServiceApp.ps1 @@ -41,22 +41,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPSubscriptionSettingsServiceApp SubscriptionSettingsServiceApp - { - Name = "Subscription Settings Service Application" - ApplicationPool = "n/a" - PsDscRunAsCredential = $SetupAccount - Ensure = "Absent" - } + SPSubscriptionSettingsServiceApp SubscriptionSettingsServiceApp + { + Name = "Subscription Settings Service Application" + ApplicationPool = "n/a" + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPTimerJobState/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPTimerJobState/1-Example.ps1 index 9c1a53868..afa68c48f 100644 --- a/SharePointDsc/Examples/Resources/SPTimerJobState/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPTimerJobState/1-Example.ps1 @@ -39,23 +39,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPTimerJobState DisableTimerJob_AppServerJob - { - TypeName = "Microsoft.Office.Server.Administration.ApplicationServerJob" - WebAppUrl = "http://sites.sharepoint.contoso.com" - Enabled = $false - Schedule ="weekly at sat 5:00" - PsDscRunAsCredential = $SetupAccount - } + SPTimerJobState DisableTimerJob_AppServerJob + { + TypeName = "Microsoft.Office.Server.Administration.ApplicationServerJob" + WebAppUrl = "http://sites.sharepoint.contoso.com" + Enabled = $false + Schedule ="weekly at sat 5:00" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuer/1-SigningCertInFileCertificateStore.ps1 b/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuer/1-SigningCertInFileCertificateStore.ps1 index 21614d437..4a33f9703 100644 --- a/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuer/1-SigningCertInFileCertificateStore.ps1 +++ b/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuer/1-SigningCertInFileCertificateStore.ps1 @@ -40,39 +40,42 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPTrustedIdentityTokenIssuer SampleSPTrust - { - Name = "Contoso" - Description = "Contoso" - Realm = "https://sharepoint.contoso.com" - SignInUrl = "https://adfs.contoso.com/adfs/ls/" - IdentifierClaim = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" - ClaimsMappings = @( - MSFT_SPClaimTypeMapping{ - Name = "Email" - IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" - } - MSFT_SPClaimTypeMapping{ - Name = "Role" - IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" - LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" - } - ) - SigningCertificateThumbPrint = "F0D3D9D8E38C1D55A3CEF3AAD1C18AD6A90D5628" - ClaimProviderName = "LDAPCP" - ProviderSignOutUri = "https://adfs.contoso.com/adfs/ls/" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPTrustedIdentityTokenIssuer SampleSPTrust + { + Name = "Contoso" + Description = "Contoso" + Realm = "https://sharepoint.contoso.com" + SignInUrl = "https://adfs.contoso.com/adfs/ls/" + IdentifierClaim = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" + ClaimsMappings = @( + MSFT_SPClaimTypeMapping { + Name = "Email" + IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" + } + MSFT_SPClaimTypeMapping { + Name = "Role" + IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" + LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" + } + ) + SigningCertificateThumbPrint = "F0D3D9D8E38C1D55A3CEF3AAD1C18AD6A90D5628" + ClaimProviderName = "LDAPCP" + ProviderSignOutUri = "https://adfs.contoso.com/adfs/ls/" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuer/2-SigningCertInFilePath.ps1 b/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuer/2-SigningCertInFilePath.ps1 index 3761f7d5a..9292069f9 100644 --- a/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuer/2-SigningCertInFilePath.ps1 +++ b/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuer/2-SigningCertInFilePath.ps1 @@ -40,39 +40,42 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPTrustedIdentityTokenIssuer SampleSPTrust - { - Name = "Contoso" - Description = "Contoso" - Realm = "https://sharepoint.contoso.com" - SignInUrl = "https://adfs.contoso.com/adfs/ls/" - IdentifierClaim = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" - ClaimsMappings = @( - MSFT_SPClaimTypeMapping{ - Name = "Email" - IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" - } - MSFT_SPClaimTypeMapping{ - Name = "Role" - IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" - LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" - } - ) - SigningCertificateFilePath = "F:\Data\DSC\FakeSigning.cer" - ClaimProviderName = "LDAPCP" - ProviderSignOutUri = "https://adfs.contoso.com/adfs/ls/" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPTrustedIdentityTokenIssuer SampleSPTrust + { + Name = "Contoso" + Description = "Contoso" + Realm = "https://sharepoint.contoso.com" + SignInUrl = "https://adfs.contoso.com/adfs/ls/" + IdentifierClaim = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" + ClaimsMappings = @( + MSFT_SPClaimTypeMapping { + Name = "Email" + IncomingClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" + } + MSFT_SPClaimTypeMapping { + Name = "Role" + IncomingClaimType = "http://schemas.xmlsoap.org/ExternalSTSGroupType" + LocalClaimType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role" + } + ) + SigningCertificateFilePath = "F:\Data\DSC\FakeSigning.cer" + ClaimProviderName = "LDAPCP" + ProviderSignOutUri = "https://adfs.contoso.com/adfs/ls/" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuerProviderRealms/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuerProviderRealms/1-Example.ps1 index 8bb315d28..62f4dbe43 100644 --- a/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuerProviderRealms/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuerProviderRealms/1-Example.ps1 @@ -42,31 +42,34 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { $ProviderRealms = @() $ProviderRealms += MSFT_SPProviderRealm { - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } $ProviderRealms += MSFT_SPProviderRealm { - RealmUrl = "https://intranet.contoso.com" - RealmUrn = "urn:sharepoint:contoso:intranet" - } + RealmUrl = "https://intranet.contoso.com" + RealmUrn = "urn:sharepoint:contoso:intranet" + } SPTrustedIdentityTokenIssuerProviderRealms Farm1OverwriteExample { - IssuerName = "Contoso" - ProviderRealms = $ProviderRealms - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount + IssuerName = "Contoso" + ProviderRealms = $ProviderRealms + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } } diff --git a/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuerProviderRealms/2-Example.ps1 b/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuerProviderRealms/2-Example.ps1 index 74b51b23b..7308a610c 100644 --- a/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuerProviderRealms/2-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuerProviderRealms/2-Example.ps1 @@ -42,32 +42,34 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) - Import-DscResource -ModuleName SharePointDsc - node localhost { + Import-DscResource -ModuleName SharePointDsc + node localhost + { $ProviderRealmsToInclude = @() $ProviderRealmsToInclude += MSFT_SPProviderRealm { - RealmUrl = "https://search.contoso.com" - RealmUrn = "urn:sharepoint:contoso:search" - } + RealmUrl = "https://search.contoso.com" + RealmUrn = "urn:sharepoint:contoso:search" + } $ProviderRealmsToInclude += MSFT_SPProviderRealm { - RealmUrl = "https://intranet.contoso.com" - RealmUrn = "urn:sharepoint:contoso:intranet" - } + RealmUrl = "https://intranet.contoso.com" + RealmUrn = "urn:sharepoint:contoso:intranet" + } SPTrustedIdentityTokenIssuerProviderRealms Farm1IncludeExample { - IssuerName = "Contoso" - ProviderRealmsToInclude = $ProviderRealmsToInclude - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount + IssuerName = "Contoso" + ProviderRealmsToInclude = $ProviderRealmsToInclude + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } } diff --git a/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuerProviderRealms/3-Example.ps1 b/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuerProviderRealms/3-Example.ps1 index 2d5da6313..203eb3cd1 100644 --- a/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuerProviderRealms/3-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuerProviderRealms/3-Example.ps1 @@ -43,14 +43,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { $ProviderRealmsToExclude = @() $ProviderRealmsToExclude += MSFT_SPProviderRealm { RealmUrl = "https://search.contoso.com" diff --git a/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuerProviderRealms/4-Example.ps1 b/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuerProviderRealms/4-Example.ps1 index eb5081b32..44073ccf5 100644 --- a/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuerProviderRealms/4-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPTrustedIdentityTokenIssuerProviderRealms/4-Example.ps1 @@ -43,14 +43,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { $ProviderRealmsToInclude = @() $ProviderRealmsToInclude += MSFT_SPProviderRealm { RealmUrl = "https://search.contoso.com" diff --git a/SharePointDsc/Examples/Resources/SPTrustedRootAuthority/1-AddRootAuthorityCertInCertStore.ps1 b/SharePointDsc/Examples/Resources/SPTrustedRootAuthority/1-AddRootAuthorityCertInCertStore.ps1 index 2bbbcc4e1..390cbb744 100644 --- a/SharePointDsc/Examples/Resources/SPTrustedRootAuthority/1-AddRootAuthorityCertInCertStore.ps1 +++ b/SharePointDsc/Examples/Resources/SPTrustedRootAuthority/1-AddRootAuthorityCertInCertStore.ps1 @@ -39,22 +39,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPTrustedRootAuthority SampleRootAuthority - { - Name = "Contoso" - CertificateThumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPTrustedRootAuthority SampleRootAuthority + { + Name = "Contoso" + CertificateThumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPTrustedRootAuthority/2-AddRootAuthorityCertInFilePath.ps1 b/SharePointDsc/Examples/Resources/SPTrustedRootAuthority/2-AddRootAuthorityCertInFilePath.ps1 index 539614913..03e73d13f 100644 --- a/SharePointDsc/Examples/Resources/SPTrustedRootAuthority/2-AddRootAuthorityCertInFilePath.ps1 +++ b/SharePointDsc/Examples/Resources/SPTrustedRootAuthority/2-AddRootAuthorityCertInFilePath.ps1 @@ -39,22 +39,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPTrustedRootAuthority SampleRootAuthority - { - Name = "Contoso" - CertificateFilePath = "C:\Certificates\RootAuthority.cer" - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPTrustedRootAuthority SampleRootAuthority + { + Name = "Contoso" + CertificateFilePath = "C:\Certificates\RootAuthority.cer" + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPTrustedRootAuthority/3-RemoveRootAuthority.ps1 b/SharePointDsc/Examples/Resources/SPTrustedRootAuthority/3-RemoveRootAuthority.ps1 index 2979399df..d56651ed1 100644 --- a/SharePointDsc/Examples/Resources/SPTrustedRootAuthority/3-RemoveRootAuthority.ps1 +++ b/SharePointDsc/Examples/Resources/SPTrustedRootAuthority/3-RemoveRootAuthority.ps1 @@ -39,22 +39,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPTrustedRootAuthority SampleRootAuthority - { - Name = "Contoso" - CertificateThumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" - Ensure = "Absent" - PsDscRunAsCredential = $SetupAccount - } + SPTrustedRootAuthority SampleRootAuthority + { + Name = "Contoso" + CertificateThumbprint = "770515261D1AB169057E246E0EE6431D557C3AFB" + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/1-CreateUsingCertificateFilePath.ps1 b/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/1-CreateUsingCertificateFilePath.ps1 index 6b453bcbe..abc444a7e 100644 --- a/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/1-CreateUsingCertificateFilePath.ps1 +++ b/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/1-CreateUsingCertificateFilePath.ps1 @@ -43,14 +43,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPTrustedSecurityTokenIssuer HighTrustAddinsTrust { Name = "HighTrustAddins" diff --git a/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/2-CreateUsingCertificateThumbprint.ps1 b/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/2-CreateUsingCertificateThumbprint.ps1 index e532c270f..a98738b9d 100644 --- a/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/2-CreateUsingCertificateThumbprint.ps1 +++ b/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/2-CreateUsingCertificateThumbprint.ps1 @@ -43,14 +43,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPTrustedSecurityTokenIssuer HighTrustAddinsTrust { Name = "HighTrustAddins" diff --git a/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/3-CreateUsingMetadata.ps1 b/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/3-CreateUsingMetadata.ps1 index d7d07c52b..ad6462b44 100644 --- a/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/3-CreateUsingMetadata.ps1 +++ b/SharePointDsc/Examples/Resources/SPTrustedSecurityTokenIssuer/3-CreateUsingMetadata.ps1 @@ -42,14 +42,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPTrustedSecurityTokenIssuer HighTrustAddinsTrust { Name = "ACS Trust" diff --git a/SharePointDsc/Examples/Resources/SPUsageApplication/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPUsageApplication/1-Example.ps1 index 4edcee171..56f4521cc 100644 --- a/SharePointDsc/Examples/Resources/SPUsageApplication/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPUsageApplication/1-Example.ps1 @@ -39,25 +39,28 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPUsageApplication UsageApplication - { - Name = "Usage Service Application" - DatabaseName = "SP_Usage" - UsageLogCutTime = 5 - UsageLogLocation = "L:\UsageLogs" - UsageLogMaxFileSizeKB = 1024 - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPUsageApplication UsageApplication + { + Name = "Usage Service Application" + DatabaseName = "SP_Usage" + UsageLogCutTime = 5 + UsageLogLocation = "L:\UsageLogs" + UsageLogMaxFileSizeKB = 1024 + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPUserProfileProperty/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPUserProfileProperty/1-Example.ps1 index 3ca90b971..2acc77809 100644 --- a/SharePointDsc/Examples/Resources/SPUserProfileProperty/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPUserProfileProperty/1-Example.ps1 @@ -42,22 +42,24 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) - Import-DscResource -ModuleName SharePointDsc - node localhost { + Import-DscResource -ModuleName SharePointDsc + node localhost + { SPUserProfileProperty WorkEmailProperty { Name = "WorkEmail2" Ensure = "Present" UserProfileService = "User Profile Service Application" DisplayName = "Work Email" - Type = "Email" + type = "Email" Description = "" #implementation isn't using it yet PolicySetting = "Mandatory" PrivacySetting = "Public" diff --git a/SharePointDsc/Examples/Resources/SPUserProfileSection/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPUserProfileSection/1-Example.ps1 index f2235575d..ceb0fadd3 100644 --- a/SharePointDsc/Examples/Resources/SPUserProfileSection/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPUserProfileSection/1-Example.ps1 @@ -40,24 +40,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPUserProfileSection PersonalInformationSection - { - Name = "PersonalInformationSection" - UserProfileService = "User Profile Service Application" - DisplayName = "Personal Information" - DisplayOrder = 5000 - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPUserProfileSection PersonalInformationSection + { + Name = "PersonalInformationSection" + UserProfileService = "User Profile Service Application" + DisplayName = "Personal Information" + DisplayOrder = 5000 + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPUserProfileServiceApp/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPUserProfileServiceApp/1-Example.ps1 index d7687c04e..e57db5f25 100644 --- a/SharePointDsc/Examples/Resources/SPUserProfileServiceApp/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPUserProfileServiceApp/1-Example.ps1 @@ -39,30 +39,33 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPUserProfileServiceApp UserProfileServiceApp - { - Name = "User Profile Service Application" - ApplicationPool = "SharePoint Service Applications" - MySiteHostLocation = "http://my.sharepoint.contoso.local" - MySiteManagedPath = "personal" - ProfileDBName = "SP_UserProfiles" - ProfileDBServer = "SQL.contoso.local\SQLINSTANCE" - SocialDBName = "SP_Social" - SocialDBServer = "SQL.contoso.local\SQLINSTANCE" - SyncDBName = "SP_ProfileSync" - SyncDBServer = "SQL.contoso.local\SQLINSTANCE" - EnableNetBIOS = $false - PsDscRunAsCredential = $SetupAccount - } + SPUserProfileServiceApp UserProfileServiceApp + { + Name = "User Profile Service Application" + ApplicationPool = "SharePoint Service Applications" + MySiteHostLocation = "http://my.sharepoint.contoso.local" + MySiteManagedPath = "personal" + ProfileDBName = "SP_UserProfiles" + ProfileDBServer = "SQL.contoso.local\SQLINSTANCE" + SocialDBName = "SP_Social" + SocialDBServer = "SQL.contoso.local\SQLINSTANCE" + SyncDBName = "SP_ProfileSync" + SyncDBServer = "SQL.contoso.local\SQLINSTANCE" + EnableNetBIOS = $false + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPUserProfileServiceApp/2-NoILMUsed.ps1 b/SharePointDsc/Examples/Resources/SPUserProfileServiceApp/2-NoILMUsed.ps1 index f890105fd..92123d748 100644 --- a/SharePointDsc/Examples/Resources/SPUserProfileServiceApp/2-NoILMUsed.ps1 +++ b/SharePointDsc/Examples/Resources/SPUserProfileServiceApp/2-NoILMUsed.ps1 @@ -39,31 +39,34 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPUserProfileServiceApp UserProfileServiceApp - { - Name = "User Profile Service Application" - ApplicationPool = "SharePoint Service Applications" - MySiteHostLocation = "http://my.sharepoint.contoso.local" - MySiteManagedPath = "personal" - ProfileDBName = "SP_UserProfiles" - ProfileDBServer = "SQL.contoso.local\SQLINSTANCE" - SocialDBName = "SP_Social" - SocialDBServer = "SQL.contoso.local\SQLINSTANCE" - SyncDBName = "SP_ProfileSync" - SyncDBServer = "SQL.contoso.local\SQLINSTANCE" - EnableNetBIOS = $false - NoILMUsed = $true - PsDscRunAsCredential = $SetupAccount - } + SPUserProfileServiceApp UserProfileServiceApp + { + Name = "User Profile Service Application" + ApplicationPool = "SharePoint Service Applications" + MySiteHostLocation = "http://my.sharepoint.contoso.local" + MySiteManagedPath = "personal" + ProfileDBName = "SP_UserProfiles" + ProfileDBServer = "SQL.contoso.local\SQLINSTANCE" + SocialDBName = "SP_Social" + SocialDBServer = "SQL.contoso.local\SQLINSTANCE" + SyncDBName = "SP_ProfileSync" + SyncDBServer = "SQL.contoso.local\SQLINSTANCE" + EnableNetBIOS = $false + NoILMUsed = $true + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPUserProfileServiceApp/3-SiteNamingConflictResolution.ps1 b/SharePointDsc/Examples/Resources/SPUserProfileServiceApp/3-SiteNamingConflictResolution.ps1 index a420609f0..e15d1b955 100644 --- a/SharePointDsc/Examples/Resources/SPUserProfileServiceApp/3-SiteNamingConflictResolution.ps1 +++ b/SharePointDsc/Examples/Resources/SPUserProfileServiceApp/3-SiteNamingConflictResolution.ps1 @@ -39,31 +39,34 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPUserProfileServiceApp UserProfileServiceApp - { - Name = "User Profile Service Application" - ApplicationPool = "SharePoint Service Applications" - MySiteHostLocation = "http://my.sharepoint.contoso.local" - MySiteManagedPath = "personal" - ProfileDBName = "SP_UserProfiles" - ProfileDBServer = "SQL.contoso.local\SQLINSTANCE" - SocialDBName = "SP_Social" - SocialDBServer = "SQL.contoso.local\SQLINSTANCE" - SyncDBName = "SP_ProfileSync" - SyncDBServer = "SQL.contoso.local\SQLINSTANCE" - EnableNetBIOS = $false - SiteNamingConflictResolution = "Domain_Username" - PsDscRunAsCredential = $SetupAccount - } + SPUserProfileServiceApp UserProfileServiceApp + { + Name = "User Profile Service Application" + ApplicationPool = "SharePoint Service Applications" + MySiteHostLocation = "http://my.sharepoint.contoso.local" + MySiteManagedPath = "personal" + ProfileDBName = "SP_UserProfiles" + ProfileDBServer = "SQL.contoso.local\SQLINSTANCE" + SocialDBName = "SP_Social" + SocialDBServer = "SQL.contoso.local\SQLINSTANCE" + SyncDBName = "SP_ProfileSync" + SyncDBServer = "SQL.contoso.local\SQLINSTANCE" + EnableNetBIOS = $false + SiteNamingConflictResolution = "Domain_Username" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPUserProfileServiceAppPermissions/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPUserProfileServiceAppPermissions/1-Example.ps1 index 04a5290b9..5f6c0e3b1 100644 --- a/SharePointDsc/Examples/Resources/SPUserProfileServiceAppPermissions/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPUserProfileServiceAppPermissions/1-Example.ps1 @@ -40,23 +40,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPUserProfileServiceAppPermissions UPAPermissions - { - ProxyName = "User Profile Service Application Proxy" - CreatePersonalSite = @("DEMO\Group", "DEMO\User1") - FollowAndEditProfile = @("Everyone") - UseTagsAndNotes = @("None") - PsDscRunAsCredential = $SetupAccount - } + SPUserProfileServiceAppPermissions UPAPermissions + { + ProxyName = "User Profile Service Application Proxy" + CreatePersonalSite = @("DEMO\Group", "DEMO\User1") + FollowAndEditProfile = @("Everyone") + UseTagsAndNotes = @("None") + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPUserProfileSyncConnection/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPUserProfileSyncConnection/1-Example.ps1 index bae1252b0..41853f85f 100644 --- a/SharePointDsc/Examples/Resources/SPUserProfileSyncConnection/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPUserProfileSyncConnection/1-Example.ps1 @@ -40,33 +40,36 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount, + + [Parameter(Mandatory = $true)] + [PSCredential] + $ConnectionAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount, - - [Parameter(Mandatory = $true)] - [PSCredential] - $ConnectionAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPUserProfileSyncConnection MainDomain - { - UserProfileService = "User Profile Service Application" - Forest = "contoso.com" - Name = "Contoso" - ConnectionCredentials = $ConnectionAccount - Server = "server.contoso.com" - UseSSL = $false - IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") - ExcludedOUs = @("OU=Notes Usersa,DC=Contoso,DC=com") - Force = $false - ConnectionType = "ActiveDirectory" - PsDscRunAsCredential = $SetupAccount - } + SPUserProfileSyncConnection MainDomain + { + UserProfileService = "User Profile Service Application" + Forest = "contoso.com" + Name = "Contoso" + ConnectionCredentials = $ConnectionAccount + Server = "server.contoso.com" + UseSSL = $false + IncludedOUs = @("OU=SharePoint Users,DC=Contoso,DC=com") + ExcludedOUs = @("OU=Notes Usersa,DC=Contoso,DC=com") + Force = $false + ConnectionType = "ActiveDirectory" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPUserProfileSyncService/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPUserProfileSyncService/1-Example.ps1 index 378d218ff..c8d8edefa 100644 --- a/SharePointDsc/Examples/Resources/SPUserProfileSyncService/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPUserProfileSyncService/1-Example.ps1 @@ -39,22 +39,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPUserProfileSyncService UserProfileSyncService - { - UserProfileServiceAppName = "User Profile Service Application" - Ensure = "Present" - RunOnlyWhenWriteable = $true - PsDscRunAsCredential = $SetupAccount - } + SPUserProfileSyncService UserProfileSyncService + { + UserProfileServiceAppName = "User Profile Service Application" + Ensure = "Present" + RunOnlyWhenWriteable = $true + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPVisioServiceApp/1-NewServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPVisioServiceApp/1-NewServiceApp.ps1 index f13e369e1..439f0bc40 100644 --- a/SharePointDsc/Examples/Resources/SPVisioServiceApp/1-NewServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPVisioServiceApp/1-NewServiceApp.ps1 @@ -39,21 +39,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPVisioServiceApp VisioServices - { - Name = "Visio Graphics Service Application" - ApplicationPool = "SharePoint Web Services" - PsDscRunAsCredential = $SetupAccount - } + SPVisioServiceApp VisioServices + { + Name = "Visio Graphics Service Application" + ApplicationPool = "SharePoint Web Services" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPVisioServiceApp/2-RemoveServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPVisioServiceApp/2-RemoveServiceApp.ps1 index dd4986ee8..703303677 100644 --- a/SharePointDsc/Examples/Resources/SPVisioServiceApp/2-RemoveServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPVisioServiceApp/2-RemoveServiceApp.ps1 @@ -41,22 +41,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPVisioServiceApp VisioServices - { - Name = "Visio Graphics Service Application" - ApplicationPool = "n/a" - Ensure = "Absent" - PsDscRunAsCredential = $SetupAccount - } + SPVisioServiceApp VisioServices + { + Name = "Visio Graphics Service Application" + ApplicationPool = "n/a" + Ensure = "Absent" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWeb/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPWeb/1-Example.ps1 index e242294fe..f32f0593f 100644 --- a/SharePointDsc/Examples/Resources/SPWeb/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPWeb/1-Example.ps1 @@ -39,26 +39,29 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWeb TeamSite - { - Url = "http://sharepoint.contoso.com/sites/site/subweb" - Name = "Team Sites" - Ensure = "Present" - Description = "A place to share documents with your team." - Template = "STS#0" - Language = 1033 - AddToTopNav = $true - PsDscRunAsCredential = $SetupAccount - } + SPWeb TeamSite + { + Url = "http://sharepoint.contoso.com/sites/site/subweb" + Name = "Team Sites" + Ensure = "Present" + Description = "A place to share documents with your team." + Template = "STS#0" + Language = 1033 + AddToTopNav = $true + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWeb/2-EnableAccessRequests.ps1 b/SharePointDsc/Examples/Resources/SPWeb/2-EnableAccessRequests.ps1 index cc6167e2d..d31dc387f 100644 --- a/SharePointDsc/Examples/Resources/SPWeb/2-EnableAccessRequests.ps1 +++ b/SharePointDsc/Examples/Resources/SPWeb/2-EnableAccessRequests.ps1 @@ -40,28 +40,31 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWeb TeamSite - { - Url = "http://sharepoint.contoso.com/sites/site/subweb" - Name = "Team Sites" - Ensure = "Present" - Description = "A place to share documents with your team." - Template = "STS#0" - Language = 1033 - AddToTopNav = $true - UniquePermissions = $true - RequestAccessEmail = "sample@contoso.com" - PsDscRunAsCredential = $SetupAccount - } + SPWeb TeamSite + { + Url = "http://sharepoint.contoso.com/sites/site/subweb" + Name = "Team Sites" + Ensure = "Present" + Description = "A place to share documents with your team." + Template = "STS#0" + Language = 1033 + AddToTopNav = $true + UniquePermissions = $true + RequestAccessEmail = "sample@contoso.com" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWeb/3-DisableAccessRequests.ps1 b/SharePointDsc/Examples/Resources/SPWeb/3-DisableAccessRequests.ps1 index 06a8e40e9..b01e580e6 100644 --- a/SharePointDsc/Examples/Resources/SPWeb/3-DisableAccessRequests.ps1 +++ b/SharePointDsc/Examples/Resources/SPWeb/3-DisableAccessRequests.ps1 @@ -40,27 +40,30 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWeb TeamSite - { - Url = "http://sharepoint.contoso.com/sites/site/subweb" - Name = "Team Sites" - Ensure = "Present" - Description = "A place to share documents with your team." - Template = "STS#0" - Language = 1033 - AddToTopNav = $true - RequestAccessEmail = "" - PsDscRunAsCredential = $SetupAccount - } + SPWeb TeamSite + { + Url = "http://sharepoint.contoso.com/sites/site/subweb" + Name = "Team Sites" + Ensure = "Present" + Description = "A place to share documents with your team." + Template = "STS#0" + Language = 1033 + AddToTopNav = $true + RequestAccessEmail = "" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebAppAuthentication/1-NTLMExample.ps1 b/SharePointDsc/Examples/Resources/SPWebAppAuthentication/1-NTLMExample.ps1 index cf3414b7b..14ff14e18 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppAuthentication/1-NTLMExample.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppAuthentication/1-NTLMExample.ps1 @@ -51,8 +51,8 @@ Configuration Example Import-DscResource -ModuleName SharePointDsc - node localhost { - + node localhost + { SPWebAppAuthentication ContosoAuthentication { WebAppUrl = "http://sharepoint.contoso.com" diff --git a/SharePointDsc/Examples/Resources/SPWebAppAuthentication/2-KerberosExample.ps1 b/SharePointDsc/Examples/Resources/SPWebAppAuthentication/2-KerberosExample.ps1 index 30ebde689..e50340286 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppAuthentication/2-KerberosExample.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppAuthentication/2-KerberosExample.ps1 @@ -51,8 +51,8 @@ Configuration Example Import-DscResource -ModuleName SharePointDsc - node localhost { - + node localhost + { SPWebAppAuthentication ContosoAuthentication { WebAppUrl = "http://sharepoint.contoso.com" diff --git a/SharePointDsc/Examples/Resources/SPWebAppAuthentication/3-ClaimsExample.ps1 b/SharePointDsc/Examples/Resources/SPWebAppAuthentication/3-ClaimsExample.ps1 index 003afd5d1..b457cba11 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppAuthentication/3-ClaimsExample.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppAuthentication/3-ClaimsExample.ps1 @@ -54,7 +54,8 @@ Configuration Example Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPTrustedIdentityTokenIssuer SampleSPTrust { Name = "Contoso" diff --git a/SharePointDsc/Examples/Resources/SPWebAppAuthentication/5-BasicAuthExample.ps1 b/SharePointDsc/Examples/Resources/SPWebAppAuthentication/5-BasicAuthExample.ps1 index 16dabd2f1..3977c0be2 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppAuthentication/5-BasicAuthExample.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppAuthentication/5-BasicAuthExample.ps1 @@ -51,8 +51,8 @@ Configuration Example Import-DscResource -ModuleName SharePointDsc - node localhost { - + node localhost + { SPWebAppAuthentication ContosoAuthentication { WebAppUrl = "http://sharepoint.contoso.com" diff --git a/SharePointDsc/Examples/Resources/SPWebAppBlockedFileTypes/1-Inclusion.ps1 b/SharePointDsc/Examples/Resources/SPWebAppBlockedFileTypes/1-Inclusion.ps1 index 16568f84e..08142796c 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppBlockedFileTypes/1-Inclusion.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppBlockedFileTypes/1-Inclusion.ps1 @@ -41,22 +41,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWebAppBlockedFileTypes PrimaryWebAppBlockedFileTypes - { - WebAppUrl = "http://example.contoso.local" - EnsureBlocked = @("exe", "dll", "msi") - EnsureAllowed = @("pdf", "docx", "xlsx") - PsDscRunAsCredential = $SetupAccount - } + SPWebAppBlockedFileTypes PrimaryWebAppBlockedFileTypes + { + WebAppUrl = "http://example.contoso.local" + EnsureBlocked = @("exe", "dll", "msi") + EnsureAllowed = @("pdf", "docx", "xlsx") + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebAppBlockedFileTypes/2-SpecificList.ps1 b/SharePointDsc/Examples/Resources/SPWebAppBlockedFileTypes/2-SpecificList.ps1 index 7fda5e262..6d730f83e 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppBlockedFileTypes/2-SpecificList.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppBlockedFileTypes/2-SpecificList.ps1 @@ -40,21 +40,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWebAppBlockedFileTypes PrimaryWebAppBlockedFileTypes - { - WebAppUrl = "http://example.contoso.local" - Blocked = @("exe", "dll", "msi") - PsDscRunAsCredential = $SetupAccount - } + SPWebAppBlockedFileTypes PrimaryWebAppBlockedFileTypes + { + WebAppUrl = "http://example.contoso.local" + Blocked = @("exe", "dll", "msi") + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebAppClientCallableSettings/1-SetClientCallableSettings.ps1 b/SharePointDsc/Examples/Resources/SPWebAppClientCallableSettings/1-SetClientCallableSettings.ps1 index b66445b3e..2dcd5d248 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppClientCallableSettings/1-SetClientCallableSettings.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppClientCallableSettings/1-SetClientCallableSettings.ps1 @@ -39,29 +39,32 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWebAppClientCallableSettings DefaultClientCallableSettings - { - WebAppUrl = "http://example.contoso.local" - MaxResourcesPerRequest = 16 - MaxObjectPaths = 256 - ExecutionTimeout = 90 - RequestXmlMaxDepth = 32 - EnableXsdValidation = $true - EnableStackTrace = $false - RequestUsageExecutionTimeThreshold = 800 - EnableRequestUsage = $true - LogActionsIfHasRequestException = $true - PsDscRunAsCredential = $SetupAccount - } + SPWebAppClientCallableSettings DefaultClientCallableSettings + { + WebAppUrl = "http://example.contoso.local" + MaxResourcesPerRequest = 16 + MaxObjectPaths = 256 + ExecutionTimeout = 90 + RequestXmlMaxDepth = 32 + EnableXsdValidation = $true + EnableStackTrace = $false + RequestUsageExecutionTimeThreshold = 800 + EnableRequestUsage = $true + LogActionsIfHasRequestException = $true + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebAppClientCallableSettings/2-EnableTenantAdministration.ps1 b/SharePointDsc/Examples/Resources/SPWebAppClientCallableSettings/2-EnableTenantAdministration.ps1 index 4d04751ce..31deb3cbd 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppClientCallableSettings/2-EnableTenantAdministration.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppClientCallableSettings/2-EnableTenantAdministration.ps1 @@ -39,27 +39,30 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - $proxyLibraries = @() - $proxyLibraries += MSFT_SPProxyLibraryEntry { - AssemblyName = "Microsoft.Online.SharePoint.Dedicated.TenantAdmin.ServerStub, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" - SupportAppAuthentication = $true - } - - SPWebAppClientCallableSettings TenantAdministration - { - WebAppUrl = "http://example.contoso.local" - ProxyLibraries = $proxyLibraries - PsDscRunAsCredential = $SetupAccount - } + $proxyLibraries = @() + $proxyLibraries += MSFT_SPProxyLibraryEntry { + AssemblyName = "Microsoft.Online.SharePoint.Dedicated.TenantAdmin.ServerStub, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" + SupportAppAuthentication = $true + } + + SPWebAppClientCallableSettings TenantAdministration + { + WebAppUrl = "http://example.contoso.local" + ProxyLibraries = $proxyLibraries + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebAppGeneralSettings/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPWebAppGeneralSettings/1-Example.ps1 index 9352a7c4e..4e220a39f 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppGeneralSettings/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppGeneralSettings/1-Example.ps1 @@ -40,23 +40,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWebAppGeneralSettings PrimaryWebAppGeneralSettings - { - WebAppUrl = "http://example.contoso.local" - TimeZone = 76 - Alerts = $true - RSS = $false - PsDscRunAsCredential = $SetupAccount - } + SPWebAppGeneralSettings PrimaryWebAppGeneralSettings + { + WebAppUrl = "http://example.contoso.local" + TimeZone = 76 + Alerts = $true + RSS = $false + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebAppPeoplePickerSettings/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPWebAppPeoplePickerSettings/1-Example.ps1 index 2349ea88e..fd1122727 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppPeoplePickerSettings/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppPeoplePickerSettings/1-Example.ps1 @@ -39,35 +39,38 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $AccessAccount, + + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $AccessAccount, - - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWebAppPeoplePickerSettings ConfigurePeoplePicker - { - WebAppUrl = "http://sharepoint.contoso.com" - ActiveDirectoryCustomFilter = $null - ActiveDirectoryCustomQuery = $null - ActiveDirectorySearchTimeout = 30 - OnlySearchWithinSiteCollection = $false - SearchActiveDirectoryDomains = @( - MSFT_SPWebAppPPSearchDomain { - FQDN = "contoso.com" - IsForest = $false - AccessAccount = $AccessAccount - } - ) - PsDscRunAsCredential = $SetupAccount - } + SPWebAppPeoplePickerSettings ConfigurePeoplePicker + { + WebAppUrl = "http://sharepoint.contoso.com" + ActiveDirectoryCustomFilter = $null + ActiveDirectoryCustomQuery = $null + ActiveDirectorySearchTimeout = 30 + OnlySearchWithinSiteCollection = $false + SearchActiveDirectoryDomains = @( + MSFT_SPWebAppPPSearchDomain { + FQDN = "contoso.com" + IsForest = $false + AccessAccount = $AccessAccount + } + ) + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebAppPermissions/1-LimitPermissions.ps1 b/SharePointDsc/Examples/Resources/SPWebAppPermissions/1-LimitPermissions.ps1 index 7a646af5d..e021a0924 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppPermissions/1-LimitPermissions.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppPermissions/1-LimitPermissions.ps1 @@ -39,23 +39,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWebAppPermissions WebApplicationPermissions - { - WebAppUrl = "https://intranet.sharepoint.contoso.com" - ListPermissions = "Manage Lists","Override List Behaviors","Add Items","Edit Items","Delete Items","View Items","Approve Items","Open Items","View Versions","Delete Versions","Create Alerts","View Application Pages" - SitePermissions = "Manage Permissions","View Web Analytics Data","Create Subsites","Manage Web Site","Add and Customize Pages","Apply Themes and Borders","Apply Style Sheets","Create Groups","Browse Directories","Use Self-Service Site Creation","View Pages","Enumerate Permissions","Browse User Information","Manage Alerts","Use Remote Interfaces","Use Client Integration Features","Open","Edit Personal User Information" - PersonalPermissions = "Manage Personal Views","Add/Remove Personal Web Parts","Update Personal Web Parts" - PsDscRunAsCredential = $SetupAccount - } + SPWebAppPermissions WebApplicationPermissions + { + WebAppUrl = "https://intranet.sharepoint.contoso.com" + ListPermissions = "Manage Lists", "Override List Behaviors", "Add Items", "Edit Items", "Delete Items", "View Items", "Approve Items", "Open Items", "View Versions", "Delete Versions", "Create Alerts", "View Application Pages" + SitePermissions = "Manage Permissions", "View Web Analytics Data", "Create Subsites", "Manage Web Site", "Add and Customize Pages", "Apply Themes and Borders", "Apply Style Sheets", "Create Groups", "Browse Directories", "Use Self-Service Site Creation", "View Pages", "Enumerate Permissions", "Browse User Information", "Manage Alerts", "Use Remote Interfaces", "Use Client Integration Features", "Open", "Edit Personal User Information" + PersonalPermissions = "Manage Personal Views", "Add/Remove Personal Web Parts", "Update Personal Web Parts" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebAppPermissions/2-AllPermissions.ps1 b/SharePointDsc/Examples/Resources/SPWebAppPermissions/2-AllPermissions.ps1 index 4ae403252..8010a9ee7 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppPermissions/2-AllPermissions.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppPermissions/2-AllPermissions.ps1 @@ -39,21 +39,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWebAppPermissions WebApplicationPermissions - { - WebAppUrl = "https://portal.sharepoint.contoso.com" - AllPermissions = $true - PsDscRunAsCredential = $SetupAccount - } + SPWebAppPermissions WebApplicationPermissions + { + WebAppUrl = "https://portal.sharepoint.contoso.com" + AllPermissions = $true + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebAppPolicy/1-SpecificMembers.ps1 b/SharePointDsc/Examples/Resources/SPWebAppPolicy/1-SpecificMembers.ps1 index c59c2072d..cf475fdc1 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppPolicy/1-SpecificMembers.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppPolicy/1-SpecificMembers.ps1 @@ -40,32 +40,35 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWebAppPolicy WebAppPolicy - { - WebAppUrl = "http://sharepoint.contoso.com" - Members = @( - MSFT_SPWebPolicyPermissions { - Username = "contoso\user1" - PermissionLevel = "Full Control" - ActAsSystemAccount = $true - } - MSFT_SPWebPolicyPermissions { - Username = "contoso\Group 1" - PermissionLevel = "Full Read" - IdentityType = "Claims" - } - ) - PsDscRunAsCredential = $SetupAccount - } + SPWebAppPolicy WebAppPolicy + { + WebAppUrl = "http://sharepoint.contoso.com" + Members = @( + MSFT_SPWebPolicyPermissions { + Username = "contoso\user1" + PermissionLevel = "Full Control" + ActAsSystemAccount = $true + } + MSFT_SPWebPolicyPermissions { + Username = "contoso\Group 1" + PermissionLevel = "Full Read" + IdentityType = "Claims" + } + ) + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebAppPolicy/2-IncludeMembers.ps1 b/SharePointDsc/Examples/Resources/SPWebAppPolicy/2-IncludeMembers.ps1 index 8af0a0cc9..29273995c 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppPolicy/2-IncludeMembers.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppPolicy/2-IncludeMembers.ps1 @@ -40,36 +40,39 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWebAppPolicy WebAppPolicy - { - WebAppUrl = "http://sharepoint.contoso.com" - MembersToInclude = @( - @(MSFT_SPWebPolicyPermissions { + SPWebAppPolicy WebAppPolicy + { + WebAppUrl = "http://sharepoint.contoso.com" + MembersToInclude = @( + @(MSFT_SPWebPolicyPermissions { Username = "contoso\user1" PermissionLevel = "Full Control" }) - @(MSFT_SPWebPolicyPermissions { + @(MSFT_SPWebPolicyPermissions { Username = "contoso\user2" PermissionLevel = "Full Read" }) - ) - MembersToExclude = @( - @(MSFT_SPWebPolicyPermissions { + ) + MembersToExclude = @( + @(MSFT_SPWebPolicyPermissions { Username = "contoso\user3" }) - ) - SetCacheAccountsPolicy = $true - PsDscRunAsCredential = $SetupAccount - } + ) + SetCacheAccountsPolicy = $true + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebAppProxyGroup/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPWebAppProxyGroup/1-Example.ps1 index b10a84560..b8130b054 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppProxyGroup/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppProxyGroup/1-Example.ps1 @@ -39,21 +39,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWebAppProxyGroup ContosoWeb - { - WebAppUrl = "https://web.contoso.com" - ServiceAppProxyGroup = "Proxy Group 1" - PsDscRunAsCredential = $SetupAccount - } + SPWebAppProxyGroup ContosoWeb + { + WebAppUrl = "https://web.contoso.com" + ServiceAppProxyGroup = "Proxy Group 1" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebAppSiteUseAndDeletion/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPWebAppSiteUseAndDeletion/1-Example.ps1 index a10c8ef92..f0a3cd9d4 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppSiteUseAndDeletion/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppSiteUseAndDeletion/1-Example.ps1 @@ -39,24 +39,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWebAppSiteUseAndDeletion ConfigureSiteUseAndDeletion - { - WebAppUrl = "http://example.contoso.local" - SendUnusedSiteCollectionNotifications = $true - UnusedSiteNotificationPeriod = 90 - AutomaticallyDeleteUnusedSiteCollections = $true - UnusedSiteNotificationsBeforeDeletion = 24 - PsDscRunAsCredential = $SetupAccount - } + SPWebAppSiteUseAndDeletion ConfigureSiteUseAndDeletion + { + WebAppUrl = "http://example.contoso.local" + SendUnusedSiteCollectionNotifications = $true + UnusedSiteNotificationPeriod = 90 + AutomaticallyDeleteUnusedSiteCollections = $true + UnusedSiteNotificationsBeforeDeletion = 24 + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebAppSuiteBar/1-ApplySuiteBarBranding2016.ps1 b/SharePointDsc/Examples/Resources/SPWebAppSuiteBar/1-ApplySuiteBarBranding2016.ps1 index 1462f4d4c..bbfccf483 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppSuiteBar/1-ApplySuiteBarBranding2016.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppSuiteBar/1-ApplySuiteBarBranding2016.ps1 @@ -40,24 +40,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWebAppSuiteBar SP2016Branding - { - WebAppUrl = "https://intranet.sharepoint.contoso.com" - SuiteNavBrandingLogoNavigationUrl = "http://sites.sharepoint.com" - SuiteNavBrandingLogoTitle = "This is my logo" - SuiteNavBrandingLogoUrl = "http://sites.sharepoint.com/images/logo.gif" - SuiteNavBrandingText = "SharePointDSC WebApp" - PsDscRunAsCredential = $SetupAccount - } + SPWebAppSuiteBar SP2016Branding + { + WebAppUrl = "https://intranet.sharepoint.contoso.com" + SuiteNavBrandingLogoNavigationUrl = "http://sites.sharepoint.com" + SuiteNavBrandingLogoTitle = "This is my logo" + SuiteNavBrandingLogoUrl = "http://sites.sharepoint.com/images/logo.gif" + SuiteNavBrandingText = "SharePointDSC WebApp" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebAppSuiteBar/2-ApplySuiteBarBranding2013.ps1 b/SharePointDsc/Examples/Resources/SPWebAppSuiteBar/2-ApplySuiteBarBranding2013.ps1 index 734d0cd87..8829b99da 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppSuiteBar/2-ApplySuiteBarBranding2013.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppSuiteBar/2-ApplySuiteBarBranding2013.ps1 @@ -40,21 +40,24 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWebAppSuiteBar SP2013Branding - { - WebAppUrl = "https://intranet.sharepoint.contoso.com" - SuiteBarBrandingElementHtml = "
SharePointDSC WebApp
" - PsDscRunAsCredential = $SetupAccount - } + SPWebAppSuiteBar SP2013Branding + { + WebAppUrl = "https://intranet.sharepoint.contoso.com" + SuiteBarBrandingElementHtml = "
SharePointDSC WebApp
" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebAppThrottlingSettings/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPWebAppThrottlingSettings/1-Example.ps1 index edcf6b54e..2035dc0d5 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppThrottlingSettings/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppThrottlingSettings/1-Example.ps1 @@ -39,28 +39,31 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWebAppThrottlingSettings PrimaryWebAppThrottlingSettings - { - WebAppUrl = "http://example.contoso.local" - ListViewThreshold = 5000 - AllowObjectModelOverride = $false - HappyHourEnabled = $true - HappyHour = MSFT_SPWebApplicationHappyHour { - Hour = 3 - Minute = 0 - Duration = 1 - } - PsDscRunAsCredential = $SetupAccount + SPWebAppThrottlingSettings PrimaryWebAppThrottlingSettings + { + WebAppUrl = "http://example.contoso.local" + ListViewThreshold = 5000 + AllowObjectModelOverride = $false + HappyHourEnabled = $true + HappyHour = MSFT_SPWebApplicationHappyHour { + Hour = 3 + Minute = 0 + Duration = 1 } + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebAppWorkflowSettings/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPWebAppWorkflowSettings/1-Example.ps1 index 8c9efa261..00bb4eeea 100644 --- a/SharePointDsc/Examples/Resources/SPWebAppWorkflowSettings/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebAppWorkflowSettings/1-Example.ps1 @@ -39,22 +39,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWebAppWorkflowSettings PrimaryWebAppWorkflowSettings - { - WebAppUrl = "Shttp://example.contoso.local" - ExternalWorkflowParticipantsEnabled = $false - EmailToNoPermissionWorkflowParticipantsEnable = $false - PsDscRunAsCredential = $SetupAccount - } + SPWebAppWorkflowSettings PrimaryWebAppWorkflowSettings + { + WebAppUrl = "Shttp://example.contoso.local" + ExternalWorkflowParticipantsEnabled = $false + EmailToNoPermissionWorkflowParticipantsEnable = $false + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebApplication/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPWebApplication/1-Example.ps1 index a418f31a1..2b62a83c3 100644 --- a/SharePointDsc/Examples/Resources/SPWebApplication/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebApplication/1-Example.ps1 @@ -39,28 +39,31 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWebApplication HostNameSiteCollectionWebApp - { - 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" - Port = 80 - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + SPWebApplication HostNameSiteCollectionWebApp + { + 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" + Port = 80 + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebApplicationAppDomain/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPWebApplicationAppDomain/1-Example.ps1 index 3a839c7e2..39ccced72 100644 --- a/SharePointDsc/Examples/Resources/SPWebApplicationAppDomain/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebApplicationAppDomain/1-Example.ps1 @@ -39,24 +39,27 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWebApplicationAppDomain Domain - { - AppDomain = "contosointranetapps.com" - WebAppUrl ="http://portal.contoso.com" - Zone = "Default"; - Port = 80; - SSL = $false; - PsDscRunAsCredential = $SetupAccount - } + SPWebApplicationAppDomain Domain + { + AppDomain = "contosointranetapps.com" + WebAppUrl = "http://portal.contoso.com" + Zone = "Default" + Port = 80 + SSL = $false + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWebApplicationExtension/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPWebApplicationExtension/1-Example.ps1 index 3c82388f9..4ba4d3260 100644 --- a/SharePointDsc/Examples/Resources/SPWebApplicationExtension/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPWebApplicationExtension/1-Example.ps1 @@ -39,29 +39,32 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - 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" - UseSSL = $false - Port = 80 - Ensure = "Present" - PsDscRunAsCredential = $SetupAccount - } + 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" + UseSSL = $false + Port = 80 + Ensure = "Present" + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWordAutomationServiceApp/1-NewServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPWordAutomationServiceApp/1-NewServiceApp.ps1 index 8152bfb9f..23f5488a9 100644 --- a/SharePointDsc/Examples/Resources/SPWordAutomationServiceApp/1-NewServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPWordAutomationServiceApp/1-NewServiceApp.ps1 @@ -41,14 +41,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPWordAutomationServiceApp WordAutomation { Name = "Word Automation Service Application" diff --git a/SharePointDsc/Examples/Resources/SPWordAutomationServiceApp/2-NewServiceAppWithDefault.ps1 b/SharePointDsc/Examples/Resources/SPWordAutomationServiceApp/2-NewServiceAppWithDefault.ps1 index dafc2bc65..07654d45c 100644 --- a/SharePointDsc/Examples/Resources/SPWordAutomationServiceApp/2-NewServiceAppWithDefault.ps1 +++ b/SharePointDsc/Examples/Resources/SPWordAutomationServiceApp/2-NewServiceAppWithDefault.ps1 @@ -42,14 +42,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPWordAutomationServiceApp WordAutomation { Name = "Word Automation Service Application" diff --git a/SharePointDsc/Examples/Resources/SPWordAutomationServiceApp/3-RemoveServiceApp.ps1 b/SharePointDsc/Examples/Resources/SPWordAutomationServiceApp/3-RemoveServiceApp.ps1 index b3212c9f1..671de6236 100644 --- a/SharePointDsc/Examples/Resources/SPWordAutomationServiceApp/3-RemoveServiceApp.ps1 +++ b/SharePointDsc/Examples/Resources/SPWordAutomationServiceApp/3-RemoveServiceApp.ps1 @@ -41,14 +41,17 @@ Updated author, copyright notice, and URLs. Configuration Example { - param( + param + ( [Parameter(Mandatory = $true)] [PSCredential] $SetupAccount ) + Import-DscResource -ModuleName SharePointDsc - node localhost { + node localhost + { SPWordAutomationServiceApp WordAutomation { Name = "Word Automation Service Application" diff --git a/SharePointDsc/Examples/Resources/SPWorkManagementServiceApp/1-Example.ps1 b/SharePointDsc/Examples/Resources/SPWorkManagementServiceApp/1-Example.ps1 index 6eb50df22..9b58a589f 100644 --- a/SharePointDsc/Examples/Resources/SPWorkManagementServiceApp/1-Example.ps1 +++ b/SharePointDsc/Examples/Resources/SPWorkManagementServiceApp/1-Example.ps1 @@ -39,22 +39,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWorkManagementServiceApp WorkManagementServiceApp - { - Name = "Work Management Service Application" - ApplicationPool = "SharePoint web services" - MinimumTimeBetweenEwsSyncSubscriptionSearches = 10 - PsDscRunAsCredential = $SetupAccount - } + SPWorkManagementServiceApp WorkManagementServiceApp + { + Name = "Work Management Service Application" + ApplicationPool = "SharePoint web services" + MinimumTimeBetweenEwsSyncSubscriptionSearches = 10 + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWorkflowService/1-RegisterWorkflowService.ps1 b/SharePointDsc/Examples/Resources/SPWorkflowService/1-RegisterWorkflowService.ps1 index 1abc5fd44..d96c50050 100644 --- a/SharePointDsc/Examples/Resources/SPWorkflowService/1-RegisterWorkflowService.ps1 +++ b/SharePointDsc/Examples/Resources/SPWorkflowService/1-RegisterWorkflowService.ps1 @@ -39,22 +39,25 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWorkflowService WorkflowService - { - WorkflowHostUri = "http://workflow.sharepoint.contoso.com" - SPSiteUrl = "http://sites.sharepoint.com" - AllowOAuthHttp = $true - PsDscRunAsCredential = $SetupAccount - } + SPWorkflowService WorkflowService + { + WorkflowHostUri = "http://workflow.sharepoint.contoso.com" + SPSiteUrl = "http://sites.sharepoint.com" + AllowOAuthHttp = $true + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Examples/Resources/SPWorkflowService/2-RegisterWorkflowService.ps1 b/SharePointDsc/Examples/Resources/SPWorkflowService/2-RegisterWorkflowService.ps1 index fafd827c2..ea1922135 100644 --- a/SharePointDsc/Examples/Resources/SPWorkflowService/2-RegisterWorkflowService.ps1 +++ b/SharePointDsc/Examples/Resources/SPWorkflowService/2-RegisterWorkflowService.ps1 @@ -39,23 +39,26 @@ Updated author, copyright notice, and URLs. #> - Configuration Example +Configuration Example +{ + param + ( + [Parameter(Mandatory = $true)] + [PSCredential] + $SetupAccount + ) + + Import-DscResource -ModuleName SharePointDsc + + node localhost { - param( - [Parameter(Mandatory = $true)] - [PSCredential] - $SetupAccount - ) - Import-DscResource -ModuleName SharePointDsc - - node localhost { - SPWorkflowService WorkflowService - { - WorkflowHostUri = "http://workflow.sharepoint.contoso.com" - ScopeName = "SharePointWorkflow" - SPSiteUrl = "http://sites.sharepoint.com" - AllowOAuthHttp = $true - PsDscRunAsCredential = $SetupAccount - } + SPWorkflowService WorkflowService + { + WorkflowHostUri = "http://workflow.sharepoint.contoso.com" + ScopeName = "SharePointWorkflow" + SPSiteUrl = "http://sites.sharepoint.com" + AllowOAuthHttp = $true + PsDscRunAsCredential = $SetupAccount } } +} diff --git a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 index 242d0d49b..bec263d31 100644 --- a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 +++ b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 @@ -1697,7 +1697,8 @@ function Export-SPDscDiagnosticData ) Write-Host 'Exporting logging information' -ForegroundColor Yellow - if (([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator") -eq $false) + $currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) + if ($currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) -eq $false) { Write-Host -Object "[ERROR] You need to run this cmdlet with Administrator privileges!" -ForegroundColor Red return diff --git a/tests/Unit/SharePointDsc/SharePointDsc.Util.Tests.ps1 b/tests/Unit/SharePointDsc/SharePointDsc.Util.Tests.ps1 index 348639d5f..2c01d6607 100644 --- a/tests/Unit/SharePointDsc/SharePointDsc.Util.Tests.ps1 +++ b/tests/Unit/SharePointDsc/SharePointDsc.Util.Tests.ps1 @@ -15,10 +15,12 @@ $script:projectPath = "$PSScriptRoot\..\..\.." | Convert-Path $script:projectName = (Get-ChildItem -Path "$script:projectPath\*\*.psd1" | Where-Object -FilterScript { ($_.Directory.Name -match 'source|src' -or $_.Directory.Name -eq $_.BaseName) -and $(try - { Test-ModuleManifest -Path $_.FullName -ErrorAction Stop + { + Test-ModuleManifest -Path $_.FullName -ErrorAction Stop } catch - { $false + { + $false }) }).BaseName @@ -66,7 +68,7 @@ try InModuleScope -ModuleName $Global:SPDscHelper.ModuleName -ScriptBlock { Describe -Name $Global:SPDscHelper.DescribeHeader -Fixture { BeforeAll { - Invoke-Command -ScriptBlock $Global:SPDscHelper.InitializeScript -NoNewScope + Invoke-Command -Scriptblock $Global:SPDscHelper.InitializeScript -NoNewScope Mock -CommandName Add-SPDscEvent -MockWith {} } @@ -295,7 +297,7 @@ try PropertiesToLoad = (New-Object -TypeName "System.Collections.Generic.List[System.String]") } $searcher = $searcher | Add-Member -MemberType ScriptMethod ` - -name FindOne ` + -Name FindOne ` -Value { return $null } -PassThru -Force @@ -381,6 +383,118 @@ try Convert-SPDscADGroupIDToName -GroupId (New-Guid) | Should -Not -BeNullOrEmpty } } + + Context -Name "Validate Export-SPDscDiagnosticData" -Fixture { + BeforeAll { + Mock -CommandName "New-Object" ` + -ParameterFilter { + $TypeName -eq "Security.Principal.WindowsPrincipal" + } -MockWith { + $returnval = "Test" + $returnval = $returnval | Add-Member -MemberType ScriptMethod ` + -Name IsInRole ` + -Value { + return $true + } -PassThru -Force + + return $returnval + } + + Mock -CommandName Write-Host -MockWith {} + + Mock -CommandName Copy-Item -MockWith { + Set-Content -Path (Join-Path -Path $Destination -ChildPath "test.json") -Value @" +URL = http://sharepoint.contoso.com" +Server = SERVER1 +"@ + } + + Mock -CommandName Get-EventLog -MockWith { + $returnval = @() + $returnval += [pscustomobject]@{ + Index = 10202 + EntryType = 'Error' + InstanceId = 1 + Message = 'Message' + Category = '(1)' + CategoryNumber = 1 + MachineName = 'SERVER1' + Source = 'MSFT_SPWorkManagementServiceApp' + TimeGenerated = Get-Date + TimeWritten = Get-Date + UserName = "" + } + $returnval += [pscustomobject]@{ + Index = 10201 + EntryType = 'Warning' + InstanceId = 1 + Message = 'Message' + Category = '(1)' + CategoryNumber = 1 + MachineName = 'SERVER1' + Source = 'MSFT_SPWorkManagementServiceApp' + TimeGenerated = Get-Date + TimeWritten = Get-Date + UserName = "" + } + return $returnval + } + + Mock -CommandName Get-ComputerInfo -MockWith { + return @" + OsName : Microsoft Windows 10 Enterprise + OsOperatingSystemSKU : EnterpriseEdition + OsArchitecture : 64-bit + WindowsVersion : 2009 + WindowsBuildLabEx : 19041.1.amd64fre.vb_release.191206-1406 + OsLanguage : en-US + OsMuiLanguages : {en-US, en-GB, nl-NL} +"@ + } + + Mock -CommandName Get-DscLocalConfigurationManager -MockWith { + return @" +ActionAfterReboot : ContinueConfiguration +AgentId : 43C51C89-F9FA-11EA-94E5-2816A80571C0 +AllowModuleOverWrite : False +CertificateID : +ConfigurationDownloadManagers : {} +ConfigurationID : +ConfigurationMode : ApplyAndMonitor +ConfigurationModeFrequencyMins : 15 +Credential : +DebugMode : {} +DownloadManagerCustomData : +DownloadManagerName : +LCMCompatibleVersions : {1.0, 2.0} +LCMState : Idle +LCMStateDetail : +LCMVersion : 2.0 +StatusRetentionTimeInDays : 10 +SignatureValidationPolicy : NONE +SignatureValidations : {} +MaximumDownloadSizeMB : 500 +PartialConfigurations : +RebootNodeIfNeeded : False +RefreshFrequencyMins : 30 +RefreshMode : PUSH +ReportManagers : {} +ResourceModuleManagers : {} +PSComputerName : +"@ + } + + Mock -CommandName Compress-Archive -MockWith {} + } + + It "should export and anonymize diagnostic data" { + Export-SPDscDiagnosticData -ExportFilePath 'C:\Temp\SPDsc.zip' -Anonymize -Server 'SERVER1' -Domain 'CONTOSO' -URL 'contoso.com' + Assert-MockCalled -CommandName Get-EventLog -Times 1 + Assert-MockCalled -CommandName Get-ComputerInfo -Times 1 + Assert-MockCalled -CommandName Get-DscLocalConfigurationManager -Times 1 + Assert-MockCalled -CommandName Compress-Archive -Times 1 + } + } } } } From f74bc2cdbdead50da76711f9cfa4b4d294716e8a Mon Sep 17 00:00:00 2001 From: Yorick Kuijs Date: Thu, 4 Mar 2021 14:03:32 +0100 Subject: [PATCH 04/14] Catching missing permissions properly in three resources --- CHANGELOG.md | 204 ++---------------- HISTORIC_CHANGELOG.md | 182 ++++++++++++++++ .../MSFT_SPFarmAdministrators.psm1 | 29 ++- .../MSFT_SPManagedMetaDataServiceApp.psm1 | 23 +- .../DSCResources/MSFT_SPSite/MSFT_SPSite.psm1 | 20 +- 5 files changed, 262 insertions(+), 196 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e244d77a..6036d46b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,16 +5,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- Export-SPDscDiagnosticData cmdlet to create a diagnostic package which can + easily be shared for troubleshooting + +### Changed + +- SPFarmAdministrators + - Added check to see if a central admin site is returned and stop if it isn't +- SPManagedMetaDataServiceApp + - Added check to see if a central admin site is returned and stop if it isn't +- SPSite + - Added check to see if a central admin site is returned and stop if it isn't + +### Fixed + +- SPSearchResultSource + - Clarified the use of ScopeName and ScopeUrl with SSA as ScopeName and added examples + ## [4.5.1] - 2021-02-05 ### Fixed - SharePointDsc - Fixed regression in v4.5 - - Added Export-SPDscDiagnosticData cmdlet to create a diagnostic package which can - easily be shared for troubleshooting -- SPSearchResultSource - - Clarified the use of ScopeName and ScopeUrl with SSA as ScopeName and added examples ## [4.5.0] - 2021-01-30 @@ -164,186 +178,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - SPWeb - Fixed issue with incorrect detection of SPWeb that has to be absent -## [4.2.0] - 2020-06-12 - -### Fixed - -- SharePointDsc - - Renamed custom event log to SPDsc to prevent event log naming issue. - -## [4.1.0] - 2020-06-10 - -### Added - -- SharePointDsc - - Added Wiki generation to build task - - Re-enabled Unit tests for Sharepoint 2016 and 2019 -- SPAppCatalog - - Added more logging in the Get method to ease troubleshooting -- SPServiceInstance - - Added logic to wait for a service start/stop, to make sure no conflicts - can occur because of the asynchronous nature of service instance starts. - -### Changed - -- SPProductUpdate - - Updated Get method to display a Verbose message when the setup file is - not found -- SPWebAppPermissions - - Changed Get method not to throw an exception when the web application - cannot be found to prevent issue -- SPWebAppSuiteBar - - This resource does not work on SharePoint 2019. Changed resource to display - a Verbose message when on 2019 - -### Fixed - -- SharePointDsc - - Fixed an issue where Test-SPDscParameterState would throw an error due to duplicate - keys when a desired value is of type CimInstance[] and multiple values - are specified. - - Fixed issue with logging to the custom event log where the event log - wasn't created correctly. - - Fixed various unit tests for Sharepoint 2016 and 2019 - - Corrected export of Get-SPDscInstalledProductVersion function, which is used - by ReverseDsc -- SPConfigWizard - - Fixed a call to Get-SPFarm without loading the snap-in first -- SPInstallLanguagePack - - Fixed issue with detection of Chinese language pack in SharePoint 2019 -- SPSearchTopology - - Fixed issue where an issue was thrown when the FirstPartitionDirectory didn't - exist on the local server (which isn't always required) -- SPSite - - Fixed issue where the default groups were checked, even though - that parameter wasn't specified in the config - - Fixed issue where the Get method threw an error when the site owner was - still in classic format (caused by an earlier migration). -- SPTrustedSecurityTokenIssuer - - Fixed incorrect storing the default value of IsTrustBroker in the Set - and Test method - -### Removed - -- SharePointDsc - - Removed returning the InstallAccount parameter from all Get methods. - These are not used and only add noise during troubleshooting - -## [4.0.0] - 2020-04-28 - -### Added - -- SharePointDsc - - Added verbose logging of the test results in the Test method - - Added function to create SharePointDsc event log and add log entries - - Added the logging of all test results to the new SharePointDsc event log - - Added support in several resources for creating/connecting to farm - and service applications using a (single) SQL-based credential - instead of the default Windows credentials. Needed when e.g. using - Azure SQL Managed Instance as SharePoint's database server. - UseSQLAuthentication and DatabaseCredentials parameters will need - to be considered. - -### Changed - -- SPTrustedRootAuthority - - It's now possible to specify both CertificateFilePath and CertificateThumbprint - so that the certificate thumbprint can be verified before importing. -- SPTrustedSecurityTokenIssuer - - It's now possible to specify both SigningCertificateFilePath and - SigningCertificateThumbprint so that the certificate thumbprint can be verified - before importing. - -The following changes will break v3.x and earlier configurations that use these -resources: - -- SPManagedMetaDataServiceAppDefault - - Updated resource to allow the configuration of default per service application - proxy groups instead of per farm -- SPSearchContentSource - - Discontinued CrawlEverything, CrawlFirstOnly and null as allowable CrawlSetting - values for a SharePoint based content source, requiring CrawlVirtualServers or - CrawlSites -- SPUserProfileServiceApp - - Changed the MySiteHostLocation parameter to a required parameter -- SPWebAppAuthentication - - Updated resource to add support for Basic Authentication - -### Fixed - -- SPFarmSolution - - Corrected bug running Solution Job wait for an Absent solution. - - Corrected bug trying to remove an already Absent solution. -- SPSearchAuthoritativePage - - Corrected bug when checking for an existing Demoted Action -- SPWebAppAuthentication - - Updated to support passing of null/empty collections for zones not utilized. - -### Removed - -The following changes will break v3.x and earlier configurations that use these -resources: - -- SPSearchServiceApp - - Removed the WindowsServiceAccount parameter that was depricated in v3.1 -- SPUserProfileSyncService - - Removed the FarmAccount parameter that was depricated in v2.2 - -## [3.8.0] - 2020-02-27 - -### Added - -- SharePointDsc - - Added automatic release with a new CI pipeline - - Updated PULL_REQUEST_TEMPLATE.md to match DSC standard - - Prepared Conceptual Help and Wiki Content generation -- SPAzureAccessControlServiceAppProxy - - Added new resource to create Azure Access Control Service Application Proxy -- SPExcelServiceApp - - Documentation update for SharePoint 2016/2019 deprecation. -- SPInstallPrereqs - - Documentation update for SharePoint 2019 offline install parameters. -- SPFarm - - Added possibility to set application credential key. -- SPOAppPrincipalMgmtServiceAppProxy - - Added new resource to create SharePoint Online Application Principal - Management Service Application Proxy -- SPTrustedSecurityTokenIssuer - - Fixed RegisteredIssuerNameRealm not applied if specified. -- SPUserProfileProperty - - Added IsReplicable property. - -### Changed - -- SharePointDsc - - Updated all resources and Invoke-SPDscCommand function to automatically - load Utils module, which broke with the new CI - - Extended Convert-SPDscHashtableToString function to support complex types - in arrays and the CIMInstance type -- SPConfigWizard - - Updated checks in Set method to make sure the resource also runs when - a language pack is installed -- SPContentDatabase - - Updated DatabaseServer parameter to support null value -- SPSearchIndexPartition - - Updated documentation to specifically mention that each index partition - requires its own dedicated RootDirectory -- SPUserProfileServiceApp - - Implemented ability to fix incorrectly linked proxy groups -- SPWebApplicationExtension - - Forced the conversion of Paths to string - -### Fixed - -- SharePointDsc - - Corrected schema.mof files of SPSubscriptionSettingServiceApp and - SPPasswordChangeSettings resources, which caused failed Wiki generation -- SPSearchContentSource - - Add CrawlVirtualServers and CrawlSites CrawlSetting for SharePoint content - sources. -- SPSubscriptionSettingServiceApp - - Corrected incorrect information in Readme file -- SPUserProfileProperty - - Fixed typo in user profile property test for IsSearchable. - For older change log history see the [historic changelog](HISTORIC_CHANGELOG.md). diff --git a/HISTORIC_CHANGELOG.md b/HISTORIC_CHANGELOG.md index 184611328..4cf201da4 100644 --- a/HISTORIC_CHANGELOG.md +++ b/HISTORIC_CHANGELOG.md @@ -1,5 +1,187 @@ # Historic change log for SharePointDsc +## [4.2.0] - 2020-06-12 + +### Fixed + +- SharePointDsc + - Renamed custom event log to SPDsc to prevent event log naming issue. + +## [4.1.0] - 2020-06-10 + +### Added + +- SharePointDsc + - Added Wiki generation to build task + - Re-enabled Unit tests for Sharepoint 2016 and 2019 +- SPAppCatalog + - Added more logging in the Get method to ease troubleshooting +- SPServiceInstance + - Added logic to wait for a service start/stop, to make sure no conflicts + can occur because of the asynchronous nature of service instance starts. + +### Changed + +- SPProductUpdate + - Updated Get method to display a Verbose message when the setup file is + not found +- SPWebAppPermissions + - Changed Get method not to throw an exception when the web application + cannot be found to prevent issue +- SPWebAppSuiteBar + - This resource does not work on SharePoint 2019. Changed resource to display + a Verbose message when on 2019 + +### Fixed + +- SharePointDsc + - Fixed an issue where Test-SPDscParameterState would throw an error due to duplicate + keys when a desired value is of type CimInstance[] and multiple values + are specified. + - Fixed issue with logging to the custom event log where the event log + wasn't created correctly. + - Fixed various unit tests for Sharepoint 2016 and 2019 + - Corrected export of Get-SPDscInstalledProductVersion function, which is used + by ReverseDsc +- SPConfigWizard + - Fixed a call to Get-SPFarm without loading the snap-in first +- SPInstallLanguagePack + - Fixed issue with detection of Chinese language pack in SharePoint 2019 +- SPSearchTopology + - Fixed issue where an issue was thrown when the FirstPartitionDirectory didn't + exist on the local server (which isn't always required) +- SPSite + - Fixed issue where the default groups were checked, even though + that parameter wasn't specified in the config + - Fixed issue where the Get method threw an error when the site owner was + still in classic format (caused by an earlier migration). +- SPTrustedSecurityTokenIssuer + - Fixed incorrect storing the default value of IsTrustBroker in the Set + and Test method + +### Removed + +- SharePointDsc + - Removed returning the InstallAccount parameter from all Get methods. + These are not used and only add noise during troubleshooting + +## [4.0.0] - 2020-04-28 + +### Added + +- SharePointDsc + - Added verbose logging of the test results in the Test method + - Added function to create SharePointDsc event log and add log entries + - Added the logging of all test results to the new SharePointDsc event log + - Added support in several resources for creating/connecting to farm + and service applications using a (single) SQL-based credential + instead of the default Windows credentials. Needed when e.g. using + Azure SQL Managed Instance as SharePoint's database server. + UseSQLAuthentication and DatabaseCredentials parameters will need + to be considered. + +### Changed + +- SPTrustedRootAuthority + - It's now possible to specify both CertificateFilePath and CertificateThumbprint + so that the certificate thumbprint can be verified before importing. +- SPTrustedSecurityTokenIssuer + - It's now possible to specify both SigningCertificateFilePath and + SigningCertificateThumbprint so that the certificate thumbprint can be verified + before importing. + +The following changes will break v3.x and earlier configurations that use these +resources: + +- SPManagedMetaDataServiceAppDefault + - Updated resource to allow the configuration of default per service application + proxy groups instead of per farm +- SPSearchContentSource + - Discontinued CrawlEverything, CrawlFirstOnly and null as allowable CrawlSetting + values for a SharePoint based content source, requiring CrawlVirtualServers or + CrawlSites +- SPUserProfileServiceApp + - Changed the MySiteHostLocation parameter to a required parameter +- SPWebAppAuthentication + - Updated resource to add support for Basic Authentication + +### Fixed + +- SPFarmSolution + - Corrected bug running Solution Job wait for an Absent solution. + - Corrected bug trying to remove an already Absent solution. +- SPSearchAuthoritativePage + - Corrected bug when checking for an existing Demoted Action +- SPWebAppAuthentication + - Updated to support passing of null/empty collections for zones not utilized. + +### Removed + +The following changes will break v3.x and earlier configurations that use these +resources: + +- SPSearchServiceApp + - Removed the WindowsServiceAccount parameter that was depricated in v3.1 +- SPUserProfileSyncService + - Removed the FarmAccount parameter that was depricated in v2.2 + +## [3.8.0] - 2020-02-27 + +### Added + +- SharePointDsc + - Added automatic release with a new CI pipeline + - Updated PULL_REQUEST_TEMPLATE.md to match DSC standard + - Prepared Conceptual Help and Wiki Content generation +- SPAzureAccessControlServiceAppProxy + - Added new resource to create Azure Access Control Service Application Proxy +- SPExcelServiceApp + - Documentation update for SharePoint 2016/2019 deprecation. +- SPInstallPrereqs + - Documentation update for SharePoint 2019 offline install parameters. +- SPFarm + - Added possibility to set application credential key. +- SPOAppPrincipalMgmtServiceAppProxy + - Added new resource to create SharePoint Online Application Principal + Management Service Application Proxy +- SPTrustedSecurityTokenIssuer + - Fixed RegisteredIssuerNameRealm not applied if specified. +- SPUserProfileProperty + - Added IsReplicable property. + +### Changed + +- SharePointDsc + - Updated all resources and Invoke-SPDscCommand function to automatically + load Utils module, which broke with the new CI + - Extended Convert-SPDscHashtableToString function to support complex types + in arrays and the CIMInstance type +- SPConfigWizard + - Updated checks in Set method to make sure the resource also runs when + a language pack is installed +- SPContentDatabase + - Updated DatabaseServer parameter to support null value +- SPSearchIndexPartition + - Updated documentation to specifically mention that each index partition + requires its own dedicated RootDirectory +- SPUserProfileServiceApp + - Implemented ability to fix incorrectly linked proxy groups +- SPWebApplicationExtension + - Forced the conversion of Paths to string + +### Fixed + +- SharePointDsc + - Corrected schema.mof files of SPSubscriptionSettingServiceApp and + SPPasswordChangeSettings resources, which caused failed Wiki generation +- SPSearchContentSource + - Add CrawlVirtualServers and CrawlSites CrawlSetting for SharePoint content + sources. +- SPSubscriptionSettingServiceApp + - Corrected incorrect information in Readme file +- SPUserProfileProperty + - Fixed typo in user profile property test for IsSearchable. + ## [3.7.0.0] - 2019-10-30 ### Fixed diff --git a/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.psm1 b/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.psm1 index a3d100a29..6af8b8b04 100644 --- a/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPFarmAdministrators/MSFT_SPFarmAdministrators.psm1 @@ -72,10 +72,18 @@ function Get-TargetResource if ($null -eq $caWebapp) { - Write-Verbose "Unable to locate central administration website" + Write-Verbose "Unable to locate central administration web application" return $nullReturn } - $caWeb = Get-SPWeb($caWebapp.Url) + + $caWeb = Get-SPWeb -Identity $caWebapp.Url -ErrorAction SilentlyContinue + + if ($null -eq $caWeb) + { + Write-Verbose "Unable to locate central administration site" + return $nullReturn + } + $farmAdminGroup = $caWeb.AssociatedOwnerGroup $farmAdministratorsGroup = $caWeb.SiteGroups.GetByName($farmAdminGroup) @@ -423,16 +431,29 @@ function Merge-SPDscFarmAdminList $caWebapp = $webApps | Where-Object -FilterScript { $_.IsAdministrationWebApplication } + if ($null -eq $caWebapp) { - $message = "Unable to locate central administration website" + $message = "Unable to locate central administration application" Add-SPDscEvent -Message $message ` -EntryType 'Error' ` -EventID 100 ` -Source $eventSource throw $message } - $caWeb = Get-SPWeb($caWebapp.Url) + + $caWeb = Get-SPWeb -Identity $caWebapp.Url -ErrorAction SilentlyContinue + + if ($null -eq $caWeb) + { + $message = "Unable to locate central administration site" + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $eventSource + throw $message + } + $farmAdminGroup = $caWeb.AssociatedOwnerGroup if ($changeUsers.ContainsKey("Add")) diff --git a/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.psm1 index dd5571a57..31c92b4bd 100644 --- a/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPManagedMetadataServiceApp/MSFT_SPManagedMetaDataServiceApp.psm1 @@ -77,8 +77,6 @@ function Get-TargetResource $params = $args[0] $eventSource = $args[1] - $serviceApps = Get-SPServiceApplication -Name $params.Name ` - -ErrorAction SilentlyContinue $nullReturn = @{ Name = $params.Name Ensure = "Absent" @@ -86,6 +84,9 @@ function Get-TargetResource TermStoreAdministrators = @() } + $serviceApps = Get-SPServiceApplication -Name $params.Name ` + -ErrorAction SilentlyContinue + if ($null -eq $serviceApps) { return $nullReturn @@ -200,6 +201,13 @@ function Get-TargetResource | Where-Object -FilterScript { $_.IsAdministrationWebApplication -eq $true } + + if ($null -eq $centralAdminSite) + { + Write-Verbose "Unable to locate central administration web application" + return $nullReturn + } + $session = Get-SPTaxonomySession -Site $centralAdminSite.Url $currentAdmins = @() @@ -488,6 +496,17 @@ function Set-TargetResource | Where-Object -FilterScript { $_.IsAdministrationWebApplication -eq $true } + + if ($null -eq $centralAdminSite) + { + $message = "Unable to locate central administration web application" + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $eventSource + throw $message + } + $session = Get-SPTaxonomySession -Site $centralAdminSite.Url $termStore = $session.TermStores[$pName] diff --git a/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.psm1 b/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.psm1 index 12e03e317..5cae6b8ef 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSite/MSFT_SPSite.psm1 @@ -84,7 +84,7 @@ function Get-TargetResource try { $centralAdminWebApp = [Microsoft.SharePoint.Administration.SPAdministrationWebApplication]::Local - $centralAdminSite = Get-SPSite -Identity $centralAdminWebApp.Url + $centralAdminSite = Get-SPSite -Identity $centralAdminWebApp.Url -ErrorAction Stop $site = New-Object "Microsoft.SharePoint.SPSite" -ArgumentList @($params.Url, $centralAdminSite.SystemAccount.UserToken) } @@ -281,10 +281,11 @@ function Set-TargetResource $CurrentValues = Get-TargetResource @PSBoundParameters $null = Invoke-SPDscCommand -Credential $InstallAccount ` - -Arguments @($PSBoundParameters, $CurrentValues) ` + -Arguments @($PSBoundParameters, $MyInvocation.MyCommand.Source, $CurrentValues) ` -ScriptBlock { $params = $args[0] - $CurrentValues = $args[1] + $eventSource = $args[1] + $CurrentValues = $args[2] $doCreateDefaultGroups = $false $params.Remove("InstallAccount") | Out-Null @@ -325,7 +326,18 @@ function Set-TargetResource } $centralAdminWebApp = [Microsoft.SharePoint.Administration.SPAdministrationWebApplication]::Local - $centralAdminSite = Get-SPSite -Identity $centralAdminWebApp.Url + $centralAdminSite = Get-SPSite -Identity $centralAdminWebApp.Url -ErrorAction SilentlyContinue + + if ($null -eq $centralAdminSite) + { + $message = "Unable to locate central administration site" + Add-SPDscEvent -Message $message ` + -EntryType 'Error' ` + -EventID 100 ` + -Source $eventSource + throw $message + } + $systemAccountSite = New-Object "Microsoft.SharePoint.SPSite" -ArgumentList @($site.Id, $centralAdminSite.SystemAccount.UserToken) if ($params.OwnerAlias -ne $CurrentValues.OwnerAlias) From b18c73a4ca488a53ad1ba3195000c24514d6ce81 Mon Sep 17 00:00:00 2001 From: Yorick Kuijs Date: Fri, 5 Mar 2021 11:18:42 +0100 Subject: [PATCH 05/14] Fixed #1293, #1294 and ReverseDsc improvements --- CHANGELOG.md | 21 ++++++++- .../MSFT_SPUserProfileServiceApp.psm1 | 9 +++- .../MSFT_SPWordAutomationServiceApp.psm1 | 22 ++++++++- .../SharePointDsc.Reverse.psm1 | 46 +++++++++++++------ .../SharePointDsc.Util.psd1 | 4 +- .../SharePointDsc.Util.psm1 | 17 ++++++- SharePointDsc/SharePointDsc.psd1 | 16 +++---- 7 files changed, 105 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6036d46b3..79867b6ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added -- Export-SPDscDiagnosticData cmdlet to create a diagnostic package which can +- SharePointDsc + - Export-SPDscDiagnosticData cmdlet to create a diagnostic package which can easily be shared for troubleshooting +- ReverseDsc + - Added a check in Export-SPConfiguration/Start-SharePointDSCExtract to check if + ReverseDsc is present or not. Show instructions if it isn't + - Added DocIcon to export GUI + - Renamed export cmdlet to Export-SPConfiguration, to match Microsoft365DSC naming. + Added old Start-SharePointDSCExtract as alias ### Changed @@ -22,6 +29,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - SPSearchResultSource - Clarified the use of ScopeName and ScopeUrl with SSA as ScopeName and added examples +- SPUserProfileServiceApp + - Fixed issue where MySiteHostLocation was return from Get method including port number, + which causes the Test method to fail +- SPWordAutomation + - Fixed issue where the resource never went into desired state when using AddToDefault + +### Removed + +### Added +- SharePointDsc + - Removed the ReverseDsc dependency for the SharePointDsc module since the module + is only required when performing an export ## [4.5.1] - 2021-02-05 diff --git a/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 index 706ffbc94..c37ba0662 100644 --- a/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPUserProfileServiceApp/MSFT_SPUserProfileServiceApp.psm1 @@ -229,7 +229,7 @@ function Get-TargetResource $caSite = $ca.Sites[0] $serviceContext = Get-SPServiceContext($caSite) $userProfileManager = New-Object Microsoft.Office.Server.UserProfiles.UserProfileManager($serviceContext) - $upMySiteLocation = $userProfileManager.MySiteHostUrl + $upMySiteLocation = [System.Uri]$userProfileManager.MySiteHostUrl $upMySiteManagedPath = $userProfileManager.PersonalSiteInclusion $upSiteConflictNaming = $userProfileManager.PersonalSiteFormat } @@ -247,7 +247,7 @@ function Get-TargetResource Name = $serviceApp.DisplayName ProxyName = $proxyName ApplicationPool = $serviceApp.ApplicationPool.Name - MySiteHostLocation = $upMySiteLocation + MySiteHostLocation = $upMySiteLocation.AbsoluteUri.TrimEnd("/") MySiteManagedPath = $upMySiteManagedPath ProfileDBName = $databases.ProfileDatabase.Name ProfileDBServer = $databases.ProfileDatabase.NormalizedDataSource @@ -749,6 +749,11 @@ function Test-TargetResource $PSBoundParameters.Ensure = $Ensure $PSBoundParameters.UpdateProxyGroup = $UpdateProxyGroup + if ($PSBoundParameters.ContainsKey("MySiteHostLocation") -eq $true) + { + $PSBoundParameters.MySiteHostLocation = ([System.Uri]$MySiteHostLocation).AbsoluteUri.TrimEnd('/') + } + $CurrentValues = Get-TargetResource @PSBoundParameters Write-Verbose -Message "Current Values: $(Convert-SPDscHashtableToString -Hashtable $CurrentValues)" diff --git a/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.psm1 b/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.psm1 index c7122f944..f1f953e40 100644 --- a/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPWordAutomationServiceApp/MSFT_SPWordAutomationServiceApp.psm1 @@ -769,7 +769,27 @@ function Test-TargetResource $result = Test-SPDscParameterState -CurrentValues $CurrentValues ` -Source $($MyInvocation.MyCommand.Source) ` - -DesiredValues $PSBoundParameters + -DesiredValues $PSBoundParameters ` + -ValuesToCheck @( + "ApplicationPool", + "ConversionProcesses", + "DatabaseCredentials", + "DatabaseName", + "DatabaseServer", + "DisableBinaryFileScan", + "DisableEmbeddedFonts", + "Ensure", + "JobConversionFrequency", + "KeepAliveTimeout", + "MaximumConversionAttempts", + "MaximumConversionTime", + "MaximumMemoryUsage", + "MaximumSyncConversionRequests", + "NumberOfConversionsPerProcess", + "RecycleThreshold", + "SupportedFileFormats", + "TimeBeforeConversionIsMonitored", + "UseSQLAuthentication") Write-Verbose -Message "Test-TargetResource returned $result" diff --git a/SharePointDsc/Modules/SharePointDsc.Reverse/SharePointDsc.Reverse.psm1 b/SharePointDsc/Modules/SharePointDsc.Reverse/SharePointDsc.Reverse.psm1 index 41d13720b..4ca9a448e 100644 --- a/SharePointDsc/Modules/SharePointDsc.Reverse/SharePointDsc.Reverse.psm1 +++ b/SharePointDsc/Modules/SharePointDsc.Reverse/SharePointDsc.Reverse.psm1 @@ -448,6 +448,12 @@ function Orchestrator Write-Host -Object "[$($spServer.Name)] Scanning Distributed Cache Settings(s)..." -BackgroundColor DarkGreen -ForegroundColor White $Script:dscConfigContent += Read-TargetResource -ResourceName 'SPDistributedCacheService' + if ($Global:ExtractionModeValue -ge 2) + { + Write-Host -Object "[$($spServer.Name)] Scanning Doc Icon(s)..." -BackgroundColor DarkGreen -ForegroundColor White + $Script:dscConfigContent += Read-TargetResource -ResourceName 'SPDocIcon' + } + Write-Host -Object "[$($spServer.Name)] Scanning Excel Services Application Settings(s)..." -BackgroundColor DarkGreen -ForegroundColor White $Script:dscConfigContent += Read-TargetResource -ResourceName 'SPExcelServiceApp' @@ -1707,8 +1713,16 @@ function DisplayGUI() $chckDistributedCache.Text = "Distributed Cache Service" $panelConfig.Controls.Add($chckDistributedCache); + $chckDocIcon = New-Object System.Windows.Forms.CheckBox + $chckDocIcon.Top = 120 + $chckDocIcon.AutoSize = $true; + $chckDocIcon.Name = "SPDocIcon" + $chckDocIcon.Checked = $true + $chckDocIcon.Text = "Doc Icons" + $panelConfig.Controls.Add($chckDocIcon); + $chckFarmConfig = New-Object System.Windows.Forms.CheckBox - $chckFarmConfig.Top = 120 + $chckFarmConfig.Top = 140 $chckFarmConfig.AutoSize = $true; $chckFarmConfig.Name = "SPFarm" $chckFarmConfig.Checked = $true @@ -1716,7 +1730,7 @@ function DisplayGUI() $panelConfig.Controls.Add($chckFarmConfig); $chckFarmPropBag = New-Object System.Windows.Forms.CheckBox - $chckFarmPropBag.Top = 140 + $chckFarmPropBag.Top = 160 $chckFarmPropBag.AutoSize = $true; $chckFarmPropBag.Name = "SPFarmPropertyBag" $chckFarmPropBag.Checked = $true @@ -1724,7 +1738,7 @@ function DisplayGUI() $panelConfig.Controls.Add($chckFarmPropBag); $chckFeature = New-Object System.Windows.Forms.CheckBox - $chckFeature.Top = 160 + $chckFeature.Top = 180 $chckFeature.AutoSize = $true; $chckFeature.Name = "SPFeature" $chckFeature.Checked = $false @@ -1732,7 +1746,7 @@ function DisplayGUI() $panelConfig.Controls.Add($chckFeature); $chckHealth = New-Object System.Windows.Forms.CheckBox - $chckHealth.Top = 180 + $chckHealth.Top = 200 $chckHealth.AutoSize = $true; $chckHealth.Name = "SPHealthAnalyzerRuleState" $chckHealth.Checked = $false @@ -1740,7 +1754,7 @@ function DisplayGUI() $panelConfig.Controls.Add($chckHealth); $chckIRM = New-Object System.Windows.Forms.CheckBox - $chckIRM.Top = 200 + $chckIRM.Top = 220 $chckIRM.AutoSize = $true; $chckIRM.Name = "SPIrmSettings" $chckIRM.Checked = $true @@ -1748,7 +1762,7 @@ function DisplayGUI() $panelConfig.Controls.Add($chckIRM); $chckManagedPaths = New-Object System.Windows.Forms.CheckBox - $chckManagedPaths.Top = 220 + $chckManagedPaths.Top = 240 $chckManagedPaths.AutoSize = $true; $chckManagedPaths.Name = "SPManagedPath" $chckManagedPaths.Checked = $true @@ -1756,7 +1770,7 @@ function DisplayGUI() $panelConfig.Controls.Add($chckManagedPaths); $chckOOS = New-Object System.Windows.Forms.CheckBox - $chckOOS.Top = 240 + $chckOOS.Top = 260 $chckOOS.AutoSize = $true; $chckOOS.Name = "SPOfficeOnlineServerBinding" $chckOOS.Checked = $true @@ -1764,7 +1778,7 @@ function DisplayGUI() $panelConfig.Controls.Add($chckOOS); $chckOutgoingEmail = New-Object System.Windows.Forms.CheckBox - $chckOutgoingEmail.Top = 260 + $chckOutgoingEmail.Top = 280 $chckOutgoingEmail.AutoSize = $true; $chckOutgoingEmail.Name = "SPOutgoingEmailSettings" $chckOutgoingEmail.Checked = $true @@ -1772,7 +1786,7 @@ function DisplayGUI() $panelConfig.Controls.Add($chckOutgoingEmail); $chckServiceAppPool = New-Object System.Windows.Forms.CheckBox - $chckServiceAppPool.Top = 280 + $chckServiceAppPool.Top = 300 $chckServiceAppPool.AutoSize = $true; $chckServiceAppPool.Name = "SPServiceAppPool" $chckServiceAppPool.Checked = $true @@ -1780,7 +1794,7 @@ function DisplayGUI() $panelConfig.Controls.Add($chckServiceAppPool); $chckServiceInstance = New-Object System.Windows.Forms.CheckBox - $chckServiceInstance.Top = 300 + $chckServiceInstance.Top = 320 $chckServiceInstance.AutoSize = $true; $chckServiceInstance.Name = "SPServiceInstance" $chckServiceInstance.Checked = $true @@ -1788,7 +1802,7 @@ function DisplayGUI() $panelConfig.Controls.Add($chckServiceInstance); $chckSessionState = New-Object System.Windows.Forms.CheckBox - $chckSessionState.Top = 320 + $chckSessionState.Top = 340 $chckSessionState.AutoSize = $true; $chckSessionState.Name = "SPSessionStateService" $chckSessionState.Checked = $true @@ -1796,7 +1810,7 @@ function DisplayGUI() $panelConfig.Controls.Add($chckSessionState); $chckDatabaseAAG = New-Object System.Windows.Forms.CheckBox - $chckDatabaseAAG.Top = 340 + $chckDatabaseAAG.Top = 360 $chckDatabaseAAG.AutoSize = $true; $chckDatabaseAAG.Name = "SPDatabaseAAG" $chckDatabaseAAG.Checked = $false @@ -1804,7 +1818,7 @@ function DisplayGUI() $panelConfig.Controls.Add($chckDatabaseAAG); $chckTimerJob = New-Object System.Windows.Forms.CheckBox - $chckTimerJob.Top = 360 + $chckTimerJob.Top = 380 $chckTimerJob.AutoSize = $true; $chckTimerJob.Name = "SPTimerJobState" $chckTimerJob.Checked = $false @@ -1875,7 +1889,7 @@ function DisplayGUI() #region Extraction Modes $Global:liteComponents = @($chckSAAccess, $chckSAAccess2010, $chckAlternateURL, $chckAntivirus, $chckAppCatalog, $chckAppDomain, $chckSAAppMan, $chckAppStore, $chckSABCS, $chckBlobCache, $chckCacheAccounts, $chckContentDB, $chckDiagLogging, $chckDistributedCache, $chckSAExcel, $chckFarmConfig, $chckFarmAdmin, $chckFarmPropBag, $chckFarmSolution, $chckIRM, $chckSAMachine, $chckManagedAccount, $chckSAMMS, $chckManagedPaths, $chckOutgoingEmail, $chckSAPerformance, $chckSAPublish, $chckQuotaTemplates, $chckSearchContentSource, $chckSearchIndexPart, $chckSearchSA, $chckSearchTopo, $chckSASecureStore, $chckServiceAppPool, $chckWAProxyGroup, $chckServiceInstance, $chckSAState, $chckSiteCollection, $chckSessionState, $chckSASub, $chckUPSA, $chckSAVisio, $chckWebApp, $chckWebAppPerm, $chckWebAppPolicy, $chckSAWord, $chckSAWork, $chckSearchIndexPart, $chckWAAppDomain, $chckSessionState, $chckSAUsage) - $Global:defaultComponents = @($chckSAAccess, $chckSAAccess2010, $chckAlternateURL, $chckAntivirus, $chckAppCatalog, $chckAppDomain, $chckSAAppMan, $chckAppStore, $chckSABCS, $chckBlobCache, $chckCacheAccounts, $chckContentDB, $chckDiagLogging, $chckDistributedCache, $chckSAExcel, $chckFarmConfig, $chckFarmAdmin, $chckFarmPropBag, $chckFarmSolution, $chckIRM, $chckSAMachine, $chckManagedAccount, $chckSAMMS, $chckManagedPaths, $chckOutgoingEmail, $chckSAPerformance, $chckSAPublish, $chckQuotaTemplates, $chckSearchContentSource, $chckSearchIndexPart, $chckSearchSA, $chckSearchTopo, $chckSASecureStore, $chckServiceAppPool, $chckWAProxyGroup, $chckServiceInstance, $chckSAState, $chckSiteCollection, $chckSessionState, $chckSASub, $chckUPSA, $chckSAVisio, $chckWebApp, $chckWebAppPerm, $chckWebAppPolicy, $chckSAWord, $chckSAWork, $chckOOS, $chckPasswordChange, $chckRemoteTrust, $chckSearchCrawlerImpact, $chckSearchCrawlRule, $chckSearchResultSources, $chckSASecurity, $chckTrustedIdentity, $chckUPSPermissions, $chckUPSSync, $chckWABlockedFiles, $chckWAGeneral, $chckWAProxyGroup, $chckWADeletion, $chckWAThrottling, $chckWAWorkflow, $chckSearchIndexPart, $chckWAAppDomain, $chckWAExtension, $chckSessionState, $chckSAUsage) + $Global:defaultComponents = @($chckSAAccess, $chckSAAccess2010, $chckAlternateURL, $chckAntivirus, $chckAppCatalog, $chckAppDomain, $chckSAAppMan, $chckAppStore, $chckSABCS, $chckBlobCache, $chckCacheAccounts, $chckContentDB, $chckDiagLogging, $chckDistributedCache, $chckDocIcon, $chckSAExcel, $chckFarmConfig, $chckFarmAdmin, $chckFarmPropBag, $chckFarmSolution, $chckIRM, $chckSAMachine, $chckManagedAccount, $chckSAMMS, $chckManagedPaths, $chckOutgoingEmail, $chckSAPerformance, $chckSAPublish, $chckQuotaTemplates, $chckSearchContentSource, $chckSearchIndexPart, $chckSearchSA, $chckSearchTopo, $chckSASecureStore, $chckServiceAppPool, $chckWAProxyGroup, $chckServiceInstance, $chckSAState, $chckSiteCollection, $chckSessionState, $chckSASub, $chckUPSA, $chckSAVisio, $chckWebApp, $chckWebAppPerm, $chckWebAppPolicy, $chckSAWord, $chckSAWork, $chckOOS, $chckPasswordChange, $chckRemoteTrust, $chckSearchCrawlerImpact, $chckSearchCrawlRule, $chckSearchResultSources, $chckSASecurity, $chckTrustedIdentity, $chckUPSPermissions, $chckUPSSync, $chckWABlockedFiles, $chckWAGeneral, $chckWAProxyGroup, $chckWADeletion, $chckWAThrottling, $chckWAWorkflow, $chckSearchIndexPart, $chckWAAppDomain, $chckWAExtension, $chckSessionState, $chckSAUsage) #endregion #region Top Menu @@ -2034,9 +2048,11 @@ function DisplayGUI() $panelMain.Controls.Add($panelMenu); #endregion + $spDscModule = (Get-Module "SharePointDSC") + $panelMain.AutoScroll = $true $form.Controls.Add($panelMain) - $form.Text = "ReverseDSC for SharePoint - v" + $Script:version + $form.Text = "ReverseDSC for SharePoint - v" + $spDscModule.Version.ToString() $form.StartPosition = [System.Windows.Forms.FormStartPosition]::CenterScreen $form.ShowDialog() | Out-Null } diff --git a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psd1 b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psd1 index ed875413a..2d4486b2b 100644 --- a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psd1 +++ b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psd1 @@ -42,6 +42,7 @@ 'Convert-SPDscHashtableToString', 'ConvertTo-ReverseString', 'ConvertTo-TwoDigitFlipString', + 'Export-SPConfiguration', 'Export-SPDscDiagnosticData', 'Format-OfficePatchGUID', 'Get-SPDscAssemblyVersion', @@ -66,7 +67,6 @@ 'Resolve-SPDscSecurityIdentifier', 'Set-SPDscObjectPropertyIfValuePresent', 'Set-SPDscZoneMap', - 'Start-SharePointDSCExtract', 'Test-SPDscIsADUser', 'Test-SPDscObjectHasProperty', 'Test-SPDscParameterState', @@ -82,7 +82,7 @@ VariablesToExport = @() # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. - AliasesToExport = @() + AliasesToExport = @('Start-SharePointDSCExtract') # DSC resources to export from this module # DscResourcesToExport = @() diff --git a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 index bec263d31..4e53cbc5b 100644 --- a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 +++ b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 @@ -1538,7 +1538,7 @@ function ConvertTo-ReverseString return $reverseString } -function Start-SharePointDSCExtract +function Export-SPConfiguration { param ( @@ -1596,6 +1596,19 @@ function Start-SharePointDSCExtract $BinaryLocation ) + $reverseDSCVersion = [Version]"2.0.0.7" + $reverseDSCModule = Get-Module ReverseDsc -ListAvailable | Where-Object -FilterScript { $_.Version -eq $reverseDSCVersion } + if ($null -eq $reverseDSCModule) + { + Write-Host "[ERROR} ReverseDsc v$($reverseDSCVersion.ToString()) could not be found. Make sure you have this module installed before running this cmdlet!" -ForegroundColor Red + Write-Host "Install via:" -ForegroundColor Red + Write-Host " Install-Module ReverseDsc -RequiredVersion $($reverseDSCVersion.ToString())" -ForegroundColor Red + Write-Host "or" -ForegroundColor Red + Write-Host " Copy the module from a different machine to C:\Program Files\WindowsPowerShell\Modules" -ForegroundColor Red + Write-Host " " + return + } + $spDscModule = (Get-Module "SharePointDSC") $spDscModulePath = Split-Path -Path $spDscModule.Path -Parent Import-Module -Name (Join-Path -Path $spDscModulePath -ChildPath "Modules\SharePointDSC.Reverse\SharePointDSC.Reverse.psm1") -Scope Global @@ -1821,3 +1834,5 @@ function Export-SPDscDiagnosticData Write-Host ('Completed with export. Information exported to {0}' -f $exportFilename) -ForegroundColor Yellow } + +New-Alias -Name Start-SharePointDSCExtract -Value Export-SPConfiguration diff --git a/SharePointDsc/SharePointDsc.psd1 b/SharePointDsc/SharePointDsc.psd1 index dd775e831..c09c2e780 100644 --- a/SharePointDsc/SharePointDsc.psd1 +++ b/SharePointDsc/SharePointDsc.psd1 @@ -48,12 +48,12 @@ # ProcessorArchitecture = '' # Modules that must be imported into the global environment prior to importing this module - RequiredModules = @( - @{ - ModuleName = "ReverseDSC" - RequiredVersion = "2.0.0.7" - } - ) + # RequiredModules = @( + # @{ + # ModuleName = "ReverseDSC" + # RequiredVersion = "2.0.0.7" + # } + # ) # Assemblies that must be loaded prior to importing this module # RequiredAssemblies = @() @@ -81,6 +81,7 @@ 'Convert-SPDscHashtableToString', 'ConvertTo-ReverseString', 'ConvertTo-TwoDigitFlipString', + 'Export-SPConfiguration', 'Export-SPDscDiagnosticData', 'Format-OfficePatchGUID', 'Get-SPDscDBForAlias', @@ -116,7 +117,6 @@ 'Set-SPFarmAdministratorsBlock', 'Set-SPDscTermStoreAdministrators', 'Set-SPDscTermStoreAdministratorsBlock', - 'Start-SharePointDSCExtract', 'Test-SPDscIsADUser', 'Test-SPDscObjectHasProperty', 'Test-SPDscParameterState', @@ -132,7 +132,7 @@ VariablesToExport = @() # Aliases to export from this module - AliasesToExport = @() + AliasesToExport = @('Start-SharePointDSCExtract') # DSCResources to export from this module DscResourcesToExport = @( From 8818570ea7eeb128e6ba7737bb14ea60d763bd58 Mon Sep 17 00:00:00 2001 From: Yorick Kuijs Date: Fri, 5 Mar 2021 15:48:14 +0100 Subject: [PATCH 06/14] ReverseDsc improvements --- CHANGELOG.md | 3 +- .../SharePointDsc.Reverse.psm1 | 965 ++++++------------ .../SharePointDsc.Util.psm1 | 1 + 3 files changed, 336 insertions(+), 633 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79867b6ad..bd175f7aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added check to see if a central admin site is returned and stop if it isn't - SPSite - Added check to see if a central admin site is returned and stop if it isn't +- ReverseDsc + - Made the export GUI logic more dynamic ### Fixed @@ -37,7 +39,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed -### Added - SharePointDsc - Removed the ReverseDsc dependency for the SharePointDsc module since the module is only required when performing an export diff --git a/SharePointDsc/Modules/SharePointDsc.Reverse/SharePointDsc.Reverse.psm1 b/SharePointDsc/Modules/SharePointDsc.Reverse/SharePointDsc.Reverse.psm1 index 4ca9a448e..0184048df 100644 --- a/SharePointDsc/Modules/SharePointDsc.Reverse/SharePointDsc.Reverse.psm1 +++ b/SharePointDsc/Modules/SharePointDsc.Reverse/SharePointDsc.Reverse.psm1 @@ -130,7 +130,7 @@ function Get-SPReverseDSC $outputDSCFile = Join-Path -Path $OutputDSCPath -ChildPath $fileName if (Test-Path -Path $outputDSCFile) { - Remove-Item -Path $outputDSCFile -Force -Confirm $false + Remove-Item -Path $outputDSCFile -Force -Confirm:$false } $Script:dscConfigContent | Out-File -FilePath $outputDSCFile @@ -155,7 +155,7 @@ function Get-SPReverseDSC $outputConfigurationData = Join-Path -Path $OutputDSCPath -ChildPath "ConfigurationData.psd1" if (Test-Path -Path $outputConfigurationData) { - Remove-Item -Path $outputConfigurationData -Force -Confirm $false + Remove-Item -Path $outputConfigurationData -Force -Confirm:$false } New-ConfigurationDataDocument -Path $outputConfigurationData } @@ -448,11 +448,8 @@ function Orchestrator Write-Host -Object "[$($spServer.Name)] Scanning Distributed Cache Settings(s)..." -BackgroundColor DarkGreen -ForegroundColor White $Script:dscConfigContent += Read-TargetResource -ResourceName 'SPDistributedCacheService' - if ($Global:ExtractionModeValue -ge 2) - { - Write-Host -Object "[$($spServer.Name)] Scanning Doc Icon(s)..." -BackgroundColor DarkGreen -ForegroundColor White - $Script:dscConfigContent += Read-TargetResource -ResourceName 'SPDocIcon' - } + Write-Host -Object "[$($spServer.Name)] Scanning Doc Icon(s)..." -BackgroundColor DarkGreen -ForegroundColor White + $Script:dscConfigContent += Read-TargetResource -ResourceName 'SPDocIcon' Write-Host -Object "[$($spServer.Name)] Scanning Excel Services Application Settings(s)..." -BackgroundColor DarkGreen -ForegroundColor White $Script:dscConfigContent += Read-TargetResource -ResourceName 'SPExcelServiceApp' @@ -655,6 +652,7 @@ function Orchestrator Set-ObtainRequiredCredentials $Script:dscConfigContent += "$configName -ConfigurationData .\ConfigurationData.psd1" + $Script:dscConfigContent += "`r`n`r`n" } function Repair-Credentials @@ -1087,13 +1085,16 @@ function Select-ComponentsForMode { try { - if ($mode -ne 3) + if ($control.Name -NotIn @("chckRequiredUsers", "chckAzure", "chckStandAlone")) { - $control.Checked = $false - } - else - { - $control.Checked = $true + if ($mode -ne 3) + { + $control.Checked = $false + } + else + { + $control.Checked = $true + } } } catch @@ -1116,6 +1117,100 @@ function Select-ComponentsForMode function DisplayGUI() { + $components = @{ + InformationArchitecture = @( + @{ Name = "SPContentDatabase"; Text = "Content Database" ; ExtractionMode = 1 }, + @{ Name = "SPQuotaTemplate" ; Text = "Quota Templates" ; ExtractionMode = 1 }, + @{ Name = "SPSite" ; Text = "Site Collections (SPSite)"; ExtractionMode = 1 }, + @{ Name = "SPWeb" ; Text = "Subsites (SPWeb)" ; ExtractionMode = 3 } + ) + Security = @( + @{ Name = "SPFarmAdministrators" ; Text = "Farm Administrators" ; ExtractionMode = 1 }, + @{ Name = "SPManagedAccount" ; Text = "Managed Accounts" ; ExtractionMode = 1 }, + @{ Name = "SPPasswordChangeSettings" ; Text = "Password Change Settings" ; ExtractionMode = 2 }, + @{ Name = "SPRemoteFarmTrust" ; Text = "Remote Farm Trusts" ; ExtractionMode = 2 }, + @{ Name = "SPServiceAppSecurity" ; Text = "Service App Security" ; ExtractionMode = 2 }, + @{ Name = "SPTrustedIdentityTokenIssuer"; Text = "Trusted Identity Token Issuers"; ExtractionMode = 2 } + ) + ServiceApplications = @( + @{ Name = "SPAccessServiceApp" ; Text = "Access Services" ; ExtractionMode = 1 }, + @{ Name = "SPAccessServices2010" ; Text = "Access Services 2010" ; ExtractionMode = 1 }, + @{ Name = "SPAppManagementServiceApp" ; Text = "App Management" ; ExtractionMode = 1 }, + @{ Name = "SPBCSServiceApp" ; Text = "Business Connectivity Services"; ExtractionMode = 1 }, + @{ Name = "SPExcelServiceApp" ; Text = "Excel Services" ; ExtractionMode = 1 }, + @{ Name = "SPMachineTranslationServiceApp" ; Text = "Machine Translation" ; ExtractionMode = 1 }, + @{ Name = "SPManagedMetadataServiceApp" ; Text = "Managed Metadata" ; ExtractionMode = 1 }, + @{ Name = "SPPerformancePointServiceApp" ; Text = "PerformancePoint Services" ; ExtractionMode = 1 }, + @{ Name = "SPPublishServiceApplication" ; Text = "Publish" ; ExtractionMode = 1 }, + @{ Name = "SPSecureStoreServiceApp" ; Text = "Secure Store" ; ExtractionMode = 1 }, + @{ Name = "SPStateServiceApp" ; Text = "State Service Application" ; ExtractionMode = 1 }, + @{ Name = "SPSubscriptionSettingsServiceApp" ; Text = "Subscription Settings" ; ExtractionMode = 1 }, + @{ Name = "SPUsageApplication" ; Text = "Usage Service Applications" ; ExtractionMode = 1 }, + @{ Name = "SPVisioServiceApp" ; Text = "Visio Graphics" ; ExtractionMode = 1 }, + @{ Name = "SPWordAutomationServiceApp" ; Text = "Word Automation" ; ExtractionMode = 1 }, + @{ Name = "SPWorkManagementServiceApp" ; Text = "Work Management" ; ExtractionMode = 1 } + ) + Search = @( + @{ Name = "SPSearchContentSource" ; Text = "Content Sources" ; ExtractionMode = 1 }, + @{ Name = "SPSearchCrawlRule" ; Text = "Crawl Rule" ; ExtractionMode = 2 }, + @{ Name = "SPSearchCrawlerImpactRule"; Text = "Crawler Impact Rules" ; ExtractionMode = 2 }, + @{ Name = "SPSearchFileType" ; Text = "File Types" ; ExtractionMode = 3 }, + @{ Name = "SPSearchIndexPartition" ; Text = "Index Partitions" ; ExtractionMode = 1 }, + @{ Name = "SPSearchManagedProperty" ; Text = "Managed Properties" ; ExtractionMode = 3 }, + @{ Name = "SPSearchResultSource" ; Text = "Result Sources" ; ExtractionMode = 2 }, + @{ Name = "SPSearchServiceApp" ; Text = "Search Service Applications"; ExtractionMode = 1 }, + @{ Name = "SPSearchTopology" ; Text = "Topologies" ; ExtractionMode = 1 } + ) + WebApplications = @( + @{ Name = "SPWebApplicationAppDomain" ; Text = "App Domain" ; ExtractionMode = 1 }, + @{ Name = "SPWebAppBlockedFileTypes" ; Text = "Blocked File Types" ; ExtractionMode = 2 }, + @{ Name = "SPWebApplicationExtension" ; Text = "Extensions" ; ExtractionMode = 2 }, + @{ Name = "SPWebAppGeneralSettings" ; Text = "General Settings" ; ExtractionMode = 2 }, + @{ Name = "SPWebAppPermissions" ; Text = "Permissions" ; ExtractionMode = 1 }, + @{ Name = "SPWebAppPolicy" ; Text = "Policies" ; ExtractionMode = 1 }, + @{ Name = "SPWebAppProxyGroup" ; Text = "Proxy Groups" ; ExtractionMode = 1 }, + @{ Name = "SPWebAppSiteUseAndDeletion"; Text = "Site Use And Deletion"; ExtractionMode = 2 }, + @{ Name = "SPWebAppThrottlingSettings"; Text = "Throttling Settings" ; ExtractionMode = 2 }, + @{ Name = "SPWebApplication" ; Text = "Web Applications" ; ExtractionMode = 1 }, + @{ Name = "SPWebAppWorkflowSettings" ; Text = "Workflow Settings" ; ExtractionMode = 2 } + ) + Customization = @( + @{ Name = "SPAppCatalog" ; Text = "App Catalog" ; ExtractionMode = 1 }, + @{ Name = "SPAppDomain" ; Text = "App Domain" ; ExtractionMode = 1 }, + @{ Name = "SPAppStoreSettings"; Text = "App Store Settings"; ExtractionMode = 1 }, + @{ Name = "SPFarmSolution" ; Text = "Farm Solutions" ; ExtractionMode = 1 } + ) + Configuration = @( + @{ Name = "SPAlternateUrl" ; Text = "Alternate Url" ; ExtractionMode = 1 }, + @{ Name = "SPAntivirusSettings" ; Text = "Antivirus Settings" ; ExtractionMode = 1 }, + @{ Name = "SPBlobCacheSettings" ; Text = "Blob Cache Settings" ; ExtractionMode = 1 }, + @{ Name = "SPCacheAccounts" ; Text = "Cache Accounts" ; ExtractionMode = 1 }, + @{ Name = "SPDiagnosticLoggingSettings"; Text = "Diagnostic Logging Settings" ; ExtractionMode = 1 }, + @{ Name = "SPDistributedCacheService" ; Text = "Distributed Cache Services" ; ExtractionMode = 1 }, + @{ Name = "SPDocIcon" ; Text = "Doc Icons" ; ExtractionMode = 2 }, + @{ Name = "SPFarm" ; Text = "Farm Configuration" ; ExtractionMode = 1 }, + @{ Name = "SPFarmPropertyBag" ; Text = "Farm Property Bag" ; ExtractionMode = 1 }, + @{ Name = "SPFeature" ; Text = "Features" ; ExtractionMode = 3 }, + @{ Name = "SPHealthAnalyzerRuleState" ; Text = "Health Analyzer Rule States" ; ExtractionMode = 3 }, + @{ Name = "SPIrmSettings" ; Text = "Information Rights Management Settings"; ExtractionMode = 1 }, + @{ Name = "SPManagedPath" ; Text = "Managed Paths" ; ExtractionMode = 1 }, + @{ Name = "SPOfficeOnlineServerBinding"; Text = "Office Online Server Bindings" ; ExtractionMode = 2 }, + @{ Name = "SPOutgoingEmailSettings" ; Text = "Outgoing Email Settings" ; ExtractionMode = 1 }, + @{ Name = "SPServiceAppPool" ; Text = "Service Application Pools" ; ExtractionMode = 1 }, + @{ Name = "SPServiceInstance" ; Text = "Service Instances" ; ExtractionMode = 1 }, + @{ Name = "SPSessionStateService" ; Text = "Session State Services" ; ExtractionMode = 1 }, + @{ Name = "SPDatabaseAAG" ; Text = "SQL Always On Availability Groups" ; ExtractionMode = 3 }, + @{ Name = "SPTimerJobState" ; Text = "Timer Job States" ; ExtractionMode = 3 } + ) + UserProfile = @( + @{ Name = "SPUserProfileProperty" ; Text = "Profile Properties" ; ExtractionMode = 3 }, + @{ Name = "SPUserProfileSection" ; Text = "Profile Sections" ; ExtractionMode = 3 }, + @{ Name = "SPUserProfileSyncConnection" ; Text = "Synchronization Connections" ; ExtractionMode = 2 }, + @{ Name = "SPUserProfileServiceApp" ; Text = "User Profile Service Applications"; ExtractionMode = 1 }, + @{ Name = "SPUserProfileServiceAppPermissions"; Text = "User Profile Service Permissions" ; ExtractionMode = 2 } + ) + } + #region Global $firstColumnLeft = 10 $secondColumnLeft = 280 @@ -1123,12 +1218,14 @@ function DisplayGUI() $topBannerHeight = 70 #endregion + $Global:liteComponents = @() + $Global:defaultComponents = @() $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 - 60 - $form.WindowState = [System.Windows.Forms.FormWindowState]::Maximized + $form.Width = ($screens[0].Bounds.Width) / 2 + $form.Height = ($screens[0].Bounds.Height) / 2 + #$form.WindowState = [System.Windows.Forms.FormWindowState]::Maximized $panelMain = New-Object System.Windows.Forms.Panel $panelMain.Width = $form.Width @@ -1147,258 +1244,128 @@ function DisplayGUI() $panelInformationArchitecture = New-Object System.Windows.Forms.Panel $panelInformationArchitecture.Top = 30 + $topBannerHeight $panelInformationArchitecture.Left = $firstColumnLeft + $panelInformationArchitecture.AutoSize = $true $panelInformationArchitecture.Height = 80 $panelInformationArchitecture.Width = 220 $panelInformationArchitecture.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle - $chckContentDB = New-Object System.Windows.Forms.CheckBox - $chckContentDB.Top = 0 - $chckContentDB.AutoSize = $true; - $chckContentDB.Name = "SPContentDatabase" - $chckContentDB.Checked = $true - $chckContentDB.Text = "Content Databases" - $panelInformationArchitecture.Controls.Add($chckContentDB) - - $chckQuotaTemplates = New-Object System.Windows.Forms.CheckBox - $chckQuotaTemplates.Top = 20 - $chckQuotaTemplates.AutoSize = $true; - $chckQuotaTemplates.Name = "SPQuotaTemplate" - $chckQuotaTemplates.Checked = $true - $chckQuotaTemplates.Text = "Quota Templates" - $panelInformationArchitecture.Controls.Add($chckQuotaTemplates); - - $chckSiteCollection = New-Object System.Windows.Forms.CheckBox - $chckSiteCollection.Top = 40 - $chckSiteCollection.AutoSize = $true; - $chckSiteCollection.Name = "SPSite" - $chckSiteCollection.Checked = $true - $chckSiteCollection.Text = "Site Collections (SPSite)" - $panelInformationArchitecture.Controls.Add($chckSiteCollection) - - $chckSPWeb = New-Object System.Windows.Forms.CheckBox - $chckSPWeb.Top = 60 - $chckSPWeb.AutoSize = $true; - $chckSPWeb.Name = "SPWeb" - $chckSPWeb.Checked = $false - $chckSPWeb.Text = "Subsites (SPWeb)" - $panelInformationArchitecture.Controls.Add($chckSPWeb) + $align = 0 + foreach ($resource in $components.InformationArchitecture) + { + $checkbox = New-Object System.Windows.Forms.CheckBox + $checkbox.Top = $align + $checkbox.AutoSize = $true; + $checkbox.Name = $resource.Name + $checkbox.Text = $resource.Text + + $checked = $false + if ($resource.ExtractionMode -le 1) + { + $Global:liteComponents += $checkbox + } + + if ($resource.ExtractionMode -le 2) + { + $Global:defaultComponents += $checkbox + $checked = $true + } + $checkbox.Checked = $checked + $panelInformationArchitecture.Controls.Add($checkbox) + $align += 20 + } $panelMain.Controls.Add($panelInformationArchitecture) - #endregion + #endregion Information Architecture #region Security $labelSecurity = New-Object System.Windows.Forms.Label $labelSecurity.Text = "Security:" $labelSecurity.AutoSize = $true - $labelSecurity.Top = 120 + $topBannerHeight + $labelSecurity.Top = $panelInformationArchitecture.Top + $panelInformationArchitecture.Height + 10 $labelSecurity.Left = $firstColumnLeft $labelSecurity.Font = [System.Drawing.Font]::new($labelSecurity.Font.Name, 14, [System.Drawing.FontStyle]::Bold) $panelMain.Controls.Add($labelSecurity) $panelSecurity = New-Object System.Windows.Forms.Panel - $panelSecurity.Top = 150 + $topBannerHeight + $panelSecurity.Top = $panelInformationArchitecture.Top + $panelInformationArchitecture.Height + 40 $panelSecurity.Left = $firstColumnLeft $panelSecurity.AutoSize = $true $panelSecurity.Width = 220 $panelSecurity.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle - $chckFarmAdmin = New-Object System.Windows.Forms.CheckBox - $chckFarmAdmin.Top = 0 - $chckFarmAdmin.AutoSize = $true; - $chckFarmAdmin.Name = "SPFarmAdministrators" - $chckFarmAdmin.Checked = $true - $chckFarmAdmin.Text = "Farm Administrators" - $panelSecurity.Controls.Add($chckFarmAdmin); - - $chckManagedAccount = New-Object System.Windows.Forms.CheckBox - $chckManagedAccount.Top = 20 - $chckManagedAccount.AutoSize = $true; - $chckManagedAccount.Name = "SPManagedAccount" - $chckManagedAccount.Checked = $true - $chckManagedAccount.Text = "Managed Accounts" - $panelSecurity.Controls.Add($chckManagedAccount); - - $chckPasswordChange = New-Object System.Windows.Forms.CheckBox - $chckPasswordChange.Top = 40 - $chckPasswordChange.AutoSize = $true; - $chckPasswordChange.Name = "SPPasswordChangeSettings" - $chckPasswordChange.Checked = $true - $chckPasswordChange.Text = "Password Change Settings" - $panelSecurity.Controls.Add($chckPasswordChange); - - $chckRemoteTrust = New-Object System.Windows.Forms.CheckBox - $chckRemoteTrust.Top = 60 - $chckRemoteTrust.AutoSize = $true; - $chckRemoteTrust.Name = "SPRemoteFarmTrust" - $chckRemoteTrust.Checked = $true - $chckRemoteTrust.Text = "Remote Farm Trust" - $panelSecurity.Controls.Add($chckRemoteTrust); - - $chckSASecurity = New-Object System.Windows.Forms.CheckBox - $chckSASecurity.Top = 80 - $chckSASecurity.AutoSize = $true; - $chckSASecurity.Name = "SPServiceAppSecurity" - $chckSASecurity.Checked = $true - $chckSASecurity.Text = "Service Applications Security" - $panelSecurity.Controls.Add($chckSASecurity) - - $chckTrustedIdentity = New-Object System.Windows.Forms.CheckBox - $chckTrustedIdentity.Top = 100 - $chckTrustedIdentity.AutoSize = $true; - $chckTrustedIdentity.Name = "SPTrustedIdentityTokenIssuer" - $chckTrustedIdentity.Checked = $true - $chckTrustedIdentity.Text = "Trusted Identity Token Issuer" - $panelSecurity.Controls.Add($chckTrustedIdentity); + $align = 0 + foreach ($resource in $components.Security) + { + $checkbox = New-Object System.Windows.Forms.CheckBox + $checkbox.Top = $align + $checkbox.AutoSize = $true; + $checkbox.Name = $resource.Name + $checkbox.Text = $resource.Text + + $checked = $false + if ($resource.ExtractionMode -le 1) + { + $Global:liteComponents += $checkbox + } + + if ($resource.ExtractionMode -le 2) + { + $Global:defaultComponents += $checkbox + $checked = $true + } + $checkbox.Checked = $checked + + $panelSecurity.Controls.Add($checkbox) + $align += 20 + } $panelMain.Controls.Add($panelSecurity) - #endregion + #endregion Security #region Service Applications $labelSA = New-Object System.Windows.Forms.Label $labelSA.Text = "Service Applications:" $labelSA.AutoSize = $true - $labelSA.Top = 285 + $topBannerHeight + $labelSA.Top = $panelSecurity.Top + $panelSecurity.Height + 10 $labelSA.Left = $firstColumnLeft $labelSA.Font = [System.Drawing.Font]::new($labelSA.Font.Name, 14, [System.Drawing.FontStyle]::Bold) $panelMain.Controls.Add($labelSA) $panelSA = New-Object System.Windows.Forms.Panel - $panelSA.Top = 315 + $topBannerHeight + $panelSA.Top = $panelSecurity.Top + $panelSecurity.Height + 40 $panelSA.Left = $firstColumnLeft $panelSA.AutoSize = $true $panelSA.Width = 220 $panelSA.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle - $chckSAAccess = New-Object System.Windows.Forms.CheckBox - $chckSAAccess.Top = 0 - $chckSAAccess.AutoSize = $true; - $chckSAAccess.Name = "SPAccessServiceApp" - $chckSAAccess.Checked = $true - $chckSAAccess.Text = "Access Services" - $panelSA.Controls.Add($chckSAAccess); - - $chckSAAccess2010 = New-Object System.Windows.Forms.CheckBox - $chckSAAccess2010.Top = 20 - $chckSAAccess2010.AutoSize = $true; - $chckSAAccess2010.Name = "SPAccessServices2010" - $chckSAAccess2010.Checked = $true - $chckSAAccess2010.Text = "Access Services 2010" - $panelSA.Controls.Add($chckSAAccess2010); - - $chckSAAppMan = New-Object System.Windows.Forms.CheckBox - $chckSAAppMan.Top = 40 - $chckSAAppMan.AutoSize = $true; - $chckSAAppMan.Name = "SPAppManagementServiceApp" - $chckSAAppMan.Checked = $true - $chckSAAppMan.Text = "App Management" - $panelSA.Controls.Add($chckSAAppMan); - - $chckSABCS = New-Object System.Windows.Forms.CheckBox - $chckSABCS.Top = 60 - $chckSABCS.AutoSize = $true; - $chckSABCS.Name = "SPBCSServiceApp" - $chckSABCS.Checked = $true - $chckSABCS.Text = "Business Connectivity Services" - $panelSA.Controls.Add($chckSABCS); - - $chckSAExcel = New-Object System.Windows.Forms.CheckBox - $chckSAExcel.Top = 80 - $chckSAExcel.AutoSize = $true; - $chckSAExcel.Name = "SPExcelServiceApp" - $chckSAExcel.Checked = $true - $chckSAExcel.Text = "Excel Services" - $panelSA.Controls.Add($chckSAExcel); - - $chckSAMachine = New-Object System.Windows.Forms.CheckBox - $chckSAMachine.Top = 100 - $chckSAMachine.AutoSize = $true; - $chckSAMachine.Name = "SPMachineTranslationServiceApp" - $chckSAMachine.Checked = $true - $chckSAMachine.Text = "Machine Translation" - $panelSA.Controls.Add($chckSAMachine); - - $chckSAMMS = New-Object System.Windows.Forms.CheckBox - $chckSAMMS.Top = 120 - $chckSAMMS.AutoSize = $true; - $chckSAMMS.Name = "SPManagedMetadataServiceApp" - $chckSAMMS.Checked = $true - $chckSAMMS.Text = "Managed Metadata" - $panelSA.Controls.Add($chckSAMMS); - - $chckSAPerformance = New-Object System.Windows.Forms.CheckBox - $chckSAPerformance.Top = 140 - $chckSAPerformance.AutoSize = $true; - $chckSAPerformance.Name = "SPPerformancePointServiceApp" - $chckSAPerformance.Checked = $true - $chckSAPerformance.Text = "PerformancePoint" - $panelSA.Controls.Add($chckSAPerformance); - - $chckSAPublish = New-Object System.Windows.Forms.CheckBox - $chckSAPublish.Top = 160 - $chckSAPublish.AutoSize = $true; - $chckSAPublish.Name = "SPPublishServiceApplication" - $chckSAPublish.Checked = $true - $chckSAPublish.Text = "Publish" - $panelSA.Controls.Add($chckSAPublish); - - $chckSASecureStore = New-Object System.Windows.Forms.CheckBox - $chckSASecureStore.Top = 180 - $chckSASecureStore.AutoSize = $true; - $chckSASecureStore.Name = "SPSecureStoreServiceApp" - $chckSASecureStore.Checked = $true - $chckSASecureStore.Text = "Secure Store" - $panelSA.Controls.Add($chckSASecureStore); - - $chckSAState = New-Object System.Windows.Forms.CheckBox - $chckSAState.Top = 200 - $chckSAState.AutoSize = $true; - $chckSAState.Name = "SPStateServiceApp" - $chckSAState.Checked = $true - $chckSAState.Text = "State Service Application" - $panelSA.Controls.Add($chckSAState); - - $chckSASub = New-Object System.Windows.Forms.CheckBox - $chckSASub.Top = 220 - $chckSASub.AutoSize = $true; - $chckSASub.Name = "SPSubscriptionSettingsServiceApp" - $chckSASub.Checked = $true - $chckSASub.Text = "Subscription settings" - $panelSA.Controls.Add($chckSASub); - - $chckSAUsage = New-Object System.Windows.Forms.CheckBox - $chckSAUsage.AutoSize = $true; - $chckSAUsage.Top = 240; - $chckSAUsage.Name = "SPUsageApplication" - $chckSAUsage.Checked = $true - $chckSAUsage.Text = "Usage Service Application" - $panelSA.Controls.Add($chckSAUsage); - - $chckSAVisio = New-Object System.Windows.Forms.CheckBox - $chckSAVisio.Top = 260 - $chckSAVisio.AutoSize = $true; - $chckSAVisio.Name = "SPVisioServiceApp" - $chckSAVisio.Checked = $true - $chckSAVisio.Text = "Visio Graphics" - $panelSA.Controls.Add($chckSAVisio); - - $chckSAWord = New-Object System.Windows.Forms.CheckBox - $chckSAWord.Top = 280 - $chckSAWord.AutoSize = $true; - $chckSAWord.Name = "SPWordAutomationServiceApp" - $chckSAWord.Checked = $true - $chckSAWord.Text = "Word Automation" - $panelSA.Controls.Add($chckSAWord); - - $chckSAWork = New-Object System.Windows.Forms.CheckBox - $chckSAWork.Top = 300 - $chckSAWork.AutoSize = $true; - $chckSAWork.Name = "SPWorkManagementServiceApp" - $chckSAWork.Checked = $true - $chckSAWork.Text = "Work Management" - $panelSA.Controls.Add($chckSAWork); + $align = 0 + foreach ($resource in $components.ServiceApplications) + { + $checkbox = New-Object System.Windows.Forms.CheckBox + $checkbox.Top = $align + $checkbox.AutoSize = $true; + $checkbox.Name = $resource.Name + $checkbox.Text = $resource.Text + + $checked = $false + if ($resource.ExtractionMode -le 1) + { + $Global:liteComponents += $checkbox + } + + if ($resource.ExtractionMode -le 2) + { + $Global:defaultComponents += $checkbox + $checked = $true + } + $checkbox.Checked = $checked + + $panelSA.Controls.Add($checkbox) + $align += 20 + } $panelMain.Controls.Add($panelSA) - #endregion + #endregion Service Applications #region Search $labelSearch = New-Object System.Windows.Forms.Label @@ -1416,187 +1383,79 @@ function DisplayGUI() $panelSearch.Width = 220 $panelSearch.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle - $chckSearchContentSource = New-Object System.Windows.Forms.CheckBox - $chckSearchContentSource.Top = 0 - $chckSearchContentSource.AutoSize = $true; - $chckSearchContentSource.Name = "SPSearchContentSource" - $chckSearchContentSource.Checked = $true - $chckSearchContentSource.Text = "Content Sources" - $panelSearch.Controls.Add($chckSearchContentSource); - - $chckSearchCrawlRule = New-Object System.Windows.Forms.CheckBox - $chckSearchCrawlRule.Top = 20 - $chckSearchCrawlRule.AutoSize = $true; - $chckSearchCrawlRule.Name = "SPSearchCrawlRule" - $chckSearchCrawlRule.Checked = $true - $chckSearchCrawlRule.Text = "Crawl Rules" - $panelSearch.Controls.Add($chckSearchCrawlRule); - - $chckSearchCrawlerImpact = New-Object System.Windows.Forms.CheckBox - $chckSearchCrawlerImpact.Top = 40 - $chckSearchCrawlerImpact.AutoSize = $true; - $chckSearchCrawlerImpact.Name = "SPSearchCrawlerImpactRule" - $chckSearchCrawlerImpact.Checked = $true - $chckSearchCrawlerImpact.Text = "Crawler Impact Rules" - $panelSearch.Controls.Add($chckSearchCrawlerImpact); - - $chckSearchFileTypes = New-Object System.Windows.Forms.CheckBox - $chckSearchFileTypes.Top = 60 - $chckSearchFileTypes.AutoSize = $true; - $chckSearchFileTypes.Name = "SPSearchFileType" - $chckSearchFileTypes.Checked = $false - $chckSearchFileTypes.Text = "File Types" - $panelSearch.Controls.Add($chckSearchFileTypes); - - $chckSearchIndexPart = New-Object System.Windows.Forms.CheckBox - $chckSearchIndexPart.Top = 80 - $chckSearchIndexPart.AutoSize = $true; - $chckSearchIndexPart.Name = "SPSearchIndexPartition" - $chckSearchIndexPart.Checked = $true - $chckSearchIndexPart.Text = "Index Partitions" - $panelSearch.Controls.Add($chckSearchIndexPart); - - $chckManagedProp = New-Object System.Windows.Forms.CheckBox - $chckManagedProp.Top = 100 - $chckManagedProp.AutoSize = $true; - $chckManagedProp.Name = "SPSearchManagedProperty" - $chckManagedProp.Checked = $false - $chckManagedProp.Text = "Managed Properties" - $panelSearch.Controls.Add($chckManagedProp); - - $chckSearchResultSources = New-Object System.Windows.Forms.CheckBox - $chckSearchResultSources.Top = 120 - $chckSearchResultSources.AutoSize = $true; - $chckSearchResultSources.Name = "SPSearchResultSource" - $chckSearchResultSources.Checked = $true - $chckSearchResultSources.Text = "Result Sources" - $panelSearch.Controls.Add($chckSearchResultSources); - - $chckSearchSA = New-Object System.Windows.Forms.CheckBox - $chckSearchSA.Top = 140 - $chckSearchSA.AutoSize = $true; - $chckSearchSA.Name = "SPSearchServiceApp" - $chckSearchSA.Checked = $true - $chckSearchSA.Text = "Search Service Applications" - $panelSearch.Controls.Add($chckSearchSA); - - $chckSearchTopo = New-Object System.Windows.Forms.CheckBox - $chckSearchTopo.Top = 160 - $chckSearchTopo.AutoSize = $true - $chckSearchTopo.Name = "SPSearchTopology" - $chckSearchTopo.Checked = $true - $chckSearchTopo.Text = "Topology" - $panelSearch.Controls.Add($chckSearchTopo); + $align = 0 + foreach ($resource in $components.Search) + { + $checkbox = New-Object System.Windows.Forms.CheckBox + $checkbox.Top = $align + $checkbox.AutoSize = $true; + $checkbox.Name = $resource.Name + $checkbox.Text = $resource.Text + + $checked = $false + if ($resource.ExtractionMode -le 1) + { + $Global:liteComponents += $checkbox + } + + if ($resource.ExtractionMode -le 2) + { + $Global:defaultComponents += $checkbox + $checked = $true + } + $checkbox.Checked = $checked + + $panelSearch.Controls.Add($checkbox) + $align += 20 + } $panelMain.Controls.Add($panelSearch) - #endregion + #endregion Search #region Web Applications $labelWebApplications = New-Object System.Windows.Forms.Label $labelWebApplications.Text = "Web Applications:" $labelWebApplications.AutoSize = $true - $labelWebApplications.Top = $panelSearch.Height + $topBannerHeight + 40 + $labelWebApplications.Top = $panelSearch.Top + $panelSearch.Height + 10 $labelWebApplications.Left = $secondColumnLeft $labelWebApplications.Font = [System.Drawing.Font]::new($labelWebApplications.Font.Name, 14, [System.Drawing.FontStyle]::Bold) $panelMain.Controls.Add($labelWebApplications) $panelWebApp = New-Object System.Windows.Forms.Panel - $panelWebApp.Top = $panelSearch.Height + $topBannerHeight + 70 + $panelWebApp.Top = $panelSearch.Top + $panelSearch.Height + 40 $panelWebApp.Left = $secondColumnLeft $panelWebApp.AutoSize = $true - $panelWebApp.Width = 220 + #$panelWebApp.Width = 220 $panelWebApp.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle - $chckWAAppDomain = New-Object System.Windows.Forms.CheckBox - $chckWAAppDomain.Top = 0 - $chckWAAppDomain.AutoSize = $true; - $chckWAAppDomain.Name = "SPWebApplicationAppDomain" - $chckWAAppDomain.Checked = $true - $chckWAAppDomain.Text = "App Domain" - $panelWebApp.Controls.Add($chckWAAppDomain); - - $chckWABlockedFiles = New-Object System.Windows.Forms.CheckBox - $chckWABlockedFiles.Top = 20 - $chckWABlockedFiles.AutoSize = $true; - $chckWABlockedFiles.Name = "SPWebAppBlockedFileTypes" - $chckWABlockedFiles.Checked = $true - $chckWABlockedFiles.Text = "Blocked File Types" - $panelWebApp.Controls.Add($chckWABlockedFiles); - - $chckWAExtension = New-Object System.Windows.Forms.CheckBox - $chckWAExtension.Top = 40 - $chckWAExtension.AutoSize = $true; - $chckWAExtension.Name = "SPWebApplicationExtension" - $chckWAExtension.Checked = $true - $chckWAExtension.Text = "Extensions" - $panelWebApp.Controls.Add($chckWAExtension); - - $chckWAGeneral = New-Object System.Windows.Forms.CheckBox - $chckWAGeneral.Top = 60 - $chckWAGeneral.AutoSize = $true; - $chckWAGeneral.Name = "SPWebAppGeneralSettings" - $chckWAGeneral.Checked = $true - $chckWAGeneral.Text = "General Settings" - $panelWebApp.Controls.Add($chckWAGeneral); - - $chckWebAppPerm = New-Object System.Windows.Forms.CheckBox - $chckWebAppPerm.Top = 80 - $chckWebAppPerm.AutoSize = $true - $chckWebAppPerm.Name = "SPWebAppPermissions" - $chckWebAppPerm.Checked = $true - $chckWebAppPerm.Text = "Permissions" - $panelWebApp.Controls.Add($chckWebAppPerm); - - $chckWebAppPolicy = New-Object System.Windows.Forms.CheckBox - $chckWebAppPolicy.Top = 100 - $chckWebAppPolicy.AutoSize = $true; - $chckWebAppPolicy.Name = "SPWebAppPolicy" - $chckWebAppPolicy.Checked = $true - $chckWebAppPolicy.Text = "Policies" - $panelWebApp.Controls.Add($chckWebAppPolicy); - - $chckWAProxyGroup = New-Object System.Windows.Forms.CheckBox - $chckWAProxyGroup.Top = 120 - $chckWAProxyGroup.AutoSize = $true; - $chckWAProxyGroup.Name = "SPWebAppProxyGroup" - $chckWAProxyGroup.Checked = $true - $chckWAProxyGroup.Text = "Proxy Groups" - $panelWebApp.Controls.Add($chckWAProxyGroup); - - $chckWADeletion = New-Object System.Windows.Forms.CheckBox - $chckWADeletion.Top = 140 - $chckWADeletion.AutoSize = $true; - $chckWADeletion.Name = "SPWebAppSiteUseAndDeletion" - $chckWADeletion.Checked = $true - $chckWADeletion.Text = "Site Usage and Deletion" - $panelWebApp.Controls.Add($chckWADeletion); - - $chckWAThrottling = New-Object System.Windows.Forms.CheckBox - $chckWAThrottling.Top = 160 - $chckWAThrottling.AutoSize = $true; - $chckWAThrottling.Name = "SPWebAppThrottlingSettings" - $chckWAThrottling.Checked = $true - $chckWAThrottling.Text = "Throttling Settings" - $panelWebApp.Controls.Add($chckWAThrottling); - - $chckWebApp = New-Object System.Windows.Forms.CheckBox - $chckWebApp.Top = 180 - $chckWebApp.AutoSize = $true; - $chckWebApp.Name = "SPWebApplication" - $chckWebApp.Checked = $true - $chckWebApp.Text = "Web Applications" - $panelWebApp.Controls.Add($chckWebApp); - - $chckWAWorkflow = New-Object System.Windows.Forms.CheckBox - $chckWAWorkflow.Top = 200 - $chckWAWorkflow.AutoSize = $true; - $chckWAWorkflow.Name = "SPWebAppWorkflowSettings" - $chckWAWorkflow.Checked = $true - $chckWAWorkflow.Text = "Workflow Settings" - $panelWebApp.Controls.Add($chckWAWorkflow); + $align = 0 + foreach ($resource in $components.WebApplications) + { + $checkbox = New-Object System.Windows.Forms.CheckBox + $checkbox.Top = $align + $checkbox.AutoSize = $true; + $checkbox.Name = $resource.Name + $checkbox.Text = $resource.Text + + $checked = $false + if ($resource.ExtractionMode -le 1) + { + $Global:liteComponents += $checkbox + } + + if ($resource.ExtractionMode -le 2) + { + $Global:defaultComponents += $checkbox + $checked = $true + } + $checkbox.Checked = $checked + + $panelWebApp.Controls.Add($checkbox) + $align += 20 + } $panelMain.Controls.Add($panelWebApp) - #endregion + #endregion Web Applications #region Customization $labelCustomization = New-Object System.Windows.Forms.Label @@ -1610,44 +1469,39 @@ function DisplayGUI() $panelCustomization = New-Object System.Windows.Forms.Panel $panelCustomization.Top = $panelWebApp.Top + $panelWebApp.Height + 40 $panelCustomization.Left = $secondColumnLeft + $panelCustomization.AutoSize = $true $panelCustomization.Height = 80 $panelCustomization.Width = 220 $panelCustomization.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle - $chckAppCatalog = New-Object System.Windows.Forms.CheckBox - $chckAppCatalog.Top = 0 - $chckAppCatalog.AutoSize = $true; - $chckAppCatalog.Name = "SPAppCatalog" - $chckAppCatalog.Checked = $true - $chckAppCatalog.Text = "App Catalog" - $panelCustomization.Controls.Add($chckAppCatalog); - - $chckAppDomain = New-Object System.Windows.Forms.CheckBox - $chckAppDomain.Top = 20 - $chckAppDomain.AutoSize = $true; - $chckAppDomain.Name = "SPAppDomain" - $chckAppDomain.Checked = $true - $chckAppDomain.Text = "App Domain" - $panelCustomization.Controls.Add($chckAppDomain); - - $chckAppStore = New-Object System.Windows.Forms.CheckBox - $chckAppStore.Top = 40 - $chckAppStore.AutoSize = $true - $chckAppStore.Name = "SPAppStoreSettings" - $chckAppStore.Checked = $true - $chckAppStore.Text = "App Store Settings" - $panelCustomization.Controls.Add($chckAppStore); - - $chckFarmSolution = New-Object System.Windows.Forms.CheckBox - $chckFarmSolution.Top = 60 - $chckFarmSolution.AutoSize = $true; - $chckFarmSolution.Name = "SPFarmSolution" - $chckFarmSolution.Checked = $true - $chckFarmSolution.Text = "Farm Solutions" - $panelCustomization.Controls.Add($chckFarmSolution); + $align = 0 + foreach ($resource in $components.Customization) + { + $checkbox = New-Object System.Windows.Forms.CheckBox + $checkbox.Top = $align + $checkbox.AutoSize = $true; + $checkbox.Name = $resource.Name + $checkbox.Text = $resource.Text + + $checked = $false + if ($resource.ExtractionMode -le 1) + { + $Global:liteComponents += $checkbox + } + + if ($resource.ExtractionMode -le 2) + { + $Global:defaultComponents += $checkbox + $checked = $true + } + $checkbox.Checked = $checked + + $panelCustomization.Controls.Add($checkbox) + $align += 20 + } $panelMain.Controls.Add($panelCustomization) - #endregion + #endregion Customization #region Configuration $labelConfiguration = New-Object System.Windows.Forms.Label @@ -1665,172 +1519,38 @@ function DisplayGUI() $panelConfig.Width = 400 $panelConfig.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle - $chckAlternateUrl = New-Object System.Windows.Forms.CheckBox - $chckAlternateUrl.Top = 0 - $chckAlternateUrl.AutoSize = $true; - $chckAlternateUrl.Name = "SPAlternateUrl" - $chckAlternateUrl.Checked = $true - $chckAlternateUrl.Text = "Alternate URL" - $panelConfig.Controls.Add($chckAlternateUrl); - - $chckAntivirus = New-Object System.Windows.Forms.CheckBox - $chckAntivirus.Top = 20 - $chckAntivirus.AutoSize = $true; - $chckAntivirus.Name = "SPAntivirusSettings" - $chckAntivirus.Checked = $true - $chckAntivirus.Text = "Antivirus Settings" - $panelConfig.Controls.Add($chckAntivirus); - - $chckBlobCache = New-Object System.Windows.Forms.CheckBox - $chckBlobCache.Top = 40 - $chckBlobCache.AutoSize = $true; - $chckBlobCache.Name = "SPBlobCacheSettings" - $chckBlobCache.Checked = $true - $chckBlobCache.Text = "Blob Cache Settings" - $panelConfig.Controls.Add($chckBlobCache); - - $chckCacheAccounts = New-Object System.Windows.Forms.CheckBox - $chckCacheAccounts.Top = 60 - $chckCacheAccounts.AutoSize = $true; - $chckCacheAccounts.Name = "SPCacheAccounts" - $chckCacheAccounts.Checked = $true - $chckCacheAccounts.Text = "Cache Accounts" - $panelConfig.Controls.Add($chckCacheAccounts); - - $chckDiagLogging = New-Object System.Windows.Forms.CheckBox - $chckDiagLogging.Top = 80 - $chckDiagLogging.AutoSize = $true; - $chckDiagLogging.Name = "SPDiagnosticLoggingSettings" - $chckDiagLogging.Checked = $true - $chckDiagLogging.Text = "Diagnostic Logging Settings" - $panelConfig.Controls.Add($chckDiagLogging); - - $chckDistributedCache = New-Object System.Windows.Forms.CheckBox - $chckDistributedCache.Top = 100 - $chckDistributedCache.AutoSize = $true; - $chckDistributedCache.Name = "SPDistributedCacheService" - $chckDistributedCache.Checked = $true - $chckDistributedCache.Text = "Distributed Cache Service" - $panelConfig.Controls.Add($chckDistributedCache); - - $chckDocIcon = New-Object System.Windows.Forms.CheckBox - $chckDocIcon.Top = 120 - $chckDocIcon.AutoSize = $true; - $chckDocIcon.Name = "SPDocIcon" - $chckDocIcon.Checked = $true - $chckDocIcon.Text = "Doc Icons" - $panelConfig.Controls.Add($chckDocIcon); - - $chckFarmConfig = New-Object System.Windows.Forms.CheckBox - $chckFarmConfig.Top = 140 - $chckFarmConfig.AutoSize = $true; - $chckFarmConfig.Name = "SPFarm" - $chckFarmConfig.Checked = $true - $chckFarmConfig.Text = "Farm Configuration" - $panelConfig.Controls.Add($chckFarmConfig); - - $chckFarmPropBag = New-Object System.Windows.Forms.CheckBox - $chckFarmPropBag.Top = 160 - $chckFarmPropBag.AutoSize = $true; - $chckFarmPropBag.Name = "SPFarmPropertyBag" - $chckFarmPropBag.Checked = $true - $chckFarmPropBag.Text = "Farm Property Bag" - $panelConfig.Controls.Add($chckFarmPropBag); - - $chckFeature = New-Object System.Windows.Forms.CheckBox - $chckFeature.Top = 180 - $chckFeature.AutoSize = $true; - $chckFeature.Name = "SPFeature" - $chckFeature.Checked = $false - $chckFeature.Text = "Features" - $panelConfig.Controls.Add($chckFeature); - - $chckHealth = New-Object System.Windows.Forms.CheckBox - $chckHealth.Top = 200 - $chckHealth.AutoSize = $true; - $chckHealth.Name = "SPHealthAnalyzerRuleState" - $chckHealth.Checked = $false - $chckHealth.Text = "Health Analyzer Rule States" - $panelConfig.Controls.Add($chckHealth); - - $chckIRM = New-Object System.Windows.Forms.CheckBox - $chckIRM.Top = 220 - $chckIRM.AutoSize = $true; - $chckIRM.Name = "SPIrmSettings" - $chckIRM.Checked = $true - $chckIRM.Text = "Information Rights Management Settings" - $panelConfig.Controls.Add($chckIRM); - - $chckManagedPaths = New-Object System.Windows.Forms.CheckBox - $chckManagedPaths.Top = 240 - $chckManagedPaths.AutoSize = $true; - $chckManagedPaths.Name = "SPManagedPath" - $chckManagedPaths.Checked = $true - $chckManagedPaths.Text = "Managed Paths" - $panelConfig.Controls.Add($chckManagedPaths); - - $chckOOS = New-Object System.Windows.Forms.CheckBox - $chckOOS.Top = 260 - $chckOOS.AutoSize = $true; - $chckOOS.Name = "SPOfficeOnlineServerBinding" - $chckOOS.Checked = $true - $chckOOS.Text = "Office Online Server Bindings" - $panelConfig.Controls.Add($chckOOS); - - $chckOutgoingEmail = New-Object System.Windows.Forms.CheckBox - $chckOutgoingEmail.Top = 280 - $chckOutgoingEmail.AutoSize = $true; - $chckOutgoingEmail.Name = "SPOutgoingEmailSettings" - $chckOutgoingEmail.Checked = $true - $chckOutgoingEmail.Text = "Outgoing Email Settings" - $panelConfig.Controls.Add($chckOutgoingEmail); - - $chckServiceAppPool = New-Object System.Windows.Forms.CheckBox - $chckServiceAppPool.Top = 300 - $chckServiceAppPool.AutoSize = $true; - $chckServiceAppPool.Name = "SPServiceAppPool" - $chckServiceAppPool.Checked = $true - $chckServiceAppPool.Text = "Service Application Pools" - $panelConfig.Controls.Add($chckServiceAppPool); - - $chckServiceInstance = New-Object System.Windows.Forms.CheckBox - $chckServiceInstance.Top = 320 - $chckServiceInstance.AutoSize = $true; - $chckServiceInstance.Name = "SPServiceInstance" - $chckServiceInstance.Checked = $true - $chckServiceInstance.Text = "Service Instances" - $panelConfig.Controls.Add($chckServiceInstance); - - $chckSessionState = New-Object System.Windows.Forms.CheckBox - $chckSessionState.Top = 340 - $chckSessionState.AutoSize = $true; - $chckSessionState.Name = "SPSessionStateService" - $chckSessionState.Checked = $true - $chckSessionState.Text = "Session State Service" - $panelConfig.Controls.Add($chckSessionState); - - $chckDatabaseAAG = New-Object System.Windows.Forms.CheckBox - $chckDatabaseAAG.Top = 360 - $chckDatabaseAAG.AutoSize = $true; - $chckDatabaseAAG.Name = "SPDatabaseAAG" - $chckDatabaseAAG.Checked = $false - $chckDatabaseAAG.Text = "SQL Always On Availability Groups" - $panelConfig.Controls.Add($chckDatabaseAAG); - - $chckTimerJob = New-Object System.Windows.Forms.CheckBox - $chckTimerJob.Top = 380 - $chckTimerJob.AutoSize = $true; - $chckTimerJob.Name = "SPTimerJobState" - $chckTimerJob.Checked = $false - $chckTimerJob.Text = "Timer Job States" - $panelConfig.Controls.Add($chckTimerJob); + $align = 0 + foreach ($resource in $components.Configuration) + { + $checkbox = New-Object System.Windows.Forms.CheckBox + $checkbox.Top = $align + $checkbox.AutoSize = $true; + $checkbox.Name = $resource.Name + $checkbox.Text = $resource.Text + + $checked = $false + if ($resource.ExtractionMode -le 1) + { + $Global:liteComponents += $checkbox + } + + if ($resource.ExtractionMode -le 2) + { + $Global:defaultComponents += $checkbox + $checked = $true + } + $checkbox.Checked = $checked + + $panelConfig.Controls.Add($checkbox) + $align += 20 + } $panelMain.Controls.Add($panelConfig) - #endregion + #endregion Configuration #region User Profile Service $lblUPS = New-Object System.Windows.Forms.Label - $lblUPS.Top = $panelConfig.Height + $topBannerHeight + 40 + $lblUPS.Top = $panelConfig.Top + $panelConfig.Height + 10 $lblUPS.Text = "User Profile:" $lblUPS.AutoSize = $true $lblUPS.Left = $thirdColumnLeft @@ -1838,59 +1558,40 @@ function DisplayGUI() $panelMain.Controls.Add($lblUPS) $panelUPS = New-Object System.Windows.Forms.Panel - $panelUPS.Top = $panelConfig.Height + $topBannerHeight + 70 + $panelUPS.Top = $panelConfig.Top + $panelConfig.Height + 40 $panelUPS.Left = $thirdColumnLeft $panelUPS.AutoSize = $true $panelUPS.Width = 400 $panelUPS.BorderStyle = [System.Windows.Forms.BorderStyle]::FixedSingle - $chckUPSProp = New-Object System.Windows.Forms.CheckBox - $chckUPSProp.Top = 0 - $chckUPSProp.AutoSize = $true; - $chckUPSProp.Name = "SPUserProfileProperty" - $chckUPSProp.Checked = $false - $chckUPSProp.Text = "Profile Properties" - $panelUPS.Controls.Add($chckUPSProp); - - $chckUPSSection = New-Object System.Windows.Forms.CheckBox - $chckUPSSection.Top = 20 - $chckUPSSection.AutoSize = $true - $chckUPSSection.Name = "SPUserProfileSection" - $chckUPSSection.Checked = $false - $chckUPSSection.Text = "Profile Sections" - $panelUPS.Controls.Add($chckUPSSection); - - $chckUPSSync = New-Object System.Windows.Forms.CheckBox - $chckUPSSync.Top = 40 - $chckUPSSync.AutoSize = $true; - $chckUPSSync.Name = "SPUserProfileSyncConnection" - $chckUPSSync.Checked = $true - $chckUPSSync.Text = "Synchronization Connections" - $panelUPS.Controls.Add($chckUPSSync); - - $chckUPSA = New-Object System.Windows.Forms.CheckBox - $chckUPSA.Top = 60 - $chckUPSA.AutoSize = $true; - $chckUPSA.Name = "SPUserProfileServiceApp" - $chckUPSA.Checked = $true - $chckUPSA.Text = "User Profile Service Applications" - $panelUPS.Controls.Add($chckUPSA); - - $chckUPSPermissions = New-Object System.Windows.Forms.CheckBox - $chckUPSPermissions.Top = 80 - $chckUPSPermissions.AutoSize = $true; - $chckUPSPermissions.Name = "SPUserProfileServiceAppPermissions" - $chckUPSPermissions.Checked = $true - $chckUPSPermissions.Text = "User Profile Service Permissions" - $panelUPS.Controls.Add($chckUPSPermissions); + $align = 0 + foreach ($resource in $components.UserProfile) + { + $checkbox = New-Object System.Windows.Forms.CheckBox + $checkbox.Top = $align + $checkbox.AutoSize = $true; + $checkbox.Name = $resource.Name + $checkbox.Text = $resource.Text + + $checked = $false + if ($resource.ExtractionMode -le 1) + { + $Global:liteComponents += $checkbox + } - $panelMain.Controls.Add($panelUPS) - #endregion + if ($resource.ExtractionMode -le 2) + { + $Global:defaultComponents += $checkbox + $checked = $true + } + $checkbox.Checked = $checked - #region Extraction Modes - $Global:liteComponents = @($chckSAAccess, $chckSAAccess2010, $chckAlternateURL, $chckAntivirus, $chckAppCatalog, $chckAppDomain, $chckSAAppMan, $chckAppStore, $chckSABCS, $chckBlobCache, $chckCacheAccounts, $chckContentDB, $chckDiagLogging, $chckDistributedCache, $chckSAExcel, $chckFarmConfig, $chckFarmAdmin, $chckFarmPropBag, $chckFarmSolution, $chckIRM, $chckSAMachine, $chckManagedAccount, $chckSAMMS, $chckManagedPaths, $chckOutgoingEmail, $chckSAPerformance, $chckSAPublish, $chckQuotaTemplates, $chckSearchContentSource, $chckSearchIndexPart, $chckSearchSA, $chckSearchTopo, $chckSASecureStore, $chckServiceAppPool, $chckWAProxyGroup, $chckServiceInstance, $chckSAState, $chckSiteCollection, $chckSessionState, $chckSASub, $chckUPSA, $chckSAVisio, $chckWebApp, $chckWebAppPerm, $chckWebAppPolicy, $chckSAWord, $chckSAWork, $chckSearchIndexPart, $chckWAAppDomain, $chckSessionState, $chckSAUsage) - $Global:defaultComponents = @($chckSAAccess, $chckSAAccess2010, $chckAlternateURL, $chckAntivirus, $chckAppCatalog, $chckAppDomain, $chckSAAppMan, $chckAppStore, $chckSABCS, $chckBlobCache, $chckCacheAccounts, $chckContentDB, $chckDiagLogging, $chckDistributedCache, $chckDocIcon, $chckSAExcel, $chckFarmConfig, $chckFarmAdmin, $chckFarmPropBag, $chckFarmSolution, $chckIRM, $chckSAMachine, $chckManagedAccount, $chckSAMMS, $chckManagedPaths, $chckOutgoingEmail, $chckSAPerformance, $chckSAPublish, $chckQuotaTemplates, $chckSearchContentSource, $chckSearchIndexPart, $chckSearchSA, $chckSearchTopo, $chckSASecureStore, $chckServiceAppPool, $chckWAProxyGroup, $chckServiceInstance, $chckSAState, $chckSiteCollection, $chckSessionState, $chckSASub, $chckUPSA, $chckSAVisio, $chckWebApp, $chckWebAppPerm, $chckWebAppPolicy, $chckSAWord, $chckSAWork, $chckOOS, $chckPasswordChange, $chckRemoteTrust, $chckSearchCrawlerImpact, $chckSearchCrawlRule, $chckSearchResultSources, $chckSASecurity, $chckTrustedIdentity, $chckUPSPermissions, $chckUPSSync, $chckWABlockedFiles, $chckWAGeneral, $chckWAProxyGroup, $chckWADeletion, $chckWAThrottling, $chckWAWorkflow, $chckSearchIndexPart, $chckWAAppDomain, $chckWAExtension, $chckSessionState, $chckSAUsage) - #endregion + $panelUPS.Controls.Add($checkbox) + $align += 20 + } + + $panelMain.Controls.Add($panelUPS) + #endregion User Profile Service #region Top Menu $panelMenu = New-Object System.Windows.Forms.Panel @@ -2023,7 +1724,7 @@ function DisplayGUI() { foreach ($checkbox in ($panel.Controls | Where-Object { $_.GetType().Name -eq "Checkbox" })) { - if ($checkbox.Checked -and $checkbox.Name -NotIn @("chckRequiredUsers", "chckAzure", "chckRequiredUsers")) + if ($checkbox.Checked -and $checkbox.Name -NotIn @("chckRequiredUsers", "chckAzure", "chckStandAlone")) { $SelectedComponents += $checkbox.Name } @@ -2032,7 +1733,7 @@ function DisplayGUI() $form.Hide() $componentsToString = "@(`"$($SelectedComponents -join "`",`"")`")" Write-Host -Object "To execute the same extraction process unattended, run the following command:" -BackgroundColor DarkGreen -ForegroundColor White - Write-Host -Object "Start-SharePointDSCExtract -ComponentsToExtract $componentsToString -Credentials (Get-Credential)" + Write-Host -Object "Export-SPConfiguration -ComponentsToExtract $componentsToString -Credentials (Get-Credential)" $password = ConvertTo-SecureString $txtPassword.Text -AsPlainText -Force $credentials = New-Object System.Management.Automation.PSCredential ($txtFarmAccount.Text, $password) diff --git a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 index 4e53cbc5b..deafb90d3 100644 --- a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 +++ b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 @@ -1601,6 +1601,7 @@ function Export-SPConfiguration if ($null -eq $reverseDSCModule) { Write-Host "[ERROR} ReverseDsc v$($reverseDSCVersion.ToString()) could not be found. Make sure you have this module installed before running this cmdlet!" -ForegroundColor Red + Write-Host " " Write-Host "Install via:" -ForegroundColor Red Write-Host " Install-Module ReverseDsc -RequiredVersion $($reverseDSCVersion.ToString())" -ForegroundColor Red Write-Host "or" -ForegroundColor Red From 96fbf844d3d2a6105d92d9de6de903d3b3932698 Mon Sep 17 00:00:00 2001 From: Yorick Kuijs Date: Wed, 17 Mar 2021 12:34:41 +0100 Subject: [PATCH 07/14] Fixed #1288 --- CHANGELOG.md | 2 ++ .../MSFT_SPSearchManagedProperty.psm1 | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd175f7aa..0bcb1e6e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- SPSearchManagedProperty + - Fixed issue where setting Searchable=True resulted in an error - SPSearchResultSource - Clarified the use of ScopeName and ScopeUrl with SSA as ScopeName and added examples - SPUserProfileServiceApp diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchManagedProperty/MSFT_SPSearchManagedProperty.psm1 b/SharePointDsc/DSCResources/MSFT_SPSearchManagedProperty/MSFT_SPSearchManagedProperty.psm1 index 5fb18d3fa..daed035a0 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchManagedProperty/MSFT_SPSearchManagedProperty.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPSearchManagedProperty/MSFT_SPSearchManagedProperty.psm1 @@ -471,8 +471,10 @@ function Test-TargetResource "Retrievable", "Searchable", "Refinable", - "Searchable", + "Queryable", + 'TokenNormalization', "NoWordBreaker", + "CrawledProperties", "IncludeAllCrawledProperties", "Aliases", "Sortable", From 433e8b32a8cd831eff727195c44176cd52c68a4e Mon Sep 17 00:00:00 2001 From: Yorick Kuijs Date: Wed, 17 Mar 2021 16:31:58 +0100 Subject: [PATCH 08/14] Added verbose message to InstallLP --- .../MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 | 1 + 1 file changed, 1 insertion(+) diff --git a/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 b/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 index 7f121a668..cec1a1c2f 100644 --- a/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 @@ -174,6 +174,7 @@ function Get-TargetResource $languageEN = $parsedENProduct[0] } } + Write-Verbose "Installed Language Pack: $languageEN" $englishProducts += $languageEN } From f7aa35a76a4f75db8339eb403fc6a8049f92042e Mon Sep 17 00:00:00 2001 From: Yorick Kuijs Date: Wed, 17 Mar 2021 21:13:22 +0100 Subject: [PATCH 09/14] Fixed test issues --- RequiredModules.psd1 | 1 + .../SharePointDsc.Reverse.psm1 | 450 +++++++++++++++--- build.yaml | 2 + 3 files changed, 378 insertions(+), 75 deletions(-) diff --git a/RequiredModules.psd1 b/RequiredModules.psd1 index 567774a32..1ea9b203e 100644 --- a/RequiredModules.psd1 +++ b/RequiredModules.psd1 @@ -14,6 +14,7 @@ ModuleBuilder = 'latest' ChangelogManagement = 'latest' Sampler = 'latest' + 'Sampler.GitHubTasks' = 'latest' MarkdownLinkCheck = 'latest' 'DscResource.Common' = 'latest' 'DscResource.Test' = 'latest' diff --git a/SharePointDsc/Modules/SharePointDsc.Reverse/SharePointDsc.Reverse.psm1 b/SharePointDsc/Modules/SharePointDsc.Reverse/SharePointDsc.Reverse.psm1 index 0184048df..b1cddaa1b 100644 --- a/SharePointDsc/Modules/SharePointDsc.Reverse/SharePointDsc.Reverse.psm1 +++ b/SharePointDsc/Modules/SharePointDsc.Reverse/SharePointDsc.Reverse.psm1 @@ -1119,95 +1119,395 @@ function DisplayGUI() { $components = @{ InformationArchitecture = @( - @{ Name = "SPContentDatabase"; Text = "Content Database" ; ExtractionMode = 1 }, - @{ Name = "SPQuotaTemplate" ; Text = "Quota Templates" ; ExtractionMode = 1 }, - @{ Name = "SPSite" ; Text = "Site Collections (SPSite)"; ExtractionMode = 1 }, - @{ Name = "SPWeb" ; Text = "Subsites (SPWeb)" ; ExtractionMode = 3 } + @{ + Name = "SPContentDatabase" + Text = "Content Database" + ExtractionMode = 1 + }, + @{ + Name = "SPQuotaTemplate" + Text = "Quota Templates" + ExtractionMode = 1 + }, + @{ + Name = "SPSite" + Text = "Site Collections (SPSite)" + ExtractionMode = 1 + }, + @{ + Name = "SPWeb" + Text = "Subsites (SPWeb)" + ExtractionMode = 3 + } ) Security = @( - @{ Name = "SPFarmAdministrators" ; Text = "Farm Administrators" ; ExtractionMode = 1 }, - @{ Name = "SPManagedAccount" ; Text = "Managed Accounts" ; ExtractionMode = 1 }, - @{ Name = "SPPasswordChangeSettings" ; Text = "Password Change Settings" ; ExtractionMode = 2 }, - @{ Name = "SPRemoteFarmTrust" ; Text = "Remote Farm Trusts" ; ExtractionMode = 2 }, - @{ Name = "SPServiceAppSecurity" ; Text = "Service App Security" ; ExtractionMode = 2 }, - @{ Name = "SPTrustedIdentityTokenIssuer"; Text = "Trusted Identity Token Issuers"; ExtractionMode = 2 } + @{ + Name = "SPFarmAdministrators" + Text = "Farm Administrators" + ExtractionMode = 1 + }, + @{ + Name = "SPManagedAccount" + Text = "Managed Accounts" + ExtractionMode = 1 + }, + @{ + Name = "SPPasswordChangeSettings" + Text = "Password Change Settings" + ExtractionMode = 2 + }, + @{ + Name = "SPRemoteFarmTrust" + Text = "Remote Farm Trusts" + ExtractionMode = 2 + }, + @{ + Name = "SPServiceAppSecurity" + Text = "Service App Security" + ExtractionMode = 2 + }, + @{ + Name = "SPTrustedIdentityTokenIssuer" + Text = "Trusted Identity Token Issuers" + ExtractionMode = 2 + } ) ServiceApplications = @( - @{ Name = "SPAccessServiceApp" ; Text = "Access Services" ; ExtractionMode = 1 }, - @{ Name = "SPAccessServices2010" ; Text = "Access Services 2010" ; ExtractionMode = 1 }, - @{ Name = "SPAppManagementServiceApp" ; Text = "App Management" ; ExtractionMode = 1 }, - @{ Name = "SPBCSServiceApp" ; Text = "Business Connectivity Services"; ExtractionMode = 1 }, - @{ Name = "SPExcelServiceApp" ; Text = "Excel Services" ; ExtractionMode = 1 }, - @{ Name = "SPMachineTranslationServiceApp" ; Text = "Machine Translation" ; ExtractionMode = 1 }, - @{ Name = "SPManagedMetadataServiceApp" ; Text = "Managed Metadata" ; ExtractionMode = 1 }, - @{ Name = "SPPerformancePointServiceApp" ; Text = "PerformancePoint Services" ; ExtractionMode = 1 }, - @{ Name = "SPPublishServiceApplication" ; Text = "Publish" ; ExtractionMode = 1 }, - @{ Name = "SPSecureStoreServiceApp" ; Text = "Secure Store" ; ExtractionMode = 1 }, - @{ Name = "SPStateServiceApp" ; Text = "State Service Application" ; ExtractionMode = 1 }, - @{ Name = "SPSubscriptionSettingsServiceApp" ; Text = "Subscription Settings" ; ExtractionMode = 1 }, - @{ Name = "SPUsageApplication" ; Text = "Usage Service Applications" ; ExtractionMode = 1 }, - @{ Name = "SPVisioServiceApp" ; Text = "Visio Graphics" ; ExtractionMode = 1 }, - @{ Name = "SPWordAutomationServiceApp" ; Text = "Word Automation" ; ExtractionMode = 1 }, - @{ Name = "SPWorkManagementServiceApp" ; Text = "Work Management" ; ExtractionMode = 1 } + @{ + Name = "SPAccessServiceApp" + Text = "Access Services" + ExtractionMode = 1 + }, + @{ + Name = "SPAccessServices2010" + Text = "Access Services 2010" + ExtractionMode = 1 + }, + @{ + Name = "SPAppManagementServiceApp" + Text = "App Management" + ExtractionMode = 1 + }, + @{ + Name = "SPBCSServiceApp" + Text = "Business Connectivity Services" + ExtractionMode = 1 + }, + @{ + Name = "SPExcelServiceApp" + Text = "Excel Services" + ExtractionMode = 1 + }, + @{ + Name = "SPMachineTranslationServiceApp" + Text = "Machine Translation" + ExtractionMode = 1 + }, + @{ + Name = "SPManagedMetadataServiceApp" + Text = "Managed Metadata" + ExtractionMode = 1 + }, + @{ + Name = "SPPerformancePointServiceApp" + Text = "PerformancePoint Services" + ExtractionMode = 1 + }, + @{ + Name = "SPPublishServiceApplication" + Text = "Publish" + ExtractionMode = 1 + }, + @{ + Name = "SPSecureStoreServiceApp" + Text = "Secure Store" + ExtractionMode = 1 + }, + @{ + Name = "SPStateServiceApp" + Text = "State Service Application" + ExtractionMode = 1 + }, + @{ + Name = "SPSubscriptionSettingsServiceApp" + Text = "Subscription Settings" + ExtractionMode = 1 + }, + @{ + Name = "SPUsageApplication" + Text = "Usage Service Applications" + ExtractionMode = 1 + }, + @{ + Name = "SPVisioServiceApp" + Text = "Visio Graphics" + ExtractionMode = 1 + }, + @{ + Name = "SPWordAutomationServiceApp" + Text = "Word Automation" + ExtractionMode = 1 + }, + @{ + Name = "SPWorkManagementServiceApp" + Text = "Work Management" + ExtractionMode = 1 + } ) Search = @( - @{ Name = "SPSearchContentSource" ; Text = "Content Sources" ; ExtractionMode = 1 }, - @{ Name = "SPSearchCrawlRule" ; Text = "Crawl Rule" ; ExtractionMode = 2 }, - @{ Name = "SPSearchCrawlerImpactRule"; Text = "Crawler Impact Rules" ; ExtractionMode = 2 }, - @{ Name = "SPSearchFileType" ; Text = "File Types" ; ExtractionMode = 3 }, - @{ Name = "SPSearchIndexPartition" ; Text = "Index Partitions" ; ExtractionMode = 1 }, - @{ Name = "SPSearchManagedProperty" ; Text = "Managed Properties" ; ExtractionMode = 3 }, - @{ Name = "SPSearchResultSource" ; Text = "Result Sources" ; ExtractionMode = 2 }, - @{ Name = "SPSearchServiceApp" ; Text = "Search Service Applications"; ExtractionMode = 1 }, - @{ Name = "SPSearchTopology" ; Text = "Topologies" ; ExtractionMode = 1 } + @{ + Name = "SPSearchContentSource" + Text = "Content Sources" + ExtractionMode = 1 + }, + @{ + Name = "SPSearchCrawlRule" + Text = "Crawl Rule" + ExtractionMode = 2 + }, + @{ + Name = "SPSearchCrawlerImpactRule"; + Text = "Crawler Impact Rules" + ExtractionMode = 2 + }, + @{ + Name = "SPSearchFileType" + Text = "File Types" + ExtractionMode = 3 + }, + @{ + Name = "SPSearchIndexPartition" + Text = "Index Partitions" + ExtractionMode = 1 + }, + @{ + Name = "SPSearchManagedProperty" + Text = "Managed Properties" + ExtractionMode = 3 + }, + @{ + Name = "SPSearchResultSource" + Text = "Result Sources" + ExtractionMode = 2 + }, + @{ + Name = "SPSearchServiceApp" + Text = "Search Service Applications" + ExtractionMode = 1 + }, + @{ + Name = "SPSearchTopology" + Text = "Topologies" + ExtractionMode = 1 + } ) WebApplications = @( - @{ Name = "SPWebApplicationAppDomain" ; Text = "App Domain" ; ExtractionMode = 1 }, - @{ Name = "SPWebAppBlockedFileTypes" ; Text = "Blocked File Types" ; ExtractionMode = 2 }, - @{ Name = "SPWebApplicationExtension" ; Text = "Extensions" ; ExtractionMode = 2 }, - @{ Name = "SPWebAppGeneralSettings" ; Text = "General Settings" ; ExtractionMode = 2 }, - @{ Name = "SPWebAppPermissions" ; Text = "Permissions" ; ExtractionMode = 1 }, - @{ Name = "SPWebAppPolicy" ; Text = "Policies" ; ExtractionMode = 1 }, - @{ Name = "SPWebAppProxyGroup" ; Text = "Proxy Groups" ; ExtractionMode = 1 }, - @{ Name = "SPWebAppSiteUseAndDeletion"; Text = "Site Use And Deletion"; ExtractionMode = 2 }, - @{ Name = "SPWebAppThrottlingSettings"; Text = "Throttling Settings" ; ExtractionMode = 2 }, - @{ Name = "SPWebApplication" ; Text = "Web Applications" ; ExtractionMode = 1 }, - @{ Name = "SPWebAppWorkflowSettings" ; Text = "Workflow Settings" ; ExtractionMode = 2 } + @{ + Name = "SPWebApplicationAppDomain" + Text = "App Domain" + ExtractionMode = 1 + }, + @{ + Name = "SPWebAppBlockedFileTypes" + Text = "Blocked File Types" + ExtractionMode = 2 + }, + @{ + Name = "SPWebApplicationExtension" + Text = "Extensions" + ExtractionMode = 2 + }, + @{ + Name = "SPWebAppGeneralSettings" + Text = "General Settings" + ExtractionMode = 2 + }, + @{ + Name = "SPWebAppPermissions" + Text = "Permissions" + ExtractionMode = 1 + }, + @{ + Name = "SPWebAppPolicy" + Text = "Policies" + ExtractionMode = 1 + }, + @{ + Name = "SPWebAppProxyGroup" + Text = "Proxy Groups" + ExtractionMode = 1 + }, + @{ + Name = "SPWebAppSiteUseAndDeletion"; + Text = "Site Use And Deletion"; + ExtractionMode = 2 + }, + @{ + Name = "SPWebAppThrottlingSettings"; + Text = "Throttling Settings" + ExtractionMode = 2 + }, + @{ + Name = "SPWebApplication" + Text = "Web Applications" + ExtractionMode = 1 + }, + @{ + Name = "SPWebAppWorkflowSettings" + Text = "Workflow Settings" + ExtractionMode = 2 + } ) Customization = @( - @{ Name = "SPAppCatalog" ; Text = "App Catalog" ; ExtractionMode = 1 }, - @{ Name = "SPAppDomain" ; Text = "App Domain" ; ExtractionMode = 1 }, - @{ Name = "SPAppStoreSettings"; Text = "App Store Settings"; ExtractionMode = 1 }, - @{ Name = "SPFarmSolution" ; Text = "Farm Solutions" ; ExtractionMode = 1 } + @{ + Name = "SPAppCatalog" + Text = "App Catalog" + ExtractionMode = 1 + }, + @{ + Name = "SPAppDomain" + Text = "App Domain" + ExtractionMode = 1 + }, + @{ + Name = "SPAppStoreSettings" + Text = "App Store Settings" + ExtractionMode = 1 + }, + @{ + Name = "SPFarmSolution" + Text = "Farm Solutions" + ExtractionMode = 1 + } ) Configuration = @( - @{ Name = "SPAlternateUrl" ; Text = "Alternate Url" ; ExtractionMode = 1 }, - @{ Name = "SPAntivirusSettings" ; Text = "Antivirus Settings" ; ExtractionMode = 1 }, - @{ Name = "SPBlobCacheSettings" ; Text = "Blob Cache Settings" ; ExtractionMode = 1 }, - @{ Name = "SPCacheAccounts" ; Text = "Cache Accounts" ; ExtractionMode = 1 }, - @{ Name = "SPDiagnosticLoggingSettings"; Text = "Diagnostic Logging Settings" ; ExtractionMode = 1 }, - @{ Name = "SPDistributedCacheService" ; Text = "Distributed Cache Services" ; ExtractionMode = 1 }, - @{ Name = "SPDocIcon" ; Text = "Doc Icons" ; ExtractionMode = 2 }, - @{ Name = "SPFarm" ; Text = "Farm Configuration" ; ExtractionMode = 1 }, - @{ Name = "SPFarmPropertyBag" ; Text = "Farm Property Bag" ; ExtractionMode = 1 }, - @{ Name = "SPFeature" ; Text = "Features" ; ExtractionMode = 3 }, - @{ Name = "SPHealthAnalyzerRuleState" ; Text = "Health Analyzer Rule States" ; ExtractionMode = 3 }, - @{ Name = "SPIrmSettings" ; Text = "Information Rights Management Settings"; ExtractionMode = 1 }, - @{ Name = "SPManagedPath" ; Text = "Managed Paths" ; ExtractionMode = 1 }, - @{ Name = "SPOfficeOnlineServerBinding"; Text = "Office Online Server Bindings" ; ExtractionMode = 2 }, - @{ Name = "SPOutgoingEmailSettings" ; Text = "Outgoing Email Settings" ; ExtractionMode = 1 }, - @{ Name = "SPServiceAppPool" ; Text = "Service Application Pools" ; ExtractionMode = 1 }, - @{ Name = "SPServiceInstance" ; Text = "Service Instances" ; ExtractionMode = 1 }, - @{ Name = "SPSessionStateService" ; Text = "Session State Services" ; ExtractionMode = 1 }, - @{ Name = "SPDatabaseAAG" ; Text = "SQL Always On Availability Groups" ; ExtractionMode = 3 }, - @{ Name = "SPTimerJobState" ; Text = "Timer Job States" ; ExtractionMode = 3 } + @{ + Name = "SPAlternateUrl" + Text = "Alternate Url" + ExtractionMode = 1 + }, + @{ + Name = "SPAntivirusSettings" + Text = "Antivirus Settings" + ExtractionMode = 1 + }, + @{ + Name = "SPBlobCacheSettings" + Text = "Blob Cache Settings" + ExtractionMode = 1 + }, + @{ + Name = "SPCacheAccounts" + Text = "Cache Accounts" + ExtractionMode = 1 + }, + @{ + Name = "SPDiagnosticLoggingSettings"; + Text = "Diagnostic Logging Settings" + ExtractionMode = 1 + }, + @{ + Name = "SPDistributedCacheService" ; + Text = "Distributed Cache Services" + ExtractionMode = 1 + }, + @{ + Name = "SPDocIcon" + Text = "Doc Icons" + ExtractionMode = 2 + }, + @{ + Name = "SPFarm" + Text = "Farm Configuration" + ExtractionMode = 1 + }, + @{ + Name = "SPFarmPropertyBag" + Text = "Farm Property Bag" + ExtractionMode = 1 + }, + @{ + Name = "SPFeature" + Text = "Features" + ExtractionMode = 3 + }, + @{ + Name = "SPHealthAnalyzerRuleState" + Text = "Health Analyzer Rule States" + ExtractionMode = 3 + }, + @{ + Name = "SPIrmSettings" + Text = "Information Rights Management Settings" + ExtractionMode = 1 + }, + @{ + Name = "SPManagedPath" + Text = "Managed Paths" + ExtractionMode = 1 + }, + @{ + Name = "SPOfficeOnlineServerBinding"; + Text = "Office Online Server Bindings" + ExtractionMode = 2 + }, + @{ + Name = "SPOutgoingEmailSettings" + Text = "Outgoing Email Settings" + ExtractionMode = 1 + }, + @{ + Name = "SPServiceAppPool" + Text = "Service Application Pools" + ExtractionMode = 1 + }, + @{ + Name = "SPServiceInstance" + Text = "Service Instances" + ExtractionMode = 1 + }, + @{ + Name = "SPSessionStateService" + Text = "Session State Services" + ExtractionMode = 1 + }, + @{ + Name = "SPDatabaseAAG" + Text = "SQL Always On Availability Groups" + ExtractionMode = 3 + }, + @{ + Name = "SPTimerJobState" + Text = "Timer Job States" + ExtractionMode = 3 + } ) UserProfile = @( - @{ Name = "SPUserProfileProperty" ; Text = "Profile Properties" ; ExtractionMode = 3 }, - @{ Name = "SPUserProfileSection" ; Text = "Profile Sections" ; ExtractionMode = 3 }, - @{ Name = "SPUserProfileSyncConnection" ; Text = "Synchronization Connections" ; ExtractionMode = 2 }, - @{ Name = "SPUserProfileServiceApp" ; Text = "User Profile Service Applications"; ExtractionMode = 1 }, - @{ Name = "SPUserProfileServiceAppPermissions"; Text = "User Profile Service Permissions" ; ExtractionMode = 2 } + @{ + Name = "SPUserProfileProperty" + Text = "Profile Properties" + ExtractionMode = 3 + }, + @{ + Name = "SPUserProfileSection" + Text = "Profile Sections" + ExtractionMode = 3 + }, + @{ + Name = "SPUserProfileSyncConnection" + Text = "Synchronization Connections" + ExtractionMode = 2 + }, + @{ + Name = "SPUserProfileServiceApp" + Text = "User Profile Service Applications" + ExtractionMode = 1 + }, + @{ + Name = "SPUserProfileServiceAppPermissions" + Text = "User Profile Service Permissions" + ExtractionMode = 2 + } ) } diff --git a/build.yaml b/build.yaml index 808e4ff97..43aa9c661 100644 --- a/build.yaml +++ b/build.yaml @@ -99,6 +99,8 @@ DscTest: ModuleBuildTasks: Sampler: - '*.build.Sampler.ib.tasks' + Sampler.GitHubTasks: + - '*.ib.tasks' DscResource.DocGenerator: - 'Task.*' From 191f655f754d99980e11f3c3594d0a9b59525281 Mon Sep 17 00:00:00 2001 From: Yorick Kuijs Date: Wed, 17 Mar 2021 21:19:17 +0100 Subject: [PATCH 10/14] Added verbose message --- .../MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 b/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 index cec1a1c2f..fee02cb02 100644 --- a/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 @@ -219,7 +219,7 @@ function Get-TargetResource throw $message } - Write-Verbose -Message "Extract English name of the language code" + Write-Verbose -Message "Extract English name of the language code: $($cultureInfo.EnglishName)" switch ($cultureInfo.EnglishName) { "Dari (Afghanistan)" From 3108a7b2dd0993981bc1ba224902289b8ecaabb0 Mon Sep 17 00:00:00 2001 From: Yorick Kuijs Date: Mon, 22 Mar 2021 23:04:04 +0100 Subject: [PATCH 11/14] Fix alias error --- .../Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 index deafb90d3..c0b35d64f 100644 --- a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 +++ b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 @@ -1836,4 +1836,4 @@ function Export-SPDscDiagnosticData Write-Host ('Completed with export. Information exported to {0}' -f $exportFilename) -ForegroundColor Yellow } -New-Alias -Name Start-SharePointDSCExtract -Value Export-SPConfiguration +New-Alias -Name Start-SharePointDSCExtract -Value Export-SPConfiguration -Force From 00cda159aa58f893d1d54ae11b2574a0d38dc668 Mon Sep 17 00:00:00 2001 From: Yorick Kuijs Date: Tue, 23 Mar 2021 08:51:56 +0100 Subject: [PATCH 12/14] Fixed bug in Export function --- .../Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 index c0b35d64f..75b038376 100644 --- a/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 +++ b/SharePointDsc/Modules/SharePointDsc.Util/SharePointDsc.Util.psm1 @@ -1732,7 +1732,11 @@ function Export-SPDscDiagnosticData $sourceLogPath = Join-Path -Path $env:windir -ChildPath 'System32\Configuration\ConfigurationStatus' $items = Get-ChildItem -Path "$sourceLogPath\*.json" | Where-Object { $_.LastWriteTime -gt $afterDate } - Copy-Item -Path $items -Destination $logPath -ErrorAction 'SilentlyContinue' #-ErrorVariable $err + + if ($null -ne $items) + { + Copy-Item -Path $items -Destination $logPath -ErrorAction 'SilentlyContinue' #-ErrorVariable $err + } if ($Anonymize.IsPresent) { From 51f2e5d0ee72731c5e3dd12f9cb32e7f4eea501e Mon Sep 17 00:00:00 2001 From: Yorick Kuijs Date: Tue, 23 Mar 2021 21:45:29 +0100 Subject: [PATCH 13/14] Fixed #1296 --- CHANGELOG.md | 2 ++ .../MSFT_SPInstallLanguagePack.psm1 | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0bcb1e6e0..dbdd1c435 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- SPInstallLanguagePack + - Fixes issue in the Norwegian Language Pack detection - SPSearchManagedProperty - Fixed issue where setting Searchable=True resulted in an error - SPSearchResultSource diff --git a/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 b/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 index fee02cb02..1d6ca9416 100644 --- a/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 +++ b/SharePointDsc/DSCResources/MSFT_SPInstallLanguagePack/MSFT_SPInstallLanguagePack.psm1 @@ -250,7 +250,10 @@ function Get-TargetResource { $languageEnglish = "Serbian (Latin)" } - "Norwegian Bokmål (Norway)" + # If VS Code shows a strange character in Bokmål, this is correct. + # PowerShell encodes files in Windows-1252 and VSCode uses UTF8. + # This characters is therefore stored in Windows-1252. + "Norwegian Bokm�l (Norway)" { $languageEnglish = "Norwegian" } From 716cae5328f5e8dd1f6eb903ca58988869d64962 Mon Sep 17 00:00:00 2001 From: Yorick Kuijs Date: Wed, 24 Mar 2021 12:33:15 +0100 Subject: [PATCH 14/14] Corrected typo --- .../MSFT_SPSearchResultSource.schema.mof | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.schema.mof b/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.schema.mof index a724a89b3..51d9e4837 100644 --- a/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.schema.mof +++ b/SharePointDsc/DSCResources/MSFT_SPSearchResultSource/MSFT_SPSearchResultSource.schema.mof @@ -3,7 +3,7 @@ class MSFT_SPSearchResultSource : OMI_BaseResource { [Key, Description("The name of the result source")] String Name; [Key, Description("The scope at which the Result Source will be created. Options are SSA, SPSite or SPWeb"), ValueMap{"SSA","SPSite","SPWeb"}, Values{"SSA","SPSite","SPWeb"}] String ScopeName; - [Key, Description("The URI of the site where to create the result source. Use 'Global' is ScopeName is SSA")] String ScopeUrl; + [Key, Description("The URI of the site where to create the result source. Use 'Global' if ScopeName is SSA")] String ScopeUrl; [Required, Description("The name of the search service application to associate this result source with")] String SearchServiceAppName; [Required, Description("The query to pass to the provider source")] String Query; [Required, Description("The provider type to use for the result source")] String ProviderType;