Creating Constant Functions

by Apr 6, 2010

In PowerShell, functions can be constant to prevent them from being deleted anymore, which is necessary if you must protect security-critical functions from being changed or deleted. Constant functions persist until you close PowerShell. You can create them with New-Item:

New-Item function:test -Value {
'You cannot delete me!' } -Option Constant

Twitter This Tip! ReTweet this Tip!