I have an issue with WINRM configuration. Once I changed HTTP port from 5985 to 5986 I cannot create new HTTPS record with the cerfificate as error said "File already exist" New-WSManInstance : Cannot create a file when that file already exists. At line:1 char:1
- New-WSManInstance winrm/config/Listener -SelectorSet @{Transport='HTT ...
-
CategoryInfo : InvalidOperation: (:) [New-WSManInstance], InvalidOperationException FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.NewWSManInstanceCommand
I tried to get quickconfig winrm, invoke it, but the problem is still this same
CodePudding user response:
Issue has been fixed. If you are struggling with issue like this, you have to create certificate, set up the HTTP listener to 5986 and then remove it. Then you can add the HTTPS listener without errors "File already exist". If you need both ports just run quickconfig for HTTP
CodePudding user response:
Whats the output of "winrm enumerate winrm/config/Listener" ?
Try deleting the listeners using "Remove-Item -Path WSMan:\localhost\Listener* -Recurse -Force" and then run https://github.com/ansible/ansible/blob/devel/examples/scripts/ConfigureRemotingForAnsible.ps1
Then you can choose to delete HTTP listener using "Get-ChildItem -Path WSMan:\localhost\Listener | Where-Object { $_.Keys -contains "Transport=HTTP" } | Remove-Item -Recurse -Force"