Write a warning message in reverse video to the host display.
Syntax
Write-Warning [-message] string [CommonParameters]
Key
-message string
The warning message to send to the host.
{may be piped}
CommonParameters:
-Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
-OutBuffer -OutVariable.
Setting the $WarningPreference variable will alter the action of Write-Warning:
Continue Show the message on the console [this is the Default action]
SilentlyContinue do not show the message.
Stop show the message and then halt.
Inquire prompt the user.
Write-Warning (and Write-host) write only to the host/screen. To also have the output passed to the success pipeline, use Write-Output instead.
Example
Write a warning message:
PS C:\> $WarningPreference = "Continue"
PS C:\> Write-Warning "The quick brown fox."
“History is a vast early warning system” ~ Norman Cousins
Related:
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-Verbose - Write a string to the host’s verbose display
© Copyright SS64.com 1999-2013
Some rights reserved