При выполнении команд net user, net stop, net start и других в командной строке Windows 11 или Windows 10 вы можете получить сообщение: «Системная ошибка 5. Отказано в доступе». Начинающему пользователю не всегда ясно, чем вызвана ошибка и как решить проблему.
В этой инструкции подробно о том, почему возникает системная ошибка 5 при запуске и остановке служб или работе с учетными записями пользователе в командной строке.
Методы решения для «Системная ошибка 5. Отказано в доступе» при выполнении команд net stop, net start, net user
Причина того, что в результате выполнения команд сообщается о системной ошибке 5 «Отказано в доступе» в том, что командная строка (Терминал Windows или Windows PowerShell) запущен не от имени администратора. Или, в некоторых случаях — в том, что ваш пользователь и вовсе не имеет прав администратора на компьютере.
В первом случае решение будет простым: запустите командную строку от имени Администратора, для этого вы можете:
- Начать набирать «Командная строка» в поиске на панели задач Windows 11 или Windows 10, а затем в результатах поиска нажать «Запуск от имени Администратора».
- Нажать правой кнопкой мыши по кнопке «Пуск» и выбрать «Терминал Windows (Администратор)» или «Windows PowerShell (Администратор)»
- Использовать инструкции Как запустить командную строку от имени Администратора в Windows 11 и Как запустить командную строку от имени Администратора в Windows 10.
Ошибка не будет появляться после того, как вы запустите командную строку с соответствующими правами.
Если ваш пользователь не имеет прав администратора на компьютере, но вы имеете доступ к учетной записи с правами администратора, вы можете зайти под ней, а потом сделать текущего пользователя администратором: Как сделать пользователя администратором в Windows 10 (в Windows 11 действия аналогичны).
В сценарии, когда компьютер контролируется не вами, права администратора вам предоставить не готовы, команды вы выполнить не сможете (разве что обходными путями, такими как сброс пароля для учетной записи администратора).
Итак, опишем проблему с сервисом печати (print spooler) на сервере, в крупной фирме, где есть много разномастных принтеров, подключенных в терминальном режиме.
0. Суть ошибки
Эта проблема появляется в остановке сервиса печати при работе в терминале с удаленного офиса. Ошибка происходит в терминале и принтер перестает принимать документы на печать, при чем на сервере появляется «клон» принтера, и на нем начитается выстраиваться очередь на печать, а фактически печать документов не происходит.
1. Причины ошибки
Происходит ошибка в очереди печати, или если возникла ошибка при печати на принтере, либо при отмене какого-нибудь документа, либо после небольшого разрыва связи, либо при отправке документов одновременно несколькими пользователями на печать. Тогда начинается паника в офисе, а если еще и нужно срочно распечатать какой-нибудь отчет, начинаются звонки сисадминам, с криками: «СПАСИТЕ!!!ПОМОГИТЕ!!!! НЕВОЗМОЖНО РАБОТАТЬ!!!! ДА КОГДА ЖЕ ЭТО ВСЕ ПРЕКРАТИТСЯ!!!!» — и т. д. Вот сейчас мы и опишем, как можно исправить данную неприятность в операционных системах семейства Windows.
2. Решение
Решается данная проблема перезапуском сервера печати, т. е. службы prints pooler. (Подробно о службе prints pooler можно прочитать вот здесь). Чтоб перезапустить данную службу (как и любую другую) необходимо выполнить 2 команды:
net stop spooler
net start spooler
Если операцию приходится выполнять периодически, удобнее создать «костыль» в виде файла c расширением «.bat», проще говоря «батника».
Откроем простой блокнот (удобнее всего использовать программу NotePad++) и напишем там 2 вышеназванные строчки. Сохраним этот файл, поставив расширение .bat вместо .txt, назвав его «перезапуск службы печати» или как нибудь еще, как удобнее. При запуске этого файла будет происходить перезапуск службы печати.
На скриншоте выше добавлен оператор pause в конце что бы показать работу bat-файла.
Запись опубликована в рубрике cmd с метками cmd, Windows Server 2008. Добавьте в закладки постоянную ссылку.
System error 5: Access is denied is an error message that prevents users from installing some software. It usually pops up due to a lack of account permissions. Running a command on Windows where you need administrative rights will probably give rise to System Error 5.
This error can be quite annoying, especially if you need to run a certain command. This article will give you different ways to fix System error 5 on your Windows 10, 8, 7, and Vista.
What Is The “System Error 5 Has Occurred Access Is Denied” Error?
System error 5 is an error access denied code which means that your access is denied because you don’t have the required privileges to run a certain command. For example, when you try to run a command which is supposed to stop the print spooler, you will get an error message.
Why Causes The “System 5 Error Has Occurred” Message?
- Time Synchronization Problem
If your PC’s time has been set up wrongly, that can lead to the System 5 error. You can resolve it by enabling the time sync feature on the PC to ensure your system’s time is always running right. In addition to that, your system should have the correct time zone as per the region you live in.
- Account You Are Trying To Access Is Disabled or Doesn’t Exist On The Domain
If the account on your PC has been disabled or doesn’t exist in the specific domain name, you can get System error 5 . Ensure that the account you wish to access exists and is enabled on your domain. You might use the “netdom” command-line utility on the PC.
- Missing Permission To Access Remote Computer
If you are attempting to access a remote computer, make sure you have the required permissions. Your PC might throw the system error 5 if any required permission is missing. You won’t have any problems with all the permissions required from the remote computer.
- Command Requires Elevated System Privileges
Some commands like the ones that manage different Windows services like net use, net start, etc. require special privileges to be executed. For example, the print spooler service is a core Windows service that needs to run always. So, if you need to stop it for some reason, you will need elevated system privileges to execute it. Note that logged in as an Administrator won’t be enough in this case.
Users who try to run the command to stop the print spooler service usually get the System error 5 messages.
Fixing the “System error 5 has occurred” requires you to open the elevated command prompt window and run the command again. This will give you proper administrator privileges to run the commands you are getting stuck with.
- How To Fix The “System Error 5” in Windows 10/8?
- How To Fix “System Error 5 Has Occurred” On Windows 8?
- How to Fix System Error 5 on Windows 7?
- How to Fix System Error 5 on Windows Vista?
How To Fix The “System Error 5” in Windows 10/8?
System error 5 is not a major issue and can be solved if you follow a couple of simple instructions. Given below are the steps you need to follow to resolve the System error 5 on Windows 10/8:
- Press the Windows + X key on the keyboard and select the Command prompt (Admin) option or the Windows Powershell (Admin) option. This will open the elevated command prompt window.
- You will receive a prompt on the screen asking if you want the command prompt app to make changes to your device. Click the Yes button and proceed.
- If it still gives the error, try running the following command:
net local administrators
- You will get the names of all administrators on your device. If your name is not present or incorrect, you are not an administrator. So, first, you need to set yourself as an administrator and then, try the method.
You can go to the Windows search box and type in Command Prompt. Right-click on the option from the search results that says Command Prompt and then, click on Run as administrator. When prompted if you want to allow the device to make changes, click on Yes.
Now, you can begin executing the commands and the System error 5 has occurred error won’t come up again.
How To Fix “System Error 5 Has Occurred” On Windows 8?
- Press the Windows key on your keyboard. This will open the Windows 8 start screen for you.
- Type in cmd in the search box.
- From the search results under the Apps header, right-click Command Prompt and click on the Run as administrator option.
- Now, a User Account Control box might come up. Click on the Yes button, this will permit the app to make changes to the control.
- A black command prompt window will come up with its title bar named – Administrator: Command Prompt. That shows that this command prompt is running with some elevated privileges.
- Try running the command that wouldn’t run earlier. It should run properly now.
How to Fix System Error 5 in Windows 7?
- Click on the Start menu and type cmd in the search box. Press the Enter key.
- Right-click on the search result that says cmd.exe. Then, click on the Run as administrator option.
- A User Account Control box might open up, click on Yes to confirm that you want to allow the program to make changes to the PC.
- Enter the following commands one by one:
net user
net user administrator
Enter the password and re-enter it. This should fix the system error 5.
How to Fix System Error 5 on Windows Vista?
- Click on the Windows Start button located at the screen’s bottom.
- Now, type in “cmd” in the Start search box.
- From the search results under Programs, right-click on the result that reads “cmd”. From the drop-down menu, select the “Run as administrator” option.
- A User Account Control box might come up. Click the Yes button. This allows the program to make changes to your system.
- Try running some commands to check if the error is gone or not.
What If Running Command Prompt with Administrative Privileges Failed?
If you can’t open the command prompt with administrative permissions due to some reason, you may have Registry issues. It is much likely that certain registry entries are preventing you from launching a command prompt session with elevated privileges. Here’s how you can remove the corrupt Windows registry entries:
- Press the Windows + R keys to launch the Run utility. Type in regedit and hit the Enter key.
- Go to the following path:
HKEY_CURRENT_USERSoftwareMicrosoftOfficeFrontPageAddins
- Right-click on the entry named FPE.com.AddIn and click on Delete
- Restart your system and the error should be gone.
Alternative Way To Fix The System Error 5: Modify Registry
- Go to the Windows search bar and type in regedit. Click on the option that says Registry Editor.
- From left panel, go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
- Click on Edit and then on Add Value
- The new value you are adding should be named MinFreeConnections
- Next, click on Add > New > REG_DWORD
- Set the new key’s value to 5 and then, close the Registry Editor. Then, right-click on the Windows key and click on Control Panel
- Then, click on Network and find the Installed Network Software. Now, under the Installed Network Software, select Server and click on Configure
- Find the Optimization option and choose Maximize Throughput for File Sharing. Click on OK.
- Then, open Start and type in cmd. Right-click on the search result and select Run as administrator.
- Type in net stop server and net start server. Press Enter after each of these commands.
- Navigate to the following path: HKEY_CURRENT_USER\Software\Microsoft\Office\FrontPage\Addins\
- Next, look for the FPE.com.AddIn entry name and right-click on it and then, choose Delete.
- When it is removed, Restart your machine and check if the error is gone.
Final Words
The above guide discusses how to get rid of the System 5 error on Windows 10, 8, 7, and Vista. We hope the step-by-step instructions in this article were easy to understand and helped you eliminate the error.
When I try to start a service I created in Visual Studio I receive the following error:
System error 5 has occurred.
Access is denied.
I am running the command line with elevated privileges, so it’s not that problem. Is there any place I can look to see what error is occuring.
abatishchev
97.7k86 gold badges295 silver badges432 bronze badges
asked Feb 22, 2009 at 5:37
To get it to work I needed to add permissions to the output bindebug folder for my service project.
The Local Service account didn’t have permissions to the output .exe file, and this was why the error was occuring.
answered Feb 22, 2009 at 5:58
Daniel ODaniel O
2,8103 gold badges28 silver badges35 bronze badges
6
Had the same issue.
Fixed by running the service under «Local System Account»
answered Sep 16, 2013 at 10:55
Oleksandr GOleksandr G
2,0503 gold badges22 silver badges31 bronze badges
0
In my case the solution was even that simple: Run Command Prompt as administrator.
johnnyRose
7,25017 gold badges40 silver badges61 bronze badges
answered Sep 3, 2012 at 11:24
hfrmobilehfrmobile
1,15614 silver badges16 bronze badges
1
I see you’ve fixed the problem; but in reality, you shouldn’t normally be running the service from a project’s bin folder anyway — the files should be put somewhere project and profile independent (for example, under program files). For debugging purposes (when it will be in the bin folder), you can detect whether it is a service in Main()
, and if it is being run interactively just run the service code directly, rather than the usual service-start setup.
You can detect either by adding a command line argument, or you can try checking Environment.UserInteractive
.
answered Feb 22, 2009 at 9:23
Marc GravellMarc Gravell
1.0m263 gold badges2555 silver badges2891 bronze badges
3
The Local Services account doesn’t seem to be privileged to control a service. So, in the service’s LogOn Property, change the account type to Local System and allow service to interact with desktop.
Also, make sure that, you install the service using instalutil, as an administrator.
Lastly, when you want to run a service from the command prompt using the «net start [service name]» command, you have to run the command prompt as an administrator.
answered Dec 27, 2014 at 18:59
IshrakIshrak
4991 gold badge9 silver badges17 bronze badges
I had the same problem because my project and its source code was in a folder that had NTFS’s Encrypting File System (EFS) enabled. This caused by compiled assemblies being encrypted aswell and the user running my service didn’t have permissions to decrypt them. Removing EFS was the easy solution for this. It can be done by command line using CIPHER.EXE, which is a Windows tool.
answered Jan 28, 2010 at 7:07
Do not simply start the service under a different username or admin. (Unless your service actually requires admin privileges of course!) This is a security hole and creates a bad user experience.
The actual issue is that the service hasn’t been assigned any permissions in the first place.
However, it must be noted that Microsoft didn’t exactly make them easy to change — service permissions are similar to regular file permissions but unfortunately cannot be altered with a simple right click. They can however be read via:
sc.exe sdshow <service name>
And written via:
sc.exe sdset <service name> <permissions>
<service name>
is your service name.<permissions>
is the permissions in SDDL format.
So use sdshow
to get the permissions, then sdset
to update them with your requirement(s). SDDL a cacophony of seemingly random letters beyond the scope of this post and more reminiscent of Unix than Windows.
In short instance adding the descriptor (A;;RPWP;;;WD)
would allow (A
) everyone (WD
) to start (RP
) and stop (WP
) the named service.
answered Dec 7, 2020 at 9:06
c zc z
7,5023 gold badges44 silver badges59 bronze badges
I had the same problem when I migrated a service from vs05 to vs2010, from framework 2.0 till framework 4.0 at the same time. I got Access denied. As soon as a change back to framework 2.0 it worked again. The ?%¤#%&%& problem was that the initializing string for the service was incorrect (?!). The string expected quotes at the beginning and at the end!
Before….path + service name» «/parameter=1 ‘ this had worked with framework 2.0
After….»path + service name» «/parameter=1»
Access Denied has nothing to do with the problem. Why not «Path not found » or «missing parameter»
answered Oct 16, 2013 at 6:32
A user account with administrator rights will prompt “are you sure?” in situations where the administrator account is not prompted. I had this problem with net stop netprofm.
To remove the prompt do this.
Control Panel, User Accounts, Change User Account Control settings, never notify
This seems to provide the user account with admin rights the same behavior as a the administrator account.
answered Mar 7, 2016 at 16:42
Run it from Task Scheduler with highest privileges and it will work.
johnnyRose
7,25017 gold badges40 silver badges61 bronze badges
answered Mar 4, 2016 at 18:05
Just ran into this issue after I had run an ‘sc config’ to change binPath of the service.
The only fix that worked for me was to ‘sc delete’ the service and install again.
Things worked perfectly after that.
answered Apr 23, 2017 at 22:33
Содержание
- Устраняем ошибку 5 при доступе к данным
- Способ 1: Запуск с привилегиями администратора
- Способ 2: Открытие доступа к каталогам
- Способ 3: «Командная строка»
- Способ 4: Устранение проблем с Виндовс
- Заключение
- Вопросы и ответы
В некоторых ситуациях пользователи операционной системы Виндовс 10 могут столкнуться с проблемой, когда попытка открыть файл, папку или программу приводит к появлению ошибки с кодом 5 и текстом «Отказано в доступе». Также она нередко возникает при попытке запуска или перезапуска служб. Далее мы расскажем о причинах появления этого сбоя и предложим методы его устранения.
Устраняем ошибку 5 при доступе к данным
В большинстве случаев источником ошибки являются проблемы с правами на чтение и запись данных в текущей пользовательской «учётке». Также подобное сообщение появляется при сбоях в ОС, повреждении её компонентов или записей реестра.
Способ 1: Запуск с привилегиями администратора
Если открытие исполняемого файла программы, игры либо инсталлятора приложения приводит к появлению рассматриваемой ошибки, следует попробовать запустить его от имени администратора.
- Убедитесь, что у текущей учётной записи нужные права есть. Если это не так, предоставьте или получите их.
Урок: Получение прав администратора на Windows 10
- Перейдите к проблемному файлу. Выделите его, нажмите правую кнопку мыши и выберите в меню пункт «Запуск от имени администратора».
- Появится всплывающее окно с запросом на разрешение, щёлкните в нём «Да».
Далее приложение или инсталлятор должны запуститься нормально.
Способ 2: Открытие доступа к каталогам
Вторая причина проблемы, которую мы сегодня рассматриваем – неполадки с правами доступа к отдельному каталогу или диску. Предоставление нужных прав покажем на примере системного диска.
Внимание! Процедура может нарушить работу компьютера, поэтому рекомендуем создать точку восстановления!
Урок: Точка восстановления в Windows 10
- Откройте «Этот компьютер», найдите в нём системный накопитель и кликните по нему ПКМ, затем выберите в меню пункт «Свойства».
- Откройте вкладку «Безопасность». Нажмите на кнопку «Изменить» под блоком «Группы и пользователи».
Далее кликните «Добавить».
- В следующем окне обратитесь к блоку «Введите имена…». Наберите на клавиатуре слово
Все
, после чего щёлкните «Проверить имена».
Если появилось окошко «Имя не найдено», попробуйте в графе «Введите имя объекта» вписать слово
All
либо имя текущей учётной записи, после чего воспользуйтесь кнопкой «ОК». - Вернувшись к утилите разрешений, убедитесь, что выделена добавленная на предыдущем шаге группа. Далее в разделе «Разрешения для группы…» отметьте все пункты в столбце «Разрешить».
- Далее последовательно щёлкните «Применить» и «ОК», после чего перезагрузите компьютер.
Предоставление прав на чтение и запись системного носителя одновременно устраняет ошибку 5 как для исполняемых файлов, так и для служб, однако данная процедура небезопасна для работоспособности системы.
Способ 3: «Командная строка»
Рассматриваемая проблема может касаться только той или иной службы Виндовс. В этом случае можно воспользоваться средством «Командная строка».
- Откройте «Поиск», в котором начните вводить запрос
командная строка
. Выделите найденное приложение и нажмите на ссылку «Запуск от имени администратора» в правой части окна. - Последовательно введите в интерфейсе следующие команды:
net localgroup Администраторы /add networkservice
net localgroup Администраторы /add localservice
Обратите внимание! Пользователям Windows 10 с английской локализацией системы необходимо вводить Administrators вместо Администраторы!
- Закрывайте окно программы и перезагружайте ПК или ноутбук.
Данный метод безопаснее предыдущего, но и применим только при отказе в доступе для служб.
Способ 4: Устранение проблем с Виндовс
Если применение всех вышеприведённых методов не принесло результата, скорее всего источником проблемы являются неполадки в самой ОС.
- Первым делом проверьте обновления – возможно, в одном из недавно установленных присутствуют баги. Если же, напротив, вы давно не обновляли систему, попробуйте загрузить актуальные апдейты.
Урок: Как установить и как удалить обновления Windows 10
- Проверьте параметры антивируса – возможно, в нём активен строгий режим контроля, который не разрешает манипуляции с данными. Также стоит попробовать временно отключить защитное ПО.
Урок: Как отключить антивирус
Если же вы по каким-то причинам вообще не пользуетесь защитой от вирусов, рекомендуем ознакомиться со статьей по борьбе с ними — возможно, ваш компьютер стал жертвой заражения.
Подробнее: Борьба с компьютерными вирусами
- Дополнительно следует проверить работоспособность системных составляющих в целом и реестра в частности.
Подробнее:
Проверка и восстановление системных файлов в Windows 10
Восстановление реестра в Windows 10
Описанные выше рекомендации должны помочь в устранении проблемы.
Заключение
Мы рассмотрели варианты решения проблемы, при которой в Виндовс 10 появляется ошибка с кодом 5 и текстом «Отказано в доступе». Как видим, возникает она по разным причинам, из-за чего нет универсального метода устранения.
Еще статьи по данной теме: