Archive

Posts Tagged ‘Group Policy’

How to run Scripts automatically in your System or Domain [scriptomatic]

Here I am taking the example for NUM LOCK status at System Logon.

The status of the NUM LOCK key is specific for each user. By default, NUM LOCK is turned off.

Configuring the Script

To configure a script to change the NUM LOCK state, use the following steps:

  1. Start Notepad.
  2. Copy the following code, and then paste the code into the text file:
    set WshShell = CreateObject("WScript.Shell")
    WshShell.SendKeys "{NUMLOCK}"

    3.Save the file as "numlock.vbs" (including the quotes). This properly creates the file with the .vbs extension. The icon changes from a Notepad icon to a script icon.

Now our script was ready to be execute so how can we Execute this.. there are several way to execute automatically..

Running the Script from the Startup Folder

To configure the script to run locally, copy the Numlock.vbs file to the user’s Startup folder, which is normally found in the user’s profile path.

To configure the script to run for all users, copy the Numlock.vbs file to the Startup folder in the All Users profile. The default path for this folder is Documents and Settings\All Users\Start Menu\Programs\Startup.

 
Running the Script Through Group Policy

Note that to run the script through Group Policy, you must be using Windows XP Professional, not Windows XP Home Edition( Home editions not included the features like Group Policy and Domain environment etc) .

To configure the newly created script to run by using Group Policy, first copy the Numlock.vbs script file into the Group Policy logon script folder.

The default path for a local logon script is %SystemRoot%\System32\GroupPolicy\UserComputer\Scripts\Logon.

The path for a domain logon script is %SysVolFolder%\Sysvol\Sysvol\DomainName\Scripts.

After you copy the script to the appropriate location, follow these steps:

  1. Click Start, click Run, type mmc, and then click OK to start Microsoft Management Console (MMC).
  2. On the Console menu, click Add/Remove Snap-in.
  3. Click Add, click Group Policy, and then click Add.
  4. Click the appropriate Group Policy Object. The default selection is the local computer, but you can click Browse and select a different Group Policy Object.
  5. Click Finish, click Close, and then click OK.
  6. In the Group Policy Management snap-in, locate the User Configuration\Windows Settings\Scripts (Logon/Logoff) folder. (You can substitute the Computer Configuration folder for the User Configuration folder.)
  7. Double-click the Logon script object, click Add, click Browse, and then click the Numlock.vbs script.
  8. Click Open, and then click OK.
  9. Click OK, and then close the Group Policy Management console.
    Its really helpful to manage so many tasks automatically through scripts.
    [Resource]
Categories: Scriptomatic