0
votes

I have server (with Microsoft Windows Server 2003 R2 SE; manually installed WinRM) when I can enter remote session by simply typing:

Enter-PSSession *computername_here*

or (outside remote session) invoke remote command:

Get-Process -ComputerName *computername_here*

Unfortunately on another (with Microsoft Windows Server 2008 R2 SE) it doesn't work (although I use the same configuration). I need to enter (according to first example):

Enter-PSSession IP address -Credential "domain\username"

and after it give username and password. I'm aware that it's possible to save credentials to external file, but I wan't to do something to connect to remote server as simply as in case of first server? Should I check firewall or configure in special way my server?

==================================================================

Thank you for answer. I'm talking about "Microsoft Windows Server 2008 R2 Standard" OS
(as "*gwmi win32_operatingsystem |select name*" command told me).

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

contain property TrustedHosts set to *, so I assume that it's correct.

It's interesintg that although I have administrator rights on both machines, I get an error message when I try to check what "localhost" contains not directly from the server, but from my local computer:

PS WSMan:\localhost> ls
Access is denied. + CategoryInfo : + FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.PowerShell.Commands.GetChildItemCommand

2

2 Answers

0
votes

Something to check is if your current user has permissions to target server, is server in the same domain as client?

Could you also clarify what servers are you using? AFAIK Microsoft Windows Server 2008 R2 SE doesn't exist. Is it 2008 or 2003?

It might be something to do with the TrustedHosts or Authentication setting of a client. You can set it like this: WinRM set winrm/config/client @{TrustedHosts="*"} Read more about this here: http://blogs.dirteam.com/blogs/sanderberkouwer/archive/2008/02/23/remotely-managing-your-server-core-using-winrm-and-winrs.aspx

0
votes

I know this is years later, but will this help?

#this is TEST computer IP
# $computer = "xxx.xxx.xxx.xxx"

# if(test-wsman $computer -ErrorAction SilentlyContinue){
    # Remoting is enabled, continue
    # Write-Host "remoting is enabled"
# } else {
    # Something is wrong. 
    # throw "remoting is not enabled"
# }