From 916797bc641cdc7c6bd85e946f48ed77e5c98b34 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Mon, 11 May 2015 12:46:49 +1000 Subject: [PATCH 01/60] Prereq installer support for SP2016 --- .../MSFT_xSPInstallPrereqs.psm1 | 114 ++++++++++++------ .../MSFT_xSPInstallPrereqs.schema.mof | 2 + .../xSharePoint.Util/xSharePoint.Util.psm1 | 10 ++ 3 files changed, 92 insertions(+), 34 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 index b08236228..0d11b4476 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 @@ -10,28 +10,51 @@ function Get-TargetResource ) $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" - $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 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 - #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 + + #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("Active Directory Rights Management Services Client 2.0", (($installedItems | ? {$_.Name -eq "Active Directory Rights Management Services Client 2.0"}) -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.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)) + #SP2013 prereqs + if ($majorVersion -eq 15) { + $returnValue.Add("Microsoft SQL Server 2008 R2 Native Client", (($installedItems | ? {$_.Name -eq "Microsoft SQL Server 2008 R2 Native Client"}) -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 } @@ -67,42 +90,61 @@ function Set-TargetResource [System.String] $KB2671763 = [System.String]::Empty, [System.String] - $WCFDataServices56 = [System.String]::Empty + $WCFDataServices56 = [System.String]::Empty, + [System.String] + $KB2898850 = [System.String]::Empty, + [System.String] + $MSVCRT12 = [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 "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") } - 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`"" + $args = "/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 { + $args += " /$_ `"$($PSBoundParameters.$_)`"" + } } + + Write-Verbose -Message "Calling the SharePoint Pre-req installer" Write-Verbose -Message "Args for prereq installer are: $args" - $process = Start-Process -FilePath $InstallerPath -ArgumentList $args -Wait + $process = Start-Process -FilePath $InstallerPath -ArgumentList $args -Wait -PassThru switch ($process.ExitCode) { 0 { - Write-Verbose -Message "Installer completed successfully" + Write-Verbose -Message "Prerequisite installer completed successfully" } - default { - $code = $process.ExitCode - Write-Verbose -Message "Machine needs reboot, exit code was $code" + 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." $global:DSCMachineStatus = 1 } + default { + throw "The prerequisite installer ran with the following unknown exit code $($process.ExitCode)" + } } } @@ -139,7 +181,11 @@ function Test-TargetResource [System.String] $KB2671763 = [System.String]::Empty, [System.String] - $WCFDataServices56 = [System.String]::Empty + $WCFDataServices56 = [System.String]::Empty, + [System.String] + $KB2898850 = [System.String]::Empty, + [System.String] + $MSVCRT12 = [System.String]::Empty ) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof index e7337f051..70e5d82ec 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof @@ -14,5 +14,7 @@ class MSFT_xSPInstallPrereqs : OMI_BaseResource [Write] String WCFDataServices; [Write] String KB2671763; [Write] String WCFDataServices56; + [Write] String KB2898850; + [Write] String MSVCRT12; }; diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 799bb4f2d..73bafb018 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -68,4 +68,14 @@ function Remove-xSharePointNullParamValues() { return $Params } +function Get-xSharePointAssemblyVerion() { + [CmdletBinding()] + param + ( + [parameter(Mandatory = $true,Position=1)] + $PathToAssembly + ) + return (Get-Command $PathToAssembly).Version +} + Export-ModuleMember -Function * From 6340908510fd1bc1faf0e241435e1d97502749c4 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 30 Jul 2015 16:37:19 -0700 Subject: [PATCH 02/60] Minor changes to bug fixes for join/create farm --- .gitattributes | 63 +++ .../MSFT_xSPCreateFarm.psm1 | 313 +++++++------- .../MSFT_xSPInstall/MSFT_xSPInstall.psm1 | 196 +++++---- .../MSFT_xSPInstallPrereqs.psm1 | 408 +++++++++--------- .../MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 | 371 ++++++++-------- .../xSharePoint.Util/xSharePoint.Util.psm1 | 6 +- 6 files changed, 706 insertions(+), 651 deletions(-) create mode 100644 .gitattributes 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_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 index 8c9cfed9f..f79c50fcc 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 @@ -1,168 +1,145 @@ -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 - ) - - 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 - ) - - $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 9999 -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 - ) - - $result = Get-TargetResource -FarmConfigDatabaseName $FarmConfigDatabaseName -DatabaseServer $DatabaseServer -FarmAccount $FarmAccount -InstallAccount $InstallAccount -Passphrase $Passphrase -AdminContentDatabaseName $AdminContentDatabaseName - - 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, + + [parameter(Mandatory = $true)] + [System.String] + $AdminContentDatabaseName + ) + + 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 + ) + + $session = Get-xSharePointAuthenticatedPSSession -Credential $InstallAccount -ForceNewSession $true + + Write-Verbose -Message "Setting up farm" + 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 + + 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 + ) + + $result = Get-TargetResource -FarmConfigDatabaseName $FarmConfigDatabaseName -DatabaseServer $DatabaseServer -FarmAccount $FarmAccount -InstallAccount $InstallAccount -Passphrase $Passphrase -AdminContentDatabaseName $AdminContentDatabaseName + + if ($result.Count -eq 0) { 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_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 index 0d11b4476..314e9b5f2 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 @@ -1,203 +1,205 @@ -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("Active Directory Rights Management Services Client 2.0", (($installedItems | ? {$_.Name -eq "Active Directory Rights Management Services Client 2.0"}) -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.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)) - - #SP2013 prereqs - if ($majorVersion -eq 15) { - $returnValue.Add("Microsoft SQL Server 2008 R2 Native Client", (($installedItems | ? {$_.Name -eq "Microsoft SQL Server 2008 R2 Native Client"}) -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 -} - - -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") - } - - $args = "/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 { - $args += " /$_ `"$($PSBoundParameters.$_)`"" - } - } - - Write-Verbose -Message "Calling the SharePoint Pre-req installer" - Write-Verbose -Message "Args for prereq installer are: $args" - $process = Start-Process -FilePath $InstallerPath -ArgumentList $args -Wait -PassThru - - switch ($process.ExitCode) { - 0 { - Write-Verbose -Message "Prerequisite installer completed successfully" - } - 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." - $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 - +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.0", (($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_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 index 0efcba8e1..31bd28e2a 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 @@ -1,183 +1,188 @@ -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 + + 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 + diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 73bafb018..abc62a768 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -10,12 +10,12 @@ function Get-xSharePointAuthenticatedPSSession() { [System.Boolean] $ForceNewSession = $false ) - - $session = @(Get-PSSession | Where-Object { $_.ComputerName -eq $env:COMPUTERNAME -and $_.Runspace.OriginalConnectionInfo.Credential.UserName -eq $Credential.UserName}) + $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 $env:COMPUTERNAME -Credential $Credential -Authentication CredSSP + $session = New-PSSession -ComputerName "." -Credential $Credential -Authentication Credssp -SessionOption (New-PSSessionOption -OperationTimeout 600000 -SkipCACheck -SkipCNCheck -SkipRevocationCheck) Invoke-Command -Session $session -ScriptBlock { if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) { From ba2cba9402716c07a16ad8607beac6cbbb855d53 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Tue, 4 Aug 2015 13:41:13 +1000 Subject: [PATCH 03/60] bug fixes in remote sessions --- .../MSFT_xSPClearRemoteSessions.psm1 | 4 +-- .../xSharePoint.Util/xSharePoint.Util.psm1 | 26 +++++++------------ 2 files changed, 12 insertions(+), 18 deletions(-) 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/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index abc62a768..679f833b4 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -11,24 +11,18 @@ function Get-xSharePointAuthenticatedPSSession() { $ForceNewSession = $false ) - $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) - Invoke-Command -Session $session -ScriptBlock { - if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) - { - Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" - } + # Remove existing sessions to keep things clean + Get-PSSession | Where-Object { $_.ComputerName -eq "localhost" -and $_.Runspace.OriginalConnectionInfo.Credential.UserName -eq $Credential.UserName } | Remove-PSSession + + Write-Verbose -Message "Creating new PowerShell session" + $session = New-PSSession -ComputerName "." -Credential $Credential -Authentication Credssp -SessionOption (New-PSSessionOption -OperationTimeout 600000 -SkipCACheck -SkipCNCheck -SkipRevocationCheck) + Invoke-Command -Session $session -ScriptBlock { + if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) + { + Add-PSSnapin -Name "Microsoft.SharePoint.PowerShell" } - return $session - } - else - { - Write-Verbose -Message "Using existing PowerShell session '$($session[0].InstanceId)'" - return $session[0] } + return $session } function Rename-xSharePointParamValue() { From da3e6b60e8fbc62e81c11965957089451a21c6a0 Mon Sep 17 00:00:00 2001 From: KarolKaczmarek Date: Tue, 11 Aug 2015 14:30:43 -0700 Subject: [PATCH 04/60] Updating version to 0.4.0.0 to match PSGallery Last version of this module has been released to PSGallery as 0.4.0.0. http://powershellgallery.com/packages/xsharepoint We can't decrease version number (PSGallery does not allow it and besides that it's not a good practice). --- Modules/xSharePoint/xSharePoint.psd1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1 index 88fa5fb42..d83311a98 100644 --- a/Modules/xSharePoint/xSharePoint.psd1 +++ b/Modules/xSharePoint/xSharePoint.psd1 @@ -12,7 +12,7 @@ # RootModule = '' # Version number of this module. -ModuleVersion = '0.3.1.0' +ModuleVersion = '0.4.0.0' # ID used to uniquely identify this module GUID = '6c1176a0-4fac-4134-8ca2-3fa8a21a7b90' From 50ab79cdf427dcee05d345468edb86822921f298 Mon Sep 17 00:00:00 2001 From: KarolKaczmarek Date: Tue, 11 Aug 2015 14:34:17 -0700 Subject: [PATCH 05/60] Create nuget package --- appveyor.yml | 74 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 19 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index b35dd9b6d..04f47fb7c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,10 +1,24 @@ -version: 0.3.1.{build} +#---------------------------------# +# environment configuration # +#---------------------------------# +version: 0.4.0.{build} +install: + - cinst -y pester + - git clone https://github.com/PowerShell/DscResource.Tests + - ps: Push-Location + - cd DscResource.Tests + - ps: Import-Module .\TestHelper.psm1 -force + - ps: Pop-Location -install: -- cinst -y pester -- git clone https://github.com/PowerShell/DscResource.Tests +#---------------------------------# +# build configuration # +#---------------------------------# -build: off +build: false + +#---------------------------------# +# test configuration # +#---------------------------------# test_script: - ps: | @@ -14,17 +28,39 @@ test_script: if ($res.FailedCount -gt 0) { throw "$($res.FailedCount) tests failed." } -deploy: off -on_finish: - - 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" - Add-Type -assemblyname System.IO.Compression.FileSystem - [System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFile) - @( - (ls $zipFile) - ) | % { Push-AppveyorArtifact $_.FullName } + +#---------------------------------# +# deployment configuration # +#---------------------------------# + +# scripts to run before deployment +before_deploy: + - ps: | + # Creating project artifact + $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.4.0.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest + $zipFilePath = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip" + Add-Type -assemblyname System.IO.Compression.FileSystem + [System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFilePath) + + # Creating NuGet package artifact + 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 . + $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" + $nuGetPackagePath = (Get-ChildItem $nuGetPackageName).FullName + + @( + # You can add other artifacts here + $zipFilePath, + $nuGetPackagePath + ) | % { + Write-Host "Pushing package $_ as Appveyor artifact" + Push-AppveyorArtifact $_ + } + + + + From 5df24af24f72e63e0eed2402aa27e3fbd530f5ca Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Thu, 13 Aug 2015 15:31:29 +1000 Subject: [PATCH 06/60] Removed additional "s" from file --- .../MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof | 1 - 1 file changed, 1 deletion(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof index d51f8626e..7484cb7f4 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.schema.mof @@ -10,4 +10,3 @@ class MSFT_xSPCreateFarm : OMI_BaseResource [Required] String AdminContentDatabaseName; [Write] uint32 CentralAdministrationPort; }; -S \ No newline at end of file From ff71b92f195a927c662e05d95e4dc5c0833e59e2 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Fri, 14 Aug 2015 21:11:49 +1000 Subject: [PATCH 07/60] Added default minrole options for 2016 create and join farm --- .../MSFT_xSPBCSServiceApp.psm1 | 258 +++++----- .../MSFT_xSPCacheAccounts.psm1 | 268 +++++----- .../MSFT_xSPCreateFarm.psm1 | 47 +- .../MSFT_xSPDiagnosticLoggingSettings.psm1 | 458 +++++++++--------- ...FT_xSPDiagnosticLoggingSettings.schema.mof | 50 +- .../MSFT_xSPDistributedCacheService.psm1 | 384 +++++++-------- .../MSFT_xSPFeature/MSFT_xSPFeature.psm1 | 302 ++++++------ .../MSFT_xSPInstall.schema.mof | 14 +- .../MSFT_xSPInstallPrereqs.psm1 | 2 +- .../MSFT_xSPInstallPrereqs.schema.mof | 40 +- .../MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 | 37 +- .../MSFT_xSPManagedAccount.psm1 | 276 +++++------ .../MSFT_xSPManagedMetaDataServiceApp.psm1 | 272 +++++------ ...FT_xSPManagedMetaDataServiceApp.schema.mof | 18 +- .../MSFT_xSPManagedPath.psm1 | 308 ++++++------ .../MSFT_xSPSearchServiceApp.psm1 | 268 +++++----- .../MSFT_xSPSecureStoreServiceApp.psm1 | 382 +++++++-------- .../MSFT_xSPServiceAppPool.psm1 | 210 ++++---- .../MSFT_xSPServiceInstance.psm1 | 242 ++++----- .../MSFT_xSPSite/MSFT_xSPSite.psm1 | 344 ++++++------- .../MSFT_xSPStateServiceApp.psm1 | 224 ++++----- .../MSFT_xSPUsageApplication.psm1 | 356 +++++++------- .../MSFT_xSPUserProfileServiceApp.psm1 | 376 +++++++------- .../MSFT_xSPUserProfileSyncService.psm1 | 340 ++++++------- .../MSFT_xSPWebApplication.psm1 | 370 +++++++------- .../xSharePoint.Util/xSharePoint.Util.psm1 | 3 +- Modules/xSharePoint/xSharePoint.psd1 | 190 ++++---- 27 files changed, 3038 insertions(+), 3001 deletions(-) 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_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 index f79c50fcc..5de10c0bc 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPCreateFarm/MSFT_xSPCreateFarm.psm1 @@ -85,20 +85,39 @@ function Set-TargetResource Write-Verbose -Message "Setting up farm" 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 - - Install-SPHelpCollection -All - Initialize-SPResourceSecurity - Install-SPService - Install-SPFeature -AllExistingFeatures -Force - New-SPCentralAdministration -Port 9999 -WindowsAuthProvider NTLM - Install-SPApplicationContent + $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 } } 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.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 314e9b5f2..e89876050 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 @@ -54,7 +54,7 @@ function Get-TargetResource $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.0", (($installedItems | ? {$_.Name -eq "Active Directory Rights Management Services Client 2.1"}) -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 } diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof index 70e5d82ec..3a446088b 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.schema.mof @@ -1,20 +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; - [Write] String KB2898850; - [Write] String MSVCRT12; -}; - +[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 31bd28e2a..9565e5495 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPJoinFarm/MSFT_xSPJoinFarm.psm1 @@ -84,20 +84,37 @@ function Set-TargetResource 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} - + $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 { - Connect-SPConfigurationDatabase -DatabaseName $params.FarmConfigDatabaseName ` - -DatabaseServer $params.DatabaseServer ` - -Passphrase (ConvertTo-SecureString -String $params.Passphrase -AsPlainText -force) ` - -SkipRegisterAsDistributedCacheHost:$true + 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 @@ -112,7 +129,7 @@ function Set-TargetResource Invoke-Command -Session $session -ScriptBlock { Install-SPHelpCollection -All } - + Write-Verbose -Message "Initialising farm resource security" Invoke-Command -Session $session -ScriptBlock { Initialize-SPResourceSecurity 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 679f833b4..24649a436 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -13,9 +13,10 @@ function Get-xSharePointAuthenticatedPSSession() { # 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() 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 "." -Credential $Credential -Authentication Credssp -SessionOption (New-PSSessionOption -OperationTimeout 0 -SkipCACheck -SkipCNCheck -SkipRevocationCheck) Invoke-Command -Session $session -ScriptBlock { if ($null -eq (Get-PSSnapin -Name "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue)) { diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1 index a90337cef..ad008567f 100644 --- a/Modules/xSharePoint/xSharePoint.psd1 +++ b/Modules/xSharePoint/xSharePoint.psd1 @@ -1,97 +1,97 @@ -# -# 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.2.0' - -# ID used to uniquely identify this module -GUID = '6c1176a0-4fac-4134-8ca2-3fa8a21a7b90' - +# +# 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.2.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 +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 = '*' - -# 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 = '' - -} - + +# 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 = '*' + +# 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 = '' + +} + From c85d7f6f7620561df6373084c44ad20eb11db7bb Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sat, 15 Aug 2015 22:26:48 +1000 Subject: [PATCH 08/60] Updated version number --- Modules/xSharePoint/xSharePoint.psd1 | 2 +- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/xSharePoint/xSharePoint.psd1 b/Modules/xSharePoint/xSharePoint.psd1 index 52c24f479..618fdd2df 100644 --- a/Modules/xSharePoint/xSharePoint.psd1 +++ b/Modules/xSharePoint/xSharePoint.psd1 @@ -12,7 +12,7 @@ # RootModule = '' # Version number of this module. -ModuleVersion = '0.3.1.0' +ModuleVersion = '0.5.0' # ID used to uniquely identify this module GUID = '6c1176a0-4fac-4134-8ca2-3fa8a21a7b90' diff --git a/appveyor.yml b/appveyor.yml index b35dd9b6d..f190ef67d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,7 +21,7 @@ on_finish: $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 + (Get-Content $manifest -Raw).Replace("0.5.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest $zipFile = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip" Add-Type -assemblyname System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFile) From 7bc8652e14a4d30a8e91fbfdf3cfbcf0331d2a30 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sat, 15 Aug 2015 23:07:14 +1000 Subject: [PATCH 09/60] Fixed spaces in file --- .../MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 index e89876050..9429e566c 100644 --- a/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 +++ b/Modules/xSharePoint/DSCResources/MSFT_xSPInstallPrereqs/MSFT_xSPInstallPrereqs.psm1 @@ -44,8 +44,8 @@ function Get-TargetResource #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)) + $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 @@ -54,7 +54,7 @@ function Get-TargetResource $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.Add("Active Directory Rights Management Services Client 2.1", (($installedItems | ? {$_.Name -eq "Active Directory Rights Management Services Client 2.1"}) -ne $null)) } $returnValue } @@ -128,7 +128,7 @@ function Set-TargetResource switch ($process.ExitCode) { 0 { Write-Verbose -Message "Prerequisite installer completed successfully. Rebooting to finalise installations" - $global:DSCMachineStatus = 1 + $global:DSCMachineStatus = 1 } 1 { throw "Another instance of the prerequisite installer is already running" From 068c48fde01b0b436f8907d67b250010f889b844 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sat, 15 Aug 2015 23:15:50 +1000 Subject: [PATCH 10/60] Fixed spaces in file --- .../Modules/xSharePoint.Util/xSharePoint.Util.psm1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 index 3a6e73ffd..1dd4c287e 100644 --- a/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 +++ b/Modules/xSharePoint/Modules/xSharePoint.Util/xSharePoint.Util.psm1 @@ -11,9 +11,9 @@ function Get-xSharePointAuthenticatedPSSession() { $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() + # 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() Write-Verbose -Message "Creating new PowerShell session" $session = New-PSSession -ComputerName $env:COMPUTERNAME -Credential $Credential -Authentication CredSSP From e0b9ca41a82ad80e4d7d2450948ef4c98dc0e64d Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sat, 15 Aug 2015 23:24:15 +1000 Subject: [PATCH 11/60] Updated readme for SP2016 support --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f76847e7e..7a79ea72d 100644 --- a/README.md +++ b/README.md @@ -66,14 +66,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 From 2ce758bcbc71914e6e454236e3c964972428c67b Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 10:20:08 +1000 Subject: [PATCH 12/60] Fixed build number for appveyor --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index f190ef67d..8d31b8f9d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 0.3.1.{build} +version: 0.5.0.{build} install: - cinst -y pester From 4c53ddd9205723836b336e9a0c53479fc0968f96 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 10:37:54 +1000 Subject: [PATCH 13/60] Removed comments from file --- appveyor.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index cff64a7eb..8babb5a16 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,7 +1,3 @@ - -#---------------------------------# -# environment configuration # -#---------------------------------# version: 0.5.0.{build} install: - cinst -y pester @@ -11,16 +7,8 @@ install: - ps: Import-Module .\TestHelper.psm1 -force - ps: Pop-Location -#---------------------------------# -# build configuration # -#---------------------------------# - build: false -#---------------------------------# -# test configuration # -#---------------------------------# - test_script: - ps: | $testResultsFile = ".\TestsResults.xml" @@ -29,10 +17,6 @@ test_script: if ($res.FailedCount -gt 0) { throw "$($res.FailedCount) tests failed." } - -#---------------------------------# -# deployment configuration # -#---------------------------------# # scripts to run before deployment before_deploy: From f2fa9629574cdac3b93a153501169339d27af4d5 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 10:43:41 +1000 Subject: [PATCH 14/60] Minor fixes in build file --- appveyor.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 8babb5a16..6ef11debe 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,12 +2,12 @@ version: 0.5.0.{build} install: - cinst -y pester - git clone https://github.com/PowerShell/DscResource.Tests - - ps: Push-Location - - cd DscResource.Tests - - ps: Import-Module .\TestHelper.psm1 -force - - ps: Pop-Location +- ps: Push-Location +- cd DscResource.Tests +- ps: Import-Module .\TestHelper.psm1 -force +- ps: Pop-Location -build: false +build: off test_script: - ps: | From f30c217093aaca453f088814d43e8aace086840e Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 10:49:23 +1000 Subject: [PATCH 15/60] Fixed import approach --- appveyor.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6ef11debe..6b93b105a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,10 +2,7 @@ version: 0.5.0.{build} install: - cinst -y pester - git clone https://github.com/PowerShell/DscResource.Tests -- ps: Push-Location -- cd DscResource.Tests -- ps: Import-Module .\TestHelper.psm1 -force -- ps: Pop-Location +- ps: Import-Module .\DscResource.Tests\TestHelper.psm1 -force build: off From 76e4adc6f4118668f7694d4b6051d6ce1211e583 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 10:51:48 +1000 Subject: [PATCH 16/60] Testing install script change --- appveyor.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6b93b105a..f11c6575e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,9 @@ version: 0.5.0.{build} install: -- cinst -y pester -- git clone https://github.com/PowerShell/DscResource.Tests -- ps: Import-Module .\DscResource.Tests\TestHelper.psm1 -force + - cinst -y pester + - git clone https://github.com/PowerShell/DscResource.Tests + - ps: | + Import-Module .\DscResource.Tests\TestHelper.psm1 -force build: off From fbd90a1c3823bfd95c1bef2a3240b8fc081adf76 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 10:53:46 +1000 Subject: [PATCH 17/60] Fixed build issue --- appveyor.yml | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f11c6575e..269ea5b86 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,10 +16,9 @@ test_script: throw "$($res.FailedCount) tests failed." } -# scripts to run before deployment before_deploy: - ps: | - # Creating project artifact + # Creating project artifact $stagingDirectory = (Resolve-Path ..).Path $pwd = Join-Path $pwd "modules\xSharePoint" Remove-Item (Join-Path $pwd "xSharePoint.pssproj") @@ -27,23 +26,19 @@ before_deploy: (Get-Content $manifest -Raw).Replace("0.5.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest $zipFile = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip" Add-Type -assemblyname System.IO.Compression.FileSystem - [System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFilePath) + [System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFilePath) - # Creating NuGet package artifact - 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 . - $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" - $nuGetPackagePath = (Get-ChildItem $nuGetPackageName).FullName + # Creating NuGet package artifact + 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 . + $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" + $nuGetPackagePath = (Get-ChildItem $nuGetPackageName).FullName @( # You can add other artifacts here $zipFilePath, $nuGetPackagePath - ) | % { + ) | % { Write-Host "Pushing package $_ as Appveyor artifact" Push-AppveyorArtifact $_ - } - - - - + } \ No newline at end of file From a125ed3b5cd5b60c8157f7894ae368ced5376396 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 10:56:19 +1000 Subject: [PATCH 18/60] Fixing finish section --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 269ea5b86..dbf0713c9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,7 +16,7 @@ test_script: throw "$($res.FailedCount) tests failed." } -before_deploy: +on_finish: - ps: | # Creating project artifact $stagingDirectory = (Resolve-Path ..).Path From b667071ffa2158900bdf935c9e20214d40584e75 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 11:00:10 +1000 Subject: [PATCH 19/60] Testing values in build --- appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index dbf0713c9..cd5946abc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,10 +21,12 @@ on_finish: # Creating project artifact $stagingDirectory = (Resolve-Path ..).Path $pwd = Join-Path $pwd "modules\xSharePoint" + $pwd Remove-Item (Join-Path $pwd "xSharePoint.pssproj") $manifest = Join-Path $pwd "xSharePoint.psd1" (Get-Content $manifest -Raw).Replace("0.5.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest $zipFile = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip" + $zipFile Add-Type -assemblyname System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFilePath) From 1028f46ead7c0b9e0f62305f161ee74c4f86c1b9 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 11:00:46 +1000 Subject: [PATCH 20/60] Fixed spaces --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index cd5946abc..e8e5526b9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,12 +21,12 @@ on_finish: # Creating project artifact $stagingDirectory = (Resolve-Path ..).Path $pwd = Join-Path $pwd "modules\xSharePoint" - $pwd + $pwd Remove-Item (Join-Path $pwd "xSharePoint.pssproj") $manifest = Join-Path $pwd "xSharePoint.psd1" (Get-Content $manifest -Raw).Replace("0.5.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest $zipFile = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip" - $zipFile + $zipFile Add-Type -assemblyname System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFilePath) From 02dc1e27074c35873cbdc4d5543381f45f835a8e Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 11:11:18 +1000 Subject: [PATCH 21/60] Testing old build file again --- appveyor.yml | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index e8e5526b9..6e4745b3b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,9 +1,8 @@ version: 0.5.0.{build} + install: - - cinst -y pester - - git clone https://github.com/PowerShell/DscResource.Tests - - ps: | - Import-Module .\DscResource.Tests\TestHelper.psm1 -force +- cinst -y pester +- git clone https://github.com/PowerShell/DscResource.Tests build: off @@ -15,32 +14,17 @@ test_script: if ($res.FailedCount -gt 0) { throw "$($res.FailedCount) tests failed." } - -on_finish: +deploy: off +on_finish: - ps: | - # Creating project artifact $stagingDirectory = (Resolve-Path ..).Path $pwd = Join-Path $pwd "modules\xSharePoint" - $pwd Remove-Item (Join-Path $pwd "xSharePoint.pssproj") $manifest = Join-Path $pwd "xSharePoint.psd1" (Get-Content $manifest -Raw).Replace("0.5.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest $zipFile = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip" - $zipFile Add-Type -assemblyname System.IO.Compression.FileSystem - [System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFilePath) - - # Creating NuGet package artifact - 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 . - $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" - $nuGetPackagePath = (Get-ChildItem $nuGetPackageName).FullName - + [System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFile) @( - # You can add other artifacts here - $zipFilePath, - $nuGetPackagePath - ) | % { - Write-Host "Pushing package $_ as Appveyor artifact" - Push-AppveyorArtifact $_ - } \ No newline at end of file + (ls $zipFile) + ) | % { Push-AppveyorArtifact $_.FullName } \ No newline at end of file From beba86f7ad1008aa397c40b7a661179700beff54 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 11:17:36 +1000 Subject: [PATCH 22/60] Pushing output directly --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6e4745b3b..30e40edf8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -25,6 +25,6 @@ on_finish: $zipFile = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip" Add-Type -assemblyname System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFile) - @( - (ls $zipFile) - ) | % { Push-AppveyorArtifact $_.FullName } \ No newline at end of file + + + Push-AppveyorArtifact $zipFile \ No newline at end of file From 96087533973c983ba9c7db467501495e6695b56f Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 11:20:36 +1000 Subject: [PATCH 23/60] Debugging build --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 30e40edf8..c611bd509 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -26,5 +26,5 @@ on_finish: Add-Type -assemblyname System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFile) - + "Zip file is '$zipFile'" Push-AppveyorArtifact $zipFile \ No newline at end of file From 377584530c48c783e10de8ed24089eb174123ccb Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 11:23:08 +1000 Subject: [PATCH 24/60] Fixing file name --- appveyor.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c611bd509..dcfea93ab 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -25,6 +25,5 @@ on_finish: $zipFile = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip" Add-Type -assemblyname System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFile) - - "Zip file is '$zipFile'" - Push-AppveyorArtifact $zipFile \ No newline at end of file + + Push-AppveyorArtifact -FileName $zipFile \ No newline at end of file From cd9adf4d61c465716e4e07897a8ac1ce71affd05 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 11:28:34 +1000 Subject: [PATCH 25/60] Changed zip file approach --- appveyor.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index dcfea93ab..e58372909 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,13 +17,10 @@ test_script: deploy: off on_finish: - 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.5.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest - $zipFile = Join-Path $stagingDirectory "$(Split-Path $pwd -Leaf).zip" - Add-Type -assemblyname System.IO.Compression.FileSystem - [System.IO.Compression.ZipFile]::CreateFromDirectory($pwd, $zipFile) - - Push-AppveyorArtifact -FileName $zipFile \ No newline at end of file + - 7z a xSharePoint.zip %APPVEYOR_BUILD_FOLDER%\modules\xSharePoint + - artifacts: + xSharePoint.zip \ No newline at end of file From 5d469c3eecc662b5f4400ddd1cfba765f4d98bf0 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 11:32:44 +1000 Subject: [PATCH 26/60] Added artifact --- appveyor.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index e58372909..131671095 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,4 +23,7 @@ on_finish: (Get-Content $manifest -Raw).Replace("0.5.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest - 7z a xSharePoint.zip %APPVEYOR_BUILD_FOLDER%\modules\xSharePoint - artifacts: - xSharePoint.zip \ No newline at end of file + - path: xSharePoint.zip + name: PSModule + type: zip + \ No newline at end of file From b623ed2b88ca86f50f33c200b0fa663a2987c3fc Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 11:36:16 +1000 Subject: [PATCH 27/60] Use PS to publish artifact --- appveyor.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 131671095..cd944fcc0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,8 +22,5 @@ on_finish: $manifest = Join-Path $pwd "xSharePoint.psd1" (Get-Content $manifest -Raw).Replace("0.5.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest - 7z a xSharePoint.zip %APPVEYOR_BUILD_FOLDER%\modules\xSharePoint - - artifacts: - - path: xSharePoint.zip - name: PSModule - type: zip + - ps: Get-ChildItem .\xSharePoint.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file From c46f0e4cdf9694263b3993c1a739872f2aaaef32 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 11:42:00 +1000 Subject: [PATCH 28/60] Fixing issue with zip file approach --- appveyor.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index cd944fcc0..13dc7bd31 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,10 +17,10 @@ test_script: deploy: off on_finish: - ps: | - $pwd = Join-Path $pwd "modules\xSharePoint" - Remove-Item (Join-Path $pwd "xSharePoint.pssproj") - $manifest = Join-Path $pwd "xSharePoint.psd1" + Remove-Item (Join-Path "%APPVEYOR_BUILD_FOLDER%\modules\xSharePoint" "xSharePoint.pssproj") + $manifest = Join-Path "%APPVEYOR_BUILD_FOLDER%\modules\xSharePoint" "xSharePoint.psd1" (Get-Content $manifest -Raw).Replace("0.5.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest - - 7z a xSharePoint.zip %APPVEYOR_BUILD_FOLDER%\modules\xSharePoint - - ps: Get-ChildItem .\xSharePoint.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } + Add-Type -assemblyname System.IO.Compression.FileSystem + [System.IO.Compression.ZipFile]::CreateFromDirectory("%APPVEYOR_BUILD_FOLDER%\modules\xSharePoint", "xSharePoint.zip") + Get-ChildItem .\xSharePoint.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file From b17cb2f17981c981888af4466b6b020689159c5b Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 11:44:45 +1000 Subject: [PATCH 29/60] Fixed environment variables --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 13dc7bd31..c7a1ed729 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,10 +17,10 @@ test_script: deploy: off on_finish: - ps: | - Remove-Item (Join-Path "%APPVEYOR_BUILD_FOLDER%\modules\xSharePoint" "xSharePoint.pssproj") - $manifest = Join-Path "%APPVEYOR_BUILD_FOLDER%\modules\xSharePoint" "xSharePoint.psd1" + 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("%APPVEYOR_BUILD_FOLDER%\modules\xSharePoint", "xSharePoint.zip") + [System.IO.Compression.ZipFile]::CreateFromDirectory("$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint", "xSharePoint.zip") Get-ChildItem .\xSharePoint.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file From 69c624398fa2f180ed0921dedbde908926e753a7 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 11:46:50 +1000 Subject: [PATCH 30/60] Changed build paths --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c7a1ed729..37ba307dc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,6 +21,6 @@ on_finish: $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("$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint", "xSharePoint.zip") - Get-ChildItem .\xSharePoint.zip | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } + [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 } \ No newline at end of file From 85ae2b8f7bcc4a040a6459c55df1d4a9cf6d39cb Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 11:54:18 +1000 Subject: [PATCH 31/60] Added nuget file --- appveyor.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 37ba307dc..be54b5043 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,6 +3,8 @@ version: 0.5.0.{build} install: - cinst -y pester - git clone https://github.com/PowerShell/DscResource.Tests + - ps: | + Import-Module .\DscResource.Tests\TestHelper.psm1 -force build: off @@ -23,4 +25,9 @@ on_finish: Add-Type -assemblyname System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::CreateFromDirectory("$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint", "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip") Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } - \ No newline at end of file + + 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 . + $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" + $nuGetPackagePath = (Get-ChildItem $nuGetPackageName).FullName + Get-ChildItem $nuGetPackagePath | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file From 1ec3720007f8cc6f7ee450151eb3554d4cef306d Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 11:55:23 +1000 Subject: [PATCH 32/60] Fixed spacing --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index be54b5043..72e78afe2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,8 @@ 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 From 60f09826fe1ad42bdbfe8801ba870525c7c60ea6 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 11:58:09 +1000 Subject: [PATCH 33/60] Fixed nuget path --- appveyor.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 72e78afe2..d35950f47 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -27,7 +27,6 @@ on_finish: 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 . + nuget pack ".\$($env:APPVEYOR_PROJECT_NAME).nuspec" -outputdirectory $env:APPVEYOR_BUILD_FOLDER $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" - $nuGetPackagePath = (Get-ChildItem $nuGetPackageName).FullName - Get-ChildItem $nuGetPackagePath | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file + Get-ChildItem (Join-Path $env:APPVEYOR_BUILD_FOLDER $nuGetPackageName) | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file From f12dc6d483087f52260bc195e7ef2a8fc7baf68e Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 11:59:54 +1000 Subject: [PATCH 34/60] Adding debug output --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index d35950f47..0822073fd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,4 +29,5 @@ on_finish: 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 = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" - Get-ChildItem (Join-Path $env:APPVEYOR_BUILD_FOLDER $nuGetPackageName) | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file + Get-ChildItem (Join-Path $env:APPVEYOR_BUILD_FOLDER $nuGetPackageName) + Get-ChildItem (Join-Path $env:APPVEYOR_BUILD_FOLDER $nuGetPackageName) | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file From cf91ca3e013e3744a64c62bd4cfbd8d3a5390feb Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 12:01:14 +1000 Subject: [PATCH 35/60] Fixed spaces --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 0822073fd..f2b38ae95 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -30,4 +30,4 @@ on_finish: nuget pack ".\$($env:APPVEYOR_PROJECT_NAME).nuspec" -outputdirectory $env:APPVEYOR_BUILD_FOLDER $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" Get-ChildItem (Join-Path $env:APPVEYOR_BUILD_FOLDER $nuGetPackageName) - Get-ChildItem (Join-Path $env:APPVEYOR_BUILD_FOLDER $nuGetPackageName) | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file + Get-ChildItem (Join-Path $env:APPVEYOR_BUILD_FOLDER $nuGetPackageName) | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file From c511eee5a79442c8e1e16c85e361506d32a41e02 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 12:03:48 +1000 Subject: [PATCH 36/60] Fixed nuget packaging --- appveyor.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f2b38ae95..c3d068640 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,6 +28,4 @@ on_finish: 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 = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" - Get-ChildItem (Join-Path $env:APPVEYOR_BUILD_FOLDER $nuGetPackageName) - Get-ChildItem (Join-Path $env:APPVEYOR_BUILD_FOLDER $nuGetPackageName) | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file + Get-ChildItem (Join-Path $env:APPVEYOR_BUILD_FOLDER "*.nupkg") | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file From c154eb0fc6aac651ddbcd643d2f42a9149ee84fd Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 12:05:19 +1000 Subject: [PATCH 37/60] Added wildcard for nupkg --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index c3d068640..71a1eb184 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,4 +28,4 @@ on_finish: 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 - Get-ChildItem (Join-Path $env:APPVEYOR_BUILD_FOLDER "*.nupkg") | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file + Get-ChildItem (Join-Path $env:APPVEYOR_BUILD_FOLDER "**\*.nupkg") | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file From 91c1feb41a4dbefa422f25bec3aef1bc9ded994c Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 12:07:24 +1000 Subject: [PATCH 38/60] Changed package name approach --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 71a1eb184..842d20c74 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,4 +28,5 @@ on_finish: 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 - Get-ChildItem (Join-Path $env:APPVEYOR_BUILD_FOLDER "**\*.nupkg") | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file + $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 From 54193e255a4cece463b37aced4170f8440949237 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 12:09:05 +1000 Subject: [PATCH 39/60] Adding debug check --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 842d20c74..577072ded 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,4 +29,5 @@ on_finish: 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 = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" + Test-Path "$env:APPVEYOR_BUILD_FOLDER\$nuGetPackageName" Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\$nuGetPackageName" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file From ebbac6aa481cf1cf35c028dfbc113dcd90cede89 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 12:14:34 +1000 Subject: [PATCH 40/60] More debugging the build --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 577072ded..307a596db 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,5 +29,5 @@ on_finish: 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 = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" - Test-Path "$env:APPVEYOR_BUILD_FOLDER\$nuGetPackageName" + Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\$nuGetPackageName" | fl Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\$nuGetPackageName" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file From 11e5c3ac84a1bd92e95e60243f085d0996a637a5 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 12:16:53 +1000 Subject: [PATCH 41/60] Testing build fix --- appveyor.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 307a596db..e5ca57522 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,5 +29,4 @@ on_finish: 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 = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" - Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\$nuGetPackageName" | fl - Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\$nuGetPackageName" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file + Push-AppveyorArtifact "$env:APPVEYOR_BUILD_FOLDER\$nuGetPackageName" -FileName $nuGetPackageName \ No newline at end of file From c07807651f24b70200af909d8df8005483b69221 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 12:20:24 +1000 Subject: [PATCH 42/60] Added artifacts section --- appveyor.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index e5ca57522..1f82c7320 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -29,4 +29,6 @@ on_finish: 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 = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" - Push-AppveyorArtifact "$env:APPVEYOR_BUILD_FOLDER\$nuGetPackageName" -FileName $nuGetPackageName \ No newline at end of file + +artifacts: + - path: '**\*.nupkg' \ No newline at end of file From 60ec2dce48655c803897c7ba16f20849cdcc6832 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 12:22:04 +1000 Subject: [PATCH 43/60] Changed script to after build --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 1f82c7320..061612c95 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,7 +17,7 @@ test_script: throw "$($res.FailedCount) tests failed." } deploy: off -on_finish: +after_build: - ps: | Remove-Item (Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.pssproj") $manifest = Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.psd1" From b277070e754143b2a47268ef17824a5fe96b8633 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 12:23:57 +1000 Subject: [PATCH 44/60] Changed to deploy --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 061612c95..8ee6c7f50 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,8 +16,8 @@ test_script: if ($res.FailedCount -gt 0) { throw "$($res.FailedCount) tests failed." } -deploy: off -after_build: + +before_deploy: - ps: | Remove-Item (Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.pssproj") $manifest = Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.psd1" From aeda88ffd61e8c52cba91940bdfdd991c534d198 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 12:27:36 +1000 Subject: [PATCH 45/60] Testing artifact sections --- appveyor.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 8ee6c7f50..572d0b846 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,8 +6,6 @@ install: - ps: | Import-Module .\DscResource.Tests\TestHelper.psm1 -force -build: off - test_script: - ps: | $testResultsFile = ".\TestsResults.xml" @@ -17,18 +15,19 @@ test_script: throw "$($res.FailedCount) tests failed." } -before_deploy: +after_build: - ps: | Remove-Item (Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.pssproj") $manifest = Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.psd1" (Get-Content $manifest -Raw).Replace("0.5.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest Add-Type -assemblyname System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::CreateFromDirectory("$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint", "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip") - Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } + # 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 = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" artifacts: - - path: '**\*.nupkg' \ No newline at end of file +- path: '**\xSharePoint.zip' +- path: '**\*.nupkg' \ No newline at end of file From eba39737739a455bd7d18fcaaa94268e6126821a Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 12:31:43 +1000 Subject: [PATCH 46/60] Added packaging to install section --- appveyor.yml | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 572d0b846..8abaaf9f5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,29 +5,27 @@ install: - git clone https://github.com/PowerShell/DscResource.Tests - ps: | Import-Module .\DscResource.Tests\TestHelper.psm1 -force - -test_script: - - ps: | - $testResultsFile = ".\TestsResults.xml" - $res = Invoke-Pester -OutputFormat NUnitXml -OutputFile $testResultsFile -PassThru - (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFile)) - if ($res.FailedCount -gt 0) { - throw "$($res.FailedCount) tests failed." - } - -after_build: - - ps: | Remove-Item (Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.pssproj") $manifest = Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.psd1" (Get-Content $manifest -Raw).Replace("0.5.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest Add-Type -assemblyname System.IO.Compression.FileSystem [System.IO.Compression.ZipFile]::CreateFromDirectory("$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint", "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip") - # Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } + 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 = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" +build: off + +test_script: + - ps: | + $testResultsFile = ".\TestsResults.xml" + $res = Invoke-Pester -OutputFormat NUnitXml -OutputFile $testResultsFile -PassThru + (New-Object 'System.Net.WebClient').UploadFile("https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $testResultsFile)) + if ($res.FailedCount -gt 0) { + throw "$($res.FailedCount) tests failed." + } + artifacts: -- path: '**\xSharePoint.zip' -- path: '**\*.nupkg' \ No newline at end of file + - path: '**\*.nupkg' \ No newline at end of file From a7e1aae6d510f9f7d2a2648e295100416dcb3a85 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 12:32:59 +1000 Subject: [PATCH 47/60] Removed artifact section --- appveyor.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 8abaaf9f5..e8cc8b5af 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -26,6 +26,3 @@ test_script: if ($res.FailedCount -gt 0) { throw "$($res.FailedCount) tests failed." } - -artifacts: - - path: '**\*.nupkg' \ No newline at end of file From 060b2d533e72a11984a46f897ba38a861d87a101 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 12:41:50 +1000 Subject: [PATCH 48/60] testing for build --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index e8cc8b5af..6475be37d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,6 +15,7 @@ install: 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 = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" + "Done" build: off From a90d378cb7472621a2e9758aed5f04d434cfb757 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 12:43:18 +1000 Subject: [PATCH 49/60] Testing for new build approach --- appveyor.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 6475be37d..e8cc8b5af 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,7 +15,6 @@ install: 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 = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" - "Done" build: off From 8e5aaf596b8254d04b63fa60c0da1557832e610a Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 13:57:42 +1000 Subject: [PATCH 50/60] Reformated file name --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index e8cc8b5af..f1545839d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,7 +14,7 @@ install: 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 = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" + $nuGetPackageName = "$env:APPVEYOR_PROJECT_NAME.$env:APPVEYOR_BUILD_VERSION.nupkg" build: off From 919b1b3f806fca1298ba10a1d22a618be4c96313 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 14:08:43 +1000 Subject: [PATCH 51/60] more build testing --- appveyor.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index f1545839d..e1f179a15 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,6 +7,11 @@ install: Import-Module .\DscResource.Tests\TestHelper.psm1 -force Remove-Item (Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.pssproj") $manifest = Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.psd1" + Test-Path $manifest + "Raw" + (Get-Content $manifest -Raw) + "Replaced" + (Get-Content $manifest -Raw).Replace("0.5.0", $env:APPVEYOR_BUILD_VERSION) (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("$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint", "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip") From e851b05b9224fd213d123a945d2e0845c0a0950b Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 14:11:59 +1000 Subject: [PATCH 52/60] Moved to after test --- appveyor.yml | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index e1f179a15..8f24a353e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,22 +5,7 @@ install: - git clone https://github.com/PowerShell/DscResource.Tests - ps: | Import-Module .\DscResource.Tests\TestHelper.psm1 -force - Remove-Item (Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.pssproj") - $manifest = Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.psd1" - Test-Path $manifest - "Raw" - (Get-Content $manifest -Raw) - "Replaced" - (Get-Content $manifest -Raw).Replace("0.5.0", $env:APPVEYOR_BUILD_VERSION) - (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("$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 = "$env:APPVEYOR_PROJECT_NAME.$env:APPVEYOR_BUILD_VERSION.nupkg" - build: off test_script: @@ -31,3 +16,16 @@ test_script: if ($res.FailedCount -gt 0) { throw "$($res.FailedCount) tests failed." } + +after_test: + - ps: | + Remove-Item (Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.pssproj") + $manifest = Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.psd1" + (Get-Content $manifest -Raw).Replace("0.5.0", $env:APPVEYOR_BUILD_VERSION) | Out-File $manifest + Add-Type -assemblyname System.IO.Compression.FileSystem + [System.IO.Compression.ZipFile]::CreateFromDirectory("$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint", "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip") + Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\xSharePoint.zip" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } + + 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 = "$env:APPVEYOR_PROJECT_NAME.$env:APPVEYOR_BUILD_VERSION.nupkg" \ No newline at end of file From 2268cf52b6511ccaa514580d6273a74e3c6369dc Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 14:14:37 +1000 Subject: [PATCH 53/60] Changed name format again --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 8f24a353e..adc4b9d54 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,4 +28,5 @@ after_test: New-Nuspec -packageName $env:APPVEYOR_PROJECT_NAME -version $env:APPVEYOR_BUILD_VERSION -author "Microsoft" -owners "Microsoft" -licenseUrl "https://github.com/PowerShell/DscResources/blob/master/LICENSE" -projectUrl "https://github.com/$($env:APPVEYOR_REPO_NAME)" -packageDescription $env:APPVEYOR_PROJECT_NAME -tags "DesiredStateConfiguration DSC DSCResourceKit" -destinationPath . nuget pack ".\$($env:APPVEYOR_PROJECT_NAME).nuspec" -outputdirectory $env:APPVEYOR_BUILD_FOLDER - $nuGetPackageName = "$env:APPVEYOR_PROJECT_NAME.$env:APPVEYOR_BUILD_VERSION.nupkg" \ No newline at end of file + $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 From 911ae68fea2c3bf82545041e6e4177e7be54e788 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 14:17:55 +1000 Subject: [PATCH 54/60] Added RDP details --- appveyor.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index adc4b9d54..f9b1fe354 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,6 +19,9 @@ test_script: after_test: - ps: | + + $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + 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 @@ -29,4 +32,6 @@ after_test: New-Nuspec -packageName $env:APPVEYOR_PROJECT_NAME -version $env:APPVEYOR_BUILD_VERSION -author "Microsoft" -owners "Microsoft" -licenseUrl "https://github.com/PowerShell/DscResources/blob/master/LICENSE" -projectUrl "https://github.com/$($env:APPVEYOR_REPO_NAME)" -packageDescription $env:APPVEYOR_PROJECT_NAME -tags "DesiredStateConfiguration DSC DSCResourceKit" -destinationPath . nuget pack ".\$($env:APPVEYOR_PROJECT_NAME).nuspec" -outputdirectory $env:APPVEYOR_BUILD_FOLDER $nuGetPackageName = $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" - Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\$nuGetPackageName" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file + Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\$nuGetPackageName" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } + + \ No newline at end of file From 323e579c08ee90f41db266a99d66d3200b591f9c Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 14:30:28 +1000 Subject: [PATCH 55/60] Moved RDP to examine output --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f9b1fe354..58c97e4ac 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -20,7 +20,7 @@ test_script: after_test: - ps: | - $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + Remove-Item (Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.pssproj") $manifest = Join-Path "$env:APPVEYOR_BUILD_FOLDER\modules\xSharePoint" "xSharePoint.psd1" @@ -34,4 +34,4 @@ after_test: $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 + $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) \ No newline at end of file From aa8eb0a8f7b8e0374f1470868ee25dfd4504ca3e Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 14:32:17 +1000 Subject: [PATCH 56/60] moved it again --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 58c97e4ac..0a55393f8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -32,6 +32,7 @@ after_test: New-Nuspec -packageName $env:APPVEYOR_PROJECT_NAME -version $env:APPVEYOR_BUILD_VERSION -author "Microsoft" -owners "Microsoft" -licenseUrl "https://github.com/PowerShell/DscResources/blob/master/LICENSE" -projectUrl "https://github.com/$($env:APPVEYOR_REPO_NAME)" -packageDescription $env:APPVEYOR_PROJECT_NAME -tags "DesiredStateConfiguration DSC DSCResourceKit" -destinationPath . nuget pack ".\$($env:APPVEYOR_PROJECT_NAME).nuspec" -outputdirectory $env:APPVEYOR_BUILD_FOLDER $nuGetPackageName = $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" + $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\$nuGetPackageName" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } - $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) \ No newline at end of file + \ No newline at end of file From b7e240a756ef983fcdbdb1c4db9f4cbb8ddd6c26 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 14:35:34 +1000 Subject: [PATCH 57/60] Blocking RDP to test for success without it --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 0a55393f8..006fadade 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -32,7 +32,7 @@ after_test: New-Nuspec -packageName $env:APPVEYOR_PROJECT_NAME -version $env:APPVEYOR_BUILD_VERSION -author "Microsoft" -owners "Microsoft" -licenseUrl "https://github.com/PowerShell/DscResources/blob/master/LICENSE" -projectUrl "https://github.com/$($env:APPVEYOR_REPO_NAME)" -packageDescription $env:APPVEYOR_PROJECT_NAME -tags "DesiredStateConfiguration DSC DSCResourceKit" -destinationPath . nuget pack ".\$($env:APPVEYOR_PROJECT_NAME).nuspec" -outputdirectory $env:APPVEYOR_BUILD_FOLDER $nuGetPackageName = $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" - $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + #$blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\$nuGetPackageName" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file From 6cb2eefecf75735fae30358d1eafba7557f9b307 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 14:56:38 +1000 Subject: [PATCH 58/60] Adding block to check source code from get --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 006fadade..52137e91f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,7 +5,8 @@ install: - git clone https://github.com/PowerShell/DscResource.Tests - ps: | Import-Module .\DscResource.Tests\TestHelper.psm1 -force - + $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + build: off test_script: @@ -32,7 +33,6 @@ after_test: New-Nuspec -packageName $env:APPVEYOR_PROJECT_NAME -version $env:APPVEYOR_BUILD_VERSION -author "Microsoft" -owners "Microsoft" -licenseUrl "https://github.com/PowerShell/DscResources/blob/master/LICENSE" -projectUrl "https://github.com/$($env:APPVEYOR_REPO_NAME)" -packageDescription $env:APPVEYOR_PROJECT_NAME -tags "DesiredStateConfiguration DSC DSCResourceKit" -destinationPath . nuget pack ".\$($env:APPVEYOR_PROJECT_NAME).nuspec" -outputdirectory $env:APPVEYOR_BUILD_FOLDER $nuGetPackageName = $nuGetPackageName = $env:APPVEYOR_PROJECT_NAME + "." + $env:APPVEYOR_BUILD_VERSION + ".nupkg" - #$blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) Get-ChildItem "$env:APPVEYOR_BUILD_FOLDER\$nuGetPackageName" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } \ No newline at end of file From 3a4d71b51fcbfe5566a856df710324d0fd7f788e Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 14:59:21 +1000 Subject: [PATCH 59/60] Testing another RDP blocker --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 52137e91f..f4a28812a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,8 +4,9 @@ install: - cinst -y pester - git clone https://github.com/PowerShell/DscResource.Tests - ps: | - Import-Module .\DscResource.Tests\TestHelper.psm1 -force $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) + Import-Module .\DscResource.Tests\TestHelper.psm1 -force + build: off From e58d6fa020c3789ef0a86f15a0d5ff1cbb0ee4c3 Mon Sep 17 00:00:00 2001 From: Brian Farnhill Date: Sun, 16 Aug 2015 15:04:15 +1000 Subject: [PATCH 60/60] Working build file completed --- appveyor.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index f4a28812a..3abd1fc50 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,7 +4,6 @@ install: - cinst -y pester - git clone https://github.com/PowerShell/DscResource.Tests - ps: | - $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) Import-Module .\DscResource.Tests\TestHelper.psm1 -force