Skip to content

Commit 4556413

Browse files
authored
Merge pull request #1199 from barbaravaldez/master
Update script
2 parents e8ba53e + 295a3fc commit 4556413

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ try {
9696
$login, $pwd = Get-Content '/var/opt/mssql/secrets/assessment' -Encoding UTF8NoBOM -TotalCount 2
9797
$securePassword = ConvertTo-SecureString $pwd -AsPlainText -Force
9898
$credential = New-Object System.Management.Automation.PSCredential ($login, $securePassword)
99-
99+
$securePassword.MakeReadOnly()
100+
100101
Write-Verbose "Acquired credentials"
101102

102103
$serverInstance = '.'
@@ -111,6 +112,7 @@ try {
111112
}
112113
}
113114

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
114116
$serverName = (Invoke-SqlCmd -ServerInstance $serverInstance -Credential $credential -Query "SELECT @@SERVERNAME")[0]
115117
$hostName = (Invoke-SqlCmd -ServerInstance $serverInstance -Credential $credential -Query "SELECT HOST_NAME()")[0]
116118

0 commit comments

Comments
 (0)