Difference between revisions of "Winrm"
Jump to navigation
Jump to search
(Created page with "https://www.codetwo.com/kb/troubleshooting-remote-powershell-connections/") |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
https://www.codetwo.com/kb/troubleshooting-remote-powershell-connections/ | https://www.codetwo.com/kb/troubleshooting-remote-powershell-connections/ | ||
+ | |||
+ | https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/enable-psremoting | ||
+ | ``` | ||
+ | Enable-PSRemoting -Force | ||
+ | winrm quickconfig | ||
+ | ``` | ||
+ | |||
+ | Enter-PsSession via ip address and https | ||
+ | ``` | ||
+ | $ipaddr = "10.x.x.y" | ||
+ | ``` | ||
+ | |||
+ | As admin | ||
+ | ``` | ||
+ | Set-Item WSMan:localhost\client\trustedhosts -value $ipaddr | ||
+ | |||
+ | Clear-Item WSMan:localhost\client\trustedhosts | ||
+ | ``` | ||
+ | |||
+ | ``` | ||
+ | Test-NetConnection $ipaddr -Port 5986 | ||
+ | $sessionOption = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck | ||
+ | $cred = get-credential | ||
+ | enter-pssession -ConnectionUri https://$ipaddr:5986/WSMAN -SessionOption $sessionOption -cred $cred | ||
+ | ``` | ||
+ | |||
+ | or | ||
+ | ``` | ||
+ | $UserCredential = Get-Credential | ||
+ | $sessionOption = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck | ||
+ | $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<FQDN of Exchange 2016 Mailbox server>/PowerShell/ -Authentication Kerberos -Credential $UserCredential -SessionOption $sessionOption | ||
+ | Import-PSSession $Session | ||
+ | ``` | ||
+ | https://social.technet.microsoft.com/Forums/en-US/e1aac407-33a1-4d19-988f-8b954d8b5007/not-able-to-remote-connect-to-powershell?forum=Exch2016PS | ||
+ | ``` |
Latest revision as of 01:02, 20 January 2022
https://www.codetwo.com/kb/troubleshooting-remote-powershell-connections/
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/enable-psremoting
Enable-PSRemoting -Force winrm quickconfig
Enter-PsSession via ip address and https
$ipaddr = "10.x.x.y"
As admin
Set-Item WSMan:localhost\client\trustedhosts -value $ipaddr Clear-Item WSMan:localhost\client\trustedhosts
Test-NetConnection $ipaddr -Port 5986 $sessionOption = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck $cred = get-credential enter-pssession -ConnectionUri https://$ipaddr:5986/WSMAN -SessionOption $sessionOption -cred $cred
or
$UserCredential = Get-Credential $sessionOption = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<FQDN of Exchange 2016 Mailbox server>/PowerShell/ -Authentication Kerberos -Credential $UserCredential -SessionOption $sessionOption Import-PSSession $Session