POwershell Flashcards

1
Q

What is PowerShell?

A

PowerShell is a Microsoft framework for task automation and configuration management.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the difference between PowerShell and Command Prompt?

A

PowerShell uses cmdlets, while Command Prompt uses commands.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are cmdlets?

A

Cmdlets are small, specialized commands in PowerShell.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you comment in PowerShell?

A

Comment in PowerShell with # for single-line and <# … #> for block comments.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the pipeline in PowerShell?

A

Pipeline (|) passes output of one cmdlet to another for chaining commands.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you handle errors in PowerShell?

A

Handle errors with try, catch, and finally blocks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the difference between Write-Host and Write-Output?

A

Write-Host for console output, Write-Output for pipeline output.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you create a function in PowerShell?

A

Create a function with the function keyword followed by its name and body.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the $PSVersionTable variable used for?

A

$PSVersionTable holds PowerShell environment info, including version.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you import a module in PowerShell?

A

Import modules with Import-Module cmdlet or in profile script.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly