Announcement

Collapse
No announcement yet.

Execute Powershell Commands via Python

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Execute Powershell Commands via Python

    You can use below script to execute Powershell commands,

    Note: This script will provide you list of windows logs via Powershell.


    Code:
    import subprocess;
    process=subprocess.Popen(["powershell","Get-Childitem C:\\Windows\\*.log"],stdout=subprocess.PIPE);
    result=process.communicate()[0]
    print (result)

    Sample output would be,

    Click image for larger version

Name:	powershell_output.jpg
Views:	1
Size:	39.6 KB
ID:	4819



  • #2
    hi,
    can some one explain how can i use this script ? where can i put the powershel script ?

    Comment


    • #3
      Hello cfcsupport ,

      Please take a few to browse through https://help.comodo.com/topic-399-1-...Procedure.html
      This should help you better understand how Procedures work/are managed.

      Comment

      Working...
      X