Errorlevel capturing from plink?



Hi,
I am able to connect via SSH to my server and run remote commands.
This seems to work fine interactively and so now I am trying create a
script to automate some commands. I am using plink with a command line
like:

plink -batch -i c:\myppk.ppk user@server cmd /c c:\temp
\commandfile.cmd

The connection works fine, and the command file does execute on the
remote server. However, my problem is that if the remote command file
fails for any reason, I don't seem to be able to capture this via an
errorlevel locally in my script. Plink always seems to return an
errorlevel = 0, even when I have redirected the errorlevel on the
server to a file and know it is non-zero. The commandfile.cmd on the
server currently finishes with:

EXIT %ERRORLEVEL%

Am I doing something obviously wrong?

Thanks in advance,
Phil Rossiter

.



Relevant Pages

  • Re: dcdiag - advertising errors on newley promoted domain controller
    ... Can you do the following on uksccmads01 ... The problem may actually have nothing to do with the new server but the ... From a command prompt try and see if you get any additional info ... Skipping site UK-CCM, this site is outside the scope ...
    (microsoft.public.windows.server.active_directory)
  • Re: dcdiag - advertising errors on newley promoted domain controller
    ... Can you do the following on uksccmads01 ... The problem may actually have nothing to do with the new server but the ... Active Directory Forest Replication GUIDs Found: ... From a command prompt try and see if you get any additional info ...
    (microsoft.public.windows.server.active_directory)
  • Re: dcdiag - advertising errors on newley promoted domain controller
    ... Default Server: uksccmads01.jw-uk.jameswalker.co.uk ... Output from dnslint on uksccmads01: No erros found, ... Active Directory Forest Replication GUIDs Found: ... From a command prompt try and see if you get any additional info ...
    (microsoft.public.windows.server.active_directory)
  • Re: dcdiag - advertising errors on newley promoted domain controller
    ... Both forward and reverse zones and server records have the correct IP ... Once you have found the error then on both servers, from a command prompt, ... Skipping site UK-CCM, this site is outside the scope provided by ...
    (microsoft.public.windows.server.active_directory)
  • Re: dcdiag - advertising errors on newley promoted domain controller
    ... Then change the secondary DNS to the other site DNS server. ... Skipping site UK-CCM, this site is outside the scope provided ... command line arguments provided. ...
    (microsoft.public.windows.server.active_directory)