The power of Powershell

HRPCUG

The power of PowerShell

Created by Ryan Woodward North Central Missouri College

Table of Contents

1. About me

2. What is PowerShell?

3. Installing/Starting PowerShell

H

4. PowerShell Basics ? Variables

R

5. PowerShell Basics ? Arrays

P

6. PowerShell Basics ? cmdlets

C

7. PowerShell Basics ? Modules

U

8. PowerShell Basics ? if and for loops

G

9. PowerShell Basics ? saving data

10. More Advance PowerShell Tricks ? SQL

11. Automating PowerShell

12. Questions?

13. Conclusion

About me

? Name: Ryan Woodward

? Occupation: Computer Wizard (of the Network/Security variety)

H

R

? I have worked at NCMC between 2 and 3 years.

P C

U

? Since starting here, I have been a Database administrator,

G

Systems administrator, and currently our Network/Security

administrator.

What is PowerShell?

? What is PowerShell? ? PowerShell is what happens when command prompt takes steroids. ? This powerhouse can do almost anything command prompt can do, plus much more in a more script friendly environment. ? For those who have used Linux before, PS may seem familiar as it is kind of Microsoft's take on the popular Linux's BASH Shell.

? Where has PS been my whole life? ? It's fairly new when compared to other scripting/programming languages, PowerShell 1.0 came out in November 2006. ? Current version of PowerShell is PowerShell 5.1. ? PowerShell Core 6.0 is also out. ? New "variety" of PowerShell that is compatible with Mac and Linux machines. ? Unlike normal PowerShell, Core is not always backwards compatible.

HRPCUG

HRPCUG

Installing/Starting PowerShell

? How do I install PowerShell? ? Good News! If you have a Windows 7, Windows Server 2008 or newer operating system, a version of PowerShell should already be installed by default. ? On servers, PowerShell can be manually installed through roles and features in the server manager. ? In order to install on desktop machines, and to upgrade PowerShell, the Windows Management Framework will need to be downloaded and installed. ? Free from Microsoft's website. ? Standard PowerShell is backward compatible.

HRPCUG

Installing/Starting PowerShell (Cont.)

? Normal PowerShell VS PowerShell ISE ? A normal PowerShell window looks like a cmd prompt window with a PS to the left of the input prompt. ? Typing "powershell" into a cmd window will turn it into a PS window. ? Reads one line at a time as you hit enter.

? PowerShell ISE (Interactive Scripting Environment) ? Program that incorporates both a text editor and a PowerShell prompt. ? Scripts can be created in the text editor and then ran, or partially ran, in the PowerShell Prompt. ? The text editor will point out some errors, along with offering some auto complete options.

HRPCUG

Installing/Starting PowerShell (Cont.)

Prompt

ISE

PowerShell Basics

- Variables

? Variables ? scripting/programming storage containers ($) ? A variable is where PowerShell (and other scripting/programming languages) stores data. This can include data produced/manipulated by PowerShell or data from an external source like a .txt file. ? A variable is declared when a `$' is put in front of a word. ? For example "$dog" declares a variable. ? Following a variable with an "=" symbol will assign the following value to that variable, for example "$dog = `Sally'" will assign Sally to $dog. Anytime $dog is called it will be replaced with this value. ? A variable containing a string (word or series of words) needs to be surrounded by single or double quotes.

HRPCUG

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download