Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Move file to mapped network drive with MID Server Script Include

greg54
Tera Expert

Hello,

We have a MID Server Script Include running that generates a text file. I am trying to move the generated file (via code) to a network drive that is mapped from the Windows machine the MID Server is running on after it is created. I was able to move the file to a different directory locally using the Java File object, but when I put a UNC path in as the destination directory, I am receiving a "java.io.IOException: Access is denied" error.

I am able to create/update a file in the mapped drive manually, so I know it isn't really a permission issue, but something about doing it via code, it doesn't like.

Does anybody have any advice to point me in the right direction?

Much appreciated!

8 REPLIES 8

greg54
Tera Expert

I found out the issue a few hours later. I mapped the drive with the same credentials that the MID Server service was running as, and was able to write to the directory fine.


Community Alums
Not applicable

Greg,

I know this post was a long time ago, but I was wondering if you would be willing to share how you accomplished the script for moving the file to another drive?

 

Thank you

Chris P_
Tera Expert

I would also like to know the code for this 🙂

marcm1
Tera Contributor

I'm wondering if the Greg ever posted his solution (the MID server script include) anywhere. I'm interested in moving files off the MID and into a network directory rather than some of the SFTP solutions floating around.