Skip to content

Commit

Permalink
Merge pull request #115 from PowerShell/Release-v0.8
Browse files Browse the repository at this point in the history
Releasing v0.8
  • Loading branch information
KarolKaczmarek committed Dec 7, 2015
2 parents 34ff4a8 + 863652f commit 0456290
Show file tree
Hide file tree
Showing 78 changed files with 4,851 additions and 1,106 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
function Get-TargetResource
{
[CmdletBinding()]
[OutputType([System.Collections.Hashtable])]
param
(
[parameter(Mandatory = $true)] [System.Boolean] $ScanOnDownload,
[parameter(Mandatory = $false)] [System.Boolean] $ScanOnUpload,
[parameter(Mandatory = $false)] [System.Boolean] $AllowDownloadInfected,
[parameter(Mandatory = $false)] [System.Boolean] $AttemptToClean,
[parameter(Mandatory = $false)] [System.UInt16] $TimeoutDuration,
[parameter(Mandatory = $false)] [System.UInt16] $NumberOfThreads,
[parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
)

Write-Verbose -Message "Getting antivirus configuration settings"

$result = Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock {
$params = $args[0]

try {
$spFarm = Get-SPFarm
} catch {
Write-Verbose -Verbose "No local SharePoint farm was detected. Antivirus settings will not be applied"
return $null
}

# Get a reference to the Administration WebService
$admService = Get-xSharePointContentService

return @{
# Set the antivirus settings
AllowDownloadInfected = $admService.AntivirusSettings.AllowDownload
ScanOnDownload = $admService.AntivirusSettings.DownloadScanEnabled
ScanOnUpload = $admService.AntivirusSettings.UploadScanEnabled
AttemptToClean = $admService.AntivirusSettings.CleaningEnabled
NumberOfThreads = $admService.AntivirusSettings.NumberOfThreads
TimeoutDuration = $admService.AntivirusSettings.Timeout.TotalSeconds
InstallAccount = $params.InstallAccount
}
}

return $result
}


function Set-TargetResource
{
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)] [System.Boolean] $ScanOnDownload,
[parameter(Mandatory = $false)] [System.Boolean] $ScanOnUpload,
[parameter(Mandatory = $false)] [System.Boolean] $AllowDownloadInfected,
[parameter(Mandatory = $false)] [System.Boolean] $AttemptToClean,
[parameter(Mandatory = $false)] [System.UInt16] $TimeoutDuration,
[parameter(Mandatory = $false)] [System.UInt16] $NumberOfThreads,
[parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
)

Write-Verbose -Message "Setting antivirus configuration settings"

Invoke-xSharePointCommand -Credential $InstallAccount -Arguments $PSBoundParameters -ScriptBlock {
$params = $args[0]

try {
$spFarm = Get-SPFarm
} catch {
throw "No local SharePoint farm was detected. Antivirus settings will not be applied"
return
}

Write-Verbose -Message "Start update"
$admService = Get-xSharePointContentService

# Set the antivirus settings
if ($params.ContainsKey("AllowDownloadInfected")) {
Write-Verbose -Message "Setting Allow Download"
$admService.AntivirusSettings.AllowDownload = $params.AllowDownloadInfected
}
if ($params.ContainsKey("ScanOnDownload")) { $admService.AntivirusSettings.DownloadScanEnabled = $params.ScanOnDownload }
if ($params.ContainsKey("ScanOnUpload")) { $admService.AntivirusSettings.UploadScanEnabled = $params.ScanOnUpload }
if ($params.ContainsKey("AttemptToClean")) { $admService.AntivirusSettings.CleaningEnabled = $params.AttemptToClean }
if ($params.ContainsKey("NumberOfThreads")) { $admService.AntivirusSettings.NumberOfThreads = $params.NumberOfThreads }
if ($params.ContainsKey("TimeoutDuration")) {
$timespan = New-TimeSpan -Seconds $params.TimeoutDuration
$admService.AntivirusSettings.Timeout = $timespan
}

$admService.Update()
}
}


function Test-TargetResource
{
[CmdletBinding()]
[OutputType([System.Boolean])]
param
(
[parameter(Mandatory = $true)] [System.Boolean] $ScanOnDownload,
[parameter(Mandatory = $false)] [System.Boolean] $ScanOnUpload,
[parameter(Mandatory = $false)] [System.Boolean] $AllowDownloadInfected,
[parameter(Mandatory = $false)] [System.Boolean] $AttemptToClean,
[parameter(Mandatory = $false)] [System.UInt16] $TimeoutDuration,
[parameter(Mandatory = $false)] [System.UInt16] $NumberOfThreads,
[parameter(Mandatory = $false)] [System.Management.Automation.PSCredential] $InstallAccount
)

Write-Verbose -Message "Testing antivirus configuration settings"
$CurrentValues = Get-TargetResource @PSBoundParameters

if ($null -eq $CurrentValues) { return $false }

return Test-xSharePointSpecificParameters -CurrentValues $CurrentValues -DesiredValues $PSBoundParameters
}

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

This resource is used to set the global antivirus settings for the local form.
These settings will be used to control the behavior of an external anti-virus scanning tool that is able to integrate with SharePoint.
Note that this will not scan documents for viruses on it's own, an external tool still needs to be installed on the servers that integrates with SharePoint.

**Example**

xSPAntivirusSettings AVSettings
{
ScanOnDownload = $true
ScanOnUpload = $true
AllowDownloadInfected = $false
AttemptToClean = $false
}
*/

[ClassVersion("1.0.0.0"), FriendlyName("xSPAntivirusSettings")]
class MSFT_xSPAntivirusSettings : OMI_BaseResource
{
[Key] Boolean ScanOnDownload;
[Write] Boolean ScanOnUpload;
[Write] Boolean AllowDownloadInfected;
[Write] Boolean AttemptToClean;
[Write] Uint16 TimeoutDuration;
[Write] Uint16 NumberOfThreads;
[Write, EmbeddedInstance("MSFT_Credential")] String InstallAccount;
};

Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
/*
**Description**

This resource is used to provision and manage an instance of the Business Connectivity Services Service Application.
It will identify an instance of the BCS app through the application display name.
Currently the resource will provision the app if it does not yet exist, and will change the service account associated to the app if it does not match the configuration.
Database names or server name will not be changed if the configuration does not match, these parameters are only used for the initial provisioning of the service application.

**Example**

xSPBCSServiceApp BCSServiceApp
{
Name = "BCS Service Application"
ApplicationPool = "SharePoint Service Applications"
DatabaseName = "SP_BCS"
DatabaseServer = $DatabaseServer
InstallAccount = $InstallAccount
}
*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPBCSServiceApp")]
class MSFT_xSPBCSServiceApp : OMI_BaseResource
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
/*
**Description**

This resource is used to set the "super user" and "super reader" cache accounts for the specified web application object (as described in the TechNet article [Configure object cache user accounts in SharePoint Server 2013](https://technet.microsoft.com/en-us/library/ff758656.aspx)).

**Example**

xSPCacheAccounts SetCacheAccounts
{
WebAppUrl = "http://sharepoint.contoso.com"
SuperUserAlias = "DEMO\svcSPSuperUser"
SuperReaderAlias = "DEMO\svcSPReader"
PsDscRunAsCredential = $InstallAccount
}
*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPCacheAccounts")]
class MSFT_xSPCacheAccounts : OMI_BaseResource
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
/*
**Description**

This resource is used to provision a new SharePoint farm.
It should only be used on the first server in the farm to create the configuration database, all servers to join the farm after the first server creates the configuration database should use [xSPJoinFarm](xSPJoinFarm).
Once the config DB has been created, the resource will install local help collections, secure resources, activate features and provision the central admin site.

The port of the Central Admin website can be set by using the CentralAdministrationPort property, if this is not defined the site will be provisioned on port 9999.
However this setting will not impact existing deployments that already have Central Admin provisioned on another port.
Also when a farm is created, the current behavior is to not enroll the server as a cache server (which is the default behavior of SharePoint).
This means you need to use [xSPDistributedCacheService](xSPDistributedCacheService) on at least one server in the farm to designate it as a cache server.

**Example**

xSPCreateFarm CreateSPFarm
{
DatabaseServer = "SQL.contoso.local\SQLINSTANCE"
FarmConfigDatabaseName = "SP_Config"
Passphrase = "Example Passphrase"
FarmAccount = $FarmAccount
PsDscRunAsCredential = $SetupAccount
AdminContentDatabaseName = "SP_AdminContent"
CentralAdministrationPort = 2000
ServerRole = Custom
}
*/

[ClassVersion("1.0.0.0"), FriendlyName("xSPCreateFarm")]
class MSFT_xSPCreateFarm : OMI_BaseResource
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
/*
**Description**

This resource is responsible for configuring settings to do with the diagnostic (ULS) logging on servers in the farm.
These settings are applied to the diagnostic logging service for the farm and do not need to be applied to each server individually, the settings will be propagated throughout the farm when they are set.

**Example**

xSPDiagnosticLoggingSettings ApplyDiagnosticLogSettings
{
PsDscRunAsCredential = $InstallAccount
LogPath = "L:\ULSLogs"
LogSpaceInGB = 10
AppAnalyticsAutomaticUploadEnabled = $false
CustomerExperienceImprovementProgramEnabled = $true
DaysToKeepLogs = 7
DownloadErrorReportingUpdatesEnabled = $false
ErrorReportingAutomaticUploadEnabled = $false
ErrorReportingEnabled = $false
EventLogFloodProtectionEnabled = $true
EventLogFloodProtectionNotifyInterval = 5
EventLogFloodProtectionQuietPeriod = 2
EventLogFloodProtectionThreshold = 5
EventLogFloodProtectionTriggerPeriod = 2
LogCutInterval = 15
LogMaxDiskSpaceUsageEnabled = $true
ScriptErrorReportingDelay = 30
ScriptErrorReportingEnabled = $true
ScriptErrorReportingRequireAuth = $true
}
*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPDiagnosticLoggingSettings")]
class MSFT_xSPDiagnosticLoggingSettings : OMI_BaseResource
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
/*
**Description**

This resource is responsible for provisioning the distributed cache to the service it runs on.
This is required in your farm on at least one server (as the behavior of [xSPCreateFarm](xSPCreateFarm) and [xSPJoinFarm](xSPJoinFarm) is to not enroll every server as a cache server).
The service will be provisioned or de-provisioned based on the Ensure property, and when provisioned the CacheSizeInMB property and ServiceAccount property will be used to configure it.
The property createFirewallRules is used to determine if exceptions should be added to the windows firewall to allow communication between servers on the appropriate ports.

**Example**

xSPDistributedCacheService EnableDistributedCache
{
Name = "AppFabricCachingService"
Ensure = "Present"
CacheSizeInMB = 8192
ServiceAccount = "DEMO\ServiceAccount"
InstallAccount = $InstallAccount
CreateFirewallRules = $true
}
*/
[ClassVersion("1.0.0.0"), FriendlyName("xSPDistributedCacheService")]
class MSFT_xSPDistributedCacheService : OMI_BaseResource
{
Expand Down

0 comments on commit 0456290

Please sign in to comment.