Access Denied In Cmd

-->

This article provides some workarounds for an issue where you can't use the runas command, the Run as Administrator option, or the Run as a different user option after you upgrade Windows Server.

Applies to: Windows Server 2012 R2
Original KB number: 977513

Symptoms

Consider the following scenario:

  • You upgrade a computer that's running Windows Server.
  • You sign in as a standard user.
  • You try to use one of the following features:
    • runas command
    • Run as Administrator option
    • Run as a different user option
Access Denied In Cmd

In this scenario, you receive the following error message:

Access is denied

Cause

To enable the built-in admin account, follow these steps: Open an elevated Command Prompt. Press Win + R to open the Run dialogue, type cmd and press Ctrl + Shift + Enter to open it in administrator mode. Right click your Desktop, choose New - shortcut. Type cmd in the location box. Give the Shortcut a meaningful name. Then tight click the shortcut and choose Properties. Click Advanced, then check the box marked 'Run as Administrator'. Save and close the properties Dialog.

The discretionary access control list (DACL) for the Secondary Logon service isn't set correctly when you upgrade Windows Server. This problem prevents a standard user from starting this service and from running an application as a different user.

Workaround 1: Use the Sc.exe command prompt utility

Method 1: Try Command Prompt. The easiest solution for this is to use the command prompt to terminate a process. There are certain commands that can be used to do the same thing i.e. Terminate process. Here are the steps for stopping processes. Press Windows key once; Type command prompt in the Start Search box. Feb 01, 2019 Diskpart has encountered an error: Access is denied. See the System Event Log for more information. If you see the System Event Log, you might get something like “Failed to open device? GLOBALROOT Device HarddiskVolume5.

You can use the Sc.exe command prompt utility to set the security to the default configuration after you upgrade the server.

Note

You should log on as an administrator before you run these commands.

To do so, follow these steps:

  1. Open a Command Prompt window.

  2. At the command prompt, type the following command, and then press ENTER:

  3. At the command prompt, type the following command, and then press ENTER:

  4. Close the Command Prompt window.

  5. Try to use one of the following features:

    • runas command
    • Run as Administrator option
    • Run as a different user option

    Also, make sure that you can switch users and that the Secondary Logon service starts correctly.

Workaround 2: Use Group Policy

You can use the Group Policy Management Console to configure a domain-based policy that sets security to the default configuration after you upgrade the server. A new Group Policy object (GPO) should be created for this workaround. And it should be linked so that the new GPO is applied to only the affected computers.

To do so, follow these steps:

  1. Edit Group Policy in the Group Policy Management Console.

  2. Locate the policy: Computer ConfigurationPoliciesWindows SettingsSecurity SettingsSystem Services.

  3. Open the Secondary Logon service.

  4. Select the Define this policy setting check box, and then select Enabled.

  5. Set the service startup mode to Manual.

  6. Expand the Security node to make sure that the following properties and objects are set to Allow.

    PropertyObjects
    Authenticated UsersQuery Template, Query Status, Enumerate Dependents, Start, Pause, and continue, Interrogate, Read Permissions, User-Defined Control
    BuiltinAdministratorsFull Control
    InteractiveQuery Template, Query Status, Enumerate Dependents, Start, Pause, and continue, Interrogate, Read Permissions, User-Defined Control
    ServiceQuery Template, Query Status, Enumerate Dependents, Pause, and continue, Interrogate, User-Defined Control
    SystemQuery Template, Query Status, Enumerate Dependents, Start, Pause, and continue, Interrogate, Stop
  7. Select OK to apply the security changes.

  8. Select OK to apply the Group Policy changes.

  9. Apply the GPO to the affected computers by waiting for Group Policy to update or by starting the update manually.

  10. Try to use one of following features:

    • runas command
    • Run as Administrator option
    • Run as a different user option

    Also, make sure that you can switch users and that the Secondary Logon service starts correctly.

Note

Why Access Denied In Cmd

We don't recommend this workaround because the permissions are reapplied during Group Policy updates. However, you have to fix the incorrect security only one time after the upgrade.

More information

For more information about the runas command, visit the following Microsoft TechNet Web site:

For more information about how to use the Group Policy Management Console, visit the following Microsoft TechNet Web site:

By Vernon Roderick, Last updated: January 31, 2020

Using File Explorer and managing our files has always been in our everyday life as a Windows user. One moment we’re searching on the browser, the next moment we’re checking our folders. In short, accessing folders is our very routine. However, sometimes things don’t end well for us. This is especially true when you encounter the access denied folder errors on Windows.

Most likely, you are going to be locked out of your precious folder. This means you won’t be seeing your files for a while, which in turn may end up bad on your side. It can either affect your studies, job, or whatever you may need the folder for.

Either way, it would be best to know how to solve the access denied folder errors on Windows as soon as possible, and that’s what we’ll be talking about today. Without further ado, let’s head to our first option.

Part 1. The Easiest Way to Bypass Access Denied Folder Errors on Windows

Although there are many ways to bypass the access denied folder errors on Windows, the easiest solution is by using third-party software to completely ignore the error. For that reason, we recommend the use of the FoneDog Data Recovery tool.

The FoneDog Data Recovery Tool allows you to safely recover all kinds of data, be it images, videos, documents, and more. In addition, the tool also supports its different formats. But what is most important is that the tool allows you to recover data from folders.

Data RecoveryRecover deleted image, document, audio and more files.Get deleted data back from computer (including Recycle Bin) and hard drives.Recover loss data caused by disk accident, operation system crushes and other reasons.

There are many things you can do with the FoneDog Data Recovery. You can even recover files that were deleted from the Recycle Bin. Regardless, to fix the access denied folder errors on Windows, you will have to follow these instructions:

  1. Launch the FoneDog Data Recovery tool after you download and install the software.

You will be taken to a window with a list of File Types and Drives.

  1. Choose which File Types you want to recover as well as the Drive from where the folder you want to access is located.

The next window will take you to a selection of files.

  1. On the left panel, navigate to the folder where the access denied folder errors on Windows

Upon clicking the folder in question, you will get a list of files on the right side.

  1. Select which files you want to recover by checking the boxes that correspond to each item.
  2. Once you’re finished with the selection, click on the Recover.
  3. Wait for the recovery process to finish.

However, if the folder that you’re using the tool for has no problem whatsoever, then there’s no guarantee that the features would work. So to compensate, we’ll discuss more solutions to bypass the access denied folder errors on Windows.

Part 2. 10 More Recommended Ways to Bypass Access Denied Folder Errors on Windows

Way 1: Take Ownership of Directory

Access denied folder errors on Windows typically show up when you don’t have the permission to access a directory. Although you can give yourself privileges, it would be easier if you take ownership of that directory at once.

This will allow you to open the folder, regardless of whether you really are its owner or not. So to fix the problem, all you have to do is assign the ownership of the folder into your account, and here’s how you can do it:

  1. Launch a session of File Explorer.
  2. Navigate to the folder that you want to access.
  3. Right-click on that folder then select Properties.
  4. On the popup window, you’ll get, click on the Security.
  5. Click on the Advanced.
  6. In the Owner field, you’ll see the name of the owner. Click on the Change button beside it.
  7. Select Advanced.
  8. In the Select User or Group field, click Find Now.
  9. Among the search results, you’ll see a list of names. Find and select the name of your user account then click on OK.
  10. On the Select User or Group field, click on OK.
  11. Click on the Apply.
  12. Keep on clicking OK until the task is complete.

At this point, certain permissions should already be added on your account for that specific folder. However, in some cases, this won’t be enough.

Way 2: Add Permissions

Although taking ownership can give you permission to use the folder, it would still not guarantee that you’ll bypass the access denied folder errors on Windows. Simply put, if you want to be accurate, you will have to add the permissions manually yourself.

You should be able to do this if you follow these instructions:

  1. Open File Explorer.
  2. Go to the folder that you want to access.
  3. Right-click on the folder and select Properties.
  4. Go to the Security.
  5. Under the Group or user names section, click the Edit.
  6. Select the User Account to add permissions on.
  7. At the bottom of the window and under the Allow column, check the boxes of permissions you want to grant.

With this, once you pinpoint the problem, you can easily solve it by choosing to grant the account-specific permissions.

Way 3: Reset Your Permissions

Despite the importance of having permissions for a folder, there is also a chance that this would backfire and result to access denied folder errors on Windows. In short, if you add permissions recklessly, this will somehow cause you problems.

To fix the problem, Windows offers a way to reset your permissions easily, and you can do this by following these steps:

  1. Open an instance of File Explorer.
  2. Navigate to the parent of the folder that you want to reset the permissions on. The parent folder is the biggest folder where your folder is located.
  3. Right-click on the parent folder and select Properties.
  4. Go to the Security.
  5. Click on the Edit.
  6. Select the User Account you are currently using.
  7. Click on Remove.
  8. Now click the Add button beside the Remove.
  9. On the Search field, type in the name of the user you just removed.
  10. Once the user pops up, select it and click on OK.

Permissions are only a tiny part of the access denied folder errors on Windows. Sometimes, what you need are privileges.

Way 4: Enable Built-in Administrator Account

The Administrator of a system is often the one with the most privileges. With that said, you can assume that accessing folders would be a piece of cake for them. By using this account, you will have access anywhere without exceptions.

Alas, using the account can be very difficult. Fortunately, you can gain a part of the privileges by simply enabling the Administrator, and here’s how you can do this:

  1. Go to the Start menu by clicking on the icon at the bottom-left corner of your screen.
  2. Type in “cmd” at the Search bar.
  3. Once the cmd option pops up, right-click on it then select Run as administrator.
  4. On the Command Prompt, type in “net user administrator /active: yes” then press Enter on your keyboard.
  5. Type in “net user administrator ” removing the <> symbols and replacing the password with your admin password.
  6. Type in “exit” then press Enter to close the Command Prompt.
  7. Once you logout, you will be able to see the Administrator as one of your options as a user.
Cmd

If the access denied folder errors on Windows still persist, then you might want to level up your game.

Way 5: Add Your Account to Administrators Group

Access Denied In Cmd

By level up your game, this means using more of the Administrator privileges. However, we still won’t head to completely setting yourself as the Administrator. All you had to do is add your account to the Administrator group, and here are the steps you need to follow:

  1. Log in to your computer as the Administrator. This should be doable since you already enabled the Administrator account.
  2. Press Win key + R on your keyboard to open the Run.
  3. Type in “MSC” and click on OK.
  4. You will be taken to the Computer Management screen where a list of users will pop up.
  5. Under the System tools, click on Local Users and Groups then select Groups.
  6. On the left side of the window, double-click on Administrators.
  7. Click on the Add.
  8. Now add your user account name to the Input field then click on OK.

Now if this is really not enough to solve the problem, you might want to head to maximize the potential of the Administrator.

Way 6: Set Your Account as Administrator

The only way to completely use the privileges of the Administrator is by setting yourself as one. Although due to security measures, you won’t be able to access it easily. However, the steps are very simple as long as you satisfy the conditions:

  1. Go to your Control Panel.
  2. Click on the User Accounts.
  3. Click on the Change My Account.
  4. Choose the Administrator.
  5. Click on Change Account Type.

With the Administrator account, you should have all the permissions and privileges you can wish for. However, in cases where this doesn’t work, then you can assume that privileges aren’t the problem. You would want to focus on Accessibility features and components instead.

Way 7: Turn Off User Account Control

One of the many features of Windows when it comes to accessibility is the User Account Control. As the name suggests, it disables certain user accounts to have limited control to directories. Although it can be a useful feature, it can sometimes lead to access denied folder errors on Windows. As such, our mission now is to disable this feature by following these instructions:

  1. Go to the Start.
  2. Type in UAC and click on the first option.
  3. Click on Change User Account Control settings.
  4. Use the slider to go to Never Notify.
  5. Click OK.
  6. Restart your computer.

Now try accessing the folder again. If it still isn’t accessible, then the problem must be with the components of the file system.

Way 8: Edit Registry

If for some reason, the folder you want to access is a part of a shared network, then the problem might be because of improper configurations on the registry. So to solve the problem, you will have to make some changes in the registry:

  1. Go to the Start.
  2. Type in “Regedit” in the search box then press Enter.
  3. The Windows Registry Editor should open up.

With this, you’ll be able to do anything you want with the Registry Editor. Although this is the case, we are still not sure what changes are necessary. Regardless, you need to be cautious when handling the registry as it may cause certain errors.

Access Is Denied In Cmd Delete File

Way 9: Check Environment Variables

Another component of the file system is environment variables. Like in the case of the registry, if the environment variables are not properly set, then the access denied folder errors on Windows would continue to exist. This, with all the solutions we discussed, should be enough to solve the problem. But if not, then there would only be one explanation left.

Way 10: Anti-Virus Software is Blocking Access

Sure, anti-virus software is rather important for the security and safety of your device. However, some software can have some useless features at times. One such feature is the blocking of various features on your Windows.

For one, it can block the installation of applications since they assume that it may cause some severe problems. Thus, you will have to disable your security software temporarily. Unfortunately, you would have to look up the instructions for this yourself since there are different ways to disable different anti-virus software. Regardless, once you’re done with this, there shouldn’t be any messages that will pop up telling you about access denied folder errors on Windows.

Part 3. Conclusion

Access Denied In Cmd As Administrator

Many people tend to think that access denied folder errors on Windows will cease to exist eventually if they continue to ignore it. However, it won’t be that simple, otherwise, life would be much easier for Windows users.

There will always be a complicated set of instructions that would be the only way to solve the problem. Fortunately, you’ve read almost all of them in this article. Regardless, you should still remain careful when following these solutions as it may lead to further problems if used incorrectly.

>Tricks >11 Ways to Bypass Access Denied Folder Errors on Windows
Comment ()