- Windows 2000, XP Professional, Vista Business, 7 Professional, 7 Enterprise, 8 Professional, 8 Enterprise, 8.1 Professional, 8.1 Enterprise, 10 Professional, 10 Enterprise
- Windows Server 2000, 2003, 2008, 2008 R2, 2012, 2012 R2, 2016
- Windows Scripting Host 5.8 or higher
It’s been a problem since 1999. You want to install a Startup or Shutdown Script on a local Windows machine without having to go through GPEdit.msc to manually populate the user interface necessary to install the script processing hook.
Well, now you can do it automatically!
So here is a VBScript api file which does the work for you to install either a Startup or Shutdown script from the command line. This installs the script as part of the Local Windows Group Policy processor, which on Domain Joined systems will be executed before Domain Logon Scripts.
- No warranty is offered or implied. Use this script at your own risk
- Please do not redistribute this script, please link to this page [Perma-link: http://www.c-amie.co.uk/qlink/?id=142]
- You may not sell or profit from the use of this script
- You may not bundle this script as part of an application deliverable or payload
Download: AddLocalGpStartupScript.zip [4KB]
You can call the script from the Command Line or a bat (batch) file using the following syntax
You can view the help screen and examples at any time by calling
Writes http://www.c-amie.co.uk/ to the file C:\LogFile.log during startup
Opens C:\LogFile.log in Notepad during shutdown
Calls D:\Scripts\MyScript.cmd with no arguments during shutdown
Executes the PowerShell Script C:\MyPsScript.ps1, ignoring the System Execution Policy during startup
Performing a Test
If you want a simple test to find out if it works, try the following which writes a log trace to two text files on the root of C Drive:
Why isn’t there a Logon and Logoff Script Version?
There is actually one and it doesn’t work. The process of installing the Logon Script isn’t quite a simple as the process for a Startup Script because it has to be written into the registry on each user account. Consequently, until such a time that I have the will to automate this part, while it performs the installation legally, it doesn’t execute unless you go in and press the apply button on the Logon Script UI.