Skip to content

Commit

Permalink
Parameters now match that of Connect-SQL (issue #1392)
Browse files Browse the repository at this point in the history
  • Loading branch information
johlju committed Jul 18, 2019
1 parent cb2a4fd commit 9739a77
Show file tree
Hide file tree
Showing 12 changed files with 157 additions and 135 deletions.
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
- Changes to helper function Invoke-Query
- Fixes issues in [issue #1355](https://github.com/PowerShell/SqlServerDsc/issues/1355).
- Works together with Connect-SQL now.
- Parameters now match that of Connect-SQL.
- Parameters now match that of Connect-SQL ([issue #1392](https://github.com/PowerShell/SqlServerDsc/issues/1392)).
- Can now pass in credentials.
- Can now pass in 'Microsoft.SqlServer.Management.Smo.Server' object.
- Can also pipe in 'Microsoft.SqlServer.Management.Smo.Server' object.
Expand All @@ -21,6 +21,20 @@
- Changes to helper function Connect-SQL
- When impersonating WindowsUser credential use the NetworkCredential UserName.
- Added additional verbose logging.
- Changes to helper function Connect-SQLAnalysis
- Parameters now match that of Connect-SQL ([issue #1392](https://github.com/PowerShell/SqlServerDsc/issues/1392)).
- Changes to helper function Restart-SqlService
- Parameters now match that of Connect-SQL ([issue #1392](https://github.com/PowerShell/SqlServerDsc/issues/1392)).
- Changes to helper function Restart-ReportingServicesService
- Parameters now match that of Connect-SQL ([issue #1392](https://github.com/PowerShell/SqlServerDsc/issues/1392)).
- Changes to helper function Split-FullSqlInstanceName
- Parameters and function name changed to use correct casing.
- Changes to helper function Get-SqlInstanceMajorVersion
- Parameters now match that of Connect-SQL ([issue #1392](https://github.com/PowerShell/SqlServerDsc/issues/1392)).
- Changes to helper function Test-LoginEffectivePermissions
- Parameters now match that of Connect-SQL ([issue #1392](https://github.com/PowerShell/SqlServerDsc/issues/1392)).
- Changes to helper function Test-AvailabilityReplicaSeedingModeAutomatic
- Parameters now match that of Connect-SQL ([issue #1392](https://github.com/PowerShell/SqlServerDsc/issues/1392)).
- Changes to SqlServerSecureConnection
- Forced $Thumbprint to lowercase to fix [issue #1350](https://github.com/PowerShell/SqlServerDsc/issues/1350).
- Changes to SqlSetup
Expand Down
10 changes: 5 additions & 5 deletions DSCResources/MSFT_SqlAGDatabase/MSFT_SqlAGDatabase.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ function Set-TargetResource
$availabilityReplicaFilestreamLevel = @{}
foreach ( $availabilityGroupReplica in $secondaryReplicas )
{
$connectSqlParameters = Split-FullSQLInstanceName -FullSQLInstanceName $availabilityGroupReplica.Name
$connectSqlParameters = Split-FullSqlInstanceName -FullSqlInstanceName $availabilityGroupReplica.Name
$currentAvailabilityGroupReplicaServerObject = Connect-SQL @connectSqlParameters
$availabilityReplicaFilestreamLevel.Add($availabilityGroupReplica.Name, $currentAvailabilityGroupReplicaServerObject.FilestreamLevel)
}
Expand All @@ -334,7 +334,7 @@ function Set-TargetResource
$availabilityReplicaContainmentEnabled = @{}
foreach ( $availabilityGroupReplica in $secondaryReplicas )
{
$connectSqlParameters = Split-FullSQLInstanceName -FullSQLInstanceName $availabilityGroupReplica.Name
$connectSqlParameters = Split-FullSqlInstanceName -FullSqlInstanceName $availabilityGroupReplica.Name
$currentAvailabilityGroupReplicaServerObject = Connect-SQL @connectSqlParameters
$availabilityReplicaContainmentEnabled.Add($availabilityGroupReplica.Name, $currentAvailabilityGroupReplicaServerObject.Configuration.ContainmentEnabled.ConfigValue)
}
Expand All @@ -355,7 +355,7 @@ function Set-TargetResource
$availabilityReplicaMissingDirectories = @{}
foreach ( $availabilityGroupReplica in $secondaryReplicas )
{
$connectSqlParameters = Split-FullSQLInstanceName -FullSQLInstanceName $availabilityGroupReplica.Name
$connectSqlParameters = Split-FullSqlInstanceName -FullSqlInstanceName $availabilityGroupReplica.Name
$currentAvailabilityGroupReplicaServerObject = Connect-SQL @connectSqlParameters

$missingDirectories = @()
Expand Down Expand Up @@ -393,7 +393,7 @@ function Set-TargetResource
$availabilityReplicaMissingCertificates = @{}
foreach ( $availabilityGroupReplica in $secondaryReplicas )
{
$connectSqlParameters = Split-FullSQLInstanceName -FullSQLInstanceName $availabilityGroupReplica.Name
$connectSqlParameters = Split-FullSqlInstanceName -FullSqlInstanceName $availabilityGroupReplica.Name
$currentAvailabilityGroupReplicaServerObject = Connect-SQL @connectSqlParameters
[System.Array]$installedCertificateThumbprints = $currentAvailabilityGroupReplicaServerObject.Databases['master'].Certificates | ForEach-Object { [System.BitConverter]::ToString($_.Thumbprint) }

Expand Down Expand Up @@ -540,7 +540,7 @@ function Set-TargetResource
foreach ( $availabilityGroupReplica in $secondaryReplicas )
{
# Connect to the replica
$connectSqlParameters = Split-FullSQLInstanceName -FullSQLInstanceName $availabilityGroupReplica.Name
$connectSqlParameters = Split-FullSqlInstanceName -FullSqlInstanceName $availabilityGroupReplica.Name
$currentAvailabilityGroupReplicaServerObject = Connect-SQL @connectSqlParameters
$currentReplicaAvailabilityGroupObject = $currentAvailabilityGroupReplicaServerObject.AvailabilityGroups[$AvailabilityGroupName]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function Set-TargetResource
)

# Now restart the SQL service so that all dependent services are also returned to their previous state
Restart-SqlService -SQLServer $ServerName -SQLInstanceName $InstanceName -Timeout $RestartTimeout
Restart-SqlService -ServerName $ServerName -InstanceName $InstanceName -Timeout $RestartTimeout

# Verify always on was set
if ( -not ( Test-TargetResource @PSBoundParameters ) )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Function Set-TargetResource
if ($RestartService)
{
Write-Verbose -Message ($script:localizedData.RestartSqlServer -f $ServerName, $InstanceName)
Restart-SqlService -SQLServer $ServerName -SQLInstanceName $InstanceName
Restart-SqlService -ServerName $ServerName -InstanceName $InstanceName
}
}
catch
Expand Down
2 changes: 1 addition & 1 deletion DSCResources/MSFT_SqlRS/MSFT_SqlRS.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ function Set-TargetResource
elseif ( $restartReportingService -and (-not $SuppressRestart) )
{
Write-Verbose -Message $script:localizedData.Restart
Restart-ReportingServicesService -SQLInstanceName $InstanceName -WaitTime 30
Restart-ReportingServicesService -InstanceName $InstanceName -WaitTime 30
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function Set-TargetResource
-f $ServerName, $InstanceName
)

Restart-SqlService -SQLServer $ServerName -SQLInstanceName $InstanceName -Timeout $RestartTimeout
Restart-SqlService -ServerName $ServerName -InstanceName $InstanceName -Timeout $RestartTimeout
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions DSCResources/MSFT_SqlServerNetwork/MSFT_SqlServerNetwork.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ function Set-TargetResource
if ($RestartService -and $isRestartNeeded)
{
$restartSqlServiceParameters = @{
SQLServer = $ServerName
SQLInstanceName = $InstanceName
Timeout = $RestartTimeout
ServerName = $ServerName
InstanceName = $InstanceName
Timeout = $RestartTimeout
}

if ($getTargetResourceResult.IsEnabled -eq $false -and $IsEnabled -eq $true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ function Set-TargetResource
$script:localizedData.RestartingService `
-f $InstanceName
)
Restart-SqlService -SQLServer localhost -SQLInstanceName $InstanceName

Restart-SqlService -ServerName localhost -InstanceName $InstanceName
}

<#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ function Set-TargetResource
if ($RestartService)
{
Write-Verbose -Message ($script:localizedData.RestartingService -f $InstanceName)
Restart-SqlService -SQLServer $ServerName -SQLInstanceName $InstanceName

Restart-SqlService -ServerName $ServerName -InstanceName $InstanceName
}
}

Expand Down
2 changes: 1 addition & 1 deletion DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ function Get-TargetResource
$analysisServiceAccountUsername = $analysisServiceCimInstance.StartName
$AsSvcStartupType = ConvertTo-StartupType -StartMode $analysisServiceCimInstance.StartMode

$analysisServer = Connect-SQLAnalysis -SQLServer $sqlHostName -SQLInstanceName $InstanceName
$analysisServer = Connect-SQLAnalysis -ServerName $sqlHostName -InstanceName $InstanceName

$analysisCollation = $analysisServer.ServerProperties['CollationName'].Value
$analysisDataDirectory = $analysisServer.ServerProperties['DataDir'].Value
Expand Down
Loading

0 comments on commit 9739a77

Please sign in to comment.