Skip to content

Commit 295a3fc

Browse files
committed
add comment
1 parent a391165 commit 295a3fc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

samples/manage/sql-assessment-api/RHEL/runassessment.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,16 @@ try {
112112
}
113113
}
114114

115-
$serverName = (Invoke-SqlCmd -ServerInstance $serverInstance -Credential $credential -Query "SELECT @@SERVERNAME" -TrustServerCertificate)[0]
116-
$hostName = (Invoke-SqlCmd -ServerInstance $serverInstance -Credential $credential -Query "SELECT HOST_NAME()" -TrustServerCertificate)[0]
115+
# IMPORTANT: If the script is run in trusted environments and there is a prelogin handshake error, add -TrustServerCertificate flag in lines 116, 117 and 124
116+
$serverName = (Invoke-SqlCmd -ServerInstance $serverInstance -Credential $credential -Query "SELECT @@SERVERNAME")[0]
117+
$hostName = (Invoke-SqlCmd -ServerInstance $serverInstance -Credential $credential -Query "SELECT HOST_NAME()")[0]
117118

118119
# Invoke assessment and store results.
119120
# Replace 'ConvertTo-Json' with 'ConvertTo-Csv' to change output format.
120121
# Available output formats: JSON, CSV, XML.
121122
# Encoding parameter is optional.
122123

123-
Get-SqlInstance -ServerInstance $serverInstance -Credential $credential -ErrorAction Stop -TrustServerCertificate
124+
Get-SqlInstance -ServerInstance $serverInstance -Credential $credential -ErrorAction Stop
124125
| Get-TargetsRecursive
125126
| %{ Write-Verbose "Invoke assessment on $($_.Urn)"; $_ }
126127
| Invoke-SqlAssessment 3>&1

0 commit comments

Comments
 (0)