Solved! Go to Solution.
I wonder if the license is not available when the task is initiated. Do you have any environment variables pointing to the license server that wouldn't be set for a 'run as' on a schedule? Is the license server or network in maintenance at that time?
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//0001000002nt000000
public void InitializeArcObjects() { try { ESRI.ArcGIS.RuntimeManager.BindLicense(ESRI.ArcGIS.ProductCode.Desktop); } catch (Exception e) { throw new Exception("Could not initialize ArcObjects.", e); } }
readonly string exportCommand = "sdeexport -o create -l $layername$,shape -f $filename$ " + "-i $sdeinstance$ -s $server$ -D $dbname$ -u $user$ -p $password$";
ESRI.ArcGIS.RuntimeManager.BindLicense(ESRI.ArcGIS.ProductCode.Desktop);