Using SMO, powershell to retrieve SQL Server Network Configuration- Certificate properties

  • Hi,

    Is there any way to programmatically retrieve  SQL Server Network Configuration-> Protocols for MSSQLSERVER-> Certificate tab-> Expiration date  property through SMO, powershell?

    Thanks.

  • praveen_vejandla - Thursday, January 25, 2018 6:51 AM

    Hi,

    Is there any way to programmatically retrieve  SQL Server Network Configuration-> Protocols for MSSQLSERVER-> Certificate tab-> Expiration date  property through SMO, powershell?

    Thanks.

    It's been awhile since I did it and can't find the script but you can get the thumbprint in the following registry key:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.x\MSSQLServer\SuperSocketNetLib\Certificate
    You can get that programmatically using xp_regread.
    Then I used this article about Certificates and Powershell to get the certificate properties by thumbprint. Expiration property is NotAfter when getting the properties in Powershell:
    Working with Certificates in PowerShell

    If you wanted an already written script, I'd probably check the Technet Gallery

    Sue

  • Thanks for the reply.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply