Hi All
I'm trying to use the Process/ProcessStartInf o class to use
sysinternals psexec tool to run a remote command but I'm unable to get
the output. The same command thru a DOS window runs fine on a remote
server.
The code is very simple...
_logger.Debug(s tring.Format("F ilename: {0} Args: {1}", pathToExe,
args));
pc = new Process();
pc.StartInfo.Fi leName = pathToExe;
pc.StartInfo.Ar guments = args;
pc.StartInfo.Cr eateNoWindow = true;
pc.StartInfo.Us eShellExecute = false;
pc.StartInfo.Re directStandardO utput = true;
if (pc.Start())
{
output = pc.StandardOutp ut.ReadToEnd();
pc.WaitForExit( 20 * 1000);
}
return output;
But the process seems to wait forever. I even tried getting the log of
the parameters namely pathToExe and args and then running it manually
and that ran fine.
Any hints are appreciated.
thanks
Sunit 1 8439
Hi Sunit,
why reinvent the wheel? See here:
[Debugging Tools for Windows] http://www.microsoft.com/whdc/devtoo...nstallx86.mspx
It comes with a tool called "remote.exe " which can run a command
remotely and display its content (with interaction!) on your local system.
It's intended for the usage in driver development scenarios, but you can
use it wherever you think it will help you. And i think it is usefull in you
case,...
It just works fine and you dont have to redirect output stream with your
code.
BTW you should redirect any stream from the console to be able
to get any returned stream from the console output, this includes
also the errors and whatever your console outputs (socket, pipe,etc,...)
Regards
Kerem
---------
New Open Source Tools from me:
Calculate MD5 or SHA1 Hash for Files!
KHash Tools 1.0 Englisch: http://download.chip.eu/de/KHash-Tools-1.0_1317168.html http://entwicklung.junetz.de/project...ls%20v.1.0.zip
---------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü ke*****@arcor.d e
Best Quote: "Ain't nobody a badass with a double dose
of rock salt...", Kill Bill Vol.2
Latest Open-Source Projects: http://entwicklung.junetz.de
Sign my guestbook: http://entwicklung.junetz.de/guestbook/
-----------------------
"This reply is provided as is, without warranty express or implied." This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: baustin75 |
last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie
only when debugging in php designer 2005
--------------------------------------------------------------------------------
Hello,
I have a very simple problem but cannot seem to figure it out. I have a
very simple php script that sends a test email to myself. When I debug
it in PHP designer, it works with no problems, I get the test email. If
|
by: dennis.scales |
last post by:
I'm trying to wrap a psexec command in a python script so I can capture
the results and generate an exception report. The problem I'm having is
that when I use x = os.popen("command") to do it, it runs, but the
content of x is empty. I know there should be output sent to it,
because when I run the command from the DOS prompt, it shows it. I
don't have this problem when wrapping other PSTools. Has anyone else
had this problem, or can...
|
by: lawrence k |
last post by:
How can I find out where my script is outputting to the screen for the
first time?
My error logs are full of stuff like this:
PHP Warning: session_start(): Cannot send
session cache limiter - headers already sent in
/home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/CommandStartSession.php
on line 14
|
by: juergen |
last post by:
Hi,
there are many postings on this subject, I have read them put don't
have an answer.
I get these warnings: Cannot send session cookie - headers already sent
in,
but my php-scripts are okay.
As you can see in the code and response below, I really don't output
anything.
I am at EVANZO.
|
by: vol30w60 |
last post by:
Hi folks,
I am trying to launch a program with PHP code. I am running Apache on
Windows XP SP2.
I am using the method noted here:
http://us2.php.net/manual/en/function.exec.php#59428
To simplify things, I am trying to launch notepad with the following
line of code:
| |
by: Fendi Baba |
last post by:
I created an ASP.net page which opens excel. The data opens up
correctly in MS office Excel 2007 but when we use a mahcine with MS
Office 2003 we encountered a message, "Cannot read output file" Is
this caused by the Cridview or does anyone know what causes this.
Thank in advance.
|
by: Curious |
last post by:
Hi,
I'm not sure if this is the right place to post such command issues.
If you know a better forum where people respond to messages fairly
often, please let me know! Anyway, would appreciate your help!
---------------------------------------------------------------------------------------------------------------
Hi,
I've created a scheduler job with FORFILES command to delete files
|
by: porsch55 |
last post by:
m_oProc = new Process();
ProcessStartInfo oInfo;
oInfo = new ProcessStartInfo("\\\\" + sSourceServer + "\\" +
Environment.SystemDirectory.Replace("C:", "C$") + "\\psexec.exe", " \
\STLLHK8PX41, -u <service admin account-p <service admin password
\WindowsExplorer.vbs STLDJSRNRC1 " );
oInfo.WorkingDirectory = \\frmweb02\NewSupportTools$\Tasks;
|
by: =?Utf-8?B?emlubw==?= |
last post by:
if I run the following from the command line as:
C:\PsTools>psexec -u domain\myUser -p myPassword -i \\remoteServer cmd.exe
it run successfully and it opens the command window on the remote server
if I try to run this same command from an asp net web page from the same
server as :
Dim p As New System.Diagnostics.Process
Dim pi As New System.Diagnostics.ProcessStartInfo
pi.FileName = "C:\PsTools\psexec.exe"
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |