Guest Larry Bird Posted October 4, 2007 Posted October 4, 2007 I'm running Windows 2003 Standard Edition with Service Pack 1. My problem is related to a batch job hanging when initiated via Task Scheduler. I have a bat file that when initiated via a double click it runs fine with no problems. However, I take the same batch job and initiate it with the Task Scheduler and it seems to hang. I've already performed the following task to try and make things work: 1. Change all of the drive mappings to UNC. 2. Checked to make sure that access is permitted using the UNC. 3. Checked to make sure that local permission are appropriate on the local machine. 4. Made sure that the "userid" and "password" used within the task scheduler is valid. 5. Given the "userid" and "Batch" group permission to use the "CMD.exe". When I view the log for Task Scheduler I see the following message: "LouisTest.job" (LouisMSDSTest.bat) 10/4/2007 11:05:09 AM ** WARNING ** The task was terminated. This action was initiated either by an administrator or by the Task Scheduler service (because, for example, the computer is now non idle). I understand that the job was terminated because I stopped it. I do not understand why it is hanging when initiated via the Scheduler. I'm expecting the same results from the Scheduler initiation as I get from double clicking the bat file to run. When I double click the bat file I get a "DOS" window displayed indicating that the job/bat file was started. I do not see the same results when doing a right click on the job and selecting the run option from the menu. Instead I get no window displayed at all. However, the status does change to "Running". The first line in the "Bat" file performs a printer assignment. The assignment is as follows: rundll32 printui.dll,PrintUIEntry /y /n \\Printer Server\Printer Name It appears that the Task Scheduler does not work will when "rundll32 printui.dll" are being used. Has anyone else seen this problem? Thanks
Guest Pegasus \(MVP\) Posted October 4, 2007 Posted October 4, 2007 Re: Task Scheduler job Hangs (rundll32 printui.dll,PrintUIEntry) "Larry Bird" <LarryBird@discussions.microsoft.com> wrote in message news:BC408AE5-6485-406F-A8DC-8B2F067B63C4@microsoft.com... > I'm running Windows 2003 Standard Edition with Service Pack 1. My problem > is > related to a batch job hanging when initiated via Task Scheduler. > > I have a bat file that when initiated via a double click it runs fine with > no problems. However, I take the same batch job and initiate it with the > Task Scheduler and it seems to hang. > > I've already performed the following task to try and make things work: > > 1. Change all of the drive mappings to UNC. > 2. Checked to make sure that access is permitted using the UNC. > 3. Checked to make sure that local permission are appropriate on the > local machine. > > 4. Made sure that the "userid" and "password" used within the task > scheduler is valid. > > 5. Given the "userid" and "Batch" group permission to use the > "CMD.exe". > > When I view the log for Task Scheduler I see the following message: > "LouisTest.job" (LouisMSDSTest.bat) 10/4/2007 11:05:09 AM ** WARNING ** > The task was terminated. This action was initiated either by an > administrator or by the Task Scheduler service (because, for example, the > computer is now non idle). > > I understand that the job was terminated because I stopped it. I do not > understand why it is hanging when initiated via the Scheduler. I'm > expecting > the same results from the Scheduler initiation as I get from double > clicking > the bat file to run. > > When I double click the bat file I get a "DOS" window displayed indicating > that the job/bat file was started. I do not see the same results when > doing > a right click on the job and selecting the run option from the menu. > Instead > I get no window displayed at all. However, the status does change to > "Running". > > The first line in the "Bat" file performs a printer assignment. The > assignment is as follows: > > rundll32 printui.dll,PrintUIEntry /y /n \\Printer Server\Printer Name > > It appears that the Task Scheduler does not work will when "rundll32 > printui.dll" are being used. > > Has anyone else seen this problem? > > > Thanks > Change your batch file like so, then examine the output file: @echo off echo %date% %time% %cd% %UserName% >> c:\test.txt rundll32 printui.dll,PrintUIEntry /y /n \\Printer Server\Printer Name 1>>c:\test.txt 2>>&1 echo %date% %time% >> c:\test.txt echo. >> c:\test.txt
Guest Larry Bird Posted October 5, 2007 Posted October 5, 2007 Re: Task Scheduler job Hangs (rundll32 printui.dll,PrintUIEntry) I modified my batch file to include your recommendation. The bat file continued to hang, which was expected, but the content of "test.txt" was as follows: Fri 10/05/2007 8:53:47.84 D:\Program Files\DirectoryName UserID Nothing else was in the file. Just the one line above. The "rundll32 printui.dll, PrintUIEntry /y /n \\Printer Name" was the only line in the bat file that was not commented out. Any ideas about what may be going on? thanks "Pegasus (MVP)" wrote: > > "Larry Bird" <LarryBird@discussions.microsoft.com> wrote in message > news:BC408AE5-6485-406F-A8DC-8B2F067B63C4@microsoft.com... > > I'm running Windows 2003 Standard Edition with Service Pack 1. My problem > > is > > related to a batch job hanging when initiated via Task Scheduler. > > > > I have a bat file that when initiated via a double click it runs fine with > > no problems. However, I take the same batch job and initiate it with the > > Task Scheduler and it seems to hang. > > > > I've already performed the following task to try and make things work: > > > > 1. Change all of the drive mappings to UNC. > > 2. Checked to make sure that access is permitted using the UNC. > > 3. Checked to make sure that local permission are appropriate on the > > local machine. > > > > 4. Made sure that the "userid" and "password" used within the task > > scheduler is valid. > > > > 5. Given the "userid" and "Batch" group permission to use the > > "CMD.exe". > > > > When I view the log for Task Scheduler I see the following message: > > "LouisTest.job" (LouisMSDSTest.bat) 10/4/2007 11:05:09 AM ** WARNING ** > > The task was terminated. This action was initiated either by an > > administrator or by the Task Scheduler service (because, for example, the > > computer is now non idle). > > > > I understand that the job was terminated because I stopped it. I do not > > understand why it is hanging when initiated via the Scheduler. I'm > > expecting > > the same results from the Scheduler initiation as I get from double > > clicking > > the bat file to run. > > > > When I double click the bat file I get a "DOS" window displayed indicating > > that the job/bat file was started. I do not see the same results when > > doing > > a right click on the job and selecting the run option from the menu. > > Instead > > I get no window displayed at all. However, the status does change to > > "Running". > > > > The first line in the "Bat" file performs a printer assignment. The > > assignment is as follows: > > > > rundll32 printui.dll,PrintUIEntry /y /n \\Printer Server\Printer Name > > > > It appears that the Task Scheduler does not work will when "rundll32 > > printui.dll" are being used. > > > > Has anyone else seen this problem? > > > > > > Thanks > > > > Change your batch file like so, then examine the output file: > > @echo off > echo %date% %time% %cd% %UserName% >> c:\test.txt > rundll32 printui.dll,PrintUIEntry /y /n \\Printer Server\Printer Name > 1>>c:\test.txt 2>>&1 > echo %date% %time% >> c:\test.txt > echo. >> c:\test.txt > > >
Guest Pegasus \(MVP\) Posted October 5, 2007 Posted October 5, 2007 Re: Task Scheduler job Hangs (rundll32 printui.dll,PrintUIEntry) Since you had just one single line, it is obvious that the rundll32.exe command never completes. I also note that your working directory is "D:\Program Files\DirectoryName", which is rather strange, and that the program runs under an account called "UserID", which is even stranger. Do you really have such an account? Did you specify it when creating the scheduled task? Does it have administrative privileges? I suggest you modify your batch file like so: @echo off echo %date% %time% %cd% %UserName% >> c:\test.txt %SystemRoot%\system32\rundll32.exe %SystemRoot%\system32\printui.dll,PrintUIEntry /y /n \\Printer Server\Printer Name 1>>c:\test.txt 2>>&1 echo %date% %time% >> c:\test.txt echo. >> c:\test.txt In other words, take care to fully qualify rundll.32.exe and printui.dll. As an alternative you could schedule the job to run under your current logon account so that you can see what's going on. I also note that you have two spaces in your printer name definition. If you do indeed have them then you must surround the whole definition with double quotes. "Larry Bird" <LarryBird@discussions.microsoft.com> wrote in message news:1D0780F1-F47F-4AAB-91D9-636696587944@microsoft.com... >I modified my batch file to include your recommendation. The bat file > continued to hang, which was expected, but the content of "test.txt" was > as > follows: > > Fri 10/05/2007 8:53:47.84 D:\Program Files\DirectoryName UserID > > Nothing else was in the file. Just the one line above. The "rundll32 > printui.dll, PrintUIEntry /y /n \\Printer Name" was the only line in the > bat > file that was not commented out. > > Any ideas about what may be going on? > > > thanks > > > > "Pegasus (MVP)" wrote: > >> >> "Larry Bird" <LarryBird@discussions.microsoft.com> wrote in message >> news:BC408AE5-6485-406F-A8DC-8B2F067B63C4@microsoft.com... >> > I'm running Windows 2003 Standard Edition with Service Pack 1. My >> > problem >> > is >> > related to a batch job hanging when initiated via Task Scheduler. >> > >> > I have a bat file that when initiated via a double click it runs fine >> > with >> > no problems. However, I take the same batch job and initiate it with >> > the >> > Task Scheduler and it seems to hang. >> > >> > I've already performed the following task to try and make things work: >> > >> > 1. Change all of the drive mappings to UNC. >> > 2. Checked to make sure that access is permitted using the UNC. >> > 3. Checked to make sure that local permission are appropriate on >> > the >> > local machine. >> > >> > 4. Made sure that the "userid" and "password" used within the task >> > scheduler is valid. >> > >> > 5. Given the "userid" and "Batch" group permission to use the >> > "CMD.exe". >> > >> > When I view the log for Task Scheduler I see the following message: >> > "LouisTest.job" (LouisMSDSTest.bat) 10/4/2007 11:05:09 AM ** WARNING ** >> > The task was terminated. This action was initiated either by an >> > administrator or by the Task Scheduler service (because, for example, >> > the >> > computer is now non idle). >> > >> > I understand that the job was terminated because I stopped it. I do >> > not >> > understand why it is hanging when initiated via the Scheduler. I'm >> > expecting >> > the same results from the Scheduler initiation as I get from double >> > clicking >> > the bat file to run. >> > >> > When I double click the bat file I get a "DOS" window displayed >> > indicating >> > that the job/bat file was started. I do not see the same results when >> > doing >> > a right click on the job and selecting the run option from the menu. >> > Instead >> > I get no window displayed at all. However, the status does change to >> > "Running". >> > >> > The first line in the "Bat" file performs a printer assignment. The >> > assignment is as follows: >> > >> > rundll32 printui.dll,PrintUIEntry /y /n \\Printer Server\Printer Name >> > >> > It appears that the Task Scheduler does not work will when "rundll32 >> > printui.dll" are being used. >> > >> > Has anyone else seen this problem? >> > >> > >> > Thanks >> > >> >> Change your batch file like so, then examine the output file: >> >> @echo off >> echo %date% %time% %cd% %UserName% >> c:\test.txt >> rundll32 printui.dll,PrintUIEntry /y /n \\Printer Server\Printer Name >> 1>>c:\test.txt 2>>&1 >> echo %date% %time% >> c:\test.txt >> echo. >> c:\test.txt >> >> >>
Recommended Posts