0

I am working on creating a script to get information about windows machines and I would like to get the audit policies.

I have tried:

import subprocess
proc = subprocess.check_output("auditpol /get /category:*").decode('utf-8')
print (proc)

And an getting:

Traceback (most recent call last):
 File "C:\Users\me\Desktop\test.py", line 14, in <module>
  proc = subprocess.check_output("auditpol /get /category:*").decode('utf-8')
 File "C:\Program Files\Python36\lib\subprocess.py", line 336, in 
  check_output**kwargs).stdout
 File "C:\Program Files\Python36\lib\subprocess.py", line 418, in run 
  output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command 'auditpol /get /category:*' returned 
 non-zero exit status 1314.

Could this be an issue of not having admin rights?

Allie Hart
  • 149
  • 1
  • 3
  • 14

1 Answers1

0
import os
os.system("auditpol.exe /get /category:*")

Run command prompt as an administrator and run this .py file on cmd.