Skip to content

Instantly share code, notes, and snippets.

@rolangom
Last active October 15, 2020 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rolangom/2e4b71d0ef5049661762269475241341 to your computer and use it in GitHub Desktop.
Save rolangom/2e4b71d0ef5049661762269475241341 to your computer and use it in GitHub Desktop.
Create Windows events using Python 3
"""
Create windows events
"""
import os
def create_event(srcname: str, type: str, id: int, description: str):
command = f'eventcreate /t {type} /id {id} /l application /so {srcname} /d "{description}"'
os.system(f'cmd /c "{command}"')
def post_info_event(srcname: str, id: int, description: str):
create_event(srcname, "INFORMATION", id, description)
def post_error_event(srcname: str, id: int, description: str):
create_event(srcname, "ERROR", id, description)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment