Windows Classroom Series – 09/Oct/2020

Enabling Powershell Remoting using Win-RM

  • In enterprise setups we have domain controlled and it is easier to configure the windows remoting.
  • In this session, since we are trying to communicate over public networks, we would be making some tweaks
  • Create a Windows Server (2016). Launch Powershell as an admin\
Set-ExecutionPolicy RemoteSigned
Winrm quickconfig -q
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="512"}'
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
  • Lets try to connect to winrm from Powershell on Client
$credential = Get-Credential qtdevops
Enter-PSSession -ComputerName <> -Credential $credential
  • The above command leads to error as we are communicated over public networks, if you try the same command b/w client & server connected in the same domain, you will not see this issue.
  • To resolve this. Enter gpedit.msc in the run command
  • Now Navigate to Local Computer Policy => Computer Configuration => Administrative Templates => Windows Components => Windows Remote Management (winrm) => WinRM Client
  • Enable Allow Basic Authentication & Allow unecrypted Traffic
  • Now open Trusted Hosts and add the computer name of the server to trusted hosts
  • Now Execute Enter-PSSession Cmdlet
  • Now since the powershell terminal is connected to the other remote server, administration & execution of commands can be done from Powershell Terminal.

Powershell Scripts

  • For the first powershell script Refer Here
  • Ensure your Execution Policy is not Restricted
Get-ExecutionPolicy

Next Steps:

  1. We need to refine our scripting capabilities
  2. Create functions
  3. Accept Parameters
  4. Should be able do some administrative tasks.
  5. Active Directory

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Plugin for Social Media by Acurax Wordpress Design Studio

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version
%%footer%%