To connect to remote server you need to start specific service named winrm (Windows Remote Management) on both computer (client/server). winrm
is also a commande line used to configure the winrm service. Windows Remote Management is base on specific protocol named WS-MAN (WS-Management protocol).
Created
September 26, 2020 15:31
-
-
Save CallMarl/fa2fae81bcb687301790332d86821279 to your computer and use it in GitHub Desktop.
Remote Connexion to windows server
This file contains 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
# Start winrm with powershell (client side and server side) | |
Enable-PSRemoting | |
# By default powershell load PSDrive for winrm service. | |
# Set trusted host on (server side) | |
Set-Item WSMan:\localhost\Client\TrustedHosts -Value 192.168.1.* | |
# Get trusted host | |
Get-Item WSMan:\localhost\Client\TrustedHosts | |
# Restart Service Winrm (server side) | |
Restart-Service WinRM | |
# Test config (client side) | |
Test-WSMan SRV-CALLMARL | |
# Connect to remote serveur (client side) | |
Enter-PSSession -ComputerName SRV-CALLMARL -Credential SRV-CALLMARL\CallMarl | |
# Stop service | |
Disable-PSRemoting |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment