I’ve deployed a bot into production, and initially, it ran without issues. However, it’s now throwing an ‘Access to the path is denied’ error for an online shared drive path. I’ve confirmed that access permissions are correct. Can you help me troubleshoot this?
Open the path manually through the VM from which you are running the bot and check if you are able to OPEN without any error and if you are able to open the manually then please follow the steps suggested by @ashokkarale
Hi, thanks for the suggestion. But the issue not with the Paths. I have double checked it. The paths are proper and the same bot is now working fine when i am running it as attendee mode from the assistant but facing this issue when i m running it from from orchestrator as an unattended mode. fYI, its a unattended bot.
@vrdabberu , hi , as i mentioned in the post.der is no issues with the access…i have tried accessing it manually and it is working fine but with the bot run , i am facing that error
Try logging the user name from unattended bot using system.Environment.UserName. I feel the bot is using user id which don’t have access to the file location.
Certainly! The “Access to the path is denied” error can be tricky, especially if permissions appear to be correct. Here are some steps to help troubleshoot and resolve the issue:
1. Verify Access Permissions
Even though you’ve confirmed the permissions, double-check the following:
Ensure the bot’s user account has read/write access to the shared drive path.
Verify the bot’s user account can manually access the shared drive from the machine where the bot is running.
2. Check Network Connectivity
Ensure there are no network issues or connectivity problems with the shared drive:
Test accessing the shared drive from the machine manually to ensure it’s reachable.
Ensure there are no intermittent network issues.
3. Ensure Path Exists
Verify that the path exists and the bot is trying to access the correct location:
Ensure there have been no changes to the path or the shared drive structure.
Manually navigate to the path using the bot’s user account.
4. Check for File Locks or Other Processes
Another process might be locking the file or directory:
Ensure no other application or process is using the file or directory the bot is trying to access.
Use tools like Process Explorer to check if any process has a lock on the path.
5. Bot Execution Context
Check the execution context of the bot:
Ensure the bot runs with the correct user context that has access to the shared drive.
If running as a service, ensure the service is configured to use the correct user account.
6. Verify Path Length and Format
Ensure the path is not too long and is formatted correctly:
Windows has a maximum path length of 260 characters.
Ensure the path is not using unsupported characters.
7. Check Event Logs and Detailed Error Logs
Review the detailed logs and Windows Event Logs for additional clues:
Look for specific error messages or codes in the bot’s logs.
Check Windows Event Viewer for any related errors or warnings.
8. Antivirus and Security Software
Sometimes, security software can block access:
Check if any antivirus or security software is blocking access to the path.
Temporarily disable security software to see if the issue persists.
9. Re-map the Shared Drive
If accessing a mapped network drive, re-map it:
Sometimes re-mapping the shared drive can resolve access issues.
Use a UNC path (\\server\share) instead of a mapped drive letter if possible.
10. Update and Re-deploy the Bot
If the issue started after a change or update:
Roll back any recent changes to the bot or environment to see if that resolves the issue.
Ensure all components and dependencies are up to date.
Example Troubleshooting Code Snippet
If you’re using UiPath to access the shared drive, here’s a sample code snippet to help troubleshoot the issue by attempting to access the path programmatically:
try
{
// Replace with your actual shared drive path
string sharedDrivePath = @"\\server\share\path";
// Check if directory exists
if (Directory.Exists(sharedDrivePath))
{
// Attempt to create a test file
string testFilePath = Path.Combine(sharedDrivePath, "testfile.txt");
File.WriteAllText(testFilePath, "Test content");
// If successful, delete the test file
File.Delete(testFilePath);
Console.WriteLine("Access to the shared drive is working correctly.");
}
else
{
Console.WriteLine("The specified path does not exist.");
}
}
catch (UnauthorizedAccessException ex)
{
Console.WriteLine($"Access to the path is denied: {ex.Message}");
}
catch (Exception ex)
{
Console.WriteLine($"An error occurred: {ex.Message}");
}
Could you please check if you are using any activity specific to background processes, I mean like Simulate Type etc…
More info on background process
Also you can change the settings in Project level , by going in Project settings and toggling the setting “Starts in Background” as mentioned by @ashokkarale .
Also usually microsoft office tools like Excel, Word etc . might not work properly when used with Background process because they need user interactions and sessions.