Introduction to PowerShell Flashcards

1
Q

PowerShell

A

is a command-line shell and a scripting language all in one. It was designed as a task engine that uses cmdlets to wrap tasks that people need to do. In PowerShell, you can run commands on local or remote machines. You can do tasks like managing users and automating workflows.

Whether you’re part of an operations team or a development team that’s adopting DevOps principles, PowerShell can help. You can use it to address various tasks, such as managing cloud resources and continuous integration and continuous delivery (CI/CD). PowerShell offers many helpful commands, but you can expand its capabilities at any time by installing modules.

When you install PowerShell, you can evaluate its features to see if it’s a good fit for your team.

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

What is PowerShel

A

PowerShell consists of two parts: a command-line shell and a scripting language. It started out as a framework to automate administrative tasks in Windows. PowerShell has grown into a cross-platform tool that’s used for many kinds of tasks.

A command-line shell lacks a graphical interface, where you use a mouse to interact with graphical elements. Instead, you type text commands into a computer console. Here are some of the benefits of using a console:

Interacting with a console is often faster than using a graphical interface.
In a console, you can run batches of commands, so it’s ideal for task automation for continuous-integration pipelines.
You can use a console to interact with cloud resources and other resources.
You can store commands and scripts in a text file and use a source-control system. This capability is probably one of the biggest benefits, because your commands are repeatable and auditable. In many systems, especially government systems, everything must be traced and evaluated, or audited. Audits cover everything from database changes to changes done by a script.

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

Built-in help system

A

Most shells have some kind of help system, in which you can learn more about a command. For example, you can learn what the command does and what parameters it supports. The help system in PowerShell provides information about commands and also integrates with online help articles.

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

Pipeline

A

Traditional shells use a pipeline to run many commands sequentially. The output of one command is the input for the next command. PowerShell implements this concept like traditional shells, but it differs because it operates on objects over text. You learn more about this feature later in this module.

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

Aliases

A

Aliases are alternate names that can be used to run commands. PowerShell supports the use of common aliases such as cls (clear the screen) and ls (list the files). Therefore, new users can use their knowledge of other frameworks and don’t necessarily have to remember the PowerShell name for familiar commands.

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

It operates on objects over text

A

In a command-line shell, you have to run scripts whose output and input might differ, so you end up spending time formatting the output and extracting the data you need. By contrast, in PowerShell you use objects as input and output. That means you spend less time formatting and extracting.

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

It has cmdlets

A

Commands in PowerShell are called cmdlets (pronounced commandlets). In PowerShell, cmdlets are built on a common runtime rather than separate executables as they are in many other shell environments. This characteristic provides a consistent experience in parameter parsing and pipeline behavior. Cmdlets typically take object input and return objects. The core cmdlets in PowerShell are built in .NET Core, and are open source. You can extend PowerShell by using more cmdlets, scripts, and functions from the community and other sources, or you can build your own cmdlets in .NET Core or PowerShell.

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

It has many types of commands

A

Commands in PowerShell can be native executables, cmdlets, functions, scripts, or aliases. Every command you run belongs to one of these types. The words command and cmdlet are often used interchangeably, because a cmdlet is a type of command.

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

Get-Command

A

The Get-Command cmdlet lists all of the available cmdlets on your system. Filter the list to quickly find the command you need.

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

Get-Help

A

Run the Get-Help core cmdlet to invoke a built-in help system. You can also run an alias help command to invoke Get-Help but improve the reading experience by paginating the response.

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

Get-Member

A

When you call a command, the response is an object that contains many properties. Run the Get-Member core cmdlet to drill down into that response and learn more about it.

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

-Noun:

A

The -Noun flag targets the part of the command name that’s related to the noun. Here’s a typical search for a command name using alias as the noun for which we’re searching:

Get-Command -Noun alias*

This command searches for all cmdlets whose noun part starts with alias.

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

-Verb

A

The -Verb flag targets the part of the command name that’s related to the verb. You can combine the -Noun flag and the -Verb flag to create an even more detailed search query and type. Here’s an example:

Get-Command -Verb Get -Noun alias*

Now you’ve narrowed the search to specify that the verb part needs to match Get, and the noun part needs to match alias.

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