Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to connect to a Windows 2012 server from Ubuntu.

winexe --user <USER> --password <SERVER> //SERVER cmd.exe 

works just fine.

However,

winexe --user <USER> --password <SERVER> //SERVER powershell.exe`

just hangs.

It displays:

Windows PowerShell
Copyright (C) 2012 Microsoft Corporation. All rights reserved.

but after that it just hangs and won't respond to keypresses.

Is there a parameter I need to pass to powershell to get it to run in interactive mode or anything?

EDIT

If I run the above command through strace, it seems to be waiting for the server to send something back.

epoll_wait(4, {}, 1, 10)                = 0
epoll_wait(4, {}, 1, 10)                = 0
epoll_wait(4, {}, 1, 10)                = 0
share|improve this question

3 Answers 3

Try

winexe --interactive=1 --user<USER> --password <SERVER> //SERVER powershell.exe

share|improve this answer
    
That doesn't seem to make any difference. –  javanix Jun 21 '13 at 17:58

The easiest way is to run the command directly using single quote. For example listing the processes can be done as follows:

winexe -U "Domain\PC-Name" //IP Address 'powershell.exe Get-Process'
share|improve this answer

Powershell seems a "Windows Gui Program", which tries to interact with the desktop. Obviously this is not possible, if connected from remote (maybe in Windows XP). To be interactive and connect the input of the powershell to stdin use "-Command -".

Which lets the powershell interact with stdin. You can type commands and see the output, but you do not get the prompt from powershell.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.