psexec error code -1073740771 - remote-access

I'm trying to open up a Unity3D game.exe that is on a remote computer through my main desktop. I had tried to do this through a batch file, but was advised to try PsExec in its place.
So far, I've brought the Psexec program into my game.exe folder. I run the command line required to open the program and the window opens up for a fraction of a second before closing down due to an error. The error code it gives is: -1073740771.
I tried googling what this error actually is but I can't find anything. Does anyone know what this error relates to?
The command line I type is as follows:
psexec \\OtherComputer -i C:\Administrator\Users\Desktop\TargetFolder\Target.exe
I even tried the above line with -d after the -i, quotes around the C:... but it all results in the same thing.

PSExec wont know about other game resources that live without side the EXE. It will simply copy game.exe to the remote machine and execute it.
Try deleting or renaming the resource folder and running it on your local machine - it should do the same thing as its doing on the remote machine.
You cant do what you want with psexec unless the entire application is self contained within one single .exe file.
You may be able to manually copy the resource folders if you have admin access to the other machines and administrative shares are enabled, then execute with psexec using the -w option:
Copy the files to \\OtherComputer\C$\MyGame
Run psexec \\OtherComputer -w C:\MyGame -i C:\Administrator\Users\Desktop\TargetFolder\Target.exe
Might work ;o)

Use the -h parameter to elevate the permissions.

Related

Translating Linux command prompt to windows PowerShell prompt

Quick background: I previously used a remote Linux server for a project. Here I was able to pull up the Linux command window in the directory where files from another program were located, and enter a command such as lspp c= example_file.cfile -nographics. LSPP in this case is short for LS PrePost - through this command I was able to call LSPP in the background and have it reference the given *.cfile which contains various commands to be executed, such as depositing a given *.csv file with results, its name, etc.
I recently managed to install LSPP for windows locally, and am now trying to essentially translate the functionality of the command I executed in Linux, to Windows. I should add that I have no experience with CMD or Windows PowerShell...
The first thing I tried was to use cd C:\.... to set the directory to where the *.cfile is located and then enter the same lspp c= example_file.cfile -nographics from Linux, however, the response was that "lspp" was either spelled wrong or could not be found.
Next I tried setting the directory to the LSPP program folder, and using start LS-PrePost-4.7-x64 to at least start the program, but this didn't work either.
I would really appreciate it if someone could point me in the right direction here - thank you!

Python 3 os.renames Access Denied only when used in a script

So I wrote a deployment script in python that essentially just moves a bunch of directories around. It may or may not be relevant that I'm working on Windows and the scripts manipulates files and directories in Windows network shares.
A requirement of this script is it moves the old binary directory to a backup location on the same Windows network share, and that's where I'm having the problem. I'm using os.renames for this task. The destination path is generated based on the timestamp of the executable in the bin directory.
exec_mtime = datetime.fromtimestamp(os.path.getmtime(server_exec_path))
new_dirname = os.path.basename(target_path) + '_' + exec_mtime.strftime('%Y-%m-%d_%H.%M.%S')
backup_target_dir = os.path.join(server_old_dir_path, new_dirname)
if not os.path.exists(backup_target_dir):
print("{0}: Backing up old software...".format(server))
os.renames(server_target_path, backup_target_dir)
else:
print("{0}: A backup already exists with the same version number. Skipping backup.".format(server))
As for my variables:
target_path == "//server/share/path/to/bin"
server_exec_path == os.path.join(target_path, 'Program.exe')
server_old_dir_path == "//server/share/path/to/bin_backup"
The os.renames command would resolve to something like this:
os.renames("//server/share/path/to/bin", "//server/share/path/to/bin_backup\\bin_2019-11-01_13.02.27")
So, my problem is that os.renames always throws PermissionError: [WinError 5] Access is Denied. I have double-checked the permissions on all of these directories and I have them. Here are some things I have tried so far:
Performing the same moves in the Windows file browser. -> It works.
Running the same os.renames command in the python3 shell with the same arguments the script would give it. -> It works, confusingly.
Putting the os.renames command in a loop to retry it 100 times if it fails (I read somewhere that it can help sometimes). -> It fails.
Running the script in an elevated PowerShell. -> It fails.
Hitting my laptop with a sledgehammer. -> Haven't tried yet.
Another thing I want to mention is the script used to work not even a few days ago. I did make some edits in the meantime, but they weren't related to this section of code.
I'm out of ideas on this one. So any help you can provide would be much appreciated.
As it turns out, the problem was a side-effect of the changes I made to my script. I use python to launch a psexec command against the same remote machine earlier in the script (to run taskkill locally so the software I'm updating can exit gracefully), and I used the -u flag, which changes the user with which the command runs on the remote machine. When I removed the -u flag os.renames started working again. So I'm guessing that somehow running psexec changed the user the python script uses when running os.renames.

Command Not Found CentOS | .bat File

Im trying to run a .bat file on my server through php popen command, ive struggled and finally got to the point where all the permissions are set correctly and now i can actually execute the file but i have a problem. In my server logs it displays
foo.bat: line 1: mstsc: command not found, referer: http://dev.example.com
The full code in the file is mstsc /v:192.168.1.1 I know this means that it doesn't recognise the command on centos but im not sure what to do to fix the problem.
The aim of this code is to open RDP for the user who requested it. Bear in mind that this code works perfectly locally on my windows OS using xampp but when i upload it to the server running CENTOS it doesnt work.
My question is
How do i fix this error and allow CENTOS to execute a command that opens an RDP window for the user
MSTSC is a Windows RDP client which is why it works on Windows.
It's not available to run on CentOS, let alone call by executing a Windows batch file! You'll need to use an alternative solution like FreeRDP and use a script like this one if you want to do this from CentOS: https://www.server-world.info/en/note?os=CentOS_7&p=x&f=5
I feel like this is exactly what you're after
http://www.jjclements.co.uk/2010/02/21/rdp-hyperlink/
It allows you run a bat file that opens windows RDP without needing to write a single line of server code. Take a look its pretty good!

How To Run a Script in WinSCP

I am using winSCP GUI to connect to linux terminal and then copy the files and other stuff.
Now i have some scripts on the UNIX server,I am connected but how to run the script from the Win SCP.
what basically is needed is
sh scriptname.sh through the WinSCP.Please let me know if anyone else found out how to do that.AS loging into putty and running the command is time taking for me.
WinSCP Custom Command option tried to click on Execute,but the error pops up like no such directory.
Tried google but to the point information is not coming up.
Try this
sh "!"
OR
First of all executing commands from WinSCP can be tricky and if you are able to run few commands also,there are restrictions which you can not do fro WinSCP and should have to ultimately take help of PUTTY.
Here is the link Integrate WinSCP with Putty which will help you integrate your WinSCP to Putty,so that when you open any server through WinSCP putty will automatically connect without even asking for the password.And then you can run you command,hope that wound be of any trouble to you.
Remember you can store the connection details in WinSCP and in just one click it will connect to the server on SCP and also on Putty.
You can define your own custom command by right-clicking, selecting Custom commands and selecting Customize. Then click "Add", enter a description, e.g. Run and specifying a custom command. Try sh "!" to start with - that works ok for me, if you still get errors post your output back here. The quotes are important - only the exclamation should be quoted.
Right click the script > Custom Commands > Execute
Hope this helps.
To execute an ad-hoc shell command in WinSCP, use the Console window:
To execute the shell script selected in a file panel, create a custom command like:
sh "!"
This is actually, what the pre-defined custom command Execute (almost) does.
I'm aware that you claim that this does not work. But it should work in general. If you are having problems, please tell us details (exact error message, screenshot, anything)
You can have WinSCP open PuTTY terminal client and execute the commands there.
With some setup you can even open the PuTTY in the same directory as you have opened in WinSCP file panel.
Particularly for long-running commands/scripts, you can create a local custom command that runs the script via Plink:
"C:\Program Files (x86)\PuTTY\plink.exe" -ssh !U#!# "!/!"
Check the Use remote files option. Do not forget to select the Local command.
You can also pass the command to PuTTY to using similar method as used for Opening PuTTY in the same directory.

Change size of files on Windows machine from remote Linux machine

I need to change somehow size of files (increase or decrease) on Windows machine using bash scripts. (Content of files doesnt matter) But i have to run this scripts from remote linux machine. I've selected truncate command for size changing, this is exactly that i need, cause i need to change size exactly of chosen file, without changing it's descriptor. It is very important.
But i DO NOT have truncate on my linux machine and i CANNOT install it there (So dont tell me to install it there plz :)). I cannot install nothing on my linux machine it has specific kernel - this is a main option of all my problems.
So i've decided to install cygwin on my Windows machine, cause it has truncate command. Also i know that there are fallocate command, but my linux machine also doesnt have it, and cygwin doesnt have it too. So if there is some another command i wanna know it :)
Then after this steps i tried to change file size from cygwin terminal via truncate and all works perfectly. And the last problem that i had to solve was just run cygwin's bash from my remote linux, i've chosen winexe for that.
Finally the way that i've chosen is:
I run winexe command on my linux machine that runs:
winexe myHost "c:\cygwin\bin\bash.exe myScriptWithTRUNCATE"
on my Win machine.
But it doesnt work and i dunno why. truncate command doesnt change size of files at all. When i type
truncate --help
all works, i can see result of help option on my linux terminal, but e.g.
truncate -s someSize myFile
doesnt work, size of file doesnt change. Also error code from truncate -s someSize myFile is 0
Any suggestions?
try giving the name of your script that is "myScriptWithTRUNCATE" directly in winexe command .
example:-
winexe myHost "c:\cygwin\bin\bash.exe myScriptWithTRUNCATE"
also check debug log of winexe by modifying winexe command as :-
winexe -d 5 myHost "c:\cygwin\bin\bash.exe myScriptWithTRUNCATE"
see in this log what actually is sent over to windows as command in place for your script.
specifically see in " CTRL: sending command : run xxxxx"
see what "xxxxx" is in that debug log.
winexe gives you the control of windows command line(cmd.exe).
Try running you script after it has got control of cmd.exe.
Based on some findings above , try this link for more help
http://blog.dotsmart.net/2011/01/27/executing-cygwin-bash-scripts-on-windows/

Resources