-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.

1
  • 2
    "Doesn't work" is considered a little vague on stackoverflow. Please specify what goes wrong and add as many details as needed. Commented May 7, 2020 at 6:54

1 Answer 1

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"
Sign up to request clarification or add additional context in comments.

2 Comments

"Whatever solution there is has to be able to be completed using only powershell commands." regedit is a gui tool
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.