Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

Bypass the Domain Wall: How to Enable PSRemoting WinRM in a Workgroup Environment

This is very simple and easy instructions to configure PowerShell PSRemoting WinRM on Windows system which is not joined into domain (Basically they are in workgroup). On the the first system login and and open PowerShell as administrator and Run below commands to configure PowerShell Remoting. 

Note: On all the systems make sure all are connected and reachable to each other. You can use ping for basic connection testing. Also below commands by default open required ports 5985/5986 Windows Remote Management (WinRM) service for HTTP/HTTPS in firewall over TCP communication. You can also check firewall incase of troubleshooting.

PS vm01 > Enable-PSRemoting -Force
PS vm01 > Set-Item WSMan:\localhost\Client\TrustedHosts * -Force
PS vm01 > Get-Item WSMan:\localhost\Client\TrustedHosts

   WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Client

Type             Name            SourceOfValue    Value
----             ----            -------------    -----
System.String    TrustedHosts                     *

PS vm01 > ipconfig

Screenshot showing PowerShell commands: Enable-PSRemoting -Force, Set-Item WSMan:\localhost\Client\TrustedHosts * -Force, and Get-Item WSMan:\localhost\Client\TrustedHosts to configure WinRM for non-domain workgroup computers.

Next from another system try connecting to above first system using Enter-PSSession but it might end up in Error. To fix this on both server and client systems you will need to enable PowerShell remoting and add * (star) to Trusted Hosts in WSMan psdrive. Which will allow any system to connect via PSRemoting. 

Once PowerShell remoting is configured on both systems try Enter-PSSession in the remote system. It will be successful this time.

Part 1: Bypass the Domain Wall: How to Enable PSRemoting WinRM in a Workgroup Environment
Part 2: PowerShell Remoting Access is Denied: How to Fix PSRemoting for Administrators Group Accounts
Part 3: PowerShell PSRemoting Fix: Bypassing "Access is Denied" for Privileged Admin Commands

Note: To make WinRM connection more secure, instead of adding * (star) to trusted hosts you can use specific system hostnames or IP addresses.

PS vm02 > Enter-PSSession -ComputerName 10.0.0.4 -Credential azureadmin
Enter-PSSession: Connecting to remote server 10.0.0.4 failed with the following error message :  The WinRM client 
cannot process the request. If the authentication scheme is different from Kerberos, or if the client computer is not
joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts
configuration setting. use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not
be authenticated. You can get more information about that by running the following command: winrm help config. For
more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ Enter-PSSession -ComputerName 10.0.0.4 -Credential azureadmin
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (10.0.0.4:String) [Enter-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : CreateRemoteRunspaceFailed

PS vm02 > Enable-PSRemoting -Force
PS vm02 > Set-Item WSMan:\localhost\Client\TrustedHosts * -Force
PS vm02 > Enter-PSSession -ComputerName 10.0.0.4 -Credential azureadmin
[10.0.0.4]: PS C:\Users\azureadmin\Documents> exit
PS vm02 > ipconfig

PowerShell Remoting connection failure (Kerberos error) followed by the fix using Enable-PSRemoting -Force and Set-Item WSMan:\localhost\Client\TrustedHosts * -Force, resulting in a successful Enter-PSSession.

Useful Articles
Installing, importing and using any module in powershell
Microsoft PowerShell: Check Windows license activation status
Find next available free drive letter using PowerShell
Copy Files with PowerShell Remoting WINRM Protocol
Powershell Find application window state minimized or maximized
How to Install and Use Microsoft PowerShell on Linux
Configure PowerShell remoting between Windows and Linux
Get-PSRepository WARNING Unable to find module repositories
Invoke-WebRequest : The underlying connection was closed: An unexpected error occurred on a send
Creating an internal PowerShell module repository
How to sign PowerShell ps1 scripts
PowerShell Convert MAC address to Link-local address IPv6
PowerShell fix repair The trust relationship between this workstation and the primary domain failed
Resovled issue with PowerShell - Trust relationship Rejoin computers in domain without restart
POWERSHELL PS REMOTING BETWEEN STANDALONE WORKGROUP COMPUTERS  
POWERSHELL DSC XACTIVEDIRECTORY ERROR - A NETBIOS DOMAIN NAME MUST BE SPECIFIED 
DSC (DESIRED STATE CONFIGURATION) : DEPLOYING ACTIVE DIRECTORY 
THE POWERSHELL XACTIVEDIRECTORY PROVIDER DOES NOT EXIST AT THE POWERSHELL MODULE PATH NOR IS IT REGISTERED AS A WMI PROVIDER
PowerShell remoting over HTTPS using self-signed SSL certificate
Configure Powershell WinRM to use OpenSSL generated Self-Signed certificate

 

Go Back

Comment

Blog Search

Page Views

13869636

Archive

Follow me on Blogarama