Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Integration_Test_Resources_ReportingServices
- Integration_Test_Resources_ReportingServices_dbatools
- Update build script path in integration tests.
- Fix style formatting in all PowerShell script files.
- SqlSetup
- Fixed issue with AddNode where cluster IP information was not being passed to
setup.exe ([issue #1171](https://github.com/dsccommunity/SqlServerDsc/issues/1171)).
Expand Down
18 changes: 9 additions & 9 deletions source/Classes/020.SqlAudit.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -395,15 +395,15 @@ class SqlAudit : SqlResourceBase
{
# Look for file audit properties not in desired state
$fileAuditProperty = $properties.Keys.Where({
$_ -in @(
'Path'
'MaximumFiles'
'MaximumFileSize'
'MaximumFileSizeUnit'
'MaximumRolloverFiles'
'ReserveDiskSpace'
)
})
$_ -in @(
'Path'
'MaximumFiles'
'MaximumFileSize'
'MaximumFileSizeUnit'
'MaximumRolloverFiles'
'ReserveDiskSpace'
)
})

# If a property was found, throw an exception.
if ($fileAuditProperty.Count -gt 0)
Expand Down
4 changes: 2 additions & 2 deletions source/Classes/020.SqlPermission.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ class SqlPermission : SqlResourceBase
$serverObject = $this.GetServerObject()

$testSqlDscIsLoginParameters = @{
ServerObject = $serverObject
Name = $this.Name
ServerObject = $serverObject
Name = $this.Name
}

# This will test wether the principal exist.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function Get-TargetResource
#>
function Set-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('AvoidThrowOutsideOfTry', '', Justification='Because the code throws based on an prior expression')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('AvoidThrowOutsideOfTry', '', Justification = 'Because the code throws based on an prior expression')]
[CmdletBinding()]
param
(
Expand Down
17 changes: 10 additions & 7 deletions source/DSCResources/DSC_SqlAgentAlert/DSC_SqlAgentAlert.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ function Set-TargetResource

function Test-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='The command Connect-Sql is called when Get-TargetResource is called')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'The command Connect-Sql is called when Get-TargetResource is called')]
[CmdletBinding()]
[OutputType([System.Boolean])]
param
Expand Down Expand Up @@ -347,15 +347,18 @@ function Test-TargetResource

if ($Ensure -eq 'Present')
{
$returnValue = Test-DscParameterState `
-CurrentValues $getTargetResourceResult `
-DesiredValues $PSBoundParameters `
-ValuesToCheck @(
$testDscParameterStateParameters = @{
CurrentValues = $getTargetResourceResult
DesiredValues = $PSBoundParameters
ValuesToCheck = @(
'Name'
'Severity'
'MessageId'
) `
-TurnOffTypeChecking
)
TurnOffTypeChecking = $true
}

$returnValue = Test-DscParameterState @testDscParameterStateParameters
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ function Set-TargetResource
#>
function Test-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='The command Connect-Sql is called when Get-TargetResource is called')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'The command Connect-Sql is called when Get-TargetResource is called')]
[CmdletBinding()]
[OutputType([System.Boolean])]
param
Expand Down Expand Up @@ -275,14 +275,17 @@ function Test-TargetResource

if ($Ensure -eq 'Present')
{
$returnValue = Test-DscParameterState `
-CurrentValues $getTargetResourceResult `
-DesiredValues $PSBoundParameters `
-ValuesToCheck @(
$testDscParameterStateParameters = @{
CurrentValues = $getTargetResourceResult
DesiredValues = $PSBoundParameters
ValuesToCheck = @(
'FailsafeOperator'
'NotificationMethod'
) `
-TurnOffTypeChecking
)
TurnOffTypeChecking = $true
}

$returnValue = Test-DscParameterState @testDscParameterStateParameters
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function Set-TargetResource
#>
function Test-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='The command Connect-Sql is called when Get-TargetResource is called')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'The command Connect-Sql is called when Get-TargetResource is called')]
[CmdletBinding()]
[OutputType([System.Boolean])]
param
Expand Down
6 changes: 3 additions & 3 deletions source/DSCResources/DSC_SqlAlias/DSC_SqlAlias.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'
#>
function Get-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='Neither command is needed for this resource since the resource modifies registry')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'Neither command is needed for this resource since the resource modifies registry')]
[CmdletBinding()]
[OutputType([System.Collections.Hashtable])]
param
Expand Down Expand Up @@ -133,7 +133,7 @@ function Get-TargetResource
#>
function Set-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='Neither command is needed for this resource since the resource modifies registry')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'Neither command is needed for this resource since the resource modifies registry')]
[CmdletBinding()]
param
(
Expand Down Expand Up @@ -265,7 +265,7 @@ function Set-TargetResource
#>
function Test-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='Neither command is needed for this resource since the resource modifies registry')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'Neither command is needed for this resource since the resource modifies registry')]
[CmdletBinding()]
[OutputType([System.Boolean])]
param
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function Set-TargetResource
)

# Build the instance name to allow the Enable/Disable-Always On to connect to the instance
if ($InstanceName -eq "MSSQLSERVER")
if ($InstanceName -eq 'MSSQLSERVER')
{
$serverInstance = $ServerName
}
Expand Down Expand Up @@ -206,7 +206,7 @@ function Set-TargetResource
#>
function Test-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='The command Connect-Sql is called when Get-TargetResource is called')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'The command Connect-Sql is called when Get-TargetResource is called')]
[CmdletBinding()]
[OutputType([System.Boolean])]
param
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function Set-TargetResource
#>
function Test-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='The command Connect-Sql is called when Get-TargetResource is called')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'The command Connect-Sql is called when Get-TargetResource is called')]
[CmdletBinding()]
[OutputType([System.Boolean])]
param
Expand Down
2 changes: 1 addition & 1 deletion source/DSCResources/DSC_SqlDatabase/DSC_SqlDatabase.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ function Set-TargetResource
#>
function Test-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='The command Connect-Sql is called when Get-TargetResource is called')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'The command Connect-Sql is called when Get-TargetResource is called')]
[CmdletBinding()]
[OutputType([System.Boolean])]
param
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function Get-TargetResource
#>
function Set-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('AvoidThrowOutsideOfTry', '', Justification='Because the code throws based on an prior expression')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('AvoidThrowOutsideOfTry', '', Justification = 'Because the code throws based on an prior expression')]
[CmdletBinding()]
param
(
Expand Down Expand Up @@ -245,7 +245,7 @@ function Set-TargetResource
#>
function Test-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='The command Connect-Sql is called when Get-TargetResource is called')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'The command Connect-Sql is called when Get-TargetResource is called')]
[CmdletBinding()]
[OutputType([System.Boolean])]
param
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ $script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'
#>
function Get-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='The command Connect-Sql is called when Get-DatabaseObject is called')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'The command Connect-Sql is called when Get-DatabaseObject is called')]
[CmdletBinding()]
[OutputType([System.Collections.Hashtable])]
param
Expand Down Expand Up @@ -241,7 +241,7 @@ function Get-TargetResource
#>
function Set-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='The command Connect-Sql will be implicitly called in the call to Compare-TargetResourceState')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'The command Connect-Sql will be implicitly called in the call to Compare-TargetResourceState')]
[CmdletBinding()]
param
(
Expand Down Expand Up @@ -523,7 +523,7 @@ function Set-TargetResource
#>
function Test-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='The command Connect-Sql will be implicitly called in the call to Compare-TargetResourceState')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'The command Connect-Sql will be implicitly called in the call to Compare-TargetResourceState')]
[CmdletBinding()]
[OutputType([System.Boolean])]
param
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function Get-TargetResource
New-ObjectNotFoundException -Message $errorMessage
}

$databaseIsUpdateable = $sqlDatabaseObject.IsUpdateable
$databaseIsUpdateable = $sqlDatabaseObject.IsUpdateable

if ($sqlDatabaseRoleObject = $sqlDatabaseObject.Roles[$Name])
{
Expand Down Expand Up @@ -414,7 +414,7 @@ function Set-TargetResource
#>
function Test-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='The command Connect-Sql is called when Get-TargetResource is called')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'The command Connect-Sql is called when Get-TargetResource is called')]
[CmdletBinding()]
[OutputType([System.Boolean])]
param
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ function Set-TargetResource

# Default parameters for the cmdlet Invoke-SqlDscQuery used throughout.
$invokeSqlDscQueryParameters = @{
ServerName = $ServerName
InstanceName = $InstanceName
ServerName = $ServerName
InstanceName = $InstanceName
DatabaseName = $DatabaseName
}

Expand Down Expand Up @@ -546,15 +546,19 @@ function Test-TargetResource
$desiredValues['Ensure'] = $Ensure
$desiredValues['UserType'] = $UserType

$testTargetResourceReturnValue = Test-DscParameterState -CurrentValues $getTargetResourceResult `
-DesiredValues $desiredValues `
-ValuesToCheck @(
$testDscParameterStateParameters = @{
CurrentValues = $getTargetResourceResult
DesiredValues = $desiredValues
ValuesToCheck = @(
'LoginName'
'AsymmetricKeyName'
'CertificateName'
'UserType'
) `
-TurnOffTypeChecking
)
TurnOffTypeChecking = $true
}

$testTargetResourceReturnValue = Test-DscParameterState @testDscParameterStateParameters
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion source/DSCResources/DSC_SqlEndpoint/DSC_SqlEndpoint.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ function Set-TargetResource
#>
function Test-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='The command Connect-Sql is called when Get-TargetResource is called')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'The command Connect-Sql is called when Get-TargetResource is called')]
[CmdletBinding()]
[OutputType([System.Boolean])]
param
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ function Set-TargetResource
#>
function Test-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='The command Connect-Sql is called when Get-TargetResource is called')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'The command Connect-Sql is called when Get-TargetResource is called')]
[CmdletBinding()]
[OutputType([System.Boolean])]
param
Expand Down
2 changes: 1 addition & 1 deletion source/DSCResources/DSC_SqlMaxDop/DSC_SqlMaxDop.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ function Set-TargetResource
#>
function Test-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='The command Connect-Sql is called when Get-TargetResource is called')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'The command Connect-Sql is called when Get-TargetResource is called')]
[CmdletBinding()]
[OutputType([System.Boolean])]
param
Expand Down
6 changes: 3 additions & 3 deletions source/DSCResources/DSC_SqlMemory/DSC_SqlMemory.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ function Set-TargetResource
#>
function Test-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='The command Connect-Sql is called when Get-TargetResource is called')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'The command Connect-Sql is called when Get-TargetResource is called')]
[CmdletBinding()]
[OutputType([System.Boolean])]
param
Expand All @@ -331,7 +331,7 @@ function Test-TargetResource
$ServerName = (Get-ComputerName),

[Parameter()]
[ValidateSet("Present", "Absent")]
[ValidateSet('Present', 'Absent')]
[System.String]
$Ensure = 'Present',

Expand Down Expand Up @@ -576,7 +576,7 @@ function Get-SqlDscPercentMemory
try
{
$physicalMemory = (Get-CimInstance -ClassName Win32_ComputerSystem).TotalPhysicalMemory
$memoryInMegaBytes = [Math]::Round(($physicalMemory * ($PercentMemory/100)) / 1MB)
$memoryInMegaBytes = [Math]::Round(($physicalMemory * ($PercentMemory / 100)) / 1MB)
}
catch
{
Expand Down
4 changes: 2 additions & 2 deletions source/DSCResources/DSC_SqlProtocol/DSC_SqlProtocol.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ function Get-TargetResource
#>
function Set-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='The command Import-SqlDscPreferredModule is implicitly called when calling Compare-TargetResourceState')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'The command Import-SqlDscPreferredModule is implicitly called when calling Compare-TargetResourceState')]
[CmdletBinding()]
param
(
Expand Down Expand Up @@ -415,7 +415,7 @@ function Set-TargetResource
#>
function Test-TargetResource
{
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification='The command Import-SqlDscPreferredModule is implicitly called when calling Compare-TargetResourceState')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('SqlServerDsc.AnalyzerRules\Measure-CommandsNeededToLoadSMO', '', Justification = 'The command Import-SqlDscPreferredModule is implicitly called when calling Compare-TargetResourceState')]
[CmdletBinding()]
[OutputType([System.Boolean])]
param
Expand Down
Loading
Loading