From 6d4fea0dd6954a1c57c878931edef22926bb13b0 Mon Sep 17 00:00:00 2001 From: Andreas Jordan <66946165+andreasjordan@users.noreply.github.com> Date: Tue, 10 Oct 2023 21:16:31 +0200 Subject: [PATCH] Set-DbaNetworkCertificate - Support localhost and use it as default for SqlInstance (part 2) (#9125) --- public/Set-DbaNetworkCertificate.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/Set-DbaNetworkCertificate.ps1 b/public/Set-DbaNetworkCertificate.ps1 index 9ee3ed15e3..3b56babf62 100644 --- a/public/Set-DbaNetworkCertificate.ps1 +++ b/public/Set-DbaNetworkCertificate.ps1 @@ -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 } } }