Write-Host Flashcards
(14 cards)
What does this PowerShell cmdlet do?
Write-Host
Displays output directly to the console.
## Footnote
Use only for visual feedback — it does NOT send data to the pipeline.
Which cmdlet would you use to do the following?
Print output directly to the screen (not to the pipeline).
Write-Host
What does this Write-Host
parameter do?
-Object
Specifies the text or object to display.
## Footnote
This is what gets written to the screen.
Which parameter would you use with Write-Host
to do the following?
Define what text or object to display on the screen.
-Object
What does this Write-Host
parameter do?
-ForegroundColor
Sets the text colour.
## Footnote
E.g. Red, Yellow, Green, etc.
Which parameter would you use with Write-Host
to do the following?
Set the text colour of console output.
-ForegroundColor
What does this Write-Host
parameter do?
-BackgroundColor
Sets the background colour of the text.
## Footnote
E.g. DarkBlue, Black, etc.
Which parameter would you use with Write-Host
to do the following?
Set the background colour of console output.
-BackgroundColor
What does this Write-Host
parameter do?
-NoNewline
Prevents a line break after the output.
## Footnote
Keeps the cursor on the same line.
Which parameter would you use with Write-Host
to do the following?
Prevent a newline after printing text.
-NoNewline
What datatype is required for the following parameter:
Write-Host -Object
object
What datatype is required for the following parameter:
Write-Host -ForegroundColor
ConsoleColor
What datatype is required for the following parameter:
Write-Host -BackgroundColor
ConsoleColor
What datatype is required for the following parameter:
Write-Host -NoNewline
None: parameter is a switch