Auteur de questions
Enable PowerShell Remoting problem

Question
-
Hi!
I installed Evaluation version of Windows 2016 and 2019 Standard. I trying configure PS Remoting and I have problem with it.
System is clear, I installed system and join to domain only.
After Enable-PSRemoting command I don't have any errors etc.When I use winrm command:
PS C:\Windows\system32> winrm quickconfig
WinRM service is already running on this machine.
WinRM is already set up for remote management on this computer.Firewall is off for all profiles.
For example bellow command:
PS C:\Windows\system32> Enter-PSSession -ComputerName localhost
Enter-PSSession : Connecting to remote server localhost failed with the following error message : The client cannot con
nect to the destination specified in the request. Verify that the service on the destination is running and is acceptin
g requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly
IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and conf
igure the WinRM service: "winrm quickconfig". For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ Enter-PSSession -ComputerName localhost
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (localhost:String) [Enter-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : CreateRemoteRunspaceFailedWhat I doing wrong?
Thanks for help!
Br,
Paweł
- Modifié Paweł Rożek samedi 20 avril 2019 17:31
Toutes les réponses
-
Hello,
After enabling PS Remoting you need to add trusted hosts in your devices. Please run the following command in order to solve your problem.
Set-Item WSMAN:\Localhost\Client\TrustedHosts -Value x.x.x.x -Force
Mark it as answer if your question has solved. MCT Regional Lead. x2 MCSE-MCSA Exchange Server & Windows Server
-
Hi Hamid,
thanks for answer.
I tried use this command with a few diferent ip address and i have this same problem. For example after use this command:
Set-Item WSMAN:\Localhost\Client\TrustedHosts -Value 0.0.0.0/0 -Force
i have error:
PS C:\Windows\system32> Set-Item WSMAN:\Localhost\Client\TrustedHosts -Value 0.0.0.0/0 -Force
PS C:\Windows\system32> get-Item WSMAN:\Localhost\Client\TrustedHosts
WSManConfig: Microsoft.WSMan.Management\WSMan::localhost\Client
Type Name SourceOfValue Value
---- ---- ------------- -----
System.String TrustedHosts 0.0.0.0/0
PS C:\Windows\system32> Enter-PSSession -ComputerName localhost
Enter-PSSession : Connecting to remote server localhost failed with the following error message : The client cannot con
nect to the destination specified in the request. Verify that the service on the destination is running and is acceptin
g requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly
IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and conf
igure the WinRM service: "winrm quickconfig". For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ Enter-PSSession -ComputerName localhost
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (localhost:String) [Enter-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : CreateRemoteRunspaceFailedBr,
Pawel
- Modifié Paweł Rożek samedi 20 avril 2019 23:20
-
-
Hi,
check your SPN records ( setspn -Q */*computername*
Check if u have port 5985 accessible.
$ipaddress = IP_Address_Server
$port = port
$connection = New-Object System.Net.Sockets.TcpClient($ipaddress, $port)
if ($connection.Connected) {
Write-Host "Success"
}
else {
Write-Host "Failed"
}
Also, read help file help about_remote_Troubleshooting- Modifié Mekac mardi 23 avril 2019 09:16
-
Hi,
Thanks for answers.
MotoX80,
yes of course Powershell works with admin previlages.
Makec,
PS C:\Windows\system32> setspn -Q app03
Checking domain DC=***,DC=net
setspn : Invalid SPN app03
At line:1 char:1
+ setspn -Q app03
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Invalid SPN app03:String) [], Rem
oteException
+ FullyQualifiedErrorId : NativeCommandErrorAne when i used New-Object commnad
PS C:\Windows\system32> New-Object System.Net.Sockets.TcpClient(10.10.10.35,5985)
New-Object : Exception calling ".ctor" with "2" argument(s): "No connection cou
ld be made because the target machine actively refused it 10.10.10.35:5985"
At line:1 char:1BUT, it is important.
I used telnet service to check 5985 port and it is closed. :( So probably I have problem with it.
all profiles of firewall is turn off and I add inbound rule this firewall for 5985 port and any address.
And of course WinRM service is running.
Any sugesstion? :)
Br,
Paweł
-
yes of course Powershell works with admin previlages.
I only have Win10 Pro to test with so I apologize if this does not apply to the versions that you are testing.
Your command "Enter-PSSession -ComputerName localhost" is remoting into the machine that you are already logged on to. That's not real remoting. Have you tried connecting from a second machine using the first computer's name?
When I tried it on my test VM, I got an access denied when running as a standard user, but it worked when I ran it from an admin Powershell prompt.
I wasn't sure why you wanted to test "localhost", so I just wanted to point that out.
-
First, use the command I provided for checking SPN records (with asterisks)
Turn all your profiles ON. I hope
Run again (via elevated PS session)
- Enable-PSRemoting -force
- winrm quickconfig
Test the port 5985 again. Fix the port issue first. It is default port for PSRemoting (I don't expect u reconfigured it to another port)
Is the W2016 machine part of the domain, or the workgroup?
Greetz to Poland, my friend.
-
Hi all,
I found my stiupid problem. Long time ago I set 10.10.10.0/24 value for IPV4Filter. And it was wrong. Should be 10.10.10.1-10.10.10.254, or * and this value was propagate via GPO. I changed this and everything was start works.
Thanks for all help and also the best for you Makec :)
Br,
Paweł
- Proposé comme réponse LeeSeenLiMicrosoft contingent staff, Moderator jeudi 25 avril 2019 08:40
-
Hi,
Was your issue resolved?
If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.
If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.
If no, please reply and tell us the current situation in order to provide further help.
Best Regards,
LeeJust do it.