Write-Verbose | Easy Powershell 2.0 Reference (original) (raw)

NAME
Write-Verbose

SYNOPSIS
Writes text to the verbose message stream.

SYNTAX
Write-Verbose [_-Message_] [<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
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
Accept pipeline input? true (ByValue)
Accept wildcard characters? false

<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
Get-Help about_CommonParameters“.

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.

NOTES

————————– 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.

RELATED LINKS
Online version: http://go.microsoft.com/fwlink/?LinkID=113429
Write-Error
Write-Warning
about_preference_variables

Post navigation