Reputation: 2208
I'm quite new to PowerShell and am trying to write a script that connects to our web server from our db server and pulls a file across. Unfortunately I'm hitting hurdles straight out of the gate with the following error when trying to use the Enter-PSSession cmdlet:
https://i.sstatic.net/Rkp00.jpg
I can confirm that PowerShell on the web server is set up and ready to receive connections:
https://i.sstatic.net/SW2LV.jpg
I am at a loss as to what to check now. Any help would be greatly appreciated.
EDIT: Just to confirm, I am able to RDP into the web server from the db server fine.
Upvotes: 1
Views: 2838
Reputation: 364
If you are not using domain joined Machines and domain user accounts you will need to add the destination server to your trusted hosts list
Set-Item WSMan:\LocalHost\Client\TrustedHosts\ -Value "192.168.100.234"
You should check if you have machines add first
Get-Item WSMan:\Localhost\Client\TrustedHosts
if you do you will need to append the new ipaddress or the pervious values will be overwritten.
You should also check the network profiles on both machines. Powershell remoting will not work with the network profile set to Public.
EDIT:
You need to run: Enable-PsRemoting not winrm qc to allow powershell remoting winrm is only half the puzzle.
Upvotes: 1
Reputation: 75
Hello. dont Have a reputation to post a comment, so read some info heare. If you have a domain you can try to do this: In the group policy mmc: Policies/Administrative Templates /Windows Components/Windows Remote Management (WinRM)/WinRM Service Allow Remote Server management through WinRM Set the Policy to Enabled. Set the IPv4 and IPv6 filters to *
Or you can try to do something like this:
On local host and remote PC
Set-ExecutionPolicy remotesigned -Scope CurrentUser -Force| Out-Null
winrm qc -q| Out-Null
Upvotes: 0