Search notes:

PowerShell: The Preference Variable $PSDefaultParameterValues

The PowerShell preference variable $psDefaultParameterValues allows to define default values with which cmdlet parameters are assigned when a given cmdlet is invoked.
$psDefaultParameterValues is a hash table (or more accurately an instance of System.Management.Automation.DefaultParameterDictionary). Such a hash table allows to store key/value pairs.
The values that are defined in $psDefaultParameterValues customize cmdLets and advanced functions only, but not scripts or simple functions.
$psDefaultParameterValues has no default values. Typically, the values for the $psDefaultParameterValues variable are set in the profile (see $profile).

Format of keys and values

Keys

The format of the keys in in $psDefaultParameterValues is cmdletName:parameterName.
Both, cmdletName and parameterName can contain wildcard characters.

Values

A value is either a string which sets the matched parameter's default value or a script block.

Simple example

Setting the key *:encoding to utf8 will cause the parameter -encoding to be set to utf8 when invoking any cmdlet with an -encoding parameter:
$psDefaultParameterValues['*:encoding'] = 'utf8'

Disabling psDefaultParameterValues

The values of $psDefaultParameterValues can be temporarily disabled by adding a key whose name is Disabled and a value whose value is $true.
Setting this value to $false enables using of $psDefaultParameterValues again.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Windows/...', 1759382464, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Windows/PowerShell/language/variable/preference/psDefaultParameterValues(70): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78