Skip to content

Commit

Permalink
Set-DbaNetworkCertificate - Support localhost and use it as default f…
Browse files Browse the repository at this point in the history
…or SqlInstance (part 2) (#9125)
  • Loading branch information
andreasjordan authored Oct 10, 2023
1 parent 9edc767 commit 6d4fea0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions public/Set-DbaNetworkCertificate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,14 @@ function Set-DbaNetworkCertificate {

if ($PScmdlet.ShouldProcess("local", "Connecting to $instanceName to import new cert")) {
try {
Invoke-Command2 -Raw -ComputerName $resolved.fqdn -Credential $Credential -ArgumentList $regRoot, $serviceAccount, $instanceName, $vsname, $Thumbprint -ScriptBlock $scriptBlock -ErrorAction Stop
Invoke-Command2 -Raw -ComputerName $computerName -Credential $Credential -ArgumentList $regRoot, $serviceAccount, $instanceName, $vsname, $Thumbprint -ScriptBlock $scriptBlock -ErrorAction Stop
if ($RestartService) {
$null = Restart-DbaService -SqlInstance $instance -Force
} else {
Write-Message -Level Warning -Message "New certificate will not take effect until SQL Server services are restarted for $instance"
}
} catch {
Stop-Function -Message "Failed to connect to $($resolved.fqdn) using PowerShell remoting." -ErrorRecord $_ -Target $instance -Continue
Stop-Function -Message "Failed to connect to $computerName using PowerShell remoting." -ErrorRecord $_ -Target $instance -Continue
}
}
}
Expand Down

0 comments on commit 6d4fea0

Please sign in to comment.