PsExec could not start app: The system cannot find the file specified - windows

This question has been asked many times elsewhere.. but they are mostly about running things on a remote computer etc. Mine is much more straight forward.
I got an app (let's call it app.exe), which runs by a service. When it runs by the service, it is ran by the SYSTEM user.
However the app is acting weird, further when I run the same app by simply clicking on the .exe file, it runs it but with the logged in user account:
So I simply want to run the same app as system, that's where I found the psExec command. If I run the psExec command like so
c:\path\BOT>psExec "*** Bot.exe"
PsExec v2.2 - Execute processes remotely
Copyright (C) 2001-2016 Mark Russinovich
Sysinternals - www.sysinternals.com
it works just fine, but once i put the -s switch (ie to run as system).. it blows up:
c:\path\BOT>psExec -i -s "*** Bot.exe"
PsExec v2.2 - Execute processes remotely
Copyright (C) 2001-2016 Mark Russinovich
Sysinternals - www.sysinternals.com
PsExec could not start *** Bot.exe on SAMERDERNAI5012:
The system cannot find the file specified.
this answer states that if the cmd window is ran as non-admin, then it should work. I tried that but nothing happend.

I expect the bot.exe file is not in the list of directories in the PATH environment variable for the SYSTEM user.
To system the system version of PATH open system control panel (Windows Key+Break), go to Advanced System Settings, and then Environment Variables.

Related

IIS wont run bat file (UAC Virtualization problem)

IIS hosts a .Net Core that simply needs to run a bat file. The file is part of the project.
On the local machine, everything works properly, but on the server, the bat file is not triggered because it is blocked by UAC virtualization.
On the server, the double-click script runs smoothly, but cannot be started automatically by .NetCore
.Net core has admin rights to execute the script, also AppPool has the
rights to execute the script. But the script simply stays blocked by
UAC.
I tried to completely disable UAC and restarted the server but again the same.
I tried to create a shortcut with admin rights that will run the script but without success.

How to run a bat script on multiple windows servers at once?

I am trying to run a .bat script that uninstall 32/64 bit agents and re-install 64-bit agents on almost 100 window servers.
Can you please guide me how this can be done?
I already tried running for one server to test
psexec \\<windows server> -u <username> -p <password> <command>
But fails with error
COULD NOT START PSEXESVC service on <windows server>
Do we need such service on all machines? Please suggest any other way?
PSEXEC is not a standard windows feature /service.
If you wish to use PS Exec you will need to install it on all of the relevant systems first.
Otherwise, your options are:
CMD:
A) Does the "Agent" Installer you are using allow you to install / uninstall to a given server in it's command line syntax?
If so utilize that.
B) Put the Installer in central location (the Active Directory Netlogon Folder is great for this) along with a CMD script to run the uninstall and install processes.
Then Use SCHTasks to connect to each server and create a Scheduled task that runs using an administrative Username and password for that server, and set it to run with the highest privileges, set the action to be the path to the CMD script in netlogon that you have previously tested and nwo is working, set the task to run 1 minute in the future, or on demand (If on demand you then run schtasks again to execute the task).
Powershell:
Work on getting a working CMD Script to run and use Invoke Command to run that command script on the remote systems. As in Option B from CMD options you can keep the CMD script and Agent installer in the netlogon folder.

Windows Linux Subsystem: start Bash Application as a Service

As the title already summarizes:
How can I start a bash-script automatically, when the computer starts - ideally without the need to log in to windows - using the Microsoft Subsystem for Linux's Bash.
At the moment, this isn't supported, because the WSL session manager service will close after the last bash.exe wrapper instance closes. There are a few options, but the absolute simplest one at the moment is to use the run utility from the Xming developer and just add a shortcut to your startup folder (in the start menu) pointing to
run.exe bash.exe -c "/home/user/daemoninit.sh ; /bin/bash". Unfortunately, if your daemon initialization requires root access, for example, something like sshd, you will need to add an exception to sudoers that allows anybody to run the daemon with root privileges.
Also, there are problems getting it to run as a true Windows system service, since each lxss installation is user-specific. Some people have gotten it to run on system startup, but it launches in a separate Windows session for that user and makes it so you can't launch bash.exe in your current user session.

Running psexec from jenkins not showing logs

I have Jenkins with 'Execute Windows Batch Command' that runs PsExec on a second computer configured with Execute Windows Batch Command
and set to cmd /c "FooPsExec.bat"
When I run the Jenkins I do not see the execution of PsExec logs and all I see is:
"c:\pstools\PsExec.exe" XXXXXXXXX
PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com
And that's it, I can see that the process is running on the remote computer however I want to see the logs on Jenkins
If I open cmd on the Jenkins and run the FooPsExec.bat (not via Jenkins) it is working and logs are shown appropriately
How can I make the logs to be visiable
You can use PaExec http://www.poweradmin.com/paexec/, which is an advanced version of PsExec

Install .exe software application on remote machines

I modified this script from the net, which is suppose to install .exe applications for remote machines:
$m = Read-Host "Enter machine name"
$File = "c:\temp\office2007sp2-kb958194-fullfile-en-us.exe"
$product = [WMICLASS]"\\$m\ROOT\CIMV2:win32_Process"
$product.Create($File)
When I run this script, I have noticed that this program promptly creates a process in the remote machine with the application name office2007sp2-kb958194-fullfile-en-us.exe.
This can be checked in the task manager also.
But other than that, there is no way to find out if this is getting installed in the remote machine or not.
Is there a way to find out, if the installation is really happening?
Or does this script actually works?
Not a proper answer because I haven't tried remote process launching like that, but I have used psexec to launch processes on other machines.
If you are still having problems with your script you may want to check out ps_exec, it lets you execute processes on other machines as if it was your own. You can check the exit code of the process just like you would if you were executing the process locally.
It's offered as a free tool by microsoft: http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

Resources