|
Answer» Hello,
I am checking the scheduled tasks at the PCs in our Network.
Problem is that "at" always gives out errorlevel 0 if there is a scheduled task or not. (So I get a long list to read...) I tried a workaround with: at \\%PC% |findstr /B /V /C:"-" But didn`t get it really to work.
This is my (yet) working Code without the errorlevel workaround: :MAIN REM main procedure rem -counts the pc numbers rem - SUB pings the pcs and checks the "errorlevel" rem -SUB1 if the pc is running at COMMAND rem (and my little problem)
CLS For /L %%A in (%VON%,1,%BIS%) do call :SUB %%A goto :EOF
:SUB %%A set PC=HA%1 for /f %%I in ('Ping -n 1 %PC% ^| find /c "Antwort"') do call :SUB1 %%I goto :EOF
:SUB1 %%I if {%1} GTR {0} ( echo. echo %PC% at \\%PC% ) goto :EOF
many thanks in ADVANCE for any help uliWhat version of Windows are you running? Try the SCHTASKS command INSTEAD of AT. I'm not sure if it RETURNS an errorlevel or not, but if it doesn't you can search on the output it gives for errors.I am running NT4 Sp6a with NT Ressource - kit and the Gnu Unix tools.
(The schtasks command is not availaible on my system.)
I tried to use the output from "at". It becomes just a bit difficult to make another For loop in the x'nd sub-prozedure.
uli you wanted only to check whether there are configured jobs at the remote? Code: [Select]set error=There are no entries in the list for /F "tokens=1* delims= " %%i in ('at \\PC') do ( set errorstring=%%i %%j if not %errorstring%==%error% echo There are some jobs configured )
have not tested the IF statement. We can just check the return string returned by "at". I find when there are no configured jobs, "at" returns "There are no entries in the list", so i guess you can manipulate this..
|