To fully automate this script on a Windows system, you will need to set it as a scheduled task. The following is a brief example of how to do that.
- Open task scheduler and choose "Create task"
- On the General tab:
- Give the task a name. This can be whatever you like, but should be something descriptive.
- (Optional) Write a short description of the task.
- Click the Change User or group button, and ensure that both the computer name and user name show up in the format of "
Computer\User
". - Click the Run whether user is logged in or not radio button
- Check the Run with highest privileges button
- Under the Triggers tab:
- On the Actions tab:
The script will now run automatically to your specifications.