0

Started getting error messages after uninstall of PS and install of the new module SqlServer when evaluating policies on remote servers using Registered Servers and Invoke-PolicyEvaluation cmdlet. It was working alright previously with the old PS module but the new replacement module requires TrustServerCertificate=True parameter which is missing from the syntax of Invoke-PolicyEvaluation. Error message is:

A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted

How can I make it work again?
Thank you

1 Answer 1

1

Follow the example in the docs to use a custom connection string.

Set-Location "C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Policies\DatabaseEngine\1033"
$Connection = New-Object Microsoft.SqlServer.Management.Sdk.Sfc.SqlStoreConnection("server='MYCOMPUTER';Trusted_Connection=True")
Invoke-PolicyEvaluation -Policy "Database Status.xml" -TargetServer $Connection

https://learn.microsoft.com/en-us/powershell/module/sqlserver/invoke-policyevaluation?view=sqlserver-ps#example-5-evaluate-policies-from-xml-files-by-using-a-sqlstoreconnection-object

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.