Execute vbs in Dude

Hello,

I have a vbs script which look at the last modified date of a file, I launch this script in Dude with this command:

if(array_element(execute(“cscript.exe”,concatenate("//NoLogo C:\fileupdated.vbs ",device_property(“CustomField1”)),“C:\WINDOWS\System32\”),1)=“1”,1,-1)

This return “1” if the file is ok and “-1” if the file is wrong, the path of the file is in the CustomFiled1 of the device. When I check a file which is located on the system (for example C:\test.txt) the command works fine but when I check a file who is on a network share (for example Z:\test.txt) the command return an error “file does not exist”.

I try to launch the Dude service with the administrator account and no the system local but this don’t resolve the issue.

If I launch the script directly on the system without use Dude, the result is ok. Is it a problem with the rights in Dude?

Thanks.

I don’t know why network files are not working but there is one issue. In an error or available line of a probe negative one is true. I tried to get the admins to modify the probe thread since the very first post shows -1 for available and that makes the result true when it is not.

Place these on the appearance of a device label to prove how the dude is handling variables…
[if(-1,“neg one is true”,“neg one is false”)]
[if(0,“zero is true”,“zero is false”)]
[if(1,“one is true”,“one is false”)]


You can put a line from a probe into the appearance of a device label as well even if they have an execute function in them.
[if(array_element(execute(“cscript.exe”,concatenate("//NoLogo C:\fileupdated.vbs ",device_property(“CustomField1”)),“C:\WINDOWS\System32\”),1)=“1”,1,0)]

DISCLAIMER, I don’t know if a -1 handed back from an execute function is considered true or false.

Lebowski

Hello,

I make a screenshot of the result in the device appearance (cf. picture). The -1 handed back the execute command return a positive result, I try with this command but it didn’t work:

if(array_element(execute(“cscript.exe”,concatenate("//NoLogo C:\fileupdated.vbs ",device_property(“CustomField1”)),“C:\WINDOWS\System32\”),1)=“1”,1,0)

In the picture Result.jpg (attachment file) the last line is the result of this command:

execute(“cscript.exe”,concatenate("//NoLogo C:\fileupdated.vbs ",device_property(“CustomField1”)),“C:\WINDOWS\System32\”)

This return an error with file missing! Strange!
Result.jpg

I can only guess that the dude is not executing the VBS correctly.
I have seen where it would execute a bat file correctly and not a cmd file so maybe it is doing that… Maybe convert your vbs script into an exe.

http://www.visualbasicscript.com/m29193.aspx#29953


Or do a test with a batch job?

HTH,
Lebowski

For the moment I don’t have a solution to check automatically file properties over network, the vbscript doesn’t works.

I make a batch job to copy the file from the network to my dude computer and then I can check the file correctly.

I will try later if I find a better solution.

Thanks for help.