remote-accesswindows-server-2016psexec

PsExec - The file cannot be accessed by the system


I'm trying to execute a .bat File on a Server in a local network with psexec

I'm currently trying with this command:

.\PsExec.exe -i -u Administrator \\192.168.4.36 -s -d cmd.exe -c "Z:\NX_SystemSetup\test.bat"

The server has no password (it has no internet connection and is running a clean install of Windows Server 2016), so I'm currently not entering one, and when a password is asked I simply press enter, which seems to work. Also, the .bat File currently only opens notepad on execution.

When I enter this command, I get the message "The file cannot be acessed by the system"

I've tried executing it with powershell with administrator privileges (and also without, since I saw another user on Stackoverflow mention that it only worked for them that way) but to no success.

I'm guessing this is a privilege problem, since it "can't be accessed", which would indicate to me that the file was indeed found.

I used net share in a cmd and it says that C:\ on my server is shared. The file I'm trying to copy is also not in any kind of restricted folder.

Any ideas what else I could try?

EDIT: I have done a lot more troubleshooting.

This is honestly maddening. There is no known documentation of this error on the internet. Searching explicitly for "File cannot be accessed" still only brings up results for "File cannot be found" and similar.

I'm surely just missing something obvious. Right?

EDIT 2

I also tried adding the domain name in front of the username. I checked the domain by using set user in cmd on the server.

.\PsExec.exe \\192.168.4.16 -u DomainName\Administrator -p ~ -c "C:\Users\UserName\Documents\Mellanox Update.bat"

-p ~

seems to work for the password, so I added that.

I also tried creating a shortcut of the .bat File, and executing it as Administrator, using it instead of the original .bat File. The error stays the same "The File cannot be accessed by the system"

As additional info, the PC I'm trying to send the command from has Windows 10, the Server is running Windows Server 2016


Solution

  • So, the reason for this specific error is as simple and as stupid as it gets.

    Turns out I was using the wrong IP. The IP I was using is an IPMI Address, which does not allow for any traffic (other than IPMI related stuff)

    I have not yet gotten it to work yet, since I've run into some different errors, but the original question/problem has been resolved.