0

I create a new AWS Windows 2016 Server instance and provide it the script to execute through User Data.

The script first creates a Windows service, creates a new admin user, grants user the Logon as a Service right and assigns the user to that service as the Log On As user.

After the system is all set, I logon and perform the operations that this service should respond to(it accesses files on a remote network share), but it does absolutely nothing. Even my custom logs aren't getting generated. The service is like it doesn't even exist. It is running, and the new user is assigned to it. But nothing happens.

Then when I just Restart the service, it starts functioning perfectly. My assumption is that when the service is started at the startup time, it is running in some other session, and not the session to which I am logged into.

I have also tried Automatic and Automatic (Delayed) Startup type. I cannot run it using LocalSystem as I need to access remote resources with it. I have no clue what is going on here!

Syed Waqas
  • 101
  • 3
  • `nothing happens`. Have you confirmed that nothing is happening by running Sysinternals' procmon.exe? You can also configure it to perform boottime logging. https://docs.microsoft.com/en-us/sysinternals/downloads/procmon – Greg Askew Apr 14 '18 at 17:14
  • This suggestion is new to me and will be beneficial in future. For now, I have posted the answer that worked for me in this case! – Syed Waqas Apr 16 '18 at 16:01

1 Answers1

0

Surprisingly, in the script, right after starting the service I stopped and then started the service again(with a couple second sleep intervals in between) and it started working. Strange, but true!

Syed Waqas
  • 101
  • 3