Q: I need a PowerShell script to run every time my server starts, but I need it to start before a certain service; how can I do this?
A: I recently had someone ask this question because they wanted to run some PowerShell code to check and set permissions before the SQL Server service started. A typical way to run something when the machine starts up is to use the machine's policy and configure a startup script; for example: