psexec fails against windows 10 remote target - shell

Does psexec work against Windows 10 remote hosts? I'm running psexec from a Windows 7 machine. When the remote host is Windows 8.1, it works, when the remote host is Windows 10, it fails as below:
C:\Windows 7>psexec -h -u Admin -p passwordHere -n 280 \xxx.xx.xxx.xxx ipconfig
PsExec v2.11 - Execute processes remotely
Copyright (C) 2001-2014 Mark Russinovich
Sysinternals - www.sysinternals.com
Could not start PSEXESVC service on xxx.xxx.xxx.xxx:
The remote procedure call failed and did not execute.
Any clues appreciated.

Found this on a Microsoft forum, worked for me.
Open regedit from start. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
Add REG_DWORD (32 bit) LocalAccountTokenFilterPolicy and set value to 1.

You must run psexec on the remote machine and accept the end-user agreement (EUA) before running psexec remotely.
This can also be done by adding '-accepteula' switch to your command or by editing the remote machine's registry (less recommended).

Related

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

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.

Powershell Commands to a Computer that is only Reachable through RDP

Is it possible to send Powershell commands to a computer that can only be reached by RDP? If yes, how?
the help about_remoting topic covers various remote command options
https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.core/about/about_remote
also to configure winRM for powershell you can open a local Powershell session and run the Following command Enable-PSremoting
https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.core/enable-psremoting
server 2012 and newer already have it enabled.

"plink.exe" hangs on Windows Server 2008 R2, creates process "conhost.exe"

I am new to the whole Windows world. I have downloaded plink.exe from Putty's website. I am executing a plink command from the Windows Server 2008 R2(64 bit) which would execute a shell script in a Linux box.
The plink command is executed from a .dtsx package which is running as a daemon job on the Windows Server. I have accepted the host key into the registry for the Linux box using Putty and I can see it in the registry.
The command executes when I RDP into the server but does not when I am not logged in. It hangs and creates a "conhost.exe" process which stays there. I can see the "plink.exe" and "conhost.exe" in the task manager on the server.
Here is the kind of command I am running.
plink.exe user#SERVERNAME -pw password ./script_name.sh param_1 param_2 param_3
Has anybody faced/or is facing any problem like this?

Shutdown Windows machine from linux terminal [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 months ago.
Improve this question
I am running an application on linux machine. By giving the ip address of a windows machine as input, the application must shutdown the windows machine. If the machines run the same OS it is very easy but I'm confused how to do it in cross OS.
There may be more setup to do, especially for Windows Vista, Windows 7 and further windows versions, to allow remote shutdown:
Part A) On the Windows machine:
1) Add a remote shutdown security policy:
run secpol.msc
in the program tree, open Security Settings > Local Policies > User rights Assignment
Find the entry Force shutdown from a remote system
Edit the entry, add the windows user account that will be used for shutdown (ex: nouknouk)
2) Add registry keys to disable UAC remote restrictions:
Run regedit.exe as Administrator
Find HKLM/SOFTWARE/Microsoft/Windows/CurrentVersion/Policies/System
Create a new registry DWORD(32) value named LocalAccountTokenFilterPolicy and then assign it the value 1
3) Start remote registry service:
Open cmd.exeas Administrator
Execute the two following commands:
sc config RemoteRegistry start= auto
sc start RemoteRegistry
Part B) On the Linux machine:
1) install the package samba-common:
It depends on your Linux distribution, but for Debian and derivated (Ubuntu, Linux Mint, ...), the apt-get command can be executed like that:
apt-get install samba-common
2) To actually shutdown your Windows machine from the Linux one, run the following command:
net rpc shutdown -f -t 0 -C 'message' -U userName%password -I xxx.yyy.zzz.ttt
Where:
-f means force shutting down all applications (may be mandatory)
-t 0 is the delay before doing it (0 means 'right now').
-U user%password is the local user and his password on the windows machine (the one that has been allowed to do remote shutdown in part A).
-I is the IP address of the windows machine to shutdown.
Command to shutdown windows system from linux -:
$ net rpc -S <ip address> -U <username>%<password> shutdown -t 1 -f
This command can be issued from bash or even set in cron job to shutdown the computer at a specific time and this command is shipped with many distros by default.
It's important to note that the above solution will not work if the username in question does not have a password set (at least that's how it was in my case).
For windows 10 (and below maybe, did not check) users one must go to the firewall settings and enable "Remote Service Management" for the linux box to be able to connect via rpc.
It depends on your infrastructure -- how you authenticate to the Windows machines, whether you can configure them yourself, etc. If it were me, I'd put Cygwin on the Windows boxes, then ssh to them and run shutdown -h. There are surely other ways to do it, of course.
You need a way to launch a shell on the Windows box so you can run th shutdown command built in to Windows.
You can install Cygwin for this, then install an SSH daemon in Windows. Once that's running, your Linux box can run commands on the Windows box just as if it were another Linux machine.
Here are some instructions for setting up Cygwin's sshd in Windows.
Option 1: Install SSH server on windows. Login to this server from any box and call shutdown command. We use Interix(Microsoft's unix like environment). It comes with a telnet server- allows to invoke windows commands from other machines..
Another option:
If you samba installed on windows it can connect to windows and call windows commands
net rpc SHUTDOWN ...
(from http://www.linuxforums.org/forum/red-hat-fedora-linux/60324-remote-shutdown-windows-linux-box.html#post573872 )
Another option:
try rdesktop to the windows machine with shutdown command ( I use it for running windows batch script which has shutdown in it, not sure if you can directly call shutodwn)
For windows 10, install openssh-server following this.
With permission setting by nouknouk here
It should be work by
ssh username#host 'shutdown /p'
Also don't forget to add an inbound rule for RPC in Windows firewall allowing port 445.
Use telnet command in Linux, make sure telnet is enabled in Windows system

executing remote psexec while logged on as SYSTEM

Step 1). log into local windows xp (sp3) machine as system account
Step 2). execute psexec test as follows on remote xp (sp3) machine
psexec \\nnn.nnn.nnn.nnn ipconfig /all
RESULT:
Couldn't access nnn.nnn.nnn.nnn
Access is denied.
Question: Why?
I am logged on as windows System user, the system user is all powerfull
i should be able to do anything, with no access restrictions at all
This doesnt work either
psexec \\nnn.nnn.nnn.nnn -s ipconfig /all
why doesnt being logged onto a local xp machine as SYSTEM give me the power to run
anything on a remote machine?
The SYSTEM account is all powerfull when it comes to the local system, but not on remote systems. Use -u to specify a username...

Resources