How to execute powershell/cmd commands in python

Viewed 19

I need to automatize some tasks about the monitoring area of Kaspersky. But i'm struggling to make they work in python (i already had done in powershell and cmd)

#1 KES and AVP.exe need to start

os.system ('""C:\Program Files (x86)\Kaspersky Lab\Kaspersky Endpoint Security for Windows\klpsm.exe"" start_avp_service.')
os.system ('""C:\Program Files\Kaspersky Lab\Kaspersky Endpoint Security for Windows\klpsm.exe"" start_avp_service.')

#2 Sincronize Network Agent with KSC

os.system ('""C:\Program Files (x86)\Kaspersky Lab\NetworkAgent\klmover.exe"" -address INSERTIPHERE')
os.system ('""C:\Program Files (x86)\Kaspersky Lab\NetworkAgent\klnagchk.exe"" -sendhb')

none of these commands are working and i really dont have any ideia how to make it works

  os.system ('""C:\Program Files (x86)\Kaspersky Lab\NetworkAgent\klmover.exe"" -address INSERTIPHERE'')
                                                                                                              ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 38-39: malformed \N character escape
0 Answers
Related