commandline runs interacvtively but not in scheduled task

#1
Hello. I would like to run a scheduled task (a .bat file) at say 2:00am every morning which QSF's daily recorded files into other folder and runs adscan over them.

These example commandlines in a .bat file:
Code:
cscript //nologo "C:\Program Files (x86)\VideoReDoTVSuite4\vp.vbs"     "d:\recorded\redorded01.ts" "e:\qsfd\redorded01.mpg" /p:zzz-MPEG2ps /na /q
cscript //nologo "C:\Program Files (x86)\VideoReDoTVSuite4\AdScan.vbs" "e:\qsfd\redorded01.mpg"    "e:\qsfd\redorded01.BPRJ" /q
run fine when I double click on it.
However when the .bat is run as a scheduled task, they just exit with no message (I redirect stdout and stderr to a log file and that shows nothing).
Omitting /q makes no difference.

Any suggestions on what may be happening ?
 
#3
I had a bit of a look, but I only want do do a couple of simple things.

When I started VRD from the icon, it popped up with that "checking for new version" dialog box. I thought "you beaut it was that" but no, acknowledging/closing that didn't help. Resorting to logs showed these errors:

Code:
cscript //nologo "C:\Program Files (x86)\VideoReDoTVSuite4\vp.vbs"     "d:\recorded\redorded01.ts" "e:\qsfd\redorded01.mpg" /p:zzz-MPEG2ps /na /q
C:\Program Files (x86)\VideoReDoTVSuite4\vp.vbs(54, 2) WScript.CreateObject: Could not create object named "VideoReDo.VideoReDoSilent".

cscript //nologo "C:\Program Files (x86)\VideoReDoTVSuite4\AdScan.vbs" "e:\qsfd\redorded01.mpg"    "e:\qsfd\redorded01.BPRJ" /q
C:\Program Files (x86)\VideoReDoTVSuite4\AdScan.vbs(41, 2) WScript.CreateObject: Could not create object named "VideoReDo.VideoReDoSilent".
It had been run as Admin once during installation. I did see the post about settings to run VAP in task scheduler and mine looked close.
The scheduled task isn't set to run with highest privs nor as an Admin user, as I can't quite see why it would need it.
 
Last edited:

Dan203

Senior Developer
Staff member
#4
Try launching the batch manager from inside VideoReDo, that'll do a check to make sure VRD is properly registered with COM and offer an option to register it for you if it's not.
 
#5
Batch Manager was OK. Some preliminary things about running a scheduled task as a non-Admin user, which I found out by trial and error:
---Start of Prelim stuff---
1. A normal user must have right "Login as Batch". To grant a user login as Batch :
On Win7Pro, login as Admin and run
Code:
secpol.mmc
(need to figure out how to do that on Win7Premium which says you're not allowed :confused:)
- Local Policies, User Rights Assignment, "Logon as a batch job" - add the usernames who are allowed
2. A non-Admin user who creates a Scheduled Task is the only one allowed to run it :rolleyes:
To allow Administrators and other users to run a scheduled task that a user has created:
EDIT: updated to use icacls instead of the deprecated cacls
On Win7Pro, login as an Admin and permit Administrators and another user to run the scheduled task...
Code:
icacls "C:\Windows\System32\Tasks\Taskname" /grant Administrators:F
icacls "C:\Windows\System32\Tasks\Taskname" /grant nonAdminUsername:F
where "Taskname" is the name of the scheduled task you want to change.
(need to check if we can do that on Win7Premium)
---End of Prelim stuff---

So, I checked the System Event Log and there's DCOM errors generated. Here's an extract of one:
Code:
Log Name:      System
Source:        Microsoft-Windows-DistributedCOM
Date:          29/10/2013 8:20:18 AM
Event ID:      10016
Task Category: None
Level:         Error
Keywords:      Classic
User:          myPC\myUsername
Computer:      myPC
Description:
The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID 
{3B394836-F59F-41C8-9E1C-590D0FB5BD70}
 and APPID 
Unavailable
 to the user myPC\myUsername SID (S-biglongnumber) from address LocalHost (Using LRPC). This security permission can be modified using the Component Services administrative tool.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Microsoft-Windows-DistributedCOM" Guid="{1B562E86-B7AA-4131-BADC-B6F3A001407E}" EventSourceName="DCOM" />
    <EventID Qualifiers="49152">10016</EventID>
    <Version>0</Version>
    <Level>2</Level>
    <Task>0</Task>
    <Opcode>0</Opcode>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2013-10-28T21:50:18.000000000Z" />
    <EventRecordID>7661</EventRecordID>
    <Correlation />
    <Execution ProcessID="0" ThreadID="0" />
    <Channel>System</Channel>
    <Computer>myPC</Computer>
    <Security UserID="S-biglongnumber" />
  </System>
  <EventData>
    <Data Name="param1">machine-default</Data>
    <Data Name="param2">Local</Data>
    <Data Name="param3">Activation</Data>
    <Data Name="param4">{3B394836-F59F-41C8-9E1C-590D0FB5BD70}</Data>
    <Data Name="param5">Unavailable</Data>
    <Data Name="param6">myPC</Data>
    <Data Name="param7">myUsername</Data>
    <Data Name="param8">S-biglongnumber</Data>
    <Data Name="param9">LocalHost (Using LRPC)</Data>
  </EventData>
</Event>
So I did what the message said and logged in as Admin and looked at the DCOM objects in MMC (to find the settings for Local Activation permission for the COM Server application with CLSID {3B394836-F59F-41C8-9E1C-590D0FB5BD70}) but CLSID {3B394836-F59F-41C8-9E1C-590D0FB5BD70} was nowhere to be found. Stuck now.

It doesn't quite explain in user terms why I can run the same .bat interactively but not as a scheduled task, it's the same username.
 
Last edited:
#6
Strange.
I read advice on the forum to delete the registry keys, so I tried it with the following results:

Code:
reg delete HKCR\VideoReDo.Application
result was OK

reg delete HKCR\VideoReDo.VideoReDoSilent
result was OK

reg delete HKCR\CLSID\{890F1ED4-6E97-4FD7-98C6-1C2D0C4D6D25}
ERROR: The system was unable to find the specified registry key or value.

reg delete HKCR\CLSID\{3B394836-F59F-41C8-9E1C-590D0FB5BD70}
ERROR: The system was unable to find the specified registry key or value.
I did start the batch manager and it did ask to register them and VRD worked.
Then I re-did the delete-keys and it still didn't locate the last 2 registry keys.
Then I re-did batch manager and it did ask to register them and VRD worked.
Ran the original .bat file interactively and it worked.
Ran the same original .bat file as a scheduled task and the same errors appeared.
Changed the scheduled task to run as an Admin, same result.

VRD v670 btw. Vanilla Win7Pro 64bit.
 
Last edited:

Danr

Administrator
Staff member
#7
Are you running the .cmd/.bat file directly from the task scheduler? If so, try invoking an extra level of indirection by running something like:

cmd /c 'my batch.cmd'
 
#9
I am pretty sure that this is a Windows Task Scheduler quirk, if that is what you are using. I had the same problem with a different .bat for a different program. Unfortunately, although I managed to get it working in one instance, I had another where nothing seemed to work, and I'm not really sure that I know what made the first one function. I think maybe checking "run whether or not logged in" and "run with highest privileges" are necessary. You may get more help on this by checking Windows help sources via Google (windows task scheduler problems), which is where I found some advice. I seem to remember that some of the conditions set in task scheduler are not intuitive, so changing them may track down the problem. Sorry to be vague, but it's a long time since I looked at this.
 
#11
Ticked "run only when user is logged on" in the Task properties.

A black DOS box appears and VRD runs in the system tray.

I wonder how to make it run automatically without having to leave the PC logged in...
 
Last edited:
#12
Experimented with

1. cscript //I and //B.
Both fail, //B fails silently.

2. cscript //H:cscript
It rejects the parameter , saying that it cannot change it. Ran it in admin mode and it changed OK.
No difference, VRD still fails to start.

I'm beginning to wonder perhaps VRD relies on some interactive property, eg maybe popping something in the system tray or getting ready for the version check or something...
 
Last edited:
#13
A post in this page http://social.msdn.microsoft.com/Fo...5395d9/64bit-office-interop-?forum=netfx64bit
said
Step 1: DCOM Config set up (In 2008 R2 version we don’t see Microsoft Excel Application listed in the DCOMConfig (DCOMCNFG). In order to do that please follow the below steps

1. In DCOMCNFG, right click on the “My Computer” and select “Properties”.
2. Choose the “COM Securities” tab
3. In “Access Permissions”, click "Edit Defaults" and add “domainname\user” to it and give it "Allow local access" permission. Do the same for <Machine_name>\Users.
4. In” launch and Activation Permissions”, click "Edit Defaults" and add “domainname\user” to it and give it "Local launch" and "Local Activation" permission. Do the same for <Machine_name>\Users
5.Press OK

Step 2: Please make this folder:
C:\Windows\SysWOW64\config\systemprofile\Desktop

And give write permissions to the "wb\ddpuser" user in those folders:
C:\Windows\SysWOW64\config\systemprofile\Desktop
C:\Windows\SysWOW64\config\systemprofile\AppData\Roaming\Microsoft
C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Microsoft
I tried step 1, and it went further, and the log yielded something to the effect could not find profile, which I assumed was my homegrown VRD mpeg output profile.
It is progress, however it's a little too esoteric for me and I don't know the consequences ... so I undid step 1 and left it at that :)
 

Danr

Administrator
Staff member
#14
If we can't find your profile, then it's likely you're not running as under your user account as the custom profiles are stored in your user-specific documents folder.
 
Top