PowerShell

PowerShell

#powershell

Table of Contents

About

1

Chapter 1: Getting started with PowerShell

2

Remarks

2

Versions

2

Examples

2

Installation or Setup

2

Windows

2

Other Platforms

3

Allow scripts stored on your machine to run un-signed

3

Aliases & Similar Functions

4

The Pipeline - Using Output from a PowerShell cmdlet

5

Commenting

6

Calling .Net Library Methods

6

Creating Objects

7

Chapter 2: ActiveDirectory module

9

Introduction

9

Remarks

9

Examples

9

Module

9

Users

9

Groups

10

Computers

10

Objects

10

Chapter 3: Aliases

12

Remarks

12

Examples

13

Get-Alias

13

Set-Alias

13

Chapter 4: Amazon Web Services (AWS) Rekognition

15

Introduction

15

Examples

15

Detect Image Labels with AWS Rekognition

15

Compare Facial Similarity with AWS Rekognition

16

Chapter 5: Amazon Web Services (AWS) Simple Storage Service (S3)

17

Introduction

17

Parameters

17

Examples

17

Create a new S3 Bucket

17

Upload a Local File Into an S3 Bucket

17

Delete a S3 Bucket

18

Chapter 6: Anonymize IP (v4 and v6) in text file with Powershell

19

Introduction

19

Examples

19

Anonymize IP address in text file

19

Chapter 7: Archive Module

21

Introduction

21

Syntax

21

Parameters

21

Remarks

21

Examples

22

Compress-Archive with wildcard

22

Update existing ZIP with Compress-Archive

22

Extract a Zip with Expand-Archive

22

Chapter 8: Automatic Variables

23

Introduction

23

Syntax

23

Examples

23

$pid

23

Boolean values

23

$null

23

$OFS

24

$_ / $PSItem

24

$?

25

$error

25

Chapter 9: Automatic Variables - part 2

26

Introduction

26

Remarks

26

Examples

26

$PSVersionTable

26

Chapter 10: Basic Set Operations

27

Introduction

27

Syntax

27

Examples

27

Filtering: Where-Object / where / ?

27

Ordering: Sort-Object / sort

28

Grouping: Group-Object / group

29

Projecting: Select-Object / select

29

Chapter 11: Built-in variables

32

Introduction

32

Examples

32

$PSScriptRoot

32

$Args

32

$PSItem

32

$?

33

$error

33

Chapter 12: Calculated Properties

34

Introduction

34

Examples

34

Display file size in KB - Calculated Properties

34

Chapter 13: Cmdlet Naming

35

Introduction

35

Examples

35

Verbs

35

Nouns

35

Chapter 14: Comment-based help

36

Introduction

36

Examples

36

Function comment-based help

36

Script comment-based help

38

Chapter 15: Common parameters

41

Remarks

41

Examples

41

ErrorAction parameter

41

-ErrorAction Continue

41

-ErrorAction Ignore

41

-ErrorAction Inquire

42

-ErrorAction SilentlyContinue

42

-ErrorAction Stop

42

-ErrorAction Suspend

43

Chapter 16: Communicating with RESTful APIs

44

Introduction

44

Examples

44

Use Incoming Webhooks

44

Post Message to hipChat

44

Using REST with PowerShell Objects to Get and Put individual data

44

Using REST with PowerShell Objects to GET and POST many items

45

Using REST with PowerShell to Delete items

45

Chapter 17: Conditional logic

46

Syntax

46

Remarks

46

Examples

46

if, else and else if

46

Negation

47

If conditional shorthand

47

Chapter 18: Creating DSC Class-Based Resources

49

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

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

Google Online Preview   Download