Link to home
Start Free TrialLog in
Avatar of Irwin W.
Irwin W.Flag for Canada

asked on

Net Send command not functioning with schtasks batch script

Hi,

I have been fighting to get schtasks working on my Windows XP clients. As users logon, a batch script runs and does the following:

- schtasks /create /tn "TempoNag" /sc minute /mo 1 /ru %computername%\administrator /rp myAdminPassword /tr \\serverName\SysVol\ADDomainName\Policies\{E29BFD55-6B5D-4A93-B0AB-EB1B05682F3E}\User\Scripts\Logon\netSendWarnMsg.bat"

- The task is created properly

- The task is supposed to do this: net send %computername% "You have more than two weeks of outstanding time sheets. Please Complete these time sheets."

- The problem I have is that the task runs but it does not do the net send pop-up message.

- I have tested the net send and it does work, but not from the schtasks.

Anyone have any ideas?

ASKER CERTIFIED SOLUTION
Avatar of sirbounty
sirbounty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Is the Messenger service running? NET SEND wont work without it.
"I have tested the net send and it does work"... must be...
Avatar of Irwin W.

ASKER

Hmmm,

I see these errors in the logs.  It seems to be going back and forth between password being invalid and invalid working directory.  I know that password is correct because it adds the task :(

"TempoNag.job" (netSendWarnMsg.bat)
      Finished 25/03/2007 9:13:00 AM
      Result: The task completed with an exit code of (1).
"TempoNag.job" (netSendWarnMsg.bat) 25/03/2007 9:14:00 AM ** WARNING **
      Invalid working directory..
      The specific error is:
      0x0000052e: Logon failure: unknown user name or bad password.
      Verify that the directory exists and try again.
"TempoNag.job" (netSendWarnMsg.bat)
      Started 25/03/2007 9:14:00 AM
"TempoNag.job" (netSendWarnMsg.bat)
      Finished 25/03/2007 9:14:00 AM
      Result: The task completed with an exit code of (1).
Did you try adjusting the /tr parameter as suggested above?
Yes  I did.  Also, the schedlgu.log does not seem to be logging any errors any more.

The schtasks does not seem to be logging any info any longer.
Try restarting the service...
Start->Run->services.msc
Locate Scheduled Task - right-click and click Restart
SO I stopped the service, cleared the log and restarted the service.

After doing that, here is the newest output, but I don't get the messenger popup.

"Task Scheduler Service"
      Started at 26/03/2007 10:39:06 PM
"TempoNag.job" (cmd.exe)
      Started 26/03/2007 10:41:00 PM
"TempoNag.job" (cmd.exe)
      Finished 26/03/2007 10:41:00 PM
      Result: The task completed with an exit code of (1).
I have raised my frustration value of this issue :-)
..and thats with which version of the taskrun line?
You might try putting some redirects in your code to determine if theres any output...

>> c:\output.txt

at the end of any command should redirect the output to that file...