Running script on powershell exit design gudline needed

This topic contains 2 replies, has 2 voices, and was last updated by  GS 2 years, 7 months ago.

  • Author
  • #33194



    I need to send everything what user entered during powershell session untill exit. Powershell is being run via Powershell web access which adds a twist to this scenario since session can be open for quite sometime. What is the best way to approach this requirement.
    I can start transcript in profile for all users but how do stop and email transcript at the end?

  • #33195

    Don Jones

    There are probably a lot of ways. If you look at the PowerShell Summit NA 2015 session recordings on YouTube (, Lee Holmes and Jeff Hicks did a security session that includes some of PowerShell's newer auditing capabilities.

    Another options is to create a custom endpoint, and have PWA connect to that rather than to the default endpoint (e.g., remove permissions to use the default endpoint). Your endpoint can have a startup script, which could start a session transcript each time someone connects. You wouldn't need to stop the transcript; it'll stop when they disconnect. In terms of mailing it, you'd probably want an external script running on a schedule to look for, and email, new transcripts it finds.

  • #33196



    Would not registering for Exit event ( allow me to run a script when sessions breaks?

You must be logged in to reply to this topic.