Users

All Posts (1)

avatar

yhprum77

Write a script to run a service upon reboot

avatar
avatar
avatar

Hello fellos,

I like to write a script to run a service upon reboot regardless which user is logged. I managed to find something below that creates a task in Win scheduler.

@echo off

for %%C in (server name) do (

schtasks /Create /F /S %%C /RU "System" /SC OnStart /TN StartSvc /TR "C:\Windows\System32\sc.exe start """service name with space"" /delay 0005:00

)

The next task is to add in credential into it, which I have trouble getting to it. The service does not auto run without credentials. How do I write the script with user name and password embedded? Any pointers

1 - 1 of 1 items