Windows – launch powershell script from registry

powershellwindows-registry

I have a powershell script that I want to run on my PC every time I log on. I've added it as a REG_SZ in my current user "run" key, but it never executes.

I've altered the execution policy to "unrestricted", but still no luck.

The contents of the registry value are like this:

powershell.exe c:\path\myscript.ps1

That does work from the command prompt. Any idea why it won't run from the registry?

Thanks.

Best Answer

I usually run PowerShell scripts this way:

powershell.exe -file c:\path\myscript.ps1

For more information, run this from the command line:

powershell.exe -help
Related Question