Sie sind auf Seite 1von 18

Exercise 12

Logon Scripts
Exercise 12 : Logon Scripts
In this exercise you will create logon and logoff scripts and apply these to users in an
organizational unit. You will specify a network home directory for users and arrange for this
directory to be mapped when the user logs on. Finally, you will specify disk space restrictions for
specific users.

EXERCISE 12.1

Logon Scripts

A logon script is a sequence of commands that executes when a user logs onto the network.

1. Log on server as Administrator (Figure 0388).

Figure 0388 : Administrator Login

2. Launch Group Policy Management. Click Start ► Administrative Tools ► Group Policy
Management (Figure 0389).
Figure 0389 : Launch Group Policy Management

3. Expand the Forest (Figure 0390).

Figure 0390 : Group Policy Management - Forest

4. Expand the Domains (Figure 0391).


Figure 0391 : Group Policy Management – Domains

5. Expand your domain.com (Figure 0392).

Figure 0392 : Group Policy Management – myserver.com

6. Right-click the STKM Group Policy and select Edit (Figure 0393).

Figure 0393 : STKM Group Policy - Edit

7. The group policy editor allows you to specify user and computer settings. In the
following steps, you will change some of these settings (Figure 0394).
Figure 0394 : Group Policy Management Editor

8. Expand User Configuration (Figure 0395).

Figure 0395 : Group Policy Management Editor – User Configuration

9. Expand the Policies folder (Figure 0396).

Figure 0396 : Group Policy Management Editor – Policies

10. Expand the Windows Setting folder (Figure 0397).


Figure 0397 : Group Policy Management Editor – Windows Setting

11. Click the Scripts (Logon/Logoff) (Figure 0398).

Figure 0398 : Group Policy Management Editor – Scripts (Logon/Logoff)

12. Double-click Logon (Figure 0399).

Figure 0399 : Group Policy Management Editor – Logon

13. In the Logon Properties windows, click Show Files… button (Figure 0400).
Figure 0400 : Logon Properties

14. Create new text document.

Right-click inside the new windows and select New ► Text Document (Figure 0401).

Figure 0401 : Create New Text Document

15. Double-click the text document. This will load the Notepad editor. Type the following
text into the file (Figure 0402).
echo off
cls
echo This is a log on script for the Stkm OU
echo Welcome %USERNAME% , member of the Stkm OU
pause

Figure 0402 : Notepad editor – New Text Document

16. Save the file as Stkm.cmd

16.1. From Menu bar, click File ► Save As… (Figure 0403).

Figure 0403 : Menu bar - Save As…

16.2. Enter Stkm.cmd in the “File name:” box (Figure 0404).

Figure 0404 : Save As – File Name


16.3. Select All Files from the “Save as type:” drop menu (Figure 0405).

Figure 0405 : Save As Type – All Files

16.4. Click Save button (Figure 0406).

Figure 0406 : Save Button

17. Close the Notepad editor.

18. Close the Script windows by clicking the X button at the right top corner of the windows
(Figure 0407).

Figure 0407 : Script Windows

19. On the Logon Properties window, click Add… button (Figure 0408).
Figure 0408 : Logon Properties – Add…

20. Click Browse… button on the Add a Script window (Figure 0409).

Figure 0409 : Add a Script – Browse…

21. Select Stkm.cmd file from the list (Figure 0410).


Figure 0410 : Browse – Stkm.cmd

22. Click Open button (Figure 0411).

Figure 0411 : Open Button

23. Now you can see the Stkm.cmd appear in the “Script Name:” box. Click OK button to
continue (Figure 0412).

Figure 0412 : Add a Script Window

24. Stkm.cmd now listed under Logon Properties Script. Click OK button to close the
Logon Properties window (Figure 0413).
Figure 0413 : Logon Properties window

25. Close the Group Policy Management Editor window.

26. On the Group Policy Management window, right-click STKM Group Policy and uncheck
all options except Link Enabled (Figure 0414).

Figure 0414 : Link Enabled

27. Open STKM Group Policy.


Right-click the STKM Group Policy and select Edit (Figure 0415).

Figure 0415 : STKM Group Policy - Edit

28. In the Group Policy Management Editor, expand User Configuration (Figure 0416).

Figure 0416 : Group Policy Management Editor – User Configuration

29. Expand the Policies folder (Figure 0417).

Figure 0417 : Group Policy Management Editor – Policies

30. Expand the Administrative Templates folder (Figure 0418).


Figure 0418 : Group Policy Management Editor – Administrative Templates

31. Expand the System folder (Figure 0419).

Figure 0419 : Group Policy Management Editor – System

32. Click the Scripts folder (Figure 0420).

Figure 0420 : Group Policy Management Editor – Scripts

33. Double-click the Run logon scripts visible option (Figure 0421).
Figure 0421 : Group Policy Management Editor – Run logon scripts visible

34. The Run logon scripts visible Properties appear. Click the Enabled button to enable this
setting (Figure 0422).

Figure 0422 : Run logon scripts visible Properties

35. Click OK to apply setting (Figure 0422).

36. In the same folder, double-click the Run logon scripts synchronously option (Figure
0423).

Figure 0423 : Group Policy Management Editor – Run logon scripts synchronously

37. The Run logon scripts synchronously Properties appear. Click the Enabled button to
enable this setting (Figure 0424).
Figure 0424: Run logon scripts visible Properties

38. Click OK to apply setting (Figure 0424).

39. The setting now displays as Enabled in the Group Policy Editor (Figure 0425).

Figure 0425 : Run logon scripts visible – Enabled

40. Close the Group Policy Management Editor.

41. On Group Policy Management, click Refresh button and close the Group Policy
Management window.

Update Group Policy


42. Launch the Run application. Click Start ► Run… (Figure 0426).

Figure 0426 : Launch the Run Application

43. Key-in gpupdate in the Open : box (Figure 0427).

Figure 0427 : Run Window

44. Click OK to run the gpupdate (Figure 0428).

Figure 0428 : Updating Policy

45. Log off the server.

Test The Logon Script


46. Log on to the client computer as ocah.blue (Figure 0429).

Figure 0429 : Log On To Server Using Client Workstation

47. The logon script should appear same as figure below (Figure 0430).

Figure 0430 : Logon Script

48. Press ENTER or any key to continue.

49. Log off the client computer.

Summary

Scripts allow for both user and computer environments to be configured. The four scripts
available are startup, shutdown, logon and logoff.

Das könnte Ihnen auch gefallen