diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 000000000..1ff0c4230
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln merge=binary
+#*.csproj merge=binary
+#*.vbproj merge=binary
+#*.vcxproj merge=binary
+#*.vcproj merge=binary
+#*.dbproj merge=binary
+#*.fsproj merge=binary
+#*.lsproj merge=binary
+#*.wixproj merge=binary
+#*.modelproj merge=binary
+#*.sqlproj merge=binary
+#*.wwaproj merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg binary
+#*.png binary
+#*.gif binary
+
+###############################################################################
+# diff behavior for common document formats
+#
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the
+# entries below.
+###############################################################################
+#*.doc diff=astextplain
+#*.DOC diff=astextplain
+#*.docx diff=astextplain
+#*.DOCX diff=astextplain
+#*.dot diff=astextplain
+#*.DOT diff=astextplain
+#*.pdf diff=astextplain
+#*.PDF diff=astextplain
+#*.rtf diff=astextplain
+#*.RTF diff=astextplain
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1
index c6e5f5c78..9e1190fbe 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPBCSServiceApp/MSFT_xSPBCSServiceApp.psm1
@@ -1,129 +1,129 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPool,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Getting BCS service app '$Name'"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
- Where-Object { $_.TypeName -eq "Business Data Connectivity Service Application" }
- If ($null -eq $serviceApp)
- {
- return @{}
- }
- else
- {
- return @{
- Name = $serviceApp.DisplayName
- ApplicationPool = $serviceApp.ApplicationPool.Name
- }
- }
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPool,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $DatabaseName,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $DatabaseServer,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -InstallAccount $InstallAccount
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
- if ($result.Count -eq 0) {
- Write-Verbose -Message "Creating BCS Service Application $Name"
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $params.Remove("InstallAccount") | Out-Null
- New-SPBusinessDataCatalogServiceApplication @params | Out-Null
- }
- }
- else {
- if ($ApplicationPool -ne $result.ApplicationPool) {
- Write-Verbose -Message "Updating BCS Service Application $Name"
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
- Where-Object { $_.TypeName -eq "Business Data Connectivity Service Application" }
- $serviceApp | Set-SPBusinessDataCatalogServiceApplication -ApplicationPool (Get-SPServiceApplicationPool $params.ApplicationPool)
- }
- }
- }
-}
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPool,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $DatabaseName,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $DatabaseServer,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
- $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -InstallAccount $InstallAccount
-
- Write-Verbose -Message "Testing for BCS Service Application '$Name'"
- if ($result.Count -eq 0) { return $false }
- else {
- if ($ApplicationPool -ne $result.ApplicationPool) { return $false }
- }
- return $true
-}
-
-Export-ModuleMember -Function *-TargetResource
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPool,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Getting BCS service app '$Name'"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
+ Where-Object { $_.TypeName -eq "Business Data Connectivity Service Application" }
+ If ($null -eq $serviceApp)
+ {
+ return @{}
+ }
+ else
+ {
+ return @{
+ Name = $serviceApp.DisplayName
+ ApplicationPool = $serviceApp.ApplicationPool.Name
+ }
+ }
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPool,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $DatabaseName,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $DatabaseServer,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -InstallAccount $InstallAccount
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+ if ($result.Count -eq 0) {
+ Write-Verbose -Message "Creating BCS Service Application $Name"
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $params.Remove("InstallAccount") | Out-Null
+ New-SPBusinessDataCatalogServiceApplication @params | Out-Null
+ }
+ }
+ else {
+ if ($ApplicationPool -ne $result.ApplicationPool) {
+ Write-Verbose -Message "Updating BCS Service Application $Name"
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
+ Where-Object { $_.TypeName -eq "Business Data Connectivity Service Application" }
+ $serviceApp | Set-SPBusinessDataCatalogServiceApplication -ApplicationPool (Get-SPServiceApplicationPool $params.ApplicationPool)
+ }
+ }
+ }
+}
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPool,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $DatabaseName,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $DatabaseServer,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+ $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -InstallAccount $InstallAccount
+
+ Write-Verbose -Message "Testing for BCS Service Application '$Name'"
+ if ($result.Count -eq 0) { return $false }
+ else {
+ if ($ApplicationPool -ne $result.ApplicationPool) { return $false }
+ }
+ return $true
+}
+
+Export-ModuleMember -Function *-TargetResource
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1
index 016af5fe8..60a1fd945 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCacheAccounts/MSFT_xSPCacheAccounts.psm1
@@ -1,134 +1,134 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $WebAppUrl,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $SuperUserAlias,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $SuperReaderAlias,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Getting cache accounts for $WebAppUrl"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $wa = Get-SPWebApplication $params.WebAppUrl -ErrorAction SilentlyContinue
-
- if ($null -eq $wa) { return @{} }
-
- $returnVal = @{}
- $returnVal.Add("WebAppUrl", $params.WebAppUrl)
- if ($wa.Properties.ContainsKey("portalsuperuseraccount")) {
- $returnVal.Add("portalsuperuseraccount", $wa.Properties["portalsuperuseraccount"])
- } else {
- $returnVal.Add("portalsuperuseraccount", "")
- }
- if ($wa.Properties.ContainsKey("portalsuperreaderaccount")) {
- $returnVal.Add("portalsuperreaderaccount", $wa.Properties["portalsuperreaderaccount"])
- } else {
- $returnVal.Add("portalsuperreaderaccount", "")
- }
-
- return $returnVal
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $WebAppUrl,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $SuperUserAlias,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $SuperReaderAlias,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Setting cache accounts for $WebAppUrl"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
-
- $params = $args[0]
-
- $wa = Get-SPWebApplication $params.WebAppUrl
-
- if ($wa.Properties.ContainsKey("portalsuperuseraccount")) {
- $wa.Properties["portalsuperuseraccount"] = $params.SuperUserAlias
- } else {
- $wa.Properties.Add("portalsuperuseraccount", $params.SuperUserAlias)
- }
- if ($wa.Properties.ContainsKey("portalsuperreaderaccount")) {
- $wa.Properties["portalsuperreaderaccount"] = $params.SuperReaderAlias
- } else {
- $wa.Properties.Add("portalsuperreaderaccount", $params.SuperReaderAlias)
- }
- $wa.Update()
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $WebAppUrl,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $SuperUserAlias,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $SuperReaderAlias,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- $result = Get-TargetResource -WebAppUrl $WebAppUrl -SuperUserAlias $SuperUserAlias -SuperReaderAlias $SuperReaderAlias -InstallAccount $InstallAccount
- Write-Verbose -Message "Testing cache accounts for $WebAppUrl"
-
- if ($result.Count -eq 0) { return $false }
- else {
- if ($SuperUserAlias -ne $result.portalsuperuseraccount) { return $false }
- if ($SuperReaderAlias -ne $result.portalsuperreaderaccount) { return $false }
- }
- return $true
-}
-
-Export-ModuleMember -Function *-TargetResource
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $WebAppUrl,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $SuperUserAlias,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $SuperReaderAlias,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Getting cache accounts for $WebAppUrl"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $wa = Get-SPWebApplication $params.WebAppUrl -ErrorAction SilentlyContinue
+
+ if ($null -eq $wa) { return @{} }
+
+ $returnVal = @{}
+ $returnVal.Add("WebAppUrl", $params.WebAppUrl)
+ if ($wa.Properties.ContainsKey("portalsuperuseraccount")) {
+ $returnVal.Add("portalsuperuseraccount", $wa.Properties["portalsuperuseraccount"])
+ } else {
+ $returnVal.Add("portalsuperuseraccount", "")
+ }
+ if ($wa.Properties.ContainsKey("portalsuperreaderaccount")) {
+ $returnVal.Add("portalsuperreaderaccount", $wa.Properties["portalsuperreaderaccount"])
+ } else {
+ $returnVal.Add("portalsuperreaderaccount", "")
+ }
+
+ return $returnVal
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $WebAppUrl,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $SuperUserAlias,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $SuperReaderAlias,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Setting cache accounts for $WebAppUrl"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+
+ $params = $args[0]
+
+ $wa = Get-SPWebApplication $params.WebAppUrl
+
+ if ($wa.Properties.ContainsKey("portalsuperuseraccount")) {
+ $wa.Properties["portalsuperuseraccount"] = $params.SuperUserAlias
+ } else {
+ $wa.Properties.Add("portalsuperuseraccount", $params.SuperUserAlias)
+ }
+ if ($wa.Properties.ContainsKey("portalsuperreaderaccount")) {
+ $wa.Properties["portalsuperreaderaccount"] = $params.SuperReaderAlias
+ } else {
+ $wa.Properties.Add("portalsuperreaderaccount", $params.SuperReaderAlias)
+ }
+ $wa.Update()
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $WebAppUrl,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $SuperUserAlias,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $SuperReaderAlias,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ $result = Get-TargetResource -WebAppUrl $WebAppUrl -SuperUserAlias $SuperUserAlias -SuperReaderAlias $SuperReaderAlias -InstallAccount $InstallAccount
+ Write-Verbose -Message "Testing cache accounts for $WebAppUrl"
+
+ if ($result.Count -eq 0) { return $false }
+ else {
+ if ($SuperUserAlias -ne $result.portalsuperuseraccount) { return $false }
+ if ($SuperReaderAlias -ne $result.portalsuperreaderaccount) { return $false }
+ }
+ return $true
+}
+
+Export-ModuleMember -Function *-TargetResource
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPClearRemoteSessions/MSFT_xSPClearRemoteSessions.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPClearRemoteSessions/MSFT_xSPClearRemoteSessions.psm1
index 61d96a2fe..8e359b001 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPClearRemoteSessions/MSFT_xSPClearRemoteSessions.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPClearRemoteSessions/MSFT_xSPClearRemoteSessions.psm1
@@ -9,7 +9,7 @@ function Get-TargetResource
$ClearRemoteSessions
)
- return Get-PSSession
+ return Get-PSSession -ComputerName "localhost"
}
@@ -23,7 +23,7 @@ function Set-TargetResource
$ClearRemoteSessions
)
- Get-PSSession | Remove-PSSession
+ Get-PSSession -ComputerName "localhost" | Remove-PSSession
}
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1
index bcdea92f4..54dc1448c 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1
@@ -1,176 +1,172 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $FarmConfigDatabaseName,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $DatabaseServer,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $FarmAccount,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $Passphrase,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $AdminContentDatabaseName,
-
- [System.UInt32]
- $CentralAdministrationPort
- )
-
- Write-Verbose -Message "Checking for local SP Farm"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ScriptBlock {
- try {
- $spFarm = Get-SPFarm -ErrorAction SilentlyContinue
- } catch {
- Write-Verbose -Message "Unable to detect local farm."
- }
-
- if ($null -eq $spFarm) {return @{ }}
-
- $returnValue = @{
- FarmName = $spFarm.Name
- }
- return $returnValue
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $FarmConfigDatabaseName,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $DatabaseServer,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $FarmAccount,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $Passphrase,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $AdminContentDatabaseName,
-
- [System.UInt32]
- $CentralAdministrationPort = 9999
- )
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- Write-Verbose -Message "Creating new configuration database"
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- New-SPConfigurationDatabase -DatabaseName $params.FarmConfigDatabaseName `
- -DatabaseServer $params.DatabaseServer `
- -Passphrase (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) `
- -FarmCredentials $params.FarmAccount `
- -SkipRegisterAsDistributedCacheHost:$true `
- -AdministrationContentDatabaseName $params.AdminContentDatabaseName
- }
-
- Write-Verbose -Message "Installing help collection"
- Invoke-Command -Session $session -ScriptBlock {
- Install-SPHelpCollection -All
- }
-
- Write-Verbose -Message "Initialising farm resource security"
- Invoke-Command -Session $session -ScriptBlock {
- Initialize-SPResourceSecurity
- }
-
- Write-Verbose -Message "Installing farm services"
- Invoke-Command -Session $session -ScriptBlock {
- Install-SPService
- }
-
- Write-Verbose -Message "Installing farm features"
- Invoke-Command -Session $session -ScriptBlock {
- Install-SPFeature -AllExistingFeatures -Force
- }
-
- Write-Verbose -Message "Creating Central Administration Website"
- Invoke-Command -Session $session -ScriptBlock {
- New-SPCentralAdministration -Port $params.CentralAdministrationPort -WindowsAuthProvider NTLM
- }
-
- Write-Verbose -Message "Installing application content"
- Invoke-Command -Session $session -ScriptBlock {
- Install-SPApplicationContent
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $FarmConfigDatabaseName,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $DatabaseServer,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $FarmAccount,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $Passphrase,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $AdminContentDatabaseName,
-
- [System.UInt32]
- $CentralAdministrationPort = 9999
- )
-
- $result = Get-TargetResource -FarmConfigDatabaseName $FarmConfigDatabaseName -DatabaseServer $DatabaseServer -FarmAccount $FarmAccount -InstallAccount $InstallAccount -Passphrase $Passphrase -AdminContentDatabaseName $AdminContentDatabaseName -CentralAdministrationPort $CentralAdministrationPort
-
- if ($result.Count -eq 0) { return $false }
- return $true
-}
-
-
-Export-ModuleMember -Function *-TargetResource
\ No newline at end of file
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $FarmConfigDatabaseName,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $DatabaseServer,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $FarmAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Passphrase,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $AdminContentDatabaseName,
+
+ [System.UInt32]
+ $CentralAdministrationPort
+ )
+
+ Write-Verbose -Message "Checking for local SP Farm"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ScriptBlock {
+ try {
+ $spFarm = Get-SPFarm -ErrorAction SilentlyContinue
+ } catch {
+ Write-Verbose -Message "Unable to detect local farm."
+ }
+
+ if ($null -eq $spFarm) {return @{ }}
+
+ $returnValue = @{
+ FarmName = $spFarm.Name
+ }
+ return $returnValue
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $FarmConfigDatabaseName,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $DatabaseServer,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $FarmAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Passphrase,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $AdminContentDatabaseName,
+
+ [System.UInt32]
+ $CentralAdministrationPort = 9999
+ )
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount -ForceNewSession $true
+
+ Write-Verbose -Message "Setting up farm"
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ $majorVersion = (Get-xSharePointAssemblyVerion -PathToAssembly "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.dll").Major
+ if ($majorVersion -eq 15) {
+ Write-Verbose -Message "Version: SharePoint 2013"
+
+ New-SPConfigurationDatabase -DatabaseName $params.FarmConfigDatabaseName `
+ -DatabaseServer $params.DatabaseServer `
+ -Passphrase (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) `
+ -FarmCredentials $params.FarmAccount `
+ -SkipRegisterAsDistributedCacheHost:$true `
+ -AdministrationContentDatabaseName $params.AdminContentDatabaseName
+ }
+ if ($majorVersion -eq 16) {
+ Write-Verbose -Message "Version: SharePoint 2016"
+
+ New-SPConfigurationDatabase -DatabaseName $params.FarmConfigDatabaseName `
+ -DatabaseServer $params.DatabaseServer `
+ -Passphrase (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) `
+ -FarmCredentials $params.FarmAccount `
+ -SkipRegisterAsDistributedCacheHost:$true `
+ -LocalServerRole Custom `
+ -AdministrationContentDatabaseName $params.AdminContentDatabaseName
+ }
+
+
+
+ Install-SPHelpCollection -All
+ Initialize-SPResourceSecurity
+ Install-SPService
+ Install-SPFeature -AllExistingFeatures -Force
+ New-SPCentralAdministration -Port 9999 -WindowsAuthProvider NTLM
+ Install-SPApplicationContent
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $FarmConfigDatabaseName,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $DatabaseServer,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $FarmAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Passphrase,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $AdminContentDatabaseName,
+
+ [System.UInt32]
+ $CentralAdministrationPort = 9999
+ )
+
+ $result = Get-TargetResource -FarmConfigDatabaseName $FarmConfigDatabaseName -DatabaseServer $DatabaseServer -FarmAccount $FarmAccount -InstallAccount $InstallAccount -Passphrase $Passphrase -AdminContentDatabaseName $AdminContentDatabaseName -CentralAdministrationPort $CentralAdministrationPort
+
+ if ($result.Count -eq 0) { return $false }
+ return $true
+}
+
+
+Export-ModuleMember -Function *-TargetResource
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof
index d51f8626e..0d04007d6 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof
@@ -1,13 +1,12 @@
-
-[ClassVersion("1.0.0.0"), FriendlyName("xSPCreateFarm")]
-class MSFT_xSPCreateFarm : OMI_BaseResource
-{
- [Key] String FarmConfigDatabaseName;
- [Key] String DatabaseServer;
- [Required, EmbeddedInstance("MSFT_Credential")] String FarmAccount;
- [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount;
- [Required] String Passphrase;
- [Required] String AdminContentDatabaseName;
- [Write] uint32 CentralAdministrationPort;
-};
-S
\ No newline at end of file
+
+[ClassVersion("1.0.0.0"), FriendlyName("xSPCreateFarm")]
+class MSFT_xSPCreateFarm : OMI_BaseResource
+{
+ [Key] String FarmConfigDatabaseName;
+ [Key] String DatabaseServer;
+ [Required, EmbeddedInstance("MSFT_Credential")] String FarmAccount;
+ [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount;
+ [Required] String Passphrase;
+ [Required] String AdminContentDatabaseName;
+ [Write] uint32 CentralAdministrationPort;
+};
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1
index 15cb5f850..e7f14f201 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.psm1
@@ -1,229 +1,229 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $LogPath,
-
- [parameter(Mandatory = $true)]
- [System.UInt32]
- $LogSpaceInGB,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Getting diagnostic configuration settings"
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ScriptBlock {
- $dc = Get-SPDiagnosticConfig -ErrorAction SilentlyContinue
- if ($null -eq $dc) { return @{} }
-
- return @{
- AllowLegacyTraceProviders = $dc.AllowLegacyTraceProviders
- AppAnalyticsAutomaticUploadEnabled = $dc.AppAnalyticsAutomaticUploadEnabled
- CustomerExperienceImprovementProgramEnabled = $dc.CustomerExperienceImprovementProgramEnabled
- ErrorReportingEnabled = $dc.ErrorReportingEnabled
- ErrorReportingAutomaticUploadEnabled = $dc.ErrorReportingAutomaticUploadEnabled
- DownloadErrorReportingUpdatesEnabled = $dc.DownloadErrorReportingUpdatesEnabled
- DaysToKeepLogs = $dc.DaysToKeepLogs
- LogMaxDiskSpaceUsageEnabled = $dc.LogMaxDiskSpaceUsageEnabled
- LogDiskSpaceUsageGB = $dc.LogDiskSpaceUsageGB
- LogLocation = $dc.LogLocation
- LogCutInterval = $dc.LogCutInterval
- EventLogFloodProtectionEnabled = $dc.EventLogFloodProtectionEnabled
- EventLogFloodProtectionThreshold = $dc.EventLogFloodProtectionThreshold
- EventLogFloodProtectionTriggerPeriod = $dc.EventLogFloodProtectionTriggerPeriod
- EventLogFloodProtectionQuietPeriod = $dc.EventLogFloodProtectionQuietPeriod
- EventLogFloodProtectionNotifyInterval = $dc.EventLogFloodProtectionNotifyInterval
- ScriptErrorReportingEnabled = $dc.ScriptErrorReportingEnabled
- ScriptErrorReportingRequireAuth = $dc.ScriptErrorReportingRequireAuth
- ScriptErrorReportingDelay = $dc.ScriptErrorReportingDelay
- }
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $LogPath,
-
- [parameter(Mandatory = $true)]
- [System.UInt32]
- $LogSpaceInGB,
-
- [System.Boolean]
- $AppAnalyticsAutomaticUploadEnabled = $true,
-
- [System.Boolean]
- $CustomerExperienceImprovementProgramEnabled = $true,
-
- [System.UInt32]
- $DaysToKeepLogs = 14,
-
- [System.Boolean]
- $DownloadErrorReportingUpdatesEnabled = $true,
-
- [System.Boolean]
- $ErrorReportingAutomaticUploadEnabled = $true,
-
- [System.Boolean]
- $ErrorReportingEnabled = $true,
-
- [System.Boolean]
- $EventLogFloodProtectionEnabled = $true,
-
- [System.UInt32]
- $EventLogFloodProtectionNotifyInterval = 5,
-
- [System.UInt32]
- $EventLogFloodProtectionQuietPeriod = 2,
-
- [System.UInt32]
- $EventLogFloodProtectionThreshold = 5,
-
- [System.UInt32]
- $EventLogFloodProtectionTriggerPeriod = 2,
-
- [System.UInt32]
- $LogCutInterval = 30,
-
- [System.Boolean]
- $LogMaxDiskSpaceUsageEnabled = $true,
-
- [System.UInt32]
- $ScriptErrorReportingDelay = 30,
-
- [System.Boolean]
- $ScriptErrorReportingEnabled = $true,
-
- [System.Boolean]
- $ScriptErrorReportingRequireAuth = $true,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Setting diagnostic configuration settings"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
-
- $params.Remove("InstallAccount") | Out-Null
- $params = Rename-xSharePointParamValue -params $params -oldName "LogPath" -newName "LogLocation"
- $params = Rename-xSharePointParamValue -params $params -oldName "LogSpaceInGB" -newName "LogDiskSpaceUsageGB"
-
- Set-SPDiagnosticConfig @params
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $LogPath,
-
- [parameter(Mandatory = $true)]
- [System.UInt32]
- $LogSpaceInGB,
-
- [System.Boolean]
- $AppAnalyticsAutomaticUploadEnabled = $true,
-
- [System.Boolean]
- $CustomerExperienceImprovementProgramEnabled = $true,
-
- [System.UInt32]
- $DaysToKeepLogs = 14,
-
- [System.Boolean]
- $DownloadErrorReportingUpdatesEnabled = $true,
-
- [System.Boolean]
- $ErrorReportingAutomaticUploadEnabled = $true,
-
- [System.Boolean]
- $ErrorReportingEnabled = $true,
-
- [System.Boolean]
- $EventLogFloodProtectionEnabled = $true,
-
- [System.UInt32]
- $EventLogFloodProtectionNotifyInterval = 5,
-
- [System.UInt32]
- $EventLogFloodProtectionQuietPeriod = 2,
-
- [System.UInt32]
- $EventLogFloodProtectionThreshold = 5,
-
- [System.UInt32]
- $EventLogFloodProtectionTriggerPeriod = 2,
-
- [System.UInt32]
- $LogCutInterval = 30,
-
- [System.Boolean]
- $LogMaxDiskSpaceUsageEnabled = $true,
-
- [System.UInt32]
- $ScriptErrorReportingDelay = 30,
-
- [System.Boolean]
- $ScriptErrorReportingEnabled = $true,
-
- [System.Boolean]
- $ScriptErrorReportingRequireAuth = $true,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Getting diagnostic configuration settings"
-
- $result = Get-TargetResource -LogPath $LogPath -LogSpaceInGB $LogSpaceInGB -InstallAccount $InstallAccount
- if ($LogPath -ne $result.LogLocation) { return $false }
- if ($LogSpaceInGB -ne $result.LogDiskSpaceUsageGB) { return $false }
-
- if ($AppAnalyticsAutomaticUploadEnabled -ne $result.AppAnalyticsAutomaticUploadEnabled) { return $false }
- if ($CustomerExperienceImprovementProgramEnabled -ne $result.CustomerExperienceImprovementProgramEnabled) { return $false }
- if ($DaysToKeepLogs -ne $result.DaysToKeepLogs) { return $false }
- if ($DownloadErrorReportingUpdatesEnabled -ne $result.DownloadErrorReportingUpdatesEnabled) { return $false }
- if ($ErrorReportingAutomaticUploadEnabled -ne $result.ErrorReportingAutomaticUploadEnabled) { return $false }
- if ($ErrorReportingEnabled -ne $result.ErrorReportingEnabled) { return $false }
- if ($EventLogFloodProtectionEnabled -ne $result.EventLogFloodProtectionEnabled) { return $false }
- if ($EventLogFloodProtectionNotifyInterval -ne $result.EventLogFloodProtectionNotifyInterval) { return $false }
- if ($EventLogFloodProtectionQuietPeriod -ne $result.EventLogFloodProtectionQuietPeriod) { return $false }
- if ($EventLogFloodProtectionThreshold -ne $result.EventLogFloodProtectionThreshold) { return $false }
- if ($EventLogFloodProtectionTriggerPeriod -ne $result.EventLogFloodProtectionTriggerPeriod) { return $false }
- if ($LogCutInterval -ne $result.LogCutInterval) { return $false }
- if ($LogMaxDiskSpaceUsageEnabled -ne $result.LogMaxDiskSpaceUsageEnabled) { return $false }
- if ($ScriptErrorReportingDelay -ne $result.ScriptErrorReportingDelay) { return $false }
- if ($ScriptErrorReportingEnabled -ne $result.ScriptErrorReportingEnabled) { return $false }
- if ($ScriptErrorReportingRequireAuth -ne $result.ScriptErrorReportingRequireAuth) { return $false }
- return $true
-}
-
-
-Export-ModuleMember -Function *-TargetResource
-
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $LogPath,
+
+ [parameter(Mandatory = $true)]
+ [System.UInt32]
+ $LogSpaceInGB,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Getting diagnostic configuration settings"
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ScriptBlock {
+ $dc = Get-SPDiagnosticConfig -ErrorAction SilentlyContinue
+ if ($null -eq $dc) { return @{} }
+
+ return @{
+ AllowLegacyTraceProviders = $dc.AllowLegacyTraceProviders
+ AppAnalyticsAutomaticUploadEnabled = $dc.AppAnalyticsAutomaticUploadEnabled
+ CustomerExperienceImprovementProgramEnabled = $dc.CustomerExperienceImprovementProgramEnabled
+ ErrorReportingEnabled = $dc.ErrorReportingEnabled
+ ErrorReportingAutomaticUploadEnabled = $dc.ErrorReportingAutomaticUploadEnabled
+ DownloadErrorReportingUpdatesEnabled = $dc.DownloadErrorReportingUpdatesEnabled
+ DaysToKeepLogs = $dc.DaysToKeepLogs
+ LogMaxDiskSpaceUsageEnabled = $dc.LogMaxDiskSpaceUsageEnabled
+ LogDiskSpaceUsageGB = $dc.LogDiskSpaceUsageGB
+ LogLocation = $dc.LogLocation
+ LogCutInterval = $dc.LogCutInterval
+ EventLogFloodProtectionEnabled = $dc.EventLogFloodProtectionEnabled
+ EventLogFloodProtectionThreshold = $dc.EventLogFloodProtectionThreshold
+ EventLogFloodProtectionTriggerPeriod = $dc.EventLogFloodProtectionTriggerPeriod
+ EventLogFloodProtectionQuietPeriod = $dc.EventLogFloodProtectionQuietPeriod
+ EventLogFloodProtectionNotifyInterval = $dc.EventLogFloodProtectionNotifyInterval
+ ScriptErrorReportingEnabled = $dc.ScriptErrorReportingEnabled
+ ScriptErrorReportingRequireAuth = $dc.ScriptErrorReportingRequireAuth
+ ScriptErrorReportingDelay = $dc.ScriptErrorReportingDelay
+ }
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $LogPath,
+
+ [parameter(Mandatory = $true)]
+ [System.UInt32]
+ $LogSpaceInGB,
+
+ [System.Boolean]
+ $AppAnalyticsAutomaticUploadEnabled = $true,
+
+ [System.Boolean]
+ $CustomerExperienceImprovementProgramEnabled = $true,
+
+ [System.UInt32]
+ $DaysToKeepLogs = 14,
+
+ [System.Boolean]
+ $DownloadErrorReportingUpdatesEnabled = $true,
+
+ [System.Boolean]
+ $ErrorReportingAutomaticUploadEnabled = $true,
+
+ [System.Boolean]
+ $ErrorReportingEnabled = $true,
+
+ [System.Boolean]
+ $EventLogFloodProtectionEnabled = $true,
+
+ [System.UInt32]
+ $EventLogFloodProtectionNotifyInterval = 5,
+
+ [System.UInt32]
+ $EventLogFloodProtectionQuietPeriod = 2,
+
+ [System.UInt32]
+ $EventLogFloodProtectionThreshold = 5,
+
+ [System.UInt32]
+ $EventLogFloodProtectionTriggerPeriod = 2,
+
+ [System.UInt32]
+ $LogCutInterval = 30,
+
+ [System.Boolean]
+ $LogMaxDiskSpaceUsageEnabled = $true,
+
+ [System.UInt32]
+ $ScriptErrorReportingDelay = 30,
+
+ [System.Boolean]
+ $ScriptErrorReportingEnabled = $true,
+
+ [System.Boolean]
+ $ScriptErrorReportingRequireAuth = $true,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Setting diagnostic configuration settings"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ $params.Remove("InstallAccount") | Out-Null
+ $params = Rename-xSharePointParamValue -params $params -oldName "LogPath" -newName "LogLocation"
+ $params = Rename-xSharePointParamValue -params $params -oldName "LogSpaceInGB" -newName "LogDiskSpaceUsageGB"
+
+ Set-SPDiagnosticConfig @params
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $LogPath,
+
+ [parameter(Mandatory = $true)]
+ [System.UInt32]
+ $LogSpaceInGB,
+
+ [System.Boolean]
+ $AppAnalyticsAutomaticUploadEnabled = $true,
+
+ [System.Boolean]
+ $CustomerExperienceImprovementProgramEnabled = $true,
+
+ [System.UInt32]
+ $DaysToKeepLogs = 14,
+
+ [System.Boolean]
+ $DownloadErrorReportingUpdatesEnabled = $true,
+
+ [System.Boolean]
+ $ErrorReportingAutomaticUploadEnabled = $true,
+
+ [System.Boolean]
+ $ErrorReportingEnabled = $true,
+
+ [System.Boolean]
+ $EventLogFloodProtectionEnabled = $true,
+
+ [System.UInt32]
+ $EventLogFloodProtectionNotifyInterval = 5,
+
+ [System.UInt32]
+ $EventLogFloodProtectionQuietPeriod = 2,
+
+ [System.UInt32]
+ $EventLogFloodProtectionThreshold = 5,
+
+ [System.UInt32]
+ $EventLogFloodProtectionTriggerPeriod = 2,
+
+ [System.UInt32]
+ $LogCutInterval = 30,
+
+ [System.Boolean]
+ $LogMaxDiskSpaceUsageEnabled = $true,
+
+ [System.UInt32]
+ $ScriptErrorReportingDelay = 30,
+
+ [System.Boolean]
+ $ScriptErrorReportingEnabled = $true,
+
+ [System.Boolean]
+ $ScriptErrorReportingRequireAuth = $true,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Getting diagnostic configuration settings"
+
+ $result = Get-TargetResource -LogPath $LogPath -LogSpaceInGB $LogSpaceInGB -InstallAccount $InstallAccount
+ if ($LogPath -ne $result.LogLocation) { return $false }
+ if ($LogSpaceInGB -ne $result.LogDiskSpaceUsageGB) { return $false }
+
+ if ($AppAnalyticsAutomaticUploadEnabled -ne $result.AppAnalyticsAutomaticUploadEnabled) { return $false }
+ if ($CustomerExperienceImprovementProgramEnabled -ne $result.CustomerExperienceImprovementProgramEnabled) { return $false }
+ if ($DaysToKeepLogs -ne $result.DaysToKeepLogs) { return $false }
+ if ($DownloadErrorReportingUpdatesEnabled -ne $result.DownloadErrorReportingUpdatesEnabled) { return $false }
+ if ($ErrorReportingAutomaticUploadEnabled -ne $result.ErrorReportingAutomaticUploadEnabled) { return $false }
+ if ($ErrorReportingEnabled -ne $result.ErrorReportingEnabled) { return $false }
+ if ($EventLogFloodProtectionEnabled -ne $result.EventLogFloodProtectionEnabled) { return $false }
+ if ($EventLogFloodProtectionNotifyInterval -ne $result.EventLogFloodProtectionNotifyInterval) { return $false }
+ if ($EventLogFloodProtectionQuietPeriod -ne $result.EventLogFloodProtectionQuietPeriod) { return $false }
+ if ($EventLogFloodProtectionThreshold -ne $result.EventLogFloodProtectionThreshold) { return $false }
+ if ($EventLogFloodProtectionTriggerPeriod -ne $result.EventLogFloodProtectionTriggerPeriod) { return $false }
+ if ($LogCutInterval -ne $result.LogCutInterval) { return $false }
+ if ($LogMaxDiskSpaceUsageEnabled -ne $result.LogMaxDiskSpaceUsageEnabled) { return $false }
+ if ($ScriptErrorReportingDelay -ne $result.ScriptErrorReportingDelay) { return $false }
+ if ($ScriptErrorReportingEnabled -ne $result.ScriptErrorReportingEnabled) { return $false }
+ if ($ScriptErrorReportingRequireAuth -ne $result.ScriptErrorReportingRequireAuth) { return $false }
+ return $true
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.schema.mof
index 7245dbbad..7a2665b76 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDiagnosticLoggingSettings/MSFT_xSPDiagnosticLoggingSettings.schema.mof
@@ -1,25 +1,25 @@
-
-[ClassVersion("1.0.0.0"), FriendlyName("xSPDiagnosticLoggingSettings")]
-class MSFT_xSPDiagnosticLoggingSettings : OMI_BaseResource
-{
- [Key] string LogPath;
- [Required] uint32 LogSpaceInGB;
- [Write] boolean AppAnalyticsAutomaticUploadEnabled;
- [Write] boolean CustomerExperienceImprovementProgramEnabled;
- [Write] uint32 DaysToKeepLogs;
- [Write] boolean DownloadErrorReportingUpdatesEnabled;
- [Write] boolean ErrorReportingAutomaticUploadEnabled;
- [Write] boolean ErrorReportingEnabled;
- [Write] boolean EventLogFloodProtectionEnabled;
- [Write] uint32 EventLogFloodProtectionNotifyInterval;
- [Write] uint32 EventLogFloodProtectionQuietPeriod;
- [Write] uint32 EventLogFloodProtectionThreshold;
- [Write] uint32 EventLogFloodProtectionTriggerPeriod;
- [Write] uint32 LogCutInterval;
- [Write] boolean LogMaxDiskSpaceUsageEnabled;
- [Write] uint32 ScriptErrorReportingDelay;
- [Write] boolean ScriptErrorReportingEnabled;
- [Write] boolean ScriptErrorReportingRequireAuth;
- [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount;
-};
-
+
+[ClassVersion("1.0.0.0"), FriendlyName("xSPDiagnosticLoggingSettings")]
+class MSFT_xSPDiagnosticLoggingSettings : OMI_BaseResource
+{
+ [Key] string LogPath;
+ [Required] uint32 LogSpaceInGB;
+ [Write] boolean AppAnalyticsAutomaticUploadEnabled;
+ [Write] boolean CustomerExperienceImprovementProgramEnabled;
+ [Write] uint32 DaysToKeepLogs;
+ [Write] boolean DownloadErrorReportingUpdatesEnabled;
+ [Write] boolean ErrorReportingAutomaticUploadEnabled;
+ [Write] boolean ErrorReportingEnabled;
+ [Write] boolean EventLogFloodProtectionEnabled;
+ [Write] uint32 EventLogFloodProtectionNotifyInterval;
+ [Write] uint32 EventLogFloodProtectionQuietPeriod;
+ [Write] uint32 EventLogFloodProtectionThreshold;
+ [Write] uint32 EventLogFloodProtectionTriggerPeriod;
+ [Write] uint32 LogCutInterval;
+ [Write] boolean LogMaxDiskSpaceUsageEnabled;
+ [Write] uint32 ScriptErrorReportingDelay;
+ [Write] boolean ScriptErrorReportingEnabled;
+ [Write] boolean ScriptErrorReportingRequireAuth;
+ [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount;
+};
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1
index ba1fc5f34..f71739057 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPDistributedCacheService/MSFT_xSPDistributedCacheService.psm1
@@ -1,192 +1,192 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [ValidateSet("Present","Absent")]
- [System.String]
- $Ensure,
-
- [parameter(Mandatory = $true)]
- [System.UInt32]
- $CacheSizeInMB,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ServiceAccount,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [System.Boolean]
- $CreateFirewallRules
- )
-
- Write-Verbose -Message "Getting the cache host information"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ScriptBlock {
- try
- {
- Use-CacheCluster -ErrorAction SilentlyContinue
- $cacheHost = Get-CacheHost -ErrorAction SilentlyContinue
- if ($null -eq $cacheHost) { return @{} }
- $cacheHostConfig = Get-AFCacheHostConfiguration -ComputerName $cacheHost.HostName -CachePort $cacheHost.PortNo -ErrorAction SilentlyContinue
- if ($null -eq $cacheHostConfig) { return @{} }
-
- return @{
- HostName = $cacheHost.HostName
- Port = $cacheHost.PortNo
- CacheSizeInMB = $cacheHostConfig.Size
- }
- }
- catch{
- return @{}
- }
- }
-
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [ValidateSet("Present","Absent")]
- [System.String]
- $Ensure,
-
- [parameter(Mandatory = $true)]
- [System.UInt32]
- $CacheSizeInMB,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ServiceAccount,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [System.Boolean]
- $CreateFirewallRules
- )
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- if ($Ensure -eq "Present") {
- Write-Verbose -Message "Adding the distributed cache to the server"
- if($createFirewallRules) {
- Write-Verbose -Message "Create a firewall rule for AppFabric"
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- Import-Module -Name NetSecurity
-
- $icmpRuleName = "File and Printer Sharing (Echo Request - ICMPv4-In)"
- $icmpPingFirewallRule = Get-NetFirewallRule -DisplayName $icmpRuleName -ErrorAction SilentlyContinue
- if($icmpPingFirewallRule) {
- Enable-NetFirewallRule -DisplayName $icmpRuleName
- }
- else {
- New-NetFirewallRule -Name Allow_Ping -DisplayName $icmpRuleName -Description "Allow ICMPv4 ping" -Protocol ICMPv4 -IcmpType 8 -Enabled True -Profile Any -Action Allow
- }
-
- $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distribute Cache" -ErrorAction SilentlyContinue
- if($null -eq $firewallRule) {
- New-NetFirewallRule -Name "SPDistCache" -DisplayName "SharePoint Distribute Cache" -Protocol TCP -LocalPort 22233-22236
- }
- Enable-NetFirewallRule -DisplayName "SharePoint Distribute Cache"
- }
- Write-Verbose -Message "Firewall rule added"
- }
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- Add-xSharePointDistributedCacheServer -CacheSizeInMB $params.CacheSizeInMB -ServiceAccount $params.ServiceAccount
- }
- } else {
- Write-Verbose -Message "Removing distributed cache to the server"
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- Remove-xSharePointDistributedCacheServer
- }
-
- $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distribute Cache" -ErrorAction SilentlyContinue
- if($null -eq $firewallRule) {
- Write-Verbose -Message "Disabling firewall rules."
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- Import-Module -Name NetSecurity
- Disable-NetFirewallRule -DisplayName -DisplayName "SharePoint Distribute Cache"
- }
- }
- Write-Verbose -Message "Distributed cache removed."
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [ValidateSet("Present","Absent")]
- [System.String]
- $Ensure,
-
- [parameter(Mandatory = $true)]
- [System.UInt32]
- $CacheSizeInMB,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ServiceAccount,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [System.Boolean]
- $createFirewallRules
- )
-
- $result = Get-TargetResource -Name $Name -Ensure $Ensure -CacheSizeInMB $CacheSizeInMB -ServiceAccount $ServiceAccount -InstallAccount $InstallAccount -CreateFirewallRules $createFirewallRules
-
- if ($Ensure -eq "Present") {
- if ($result.Count -eq 0) { return $false }
- else {
- if ($result.CacheSizeInMB -ne $CacheSizeInMB) { return $false }
- }
- return $true
- } else {
- if ($result.Count -eq 0) { return $true }
- return $false
- }
-}
-
-
-Export-ModuleMember -Function *-TargetResource
-
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [ValidateSet("Present","Absent")]
+ [System.String]
+ $Ensure,
+
+ [parameter(Mandatory = $true)]
+ [System.UInt32]
+ $CacheSizeInMB,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ServiceAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Boolean]
+ $CreateFirewallRules
+ )
+
+ Write-Verbose -Message "Getting the cache host information"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ScriptBlock {
+ try
+ {
+ Use-CacheCluster -ErrorAction SilentlyContinue
+ $cacheHost = Get-CacheHost -ErrorAction SilentlyContinue
+ if ($null -eq $cacheHost) { return @{} }
+ $cacheHostConfig = Get-AFCacheHostConfiguration -ComputerName $cacheHost.HostName -CachePort $cacheHost.PortNo -ErrorAction SilentlyContinue
+ if ($null -eq $cacheHostConfig) { return @{} }
+
+ return @{
+ HostName = $cacheHost.HostName
+ Port = $cacheHost.PortNo
+ CacheSizeInMB = $cacheHostConfig.Size
+ }
+ }
+ catch{
+ return @{}
+ }
+ }
+
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [ValidateSet("Present","Absent")]
+ [System.String]
+ $Ensure,
+
+ [parameter(Mandatory = $true)]
+ [System.UInt32]
+ $CacheSizeInMB,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ServiceAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Boolean]
+ $CreateFirewallRules
+ )
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ if ($Ensure -eq "Present") {
+ Write-Verbose -Message "Adding the distributed cache to the server"
+ if($createFirewallRules) {
+ Write-Verbose -Message "Create a firewall rule for AppFabric"
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ Import-Module -Name NetSecurity
+
+ $icmpRuleName = "File and Printer Sharing (Echo Request - ICMPv4-In)"
+ $icmpPingFirewallRule = Get-NetFirewallRule -DisplayName $icmpRuleName -ErrorAction SilentlyContinue
+ if($icmpPingFirewallRule) {
+ Enable-NetFirewallRule -DisplayName $icmpRuleName
+ }
+ else {
+ New-NetFirewallRule -Name Allow_Ping -DisplayName $icmpRuleName -Description "Allow ICMPv4 ping" -Protocol ICMPv4 -IcmpType 8 -Enabled True -Profile Any -Action Allow
+ }
+
+ $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distribute Cache" -ErrorAction SilentlyContinue
+ if($null -eq $firewallRule) {
+ New-NetFirewallRule -Name "SPDistCache" -DisplayName "SharePoint Distribute Cache" -Protocol TCP -LocalPort 22233-22236
+ }
+ Enable-NetFirewallRule -DisplayName "SharePoint Distribute Cache"
+ }
+ Write-Verbose -Message "Firewall rule added"
+ }
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ Add-xSharePointDistributedCacheServer -CacheSizeInMB $params.CacheSizeInMB -ServiceAccount $params.ServiceAccount
+ }
+ } else {
+ Write-Verbose -Message "Removing distributed cache to the server"
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ Remove-xSharePointDistributedCacheServer
+ }
+
+ $firewallRule = Get-NetFirewallRule -DisplayName "SharePoint Distribute Cache" -ErrorAction SilentlyContinue
+ if($null -eq $firewallRule) {
+ Write-Verbose -Message "Disabling firewall rules."
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ Import-Module -Name NetSecurity
+ Disable-NetFirewallRule -DisplayName -DisplayName "SharePoint Distribute Cache"
+ }
+ }
+ Write-Verbose -Message "Distributed cache removed."
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [ValidateSet("Present","Absent")]
+ [System.String]
+ $Ensure,
+
+ [parameter(Mandatory = $true)]
+ [System.UInt32]
+ $CacheSizeInMB,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ServiceAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Boolean]
+ $createFirewallRules
+ )
+
+ $result = Get-TargetResource -Name $Name -Ensure $Ensure -CacheSizeInMB $CacheSizeInMB -ServiceAccount $ServiceAccount -InstallAccount $InstallAccount -CreateFirewallRules $createFirewallRules
+
+ if ($Ensure -eq "Present") {
+ if ($result.Count -eq 0) { return $false }
+ else {
+ if ($result.CacheSizeInMB -ne $CacheSizeInMB) { return $false }
+ }
+ return $true
+ } else {
+ if ($result.Count -eq 0) { return $true }
+ return $false
+ }
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1
index b118a6a50..8bdcfce1d 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPFeature/MSFT_xSPFeature.psm1
@@ -1,151 +1,151 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [ValidateSet("Farm","WebApplication","Site","Web")]
- [System.String]
- $FeatureScope,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $Url,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [ValidateSet("Present","Absent")]
- [System.String]
- $Ensure
- )
-
- Write-Verbose -Message "Getting feature $Name at $FeatureScope scope"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $feature = Get-SPFeature $params.Name -ErrorAction SilentlyContinue
-
- if ($null -eq $feature) { return @{} }
-
- $checkParams = @{}
- $checkParams.Add("Identity", $params.Name)
- if ($FeatureScope -eq "Farm") {
- $checkParams.Add($params.FeatureScope, $true)
- } else {
- $checkParams.Add($params.FeatureScope, $params.Url)
- }
- $checkParams.Add("ErrorAction", "SilentlyContinue")
- $featureAtScope = Get-SPFeature @checkParams
- $enabled = ($null -ne $featureAtScope)
-
- return @{
- Name = $params.Name
- Id = $feature.Id
- Version = $feature.Version
- Enabled = $enabled
- }
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [ValidateSet("Farm","WebApplication","Site","Web")]
- [System.String]
- $FeatureScope,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $Url,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [ValidateSet("Present","Absent")]
- [System.String]
- $Ensure
- )
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
-
- $runParams = @{}
- $runParams.Add("Identity", $params.Name)
- if ($params.FeatureScope -ne "Farm") {
- $runParams.Add("Url", $params.Url)
- }
-
- if ($params.Ensure -eq "Present") {
- Enable-SPFeature @runParams
- } else {
- $runParams.Add("Confirm", $false)
- Disable-SPFeature @runParams
- }
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [ValidateSet("Farm","WebApplication","Site","Web")]
- [System.String]
- $FeatureScope,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $Url,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [ValidateSet("Present","Absent")]
- [System.String]
- $Ensure
- )
-
- $result = Get-TargetResource -Name $Name -FeatureScope $FeatureScope -Url $Url -InstallAccount $InstallAccount -Ensure $Ensure
- Write-Verbose -Message "Testing for feature $Name at $FeatureScope scope"
-
- if ($result.Count -eq 0) {
- throw "Unable to locate feature '$Name' in the current SharePoint farm, check that the name is correct and that the feature has been deployed to the file system."
- } else {
- if ($Ensure -eq "Present" -and $result.Enabled -eq $false) { return $false }
- if ($Ensure -eq "Absent" -and $result.Enabled -eq $true) { return $false }
- }
- return $true
-}
-Export-ModuleMember -Function *-TargetResource
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [ValidateSet("Farm","WebApplication","Site","Web")]
+ [System.String]
+ $FeatureScope,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Url,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [ValidateSet("Present","Absent")]
+ [System.String]
+ $Ensure
+ )
+
+ Write-Verbose -Message "Getting feature $Name at $FeatureScope scope"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $feature = Get-SPFeature $params.Name -ErrorAction SilentlyContinue
+
+ if ($null -eq $feature) { return @{} }
+
+ $checkParams = @{}
+ $checkParams.Add("Identity", $params.Name)
+ if ($FeatureScope -eq "Farm") {
+ $checkParams.Add($params.FeatureScope, $true)
+ } else {
+ $checkParams.Add($params.FeatureScope, $params.Url)
+ }
+ $checkParams.Add("ErrorAction", "SilentlyContinue")
+ $featureAtScope = Get-SPFeature @checkParams
+ $enabled = ($null -ne $featureAtScope)
+
+ return @{
+ Name = $params.Name
+ Id = $feature.Id
+ Version = $feature.Version
+ Enabled = $enabled
+ }
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [ValidateSet("Farm","WebApplication","Site","Web")]
+ [System.String]
+ $FeatureScope,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Url,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [ValidateSet("Present","Absent")]
+ [System.String]
+ $Ensure
+ )
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ $runParams = @{}
+ $runParams.Add("Identity", $params.Name)
+ if ($params.FeatureScope -ne "Farm") {
+ $runParams.Add("Url", $params.Url)
+ }
+
+ if ($params.Ensure -eq "Present") {
+ Enable-SPFeature @runParams
+ } else {
+ $runParams.Add("Confirm", $false)
+ Disable-SPFeature @runParams
+ }
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [ValidateSet("Farm","WebApplication","Site","Web")]
+ [System.String]
+ $FeatureScope,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Url,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [ValidateSet("Present","Absent")]
+ [System.String]
+ $Ensure
+ )
+
+ $result = Get-TargetResource -Name $Name -FeatureScope $FeatureScope -Url $Url -InstallAccount $InstallAccount -Ensure $Ensure
+ Write-Verbose -Message "Testing for feature $Name at $FeatureScope scope"
+
+ if ($result.Count -eq 0) {
+ throw "Unable to locate feature '$Name' in the current SharePoint farm, check that the name is correct and that the feature has been deployed to the file system."
+ } else {
+ if ($Ensure -eq "Present" -and $result.Enabled -eq $false) { return $false }
+ if ($Ensure -eq "Absent" -and $result.Enabled -eq $true) { return $false }
+ }
+ return $true
+}
+Export-ModuleMember -Function *-TargetResource
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1
index 35ca2bcc0..a239118c4 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.psm1
@@ -1,94 +1,102 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $BinaryDir,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ProductKey
- )
-
- Write-Verbose -Message "Getting install status of SP binaries"
-
- $spInstall = Get-CimInstance -ClassName Win32_Product -Filter "Name like 'Microsoft SharePoint Server%'"
- $result = ($null -ne $spInstall)
- $returnValue = @{
- SharePointInstalled = $result
- }
-
- $returnValue
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $BinaryDir,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ProductKey
- )
-
- Write-Verbose -Message "Writing install config file"
-
- $configPath = "$env:temp\SPInstallConfig.xml"
-
-"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-" | Out-File -FilePath $configPath
-
- Write-Verbose -Message "Begining installation of SharePoint"
-
- $setupExe = Join-Path -Path $BinaryDir -ChildPath "setup.exe"
-
- Start-Process -FilePath $setupExe -ArgumentList "/config `"$configPath`"" -Wait
-
- Write-Verbose -Message "SharePoint binary installation complete"
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $BinaryDir,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ProductKey
- )
-
- $result = Get-TargetResource -BinaryDir $BinaryDir -ProductKey $ProductKey
- Write-Verbose -Message "Testing for installation of SharePoint"
- $result.SharePointInstalled
-}
-
-Export-ModuleMember -Function *-TargetResource
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $BinaryDir,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ProductKey
+ )
+
+ Write-Verbose -Message "Getting install status of SP binaries"
+
+ $spInstall = Get-CimInstance -ClassName Win32_Product -Filter "Name like 'Microsoft SharePoint Server%'"
+ $result = ($null -ne $spInstall)
+ $returnValue = @{
+ SharePointInstalled = $result
+ }
+
+ $returnValue
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $BinaryDir,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ProductKey
+ )
+
+ Write-Verbose -Message "Writing install config file"
+
+ $configPath = "$env:temp\SPInstallConfig.xml"
+
+"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+" | Out-File -FilePath $configPath
+
+ Write-Verbose -Message "Begining installation of SharePoint"
+
+ $setupExe = Join-Path -Path $BinaryDir -ChildPath "setup.exe"
+
+ $setup = Start-Process -FilePath $setupExe -ArgumentList "/config `"$configPath`"" -Wait -PassThru
+
+ if ($setup.ExitCode -eq 0) {
+ Write-Verbose -Message "SharePoint binary installation complete"
+ $global:DSCMachineStatus = 1
+ }
+ else
+ {
+ throw "SharePoint install failed, exit code was $($setup.ExitCode)"
+ }
+
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $BinaryDir,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ProductKey
+ )
+
+ $result = Get-TargetResource -BinaryDir $BinaryDir -ProductKey $ProductKey
+ Write-Verbose -Message "Testing for installation of SharePoint"
+ $result.SharePointInstalled
+}
+
+Export-ModuleMember -Function *-TargetResource
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.schema.mof
index 32bbc54da..eb1894f59 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstall/MSFT_xSPInstall.schema.mof
@@ -1,7 +1,7 @@
-[ClassVersion("1.0.0.0"), FriendlyName("xSPInstall")]
-class MSFT_xSPInstall : OMI_BaseResource
-{
- [Key] String BinaryDir;
- [Required] String ProductKey;
-};
-
+[ClassVersion("1.0.0.0"), FriendlyName("xSPInstall")]
+class MSFT_xSPInstall : OMI_BaseResource
+{
+ [Key] String BinaryDir;
+ [Required] String ProductKey;
+};
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1
index b08236228..9429e566c 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1
@@ -1,157 +1,205 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $InstallerPath
- )
-
- $returnValue = @{}
-
- Write-Verbose -Message "Getting installed windows features"
- $WindowsFeatures = Get-WindowsFeature -Name Net-Framework-Features,Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Security,Web-Basic-Auth,Web-Windows-Auth,Web-Filtering,Web-Digest-Auth,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Application-Server,AS-Web-Support,AS-TCP-Port-Sharing,AS-WAS-Support, AS-HTTP-Activation,AS-TCP-Activation,AS-Named-Pipes,AS-Net-Framework,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Web-Lgcy-Scripting,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer
- foreach ($feature in $WindowsFeatures) {
- $returnValue.Add($feature.Name, $feature.Installed)
- }
-
- Write-Verbose -Message "Checking windows packages"
- $installedItems = Get-CimInstance -ClassName Win32_Product
- #TODO: Ensure this checks for all prereqs, believe this list is missing a couple
- #TODO: Check the list on other operating systems, this was tested on 2012 R2
- $returnValue.Add("Microsoft SQL Server 2008 R2 Native Client", (($installedItems | ? {$_.Name -eq "Microsoft SQL Server 2008 R2 Native Client"}) -ne $null))
- $returnValue.Add("Microsoft Sync Framework Runtime v1.0 SP1 (x64)", (($installedItems | ? {$_.Name -eq "Microsoft Sync Framework Runtime v1.0 SP1 (x64)"}) -ne $null))
- $returnValue.Add("AppFabric 1.1 for Windows Server", (($installedItems | ? {$_.Name -eq "AppFabric 1.1 for Windows Server"}) -ne $null))
-
- # Detect Identity extensions from the registry as depending on the user that installed it may not appear in the WmiObject call
- $returnValue.Add("Microsoft Identity Extensions", (@(Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\ -Recurse | ? {$_.GetValue("DisplayName") -eq "Microsoft Identity Extensions" }).Count -gt 0))
- $returnValue.Add("Active Directory Rights Management Services Client 2.0", (($installedItems | ? {$_.Name -eq "Active Directory Rights Management Services Client 2.0"}) -ne $null))
- $returnValue.Add("WCF Data Services 5.0 (for OData v3) Primary Components", (($installedItems | ? {$_.Name -eq "WCF Data Services 5.0 (for OData v3) Primary Components"}) -ne $null))
- $returnValue.Add("WCF Data Services 5.6.0 Runtime", (($installedItems | ? {$_.Name -eq "WCF Data Services 5.6.0 Runtime"}) -ne $null))
- $returnValue.Add("Microsoft CCR and DSS Runtime 2008 R3", (($installedItems | ? {$_.Name -eq "Microsoft CCR and DSS Runtime 2008 R3"}) -ne $null))
-
- $returnValue
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $InstallerPath,
- [System.Boolean]
- $OnlineMode = $true,
- [System.String]
- $SQLNCli = [System.String]::Empty,
- [System.String]
- $PowerShell = [System.String]::Empty,
- [System.String]
- $NETFX = [System.String]::Empty,
- [System.String]
- $IDFX = [System.String]::Empty,
- [System.String]
- $Sync = [System.String]::Empty,
- [System.String]
- $AppFabric = [System.String]::Empty,
- [System.String]
- $IDFX11 = [System.String]::Empty,
- [System.String]
- $MSIPCClient = [System.String]::Empty,
- [System.String]
- $WCFDataServices = [System.String]::Empty,
- [System.String]
- $KB2671763 = [System.String]::Empty,
- [System.String]
- $WCFDataServices56 = [System.String]::Empty
- )
-
- if ($OnlineMode -eq $false) {
- if ([string]::IsNullOrEmpty($SQLNCli)) { throw "In offline mode parameter SQLNCli is required" }
- if ([string]::IsNullOrEmpty($PowerShell)) { throw "In offline mode parameter PowerShell is required" }
- if ([string]::IsNullOrEmpty($NETFX)) { throw "In offline mode parameter NETFX is required" }
- if ([string]::IsNullOrEmpty($IDFX)) { throw "In offline mode parameter IDFX is required" }
- if ([string]::IsNullOrEmpty($Sync)) { throw "In offline mode Sync SQLNCli is required" }
- if ([string]::IsNullOrEmpty($AppFabric)) { throw "In offline mode parameter AppFabric is required" }
- if ([string]::IsNullOrEmpty($IDFX11)) { throw "In offline mode parameter IDFX11 is required" }
- if ([string]::IsNullOrEmpty($MSIPCClient)) { throw "In offline mode parameter MSIPCClient is required" }
- if ([string]::IsNullOrEmpty($WCFDataServices)) { throw "In offline mode parameter WCFDataServices is required" }
- if ([string]::IsNullOrEmpty($KB2671763)) { throw "In offline mode parameter KB2671763 is required" }
- if ([string]::IsNullOrEmpty($WCFDataServices56)) { throw "In offline mode parameter WCFDataServices56 is required" }
- }
-
- Write-Verbose -Message "Calling the SharePoint Pre-req installer"
-
- if ($OnlineMode) {
- $args = "/unattended"
- } else {
- $args = "/unattended /SQLNCli:`"$SQLNCli`" /PowerShell:`"$PowerShell`" /NETFX:`"$NETFX`" /IDFX:`"$IDFX`" /Sync:`"$Sync`" /AppFabric:`"$AppFabric`" /IDFX11:`"$IDFX11`" /MSIPCClient:`"$MSIPCClient`" /WCFDataServices:`"$WCFDataServices`" /KB2671763:`"$KB2671763`" /WCFDataServices56:`"$WCFDataServices56`""
- }
- Write-Verbose -Message "Args for prereq installer are: $args"
- $process = Start-Process -FilePath $InstallerPath -ArgumentList $args -Wait
-
- switch ($process.ExitCode) {
- 0 {
- Write-Verbose -Message "Installer completed successfully"
- }
- default {
- $code = $process.ExitCode
- Write-Verbose -Message "Machine needs reboot, exit code was $code"
- $global:DSCMachineStatus = 1
- }
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $InstallerPath,
- [System.Boolean]
- $OnlineMode = $true,
- [System.String]
- $SQLNCli = [System.String]::Empty,
- [System.String]
- $PowerShell = [System.String]::Empty,
- [System.String]
- $NETFX = [System.String]::Empty,
- [System.String]
- $IDFX = [System.String]::Empty,
- [System.String]
- $Sync = [System.String]::Empty,
- [System.String]
- $AppFabric = [System.String]::Empty,
- [System.String]
- $IDFX11 = [System.String]::Empty,
- [System.String]
- $MSIPCClient = [System.String]::Empty,
- [System.String]
- $WCFDataServices = [System.String]::Empty,
- [System.String]
- $KB2671763 = [System.String]::Empty,
- [System.String]
- $WCFDataServices56 = [System.String]::Empty
- )
-
-
- $result = Get-TargetResource -InstallerPath $InstallerPath
- Write-Verbose -Message "Checking installation of SharePoint prerequisites"
- if (($result.Values | Where-Object { $_ -eq $false }).Count -gt 0) {
- Write-Verbose -Message "Prerequisites were detected as missing."
- return $false
- }
-
- return $true
-}
-
-Export-ModuleMember -Function *-TargetResource
-
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $InstallerPath
+ )
+
+ $returnValue = @{}
+ Write-Verbose -Message "Detecting SharePoint version from binaries"
+ $majorVersion = (Get-xSharePointAssemblyVerion -PathToAssembly $InstallerPath).Major
+ if ($majorVersion -eq 15) {
+ Write-Verbose -Message "Version: SharePoint 2013"
+ }
+ if ($majorVersion -eq 16) {
+ Write-Verbose -Message "Version: SharePoint 2016"
+ }
+
+ Write-Verbose -Message "Getting installed windows features"
+
+ if ($majorVersion -eq 15) {
+ $WindowsFeatures = Get-WindowsFeature -Name Net-Framework-Features,Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Security,Web-Basic-Auth,Web-Windows-Auth,Web-Filtering,Web-Digest-Auth,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Application-Server,AS-Web-Support,AS-TCP-Port-Sharing,AS-WAS-Support, AS-HTTP-Activation,AS-TCP-Activation,AS-Named-Pipes,AS-Net-Framework,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Web-Lgcy-Scripting,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer
+ }
+ if ($majorVersion -eq 16) {
+ $WindowsFeatures = Get-WindowsFeature -Name Application-Server,AS-NET-Framework,AS-Web-Support,Web-Server,Web-WebServer,Web-Common-Http,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-Static-Content,Web-Http-Redirect,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Security,Web-Filtering,Web-Basic-Auth,Web-Client-Auth,Web-Digest-Auth,Web-Cert-Auth,Web-IP-Security,Web-Url-Auth,Web-Windows-Auth,Web-App-Dev,Web-Net-Ext,Web-Net-Ext45,Web-Asp-Net45,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Web-Lgcy-Mgmt-Console,Web-Lgcy-Scripting,Web-WMI,Web-Scripting-Tools,NET-Framework-Features,NET-Framework-Core,NET-HTTP-Activation,NET-Non-HTTP-Activ,NET-Framework-45-ASPNET,NET-WCF-HTTP-Activation45,Windows-Identity-Foundation,PowerShell-V2,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs
+ }
+ foreach ($feature in $WindowsFeatures) {
+ $returnValue.Add($feature.Name, $feature.Installed)
+ }
+
+ Write-Verbose -Message "Checking windows packages"
+ $installedItems = Get-CimInstance -ClassName Win32_Product
+
+ #Common prereqs
+ $returnValue.Add("Microsoft Identity Extensions", (@(Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\ -Recurse | ? {$_.GetValue("DisplayName") -eq "Microsoft Identity Extensions" }).Count -gt 0))
+ $returnValue.Add("Microsoft CCR and DSS Runtime 2008 R3", (($installedItems | ? {$_.Name -eq "Microsoft CCR and DSS Runtime 2008 R3"}) -ne $null))
+ $returnValue.Add("Microsoft Sync Framework Runtime v1.0 SP1 (x64)", (($installedItems | ? {$_.Name -eq "Microsoft Sync Framework Runtime v1.0 SP1 (x64)"}) -ne $null))
+ $returnValue.Add("AppFabric 1.1 for Windows Server", (($installedItems | ? {$_.Name -eq "AppFabric 1.1 for Windows Server"}) -ne $null))
+ $returnValue.Add("WCF Data Services 5.6.0 Runtime", (($installedItems | ? {$_.Name -eq "WCF Data Services 5.6.0 Runtime"}) -ne $null))
+
+ #SP2013 prereqs
+ if ($majorVersion -eq 15) {
+ $returnValue.Add("WCF Data Services 5.0 (for OData v3) Primary Components", (($installedItems | ? {$_.Name -eq "WCF Data Services 5.0 (for OData v3) Primary Components"}) -ne $null))
+ $returnValue.Add("Microsoft SQL Server 2008 R2 Native Client", (($installedItems | ? {$_.Name -eq "Microsoft SQL Server 2008 R2 Native Client"}) -ne $null))
+ $returnValue.Add("Active Directory Rights Management Services Client 2.0", (($installedItems | ? {$_.Name -eq "Active Directory Rights Management Services Client 2.0"}) -ne $null))
+ }
+
+ #SP2016 prereqs
+ if ($majorVersion -eq 16) {
+ $returnValue.Add("Microsoft ODBC Driver 11 for SQL Server", (($installedItems | ? {$_.Name -eq "Microsoft ODBC Driver 11 for SQL Server"}) -ne $null))
+ $returnValue.Add("Microsoft Visual C++ 2013 x64 Minimum Runtime - 12.0.21005", (($installedItems | ? {$_.Name -eq "Microsoft Visual C++ 2013 x64 Minimum Runtime - 12.0.21005"}) -ne $null))
+ $returnValue.Add("Microsoft Visual C++ 2013 x64 Additional Runtime - 12.0.21005", (($installedItems | ? {$_.Name -eq "Microsoft Visual C++ 2013 x64 Additional Runtime - 12.0.21005"}) -ne $null))
+ $returnValue.Add("Microsoft SQL Server 2012 Native Client", (($installedItems | ? {$_.Name.Trim() -eq "Microsoft SQL Server 2012 Native Client"}) -ne $null))
+ $returnValue.Add("Active Directory Rights Management Services Client 2.1", (($installedItems | ? {$_.Name -eq "Active Directory Rights Management Services Client 2.1"}) -ne $null))
+ }
+ $returnValue
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $InstallerPath,
+ [System.Boolean]
+ $OnlineMode = $true,
+ [System.String]
+ $SQLNCli = [System.String]::Empty,
+ [System.String]
+ $PowerShell = [System.String]::Empty,
+ [System.String]
+ $NETFX = [System.String]::Empty,
+ [System.String]
+ $IDFX = [System.String]::Empty,
+ [System.String]
+ $Sync = [System.String]::Empty,
+ [System.String]
+ $AppFabric = [System.String]::Empty,
+ [System.String]
+ $IDFX11 = [System.String]::Empty,
+ [System.String]
+ $MSIPCClient = [System.String]::Empty,
+ [System.String]
+ $WCFDataServices = [System.String]::Empty,
+ [System.String]
+ $KB2671763 = [System.String]::Empty,
+ [System.String]
+ $WCFDataServices56 = [System.String]::Empty,
+ [System.String]
+ $KB2898850 = [System.String]::Empty,
+ [System.String]
+ $MSVCRT12 = [System.String]::Empty
+ )
+
+ Write-Verbose -Message "Detecting SharePoint version from binaries"
+ $majorVersion = (Get-xSharePointAssemblyVerion -PathToAssembly $InstallerPath).Major
+ if ($majorVersion -eq 15) {
+ Write-Verbose -Message "Version: SharePoint 2013"
+ $requiredParams = @("SQLNCli","PowerShell","NETFX","IDFX","Sync","AppFabric","IDFX11","MSIPCClient","WCFDataServices","KB2671763","WCFDataServices56")
+ }
+ if ($majorVersion -eq 16) {
+ Write-Verbose -Message "Version: SharePoint 2016"
+ $requiredParams = @("SQLNCli","Sync","AppFabric","IDFX11","MSIPCClient","WCFDataServices","KB2671763","WCFDataServices56","KB2898850","MSVCRT12")
+ }
+
+ $prereqArgs = "/unattended"
+ if ($OnlineMode -eq $false) {
+ $requiredParams | ForEach-Object {
+ if($PSBoundParameters.ContainsKey($_) -and [string]::IsNullOrEmpty($PSBoundParameters.$_)) {
+ throw "In offline mode for version $majorVersion parameter $_ is required"
+ }
+ }
+ $requiredParams | ForEach-Object {
+ $prereqArgs += " /$_ `"$($PSBoundParameters.$_)`""
+ }
+ }
+
+ Write-Verbose -Message "Calling the SharePoint Pre-req installer"
+ Write-Verbose -Message "Args for prereq installer are: $prereqArgs"
+ $process = Start-Process -FilePath $InstallerPath -ArgumentList $prereqArgs -Wait -PassThru
+
+ switch ($process.ExitCode) {
+ 0 {
+ Write-Verbose -Message "Prerequisite installer completed successfully. Rebooting to finalise installations"
+ $global:DSCMachineStatus = 1
+ }
+ 1 {
+ throw "Another instance of the prerequisite installer is already running"
+ }
+ 2 {
+ throw "Invalid command line parameters passed to the prerequisite installer"
+ }
+ 1001 {
+ Write-Verbose -Message "A pending restart is blocking the prerequisite installer from running. Scheduling a reboot."
+ $global:DSCMachineStatus = 1
+ }
+ 3010 {
+ Write-Verbose -Message "The prerequisite installer has run correctly and needs to reboot the machine before continuing."
+ $global:DSCMachineStatus = 1
+ }
+ default {
+ throw "The prerequisite installer ran with the following unknown exit code $($process.ExitCode)"
+ }
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $InstallerPath,
+ [System.Boolean]
+ $OnlineMode = $true,
+ [System.String]
+ $SQLNCli = [System.String]::Empty,
+ [System.String]
+ $PowerShell = [System.String]::Empty,
+ [System.String]
+ $NETFX = [System.String]::Empty,
+ [System.String]
+ $IDFX = [System.String]::Empty,
+ [System.String]
+ $Sync = [System.String]::Empty,
+ [System.String]
+ $AppFabric = [System.String]::Empty,
+ [System.String]
+ $IDFX11 = [System.String]::Empty,
+ [System.String]
+ $MSIPCClient = [System.String]::Empty,
+ [System.String]
+ $WCFDataServices = [System.String]::Empty,
+ [System.String]
+ $KB2671763 = [System.String]::Empty,
+ [System.String]
+ $WCFDataServices56 = [System.String]::Empty,
+ [System.String]
+ $KB2898850 = [System.String]::Empty,
+ [System.String]
+ $MSVCRT12 = [System.String]::Empty
+ )
+
+
+ $result = Get-TargetResource -InstallerPath $InstallerPath
+ Write-Verbose -Message "Checking installation of SharePoint prerequisites"
+ if (($result.Values | Where-Object { $_ -eq $false }).Count -gt 0) {
+ Write-Verbose -Message "Prerequisites were detected as missing."
+ return $false
+ }
+
+ return $true
+}
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof
index e7337f051..3a446088b 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof
@@ -1,18 +1,20 @@
-[ClassVersion("1.0.0.0"), FriendlyName("xSPInstallPrereqs")]
-class MSFT_xSPInstallPrereqs : OMI_BaseResource
-{
- [Key] String InstallerPath;
- [Write] Boolean OnlineMode;
- [Write] String SQLNCli;
- [Write] String PowerShell;
- [Write] String NETFX;
- [Write] String IDFX;
- [Write] String Sync;
- [Write] String AppFabric;
- [Write] String IDFX11;
- [Write] String MSIPCClient;
- [Write] String WCFDataServices;
- [Write] String KB2671763;
- [Write] String WCFDataServices56;
-};
-
+[ClassVersion("1.0.0.0"), FriendlyName("xSPInstallPrereqs")]
+class MSFT_xSPInstallPrereqs : OMI_BaseResource
+{
+ [Key] String InstallerPath;
+ [Write] Boolean OnlineMode;
+ [Write] String SQLNCli;
+ [Write] String PowerShell;
+ [Write] String NETFX;
+ [Write] String IDFX;
+ [Write] String Sync;
+ [Write] String AppFabric;
+ [Write] String IDFX11;
+ [Write] String MSIPCClient;
+ [Write] String WCFDataServices;
+ [Write] String KB2671763;
+ [Write] String WCFDataServices56;
+ [Write] String KB2898850;
+ [Write] String MSVCRT12;
+};
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1
index 0efcba8e1..9565e5495 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1
@@ -1,183 +1,205 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $FarmConfigDatabaseName,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $DatabaseServer,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $FarmAccount,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $Passphrase
- )
-
- Write-Verbose -Message "Checking for local SP Farm"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount -ForceNewSession $true
-
- $result = Invoke-Command -Session $session -ScriptBlock {
- try {
- $spFarm = Get-SPFarm -ErrorAction SilentlyContinue
- } catch {
- Write-Verbose -Message "Unable to detect local farm."
- }
-
- if ($null -eq $spFarm) {return @{ }}
-
- $returnValue = @{
- FarmName = $spFarm.Name
- }
- return $returnValue
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $FarmConfigDatabaseName,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $DatabaseServer,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $FarmAccount,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $Passphrase,
-
- [System.UInt32]
- $WaitTime = 30,
-
- [System.UInt32]
- $WaitCount = 60
- )
-
- Write-Verbose -Message "Joining existing farm configuration database"
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount -ForceNewSession $true
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
-
- $loopCount = 0
-
- while ($loopCount -le $WaitCount) {
- try
- {
- Connect-SPConfigurationDatabase -DatabaseName $params.FarmConfigDatabaseName `
- -DatabaseServer $params.DatabaseServer `
- -Passphrase (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) `
- -SkipRegisterAsDistributedCacheHost:$true
- $loopCount = $WaitCount + 1
- }
- catch
- {
- $loopCount = $loopCount + 1
- Start-Sleep -Seconds $WaitTime
- }
- }
- }
-
- Write-Verbose -Message "Installing help collection"
- Invoke-Command -Session $session -ScriptBlock {
- Install-SPHelpCollection -All
- }
-
- Write-Verbose -Message "Initialising farm resource security"
- Invoke-Command -Session $session -ScriptBlock {
- Initialize-SPResourceSecurity
- }
-
- Write-Verbose -Message "Installing farm services"
- Invoke-Command -Session $session -ScriptBlock {
- Install-SPService
- }
-
- Write-Verbose -Message "Installing farm features"
- Invoke-Command -Session $session -ScriptBlock {
- Install-SPFeature -AllExistingFeatures -Force
- }
-
- Write-Verbose -Message "Installing application content"
- Invoke-Command -Session $session -ScriptBlock {
- Install-SPApplicationContent
- }
-
- Write-Verbose -Message "Starting timer service"
- Start-Service -Name sptimerv4
-
- Write-Verbose -Message "Pausing for 5 minutes to allow the timer service to fully provision the server"
- Start-Sleep -Seconds 300
- Write-Verbose -Message "Join farm complete. Restarting computer to allow configuration to continue"
-
- $global:DSCMachineStatus = 1
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $FarmConfigDatabaseName,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $DatabaseServer,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $FarmAccount,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $Passphrase,
-
- [System.UInt32]
- $WaitTime = 30,
-
- [System.UInt32]
- $WaitCount = 60
- )
-
- $result = Get-TargetResource -FarmConfigDatabaseName $FarmConfigDatabaseName -DatabaseServer $DatabaseServer -FarmAccount $FarmAccount -InstallAccount $InstallAccount -Passphrase $Passphrase
-
- if ($result.Count -eq 0) { return $false }
- return $true
-}
-
-
-Export-ModuleMember -Function *-TargetResource
-
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $FarmConfigDatabaseName,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $DatabaseServer,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $FarmAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Passphrase
+ )
+
+ Write-Verbose -Message "Checking for local SP Farm"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount -ForceNewSession $true
+
+ $result = Invoke-Command -Session $session -ScriptBlock {
+ try {
+ $spFarm = Get-SPFarm -ErrorAction SilentlyContinue
+ } catch {
+ Write-Verbose -Message "Unable to detect local farm."
+ }
+
+ if ($null -eq $spFarm) {return @{ }}
+
+ $returnValue = @{
+ FarmName = $spFarm.Name
+ }
+ return $returnValue
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $FarmConfigDatabaseName,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $DatabaseServer,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $FarmAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Passphrase,
+
+ [System.UInt32]
+ $WaitTime = 30,
+
+ [System.UInt32]
+ $WaitCount = 60
+ )
+
+ Write-Verbose -Message "Joining existing farm configuration database"
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount -ForceNewSession $true
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ $WaitTime = $PSBoundParameters.WaitTime
+ if ($WaitTime -lt 1) {$WaitTime = 30}
+ $WaitCount = $PSBoundParameters.WaitCount
+ if ($WaitCount -lt 1) {$WaitCount = 30}
+
+ $loopCount = 0
+
+ $majorVersion = (Get-xSharePointAssemblyVerion -PathToAssembly "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.dll").Major
+
+ while ($loopCount -le $WaitCount) {
+ try
+ {
+ if ($majorVersion -eq 15) {
+ Write-Verbose -Message "Version: SharePoint 2013"
+
+ Connect-SPConfigurationDatabase -DatabaseName $params.FarmConfigDatabaseName `
+ -DatabaseServer $params.DatabaseServer `
+ -Passphrase (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) `
+ -SkipRegisterAsDistributedCacheHost:$true
+ }
+ if ($majorVersion -eq 16) {
+ Write-Verbose -Message "Version: SharePoint 2016"
+
+ Connect-SPConfigurationDatabase -DatabaseName $params.FarmConfigDatabaseName `
+ -DatabaseServer $params.DatabaseServer `
+ -LocalServerRole Custom `
+ -Passphrase (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) `
+ -SkipRegisterAsDistributedCacheHost:$true
+ }
+
+
+ $loopCount = $WaitCount + 1
+ }
+ catch
+ {
+ $loopCount = $loopCount + 1
+ Start-Sleep -Seconds $WaitTime
+ }
+ }
+ }
+
+ Write-Verbose -Message "Installing help collection"
+ Invoke-Command -Session $session -ScriptBlock {
+ Install-SPHelpCollection -All
+ }
+
+ Write-Verbose -Message "Initialising farm resource security"
+ Invoke-Command -Session $session -ScriptBlock {
+ Initialize-SPResourceSecurity
+ }
+
+ Write-Verbose -Message "Installing farm services"
+ Invoke-Command -Session $session -ScriptBlock {
+ Install-SPService
+ }
+
+ Write-Verbose -Message "Installing farm features"
+ Invoke-Command -Session $session -ScriptBlock {
+ Install-SPFeature -AllExistingFeatures -Force
+ }
+
+ Write-Verbose -Message "Installing application content"
+ Invoke-Command -Session $session -ScriptBlock {
+ Install-SPApplicationContent
+ }
+
+ Write-Verbose -Message "Starting timer service"
+ Start-Service -Name sptimerv4
+
+ Write-Verbose -Message "Pausing for 5 minutes to allow the timer service to fully provision the server"
+ Start-Sleep -Seconds 300
+ Write-Verbose -Message "Join farm complete. Restarting computer to allow configuration to continue"
+
+ $global:DSCMachineStatus = 1
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $FarmConfigDatabaseName,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $DatabaseServer,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $FarmAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Passphrase,
+
+ [System.UInt32]
+ $WaitTime = 30,
+
+ [System.UInt32]
+ $WaitCount = 60
+ )
+
+ $result = Get-TargetResource -FarmConfigDatabaseName $FarmConfigDatabaseName -DatabaseServer $DatabaseServer -FarmAccount $FarmAccount -InstallAccount $InstallAccount -Passphrase $Passphrase
+
+ if ($result.Count -eq 0) { return $false }
+ return $true
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1
index 9d23abb3f..7079f3f5d 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedAccount/MSFT_xSPManagedAccount.psm1
@@ -1,138 +1,138 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $Account,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $AccountName
- )
-
- Write-Verbose -Message "Checking for managed account $AccountName"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
-
- try {
- $ma = Get-SPManagedAccount $params.AccountName -ErrorAction SilentlyContinue
- if ($null -eq $ma) { return @{ } }
- return @{
- AccountName = $ma.Userame
- AutomaticChange = $ma.AutomaticChange
- DaysBeforeChangeToEmail = $ma.DaysBeforeChangeToEmail
- DaysBeforeExpiryToChange = $ma.DaysBeforeExpiryToChange
- PasswordLastChanged = $ma.PasswordLastChanged
- PasswordExpiration = $ma.PasswordExpiration
- ChangeSchedule = $ma.ChangeSchedule
- }
- } catch {
- return @{ }
- }
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $Account,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [System.UInt32]
- $EmailNotification = 5,
-
- [System.UInt32]
- $PreExpireDays = 2,
-
- [System.String]
- $Schedule = [System.String]::Empty,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $AccountName
- )
-
- Write-Verbose -Message "Setting managed account $AccountName"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
-
- $ma = Get-SPManagedAccount $params.Account.UserName -ErrorAction SilentlyContinue
- if ($null -eq $ma) {
- $ma = New-SPManagedAccount $params.Account
- }
- $params.Add("Identity", $params.Account.UserName)
- $params.Remove("Account") | Out-Null
- $params.Remove("AccountName") | Out-Null
- $params.Remove("InstallAccount") | Out-Null
-
- Set-SPManagedAccount @params
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $Account,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [System.UInt32]
- $EmailNotification = 5,
-
- [System.UInt32]
- $PreExpireDays = 2,
-
- [System.String]
- $Schedule = [System.String]::Empty,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $AccountName
- )
-
- $result = Get-TargetResource -Account $Account -InstallAccount $InstallAccount -AccountName $AccountName
- Write-Verbose -Message "Testing managed account $AccountName"
- if ($result.Count -eq 0) { return $false }
- else {
- if($result.AutomaticChange -eq $true) {
- if($result.ChangeSchedule -ne $Schedule) { return $false }
- if($result.DaysBeforeExpiryToChange -ne $PreExpireDays) { return $false }
- if($result.DaysBeforeChangeToEmail -ne $EmailNotification) { return $false }
- }
- }
- return $true
-}
-
-
-Export-ModuleMember -Function *-TargetResource
-
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $Account,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $AccountName
+ )
+
+ Write-Verbose -Message "Checking for managed account $AccountName"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ try {
+ $ma = Get-SPManagedAccount $params.AccountName -ErrorAction SilentlyContinue
+ if ($null -eq $ma) { return @{ } }
+ return @{
+ AccountName = $ma.Userame
+ AutomaticChange = $ma.AutomaticChange
+ DaysBeforeChangeToEmail = $ma.DaysBeforeChangeToEmail
+ DaysBeforeExpiryToChange = $ma.DaysBeforeExpiryToChange
+ PasswordLastChanged = $ma.PasswordLastChanged
+ PasswordExpiration = $ma.PasswordExpiration
+ ChangeSchedule = $ma.ChangeSchedule
+ }
+ } catch {
+ return @{ }
+ }
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $Account,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [System.UInt32]
+ $EmailNotification = 5,
+
+ [System.UInt32]
+ $PreExpireDays = 2,
+
+ [System.String]
+ $Schedule = [System.String]::Empty,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $AccountName
+ )
+
+ Write-Verbose -Message "Setting managed account $AccountName"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ $ma = Get-SPManagedAccount $params.Account.UserName -ErrorAction SilentlyContinue
+ if ($null -eq $ma) {
+ $ma = New-SPManagedAccount $params.Account
+ }
+ $params.Add("Identity", $params.Account.UserName)
+ $params.Remove("Account") | Out-Null
+ $params.Remove("AccountName") | Out-Null
+ $params.Remove("InstallAccount") | Out-Null
+
+ Set-SPManagedAccount @params
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $Account,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [System.UInt32]
+ $EmailNotification = 5,
+
+ [System.UInt32]
+ $PreExpireDays = 2,
+
+ [System.String]
+ $Schedule = [System.String]::Empty,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $AccountName
+ )
+
+ $result = Get-TargetResource -Account $Account -InstallAccount $InstallAccount -AccountName $AccountName
+ Write-Verbose -Message "Testing managed account $AccountName"
+ if ($result.Count -eq 0) { return $false }
+ else {
+ if($result.AutomaticChange -eq $true) {
+ if($result.ChangeSchedule -ne $Schedule) { return $false }
+ if($result.DaysBeforeExpiryToChange -ne $PreExpireDays) { return $false }
+ if($result.DaysBeforeChangeToEmail -ne $EmailNotification) { return $false }
+ }
+ }
+ return $true
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1
index 746c92dd0..5c7efb7b9 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.psm1
@@ -1,136 +1,136 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPool
- )
-
- Write-Verbose -Message "Getting managed metadata service application $Name"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
- Where-Object { $_.TypeName -eq "Managed Metadata Service" }
- If ($null -eq $serviceApp)
- {
- return @{}
- }
- else
- {
- return @{
- Name = $serviceApp.DisplayName
- ApplicationPool = $serviceApp.ApplicationPool.Name
- }
- }
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPool,
-
- [System.String]
- $DatabaseServer = $null,
-
- [System.String]
- $DatabaseName = $null,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -InstallAccount $InstallAccount
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
- if ($result.Count -eq 0) {
- Write-Verbose -Message "Creating Managed Metadata Service Application $Name"
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $params = Remove-xSharePointNullParamValues -Params $params
- $params.Remove("InstallAccount") | Out-Null
- $app = New-SPMetadataServiceApplication @params
- if ($null -ne $app)
- {
- New-SPMetadataServiceApplicationProxy -Name ($params.Name + " Proxy") -ServiceApplication $app -DefaultProxyGroup -ContentTypePushdownEnabled -DefaultKeywordTaxonomy -DefaultSiteCollectionTaxonomy
- }
- }
- }
- else {
- if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) {
- Write-Verbose -Message "Updating Managed Metadata Service Application $Name"
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $params = Remove-xSharePointNullParamValues -Params $params
- $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
- Where-Object { $_.TypeName -eq "Managed Metadata Service" }
- $serviceApp | Set-SPMetadataServiceApplication -ApplicationPool (Get-SPServiceApplicationPool $params.ApplicationPool)
- }
- }
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPool,
-
- [System.String]
- $DatabaseServer = $null,
-
- [System.String]
- $DatabaseName = $null
- )
-
- $result = Get-TargetResource -Name $Name -InstallAccount $InstallAccount -ApplicationPool $ApplicationPool
-
- Write-Verbose -Message "Testing for Managed Metadata Service Application '$Name'"
- if ($result.Count -eq 0) { return $false }
- else {
- if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) { return $false }
- }
- return $true
-
-}
-
-
-Export-ModuleMember -Function *-TargetResource
-
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPool
+ )
+
+ Write-Verbose -Message "Getting managed metadata service application $Name"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
+ Where-Object { $_.TypeName -eq "Managed Metadata Service" }
+ If ($null -eq $serviceApp)
+ {
+ return @{}
+ }
+ else
+ {
+ return @{
+ Name = $serviceApp.DisplayName
+ ApplicationPool = $serviceApp.ApplicationPool.Name
+ }
+ }
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPool,
+
+ [System.String]
+ $DatabaseServer = $null,
+
+ [System.String]
+ $DatabaseName = $null,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -InstallAccount $InstallAccount
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+ if ($result.Count -eq 0) {
+ Write-Verbose -Message "Creating Managed Metadata Service Application $Name"
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $params = Remove-xSharePointNullParamValues -Params $params
+ $params.Remove("InstallAccount") | Out-Null
+ $app = New-SPMetadataServiceApplication @params
+ if ($null -ne $app)
+ {
+ New-SPMetadataServiceApplicationProxy -Name ($params.Name + " Proxy") -ServiceApplication $app -DefaultProxyGroup -ContentTypePushdownEnabled -DefaultKeywordTaxonomy -DefaultSiteCollectionTaxonomy
+ }
+ }
+ }
+ else {
+ if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) {
+ Write-Verbose -Message "Updating Managed Metadata Service Application $Name"
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $params = Remove-xSharePointNullParamValues -Params $params
+ $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
+ Where-Object { $_.TypeName -eq "Managed Metadata Service" }
+ $serviceApp | Set-SPMetadataServiceApplication -ApplicationPool (Get-SPServiceApplicationPool $params.ApplicationPool)
+ }
+ }
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPool,
+
+ [System.String]
+ $DatabaseServer = $null,
+
+ [System.String]
+ $DatabaseName = $null
+ )
+
+ $result = Get-TargetResource -Name $Name -InstallAccount $InstallAccount -ApplicationPool $ApplicationPool
+
+ Write-Verbose -Message "Testing for Managed Metadata Service Application '$Name'"
+ if ($result.Count -eq 0) { return $false }
+ else {
+ if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) { return $false }
+ }
+ return $true
+
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.schema.mof
index e97215bd2..987d9fe10 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.schema.mof
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedMetadataServiceApp/MSFT_xSPManagedMetaDataServiceApp.schema.mof
@@ -1,9 +1,9 @@
-[ClassVersion("1.0.0.0"), FriendlyName("xSPManagedMetaDataServiceApp")]
-class MSFT_xSPManagedMetaDataServiceApp : OMI_BaseResource
-{
- [Key] string Name;
- [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount;
- [Required] string ApplicationPool;
- [Write] string DatabaseServer;
- [Write] string DatabaseName;
-};
+[ClassVersion("1.0.0.0"), FriendlyName("xSPManagedMetaDataServiceApp")]
+class MSFT_xSPManagedMetaDataServiceApp : OMI_BaseResource
+{
+ [Key] string Name;
+ [Required, EmbeddedInstance("MSFT_Credential")] String InstallAccount;
+ [Required] string ApplicationPool;
+ [Write] string DatabaseServer;
+ [Write] string DatabaseName;
+};
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1
index d4d3bf945..311add1d8 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPManagedPath/MSFT_xSPManagedPath.psm1
@@ -1,154 +1,154 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $WebAppUrl,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $RelativeUrl,
-
- [parameter(Mandatory = $true)]
- [System.Boolean]
- $Explicit,
-
- [parameter(Mandatory = $true)]
- [System.Boolean]
- $HostHeader
- )
-
- Write-Verbose -Message "Looking up the managed path $RelativeUrl in $WebAppUrl"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
-
- if ($params.HostHeader) {
- $path = Get-SPManagedPath -Identity $params.RelativeUrl -HostHeader -ErrorAction SilentlyContinue
- }
- else {
- $path = Get-SPManagedPath -WebApplication $params.WebAppUrl -Identity $params.RelativeUrl -ErrorAction SilentlyContinue
- }
-
- if ($null -eq $path) { return @{} }
-
- return @{
- Name = $path.Name
- PathType = $path.Type
- }
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $WebAppUrl,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $RelativeUrl,
-
- [parameter(Mandatory = $true)]
- [System.Boolean]
- $Explicit,
-
- [parameter(Mandatory = $true)]
- [System.Boolean]
- $HostHeader
- )
-
- Write-Verbose -Message "Creating the managed path $RelativeUrl in $WebAppUrl"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
-
- if ($params.HostHeader) {
- $path = Get-SPManagedPath -Identity $params.RelativeUrl -HostHeader -ErrorAction SilentlyContinue
- }
- else {
- $path = Get-SPManagedPath -WebApplication $params.WebAppUrl -Identity $params.RelativeUrl -ErrorAction SilentlyContinue
- }
-
- if ($null -eq $path) {
-
- $newParams = @{}
- if ($params.HostHeader) {
- $newParams.Add("HostHeader", $params.HostHeader)
- }
- else {
- $newParams.Add("WebApplication", $params.WebAppUrl)
- }
- $newParams.Add("RelativeURL", $params.RelativeUrl)
- $newParams.Add("Explicit", $params.Explicit)
-
- New-SPManagedPath @newParams
- }
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $WebAppUrl,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $RelativeUrl,
-
- [parameter(Mandatory = $true)]
- [System.Boolean]
- $Explicit,
-
- [parameter(Mandatory = $true)]
- [System.Boolean]
- $HostHeader
- )
-
- $result = Get-TargetResource -WebAppUrl $WebAppUrl -InstallAccount $InstallAccount -RelativeUrl $RelativeUrl -Explicit $Explicit -HostHeader $HostHeader
- Write-Verbose -Message "Looking up the managed path $RelativeUrl in $WebAppUrl"
- if ($result.Count -eq 0) { return $false }
- else {
- if ($Explicit) {
- if ($result.PathType -ne "ExplicitInclusion") { return $false }
- }
- else {
- if ($result.PathType -ne "WildcardInclusion") { return $false }
- }
- }
- return $true
-}
-
-
-Export-ModuleMember -Function *-TargetResource
-
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $WebAppUrl,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $RelativeUrl,
+
+ [parameter(Mandatory = $true)]
+ [System.Boolean]
+ $Explicit,
+
+ [parameter(Mandatory = $true)]
+ [System.Boolean]
+ $HostHeader
+ )
+
+ Write-Verbose -Message "Looking up the managed path $RelativeUrl in $WebAppUrl"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ if ($params.HostHeader) {
+ $path = Get-SPManagedPath -Identity $params.RelativeUrl -HostHeader -ErrorAction SilentlyContinue
+ }
+ else {
+ $path = Get-SPManagedPath -WebApplication $params.WebAppUrl -Identity $params.RelativeUrl -ErrorAction SilentlyContinue
+ }
+
+ if ($null -eq $path) { return @{} }
+
+ return @{
+ Name = $path.Name
+ PathType = $path.Type
+ }
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $WebAppUrl,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $RelativeUrl,
+
+ [parameter(Mandatory = $true)]
+ [System.Boolean]
+ $Explicit,
+
+ [parameter(Mandatory = $true)]
+ [System.Boolean]
+ $HostHeader
+ )
+
+ Write-Verbose -Message "Creating the managed path $RelativeUrl in $WebAppUrl"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ if ($params.HostHeader) {
+ $path = Get-SPManagedPath -Identity $params.RelativeUrl -HostHeader -ErrorAction SilentlyContinue
+ }
+ else {
+ $path = Get-SPManagedPath -WebApplication $params.WebAppUrl -Identity $params.RelativeUrl -ErrorAction SilentlyContinue
+ }
+
+ if ($null -eq $path) {
+
+ $newParams = @{}
+ if ($params.HostHeader) {
+ $newParams.Add("HostHeader", $params.HostHeader)
+ }
+ else {
+ $newParams.Add("WebApplication", $params.WebAppUrl)
+ }
+ $newParams.Add("RelativeURL", $params.RelativeUrl)
+ $newParams.Add("Explicit", $params.Explicit)
+
+ New-SPManagedPath @newParams
+ }
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $WebAppUrl,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $RelativeUrl,
+
+ [parameter(Mandatory = $true)]
+ [System.Boolean]
+ $Explicit,
+
+ [parameter(Mandatory = $true)]
+ [System.Boolean]
+ $HostHeader
+ )
+
+ $result = Get-TargetResource -WebAppUrl $WebAppUrl -InstallAccount $InstallAccount -RelativeUrl $RelativeUrl -Explicit $Explicit -HostHeader $HostHeader
+ Write-Verbose -Message "Looking up the managed path $RelativeUrl in $WebAppUrl"
+ if ($result.Count -eq 0) { return $false }
+ else {
+ if ($Explicit) {
+ if ($result.PathType -ne "ExplicitInclusion") { return $false }
+ }
+ else {
+ if ($result.PathType -ne "WildcardInclusion") { return $false }
+ }
+ }
+ return $true
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1
index 2b9163c4a..81fc03b69 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSearchServiceApp/MSFT_xSPSearchServiceApp.psm1
@@ -1,134 +1,134 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPool,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Getting Search service application '$Name'"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
- Where-Object { $_.TypeName -eq "Search Service Application" }
- If ($null -eq $serviceApp)
- {
- return @{}
- }
- else
- {
- return @{
- Name = $serviceApp.DisplayName
- ApplicationPool = $serviceApp.ApplicationPool.Name
- }
- }
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPool,
-
- [System.String]
- $DatabaseServer = $null,
-
- [System.String]
- $DatabaseName = $null,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -InstallAccount $InstallAccount
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
- if ($result.Count -eq 0) {
- Write-Verbose -Message "Creating Search Service Application $Name"
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $params = Remove-xSharePointNullParamValues -Params $params
- $params.Remove("InstallAccount") | Out-Null
-
- Get-SPEnterpriseSearchServiceInstance -Local | Start-SPEnterpriseSearchServiceInstance -ErrorAction SilentlyContinue
- $app = New-SPEnterpriseSearchServiceApplication @params
- if ($app) {
- New-SPEnterpriseSearchServiceApplicationProxy -Name ($params.Name + " Proxy") -SearchApplication $app
- }
- }
- }
- else {
- if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) {
- Write-Verbose -Message "Updating Search Service Application $Name"
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $params = Remove-xSharePointNullParamValues -Params $params
- $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
- Where-Object { $_.TypeName -eq "Search Service Application" }
- $serviceApp | Set-SPEnterpriseSearchServiceApplication -ApplicationPool (Get-SPServiceApplicationPool $params.ApplicationPool)
- }
- }
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPool,
-
- [System.String]
- $DatabaseServer = $null,
-
- [System.String]
- $DatabaseName = $null,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -InstallAccount $InstallAccount
- Write-Verbose -Message "Testing Search service application '$Name'"
-
- if ($result.Count -eq 0) { return $false }
- else {
- if ($ApplicationPool -ne $result.ApplicationPool) { return $false }
- }
- return $true
-}
-
-Export-ModuleMember -Function *-TargetResource
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPool,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Getting Search service application '$Name'"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
+ Where-Object { $_.TypeName -eq "Search Service Application" }
+ If ($null -eq $serviceApp)
+ {
+ return @{}
+ }
+ else
+ {
+ return @{
+ Name = $serviceApp.DisplayName
+ ApplicationPool = $serviceApp.ApplicationPool.Name
+ }
+ }
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPool,
+
+ [System.String]
+ $DatabaseServer = $null,
+
+ [System.String]
+ $DatabaseName = $null,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -InstallAccount $InstallAccount
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+ if ($result.Count -eq 0) {
+ Write-Verbose -Message "Creating Search Service Application $Name"
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $params = Remove-xSharePointNullParamValues -Params $params
+ $params.Remove("InstallAccount") | Out-Null
+
+ Get-SPEnterpriseSearchServiceInstance -Local | Start-SPEnterpriseSearchServiceInstance -ErrorAction SilentlyContinue
+ $app = New-SPEnterpriseSearchServiceApplication @params
+ if ($app) {
+ New-SPEnterpriseSearchServiceApplicationProxy -Name ($params.Name + " Proxy") -SearchApplication $app
+ }
+ }
+ }
+ else {
+ if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) {
+ Write-Verbose -Message "Updating Search Service Application $Name"
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $params = Remove-xSharePointNullParamValues -Params $params
+ $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
+ Where-Object { $_.TypeName -eq "Search Service Application" }
+ $serviceApp | Set-SPEnterpriseSearchServiceApplication -ApplicationPool (Get-SPServiceApplicationPool $params.ApplicationPool)
+ }
+ }
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPool,
+
+ [System.String]
+ $DatabaseServer = $null,
+
+ [System.String]
+ $DatabaseName = $null,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -InstallAccount $InstallAccount
+ Write-Verbose -Message "Testing Search service application '$Name'"
+
+ if ($result.Count -eq 0) { return $false }
+ else {
+ if ($ApplicationPool -ne $result.ApplicationPool) { return $false }
+ }
+ return $true
+}
+
+Export-ModuleMember -Function *-TargetResource
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1
index 03551927d..76efdc33b 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSecureStoreServiceApp/MSFT_xSPSecureStoreServiceApp.psm1
@@ -1,191 +1,191 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPool,
-
- [parameter(Mandatory = $true)]
- [System.Boolean]
- $AuditingEnabled,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Getting secure store service application '$Name'"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
- Where-Object { $_.TypeName -eq "Secure Store Service Application" }
- If ($null -eq $serviceApp)
- {
- return @{}
- }
- else
- {
- return @{
- Name = $serviceApp.DisplayName
- ApplicationPool = $serviceApp.ApplicationPool.Name
- }
- }
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPool,
-
- [parameter(Mandatory = $true)]
- [System.Boolean]
- $AuditingEnabled,
-
- [System.UInt32]
- $AuditlogMaxSize = 30,
-
- [System.Management.Automation.PSCredential]
- $DatabaseCredentials = $null,
-
- [System.String]
- $DatabaseName = $null,
-
- [System.String]
- $DatabasePassword = $null,
-
- [System.String]
- $DatabaseServer = $null,
-
- [System.String]
- $DatabaseUsername = $null,
-
- [System.String]
- $FailoverDatabaseServer = $null,
-
- [System.Boolean]
- $PartitionMode = $false,
-
- [System.Boolean]
- $Sharing = $true,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -AuditingEnabled $AuditingEnabled -InstallAccount $InstallAccount
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
- if ($result.Count -eq 0) {
- Write-Verbose -Message "Creating Secure Store Service Application $Name"
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $params = Remove-xSharePointNullParamValues -Params $params
- $params.Remove("InstallAccount") | Out-Null
-
- $app = New-SPSecureStoreServiceApplication @params
- if ($null -ne $app) {
- New-SPSecureStoreServiceApplicationProxy -Name ($params.Name + " Proxy") -ServiceApplication $app
- }
- }
- }
- else {
- if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) {
- Write-Verbose -Message "Updating Secure Store Service Application $Name"
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $params = Remove-xSharePointNullParamValues -Params $params
- $params.Remove("Name") | Out-Null
- if ($params.ContainsKey("PartitionMode")) { $params.Remove("PartitionMode") | Out-Null }
-
- $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
- Where-Object { $_.TypeName -eq "Secure Store Service Application" }
- $serviceApp | Set-SPSecureStoreServiceApplication @params
- }
- }
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPool,
-
- [parameter(Mandatory = $true)]
- [System.Boolean]
- $AuditingEnabled,
-
- [System.UInt32]
- $AuditlogMaxSize = 30,
-
- [System.Management.Automation.PSCredential]
- $DatabaseCredentials = $null,
-
- [System.String]
- $DatabaseName = $null,
-
- [System.String]
- $DatabasePassword = $null,
-
- [System.String]
- $DatabaseServer = $null,
-
- [System.String]
- $DatabaseUsername = $null,
-
- [System.String]
- $FailoverDatabaseServer = $null,
-
- [System.Boolean]
- $PartitionMode = $false,
-
- [System.Boolean]
- $Sharing = $true,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -AuditingEnabled $AuditingEnabled -InstallAccount $InstallAccount
- Write-Verbose -Message "Testing secure store service application $Name"
- if ($result.Count -eq 0) { return $false }
- else {
- if ($ApplicationPool -ne $result.ApplicationPool) { return $false }
- }
- return $true
-}
-
-
-Export-ModuleMember -Function *-TargetResource
-
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPool,
+
+ [parameter(Mandatory = $true)]
+ [System.Boolean]
+ $AuditingEnabled,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Getting secure store service application '$Name'"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
+ Where-Object { $_.TypeName -eq "Secure Store Service Application" }
+ If ($null -eq $serviceApp)
+ {
+ return @{}
+ }
+ else
+ {
+ return @{
+ Name = $serviceApp.DisplayName
+ ApplicationPool = $serviceApp.ApplicationPool.Name
+ }
+ }
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPool,
+
+ [parameter(Mandatory = $true)]
+ [System.Boolean]
+ $AuditingEnabled,
+
+ [System.UInt32]
+ $AuditlogMaxSize = 30,
+
+ [System.Management.Automation.PSCredential]
+ $DatabaseCredentials = $null,
+
+ [System.String]
+ $DatabaseName = $null,
+
+ [System.String]
+ $DatabasePassword = $null,
+
+ [System.String]
+ $DatabaseServer = $null,
+
+ [System.String]
+ $DatabaseUsername = $null,
+
+ [System.String]
+ $FailoverDatabaseServer = $null,
+
+ [System.Boolean]
+ $PartitionMode = $false,
+
+ [System.Boolean]
+ $Sharing = $true,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -AuditingEnabled $AuditingEnabled -InstallAccount $InstallAccount
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+ if ($result.Count -eq 0) {
+ Write-Verbose -Message "Creating Secure Store Service Application $Name"
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $params = Remove-xSharePointNullParamValues -Params $params
+ $params.Remove("InstallAccount") | Out-Null
+
+ $app = New-SPSecureStoreServiceApplication @params
+ if ($null -ne $app) {
+ New-SPSecureStoreServiceApplicationProxy -Name ($params.Name + " Proxy") -ServiceApplication $app
+ }
+ }
+ }
+ else {
+ if ([string]::IsNullOrEmpty($ApplicationPool) -eq $false -and $ApplicationPool -ne $result.ApplicationPool) {
+ Write-Verbose -Message "Updating Secure Store Service Application $Name"
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $params = Remove-xSharePointNullParamValues -Params $params
+ $params.Remove("Name") | Out-Null
+ if ($params.ContainsKey("PartitionMode")) { $params.Remove("PartitionMode") | Out-Null }
+
+ $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
+ Where-Object { $_.TypeName -eq "Secure Store Service Application" }
+ $serviceApp | Set-SPSecureStoreServiceApplication @params
+ }
+ }
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPool,
+
+ [parameter(Mandatory = $true)]
+ [System.Boolean]
+ $AuditingEnabled,
+
+ [System.UInt32]
+ $AuditlogMaxSize = 30,
+
+ [System.Management.Automation.PSCredential]
+ $DatabaseCredentials = $null,
+
+ [System.String]
+ $DatabaseName = $null,
+
+ [System.String]
+ $DatabasePassword = $null,
+
+ [System.String]
+ $DatabaseServer = $null,
+
+ [System.String]
+ $DatabaseUsername = $null,
+
+ [System.String]
+ $FailoverDatabaseServer = $null,
+
+ [System.Boolean]
+ $PartitionMode = $false,
+
+ [System.Boolean]
+ $Sharing = $true,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -AuditingEnabled $AuditingEnabled -InstallAccount $InstallAccount
+ Write-Verbose -Message "Testing secure store service application $Name"
+ if ($result.Count -eq 0) { return $false }
+ else {
+ if ($ApplicationPool -ne $result.ApplicationPool) { return $false }
+ }
+ return $true
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1
index 7227975ba..99b086056 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceAppPool/MSFT_xSPServiceAppPool.psm1
@@ -1,105 +1,105 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ServiceAccount,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Getting service application pool '$Name'"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
-
- $sap = Get-SPServiceApplicationPool $params.Name -ErrorAction SilentlyContinue
- if ($null -eq $sap) { return @{} }
-
- return @{
- Name = $sap.Name
- ProcessAccountName = $sap.ProcessAccountName
- }
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ServiceAccount,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Creating service application pool '$Name'"
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
-
- $sap = Get-SPServiceApplicationPool $params.Name -ErrorAction SilentlyContinue
- if ($null -eq $sap) {
- New-SPServiceApplicationPool -Name $params.Name -Account $params.ServiceAccount
- } else {
- if ($sap.ProcessAccountName -ne $params.ServiceAccount) {
- Set-SPServiceApplicationPool -Identity $params.Name -Account $params.ServiceAccount
- }
- }
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ServiceAccount,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- $result = Get-TargetResource -Name $Name -ServiceAccount $ServiceAccount -InstallAccount $InstallAccount
- Write-Verbose -Message "Testing service application pool '$Name'"
- if ($result.Count -eq 0) { return $false }
- else {
- if ($ServiceAccount -ne $result.ProcessAccountName) { return $false }
- }
- return $true
-}
-
-
-Export-ModuleMember -Function *-TargetResource
-
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ServiceAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Getting service application pool '$Name'"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ $sap = Get-SPServiceApplicationPool $params.Name -ErrorAction SilentlyContinue
+ if ($null -eq $sap) { return @{} }
+
+ return @{
+ Name = $sap.Name
+ ProcessAccountName = $sap.ProcessAccountName
+ }
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ServiceAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Creating service application pool '$Name'"
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ $sap = Get-SPServiceApplicationPool $params.Name -ErrorAction SilentlyContinue
+ if ($null -eq $sap) {
+ New-SPServiceApplicationPool -Name $params.Name -Account $params.ServiceAccount
+ } else {
+ if ($sap.ProcessAccountName -ne $params.ServiceAccount) {
+ Set-SPServiceApplicationPool -Identity $params.Name -Account $params.ServiceAccount
+ }
+ }
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ServiceAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ $result = Get-TargetResource -Name $Name -ServiceAccount $ServiceAccount -InstallAccount $InstallAccount
+ Write-Verbose -Message "Testing service application pool '$Name'"
+ if ($result.Count -eq 0) { return $false }
+ else {
+ if ($ServiceAccount -ne $result.ProcessAccountName) { return $false }
+ }
+ return $true
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1
index bf0264bf8..e64673c24 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPServiceInstance/MSFT_xSPServiceInstance.psm1
@@ -1,121 +1,121 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [ValidateSet("Present","Absent")]
- [System.String]
- $Ensure
- )
-
- Write-Verbose -Message "Getting service instance '$Name'"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
-
- $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq $params.Name }
- if ($null -eq $si) { return @{} }
-
- return @{
- Name = $params.Name
- Status = $si.Status
- }
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [ValidateSet("Present","Absent")]
- [System.String]
- $Ensure
- )
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- if ($Ensure -eq "Present") {
- Write-Verbose -Message "Provisioning service instance '$Name'"
-
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
-
- $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq $params.Name }
- if ($null -eq $si) { return $false }
- Start-SPServiceInstance $si
- }
- } else {
- Write-Verbose -Message "Deprovioning service instance '$Name'"
-
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
-
- $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq $params.Name }
- if ($null -eq $si) { return $false }
- Stop-SPServiceInstance $si
- }
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [parameter(Mandatory = $true)]
- [ValidateSet("Present","Absent")]
- [System.String]
- $Ensure
- )
-
- $result = Get-TargetResource -Name $Name -InstallAccount $InstallAccount -Ensure $Ensure
- Write-Verbose -Message "Getting service instance '$Name'"
- if ($result.Count -eq 0) { return $false }
- else {
- if ($Ensure -eq "Present" -and $result.Status -eq "Disabled") {
- return $false
- }
- if ($Ensure -eq "Absent" -and $result.Status -eq "Online") {
- return $false
- }
- }
- return $true
-}
-
-
-Export-ModuleMember -Function *-TargetResource
-
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [ValidateSet("Present","Absent")]
+ [System.String]
+ $Ensure
+ )
+
+ Write-Verbose -Message "Getting service instance '$Name'"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq $params.Name }
+ if ($null -eq $si) { return @{} }
+
+ return @{
+ Name = $params.Name
+ Status = $si.Status
+ }
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [ValidateSet("Present","Absent")]
+ [System.String]
+ $Ensure
+ )
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ if ($Ensure -eq "Present") {
+ Write-Verbose -Message "Provisioning service instance '$Name'"
+
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq $params.Name }
+ if ($null -eq $si) { return $false }
+ Start-SPServiceInstance $si
+ }
+ } else {
+ Write-Verbose -Message "Deprovioning service instance '$Name'"
+
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ $si = Get-SPServiceInstance -Server $env:COMPUTERNAME | Where-Object { $_.TypeName -eq $params.Name }
+ if ($null -eq $si) { return $false }
+ Stop-SPServiceInstance $si
+ }
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [parameter(Mandatory = $true)]
+ [ValidateSet("Present","Absent")]
+ [System.String]
+ $Ensure
+ )
+
+ $result = Get-TargetResource -Name $Name -InstallAccount $InstallAccount -Ensure $Ensure
+ Write-Verbose -Message "Getting service instance '$Name'"
+ if ($result.Count -eq 0) { return $false }
+ else {
+ if ($Ensure -eq "Present" -and $result.Status -eq "Disabled") {
+ return $false
+ }
+ if ($Ensure -eq "Absent" -and $result.Status -eq "Online") {
+ return $false
+ }
+ }
+ return $true
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1
index 1fdf43f92..0f0210364 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPSite/MSFT_xSPSite.psm1
@@ -1,172 +1,172 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Url,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $OwnerAlias,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Getting site collection $Url"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $site = Get-SPSite $params.Url -ErrorAction SilentlyContinue
-
- if ($null -eq $site) { return @{} }
- else {
- return @{
- Url = $site.Url
- OwnerAlias = $site.OwnerAlias
- }
- }
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Url,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $OwnerAlias,
-
- [System.UInt32]
- $CompatibilityLevel = $null,
-
- [System.String]
- $ContentDatabase = $null,
-
- [System.String]
- $Description = $null,
-
- [System.String]
- $HostHeaderWebApplication = $null,
-
- [System.UInt32]
- $Language = $null,
-
- [System.String]
- $Name = $null,
-
- [System.String]
- $OwnerEmail = $null,
-
- [System.String]
- $QuotaTemplate = $null,
-
- [System.String]
- $SecondaryEmail = $null,
-
- [System.String]
- $SecondaryOwnerAlias = $null,
-
- [System.String]
- $Template = $null,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Creating site collection $Url"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $params = Remove-xSharePointNullParamValues -Params $params
- $params.Remove("InstallAccount") | Out-Null
-
- $site = Get-SPSite $params.Url -ErrorAction SilentlyContinue
-
- if ($null -eq $site) {
- New-SPSite @params | Out-Null
- }
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Url,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $OwnerAlias,
-
- [System.UInt32]
- $CompatibilityLevel = $null,
-
- [System.String]
- $ContentDatabase = $null,
-
- [System.String]
- $Description = $null,
-
- [System.String]
- $HostHeaderWebApplication = $null,
-
- [System.UInt32]
- $Language = $null,
-
- [System.String]
- $Name = $null,
-
- [System.String]
- $OwnerEmail = $null,
-
- [System.String]
- $QuotaTemplate = $null,
-
- [System.String]
- $SecondaryEmail = $null,
-
- [System.String]
- $SecondaryOwnerAlias = $null,
-
- [System.String]
- $Template = $null,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- $result = Get-TargetResource -Url $Url -OwnerAlias $OwnerAlias -InstallAccount $InstallAccount
- Write-Verbose -Message "Testing site collection $Url"
- if ($result.Count -eq 0) { return $false }
- else {
-
- }
- return $true
-}
-
-
-Export-ModuleMember -Function *-TargetResource
-
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Url,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $OwnerAlias,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Getting site collection $Url"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $site = Get-SPSite $params.Url -ErrorAction SilentlyContinue
+
+ if ($null -eq $site) { return @{} }
+ else {
+ return @{
+ Url = $site.Url
+ OwnerAlias = $site.OwnerAlias
+ }
+ }
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Url,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $OwnerAlias,
+
+ [System.UInt32]
+ $CompatibilityLevel = $null,
+
+ [System.String]
+ $ContentDatabase = $null,
+
+ [System.String]
+ $Description = $null,
+
+ [System.String]
+ $HostHeaderWebApplication = $null,
+
+ [System.UInt32]
+ $Language = $null,
+
+ [System.String]
+ $Name = $null,
+
+ [System.String]
+ $OwnerEmail = $null,
+
+ [System.String]
+ $QuotaTemplate = $null,
+
+ [System.String]
+ $SecondaryEmail = $null,
+
+ [System.String]
+ $SecondaryOwnerAlias = $null,
+
+ [System.String]
+ $Template = $null,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Creating site collection $Url"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $params = Remove-xSharePointNullParamValues -Params $params
+ $params.Remove("InstallAccount") | Out-Null
+
+ $site = Get-SPSite $params.Url -ErrorAction SilentlyContinue
+
+ if ($null -eq $site) {
+ New-SPSite @params | Out-Null
+ }
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Url,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $OwnerAlias,
+
+ [System.UInt32]
+ $CompatibilityLevel = $null,
+
+ [System.String]
+ $ContentDatabase = $null,
+
+ [System.String]
+ $Description = $null,
+
+ [System.String]
+ $HostHeaderWebApplication = $null,
+
+ [System.UInt32]
+ $Language = $null,
+
+ [System.String]
+ $Name = $null,
+
+ [System.String]
+ $OwnerEmail = $null,
+
+ [System.String]
+ $QuotaTemplate = $null,
+
+ [System.String]
+ $SecondaryEmail = $null,
+
+ [System.String]
+ $SecondaryOwnerAlias = $null,
+
+ [System.String]
+ $Template = $null,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ $result = Get-TargetResource -Url $Url -OwnerAlias $OwnerAlias -InstallAccount $InstallAccount
+ Write-Verbose -Message "Testing site collection $Url"
+ if ($result.Count -eq 0) { return $false }
+ else {
+
+ }
+ return $true
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1
index 3c73dd6be..d26270c1d 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPStateServiceApp/MSFT_xSPStateServiceApp.psm1
@@ -1,112 +1,112 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Getting state service application '$Name'"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
-
- $app = Get-SPStateServiceApplication -Identity $params.Name -ErrorAction SilentlyContinue
-
- if ($null -eq $app) { return @{} }
-
- return @{
- Name = $app.DisplayName
- }
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [System.Management.Automation.PSCredential]
- $DatabaseCredentials = $null,
-
- [System.String]
- $DatabaseName = $null,
-
- [System.String]
- $DatabaseServer = $null,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Creating state service application $Name"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $params = Remove-xSharePointNullParamValues -Params $params
-
- $app = Get-SPStateServiceApplication -Identity $params.Name -ErrorAction SilentlyContinue
- if ($null -eq $app) {
-
- $dbParams = @{}
- if ($params.ContainsKey("DatabaseName")) { $dbParams.Add("Name", $params.DatabaseName) }
- if ($params.ContainsKey("DatabaseServer")) { $dbParams.Add("DatabaseServer", $params.DatabaseServer) }
- if ($params.ContainsKey("DatabaseCredentials")) { $dbParams.Add("DatabaseCredentials", $params.DatabaseCredentials) }
-
- New-SPStateServiceDatabase @dbParams| New-SPStateServiceApplication -Name $params.Name | New-SPStateServiceApplicationProxy -DefaultProxyGroup
- }
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [System.Management.Automation.PSCredential]
- $DatabaseCredentials = $null,
-
- [System.String]
- $DatabaseName = $null,
-
- [System.String]
- $DatabaseServer = $null,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- $result = Get-TargetResource -Name $Name -InstallAccount $InstallAccount
- Write-Verbose -Message "Testing for state service application $Name"
- if ($result.Count -eq 0) { return $false }
- return $true
-}
-
-
-Export-ModuleMember -Function *-TargetResource
-
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Getting state service application '$Name'"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ $app = Get-SPStateServiceApplication -Identity $params.Name -ErrorAction SilentlyContinue
+
+ if ($null -eq $app) { return @{} }
+
+ return @{
+ Name = $app.DisplayName
+ }
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [System.Management.Automation.PSCredential]
+ $DatabaseCredentials = $null,
+
+ [System.String]
+ $DatabaseName = $null,
+
+ [System.String]
+ $DatabaseServer = $null,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Creating state service application $Name"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $params = Remove-xSharePointNullParamValues -Params $params
+
+ $app = Get-SPStateServiceApplication -Identity $params.Name -ErrorAction SilentlyContinue
+ if ($null -eq $app) {
+
+ $dbParams = @{}
+ if ($params.ContainsKey("DatabaseName")) { $dbParams.Add("Name", $params.DatabaseName) }
+ if ($params.ContainsKey("DatabaseServer")) { $dbParams.Add("DatabaseServer", $params.DatabaseServer) }
+ if ($params.ContainsKey("DatabaseCredentials")) { $dbParams.Add("DatabaseCredentials", $params.DatabaseCredentials) }
+
+ New-SPStateServiceDatabase @dbParams| New-SPStateServiceApplication -Name $params.Name | New-SPStateServiceApplicationProxy -DefaultProxyGroup
+ }
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [System.Management.Automation.PSCredential]
+ $DatabaseCredentials = $null,
+
+ [System.String]
+ $DatabaseName = $null,
+
+ [System.String]
+ $DatabaseServer = $null,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ $result = Get-TargetResource -Name $Name -InstallAccount $InstallAccount
+ Write-Verbose -Message "Testing for state service application $Name"
+ if ($result.Count -eq 0) { return $false }
+ return $true
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1
index 6c41c7321..1f726a84d 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUsageApplication/MSFT_xSPUsageApplication.psm1
@@ -1,178 +1,178 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Getting usage application '$Name'"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
- Where-Object { $_.TypeName -eq "Usage and Health Data Collection Service Application" }
- If ($null -eq $serviceApp)
- {
- return @{}
- }
- else
- {
- $service = Get-SPUsageService
- return @{
- Name = $serviceApp.DisplayName
- UsageLogCutTime = $service.UsageLogCutTime
- UsageLogDir = $service.UsageLogDir
- UsageLogMaxFileSize = $service.UsageLogMaxFileSize
- UsageLogMaxSpaceGB = $service.UsageLogMaxSpaceGB
- }
- }
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [System.String]
- $DatabaseName = $null,
-
- [System.String]
- $DatabasePassword = $null,
-
- [System.String]
- $DatabaseServer = $null,
-
- [System.String]
- $DatabaseUsername = $null,
-
- [System.String]
- $FailoverDatabaseServer = $null,
-
- [System.UInt32]
- $UsageLogCutTime = 5,
-
- [System.String]
- $UsageLogLocation = $null,
-
- [System.UInt32]
- $UsageLogMaxFileSizeKB = 1024,
-
- [System.UInt32]
- $UsageLogMaxSpaceGB = $null
- )
-
- Write-Verbose -Message "Setting usage application $Name"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
-
- $app = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue
-
- if ($null -eq $app) {
- $newParams = @{}
- $newParams.Add("Name", $params.Name)
- if ($params.ContainsKey("DatabaseName")) { $newParams.Add("DatabaseName", $params.DatabaseName) }
- if ($params.ContainsKey("DatabasePassword")) { $newParams.Add("DatabasePassword", $params.DatabasePassword) }
- if ($params.ContainsKey("DatabaseServer")) { $newParams.Add("DatabaseServer", $params.DatabaseServer) }
- if ($params.ContainsKey("DatabaseUsername")) { $newParams.Add("DatabaseUsername", $params.DatabaseUsername) }
- if ($params.ContainsKey("FailoverDatabaseServer")) { $newParams.Add("FailoverDatabaseServer", $params.FailoverDatabaseServer) }
-
- New-SPUsageApplication @newParams
- }
- }
-
- Write-Verbose -Message "Configuring usage application $Name"
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $params = Remove-xSharePointNullParamValues -Params $params
-
- $setParams = @{}
- $setParams.Add("LoggingEnabled", $true)
- if ($params.ContainsKey("UsageLogCutTime")) { $setParams.Add("UsageLogCutTime", $params.UsageLogCutTime) }
- if ($params.ContainsKey("UsageLogLocation")) { $setParams.Add("UsageLogLocation", $params.UsageLogLocation) }
- if ($params.ContainsKey("UsageLogMaxFileSizeKB")) { $setParams.Add("UsageLogMaxFileSizeKB", $params.UsageLogMaxFileSizeKB) }
- if ($params.ContainsKey("UsageLogMaxSpaceGB")) { $setParams.Add("UsageLogMaxSpaceGB", $params.UsageLogMaxSpaceGB) }
- Set-SPUsageService @setParams
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount,
-
- [System.String]
- $DatabaseName = $null,
-
- [System.String]
- $DatabasePassword = $null,
-
- [System.String]
- $DatabaseServer = $null,
-
- [System.String]
- $DatabaseUsername = $null,
-
- [System.String]
- $FailoverDatabaseServer = $null,
-
- [System.UInt32]
- $UsageLogCutTime = 5,
-
- [System.String]
- $UsageLogLocation = $null,
-
- [System.UInt32]
- $UsageLogMaxFileSizeKB = 1024,
-
- [System.UInt32]
- $UsageLogMaxSpaceGB = $null
- )
-
- $result = Get-TargetResource -Name $Name -InstallAccount $InstallAccount
- Write-Verbose -Message "Testing for usage application '$Name'"
- if ($result.Count -eq 0) { return $false }
- else {
- if ($PSBoundParameters.ContainsKey("UsageLogCutTime") -and $result.UsageLogCutTime -ne $UsageLogCutTime) { return $false }
- if ($PSBoundParameters.ContainsKey("UsageLogLocation") -and $result.UsageLogDir -ne $UsageLogLocation) { return $false }
- if ($PSBoundParameters.ContainsKey("UsageLogMaxFileSizeKB") -and $result.UsageLogMaxFileSize -ne $UsageLogMaxFileSizeKB) { return $false }
- if ($PSBoundParameters.ContainsKey("UsageLogMaxSpaceGB") -and $result.UsageLogMaxSpaceGB -ne $UsageLogMaxSpaceGB) { return $false }
- }
- return $true
-}
-
-
-Export-ModuleMember -Function *-TargetResource
-
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Getting usage application '$Name'"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
+ Where-Object { $_.TypeName -eq "Usage and Health Data Collection Service Application" }
+ If ($null -eq $serviceApp)
+ {
+ return @{}
+ }
+ else
+ {
+ $service = Get-SPUsageService
+ return @{
+ Name = $serviceApp.DisplayName
+ UsageLogCutTime = $service.UsageLogCutTime
+ UsageLogDir = $service.UsageLogDir
+ UsageLogMaxFileSize = $service.UsageLogMaxFileSize
+ UsageLogMaxSpaceGB = $service.UsageLogMaxSpaceGB
+ }
+ }
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [System.String]
+ $DatabaseName = $null,
+
+ [System.String]
+ $DatabasePassword = $null,
+
+ [System.String]
+ $DatabaseServer = $null,
+
+ [System.String]
+ $DatabaseUsername = $null,
+
+ [System.String]
+ $FailoverDatabaseServer = $null,
+
+ [System.UInt32]
+ $UsageLogCutTime = 5,
+
+ [System.String]
+ $UsageLogLocation = $null,
+
+ [System.UInt32]
+ $UsageLogMaxFileSizeKB = 1024,
+
+ [System.UInt32]
+ $UsageLogMaxSpaceGB = $null
+ )
+
+ Write-Verbose -Message "Setting usage application $Name"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ $app = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue
+
+ if ($null -eq $app) {
+ $newParams = @{}
+ $newParams.Add("Name", $params.Name)
+ if ($params.ContainsKey("DatabaseName")) { $newParams.Add("DatabaseName", $params.DatabaseName) }
+ if ($params.ContainsKey("DatabasePassword")) { $newParams.Add("DatabasePassword", $params.DatabasePassword) }
+ if ($params.ContainsKey("DatabaseServer")) { $newParams.Add("DatabaseServer", $params.DatabaseServer) }
+ if ($params.ContainsKey("DatabaseUsername")) { $newParams.Add("DatabaseUsername", $params.DatabaseUsername) }
+ if ($params.ContainsKey("FailoverDatabaseServer")) { $newParams.Add("FailoverDatabaseServer", $params.FailoverDatabaseServer) }
+
+ New-SPUsageApplication @newParams
+ }
+ }
+
+ Write-Verbose -Message "Configuring usage application $Name"
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $params = Remove-xSharePointNullParamValues -Params $params
+
+ $setParams = @{}
+ $setParams.Add("LoggingEnabled", $true)
+ if ($params.ContainsKey("UsageLogCutTime")) { $setParams.Add("UsageLogCutTime", $params.UsageLogCutTime) }
+ if ($params.ContainsKey("UsageLogLocation")) { $setParams.Add("UsageLogLocation", $params.UsageLogLocation) }
+ if ($params.ContainsKey("UsageLogMaxFileSizeKB")) { $setParams.Add("UsageLogMaxFileSizeKB", $params.UsageLogMaxFileSizeKB) }
+ if ($params.ContainsKey("UsageLogMaxSpaceGB")) { $setParams.Add("UsageLogMaxSpaceGB", $params.UsageLogMaxSpaceGB) }
+ Set-SPUsageService @setParams
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount,
+
+ [System.String]
+ $DatabaseName = $null,
+
+ [System.String]
+ $DatabasePassword = $null,
+
+ [System.String]
+ $DatabaseServer = $null,
+
+ [System.String]
+ $DatabaseUsername = $null,
+
+ [System.String]
+ $FailoverDatabaseServer = $null,
+
+ [System.UInt32]
+ $UsageLogCutTime = 5,
+
+ [System.String]
+ $UsageLogLocation = $null,
+
+ [System.UInt32]
+ $UsageLogMaxFileSizeKB = 1024,
+
+ [System.UInt32]
+ $UsageLogMaxSpaceGB = $null
+ )
+
+ $result = Get-TargetResource -Name $Name -InstallAccount $InstallAccount
+ Write-Verbose -Message "Testing for usage application '$Name'"
+ if ($result.Count -eq 0) { return $false }
+ else {
+ if ($PSBoundParameters.ContainsKey("UsageLogCutTime") -and $result.UsageLogCutTime -ne $UsageLogCutTime) { return $false }
+ if ($PSBoundParameters.ContainsKey("UsageLogLocation") -and $result.UsageLogDir -ne $UsageLogLocation) { return $false }
+ if ($PSBoundParameters.ContainsKey("UsageLogMaxFileSizeKB") -and $result.UsageLogMaxFileSize -ne $UsageLogMaxFileSizeKB) { return $false }
+ if ($PSBoundParameters.ContainsKey("UsageLogMaxSpaceGB") -and $result.UsageLogMaxSpaceGB -ne $UsageLogMaxSpaceGB) { return $false }
+ }
+ return $true
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1
index bfb537948..d9eb2e607 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileServiceApp/MSFT_xSPUserProfileServiceApp.psm1
@@ -1,188 +1,188 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPool,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $FarmAccount,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Getting user profile service application $Name"
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
- Where-Object { $_.TypeName -eq "User Profile Service Application" }
- If ($null -eq $serviceApp)
- {
- return @{}
- }
- else
- {
- return @{
- Name = $serviceApp.DisplayName
- ApplicationPool = $serviceApp.ApplicationPool.Name
- }
- }
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPool,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $FarmAccount,
-
- [System.String]
- $MySiteHostLocation = $null,
-
- [System.String]
- $ProfileDBName = $null,
-
- [System.String]
- $ProfileDBServer = $null,
-
- [System.String]
- $SocialDBName = $null,
-
- [System.String]
- $SocialDBServer = $null,
-
- [System.String]
- $SyncDBName = $null,
-
- [System.String]
- $SyncDBServer = $null,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Creating user profile service application $Name"
- $domainName = $FarmAccount.UserName.Split('\')[0]
- $userName = $FarmAccount.UserName.Split('\')[1]
- $computerName = "$env:computername"
-
- # Add the FarmAccount to the local Administrators group, if it's not already there
- $isLocalAdmin = ([ADSI]"WinNT://$computerName/Administrators,group").PSBase.Invoke("Members") |
- ForEach-Object {$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)} |
- Where-Object { $_ -eq $userName }
-
- if (!$isLocalAdmin)
- {
- Write-Verbose -Message "Adding $domainName\$userName to local admin group"
- ([ADSI]"WinNT://$computerName/Administrators,group").Add("WinNT://$domainName/$userName") | Out-Null
- }
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $FarmAccount -ForceNewSession $true
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $params = Remove-xSharePointNullParamValues -Params $params
- $params.Remove("InstallAccount") | Out-Null
- $params.Remove("FarmAccount") | Out-Null
-
- $params = Rename-xSharePointParamValue -params $params -oldName "SyncDBName" -newName "ProfileSyncDBName"
- $params = Rename-xSharePointParamValue -params $params -oldName "SyncDBServer" -newName "ProfileSyncDBServer"
-
- $app = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue
- if ($null -eq $app) {
- $app = New-SPProfileServiceApplication @params
- if ($null -ne $app) {
- New-SPProfileServiceApplicationProxy -Name ($params.Name + " Proxy") -ServiceApplication $app -DefaultProxyGroup
- }
- }
- }
-
- # Remove the FarmAccount from the local Administrators group, if it was added above
- if (!$isLocalAdmin)
- {
- Write-Verbose -Message "Removing $domainName\$userName from local admin group"
- ([ADSI]"WinNT://$computerName/Administrators,group").Remove("WinNT://$domainName/$userName") | Out-Null
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPool,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $FarmAccount,
-
- [System.String]
- $MySiteHostLocation = $null,
-
- [System.String]
- $ProfileDBName = $null,
-
- [System.String]
- $ProfileDBServer = $null,
-
- [System.String]
- $SocialDBName = $null,
-
- [System.String]
- $SocialDBServer = $null,
-
- [System.String]
- $SyncDBName = $null,
-
- [System.String]
- $SyncDBServer = $null,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -FarmAccount $FarmAccount -InstallAccount $InstallAccount
- Write-Verbose -Message "Testing for user profile service application $Name"
-
- if ($result.Count -eq 0) { return $false }
- else {
- if ($ApplicationPool -ne $result.ApplicationPool) { return $false }
- }
- return $true
-}
-
-Export-ModuleMember -Function *-TargetResource
-
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPool,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $FarmAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Getting user profile service application $Name"
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $serviceApp = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue |
+ Where-Object { $_.TypeName -eq "User Profile Service Application" }
+ If ($null -eq $serviceApp)
+ {
+ return @{}
+ }
+ else
+ {
+ return @{
+ Name = $serviceApp.DisplayName
+ ApplicationPool = $serviceApp.ApplicationPool.Name
+ }
+ }
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPool,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $FarmAccount,
+
+ [System.String]
+ $MySiteHostLocation = $null,
+
+ [System.String]
+ $ProfileDBName = $null,
+
+ [System.String]
+ $ProfileDBServer = $null,
+
+ [System.String]
+ $SocialDBName = $null,
+
+ [System.String]
+ $SocialDBServer = $null,
+
+ [System.String]
+ $SyncDBName = $null,
+
+ [System.String]
+ $SyncDBServer = $null,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Creating user profile service application $Name"
+ $domainName = $FarmAccount.UserName.Split('\')[0]
+ $userName = $FarmAccount.UserName.Split('\')[1]
+ $computerName = "$env:computername"
+
+ # Add the FarmAccount to the local Administrators group, if it's not already there
+ $isLocalAdmin = ([ADSI]"WinNT://$computerName/Administrators,group").PSBase.Invoke("Members") |
+ ForEach-Object {$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)} |
+ Where-Object { $_ -eq $userName }
+
+ if (!$isLocalAdmin)
+ {
+ Write-Verbose -Message "Adding $domainName\$userName to local admin group"
+ ([ADSI]"WinNT://$computerName/Administrators,group").Add("WinNT://$domainName/$userName") | Out-Null
+ }
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $FarmAccount -ForceNewSession $true
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $params = Remove-xSharePointNullParamValues -Params $params
+ $params.Remove("InstallAccount") | Out-Null
+ $params.Remove("FarmAccount") | Out-Null
+
+ $params = Rename-xSharePointParamValue -params $params -oldName "SyncDBName" -newName "ProfileSyncDBName"
+ $params = Rename-xSharePointParamValue -params $params -oldName "SyncDBServer" -newName "ProfileSyncDBServer"
+
+ $app = Get-SPServiceApplication -Name $params.Name -ErrorAction SilentlyContinue
+ if ($null -eq $app) {
+ $app = New-SPProfileServiceApplication @params
+ if ($null -ne $app) {
+ New-SPProfileServiceApplicationProxy -Name ($params.Name + " Proxy") -ServiceApplication $app -DefaultProxyGroup
+ }
+ }
+ }
+
+ # Remove the FarmAccount from the local Administrators group, if it was added above
+ if (!$isLocalAdmin)
+ {
+ Write-Verbose -Message "Removing $domainName\$userName from local admin group"
+ ([ADSI]"WinNT://$computerName/Administrators,group").Remove("WinNT://$domainName/$userName") | Out-Null
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPool,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $FarmAccount,
+
+ [System.String]
+ $MySiteHostLocation = $null,
+
+ [System.String]
+ $ProfileDBName = $null,
+
+ [System.String]
+ $ProfileDBServer = $null,
+
+ [System.String]
+ $SocialDBName = $null,
+
+ [System.String]
+ $SocialDBServer = $null,
+
+ [System.String]
+ $SyncDBName = $null,
+
+ [System.String]
+ $SyncDBServer = $null,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -FarmAccount $FarmAccount -InstallAccount $InstallAccount
+ Write-Verbose -Message "Testing for user profile service application $Name"
+
+ if ($result.Count -eq 0) { return $false }
+ else {
+ if ($ApplicationPool -ne $result.ApplicationPool) { return $false }
+ }
+ return $true
+}
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1
index 0a8a6bac8..9c426e7e5 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPUserProfileSyncService/MSFT_xSPUserProfileSyncService.psm1
@@ -1,170 +1,170 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $UserProfileServiceAppName,
-
- [parameter(Mandatory = $true)]
- [ValidateSet("Present","Absent")]
- [System.String]
- $Ensure,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $FarmAccount,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
- Write-Verbose -Message "Getting the local user profile sync service instance"
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $computerName = $env:COMPUTERNAME
-
- $syncService = Get-SPServiceInstance |
- Where-Object {$_.TypeName -match "User Profile Synchronization Service" -and $_.Server -match "SPServer Name=$computerName" }
-
- if ($null -eq $syncService) { return @{} }
-
- return @{
- Status = $syncService.Status
- }
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $UserProfileServiceAppName,
-
- [parameter(Mandatory = $true)]
- [ValidateSet("Present","Absent")]
- [System.String]
- $Ensure,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $FarmAccount,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Setting User Profile Synchronization Service"
-
-
- $domainName = $FarmAccount.UserName.Split('\')[0]
- $userName = $FarmAccount.UserName.Split('\')[1]
- $computerName = "$env:computername"
-
- # Add the FarmAccount to the local Admins group, if it's not already there
- $isLocalAdmin = ([ADSI]"WinNT://$computerName/Administrators,group").PSBase.Invoke("Members") |
- ForEach-Object {$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)} |
- Where-Object { $_ -eq $userName }
-
- if (!$isLocalAdmin)
- {
- ([ADSI]"WinNT://$computerName/Administrators,group").Add("WinNT://$domainName/$userName") | Out-Null
-
- # Cycle the Timer Service so that it picks up the local Admin token
- Restart-Service -Name "SPTimerV4"
- }
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $FarmAccount -ForceNewSession $true
-
- Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
-
- $computerName = $env:COMPUTERNAME
- $syncService = Get-SPServiceInstance |
- Where-Object {$_.TypeName -match "User Profile Synchronization Service" -and $_.Server -match "SPServer Name=$computerName" }
-
- # Start the Sync service if it should be running on this server
- if (($Ensure -eq "Present") -and ($syncService.Status -ne "Online")) {
- $ups = Get-SPServiceApplication -Name $params.UserProfileServiceAppName
- $ups.SetSynchronizationMachine("$computerName", $syncService.ID, $params.FarmAccount.UserName, $params.FarmAccount.GetNetworkCredential().Password)
- Start-SPServiceInstance -Identity $syncService.ID
- $desiredState = "Online"
- }
- # Stop the Sync service in all other cases
- else {
- Stop-SPServiceInstance -Identity $syncService.ID -Confirm:$false
- $desiredState = "Disabled"
- }
-
- $wait = $true
- $count = 0
- $maxCount = 10
- while ($wait) {
- Start-Sleep -Seconds 60
-
- # Get the current status of the Sync service
- $syncService = $(Get-SPServiceInstance |
- Where-Object {$_.TypeName -match "User Profile Synchronization Service" } |
- Where-Object {$_.Server -match "SPServer Name=$computerName"})
-
- # Continue to wait if haven't reached $maxCount or $desiredState
- $wait = (($count -lt $maxCount) -and ($syncService.Status -ne $desiredState))
- $count++
- }
- }
-
- # Remove the FarmAccount from the local Admins group, if it was added above
- if (!$isLocalAdmin)
- {
- ([ADSI]"WinNT://$computerName/Administrators,group").Remove("WinNT://$domainName/$userName") | Out-Null
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $UserProfileServiceAppName,
-
- [parameter(Mandatory = $true)]
- [ValidateSet("Present","Absent")]
- [System.String]
- $Ensure,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $FarmAccount,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- $result = Get-TargetResource -UserProfileServiceAppName $UserProfileServiceAppName -Ensure $Ensure -FarmAccount $FarmAccount -InstallAccount $InstallAccount
- Write-Verbose -Message "Testing for User Profile Synchronization Service"
- if ($result.Count -eq 0) { return $false }
- else {
- if (($result.Status -eq "Online") -and ($Ensure -ne "Present")) { return $false }
- if (($result.Status -eq "Disabled") -and ($Ensure -ne "Absent")) { return $false }
- }
- return $true
-}
-
-
-Export-ModuleMember -Function *-TargetResource
-
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $UserProfileServiceAppName,
+
+ [parameter(Mandatory = $true)]
+ [ValidateSet("Present","Absent")]
+ [System.String]
+ $Ensure,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $FarmAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+ Write-Verbose -Message "Getting the local user profile sync service instance"
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $computerName = $env:COMPUTERNAME
+
+ $syncService = Get-SPServiceInstance |
+ Where-Object {$_.TypeName -match "User Profile Synchronization Service" -and $_.Server -match "SPServer Name=$computerName" }
+
+ if ($null -eq $syncService) { return @{} }
+
+ return @{
+ Status = $syncService.Status
+ }
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $UserProfileServiceAppName,
+
+ [parameter(Mandatory = $true)]
+ [ValidateSet("Present","Absent")]
+ [System.String]
+ $Ensure,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $FarmAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Setting User Profile Synchronization Service"
+
+
+ $domainName = $FarmAccount.UserName.Split('\')[0]
+ $userName = $FarmAccount.UserName.Split('\')[1]
+ $computerName = "$env:computername"
+
+ # Add the FarmAccount to the local Admins group, if it's not already there
+ $isLocalAdmin = ([ADSI]"WinNT://$computerName/Administrators,group").PSBase.Invoke("Members") |
+ ForEach-Object {$_.GetType().InvokeMember("Name", 'GetProperty', $null, $_, $null)} |
+ Where-Object { $_ -eq $userName }
+
+ if (!$isLocalAdmin)
+ {
+ ([ADSI]"WinNT://$computerName/Administrators,group").Add("WinNT://$domainName/$userName") | Out-Null
+
+ # Cycle the Timer Service so that it picks up the local Admin token
+ Restart-Service -Name "SPTimerV4"
+ }
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $FarmAccount -ForceNewSession $true
+
+ Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ $computerName = $env:COMPUTERNAME
+ $syncService = Get-SPServiceInstance |
+ Where-Object {$_.TypeName -match "User Profile Synchronization Service" -and $_.Server -match "SPServer Name=$computerName" }
+
+ # Start the Sync service if it should be running on this server
+ if (($Ensure -eq "Present") -and ($syncService.Status -ne "Online")) {
+ $ups = Get-SPServiceApplication -Name $params.UserProfileServiceAppName
+ $ups.SetSynchronizationMachine("$computerName", $syncService.ID, $params.FarmAccount.UserName, $params.FarmAccount.GetNetworkCredential().Password)
+ Start-SPServiceInstance -Identity $syncService.ID
+ $desiredState = "Online"
+ }
+ # Stop the Sync service in all other cases
+ else {
+ Stop-SPServiceInstance -Identity $syncService.ID -Confirm:$false
+ $desiredState = "Disabled"
+ }
+
+ $wait = $true
+ $count = 0
+ $maxCount = 10
+ while ($wait) {
+ Start-Sleep -Seconds 60
+
+ # Get the current status of the Sync service
+ $syncService = $(Get-SPServiceInstance |
+ Where-Object {$_.TypeName -match "User Profile Synchronization Service" } |
+ Where-Object {$_.Server -match "SPServer Name=$computerName"})
+
+ # Continue to wait if haven't reached $maxCount or $desiredState
+ $wait = (($count -lt $maxCount) -and ($syncService.Status -ne $desiredState))
+ $count++
+ }
+ }
+
+ # Remove the FarmAccount from the local Admins group, if it was added above
+ if (!$isLocalAdmin)
+ {
+ ([ADSI]"WinNT://$computerName/Administrators,group").Remove("WinNT://$domainName/$userName") | Out-Null
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $UserProfileServiceAppName,
+
+ [parameter(Mandatory = $true)]
+ [ValidateSet("Present","Absent")]
+ [System.String]
+ $Ensure,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $FarmAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ $result = Get-TargetResource -UserProfileServiceAppName $UserProfileServiceAppName -Ensure $Ensure -FarmAccount $FarmAccount -InstallAccount $InstallAccount
+ Write-Verbose -Message "Testing for User Profile Synchronization Service"
+ if ($result.Count -eq 0) { return $false }
+ else {
+ if (($result.Status -eq "Online") -and ($Ensure -ne "Present")) { return $false }
+ if (($result.Status -eq "Disabled") -and ($Ensure -ne "Absent")) { return $false }
+ }
+ return $true
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1
index 236934792..c498c2669 100644
--- a/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1
+++ b/Modules/xSharePoint/DSCResources/MSFT_xSPWebApplication/MSFT_xSPWebApplication.psm1
@@ -1,185 +1,185 @@
-function Get-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Collections.Hashtable])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPool,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPoolAccount,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $Url,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Getting web application '$Name'"
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
- $wa = Get-SPWebApplication $params.Name -ErrorAction SilentlyContinue
- if ($null -eq $wa) { return @{} }
-
- return @{
- Name = $wa.DisplayName
- ApplicationPool = $wa.ApplicationPool.Name
- ApplicationPoolAccount = $wa.ApplicationPool.Username
- }
- }
- $result
-}
-
-
-function Set-TargetResource
-{
- [CmdletBinding()]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPool,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPoolAccount,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $Url,
-
- [System.Boolean]
- $AllowAnonymous = $false,
-
- [ValidateSet("NTLM","Kerberos")]
- [System.String]
- $AuthenticationMethod = "NTLM",
-
- [System.String]
- $DatabaseName = $null,
-
- [System.String]
- $DatabaseServer = $null,
-
- [System.String]
- $HostHeader = $null,
-
- [System.String]
- $Path = $null,
-
- [System.String]
- $Port = $null,
-
- [parameter(Mandatory = $true)]
- [System.Management.Automation.PSCredential]
- $InstallAccount
- )
-
- Write-Verbose -Message "Creating web application '$Name'"
-
- $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
-
- $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
- $params = $args[0]
-
- if ($AuthenticationMethod -eq "NTLM") {
- $ap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication -DisableKerberos
- $params.Add("AuthenticationProvider", $ap)
- } else {
- $ap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication
- $params.Add("AuthenticationProvider", $ap)
- }
-
- $wa = Get-SPWebApplication $params.Name -ErrorAction SilentlyContinue
- if ($null -eq $wa) {
- $params.Remove("InstallAccount") | Out-Null
- if ($params.ContainsKey("AuthenticationMethod")) { $params.Remove("AuthenticationMethod") | Out-Null }
- if ($params.ContainsKey("AllowAnonymous")) {
- $params.Remove("AllowAnonymous") | Out-Null
- $params.Add("AllowAnonymousAccess", $true)
- }
-
- New-SPWebApplication @params
- }
- }
-}
-
-
-function Test-TargetResource
-{
- [CmdletBinding()]
- [OutputType([System.Boolean])]
- param
- (
- [parameter(Mandatory = $true)]
- [System.String]
- $Name,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPool,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $ApplicationPoolAccount,
-
- [parameter(Mandatory = $true)]
- [System.String]
- $Url,
-
- [System.Boolean]
- $AllowAnonymous = $false,
-
- [ValidateSet("NTLM","Kerberos")]
- [System.String]
- $AuthenticationMethod = "NTLM",
-
- [System.String]
- $DatabaseName = $null,
-
- [System.String]
- $DatabaseServer = $null,
-
- [System.String]
- $HostHeader = $null,
-
- [System.String]
- $Path = $null,
-
- [System.String]
- $Port = $null,
-
- [System.Management.Automation.PSCredential]
- [parameter(Mandatory = $true)]
- $InstallAccount
- )
-
- $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -ApplicationPoolAccount $ApplicationPoolAccount -Url $Url -InstallAccount $InstallAccount
- Write-Verbose -Message "Testing for web application '$Name'"
- if ($result.Count -eq 0) { return $false }
- else {
- if ($result.ApplicationPool -ne $ApplicationPool) { return $false }
- if ($result.ApplicationPoolAccount -ne $ApplicationPoolAccount) { return $false }
- }
- return $true
-}
-
-
-Export-ModuleMember -Function *-TargetResource
-
+function Get-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Collections.Hashtable])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPool,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPoolAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Url,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Getting web application '$Name'"
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+ $wa = Get-SPWebApplication $params.Name -ErrorAction SilentlyContinue
+ if ($null -eq $wa) { return @{} }
+
+ return @{
+ Name = $wa.DisplayName
+ ApplicationPool = $wa.ApplicationPool.Name
+ ApplicationPoolAccount = $wa.ApplicationPool.Username
+ }
+ }
+ $result
+}
+
+
+function Set-TargetResource
+{
+ [CmdletBinding()]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPool,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPoolAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Url,
+
+ [System.Boolean]
+ $AllowAnonymous = $false,
+
+ [ValidateSet("NTLM","Kerberos")]
+ [System.String]
+ $AuthenticationMethod = "NTLM",
+
+ [System.String]
+ $DatabaseName = $null,
+
+ [System.String]
+ $DatabaseServer = $null,
+
+ [System.String]
+ $HostHeader = $null,
+
+ [System.String]
+ $Path = $null,
+
+ [System.String]
+ $Port = $null,
+
+ [parameter(Mandatory = $true)]
+ [System.Management.Automation.PSCredential]
+ $InstallAccount
+ )
+
+ Write-Verbose -Message "Creating web application '$Name'"
+
+ $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount
+
+ $result = Invoke-Command -Session $session -ArgumentList $PSBoundParameters -ScriptBlock {
+ $params = $args[0]
+
+ if ($AuthenticationMethod -eq "NTLM") {
+ $ap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication -DisableKerberos
+ $params.Add("AuthenticationProvider", $ap)
+ } else {
+ $ap = New-SPAuthenticationProvider -UseWindowsIntegratedAuthentication
+ $params.Add("AuthenticationProvider", $ap)
+ }
+
+ $wa = Get-SPWebApplication $params.Name -ErrorAction SilentlyContinue
+ if ($null -eq $wa) {
+ $params.Remove("InstallAccount") | Out-Null
+ if ($params.ContainsKey("AuthenticationMethod")) { $params.Remove("AuthenticationMethod") | Out-Null }
+ if ($params.ContainsKey("AllowAnonymous")) {
+ $params.Remove("AllowAnonymous") | Out-Null
+ $params.Add("AllowAnonymousAccess", $true)
+ }
+
+ New-SPWebApplication @params
+ }
+ }
+}
+
+
+function Test-TargetResource
+{
+ [CmdletBinding()]
+ [OutputType([System.Boolean])]
+ param
+ (
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Name,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPool,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $ApplicationPoolAccount,
+
+ [parameter(Mandatory = $true)]
+ [System.String]
+ $Url,
+
+ [System.Boolean]
+ $AllowAnonymous = $false,
+
+ [ValidateSet("NTLM","Kerberos")]
+ [System.String]
+ $AuthenticationMethod = "NTLM",
+
+ [System.String]
+ $DatabaseName = $null,
+
+ [System.String]
+ $DatabaseServer = $null,
+
+ [System.String]
+ $HostHeader = $null,
+
+ [System.String]
+ $Path = $null,
+
+ [System.String]
+ $Port = $null,
+
+ [System.Management.Automation.PSCredential]
+ [parameter(Mandatory = $true)]
+ $InstallAccount
+ )
+
+ $result = Get-TargetResource -Name $Name -ApplicationPool $ApplicationPool -ApplicationPoolAccount $ApplicationPoolAccount -Url $Url -InstallAccount $InstallAccount
+ Write-Verbose -Message "Testing for web application '$Name'"
+ if ($result.Count -eq 0) { return $false }
+ else {
+ if ($result.ApplicationPool -ne $ApplicationPool) { return $false }
+ if ($result.ApplicationPoolAccount -ne $ApplicationPoolAccount) { return $false }
+ }
+ return $true
+}
+
+
+Export-ModuleMember -Function *-TargetResource
+
diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1
index abc62a768..1dd4c287e 100644
--- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1
+++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1
@@ -10,12 +10,13 @@ function Get-xSharePointAuthenticatedPSSession() {
[System.Boolean]
$ForceNewSession = $false
)
+
+ # Remove existing sessions to keep things clean
+ Get-PSSession | Where-Object { $_.ComputerName -eq "localhost" -and $_.Runspace.OriginalConnectionInfo.Credential.UserName -eq $Credential.UserName } | Remove-PSSession
+ [GC]::Collect()
- $session = @(Get-PSSession | Where-Object { $_.ComputerName -eq "." -and $_.Runspace.OriginalConnectionInfo.Credential.UserName -eq $Credential.UserName -and $_.State -eq "Open"})
-
- if (($session.Count -eq 0) -or ($ForceNewSession -eq $true)) {
Write-Verbose -Message "Creating new PowerShell session"
- $session = New-PSSession -ComputerName "." -Credential $Credential -Authentication Credssp -SessionOption (New-PSSessionOption -OperationTimeout 600000 -SkipCACheck -SkipCNCheck -SkipRevocationCheck)
+ $session = New-PSSession -ComputerName $env:COMPUTERNAME -Credential $Credential -Authentication CredSSP
Invoke-Command -Session $session -ScriptBlock {
if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue))
{
@@ -24,12 +25,6 @@ function Get-xSharePointAuthenticatedPSSession() {
}
return $session
}
- else
- {
- Write-Verbose -Message "Using existing PowerShell session '$($session[0].InstanceId)'"
- return $session[0]
- }
-}
function Rename-xSharePointParamValue() {
[CmdletBinding()]
diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1
index 88fa5fb42..618fdd2df 100644
--- a/Modules/xSharePoint/xSharePoint.psd1
+++ b/Modules/xSharePoint/xSharePoint.psd1
@@ -1,101 +1,101 @@
-#
-# Module manifest for module 'xSharePoint'
-#
-# Generated by: Brian Farnhill
-#
-# Generated on: 17/03/2015
-#
-
-@{
-
-# Script module or binary module file associated with this manifest.
-# RootModule = ''
-
-# Version number of this module.
-ModuleVersion = '0.3.1.0'
-
-# ID used to uniquely identify this module
-GUID = '6c1176a0-4fac-4134-8ca2-3fa8a21a7b90'
-
-# Author of this module
-Author = 'Microsoft Corporation'
-
-# Company or vendor of this module
-CompanyName = 'Microsoft Corporation'
-
-# Copyright statement for this module
-Copyright = '(c) 2015 Microsoft Corporation. All rights reserved.'
-
-# Description of the functionality provided by this module
-Description = 'This DSC module is used to deploy and configure SharePoint Server 2013, and convers a wide range of areas including web apps, service apps and farm configuration.'
-
-# Minimum version of the Windows PowerShell engine required by this module
-# PowerShellVersion = ''
-
-# Name of the Windows PowerShell host required by this module
-# PowerShellHostName = ''
-
-# Minimum version of the Windows PowerShell host required by this module
-# PowerShellHostVersion = ''
-
-# Minimum version of Microsoft .NET Framework required by this module
-# DotNetFrameworkVersion = ''
-
-# Minimum version of the common language runtime (CLR) required by this module
-# CLRVersion = ''
-
-# Processor architecture (None, X86, Amd64) required by this module
-# ProcessorArchitecture = ''
-
-# Modules that must be imported into the global environment prior to importing this module
-# RequiredModules = @()
-
-# Assemblies that must be loaded prior to importing this module
-# RequiredAssemblies = @()
-
-# Script files (.ps1) that are run in the caller's environment prior to importing this module.
-# ScriptsToProcess = @()
-
-# Type files (.ps1xml) to be loaded when importing this module
-# TypesToProcess = @()
-
-# Format files (.ps1xml) to be loaded when importing this module
-# FormatsToProcess = @()
-
-# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
-NestedModules = @("modules\xSharePoint.DistributedCache\xSharePoint.DistributedCache.psm1",
- "modules\xSharePoint.Util\xSharePoint.Util.psm1")
-
-# Functions to export from this module
-FunctionsToExport = '*'
-
-# Cmdlets to export from this module
-CmdletsToExport = @("Add-xSharePointDistributedCacheServer",
- "Remove-xSharePointDistributedCacheServer",
- "Get-xSharePointAuthenticatedPSSession",
- "Rename-xSharePointParamValue",
- "Remove-xSharePointNullParamValues")
-
-# Variables to export from this module
-VariablesToExport = '*'
-
-# Aliases to export from this module
-AliasesToExport = '*'
-
-# List of all modules packaged with this module
-# ModuleList = @()
-
-# List of all files packaged with this module
-# FileList = @()
-
-# Private data to pass to the module specified in RootModule/ModuleToProcess
-# PrivateData = ''
-
-# HelpInfo URI of this module
-# HelpInfoURI = ''
-
-# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
-# DefaultCommandPrefix = ''
-
-}
-
+#
+# Module manifest for module 'xSharePoint'
+#
+# Generated by: Brian Farnhill
+#
+# Generated on: 17/03/2015
+#
+
+@{
+
+# Script module or binary module file associated with this manifest.
+# RootModule = ''
+
+# Version number of this module.
+ModuleVersion = '0.5.0'
+
+# ID used to uniquely identify this module
+GUID = '6c1176a0-4fac-4134-8ca2-3fa8a21a7b90'
+
+# Author of this module
+Author = 'Microsoft Corporation'
+
+# Company or vendor of this module
+CompanyName = 'Microsoft Corporation'
+
+# Copyright statement for this module
+Copyright = '(c) 2015 Microsoft Corporation. All rights reserved.'
+
+# Description of the functionality provided by this module
+Description = 'This DSC module is used to deploy and configure SharePoint Server 2013, and convers a wide range of areas including web apps, service apps and farm configuration.'
+
+# Minimum version of the Windows PowerShell engine required by this module
+# PowerShellVersion = ''
+
+# Name of the Windows PowerShell host required by this module
+# PowerShellHostName = ''
+
+# Minimum version of the Windows PowerShell host required by this module
+# PowerShellHostVersion = ''
+
+# Minimum version of Microsoft .NET Framework required by this module
+# DotNetFrameworkVersion = ''
+
+# Minimum version of the common language runtime (CLR) required by this module
+# CLRVersion = ''
+
+# Processor architecture (None, X86, Amd64) required by this module
+# ProcessorArchitecture = ''
+
+# Modules that must be imported into the global environment prior to importing this module
+# RequiredModules = @()
+
+# Assemblies that must be loaded prior to importing this module
+# RequiredAssemblies = @()
+
+# Script files (.ps1) that are run in the caller's environment prior to importing this module.
+# ScriptsToProcess = @()
+
+# Type files (.ps1xml) to be loaded when importing this module
+# TypesToProcess = @()
+
+# Format files (.ps1xml) to be loaded when importing this module
+# FormatsToProcess = @()
+
+# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
+NestedModules = @("modules\xSharePoint.DistributedCache\xSharePoint.DistributedCache.psm1",
+ "modules\xSharePoint.Util\xSharePoint.Util.psm1")
+
+# Functions to export from this module
+FunctionsToExport = '*'
+
+# Cmdlets to export from this module
+CmdletsToExport = @("Add-xSharePointDistributedCacheServer",
+ "Remove-xSharePointDistributedCacheServer",
+ "Get-xSharePointAuthenticatedPSSession",
+ "Rename-xSharePointParamValue",
+ "Remove-xSharePointNullParamValues")
+
+# Variables to export from this module
+VariablesToExport = '*'
+
+# Aliases to export from this module
+AliasesToExport = '*'
+
+# List of all modules packaged with this module
+# ModuleList = @()
+
+# List of all files packaged with this module
+# FileList = @()
+
+# Private data to pass to the module specified in RootModule/ModuleToProcess
+# PrivateData = ''
+
+# HelpInfo URI of this module
+# HelpInfoURI = ''
+
+# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
+# DefaultCommandPrefix = ''
+
+}
+
diff --git a/README.md b/README.md
index 1997490f4..34fcd3d67 100644
--- a/README.md
+++ b/README.md
@@ -68,14 +68,15 @@ Additional detailed documentation is included on the wiki on GitHub.
## Version History
-### Unreleased
+### 0.5.0
+* Added support for SharePoint 2016 prerequisites, binary installation, creation and joining of a farm
-### 0.4.0.0
+### 0.4.0
* Fixed issue with nested modules’ cmdlets not being found
-### 0.3.0.0
+### 0.3.0
* Fixed issue with detection of Identity Extensions in xSPInstallPrereqs resource
* Changes to comply with PSScriptAnalyzer rules
diff --git a/appveyor.yml b/appveyor.yml
index b35dd9b6d..3abd1fc50 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,8 +1,11 @@
-version: 0.3.1.{build}
+version: 0.5.0.{build}
install:
-- cinst -y pester
-- git clone https://github.com/PowerShell/DscResource.Tests
+ - cinst -y pester
+ - git clone https://github.com/PowerShell/DscResource.Tests
+ - ps: |
+ Import-Module .\DscResource.Tests\TestHelper.psm1 -force
+
build: off
@@ -14,17 +17,22 @@ test_script:
if ($res.FailedCount -gt 0) {
throw "$($res.FailedCount) tests failed."
}
-deploy: off
-on_finish:
+
+after_test:
- ps: |
- $stagingDirectory = (Resolve-Path ..).Path
- $pwd = Join-Path $pwd "modules\xSharePoint"
- Remove-Item (Join-Path $pwd "xSharePoint.pssproj")
- $manifest = Join-Path $pwd "xSharePoint.psd1"
- (Get-Content $manifest -Raw).Replace("0.2.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest
- $zipFile = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip"
+
+
+
+ Remove-Item (Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.pssproj")
+ $manifest = Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.psd1"
+ (Get-Content $manifest -Raw).Replace("0.5.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest
Add-Type -assemblyname System.IO.Compression.FileSystem
- [System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFile)
- @(
- (ls $zipFile)
- ) | % { Push-AppveyorArtifact $_.FullName }
+ [System.IO.Compression.ZipFile]::CreateFromDirectory("$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint", "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip")
+ Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
+
+ New-Nuspec -packageName $env:APPVEYOR_PROJECT_NAME -version $env:APPVEYOR_BUILD_VERSION -author "Microsoft" -owners "Microsoft" -licenseUrl "https://github.com/PowerShell/DscResources/blob/master/LICENSE" -projectUrl "https://github.com/$($env:APPVEYOR_REPO_NAME)" -packageDescription $env:APPVEYOR_PROJECT_NAME -tags "DesiredStateConfiguration DSC DSCResourceKit" -destinationPath .
+ nuget pack ".\$($env:APPVEYOR_PROJECT_NAME).nuspec" -outputdirectory $env:APPVEYOR_BUILD_FOLDER
+ $nuGetPackageName = $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg"
+ Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\$nuGetPackageName" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
+
+
\ No newline at end of file