Skip to content

Commit

Permalink
Merge pull request #114 from BrianFarnhill/merge-pr96
Browse files Browse the repository at this point in the history
Fixes to release v0.8
  • Loading branch information
BrianFarnhill committed Dec 7, 2015
2 parents 99a8a82 + 36641b5 commit 863652f
Show file tree
Hide file tree
Showing 28 changed files with 756 additions and 567 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ function Get-TargetResource
Write-Verbose -Message "Getting installed windows features"

if ($majorVersion -eq 15) {
$WindowsFeatures = Get-WindowsFeature -Name Net-Framework-Features,Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-Default-Doc,Web-Dir-Browsing,Web-Http-Errors,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Health,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Security,Web-Basic-Auth,Web-Windows-Auth,Web-Filtering,Web-Digest-Auth,Web-Performance,Web-Stat-Compression,Web-Dyn-Compression,Web-Mgmt-Tools,Web-Mgmt-Console,Web-Mgmt-Compat,Web-Metabase,Application-Server,AS-Web-Support,AS-TCP-Port-Sharing,AS-WAS-Support, AS-HTTP-Activation,AS-TCP-Activation,AS-Named-Pipes,AS-Net-Framework,WAS,WAS-Process-Model,WAS-NET-Environment,WAS-Config-APIs,Web-Lgcy-Scripting,Windows-Identity-Foundation,Server-Media-Foundation,Xps-Viewer
$WindowsFeatures = Get-WindowsFeature -Name Application-Server, AS-NET-Framework, AS-TCP-Port-Sharing, AS-Web-Support, AS-WAS-Support, AS-HTTP-Activation, AS-Named-Pipes, AS-TCP-Activation, 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-Http-Tracing, 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-Net, Web-Asp-Net45, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Mgmt-Tools, Web-Mgmt-Console, Web-Mgmt-Compat, Web-Metabase, Web-Lgcy-Scripting, Web-WMI, Web-Scripting-Tools, NET-Framework-Features, NET-Framework-Core, NET-Framework-45-ASPNET, NET-WCF-HTTP-Activation45, NET-WCF-Pipe-Activation45, NET-WCF-TCP-Activation45, Server-Media-Foundation, Windows-Identity-Foundation, PowerShell-V2, WAS, WAS-Process-Model, WAS-NET-Environment, WAS-Config-APIs, 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
$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) {
Expand All @@ -51,26 +51,28 @@ function Get-TargetResource
$installedItems = Get-CimInstance -ClassName Win32_Product

#Common prereqs
$returnValue.Add("Microsoft Identity Extensions", (@(Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\ -Recurse | ? {$_.GetValue("DisplayName") -eq "Microsoft Identity Extensions" }).Count -gt 0))
$returnValue.Add("AppFabric 1.1 for Windows Server", (($installedItems | ? {$_.Name -eq "AppFabric 1.1 for Windows Server"}) -ne $null))
$returnValue.Add("Microsoft CCR and DSS Runtime 2008 R3", (($installedItems | ? {$_.Name -eq "Microsoft CCR and DSS Runtime 2008 R3"}) -ne $null))
$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 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))
$returnValue.Add("Microsoft SQL Server 2008 R2 Native Client", (($installedItems | ? {$_.Name -eq "Microsoft SQL Server 2008 R2 Native Client"}) -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))
}

#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 -ne $null -and $_.Name.Trim() -eq "Microsoft SQL Server 2012 Native Client"}) -ne $null))
$returnValue.Add("Active Directory Rights Management Services Client 2.1", (($installedItems | ? {$_.Name -eq "Active Directory Rights Management Services Client 2.1"}) -ne $null))
$returnValue.Add("Microsoft SQL Server 2012 Native Client", (($installedItems | ? {$_.Name -ne $null -and $_.Name.Trim() -eq "Microsoft SQL Server 2012 Native Client"}) -ne $null))
$returnValue.Add("Microsoft ODBC Driver 11 for SQL Server", (($installedItems | ? {$_.Name -eq "Microsoft ODBC Driver 11 for SQL Server"}) -ne $null))
$returnValue.Add("Microsoft Visual C++ 2012 x64 Minimum Runtime - 11.0.61030", (($installedItems | ? {$_.Name -eq "Microsoft Visual C++ 2012 x64 Minimum Runtime - 11.0.61030"}) -ne $null))
$returnValue.Add("Microsoft Visual C++ 2012 x64 Additional Runtime - 11.0.61030", (($installedItems | ? {$_.Name -eq "Microsoft Visual C++ 2012 x64 Additional Runtime - 11.0.61030"}) -ne $null))
$returnValue.Add("Microsoft Visual C++ 2015 x64 Minimum Runtime - 14.0.23026", (($installedItems | ? {$_.Name -eq "Microsoft Visual C++ 2015 x64 Minimum Runtime - 14.0.23026"}) -ne $null))
$returnValue.Add("Microsoft Visual C++ 2015 x64 Additional Runtime - 14.0.23026", (($installedItems | ? {$_.Name -eq "Microsoft Visual C++ 2015 x64 Additional Runtime - 14.0.23026"}) -ne $null))
}

$results = $PSBoundParameters
Expand Down Expand Up @@ -145,8 +147,7 @@ function Set-TargetResource

switch ($process.ExitCode) {
0 {
Write-Verbose -Message "Prerequisite installer completed successfully. Rebooting to finalise installations"
$global:DSCMachineStatus = 1
Write-Verbose -Message "Prerequisite installer completed successfully."
}
1 {
throw "Another instance of the prerequisite installer is already running"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ It is possible to set the outgoing server, from address, reply to address and th
class MSFT_xSPOutgoingEmailSettings : OMI_BaseResource
{
[key] string WebAppUrl;
[Write] string SMTPServer;
[Write] string FromAddress;
[Write] string ReplyToAddress;
[Write] string CharacterSet;
[Required] string SMTPServer;
[Required] string FromAddress;
[Required] string ReplyToAddress;
[Required] string CharacterSet;
[Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount;
};

Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
function Get-TargetResource
{
[CmdletBinding()]
[OutputType([System.Collections.Hashtable])]
param
(
[parameter(Mandatory = $true)] [System.String] $Url,
[parameter(Mandatory = $false)] [System.String[]] $Blocked,
[parameter(Mandatory = $false)] [System.String[]] $EnsureBlocked,
[parameter(Mandatory = $false)] [System.String[]] $EnsureAllowed,
[parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
)

Write-Verbose -Message "Getting web application '$url' blocked file types"

$result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments @($PSBoundParameters,$PSScriptRoot) -ScriptBlock {
$params = $args[0]
$ScriptRoot = $args[1]


$wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue
if ($null -eq $wa) { return $null }

Import-Module (Join-Path $ScriptRoot "..\..\Modules\xSharePoint.WebApplication\xSPWebApplication.BlockedFileTypes.psm1" -Resolve)

$result = Get-xSPWebApplicationBlockedFileTypes -WebApplication $wa
$result.Add("Url", $params.Url)
$result.Add("InstallAccount", $params.InstallAccount)
return $result
}
return $result
}


function Set-TargetResource
{
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)] [System.String] $Url,
[parameter(Mandatory = $false)] [System.String[]] $Blocked,
[parameter(Mandatory = $false)] [System.String[]] $EnsureBlocked,
[parameter(Mandatory = $false)] [System.String[]] $EnsureAllowed,
[parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
)

Write-Verbose -Message "Setting web application '$Url' blocked file types"
$result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments @($PSBoundParameters,$PSScriptRoot) -ScriptBlock {
$params = $args[0]
$ScriptRoot = $args[1]

$wa = Get-SPWebApplication -Identity $params.Url -ErrorAction SilentlyContinue
if ($null -eq $wa) {
throw "Web application $($params.Url) was not found"
return
}

Import-Module (Join-Path $ScriptRoot "..\..\Modules\xSharePoint.WebApplication\xSPWebApplication.BlockedFileTypes.psm1" -Resolve)
Set-xSPWebApplicationBlockedFileTypes -WebApplication $wa -Settings $params
$wa.Update()
}
}


function Test-TargetResource
{
[CmdletBinding()]
[OutputType([System.Boolean])]
param
(
[parameter(Mandatory = $true)] [System.String] $Url,
[parameter(Mandatory = $false)] [System.String[]] $Blocked,
[parameter(Mandatory = $false)] [System.String[]] $EnsureBlocked,
[parameter(Mandatory = $false)] [System.String[]] $EnsureAllowed,
[parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
)

$CurrentValues = Get-TargetResource @PSBoundParameters
Write-Verbose -Message "Testing for web application '$Url' blocked file types"
if ($null -eq $CurrentValues) { return $false }

Import-Module (Join-Path $PSScriptRoot "..\..\Modules\xSharePoint.WebApplication\xSPWebApplication.BlockedFileTypes.psm1" -Resolve)
return Test-xSPWebApplicationBlockedFileTypes -CurrentSettings $CurrentValues -DesiredSettings $PSBoundParameters
}


Export-ModuleMember -Function *-TargetResource

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
**Description**

This resource is responsible for controlling the blocked file type setting on a specific web application.
It has two modes of operation, the first is to use the 'blocked' property, where you are able to define a specific list of file types that will be blocked.
In this mode when it is detected that the list does not match the local farm, it is set to match this list exactly.
The second mode is to use the 'EnsureBlocked' and 'EnsureAllowed' properties.
EnsureBlocked will check to make sure that the specified file types are on the list, and if not they will be added.
EnsureAllowed checks to make sure that a file type is not on the list, and if it is it will be removed.
Both of these properties will only make changes to the file types in their list and will leave the full list as it is otherwise, whereas the blocked property resets the list in full.

**Example**

xSPBlockedFileTypes PrimaryWebAppBlockedFileTypes
{
Url = "Shttp://exmaple.contoso.local"
EnsureBlocked = @("exe", "dll", "msi")
EnsureAllowed = @("pdf", "docx", "xlsx")
PsDscRunAsCredential = $InstallAccount
}
*/
[ClassVersion("1.0.0"), FriendlyName("xSPWebAppBlockedFileTypes")]
Class MSFT_xSPWebAppBlockedFileTypes : OMI_BaseResource
{
[Key] string Url;
[write] string Blocked[];
[write] string EnsureBlocked[];
[write] string EnsureAllowed[];
[Write, EmbeddedInstance("MSFT_Credential")] string InstallAccount;
};
Loading

0 comments on commit 863652f

Please sign in to comment.