Page 1 of 1

File loop on network location

Posted: Thu Jun 11, 2020 12:49 pm
by brainbridge
Hi all,

I have a problem with robotask concerning accessing files on a network location. \\serverxx\... or \\10.10.0.10\...
Robotask isn't finding any files.
If I change this to a local location everything is working.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|0
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task3"
Hide=INTEGER|0
ID=INTEGER|-504778660
LogOnAsUser=INTEGER|1
Name=STRING|"testing"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER

[Actions\Action1]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER

[Actions\Action1\Params]
createmode=STRING|"1"
date1=STRING|"20200611"
date2=STRING|"20200611"
destvar=STRING|"OK"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"\\serverxx\kmo\testscript\*.xlsx"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action2\Params]
message=STRING|"{OK}"
type=STRING|"3"

[Actions\Action3]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action4]
ActionID=STRING|"A_FILE_SEARCH"
Enabled=INTEGER|-1
Name=STRING|"Create File List (variable: OK2)"
Params=FOLDER

[Actions\Action4\Params]
After=STRING|"0"
aftercount=STRING|"0"
AfterLine=STRING|"0"
Before=STRING|"0"
beforecount=STRING|"0"
BeforeLine=STRING|"0"
createmode=STRING|"1"
date1=STRING|"20200611"
date2=STRING|"20200611"
destfile=STRING|"OK2"
destvar=STRING|"OK2"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"\\serverxx\KMO\testscript\*.xlsx"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savetofile=STRING|"0"
savetovar=STRING|"1"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"1"
WithoutPath=STRING|"0"

Any tips to find the solution?

Regards
Stephan

Re: File loop on network location

Posted: Thu Jun 11, 2020 3:09 pm
by Oleg
I created the similar task (see below). It works

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1075658632
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task1194"
Hide=INTEGER|0
ID=INTEGER|1827985836
LogOnAsUser=INTEGER|1
Name=STRING|"file loop on network"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER

[Actions\Action1]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER

[Actions\Action1\Params]
createmode=STRING|"1"
date1=STRING|"20200611"
date2=STRING|"20200611"
destvar=STRING|"FILENAME"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"\\192.168.2.38\diskd\Temp\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"1"
timesize=STRING|"0"
WithoutPath=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action2\Params]
message=STRING|"{FileName}"
type=STRING|"3"

[Actions\Action3]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action4]
ActionID=STRING|"A_FILE_SEARCH"
Enabled=INTEGER|-1
Name=STRING|"Create File List (variable: aaa)"
Params=FOLDER

[Actions\Action4\Params]
After=STRING|"0"
aftercount=STRING|"0"
AfterLine=STRING|"0"
Before=STRING|"0"
beforecount=STRING|"0"
BeforeLine=STRING|"0"
createmode=STRING|"1"
date1=STRING|"20200611"
date2=STRING|"20200611"
destvar=STRING|"aaa"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"\\192.168.2.38\diskd\Temp\*.*"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savetofile=STRING|"0"
savetovar=STRING|"1"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"1"
WithoutPath=STRING|"0"

[Actions\Action5]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action5\Params]
message=STRING|"{aaa}"
type=STRING|"3"

Of course network resource must be available in user session. Otherwise you will get an empty list

Another one question: where do you run this task? In application mode or under system service mode?

Re: File loop on network location

Posted: Fri Jun 12, 2020 11:48 am
by brainbridge
Hi Oley,

Thanks for your feedback.
I am running as a remote task so u supposse system service mode.
I also test it with the option 'logon task as user (for NT Service mode only)'.

Afther changing the service to 'run as a user' and not local system everyhting is working :)
Thx!


Another small question
The option -> 'logon task as user (for NT Service mode only)'.
Is this reffering to the account you specify under the Robotask service manager, tab 'logon Parametres'?

Kind regards,
Stephan

Re: File loop on network location

Posted: Fri Jun 12, 2020 12:27 pm
by Oleg
By default system service can't access network resources.
There are two ways to solve this problem
  • Logon task as some user
    RoboTask service will work under SYSTEM account but it can run task with specified credentials.
    • Specify login parameters in RoboTask Service manager (Logon parameters tab)
      Turn ON "Logon task as user" (Task editor -> Advanced tab). This checkbox is ON by default. You can turn it off. In this case the task will be performed with SYSTEM credentials.
  • Logon system service as user
    Go RoboTask service manager -> Service Setup tab -> Service configuration button.
    You can specify valid user account and system will start service under specified credentials.
    But please note that the user must have Logon as a service system security policy. (Local security policy->Local policies->User rights assignment->Log on as a service)
Both methods have their advantages and disadvantages.