Free Power Tools Brochure
Get Mark Minasi's
17-page guide today!



      

advertisement

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

June 29, 2004 05:29 PM

PsExec

Execute processes on a remote system and redirect output to the local system
Rating: (69)
Windows IT Pro
InstantDoc ID #42919
PsExec is a command-line tool that lets you execute processes on remote systems and redirect console applications' output to the local system so that these applications appear to be running locally. You can download PsExec for free from the Sysinternals Web site. Here are some advanced tips and tricks to help you leverage the full potential of PsExec as a systems management utility.

ARTICLE TOOLS

You must be a paid Professional Member to access this entire article.

Already a Professional Member? Please log in now:

NOT A PROFESSIONAL MEMBER? YOU CHOOSE:

Monthly or Annual

Professional Membership

VIP Membership

Compare Member Benefits

Add a Comment

I am getting the following error code 0. Any idea how to fix this?

C:\\WINDOWS\\system32>psexec \\\\2.75.221.2 -u administrator -p watchThis ipconfig

PsExec v1.95 - Execute processes remotely
Copyright (C) 2001-2009 Mark Russinovich
Sysinternals - www.sysinternals.com


ipconfig exited on 2.75.221.2 with error code 0.

C:\\WINDOWS\\system32>

Shuaib5/15/2009 8:36:35 PM


PsExec is gr8!!!
further, I need to know how can i use autocomplete of folder names, etc. while using cmd on remote machines..
thanks

nilakshi 11/24/2008 6:46:07 AM


See also this newer article by Mark Russinovich on PsExec:

http://windowsitpro.com/article/articleid/95231/psexec-user-account-control-and-security-boundaries.html
or type 95231 in the InstantDoc ID box at the top of this page.

Plus, there's also http://windowsitpro.com/article/articleid/50102/let-users-install-software-without-giving-them-administrator-r
ights.html
or type 50102 into the InstantDoc ID box at the top of this page.

Hope this helps!

Caroline11/13/2008 4:10:15 PM


Trying to run an install .exe on a remote PC. How can this be done in passive mode, so that all default options are used and the program installs? So far, I can only get the Welcome Page for the install program to appear.

Thanks.

Murdoch07 10/31/2008 7:28:04 AM


I’m trying to run psexec with an exe that contains this line of code:
gfx.CopyFromScreen(0, 0, 0, 0, new Size(screenWidth, screenHeight), CopyPixelOperation.SourceCopy);

It will hit an exception when run on a remote computer, but runs fine locally.

This is the exception:
Unhandled Exception: System.ComponentModel.Win32Exception: The handle is invalid

at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32
destinationX, Int32 destinationY, Size blockRegionSize)
at TakeScreenShot.Program.Main(String[] args)
c:\\browsershotsexes\\TakeScreenShot.exe exited on TestVistaErtang with error code
-532459699.

Thanks, Eric


PS This is all the code for the exe:

using System;
using System.Collections;
using System.Text;
using System.Drawing.Imaging;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace TakeScreenShot
{
class Program
{
#region Console Window property stuff
[DllImport("kernel32.dll", ExactSpelling = true)]
private static extern IntPtr GetConsoleWindow();

private static IntPtr ThisConsole = GetConsoleWindow();

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
private const int HIDE = 0;
private const int MAXIMIZE = 3;
private const int MINIMIZE = 6;
private const int RESTORE = 9;
#endregion
static void Main(string[] args)
{

ShowWindow(ThisConsole, HIDE); //Hides Console Window
Console.WriteLine("Minimizing the Current Console Window...");
System.Threading.Thread.Sleep(2000);
Rectangle scrBounds = Screen.GetBounds(new Point(0, 0));
int screenWidth = scrBounds.Width;
Console.WriteLine(screenWidth);

Eric9/23/2008 12:12:02 PM


Regarding the post by Rajeevnair81 on September 19, 2006:

I believe the problem you encountered stems from fact that PSEXEC, per the article, will "redirect console applications' output to the local system". The key phrase being "console applications". Notepad and other programs that have a Graphical User Interface (GUI) are not console-type programs.

I too would like some way to initiate/start a GUI-type program on a remote computer that would continue running after my connection to that remote computer has ended. Most "remote control" programs are either of the Window's "Remote Desktop" or VNC approach, or like TelNet/SSH/PSExec approach that seem to fly under the level of a GUI, handling only console output. Great for many, many tasks, but not what I (& perhaps Rajeevnair81) are looking for.

Dan9/18/2008 10:30:41 AM


Good utility. But requires autocomplete(Tab) while using cmd.
Can u tell me is there any way to autocomplete in psexec.

Asdaq8/14/2008 6:01:56 AM


I'm trying to run the PSExec Tool on a remote server in order to change the System Time. Problem is, this process is being called within a simple bat script and I have concerns exposing sensitive data, such as, Server's Administrator UserName and Password in clear text. I'm trying to run this tool using a regular user account modified with elevated privileges.

I believe the only Privilege Usage requirements needed to execute this task are as shown below. As a result, I added the corresponding User Right Assignments to Joe user hoping that would solve the issue. Sadly though, this did not work. Am I missing something else or is my requirement not possible?

Thx. Ron

SeAssignPrimaryTokenPrivilege (Replace a process- level token)

SeCreateTokenPrivilege (Create a token object)

SeLoadDriverPrivilege (Load and unload device drivers)

SeTakeOwnershipPrivilege (Take ownership of files and other object)

SeRestorePrivilege (Restore files and directories)

SeSystemEnvironmentPrivilege (Modify firmware environment variables)

SeSecurityPrivilege (Manage auditing and security log)

SeTcbPrivilege (Act as part of the operating system)

SeBackupPrivilege (Backup files and directories)

SeSystemtimePrivilege (Change the system time)

Ronald9/6/2007 9:54:51 AM


Hi All

I need help with this. I used Psexec the day but after some hourse received this Error Message :

Error communicating with PsExec service on tallyjavint.
The pipe has been ended

CAn you please help with this.

Anthonio5/17/2007 11:22:52 PM


I'm sure the article is very useful but I will never know because it would cost me a minimum of $49.95 to read it.

Nunya4/22/2007 7:46:25 PM


You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

windows 7 profile removal

Does anyone know of a script that will delete all domain profiles or all if easier upon reboot? With XP I used to do this with Delprof. I know there i...222-96223

advertisement

GOOGLE LINKS
SPONSORED LINKS
FEATURED LINKS

Podcasts

To successfully implement virtual desktops, IT administrators must carefully match user requirements to specific desktop technologies. Listen to this podcast to learn what you need to keep in mind when formulating your approach to desktop virtualization.

Downloads

PacketTrap IT is a comprehensive and affordable network management and application monitoring solution that solves problems associated with bandwidth, network and application performance, and connectivity. Gain insight into your network - try PacketTrapIT free for 21 days!

Web Seminars

Aside from its employees, data is an organization’s most important resource. Join Windows technical specialist and 11-time MVP John Savill to learn the best practices for managing data using features in Windows Server.
View this web seminar on demand!

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.