PowerShell: Getting Started - Michael Bender Flashcards

1
Q

What is Windows PowerShell?

A

It’s an execution engine that provides the ability for you to interface with your environment using a variety of tools

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

What does PowerShell ISE stand for?

A

Integrated Scripting Environment

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

What are the commands to see a directory?

A

ls, dir

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

How do you clear a screen?

A

cls

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

What is the command for finding services?

A

get-service

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

What command do you use to filter the information?

A

where-object, then the condition you require.

eg. get-service | where-object status -eq ‘stopped’

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

How do you export your results to a CSV file or txt file?

A

export-csv C:/powershell/services.ps1

out-file C:/powershell/services.txt

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

What is the syntax to request PowerShell to open a .ps1 script via notepad?

A

First, type notepad then the location of the file.

eg. notepad c:/powershell/services.ps1

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

What is the command to find more commands available in PowerShell?

A

Get-command

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

How do you change the fonts and the size of PowerShell Window?

A

Right click on the title of PowerShell box and choose properties

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

What is the command to find more commands available in PowerShell?

A

Get-command

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

How do you change the fonts and the size of PowerShell Window?

A

Right click on the title of PowerShell box and choose properties

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

What is the syntax for:

  1. Get Service
  2. Status: Stopped
  3. only display name, displayname and status
  4. Export to CSV
A

get-service | Where-Object {$_.status -eq “stopped”} |select-object status,name,displayname|Export-Csv C:\PowerShell\services2.ps1

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

Please explain the concept of “Verb - Noun” in PowerShell?

A

“Do Something - To Something”

Get-Verb

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

How can you find:

  1. Service
  2. Name starting with M
  3. on a specific computer/s
A

Get-service -name m* -ComputerName PC1,DC1

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

What does PowerShell search for after a -Parameter?

A

PowerShell searches for a value after a parameter.

-ComputerName DC1,PC1

Note: Comma allows multiple values.

17
Q

How do positional parameters work?

A

When you’re running a command, PS will automatically use the first positional parameter.

eg. gsv m* - computername PC1,DC1

18
Q

What is the syntax to get help on a parameter?

A

get-help get-service

Note: Here you can also see the positional parameters in the syntax section

19
Q

Syntax for finding parameter with wildcard?

A

get-help DNS or DNS*

20
Q

What is the difference between cmdlet and function?

A
  • cmdlet is created with a code, built on .NET Framework so that it could be used.
  • Function is essentially created using PS commands, cmdlets and logic
21
Q

Syntax for related helpful command?

A

Under get-help get-service, check RELATED LINKS

22
Q

Syntax for finding EXAMPLES of a PS Parameter?

A

get-help get-service -examples

23
Q

Syntax for finding and filtering verbs available starting from “S”?

A

get-verb -verb s*

24
Q

syntax for finding and filtering verbs by group (category)?

A

get-verb | where-object {$_.group -eq “Security”}

25
Q

Steps to searching for new commands (General to specific)?

A

get-command -name ip -module nettcpip

  1. Get-command
  2. Filter by -name and wildcard (eg IP
  3. Filter by -module (module name)
26
Q

Syntax for getting the list of commands entered during the session (history)?

A

get-history

Note: Save history

27
Q

Syntax for transcript activation/stop?

A

start-transcript -path C:\PowerShell\transcript01.txt

28
Q

How to find which member a property belong to?

A

get-service | get-member

29
Q

3 types of formatting output?

A

Format-list (FL)
Format-table (FT)
Out-gridview

Note: You can also use -autosize and -wrap.

30
Q

3 Syntax for help, finding new commands and finding history?

A

get-help
get-command
get-history