Configuration Manager Configuration Item to detect presence of WinRM https listener

Bojan Zivkovic 526 Reputation points
2025-02-21T14:01:09.78+00:00

Hi, I want to deploy Configuration Baseline containing the Configuration Item that should report servers with WinRM https listener as compliant hence I tried with script which works fine in PowerShell:

if(Get-WSManInstance -ResourceURI winrm/config/listener -SelectorSet @{Address="*";Transport="HTTPS"})

{return $true}

else

{return $false}

However, this code inside CI does not work properly and systems without WinRM https listener are reported not as non-compliant but with error. Why is this happening?

Microsoft Configuration Manager Deployment
Microsoft Configuration Manager Deployment
Microsoft Configuration Manager: An integrated solution for for managing large groups of personal computers and servers.Deployment: The process of delivering, assembling, and maintaining a particular version of a software system at a site.
1,045 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Bojan Zivkovic 526 Reputation points
    2025-02-22T16:27:25.19+00:00

    Well, this works much better.

    if(Test-Path -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WSMAN\Listener*+HTTPS)

    {return $true}

    else

    {return $false}

    0 comments No comments

  2. AllenLiu-MSFT 48,356 Reputation points Microsoft Vendor
    2025-02-24T01:49:58.1666667+00:00

    Hi, @Bojan Zivkovic

    Thank you for posting in Microsoft Q&A forum and thanks for the update.

    We are glad that you found an accurate way to config the Configuration Item.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.