@@ -947,7 +947,7 @@ private object RecursiveConnectWithNewCredentials(object inputObject)
947947
948948 try
949949 {
950- Collection < PSObject > results = InvokeCommand . InvokeScript ( false , SB_RecursiveConnect , null ,
950+ Collection < PSObject > results = InvokeCommand . InvokeScript ( true , SB_RecursiveConnect , null ,
951951 serverName , Database , cred , MyInvocation . BoundParameters ) ;
952952 if ( results != null && results . Count > 0 )
953953 return results [ 0 ] . BaseObject ;
@@ -964,7 +964,7 @@ private object CopyAndModifyContext(object inputObject)
964964 {
965965 try
966966 {
967- Collection < PSObject > results = InvokeCommand . InvokeScript ( false , SB_CopyContext , null ,
967+ Collection < PSObject > results = InvokeCommand . InvokeScript ( true , SB_CopyContext , null ,
968968 inputObject ,
969969 ApplicationIntent ,
970970 NonPooledConnection . IsPresent ,
@@ -987,7 +987,7 @@ private object CreateServerFromSqlConnection(object inputObject)
987987 {
988988 try
989989 {
990- Collection < PSObject > results = InvokeCommand . InvokeScript ( false , SB_CreateFromSqlConn , null , inputObject ) ;
990+ Collection < PSObject > results = InvokeCommand . InvokeScript ( true , SB_CreateFromSqlConn , null , inputObject ) ;
991991 if ( results != null && results . Count > 0 )
992992 return results [ 0 ] . BaseObject ;
993993 }
@@ -1004,7 +1004,7 @@ private object CreateServerFromConnectionString(string connString, string server
10041004 // Mirrors PS1: SqlConnectionInfo from connection string properties, then ServerConnection -> Server
10051005 try
10061006 {
1007- Collection < PSObject > results = InvokeCommand . InvokeScript ( false , SB_CreateFromConnString , null ,
1007+ Collection < PSObject > results = InvokeCommand . InvokeScript ( true , SB_CreateFromConnString , null ,
10081008 connString , TrustServerCertificate . IsPresent , Database ) ;
10091009 if ( results != null && results . Count > 0 )
10101010 return results [ 0 ] . BaseObject ;
@@ -1069,7 +1069,7 @@ private object CreateServerFromString(DbaInstanceParameter instance, string serv
10691069
10701070 try
10711071 {
1072- Collection < PSObject > results = InvokeCommand . InvokeScript ( false , SB_CreateFromString , null ,
1072+ Collection < PSObject > results = InvokeCommand . InvokeScript ( true , SB_CreateFromString , null ,
10731073 serverName ,
10741074 authType ,
10751075 username ,
@@ -1118,7 +1118,7 @@ private static string BuildCreateServerScript()
11181118 {
11191119 return @"
11201120param(
1121- $serverName, $authType, $username, $sqlCredential , $accessToken,
1121+ $serverName, $authType, $username, $p_sqlCredential , $accessToken,
11221122 $appendConnectionString, $failoverPartner, $multiSubnetFailover,
11231123 $alwaysEncrypted, $applicationIntent, $clientName, $networkProtocol,
11241124 $connectTimeout, $database, $fullSmoName, $encryptConnection,
@@ -1232,7 +1232,7 @@ private static string BuildCreateServerScript()
12321232# SecurePassword and UserName
12331233if ($authType -in 'azure ad', 'azure sql', 'local sql') {
12341234 Write-Message -Level Debug -Message ""SecurePassword will be set""
1235- $sqlConnectionInfo.SecurePassword = $sqlCredential .Password
1235+ $sqlConnectionInfo.SecurePassword = $p_sqlCredential .Password
12361236 Write-Message -Level Debug -Message ""UserName will be set to '$username'""
12371237 $sqlConnectionInfo.UserName = $username
12381238}
@@ -1296,7 +1296,7 @@ private static string BuildCreateServerScript()
12961296 Write-Message -Level Debug -Message ""ConnectAsUserName will be set to '$username'""
12971297 $serverConnection.ConnectAsUserName = $username
12981298 Write-Message -Level Debug -Message ""ConnectAsUserPassword will be set""
1299- $serverConnection.ConnectAsUserPassword = $sqlCredential .GetNetworkCredential().Password
1299+ $serverConnection.ConnectAsUserPassword = $p_sqlCredential .GetNetworkCredential().Password
13001300}
13011301
13021302Write-Message -Level Debug -Message ""Building Server from ServerConnection""
@@ -1390,7 +1390,7 @@ private bool ValidateConnection(object server, DbaInstanceParameter instance, bo
13901390
13911391 private void RetryWithTrustServerCertificate ( object server )
13921392 {
1393- InvokeCommand . InvokeScript ( false , SB_RetryTrustCert , null , server ) ;
1393+ InvokeCommand . InvokeScript ( true , SB_RetryTrustCert , null , server ) ;
13941394 }
13951395
13961396 #endregion Connection Validation
@@ -1576,7 +1576,7 @@ private void PostConnectionSetup(DbaInstanceParameter instance, object server, b
15761576
15771577 try
15781578 {
1579- InvokeCommand . InvokeScript ( false , SB_PostConnectionSetup , null ,
1579+ InvokeCommand . InvokeScript ( true , SB_PostConnectionSetup , null ,
15801580 instance , server , isAzure ,
15811581 Fields2000Db , Fields200xDb , Fields201xDb ,
15821582 Fields2000Login , Fields200xLogin , Fields201xLogin ,
@@ -1703,7 +1703,7 @@ internal string GetConfigValue(string fullName)
17031703 {
17041704 try
17051705 {
1706- Collection < PSObject > results = InvokeCommand . InvokeScript ( false , SB_GetConfigValue , null , fullName ) ;
1706+ Collection < PSObject > results = InvokeCommand . InvokeScript ( true , SB_GetConfigValue , null , fullName ) ;
17071707 if ( results != null && results . Count > 0 && results [ 0 ] != null )
17081708 {
17091709 object val = results [ 0 ] . BaseObject ;
@@ -1778,7 +1778,7 @@ private void ConnectContext(object server)
17781778 {
17791779 try
17801780 {
1781- InvokeCommand . InvokeScript ( false , SB_ConnectContext , null , server ) ;
1781+ InvokeCommand . InvokeScript ( true , SB_ConnectContext , null , server ) ;
17821782 }
17831783 catch ( Exception ex )
17841784 {
@@ -1790,7 +1790,7 @@ private void DisconnectServer(object server)
17901790 {
17911791 try
17921792 {
1793- InvokeCommand . InvokeScript ( false , SB_DisconnectServer , null , server ) ;
1793+ InvokeCommand . InvokeScript ( true , SB_DisconnectServer , null , server ) ;
17941794 }
17951795 catch ( Exception ex )
17961796 {
@@ -1800,7 +1800,7 @@ private void DisconnectServer(object server)
18001800
18011801 private void InvokeExecuteWithResults ( object server , string sql )
18021802 {
1803- InvokeCommand . InvokeScript ( false , SB_ExecuteWithResults , null , server , sql ) ;
1803+ InvokeCommand . InvokeScript ( true , SB_ExecuteWithResults , null , server , sql ) ;
18041804 }
18051805
18061806 private object GetSqlConnectionObject ( object server )
@@ -1819,7 +1819,7 @@ private void LogMaskedConnectionString(object server)
18191819 {
18201820 try
18211821 {
1822- InvokeCommand . InvokeScript ( false , SB_LogMaskedConnStr , null , server ) ;
1822+ InvokeCommand . InvokeScript ( true , SB_LogMaskedConnStr , null , server ) ;
18231823 }
18241824 catch { }
18251825 }
@@ -1828,7 +1828,7 @@ private void AddNoteProperty(object server, string name, object value)
18281828 {
18291829 try
18301830 {
1831- InvokeCommand . InvokeScript ( false , SB_AddNoteProperty , null , server , name , value ) ;
1831+ InvokeCommand . InvokeScript ( true , SB_AddNoteProperty , null , server , name , value ) ;
18321832 }
18331833 catch { }
18341834 }
@@ -1837,7 +1837,7 @@ private void AddConnectionHashValue(string key, object value)
18371837 {
18381838 try
18391839 {
1840- InvokeCommand . InvokeScript ( false , SB_AddConnHashValue , null , key , value ) ;
1840+ InvokeCommand . InvokeScript ( true , SB_AddConnHashValue , null , key , value ) ;
18411841 }
18421842 catch { }
18431843 }
@@ -1846,7 +1846,7 @@ private bool IsRunningOnCore()
18461846 {
18471847 try
18481848 {
1849- Collection < PSObject > results = InvokeCommand . InvokeScript ( false , SB_IsRunningOnCore , null , new object [ 0 ] ) ;
1849+ Collection < PSObject > results = InvokeCommand . InvokeScript ( true , SB_IsRunningOnCore , null , new object [ 0 ] ) ;
18501850 if ( results != null && results . Count > 0 && results [ 0 ] != null )
18511851 {
18521852 return results [ 0 ] . BaseObject is bool val && val ;
@@ -1858,7 +1858,7 @@ private bool IsRunningOnCore()
18581858
18591859 private PSObject InvokeNewDbaAzAccessToken ( )
18601860 {
1861- Collection < PSObject > results = InvokeCommand . InvokeScript ( false , SB_NewAzAccessToken , null , Tenant , SqlCredential ) ;
1861+ Collection < PSObject > results = InvokeCommand . InvokeScript ( true , SB_NewAzAccessToken , null , Tenant , SqlCredential ) ;
18621862 if ( results != null && results . Count > 0 )
18631863 return results [ 0 ] ;
18641864 return null ;
@@ -1883,7 +1883,7 @@ private DbaInstanceParameter RewriteForServicePrincipal(DbaInstanceParameter ins
18831883" ;
18841884 try
18851885 {
1886- Collection < PSObject > results = InvokeCommand . InvokeScript ( false , ScriptBlock . Create ( script ) , null ,
1886+ Collection < PSObject > results = InvokeCommand . InvokeScript ( true , ScriptBlock . Create ( script ) , null ,
18871887 azureServer , Database , SqlCredential ) ;
18881888 if ( results != null && results . Count > 0 )
18891889 {
0 commit comments