List SSL Certificates and List SSL Certificate Bindings

  • Hello,

    I have a question about the above Methods. Running $wotevah.ListSSLCertificates() Provides the following details (when run on my local Win7 machine)...

    __GENUS : 2

    __CLASS : __PARAMETERS

    __SUPERCLASS :

    __DYNASTY : __PARAMETERS

    __RELPATH :

    __PROPERTY_COUNT : 5

    __DERIVATION : {}

    __SERVER :

    __NAMESPACE :

    __PATH :

    CertificateHash : {THE_LONG_HASH_NUMBER}

    CertName : {FQDN of Machine}

    Hostname : {FQDN of Machine}

    HRESULT : 0

    Length : 1

    PSComputerName :

    ...now looking at ListSSLCertificateBindings, the parameters are...

    LCID

    The locale to use for the error messages that are returned.

    Application[]

    [out] The applications that have certificate bindings.

    CertificateHash[]

    [out] The hashes for the certificates.

    IPAddress[]

    [out] The IP address for the applications.

    Port[]

    [out] The port number stored in the binding in rsreportserver.config.

    Errors[]

    [out] The descriptions for errors that occurred.

    Length

    [out] The length of the array returned by the method.

    HRESULT

    [out] Value indicating whether the call succeeded or failed.

    ...but I am not sure how to use these parameters and get the Method to work. Do I need to use some of the output from the first method? I cant find an example of actual syntax in action to copy, or use as a guide.

    Would love a bit of help.

    Thank you,

    D.

  • Note that all but LCID are out parameters i.e. no values are to be passed in.

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

  • Thank you, Gary. I took the parameters a little too literally there!

    Regards,

    D.

  • You are very welcome. It is always easier being the fresh eyes 😉

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

  • Hi Gary,

    I wondered if I might call on your help once more. I am trying to set up some try/catch action, I feel like I am almost there but I am struggling with a particular step. I am trying to assign HRESULT as a variable $Result.

    But I can only go as "deep" as assigning the ListIPAddress method which contains HResult as part of its output (as it comes up in the prompt)...

    PS C:\Windows\system32> $Result.ListIPAddresses()

    __GENUS : 2

    __CLASS : __PARAMETERS

    __SUPERCLASS :

    __DYNASTY : __PARAMETERS

    __RELPATH :

    __PROPERTY_COUNT : 5

    __DERIVATION : {}

    __SERVER :

    __NAMESPACE :

    __PATH :

    HRESULT : 0

    IPAddress : {BUNCHOFIPADDRESSES]...}

    IPVersion : {V4, V4, V4, V6...}

    IsDhcpEnabled : {False, False, False, False...}

    Length : 5

    PSComputerName :

    What am after is assigning HRESULT as the $Result variable, so can put in a line like...

    If ($Result.HResult -ne 0)

    ...so it only throws an error if it fails. But I just cant seem to get HResult up as an option in the ISE. How do I get beyond the wall and get to the HResult property to assign it to a variable? Could you please point me in the right direction? I'm learning a lot, but still a lot of learning to do.

    Regards,

    D.

  • Hi,

    You could try the following (assuming the object that you are calling is a COM object underneath - safe assumption if you are after the HRESULT):

    try

    {

    $wotevah.ListSSLCertificates()

    }

    catch [System.Runtime.InteropServices.COMException]

    {

    if($_.Exception.ErrorCode -eq 0x0)

    {

    # Known code - this could have been a switch etc.

    }

    else

    {

    # Unexpected COM exception

    }

    }

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

  • Thanks Gary,

    I think I found another way of doing it which I will post when I can sort out an non-sensitive version, its probably not the most elegant way to be honest.

    What I am trying to work out now is how I can hit the apply button in SSRS Web service URL section of the SSRS configuration manager using Powershell now. Coming up blank so far.

    Regards,

    D.

  • No idea with that. Sorry and good luck!!!

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!

Viewing 8 posts - 1 through 7 (of 7 total)

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