Export (0) Print
Expand All

Write-Verbose

Updated: May 8, 2014

Applies To: Windows PowerShell 4.0

Write-Verbose

Writes text to the verbose message stream.

Syntax

Parameter Set: Default
Write-Verbose [-Message] <String> [ <CommonParameters>]




Detailed Description

The Write-Verbose cmdlet writes text to the verbose message stream in Windows PowerShell. Typically, the verbose message stream is used to deliver information about command processing that is used for debugging a command.

By default, the verbose message stream is not displayed, but you can display it by changing the value of the $VerbosePreference variable or using the Verbose common parameter in any command.

Parameters

-Message<String>

Specifies the message to display. This parameter is required. You can also pipe a message string to Write-Verbose.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (http://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • System.String

    You can pipe a string that contains the message to Write-Verbose.


Outputs

The output type is the type of the objects that the cmdlet emits.

  • None

    Write-Verbose writes only to the verbose message stream.


Notes

  • Verbose messages are returned only when the command uses the Verbose common parameter. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

  • In Windows PowerShell background jobs and remote commands, the $VerbosePreference variable in the job session and remote session determine whether the verbose message is displayed by default. For more information about the $VerbosePreference variable, see about_Preference_Variables (http://go.microsoft.com/fwlink/?LinkID=113248).

Examples

-------------------------- EXAMPLE 1 --------------------------

These commands use the Write-Verbose cmdlet to display a status message. By default, the message is not displayed.

The second command uses the Verbose common parameter, which displays any verbose messages, regardless of the value of the $VerbosePreference variable.


PS C:\> Write-Verbose -Message "Searching the Application Event Log."
PS C:\>Write-Verbose -Message "Searching the Application Event Log." -verbose

-------------------------- EXAMPLE 2 --------------------------

These commands use the Write-Verbose cmdlet to display a status message. By default, the message is not displayed.

The first command assigns a value of "Continue" to the $VerbosePreference preference variable. The default value, "SilentlyContinue", suppresses verbose messages. The second command writes a verbose message.


PS C:\> $VerbosePreference = "Continue"
PS C:\>Write-Verbose "Copying file $filename"

Related topics



Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft