Operational Procedures

A technician must write a Windows script that uses cmdlets and passes objects from one command to the next through a pipeline. Which file type should the script use?

Show the answer

Correct answerC. .ps1

AWhy not this: .vbs files use VBScript syntax and Windows Script Host objects, not cmdlets.

BWhy not this: .sh files are Linux and macOS shell scripts, not Windows cmdlet scripts.

CWhy this is right: PowerShell scripts use cmdlets and pipe objects between commands.

DWhy not this: .bat files run Command Prompt commands and pass text, with no cmdlets or object pipeline.

A .ps1 file is a PowerShell script. PowerShell uses cmdlets and pipes objects between them. A .bat file only runs Command Prompt commands and passes plain text, so it has no cmdlets.