Step by Step How to Configuring Scripts with GPOs in Windows Server 2016

Group Policy settings for applying scripts

You can use Group Policy scripts to perform a number of tasks. There might be actions that you need to perform every time a computer starts up or shuts down, or when users sign in or sign out. For example, you can use scripts to:


Clean up desktops when users sign out and shut down computers.
Delete the contents of temporary directories.
Map drives or printers.
Set environment variables.
Assign scripts to the computer to run in the security context of the Local System            account.

Infrastructure Requirement :

  • 1 DC SERVER (DC-CLOUD) 
  • Client PC running Windows 10 (CLIENT-10)

Lets get started.

01 – Create a logon script to display a message

1 – On DC-CLOUD, click Start, type Notepad, and then click Notepad.

1.png

2 – In Notepad, type the following command, and then press Enter:

Msgbox “This is the script”

2.png

3 – Click the File menu, and then click Save As.

3.png

4 – In the Save As dialog box, in the File name text box, type Logon.vbsthen navigation pane, click Desktop, and then click Save.

4.png Close Notepad.

5 – On the Desktop, right-click the Logon.vbs file, and then click Copy.

5.png

02 – Create and link a GPO to use the script

1 – Open Server Manager, click Tools, and then click Group Policy Management.

19

2 – Expand Forest: Windows.ae, and then expand Domains, Right-click Windows.ae, and then click Create a GPO in this domain and Link it here.

8

3 – In the New GPO dialog box, in the Name text box, type User Logon Script, and then click OK.

6.png

4 – Expand Windows.ae, right-click the User Logon Script GPO, and then click Edit.

8

5 – In the Group Policy Management Editor window, under User Configuration, expand Policies, expand Windows Settings, and then click Scripts (Logon/Logoff).

9

6 – In the details pane, double-click Logon.

10.png

7 – In the Logon Properties dialog box, click Show Files.

11.png

8 – In the details pane, right-click a blank area, and then right-click Paste.

1213 Close the Logon window.

9 – In the Logon Properties dialog box, click Add.

14.png

10 – In the Add a Script dialog box, click Browse.

15.png

11 – Click the Logon.vbs script, and then click Open.

16.png

12 – Click OK twice to close all dialog boxes.

17.pngClose both the Group Policy Management Editor window and the Group Policy Management Console.

03 – Sign in to a client computer and test the results

1 – On CLIENT-10, sign out and then sign in as Windows\Administrator with password asd@123.

32

2 – Right-click Start, and then click Command Prompt.

5

3 – In the Command Prompt window, type the following command, and then press Enter:

Gpupdate /force

17

4 – If prompted, in the command prompt window, type the following, and then press Enter:

Y

5 – On CLIENT-10, sign out and then sign in as Windows\Administrator with password asd@123.

3218.png Verify that the script runs, displaying the message you configured in the GPO earlier

Note: This could take up to ten minutes to display. If the message does not display,
restart
CLIENT-10 and repeat step one through five.

that’s all for now.., any Doubts type a commend.. 🙂

3 thoughts on “Step by Step How to Configuring Scripts with GPOs in Windows Server 2016

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s