Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
tutorial:adm:configuration_-_winrm [2024/01/30 06:06] – erbenr | tutorial:adm:configuration_-_winrm [2024/11/21 09:04] (current) – [Check if Winrm is running] erbenr | ||
---|---|---|---|
Line 9: | Line 9: | ||
<code powershell> | <code powershell> | ||
Test-WSMan | Test-WSMan | ||
+ | |||
</ | </ | ||
Line 15: | Line 16: | ||
If you get some error then you need to do the [[https:// | If you get some error then you need to do the [[https:// | ||
+ | < | ||
+ | |||
+ | winrm quickconfig | ||
+ | |||
+ | </ | ||
Now execute the first command again and it should without error now. | Now execute the first command again and it should without error now. | ||
+ | |||
===== Show current configuration ===== | ===== Show current configuration ===== | ||
Line 92: | Line 99: | ||
<code powershell> | <code powershell> | ||
- | winrm set winrm/ | + | winrm set winrm/ |
- | {{.: | + | |
winrm set winrm/ | winrm set winrm/ | ||
Enable-WSManCredSSP -Role Server | Enable-WSManCredSSP -Role Server | ||
- | |||
</ | </ | ||
- | |||
===== Permission configuration ===== | ===== Permission configuration ===== | ||
Line 107: | Line 111: | ||
Assign user into group Set WMI access for group. | Assign user into group Set WMI access for group. | ||
- | * Computer Management → Services and Application → right click WMI Control → Properties * In new dialog window → tab Security → Root → CIMV2 and click button Security * Next dialog window will appear - you need to add group (WinRMRemoteWMIUsers\_\_ or Remote Management Users) here * You need to select these options in the checkboxes - Execute Methods, Enable Account and Remote Enable * Click on Advanced - select and edit group → Set " | + | |
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
{{.: | {{.: | ||
Line 118: | Line 127: | ||
</ | </ | ||
- | {{.: | + | {{.: |
+ | | ||
+ | | ||
<code powershell> | <code powershell> | ||
Line 214: | Line 225: | ||
</ | </ | ||
- | To turn the credentials delegation on. Open Group policy setting and navigate to Computer | + | To turn the credentials delegation on. Open Group policy setting and navigate to Computer |
The Allow Delegating Fresh Credentials (AllowFreshCredentials) policy setting must be enabled. If it's enabled validate if correct value (values) are added to this policy. The correct value is WSMAN/SPN of your server. For example | The Allow Delegating Fresh Credentials (AllowFreshCredentials) policy setting must be enabled. If it's enabled validate if correct value (values) are added to this policy. The correct value is WSMAN/SPN of your server. For example | ||
Line 312: | Line 323: | ||
Now we have certificate which is imported in our windows server and now we can configure the HTTP listener | Now we have certificate which is imported in our windows server and now we can configure the HTTP listener | ||
+ | Create and export self signed certificate with powershell: | ||
+ | <code powershell> | ||
+ | $pathToCertificate=" | ||
+ | $hostname=' | ||
+ | $params = @{ | ||
+ | Subject = " | ||
+ | DnsName = ' | ||
+ | CertStoreLocation = ' | ||
+ | KeyExportPolicy =' | ||
+ | KeySpec =' | ||
+ | KeyLength =' | ||
+ | KeyAlgorithm = ' | ||
+ | HashAlgorithm = ' | ||
+ | } | ||
+ | |||
+ | $cert = New-SelfSignedCertificate @params | ||
+ | Export-Certificate -Cert $cert -FilePath " | ||
+ | $mypwd = ConvertTo-SecureString -String " | ||
+ | Export-PfxCertificate -Cert $cert -FilePath " | ||
+ | </ | ||
+ | |||
+ | List certificate in windows certificate storage: | ||
+ | <code powershell> | ||
+ | Get-ChildItem -Path Cert: | ||
+ | </ | ||
+ | |||
+ | Configure WinRM listener with HTTPS certficate: | ||
<code powershell> | <code powershell> | ||
winrm create winrm/ | winrm create winrm/ | ||
for deleting | for deleting | ||
winrm delete winrm/ | winrm delete winrm/ | ||
+ | </ | ||
+ | Create firewall rule for WinRM HTTPS: | ||
+ | <code powershell> | ||
+ | New-NetFirewallRule -Displayname 'WinRM - Powershell remoting HTTPS-In' | ||
</ | </ | ||
Restart WinRM | Restart WinRM | ||
- | |||
<code powershell> | <code powershell> | ||
Restart-Service winrm | Restart-Service winrm | ||
- | |||
</ | </ | ||
Line 329: | Line 369: | ||
+ | ===== Powershell 7 support ===== | ||
+ | |||
+ | Install powershell 7: https:// | ||
+ | |||
+ | Run app '' | ||
+ | <code powershell> | ||
+ | Enable-PSRemoting | ||
+ | </ | ||