psexec.exe problem running a netstat on remote server

From: Mike Ouimet (mike_ouimet_at_premierinc.com)
Date: 06/16/04


Date: Wed, 16 Jun 2004 04:14:06 -0700

I am trying to use the WScript.Shell command to execute a netstat using
psexec (from sysinternals) against remote servers. The problem is I get
an error back from what appears to be from netstat.

The error is:
netstat.exe exited on Servername with error code 1.

Any ideas what the problem could be? I have a huntch it's character
related because if I just run the same command from the command prompt
on my machine it runs fine and I get a value back. I can even run the
netstat.exe -a from with the vbscript but as soon as the next character
of | is added to separate the "find" command I get the error code from
above. If I try to do just netstat -a -o it runs fine however I simply
do not get all the results back from the netstat in my window nor if I
try to pipe to a txt file.

Here is how I am building my exec path and executing:
command_exec = "psexec.exe"
cmdNetStat = "netstat.exe -a | find /C " & Chr(34) & ":33569" &
Chr(34)
strPath = cmdNetStat

Set objWshShell = CreateObject("WScript.Shell")
Set objExec = objWshShell.Exec (strPath)
Set objStdOut = objExec.StdOut
strResult = objStdOut.ReadAll
WScript.Echo strResult

Thanks a bunch!

Mike O

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!



Relevant Pages

  • Re: Wnidows Server 2003 - I need help in getting the Connection Co
    ... command if already running. ... it fires off the netstat command for you, sending the results from that to ... SHELL EXEC FUNCTION ON SERVER 2003 - PERMISION PROBLEM!!!!! ... requires administator access we are get file permison problems - ANY ...
    (microsoft.public.windowsmedia.server)
  • Re: Wnidows Server 2003 - I need help in getting the Connection Co
    ... Run your PHP script with admin rights (likely a bad ... idea) or use another process on the box to run the command and save it to a text ... shell exec function but since PHP as a anonymous user - the netstat comand ... requires administator access we are get file permison problems - ANY IDEAS OR ...
    (microsoft.public.windowsmedia.server)
  • Netstat
    ... Its an amateursh query but we all have also passed by ... When you execute a command line exe you have to be the ... In RUN instead of typing NETSTAT type cmd ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Netstat
    ... >Its an amateursh query but we all have also passed by ... >When you execute a command line exe you have to be the ... In RUN instead of typing NETSTAT type cmd ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: Wnidows Server 2003 - I need help in getting the Connection Co
    ... command if already running. ... it fires off the netstat command for you, sending the results from that to ... another file which your PHP process can access. ... requires administator access we are get file permison problems - ANY IDEAS ...
    (microsoft.public.windowsmedia.server)