The Powershell Community Extensions (pscx) override the standard “help” function when the module is imported, to use the supplied “less” function which in turn calls the less.exe command supplied with pscx. Unfortunately, less.exe crashes the “Console2” command shell wrapper that I use extensively, so I want to override what pscx does.
I know PSCX has a preference option to make help use the standard “more” function rather than “less”. I also know that I can manually override the “less” function. But I only use pscx occasionally, so I don’t load it in my profile, and if I forget either of these overrides, I can crash my powershell session with something as simple as typing “help”!
What I would like is to be able to put something in my profile that detects when pscx is imported, and at that point overrides the less function and sets the help preference appropriately.
Is it possible to define an “after import” type of event like this in powershell?
In your
$profileaddset-alias less more.com