From 660b6d12c42a6bf7ff96161f0c076f88f12bd4ae Mon Sep 17 00:00:00 2001 From: Shawn Melton Date: Thu, 28 Feb 2019 14:44:36 -0600 Subject: [PATCH 1/2] format and correcting connect issue to login cmd --- functions/Get-DbaServerRoleMember.ps1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/functions/Get-DbaServerRoleMember.ps1 b/functions/Get-DbaServerRoleMember.ps1 index 8e2f2ba9dd..4a7c340f0d 100644 --- a/functions/Get-DbaServerRoleMember.ps1 +++ b/functions/Get-DbaServerRoleMember.ps1 @@ -81,7 +81,7 @@ function Get-DbaServerRoleMember { param ( [parameter(Position = 0, Mandatory, ValueFromPipeline)] [Alias('ServerInstance', 'SqlServer')] - [DbaInstance[]]$SqlInstance, + [DbaInstanceParameter[]]$SqlInstance, [Alias('Credential')] [PSCredential]$SqlCredential, [string[]]$ServerRole, @@ -105,9 +105,12 @@ function Get-DbaServerRoleMember { $roles = $server.Roles if (Test-Bound -ParameterName 'Login') { - $logins = Get-DbaLogin -SqlInstance $instance -Login $Login + try { + $logins = Get-DbaLogin -SqlInstance $server -Login $Login -EnableException + } catch { + Stop-Function -Message "Issue gathering login details" -ErrorRecord $_ -Target $instance + } Write-Message -Level 'Verbose' -Message "Filtering by logins: $($logins -join ', ')" - foreach ($l in $logins) { $loginRoles += $l.ListMembers() } From db6d17b83ec81cbdedec987394dd0c38aaff5463 Mon Sep 17 00:00:00 2001 From: Shawn Melton Date: Sun, 3 Mar 2019 15:00:56 -0600 Subject: [PATCH 2/2] remove restart of agent (test don't require runing state) --- tests/appveyor.SQL2017.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/appveyor.SQL2017.ps1 b/tests/appveyor.SQL2017.ps1 index 3816cec106..b9e9720843 100644 --- a/tests/appveyor.SQL2017.ps1 +++ b/tests/appveyor.SQL2017.ps1 @@ -28,7 +28,6 @@ Write-Host -Object "$indent Starting $instance" -ForegroundColor DarkGreen #Restart-Service "SQLAgent`$$instance" -WarningAction SilentlyContinue -Force $null = Enable-DbaAgHadr -SqlInstance $sqlinstance -Confirm:$false -Force -Restart-Service "SQLAgent`$$instance" -WarningAction SilentlyContinue -Force do { Start-Sleep 1