After reviewing tonnes of different suggestions – none of them worked. After a couple of minutes of testing, this is the answer (using Windows 10).
In order to run a powershell script on startup – you will need to place a shortcut in the startup folder (check %APPDATA%/Microsoft/Windows/Start-menu/Program/Autostart). Has to be in the ROAMING profile.
But first! Create the shortcut by right-clicking the desktop and select “New Shortcut”. Right-click and select “Properties“.
Many guides suggest the following in the “target” field.
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File “C:\Script\test.ps1”
What works is this:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File C:\Script\test.ps1
(Basically WITHOUT the “)
Start in field: “C:\Scripts” (or whichever folder you want – without the “).
PS: You could add the disable execution policy in the command – but I disabled it on the system anyways. Also, I’m local admin on the machine. Good to know if you want to try this in an enviorment thats different…