Search notes:

PowerShell cmdLet Write-Verbose

write-verbose writes text into the verbose stream.

Influencing the result with the preference variable verbosePreference

By default, the content of the verbose stream is not displayed after a pipeline finished executing.
Setting the preference variable $verbosePreference to 'continue' changes that behavior:
function writeVerbosely {
   write-host    "going to write verbosely"
   write-verbose "This is a verbose message"
   write-host
}

$verbosePreference = 'silentlyContinue'
writeVerbosely

$verbosePreference = 'continue'
writeVerbosely
Github repository about-PowerShell, path: /cmdlets/verbose/write/preference-variable.ps1

Using the -verbose common parameter

Invoked a cmdlet with the common parameter -verbose causes the value of $verbosePreference to be set to Continue and consequently write-verbose commands to print the message.
In order to turn a function into a cmdlet (which automatically has the -verbose parameter), it must be provided with [cmdLetBinding()] param(…)].
function writeVerbosely {

  [cmdletBinding()]
   param()

   write-host    "Value of `$verbosePreference is $verbosePreference"
   write-verbose "This is a verbose message"
   write-host
}

writeVerbosely
writeVerbosely -verbose
Github repository about-PowerShell, path: /cmdlets/verbose/write/verbose-parameter.ps1

See also

The cmdLet verb write
Powershell command noun: verbose

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/...', 1745385428, '160.79.111.135', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Windows/PowerShell/command-inventory/noun/verbose/write(83): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78