Share via


Write-Verbose

Applies To: Windows PowerShell 2.0

Writes text to the verbose message stream.

Syntax

Write-Verbose [-Message] <string> [<CommonParameters>]

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 Verbose-Message.

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

This command supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, OutBuffer, OutVariable, WarningAction, and WarningVariable. For more information, see about_CommonParameters.

Inputs and Outputs

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

Inputs

System.String

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

Outputs

None

Write-Verbose writes only to the verbose message stream.

Example 1

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

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

Description

-----------

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.

Example 2

C:\PS>$VerbosePreference = "Continue"

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

Description

-----------

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.

See Also

Concepts

Write-Error
Write-Warning
about_Preference_Variables