How to subscribe for "user enter command to prompt" event in powershell? -
i'd implement incremental history log of commands enter powershell. found lot of related questions same history-save on-exit. solution here
register-engineevent -sourceidentifier powershell.exiting -supportevent -action { save-history }
i found inconvenient, because doesn't work multiply tabs/ps instances. want call save-historyincremental append existing csv file history.
but don't know how make callback function after user enter command.
workaround: closest workaround have right alter prompt:
rename-item function:\prompt oldprompt function prompt { save-historyincremental oldprompt }
here behavior oposit: save history after execution oh command (and duplicate last record on start).
i'm not sure if understand asking completely, help?
http://jaworskiblog.com/2011/08/05/logging-all-powershell-commands-and-output/
basically, add "start-transcript" powershell profile. log across multiple powershell instances, think...
Comments
Post a Comment