Skip to content

Instantly share code, notes, and snippets.

@idavis
Created June 12, 2015 16:46
Show Gist options
  • Save idavis/c16f117c0f99eb20c49f to your computer and use it in GitHub Desktop.
Save idavis/c16f117c0f99eb20c49f to your computer and use it in GitHub Desktop.
PowerShell Module Security
@ferventcoder
Copy link

Recently I learned you don't even need to overwrite the function, just create an alias with the same name and it doesn't matter what your function is named. If the user is just calling it, without a local scope, it will call your alias instead. https://technet.microsoft.com/en-us/library/hh848304.aspx

Windows PowerShell uses the following
precedence order when it runs commands:

1. Alias
2. Function
3. Cmdlet 
4. Native Windows commands

Update: May only work for the exported functions, not the private ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment