You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updates the examples used to create a HTTP or HTTPS WinRM listener to be
compatible with both Windows PowerShell 5.1 and PowerShell 7.x. The
`New-WSManInstance` only worked for WinPS and not for PS 7.x.
(cherry picked from commit 3ecd3e5)
Copy file name to clipboardExpand all lines: docs/docsite/rst/os_guide/windows_winrm.rst
+23-31Lines changed: 23 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,17 +90,15 @@ To also add a HTTPS listener with a self signed certificate we can run the follo
90
90
91
91
# Create HTTPS listener
92
92
$httpsParams=@{
93
-
ResourceURI='winrm/config/listener'
94
-
SelectorSet=@{
95
-
Transport="HTTPS"
96
-
Address="*"
97
-
}
98
-
ValueSet=@{
99
-
CertificateThumbprint=$cert.Thumbprint
100
-
Enabled=$true
101
-
}
93
+
Path='WSMan:\localhost\Listener'
94
+
Address='*'
95
+
CertificateThumbprint=$cert.Thumbprint
96
+
Enabled=$true
97
+
Port=5986
98
+
Transport='HTTPS'
99
+
Force=$true
102
100
}
103
-
New-WSManInstance@httpsParams
101
+
New-Item@httpsParams
104
102
105
103
# Opens port 5986 for all profiles
106
104
$firewallParams=@{
@@ -175,35 +173,29 @@ Creating a HTTP listener can be done through the ``Enable-PSRemoting`` cmdlet bu
175
173
.. code-block:: powershell
176
174
177
175
$listenerParams=@{
178
-
ResourceURI='winrm/config/listener'
179
-
SelectorSet=@{
180
-
Transport="HTTP"
181
-
Address="*"
182
-
}
183
-
ValueSet=@{
184
-
Enabled=$true
185
-
Port=5985
186
-
}
176
+
Path='WSMan:\localhost\Listener'
177
+
Address='*'
178
+
Enabled=$true
179
+
Port=5985
180
+
Transport='HTTP'
181
+
Force=$true
187
182
}
188
-
New-WSManInstance@listenerParams
183
+
New-Item@listenerParams
189
184
190
185
Creating a HTTPS listener is similar but the ``Port`` is now ``5986`` and the ``CertificateThumbprint`` value must be set. The certificate can either be a self signed certificate or a certificate from a certificate authority. How to generate a certificate is outside the scope of this section.
0 commit comments