1. Run a PowerShell console running as administrator enable PowerShell Remoting.
Enable-PSRemoting –force

2. Make sure the WinRM service is setup to start automatically.

# Sets start mode to automatic
Set-Service WinRM -StartMode Automatic
# Verify start mode and state - it should be running
Get-WmiObject -Class win32_service | Where-Object {$_.name -like "WinRM"}

3. Set all remote hosts to trusted. Note: You may want to unset this later.

# Trust all hosts
 as * or specify the required host ONLY. 
Set-Item WSMan:localhost\client\trustedhosts -value *
# Verify trusted hosts configuration
Get-Item WSMan:\localhost\Client\TrustedHosts

Executing Remote Commands with PowerShell Remoting

Executing a Single Command on a Remote System

The “Invoke-Command” command can be used to run commands on remote systems. Examples.

Invoke-Command –ComputerName TechGeniusServer  -ScriptBlock {Hostname}
Invoke-Command –ComputerName TechGeniusServer  -Credential demo\serveradmin -ScriptBlock {Hostname}