Skip to content

WSManListener

Daniel Scott-Raynsford edited this page Sep 2, 2017 · 7 revisions

WSManListener

Parameters

Parameter Attribute DataType Description Allowed Values
Transport Key String The transport type of WS-Man Listener. HTTP, HTTPS
Ensure Required String Specifies whether the WS-Man Listener should exist. Present, Absent
Port Write uint16 The port the WS-Man Listener should use. Defaults to 5985 for HTTP and 5986 for HTTPS listeners.
Address Write String The Address that the WS-Man Listener will be bound to. The default is * (any address).
Issuer Write String The Issuer of the certificate to use for the HTTPS WS-Man Listener.
SubjectFormat Write String The format used to match the certificate subject to use for an HTTPS WS-Man Listener. Both, FQDNOnly, NameOnly
MatchAlternate Write Boolean Should the FQDN/Name be used to also match the certificate alternate subject for an HTTPS WS-Man Listener.
DN Write String This is a Distinguished Name component that will be used to identify the certificate to use for the HTTPS WS-Man Listener.
HostName Read String The Host Name that an existing WS-Man Listener is bound to.
Enabled Read Boolean Returns true if the existing WS-Man Listener is enabled.
URLPrefix Read String The URL Prefix of the existing WS-Man Listener.
CertificateThumbprint Read String The Certificate Thumbprint that an existing HTTPS WS-Man Listener is using.

Description

This resource is used to create, edit or remove WS-Management HTTP/HTTPS listeners.

SubjectFormat Parameter Notes

The subject format is used to determine how the certificate for the listener will be identified. It must be one of the following:

  • Both: Look for a certificate with a subject matching the computer FQDN. If one can't be found the flat computer name will be used. If neither can be found then the listener will not be created.
  • FQDN: Look for a certificate with a subject matching the computer FQDN only. If one can't be found then the listener will not be created.
  • ComputerName: Look for a certificate with a subject matching the computer FQDN only. If one can't be found then the listener will not be created.

Examples

Example 1

This will create or enable an HTTP WS-Man Listener on port 5985. configuration Sample_WSManListener_HTTP

Configuration Example
{
    param
    (
        [Parameter()]
        [System.String[]]
        $NodeName = 'localhost'
    )

    Import-DscResource -Module WSManDsc

    Node $NodeName
    {
        WSManListener HTTP
        {
            Transport = 'HTTP'
            Ensure    = 'Present'
        } # End of WSManListener Resource
    } # End of Node
} # End of Configuration

Example 2

Create an HTTPS Listener using a LocalMachine certificate that is installed and issued by 'CN=CONTOSO.COM Issuing CA, DC=CONTOSO, DC=COM' on port 5986.

Configuration Example
{
    param
    (
        [Parameter()]
        [System.String[]]
        $NodeName = 'localhost'
    )

    Import-DscResource -Module WSManDsc

    Node $NodeName
    {
        WSManListener HTTPS
        {
            Transport = 'HTTPS'
            Ensure    = 'Present'
            Issuer    = 'CN=CONTOSO.COM Issuing CA, DC=CONTOSO, DC=COM'
        } # End of WSManListener Resource
    } # End of Node
} # End of Configuration

Example 3

Create an HTTPS Listener using a LocalMachine certificate containing a DN matching 'O=Contoso Inc, S=Pennsylvania, C=US' that is installed and issued by 'CN=CONTOSO.COM Issuing CA, DC=CONTOSO, DC=COM' on port 5986.

Configuration Example
{
    param
    (
        [Parameter()]
        [System.String[]]
        $NodeName = 'localhost'
    )

    Import-DscResource -Module WSManDsc

    Node $NodeName
    {
        WSManListener HTTPS
        {
            Transport = 'HTTPS'
            Ensure    = 'Present'
            Issuer    = 'CN=CONTOSO.COM Issuing CA, DC=CONTOSO, DC=COM'
            DN        = 'O=Contoso Inc, S=Pennsylvania, C=US'
        } # End of WSManListener Resource
    } # End of Node
} # End of Configuration
Clone this wiki locally