Use PyWinAuto and Python to monitor a script being run

385 Views Asked by At

What I want is for anytime a user tries to run a .Ps1 file, my Python script using PyWinAuto converts the file into an executable file and runs that.

This means I need:

  • The fact that someone tried to run a .Ps1 (It will fail due to script-running permissions, so won't actually complete)
  • The name and location of the file (So I can pass that into the Ps1ToExe converter)

Is there a way to have a Python script just acting as a Watcher, and then whenever this event occurs retrieve the neccessary information?

I can do all the actual conversion, just getting the information in the first place I'm struggling with.

Thanks.

0

There are 0 best solutions below