I want to use winrm remote vm, I can connect to the localhost, but I can't connect to the other remote machine, the error is "access is denied".
Please help me.
Description. The Exit-PSSession cmdlet ends interactive sessions that you started by using the Enter-PSSession cmdlet. You can also use the exit keyword to end an interactive session. The effect is the same as using Exit-PSSession .
To use the PSSession to interact directly with a remote computer, use the Enter-PSSession cmdlet. For more information, see about_PSSessions. You can run commands on a remote computer without creating a PSSession with the ComputerName parameters of Enter-PSSession or Invoke-Command .
The Enter-PSSession cmdlet starts an interactive session with a single remote computer. During the session, the commands that you type run on the remote computer, just as if you were typing directly on the remote computer. You can have only one interactive session at a time.
If you use the ComputerName parameter of the Invoke-Command or Enter-PSSession cmdlet to run a remote command or to start an interactive session, PowerShell creates a temporary session on the remote computer and closes the session as soon as the command is complete or as soon as the interactive session ends.
You need to provide -Credential
parameter:
Enter-PSSession –ComputerName Server –Credential Domain\UserName
So I was having the EXACT same issue as this user and found the issue. Basically I was running the commands as my Domain Admin account but the servers are locked down to not accept network connections from Domain Admin accounts in Group Policy as a security measure. Once changing the command credentials to run as my non domain admin account and an account allowed network access with administrative permissions the enter-pssession command worked perfectly. What I don't understand is why the test-wsman command appears to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With