-3

I've tried the answers that were posted here: How do I run a PowerShell script when the computer starts?

Tried the 50 upvote solution and it did not work, so I'm looking at other alternatives. Whatever solution there is has to be able to be completed using only powershell commands.

jf4i2d
  • 27
  • 1
  • 8
  • 2
    "Doesn't work" is considered a little vague on stackoverflow. Please specify what goes wrong and add as many details as needed. – Palle Due May 07 '20 at 06:54

1 Answers1

5

Could you not just create a registry value to do run it at startup? Open Regedit and navigate to:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Create a new String value - name it whatever you want. And for the data, provide the command that you want to run (Powershell.exe command line)? For example:

Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
Name: MyPowerShellScript
Data: %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File "C:\Path\To\File.ps1"
Captain_Planet
  • 1,228
  • 1
  • 12
  • 28
  • 1
    "Whatever solution there is has to be able to be completed using only powershell commands." regedit is a gui tool – jf4i2d May 07 '20 at 20:25
  • 2
    Then write the registry entry using PowerShell!!? If you want a clear answer, you need to write a clear question. It's vague. There is no explanation of what you have specifically tried. And there is no reason given as to why you can only use PowerShell. – Captain_Planet May 09 '20 at 18:49