Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set-DbaNetworkCertificate - Support localhost and use it as default for SqlInstance (part 2) #9125

Merged
merged 1 commit into from
Oct 10, 2023
Merged
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
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