Software⏱️ 3 min read📅 2026-06-11

How to Fix: Permission Denied VBScript error when trying to run the file

Permission denied error when running VBScript on Remote Desktop Connection.

Quick Answer: Check the file path and permissions for the Java-Update.exe file, and ensure that the script is running with sufficient privileges.

The 'Permission Denied' error when trying to run a VBScript can be frustrating, especially in a remote desktop connection scenario. This error occurs when the script is unable to execute due to a lack of necessary permissions or access rights.

This issue can be particularly challenging because it may seem like the problem lies with the script itself, rather than the actual cause. However, by following the steps outlined below, you should be able to resolve this issue and successfully run your VBScript.

💡 Why You Are Getting This Error

  • The primary reason for this error is that the Wscript.Shell object requires elevated privileges to execute certain commands. In a remote desktop connection scenario, this can be particularly challenging because the remote desktop session may not have the same level of access as the local machine. Additionally, even if you are logged in as an administrator on the remote desktop session, the VBScript may still require additional permissions or access rights to execute.
  • Another possible cause for this error is that the Java-Update.exe file is not located at the specified path ('C:\\Users\\Public\\Java-Update.exe'). If the file is located elsewhere, the script will fail to find it and throw a 'Permission Denied' error.

🚀 How to Resolve This Issue

Elevating Privileges Using Runas Command

  1. Step 1: Open a command prompt on the remote desktop session and navigate to the directory where your VBScript is located.
  2. Step 2: Type the following command: runas /user:administrator "C:\\Path\\To\\Your\\VBScript.vbs"
  3. Step 3: Press Enter to execute the command. This will launch the VBScript with elevated privileges, allowing it to execute without a 'Permission Denied' error.

Checking File Locations and Permissions

  1. Step 1: Verify that the Java-Update.exe file is located at the specified path ('C:\\Users\\Public\\Java-Update.exe') or adjust the script to use the correct location.
  2. Step 2: Check the permissions of the VBScript and the Java-Update.exe file. Ensure that the user account running the VBScript has read, write, and execute access to both files.

💡 Conclusion

By following these steps, you should be able to resolve the 'Permission Denied' error when trying to run your VBScript. If you continue to experience issues, it may be helpful to consult with a Windows administrator or IT professional for further assistance.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions