0

I have a executable file that I need to run when a machine starts. The scenario is that I need to write install.ps1 and uninstall.ps1. install.ps1 will tell the machine to run my executable everytime the computer starts. uninstall.ps1 will tell the machine not to run that executable. I m looking for how write install.ps1 and what to write in that so that it runs the executable. Also is there any way that I can put a timer in the .ps1 file to check if the executable is executing or not?

2 Answers 2

1

Instead of writing powerscripts you can write a console app that can put your executable file to run at startup using registry? Similarly you can write uninstall.exe that will remove the above said entry from registry. Simple and easy.. isn't it?

Sign up to request clarification or add additional context in comments.

Comments

0

You could use Scheduled Task to start the executable. Something like:

schtasks.exe /Create /TN myTask /SC ONSTART /TR notepad.exe

It will start notepad on login according to: http://poshtips.com/2011/04/07/use-powershell-to-create-a-scheduled-task/

2 Comments

I actually need to go only by powerscript way.. I need to monitor the executable also.
I'm not sure I understand. Could you clarify your question then?

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.