Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Denied message for commands executed from batch file that work in Windows

Status
Not open for further replies.

theniteowl

Programmer
May 24, 2005
1,975
US
Hi Everyone,
Our image storage system is moving its staging folders to a new file share. We have been given full control access to the folders our system writes the images to.
Our system creates post processing bat files to perform actions after the images are generated and in some cases this includes a command to delete temporary files but I have discovered that when executed from a bat file the command is receiving an Access Denied error. Interestingly when I access the folders in Windows Explorer I can delete the files, just not when it is executed from a command prompt.
I have manually checked the permissions in the folder and the individual files and we appear to have the access we need so I am at a loss to explain why it fails when executed from a bat file.

This system has been in place for years, the only change is the new file share. I am still trying to get details on the nature of that file share such as if it is NAS, SAN or just a direct share on a Windows or Linux server.

Has anyone seen this issue before? Any thoughts on what could be wrong? The permissions are assigned through an Active Directory group and they are inherited from a higher level. Is there a chance there are restrictions applied that I am not able to see?

Any thoughts or suggestions would be appreciated.

Thanks.
Trent

At my age I still learn something new every day, but I forget two others.
 
The issue seems to be related to using UNC paths in the command. Searching the internet I find all sorts of similar issues but all of the responses are saying that UNC paths are not supported and to map a drive.
This setup is working perfectly on the existing file share using UNC paths so there must be something else causing the problem. Also, others had issues with move or copy commands and UNC paths while I do not have those problems, only an issue with delete.

I have attempted using a net use command without mapping a drive to the file share in the hopes it was an issue with the credentials but it made no difference. Should the server need rebooting after setting up credentials with net use for a network location?

We have in the past had a lot of issues with mapped drives disappearing and causing production outages so I would prefer not to have to rely on them. In Server 2003 we had to use stored credentials but they do not seem to be working in 8.1 at least for this issue. It does not really seem to be an issue with credentials anyway since all other commands work.

At my age I still learn something new every day, but I forget two others.
 
We found the solution was to add the AD group to the top level of the share with Read permissions.
The group was set with full permissions on a sub-level folder and though it showed the rights as being full it would not allow a delete operation to occur from a bat file using an UNC path.
Once the same group was added at the top level share with Read access the problem went away.
I do not have an explanation as to why this works yet but am still looking.
I post this solution in case anyone else has a similar issue.
Please let me know if this question should have been posted in another forum. If this is the correct forum we could use someone with knowledge of Active Directory.

At my age I still learn something new every day, but I forget two others.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top