Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Confusing Powershell behavior

Tags:

Am a bit confused w/ remote executing a powershell command. I have a test server (Win 2k8-R2-SP1) called ServerA, which has powershell remoting enabled correctly. From my dev machine (Win 2k8-R2-SP1), am able to remote execure powershell commands correctly. But, when I try to execute the same command from a different server called ServerB (Win 2k8-R2), I get the following error

[ServerA] Connecting to remote server failed with the following error message : The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting 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 configure the WinRM service: "winrm quickconfig". For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo : OpenError: (:) [], PSRemotingTransportException + FullyQualifiedErrorId : PSSessionStateBroken

All three machines are in the same domain. My confusion is that from my dev machine, I am perfectly able to connect to ServerA and execute the command.

Will the fact that ServerB does not have SP1, make a difference? Please advise. I am using the same domain account which has admin rights on all 3 servers.

And the command that I am trying is Invoke-Command -ComputerName ServerA -ScriptBlock {Get-UICulture}.

Please help.

Thanks

like image 441
Prasanna K Rao Avatar asked Sep 02 '11 14:09

Prasanna K Rao


People also ask

Is PowerShell good?

You can use PowerShell as a great way to replace all those little command line utilities you used to write. Think about this. PowerShell is a reasonably powerful script language that gives you access to most of the . NET Framework.

What's the difference between PowerShell and command prompt?

CMD is the command line for Microsoft Windows operating system, with command-based features. Powershell is a task-based command-line interface, specifically designed for system admins and is based on the . Net Framework.

What can PowerShell do?

The uses of PowerShell include adding and deleting accounts, editing groups, and creating listings to view specific types of users or groups. You can also choose to use the Windows PowerShell Integrated Scripting Environment (ISE), a graphic user interface that lets you run commands and create or test scripts.


1 Answers

Run winrm quickconfig or Enable-PSRemoting -force from ServerB.

Verify service is running with get-service winrm

http://technet.microsoft.com/en-us/magazine/ff700227.aspx

Also, run this from your local dev box:

Set-Item WSMan:\localhost\Client\TrustedHosts -Value "*" -Force 
like image 150
manojlds Avatar answered Sep 30 '22 18:09

manojlds