Answer the question
In order to leave comments, you need to log in
How can I set the program to Automatic mode on a Windows service?
I can't find any information on how to edit Windows "Services" settings. At work, I need to install OpenVPN on clients' computers, it is installed with "manual" control and I need to change it to "Automatic", I want to automate this process in order to, for example, write a script and set up the VPN client, the client himself launched the following file and all the settings were applied to him , also, ideally, it would be in the same file with a change in the Widnows "Services" settings to push the code that opens a specific port in the Firewall, so far it was possible to automate this action only through PyAutiGUI.
import pyautogui as pg
import time
import os
from key import command, command1, command2
os.startfile('powershell', 'runas')
time.sleep(3)
pg.typewrite(command)
pg.typewrite(command1, 0.01)
pg.typewrite(command2, 0.01)
time.sleep(1)
pg.hotkey("enter")
command = ('New-NetFirewallRule -DisplayName "UTM_transport"')
command1 = (' -Profile @("Domain", "Private") ')
command2 = ("-Direction Inbound -Action Allow -Protocol TCP -LocalPort @('8228')")
Answer the question
In order to leave comments, you need to log in
If I understand you correctly, then through powershell you can specify the startup type for the service like this
Get-Service openvpn | Set-Service -StartupType Automatic
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question