Write a string to the host's verbose display. This is normally used within PowerShell scripts to provide an optional message, normally hidden but available to view by setting a preference.

      Write-Verbose [-message] string [CommonParameters]

   -message string
       The message to display.
       {may be piped}

       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
       -OutBuffer -OutVariable.

Setting the $VerbosePreference variable will alter the action of Write-verbose:

Continue Show the message on the console
SilentlyContinue do not show the message. [this is the Default action]
Stop show the message and then halt
Inquire prompt the user

If you close and reopen PowerShell, the $VerbosePreference variable will revert to the default.
To make a permanent change, add the preference to your PowerShell $Profile.


Write a message:

PS C:\> $VerbosePreference = "SilentlyContinue"
PS C:\> Write-Verbose 'The quick red fox.'

PS C:\> $VerbosePreference = 'Continue'
PS C:\> Write-Verbose 'The quick brown fox.'

“Inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination” ~ Benjamin Disraeli


Write-Debug - Write a debug message to the host display
Write-Error - Write an object to the error pipeline.
Write-Host - Display objects through the host user interface
Write-Output - Write an object to the pipeline
Write-Progress - Display a progress bar
Write-Warning - Write a warning message

Copyright © SS64.com 1999-2017
Some rights reserved