Enable support for WinRM over HTTPS - #623
Open
Adam Rudell (arudell) with Copilot wants to merge 2 commits into
Open
Enable support for WinRM over HTTPS#623Adam Rudell (arudell) with Copilot wants to merge 2 commits into
Adam Rudell (arudell) with Copilot wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: arudell <18577812+arudell@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Enable support for WinRM over HTTPS
Enable support for WinRM over HTTPS
Aug 13, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (5)
src/modules/SdnDiag.Utilities.psm1:2093
- HTTPS authenticates the server certificate, but it does not make Kerberos support an IP-address target. WinRM connections addressed by IP still require explicit credentials; otherwise this branch proceeds with default credentials and the session fails authentication. Keep the credential requirement independent of
UseSSL.
if ($isIpAddress -and -NOT $UseSSL -and $Credential -eq [System.Management.Automation.PSCredential]::Empty) {
src/modules/SdnDiag.Utilities.psm1:1954
- An existing
SdnDiag-*session is reused solely by computer name, so a prior HTTP/5985 session can be returned even when this new option requests HTTPS or a different port. That makes transport changes ineffective until sessions are manually removed or-Forceis used. Match reusable sessions on the requested URI scheme and port (or create a new session when either differs).
[Parameter(Mandatory = $false)]
[Switch]$UseSSL,
[Parameter(Mandatory = $false)]
[System.Int32]$Port
src/SdnDiagnostics.psm1:955
ForEach-Object -Parallelinvokes this mutation concurrently, butArrayListis not thread-safe. Simultaneous failures can race while adding entries, potentially omitting unreachable nodes or corrupting the collection. Use a thread-safe collection for the shared results.
[void]($using:nodesToRemove).Add($_)
src/SdnDiagnostics.psm1:770
- The exported cmdlet adds
UseSSLandPort, but its comment-based help does not include.PARAMETERentries for either option. Add descriptions covering HTTPS selection, automatic ports, and the custom-port override soGet-Help Start-SdnDataCollection -Fulldocuments the new public API.
[Switch]$UseSSL,
[Parameter(Mandatory = $false, ParameterSetName = 'Role')]
[Parameter(Mandatory = $false, ParameterSetName = 'Computer')]
[System.Int32]$Port
src/SdnDiagnostics.psm1:790
- The exported
Start-SdnDataCollectionpath now mutates module-wide transport settings and selects the preflight port, but the added tests only exerciseNew-PSRemotingSession. Please add offline Pester coverage verifying that-UseSSL/-Portupdate the configuration and that the preflight uses 5986 or the explicit port.
if ($PSBoundParameters.ContainsKey('UseSSL')) {
$Global:SdnDiagnostics.Config.UseSSL = $UseSSL.IsPresent
}
if ($PSBoundParameters.ContainsKey('Port')) {
Adam Rudell (arudell)
marked this pull request as ready for review
August 13, 2026 15:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CIS-hardened environments disable WinRM over HTTP (port 5985), breaking all PSRemoting-based diagnostics. This adds first-class
-UseSSLand-Portsupport throughout the PSRemoting call chain so diagnostics work with HTTPS (port 5986).Description
Summary of changes:
New-PSRemotingSession: Added-UseSSLswitch and-Portparameter. Defaults to port 5986 when SSL is enabled, 5985 otherwise. Falls back to$Global:SdnDiagnostics.Config.UseSSL/Portwhen not explicitly provided, allowing module-wide configuration without per-call parameter threading. Skips WinRM TrustedHosts management for IP addresses when using SSL (certificate validates identity). MadeNew-PSSessionOptionplatform-aware to allow Linux test compatibility.Invoke-PSRemoteCommand,Copy-FileFromRemoteComputerWinRM,Copy-FileToRemoteComputerWinRM,Copy-FileFromRemoteComputer,Copy-FileToRemoteComputer: Added-UseSSLand-Portparameters propagated toNew-PSRemotingSession.$Global:SdnDiagnostics.Config: AddedUseSSL = $falseandPort = 0defaults for module-wide transport configuration.Start-SdnDataCollection: Added-UseSSLand-Portparameters; sets global config so all downstream calls inherit the transport settings. Fixed the WinRM pre-flight connectivity check (was hardcoded to 5985) to derive port from global config.Change type
Checklist: