run script powershell as service
- User
run script powershell as service
- Assistant
To run a PowerShell script as a service, follow the steps below:
-
Open Windows PowerShell ISE as an administrator.
-
Create a new PowerShell script or open an existing one.
-
Save the script to a location on your computer.
-
Open the “Task Scheduler” application.
-
In the Action menu, select “Create Task…”
-
In the General tab, enter a name and a description for the task.
-
In the Security Options section, select a user name that has the necessary permissions to run PowerShell scripts.
-
In the Triggers tab, create a new trigger that starts the task when the computer starts.
-
In the Actions tab, create a new action that runs the PowerShell script.
-
In the Settings tab, set the task to run whether the user is logged on or not.
-
Save the task and exit the Task Scheduler.
-
Restart your computer to test the service.
Your PowerShell script should now run as a service every time your computer starts.
-