Several Windows users are encountering the “The process cannot access the file because it is being used by another process” error. Most of the time, the issue occurs when the user tries to run a netsh command. Some users are reporting that for them, the error message appears when they try to right-click a website in the IIS (Internet Information Services ) MMC (Microsoft Management Console) snap-in.
The issue is reported to occur on Windows Vista, Windows 7, Windows 8.1, Windows 10 and on various Windows Server versions.
What causes the process to be used by another process?
We investigated this particular issue by looking at various user reports and the repair strategies that they used to get the issue resolved. Based on what we were able to gather, there are several common scenarios that will trigger this particular error message:
- The command requires admin privileges – If you’re encountering the error inside a terminal, it’s most likely because you don’t have administrative privileges to make the modifications. Several users in a similar situation have managed to get the issue resolved by granting admin privileges.
- Another process is using port 80 or port 443 – This is typical with computers running IIS (Internet Information Services). If another process is using these two ports, you will see this error message.
- The ListenOnlyList registry subkey is not configured correctly – Another common scenario with IIS (Internet Information services) that will trigger this particular error is an incorrectly configured ListenOnlyList registry subkey.
If you’re currently struggling to resolve this particular error message, this article will provide you with a collection of verified troubleshooting steps. Down below, you have a collection of methods that other users in a similar situation have used to get the issue resolved.
For the best results, follow the methods below in order until you encounter a fix that is effective in resolving the error in your particular scenario.
Method 1: Running the command with admin privileges
If you’re getting this error when trying to run a netsh command, it’s likely that the error is occurring because you don’t have admin privileges. This is reported to occur more than often when the user tries to run a command that adds exclusions to the dynamic port range for native Windows apps or 3rd party application.
Keep in mind that an operation of this kind will require administrator privileges. To ensure that the CMD window you’re trying to perform the action in has admin privileges, follow the steps below:
- Press Windows key + R to open up a Run dialog box. Then, type “cmd” and press Ctrl + Shift + Enter to open up an elevated Command Prompt.
- When prompted by the UAC (User Account Control), click Yes to grant admin privileges.
- In the elevated Command Prompt, run the command again and see if you’re still encountering the same error message.
If you’re still getting the “The process cannot access the file because it is being used by another process” error or this scenario wasn’t applicable, move down to the next method below.
Method 2: Setting a different IP range
If you’re trying to resolve a conflict DNS conflict using netsh and the method above didn’t help you, you might want to try a different approach.
Several users struggling to resolve the same error message have found that the conflict is resolved after they tried to set a completely different IP range instead of creating an exclusion range.
Below you have a couple of commands that one affected user successfully ran to resolve a conflict between DNS and Quickbooks:
netsh int ipv4 set dynamicport tcp start=10000 num=1000 netsh int ipv4 set dynamicport udp start=10000 num=1000
Note: Ensure that the terminal you’re running the command in has admin privileges.
If this method didn’t resolve the conflict or wasn’t applicable to the situation that you’re encountering, move down to the final method.
Method 3: Resolving the IIS port conflict
If you are encountering the issue while trying to right-click a website item inside the IIS MMC snap-in (clicking Start doesn’t do anything), you’ll need to use the Netstat.exe utility to figure out if another process is using port 80 and port 443.
This issue is quite common with computers running Microsoft IIS 6.0 and 7.0. Based on the official Microsoft documentation, the error message will appear if one of the following conditions are applicable to your current situation:
- The ListenOnlyList registry subkey is not configured correctly on the IIS running computer.
- Another process is using the TCP port (80) or the SSL port (443) required by the IIS.
To resolve this issue, we’ll need to deploy the Netstat.exe utility in order to determine if another process is using the ports specified above. If the utility determines that the ports are not being used, we’ll examine the ListenOnlyList subkey to see if it’s correctly configured.
Here’s a step-by-step guide through the whole thing:
- Press Windows key + R to open up a Run dialog box. Then, type “cmd” and press Ctrl + Shift + Enter to open up an elevated Command Prompt. When prompted by the UAC (User Account Control), click Yes to grant administrative privileges.
- Inside the elevated command prompt, run the following command to start the Netstat.exe utility:
- Once you get a return, scroll through the list of Active Connections and verify whether the ports 50 and 443 are being actively used by a different process.
Note: If the ports are being actively used by a different process, you’ve just managed to identify the source of your problem. In this case, look online for specific steps on how to resolve the port conflict according to the PID of the port.
- Close the elevated Command Prompt as we won’t need admin privileges for the next steps.
- If the ports aren’t actively used, press Windows key + R to open up a Run dialog box. Then, type ‘regedit‘ and press Enter to open the Registry Editor. When prompted by the UAC (User account control), click Yes to grant administrative privileges.
- Inside the Registry editor, use the left pane to navigate to the following location:
Note: In case the ListenOnlyList subkey is not present, there’s no need to create one as an IP address of 0.0.0.0 will be used by default.
- Before you go ahead and modify the ListenOnlyList subkey, you’ll need to stop the HTTP service that is running the IIS. So put the Registry Editor in the background as we’ll return to it in a moment.
- Next, press Windows key + R to open a Run dialog box, type ‘cmd‘ and press Enter to open another Command Prompt window.
- In the Cmd prompt, run the following command and press Enter to stop the HTTP service responsible for running the IIS:
net stop http
- When asked whether you want to continue this operation, type ‘Y’ and press Enter to confirm the operation.
- Once the HTTP service is disabled, close the Command Prompt window and return to the Registry Editor.
- With the ListenOnlyList subkey selected, move over to the right-hand pane and ensure that it contains valid IP addresses. If you spot an IP address that isn’t valid, remove it or modify it to reflect an entry with a valid IP address.
Note: In case the ListenOnlyList subkey is present and the 0.0.0.0 address is listed, you need to delete all the other IP addresses.
- Close Registry Editor and restart your computer.
- At the next startup, the HTTP service should be automatically started. But just to make sure, press Windows key + R to open up another Run dialog box. Then, type “cmd” and press Enter to open a Command Prompt window.
- In the newly opened Command Prompt, type the following command to ensure that the HTTP service is started:
net start http
Note: If you get returned a message saying that “The requested service has been already started” you are good to go.
- Attempt to start a service from the Microsoft Internet Information Services (IIS) Microsoft Management Console (MMC) snap-in. You should no longer encounter the ‘process cannot access the file because it is being used by another process’ error.