How to Deploy a Computer Startup Script via Group Policy
Use the method below to push out a computer startup script via Group Policy. Computer startup scripts are a useful way of making changes that need to happen regardless of which user is logged on.
The example below deploys the LANPWR.VBS script to disable a LAN or wireless LAN adapter’s power management.
Recommendation: Always test network changes on a small group of machines before deploying the improvement. Where possible, implement the change room by room or department for department and monitor the situation for any unexpected side effects.
- Find a suitable machine that you can use for test purposes.
- Log on to your server as an Administrator
- Open up Server Manager > Active Directory Domain Services > Active Directory Users and Computers
- Find your test machine in Active Directory, and ideally, create a sub OU (organisational unit) to test the new setting. For example, the machine WIRELESS-PC below has been moved into the “Test_Laptops” OU which has been created just for testing.
- Open up the Group Policy Management tool by clicking Start, and typing in gpmc.msc. Then click on gpmc.msc that appears in the search results.
- Find the OU containing the test machine
- Right hand click on the OU name and then left click on “Create a GPO in this domain, and Link it here…”
- Give the new policy a name that is relevant to the settings it will contain
- Now right-hand click on the new policy that has appeared, and left click on Edit
- A new window will open. This list settings which can be applied to Computers – the machines – and user settings. Expand the tree of settings under “Computer Configuration” to find Policies, then Windows settings, and then finally Scripts (Startup/Shutdown).
- In the right hand Window, right-hand click on Startup and then left click on Properties.
- Click the Add button.
- Click Browse.
- Using Windows File Explorer, copy the script file that intend to use (lanpwr.vbs in the example) and then paste the file into the “Browse” window for the script, by right hand clicking on a blank part of the window, then left clicking on “Paste”.
- Then make sure you select the intended file (lanpwr.vbs in the example) and click on Open.
- Ensure that the Script Name field has the name of your script, then click OK.
- You should now see your script added to the Startup Properties. Click on OK again.
- Thats it, you have now added your policy settings. You can close the Group Policy Management Editor window.
- Back in the main Group Policy Management screen, hit F5 to refresh the view, then click on your Policy and review the settings tab to ensure your policy has been submitted.
Things to Remember
- New policies might not be applied to systems straight away, even after a reboot (use the GPUPDATE /FORCE command from an Administrative command prompt to make this quicker)
- Some scripts themselves might take an additional reboot to take effect.
- Using a computer startup script is a great way of enforcing a setting no matter what subsequent software is installed or whatever changes users make.
Applies to:
- Networks running Windows Server with Windows clients