PsExec fails to open the stdin, stdout and stderr named pipes - named-pipes

I am using PsExec to access two servers from my laptop. Access to one of the servers (running Windows 2008R2 Enterprise) works fine. Access to the other (Windows 2008R2 Standard) fails with an error (message below). My laptop has Windows 8.1.
Literature
I've verified that my systems match the requirements, as specified here
Investigating an earlier access denied, I followed the steps outlined here
Commands
Steps taken:
net use \\<servername>\Admin$ /user:me * succeeds
dir \\<servername>\Admin$ lists the remote directory, as expected
PsExec.exe \\<servername> -e cmd is very slow, and then fails with the message:
Error establishing communication with PsExec service on <servername>:
The system cannot find the file specified.
To the best of my knowledge (though I'm no Windows expert), I am in the administrator group on both the client and server machine.
Analysis 1
After executing the command, psexesvc.exe is still running on the remote machine, so the command at least partially succeeds
Before each invocation, I stop and delete the psexesvc service, and remove the executable manually
Analysis 2
I used wireshark to observe the communication between client and server. The following seems to happen:
File PSEXESVC.EXE gets successfully created and written
A "Bind" and a "Map" of SVCCTL
Delay of about 20 seconds (?)
Several SVCCTL calls (presumably resulting in the PSEXESVC service being created and started)
Named pipe PSEXESVC is opened and successfully written to
Named pipes for stdin, stdout and stderr cannot be found (STATUS_OBJECT_NAME_NOT_FOUND)
Trying to eliminate a permissions problem, I tried to verify that the named pipes actually don't exist, by running pipelist.exe (found here) on the server side. I did not actually see the pipes, but if they existed only for a very short time, I might not have run pipelist.exe frequently enough.
Version numbers
PsExec version 2.11

Related

PsExec connects using system name but not ipAddress

I need to use my local computer to simulate a test stand which will be on a domain and access a remote computer which is on a workgroup using PsExec. The testing computer is built from an imaging tool. The IP will be the same every time but the name isn't. The process I'm working with was used on an embedded XP system and is now being upgraded to WIN10. I've added network security using GPO and have found workarounds to be able to open the connection but for some reason just trying to run cmd on the remote machine does not work when using the IP, only the name. Using the IP returns the "access is denied" error. I have already added the token filter key to the registry. Has anyone heard of something like this before?
I have a script I'm trying to run but in the meantime I'm just trying to get
psexec \IP_ADDERESS -h -u USER_NAME(this is an admin) -p PASSWORD cmd
edit: I have to keep my computer on a domain but I have a spare that I was able to put on a workgroup with the test system. Running psexec went perfect. It makes no sense why it works for the name and not ip on a domain->workgroup connection and works exactly how I need it to on a workgroup->workgroup connection.

How an output of Windows application executed on remote SSH server gets to a local SSH client

I'm using PuTTY to connect to an SSH server running on Windoes 7.
When I issue powershell in PuTTY terminal does it mean that the powershell command window opens on the remote machine?
If so how does the output from remotely running powershell window gets routed to PuTTY client?
Sorry if this is lame question but it's not so obvious to me.
While the PowerShell is executed on the remote machine, no window opens on the server.
powershell.exe is a console application. Console applications have a standard IO (input and output). If you run a Windows console application locally, Windows GUI creates a console window and binds the application IO to the window. While if you run a console application via an SSH server, the SSH server binds the application IO to the SSH shell session. So anything that the PowerShell prints, gets routed to the SSH shell session output, which ultimately renders in your local SSH client window (PuTTY).
In other words, a local PowerShell window is rendered by Windows GUI (the system that executes the PowerShell), not by the PowerShell process itself (contrary to windows of GUI applications). Another system, like the SSH server, can choose a completely different "rendering" of the IO, like routing the IO to the SSH shell session.
It's the same process like, if you use ls command on a *nix server. The ls is also a console application. (Afaik, all *nix applications are actually console applications, what is not true on Windows.)

Execute remote PowerShell script from VSOnline fails - Access Denied

I am facing a very strange issue trying to run a Remote PowerShell script from the new build system of Visual Studio Online.
Context:
I have a Build server that I host on my own VM. I have also created a second VM where I want the PowerShell script to be run on.
When I run a build from the Build server, I want to create a task that run a PowerShell script on a remote machine. Sounds easy.
Both machines have everything configured to run the Remote PowerShell. (I think)
Problem:
If I manually run the script from the build server, the script is properly executed on my remote machine.
But, if I run the script by starting a new build, it doesn't work, I always get an error message
New-PSSession : [xxx.cloudapp.net] Connecting to remote server xxx.cloudapp.net failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.
Have you faced this issue before with VSOnline?
This can happen if there isn't a trust relationship between the remote machine and the build machine. E.g. you could look at the hosts.equiv file on the remote machine and make sure it trusts the build machine.
If that doesn't help then more info might be needed, like how you're trying to sign in, what build agent account you're running as.
Guy

How to uninstall a service on remote machine using powershell?

I am a newbie in powershell script. I want to uninstall a service on remote machine and re-install it again. I am able to stop the service, change the files that service is using and again start it.
But, now I want to completely uninstall it.
One more thing, I will be executing these scripts via TeamCity.
I have tried following ways, but each one is giving trouble:
using wmi class
running installutil command on remote machine. But, cant execute this on remote machine since there is problem in accessing that service.
Using Get-WmiObject command and then calling delete() on retrieved service.
Is there any promising solution ??
Any help will be appreciable..
After playing a lot with TC and many commands, finally I got my answer to uninstall a service on remote computer, and its working properly.
I have made use of "wmic" command and provided the remote computer name, username and password for /node:, /username:, and /password: parameters. And, provided 'installutil.exe' command to be executed remotely. Here, the actual command is..
"wmic /NODE:$serverName /USER:$userName /PASSWORD:$password process call create '$path_to_installutil_exe\installutil /u $exe_location_path_of_service'"

Problems using teamcity command line to perform ssh remote login

I was wondering if anyone has tried using teamcity's command line builder to perform ssh remote login.
Right now, I would like to automate some testing on a QNX neutrino OS which is currently unsupported by teamcity. As a work around, I setup a ssh server on the target qnx machine so i could ssh and sftp the executables in.
Firstly, the source are compiled on Windows XP using qnx's compiler (based on g++). Followed by sftp-ing the executables into qnx neutrino.
Next, using ssh, script the login to remotely start the test apps and send the results back to the remote agent for publishing.
The batch script I created works well standalone, however, after hooking it up on the remote agent, it fails to login ssh and hangs indefinitely at the following command:
ssh -l "./.sh"
Notes:
I have added the remote agent's RSA public key in the QNX .ssh/authorized keys file, automatic login is working.
Is there a need to add the teamcity server's RSA public key in too?
Anyone has any idea on this problem?
I had a few weird problems with key-based SSH logins on QNX related to file permissions for the keys in .ssh. and permissions of parent folders (/home/username and /root).
Add
LogLevel DEBUG3
to /etc/openssh/sshd_config, make sure syslog is configured and is logging sshd output, restart sshd and try again - it will most likely complain about something.
Also, ssh -l "./.sh" makes no sense - -l is used to specify the user name, something is off there.