Скрипт входа в систему отрабатывает с задержкой в 5 минут
Скрипт входа в систему отрабатывает с задержкой в 5 минут
Добрый день! Уважаемые читатели и гости крупного IT блога России Pyatilistnik.org. В прошлый раз я вас научил делать резервную копию файлов и папок с помощью утилиты Robocopy. Сегодня я хочу вам рассказать еще об одной ситуации, которая случилась в моей административной практике, а именно по какой то причине скрипты и сценарии настроенные на вход пользователя в систему не отрабатывают сразу, а выполняются с задержкой в 5 минут. Мне стало интересно разобраться в данной ситуации и естественно поправить время выполнения моих скриптов. Думаю, что найдутся люди, кто так же зададутся данным вопросом.
Описание ситуации
Есть терминальная RDS ферма построенная на базе операционной системы Windows Server 2012 R2, состоящая из 15 RDSH хостов. Для удобства пользователей использующих программу 1С, был настроен через групповую политику скрипт, который при входе пользователя в систему должен был подтянуть конфигурационный файл с необходимым списком баз 1С. Но получилась такая ситуация, что пользователь заходит, видит свой рабочий стол, открывает программу 1С и баз там нет, через 5 минут, перезапустив 1С они магическим образом появляются. Давайте разбираться, что это за задержка и как от нее избавится.
Откуда берется 5-ти минутная задержка
Оказывается с выходом операционных систем Windows Server 2012 R2 и Windows 8.1 компания Microsoft ввела некоторое изменение с применением сценариев и скриптов при входе пользователя в систему. После входа пользователя на компьютер под управлением Windows 8.1 и Windows Server 2012 R2 сценарии входа не запускаются в течение пяти минут. Такое поведение вызывает следующие симптомы:
- Операции, выполняемые сценариями входа в систему, могут не отображаться на компьютерах под управлением Windows 8.1 и Windows Server 2012 R2 в течение пяти минут после входа пользователя в систему.
- Ресурсы, предоставляемые сценариями входа в систему, могут быть недоступны пользователям на компьютерах под управлением Windows 8.1 и Windows Server 2012 R2 в течение примерно пяти минут после входа пользователей.
Microsoft ввела данную задержку из-за того, чтобы улучшить ситуацию, когда большое количество скриптов, сценариев, выполняемых при логине пользователя в систему вступают в конфликтную ситуацию, что он даже не может попасть на свой рабочий стол. Данная настройка называется » Настроить задержку сценария входа (Configure Logon Script Delay)». По умолчанию она имеет значение в 5 минут, этого достаточно, чтобы пользователь вошел в систему, которая успела прогрузить все из автозагрузки, после чего к нему можно применять сценарии.
Как убрать 5-ти минутную задержку выполнения сценариев при входе в систему
Так как у вас есть домен Active Directory и вы все настройки выполняете через групповую политику, то откройте редактор групповой политики, найдите нужное вам организационное подразделение, создайте там политику или измените существующую. Нужная нам настройка находится в разделе компьютера, переходим по пути:
Открываем политику «Настроить задержку сценария входа». Режимы работы:
- Если стоит значение по умолчанию, то будет отложенное выполнение скриптов через 5 минут
- Если выставлено значение отключено, то сценарии входа будут выполнятся сразу
- Если поставите 0, то так же политика будет отключена и все будет выполняться сразу при входе, именно данный вариант и советует сама Microsoft
- Так же вы можете выставить другое значение, вплоть до 1000 минут.
Сохраняем настройку и давайте посмотрим как будет применяться политика при входе пользователя Барбоскина на терминальную ферму. Для этого откройте журналы логов Windows. Нас будет интересовать журнал Microsoft-Windows-GroupPolicy/Operational. Зашел я на терминальный сервер в 18-42 минуты.
Script logon windows server 2012
The following forum(s) have migrated to Microsoft Q&A: All English Windows 8.1 IT Pro forums!
Visit Microsoft Q&A to post new questions.
Asked by:
Question
We recently replaced some Windows 2008 R2 EE servers with Windows Server 2012 DCE servers.
We use GPO User Policy to kick off logon scripts written in VBS to map some drives depending on group membership.
The logon script executes correctly on all remaining Windows 2008 R2 Servers and Windows XP and Windows 7 clients.
It does not show any mapped drives in File Explorer on Windows Server 2012. But, if I use a sub-dialog that engages the File Explorer shell, such as when deciding on the location for a new Hyper-V machine location, I can see all the drives that are mapped.
So at first, it appeared the mappings were not executing at all, but now it appears that they are simply hidden from view in File Explorer and most other ways to access the files system.
I remember with Windows Server 2008 R2 and Windows 7 (and Vista) you had to EnableLinkedConnections in the registry at the key:
Add a key EnableLinkedConnections Setting a DWORD value to = 1
I am not sure if this still applies in Windows Server 2012 and also while that key technically exists, the key is named policies with a lowercase ‘p’.
Although that is a small thing, sometimes registry keys are case sensitive to the dll or application that is reading them or writing them.
Any advice would be appreciated.
All replies
It is NOT a problem with Group Policy. Group Policy works completely correctly. The problem is Windows Server 2012 DOES NOT reflect the execution of VBS logon scripts that are being successfully delivered via Group Policy.
The mention of Group Policy was merely to establish the delivery mechanism. The script execute successfully when executed manually. The seem to have been run as, if you would please read the post completely, you would see that in other File Explorer shell dialogs, the mapped drives are showing, but in File Explorer application they are not.
Please read the entire post. If it needs to be put into another forum I will reports, but it is NOT a GROUP POLICY issue.
Regarding mapping drive with Group Policy setting, please also refer to the method about GPP:
Using Group Policy Preferences to Map Drives Based on Group Membership
Nicholas Li
TechNet Community Support
As much as I appreciate the replies folks, please read the problem before commenting.
1. The GPO is mentioned because it is what initiates a VBS logon script. IT WORKS FOR ALL CLIENTS XP, and Windows 7 (Since they are all modified with the registry key setting ‘EnableLinkedConnections=1’ DWORD. I suspect this has to be applied to Windows Server 2012/Windows 8 for the script to execute, but on Windows Server 2012, the key name is slightly different in capitalization and I am not sure it applies or should be tampered with.
2. If the above is not the issue, the script will execute with no problem when run manually after logon but does not show any mapped drives in File Explorer when run by GPO. It does however without manually executing the script (GPO invoked) show mapped drives when using a browse dialog, as in the case of selecting a folder for a Hyper-V child, but not in File Explorer.
3. I am not experiencing any problem with group policy and choose to use logon scripts written in VBS to setup the initial user environment. I plan to convert this to powershell eventually. But right now they are VBS scripts.
If you need me to elaborate, please let me know.
Script logon windows server 2012
The following forum(s) have migrated to Microsoft Q&A: All English Windows Server forums!
Visit Microsoft Q&A to post new questions.
Answered by:
Question
We have created a new Active Directory domain and created all the needed users.
When a user logs in to the domain with his pc it should get a mapping of another server.
It should do a net use:
net use i: \\serverY\share pw /user:user1
I would like to create a login script . I specified in the user profile username.bat
But this uername.bat is not created \\server\SYSVOL and I connect write in it .
Answers
I wrote this FAQ years ago to explain:
You must specify the logon script on the profile tab in ADUC for the user, then create the file in the correct folder on one domain controller. The folder is:
This folder gets replicated to all domain controllers in the domain.
Or you can consider configuring a logon script in a Group Policy. That is also explained in the FAQ.
Richard Mueller — MVP Enterprise Mobility (Identity and Access)
- Proposed as answer by Ethan Hua Microsoft contingent staff Monday, February 1, 2016 2:58 AM
- Marked as answer by joerifeyen Tuesday, February 2, 2016 9:43 AM
All replies
I wrote this FAQ years ago to explain:
You must specify the logon script on the profile tab in ADUC for the user, then create the file in the correct folder on one domain controller. The folder is:
This folder gets replicated to all domain controllers in the domain.
Or you can consider configuring a logon script in a Group Policy. That is also explained in the FAQ.
Richard Mueller — MVP Enterprise Mobility (Identity and Access)
- Proposed as answer by Ethan Hua Microsoft contingent staff Monday, February 1, 2016 2:58 AM
- Marked as answer by joerifeyen Tuesday, February 2, 2016 9:43 AM
For individual user, you can assign logon scripts through the «Active Directory Users and Computers» console as mentioned by Richard above. In this way, you can assign each user a separate logon script.
If you want to assign the same logon script to all users, you can do this as part of a group policy. In this way, all users who are members of the site, domain, or organizational unit — or all three, execute scripts automatically when they log on: