What is windows logon script

How to assign a logon script to a profile for a local user

This article describes how to assign a logon script to a profile for a local user.

Original product version: В Windows Server 2012 R2
Original KB number: В 324803

Summary

This article describes how to assign a logon script to a profile for a local user’s account in Windows Server 2003. This logon script runs when a local user logs on locally to the computer. This logon script does not run when the user logs on to the domain.

You must be logged on as Administrator or as a member of the Administrators group to complete this procedure. If your computer is connected to a network, network policy settings may also prevent you from completing this procedure.

How to assign a logon script to a user’s profile

Click the Start, point to Administrative Tools, and then click Computer Management.

In the console tree, expand Local Users and Groups, and then click Users.

In the right pane, right-click the user account that you want, and then click Properties.

Click the Profile tab.

In the Logon script box, type the file name (and the relative path, if necessary) of the logon script.

If the logon script is stored in a subfolder of the default logon script path, put the relative path to that folder in front of the file name. For example, if the Startup.bat logon script is stored in \\ComputerName\Netlogon\FolderName, type FolderName\Startup.bat .

Click Apply, and then click OK.

Logon scripts that are stored on the local computer apply only to users who log on to the local computer.

Local logon scripts must be stored in a shared folder that uses the share name of Netlogon, or be stored in subfolders of the Netlogon folder.

The default location for local logon scripts is the Systemroot\System32\Repl\Imports\Scripts folder. This folder is not created on a new installation of Windows. Therefore, the SystemRoot\System32\Repl\Imports\Scripts folder must be created and shared out by using the Netlogon share name.

If you do not want to create the Netlogon share in the default location, put the logon script in any folder that the user can access during logon, and then share this folder.

Using Startup, Shutdown, Logon, and Logoff Scripts in Group Policy

This topic contains procedures for using the GPMC tool to configure and run four types of Group Policy.

This topic describes how to install and use scripts on a domain controller. If you want information about script use for the local computer, see Working with startup, shutdown, logon, and logoff scripts using the Local Group Policy Editor.

Group Policy allows you to associate one or more scripting files to four triggered events:

You can use Windows PowerShell scripts, or author scripts in any other language supported by the client computer. Windows Script Host (WSH) supported languages and command files are also used, including VBScript and Jscript.

How to set up scripts on the domain controller

To set up scripts on the domain controller

  1. Copy the script and dependent files to the Netlogon shared folder on the domain controller.

Additional considerations

You must be a member of the Domain Administrators security group to configure scripts on a domain controller.

How to assign computer startup scripts

To assign computer startup scripts

Open the Group Policy Management Console (GPMC). Right-click the Group Policy Object you want to edit, and then click Edit.

In the console tree, click Scripts (Startup/Shutdown). The path is Computer Configuration\Policies\Windows Settings\Scripts (Startup/Shutdown).

In the results pane, double-click Startup.

In the Startup Properties dialog box, click Add.

In the Add a Script dialog box, do the following:

In Script Name, type the path of the script, or click Browse to search for the script file in the Netlogon shared folder on the domain controller.

Читайте также:  Hdd tools windows 10

In Script Parameters, type any parameters that you want, exactly as you would type them on the command line. For example, if your script includes parameters called //logo (display banner) and //I (interactive mode), type //logo //I.

In the Startup Properties dialog box, specify the options that you want:

Startup Scripts for : Lists all the scripts that currently are assigned to the selected GPO. If you assign multiple scripts, the scripts are processed in the order that you specify. To move a script up in the list, click it, and then click Up. To move a script down in the list, click it, and then click Down.

Add: Opens the Add a Script dialog box, where you can specify any additional scripts to use.

Edit: Opens the Edit Script dialog box, where you can change script information, such as name and parameters.

Remove: Removes the selected script from the Startup Scripts list.

Show Files: Displays the script files that are stored in the selected GPO.

Additional considerations

Startup scripts are run under the Local System account, and they have the full rights that are associated with being able to run under the Local System account.

Startup scripts are run asynchronously, by default.

Setting startup scripts to run synchronously may cause the boot process to run slowly.

Startup scripts that run asynchronously will not be visible. Enabling the Run Startup Scripts Visible Group Policy setting has no effect when you are running startup scripts asynchronously.

How to assign computer shutdown scripts

To assign computer shutdown scripts

Open the Group Policy Management Console. Right-click the Group Policy object you want to edit, and then click Edit.

In the console tree, click Scripts (Startup/Shutdown). The path is Computer Configuration\Policies\Windows Settings\Scripts (Startup/Shutdown).

In the results pane, expand Shutdown.

In the Shutdown Properties dialog box, click Add.

In the Add a Script dialog box, do the following:

In Script Name, type the path of the script, or click Browse to search for the script file in the Netlogon shared folder on the domain controller.

In Script Parameters, type any parameters that you want, exactly as you would type them on the command line. For example, if your script includes parameters called //logo (display banner) and //I (interactive mode), type //logo //I.

In the Shutdown Properties dialog box, specify the options that you want:

Shutdown Scripts for : Lists all the scripts that are currently assigned to the selected Group Policy object (GPO). If you assign multiple scripts, the scripts are processed in the order that you specify. To move a script up in the list, click it, and then click Up. To move a script down in the list, click it, and then click Down.

Add: Opens the Add a Script dialog box, where you can specify any additional scripts to use.

Edit: Opens the Edit Script dialog box, where you can change script information, such as name and parameters.

Remove: Removes the selected script from the Shutdown Scripts list.

Show Files: Displays the script files that are stored in the selected GPO.

Additional considerations

Shutdown scripts are run as Local System, and they have the full rights that are associated with being able to run as Local System.

Setting shutdown scripts to run synchronously may cause the shutdown process to run slowly.

How to assign user logon scripts

To assign user logon scripts

Open the Group Policy Management Console. Right-click the Group Policy object you want to edit, and then click Edit.

In the console tree, click Scripts (Logon/Logoff). The path is User Configuration\Policies\Windows Settings\Scripts (Logon/Logoff).

In the results pane, expand Logon.

In the Logon Properties dialog box, click Add.

In the Add a Script dialog box, do the following:

In Script Name, type the path of the script, or click Browse to search for the script file in the Netlogon shared folder on the domain controller.

In Script Parameters, type any parameters that you want, exactly as you would type them on the command line. For example, if your script includes parameters called //logo (display banner) and //I (interactive mode), type //logo //I.

In the Logon Properties dialog box, specify the options that you want:

Logon Scripts for : Lists all the scripts that currently are assigned to the selected Group Policy object (GPO). If you assign multiple scripts, the scripts are processed in the order that you specify. To move a script up in the list, click it, and then click Up. To move a script down in the list, click it, and then click Down.

Читайте также:  Дистрибутив windows 10 pro x64 iso

Add: Opens the Add a Script dialog box, where you can specify any additional scripts to use.

Edit: Opens the Edit Script dialog box, where you can change script information, such as name and parameters.

Remove: Removes the selected script from the Logon Scripts list.

Show Files: Displays the script files that are stored in the selected GPO.

Additional considerations

Setting logon scripts to run synchronously may cause the logon process to run slowly.

Logon scripts are run as User, not Administrator, and their rights are limited accordingly.

How to assign user logoff scripts

To assign user logoff scripts

Open the Group Policy Management Console. Right-click the Group Policy object you want to edit, and then click Edit.

In the console tree, click Scripts (Logon/Logoff). The path is User Configuration\Policies\Windows Settings\Scripts (Logon/Logoff).

In the results pane, expand Logoff.

In the Logoff Properties dialog box, click Add.

In the Add a Script dialog box, do the following:

In Script Name, type the path of the script, or click Browse to search for the script file in the Netlogon shared folder on the domain controller.

In Script Parameters, type any parameters that you want, exactly as you would type them on the command line. For example, if your script includes parameters called //logo (display banner) and //I (interactive mode), type //logo //I.

In the Logoff Properties dialog box, specify the options the you want:

Logoff Scripts for : Lists all the scripts that currently are assigned to the selected Group Policy object (GPO). If you assign multiple scripts, the scripts are processed in the order that you specify. To move a script up in the list, click it, and then click Up. To move a script down in the list, click it, and then click Down.

Add: Opens the Add a Script dialog box, where you can specify any additional scripts to use.

Edit: Opens the Edit Script dialog box, where you can change script information, such as name and parameters.

Remove: Removes the selected script from the Logoff Scripts list.

Show Files: Displays the script files that are stored in the selected GPO.

Additional considerations

Logoff scripts are run as User, not Administrator, and their rights are limited accordingly.

Setting logoff scripts to run synchronously may cause the logoff process to run slowly.

What is a logon script in windows 7

What is a logon script in windows 7

Проблема в отработке логон батников и *.vbs.
Просто не отрабатываются, но руками из того же местоположения работают. На ХП все прекрасно работает.
Ошибок в журналах не пишется.
UAC отключен, включать тоже пробовал, политика на ожидание сетевого подключения включена, синхронная отработка не помогла, задержка в коде скрипта так же результатов не дала.
Спасите.

Сообщения: 51577
Благодарности: 14800

Конфигурация компьютера
Материнская плата: ASUS P8Z77-V LE PLUS
HDD: Samsung SSD 850 PRO 256 Гб, WD Green WD20EZRX 2 Тб
Звук: Realtek ALC889 HD Audio
CD/DVD: ASUS DRW-24B5ST
ОС: Windows 8.1 Pro x64
Прочее: корпус: Fractal Design Define R4

Если же вы забыли свой пароль на форуме, то воспользуйтесь данной ссылкой для восстановления пароля.

Сообщения: 55
Благодарности: 2

Сообщения: 55
Благодарности: 2

Юзерские скрипты без проблем выполняются.

Через Rsop видно, что скрипты для ПК ни разу не отрабатывались.

Сообщения: 51577
Благодарности: 14800

Конфигурация компьютера
Материнская плата: ASUS P8Z77-V LE PLUS
HDD: Samsung SSD 850 PRO 256 Гб, WD Green WD20EZRX 2 Тб
Звук: Realtek ALC889 HD Audio
CD/DVD: ASUS DRW-24B5ST
ОС: Windows 8.1 Pro x64
Прочее: корпус: Fractal Design Define R4

DOCznet, включите лог Gpsvc.log и посмотрите в нем (после перезагрузки).

Сообщения: 55
Благодарности: 2

Проблема решена.
То ли глюк, то ли так задумано. вобщем дело было в следующем:

What is a logon script in windows 7

Вопрос

These login script trouble and other various problems were discuess to death but I got another one for you:

In the Windows 2003 Server enviroment, we have some Windows 7 workstations/laptops. Now I have compiled togehter logon script, that has no errors in it and is distributed by default domain policy. Now the script definately runs — BUT — only in Windows 7 I get this strange behaviour; it does not connect network drives defined in it, but if I go to the server share and run it manually, the drives are connected corectly and are there. I tried this with UAC on and off, I tried sleep the script, I tried to distribute it trough user policy — nothing seems to work. Can aynone shine some ligh on this issue and how to proceed?

Note that other settings are processed just fine. foe example I added the strMsgBox to test it out and the message box is opened just fine so the iteration goes trough mapping drives logic.

Ответы

I don’t have it in front of me so I’ll go off of memory and just the logic. Our script basically does this:

check for windows version
if «6.1» goto :Win7
if «whatever XP was» goto :XP
. etc

If %variable on computer or AD% = personnel then
goto :PER
If %variable on computer or AD% = engineering then
goto :ENG
.
. etc

:PER
net use x: /delete
net use y: /delete
net use z: /delete
net use x: \\computer name \share name /persistent
net use y: \\computer name \share name /persistent
net use z: \\computer name \share name /persistent
.
check personnel app versions.
. other stuff

:ENG
net use a: /delete
net use b: /delete
net use c: /delete
net use a: \\computer name \share name /persistent
net use b: \\computer name \share name /persistent
net use c: \\computer name \share name /persistent

check engineering app versions.
. other stuff
.
.
goto :EOF

Or you could just have it call a different batch or .vbs file for each dept./OS/etc

Or depending on how many variations of drive mappings you have. if you don’t have too many you could as you said just make a GPO for each and scope them accordingly.

As for the logon process time, I know our XP boxes take quite awhile to logon but our 7 boxes w/ the same scripts take about 1/4 the time. I disabled the logon script section for 7 and have been using just Group Policy for about 2 months now and 7 is still a day & night different to our XP boxes running solely on scripts for things like that. Your environment may be radically different that ours so I couldn’t say which is best for you. I hope that helps.

Все ответы

These login script trouble and other various problems were discuess to death but I got another one for you:

In the Windows 2003 Server enviroment, we have some Windows 7 workstations/laptops. Now I have compiled togehter logon script, that has no errors in it and is distributed by default domain policy. Now the script definately runs — BUT — only in Windows 7 I get this strange behaviour; it does not connect network drives defined in it, but if I go to the server share and run it manually, the drives are connected corectly and are there. I tried this with UAC on and off, I tried sleep the script, I tried to distribute it trough user policy — nothing seems to work. Can aynone shine some ligh on this issue and how to proceed?

Note that other settings are processed just fine. foe example I added the strMsgBox to test it out and the message box is opened just fine so the iteration goes trough mapping drives logic.

I experienced the same issue and simply settled on mapping drives w/ Group Policy Preferences. Works fine for XP & 7.

We had similar issues after XP SP3 which required us to forcefully disconnect/delete the drive mappings, then map them in the script. You might try this for your 7 PC’s.

Читайте также:  Астра линукс регистрация оптических дисков
Оцените статью