Create batch file to install windows service
For the final step, before clicking Finish, make sure to check the box next to Open the properties dialog for this task when I click Finish. This will allow you to make a few additional, yet important, changes to the task before saving it. The options that you will select in the dialog window mostly depend on the usage of the server where the task is being configured.
For the most part you only need to make changes to the General tab as the other tabs only show the configuration settings from the previous steps outlined above. In most cases I would recommend changing the User account that calls the task as well as selecting the radio button next to Run whether user is logged in or not and selecting the check box next to Run with highest privileges.
Though I did not change the account in the example above, typically it is best to set a service account or some other domain level account where the password will not expire. Otherwise you run the risk of causing the scheduled task to fail if you change your password and do not go back and update the scheduler. Once you have made the desired configuration changes click OK to save the scheduled task. The batch file will now be executed at the specified time. If you took the steps to include the log file then you can check the file periodically to make sure the scheduler is running correctly.
Skip to content Windows Server. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked Related Hot Network Questions. Improve this answer. Jesse Jesse 21 2 2 bronze badges. Pause Run this bat file as administrator. Andrea 1, 4 4 gold badges 16 16 silver badges 19 19 bronze badges.
Chenthurij Chenthurij 19 3 3 bronze badges. Could you please add a description to the code what it does does? You also seem to have a typo installNETservie. Hmmm, this StackOverflow answer suggests to me that using sc may not be the correct way to install a Windows Service developed in. NET stackoverflow. It may not be, I guess it depends on your needs. It looks like from that answer that installutil requires a restart to remove the service, and sc does not.
Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Use cmd line to navigate to the dir where my service and installutil. Type in installutil -u myservice. Type in installutil myservice. Window pops up asking for username and the password two textboxes for password After googling, I think I got the jest of writing what I need, except for the username password part.
How would I achieve that step in a batch file? Ben Personick Previously QCubed. Join our community to see this answer! Unlock 1 Answer and 6 Comments.
0コメント