PowerShell® Notes for Professionals book

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

What people are saying about this PowerShell® Notes for Professionals book This is outstanding! filling in lots of gaps in my knowledge Whoa, this is a treasure trove! Thanks As a guy who writes all of his code in PowerShell, I love this. Chuck Norris Thumbs Up Grabbed a handful. The powershell one is neat, judging by a quick squizz. 200 Pages, very short but plenty of examples, rules and hints. Love it. This book is almost entire syntax. I really like it! Fantastic for folks that are coming from another language that just need to know how to use existing concepts. This is wonderful! Thanks a ton! The PowerShell® Notes for Professionals book is compiled from Stack Overflow Documentation, the content is written by the beautiful people at Stack Overflow. Text content is released under Creative Commons BY-SA. See credits at the end of this book whom contributed to the various chapters. Images may be copyright of their respective owners unless otherwise specified Book created for educational purposes and is not affiliated with PowerShell® group(s), company(s) nor Stack Overflow. All trademarks belong to their respective company owners 184 pages, published on May 2019

Author(s): GoalKicker Books
Series: Programming Notes for Professionals
Publisher: GoalKicker Books
Year: 2019

Language: English
Pages: 184
Tags: Programming, Notes, PowerShell, Professionals

Content list
About
Chapter 1: Getting started with PowerShell
Section 1.1: Allow scripts stored on your machine to run un-signed
Section 1.2: Aliases & Similar Functions
Section 1.3: The Pipeline - Using Output from a PowerShell cmdlet
Section 1.4: Calling .Net Library Methods
Section 1.5: Installation or Setup
Section 1.6: Commenting
Section 1.7: Creating Objects
Chapter 2: Variables in PowerShell
Section 2.1: Simple variable
Section 2.2: Arrays
Section 2.3: List Assignment of Multiple Variables
Section 2.4: Scope
Section 2.5: Removing a variable
Chapter 3: Operators
Section 3.1: Comparison Operators
Section 3.2: Arithmetic Operators
Section 3.3: Assignment Operators
Section 3.4: Redirection Operators
Section 3.5: Mixing operand types, the type of the left operand dictates the behavior
Section 3.6: Logical Operators
Section 3.7: String Manipulation Operators
Chapter 4: Special Operators
Section 4.1: Array Expression Operator
Section 4.2: Call Operation
Section 4.3: Dot sourcing operator
Chapter 5: Basic Set Operations
Section 5.1: Filtering: Where-Object / where / ?
Section 5.2: Ordering: Sort-Object / sort
Section 5.3: Grouping: Group-Object / group
Section 5.4: Projecting: Select-Object / select
Chapter 6: Conditional logic
Section 6.1: if, else and else if
Section 6.2: Negation
Section 6.3: If conditional shorthand
Chapter 7: Loops
Section 7.1: Foreach
Section 7.2: For
Section 7.3: ForEach() Method
Section 7.4: ForEach-Object
Section 7.5: Continue
Section 7.6: Break
Section 7.7: While
Section 7.8: Do
Chapter 8: Switch statement
Section 8.1: Simple Switch
Section 8.2: Switch Statement with CaseSensitive Parameter
Section 8.3: Switch Statement with Wildcard Parameter
Section 8.4: Switch Statement with File Parameter
Section 8.5: Simple Switch with Default Condition
Section 8.6: Switch Statement with Regex Parameter
Section 8.7: Simple Switch With Break
Section 8.8: Switch Statement with Exact Parameter
Section 8.9: Switch Statement with Expressions
Chapter 9: Strings
Section 9.1: Multiline string
Section 9.2: Here-string
Section 9.3: Concatenating strings
Section 9.4: Special characters
Section 9.5: Creating a basic string
Section 9.6: Format string
Chapter 10: HashTables
Section 10.1: Access a hash table value by key
Section 10.2: Creating a Hash Table
Section 10.3: Add a key value pair to an existing hash table
Section 10.4: Remove a key value pair from an existing hash table
Section 10.5: Enumerating through keys and Key-Value Pairs
Section 10.6: Looping over a hash table
Chapter 11: Working with Objects
Section 11.1: Examining an object
Section 11.2: Updating Objects
Section 11.3: Creating a new object
Section 11.4: Creating Instances of Generic Classes
Chapter 12: PowerShell Functions
Section 12.1: Basic Parameters
Section 12.2: Advanced Function
Section 12.3: Mandatory Parameters
Section 12.4: Parameter Validation
Section 12.5: Simple Function with No Parameters
Chapter 13: PowerShell Classes
Section 13.1: Listing available constructors for a class
Section 13.2: Methods and properties
Section 13.3: Constructor overloading
Section 13.4: Get All Members of an Instance
Section 13.5: Basic Class Template
Section 13.6: Inheritance from Parent Class to Child Class
Chapter 14: PowerShell Modules
Section 14.1: Create a Module Manifest
Section 14.2: Simple Module Example
Section 14.3: Exporting a Variable from a Module
Section 14.4: Structuring PowerShell Modules
Section 14.5: Location of Modules
Section 14.6: Module Member Visibility
Chapter 15: PowerShell profiles
Section 15.1: Create an basic profile
Chapter 16: Calculated Properties
Section 16.1: Display file size in KB - Calculated Properties
Chapter 17: Using existing static classes
Section 17.1: Adding types
Section 17.2: Using the .Net Math Class
Section 17.3: Creating new GUID instantly
Chapter 18: Built-in variables
Section 18.1: $PSScriptRoot
Section 18.2: $Args
Section 18.3: $PSItem
Section 18.4: $?
Section 18.5: $error
Chapter 19: Automatic Variables
Section 19.1: $OFS
Section 19.2: $?
Section 19.3: $null
Section 19.4: $error
Section 19.5: $pid
Section 19.6: Boolean values
Section 19.7: $_ / $PSItem
Section 19.8: $PSVersionTable
Chapter 20: Environment Variables
Section 20.1: Windows environment variables are visible as a PS drive called Env:
Section 20.2: Instant call of Environment Variables with $env:
Chapter 21: Splatting
Section 21.1: Piping and Splatting
Section 21.2: Passing a Switch parameter using Splatting
Section 21.3: Splatting From Top Level Function to a Series of Inner Function
Section 21.4: Splatting parameters
Chapter 22: PowerShell "Streams"; Debug, Verbose, Warning, Error, Output and Information
Section 22.1: Write-Output
Section 22.2: Write Preferences
Chapter 23: Sending Email
Section 23.1: Send-MailMessage with predefined parameters
Section 23.2: Simple Send-MailMessage
Section 23.3: SMTPClient - Mail with .txt file in body message
Chapter 24: PowerShell Remoting
Section 24.1: Connecting to a Remote Server via PowerShell
Section 24.2: Run commands on a Remote Computer
Section 24.3: Enabling PowerShell Remoting
Section 24.4: A best practise for automatically cleaning-up PSSessions
Chapter 25: Working with the PowerShell pipeline
Section 25.1: Writing Functions with Advanced Lifecycle
Section 25.2: Basic Pipeline Support in Functions
Section 25.3: Working concept of pipeline
Chapter 26: PowerShell Background Jobs
Section 26.1: Basic job creation
Section 26.2: Basic job management
Chapter 27: Return behavior in PowerShell
Section 27.1: Early exit
Section 27.2: Gotcha! Return in the pipeline
Section 27.3: Return with a value
Section 27.4: How to work with functions returns
Section 27.5: Gotcha! Ignoring unwanted output
Chapter 28: CSV parsing
Section 28.1: Basic usage of Import-Csv
Section 28.2: Import from CSV and cast properties to correct type
Chapter 29: Working with XML Files
Section 29.1: Accessing an XML File
Section 29.2: Creating an XML Document using XmlWriter()
Section 29.3: Adding snippets of XML to current XMLDocument
Chapter 30: Communicating with RESTful APIs
Section 30.1: Post Message to hipChat
Section 30.2: Using REST with PowerShell Objects to GET and POST many items
Section 30.3: Use Slack.com Incoming Webhooks
Section 30.4: Using REST with PowerShell Objects to Get and Put individual data
Section 30.5: Using REST with PowerShell to Delete items
Chapter 31: PowerShell SQL queries
Section 31.1: SQLExample
Section 31.2: SQLQuery
Chapter 32: Regular Expressions
Section 32.1: Single match
Section 32.2: Replace
Section 32.3: Replace text with dynamic value using a MatchEvalutor
Section 32.4: Escape special characters
Section 32.5: Multiple matches
Chapter 33: Aliases
Section 33.1: Get-Alias
Section 33.2: Set-Alias
Chapter 34: Using the progress bar
Section 34.1: Simple use of progress bar
Section 34.2: Usage of inner progress bar
Chapter 35: PowerShell.exe Command-Line
Section 35.1: Executing a command
Section 35.2: Executing a script file
Chapter 36: Cmdlet Naming
Section 36.1: Verbs
Section 36.2: Nouns
Chapter 37: Running Executables
Section 37.1: GUI Applications
Section 37.2: Console Streams
Section 37.3: Exit Codes
Chapter 38: Enforcing script prerequisites
Section 38.1: Enforce minimum version of PowerShell host
Section 38.2: Enforce running the script as administrator
Chapter 39: Using the Help System
Section 39.1: Updating the Help System
Section 39.2: Using Get-Help
Section 39.3: Viewing online version of a help topic
Section 39.4: Viewing Examples
Section 39.5: Viewing the Full Help Page
Section 39.6: Viewing help for a specific parameter
Chapter 40: Modules, Scripts and Functions
Section 40.1: Function
Section 40.2: Script
Section 40.3: Module
Section 40.4: Advanced Functions
Chapter 41: Naming Conventions
Section 41.1: Functions
Chapter 42: Common parameters
Section 42.1: ErrorAction parameter
Chapter 43: Parameter sets
Section 43.1: Parameter set to enforce the use of a parameter when a other is selected
Section 43.2: Parameter set to limit the combination of parameters
Chapter 44: PowerShell Dynamic Parameters
Section 44.1: "Simple" dynamic parameter
Chapter 45: GUI in PowerShell
Section 45.1: WPF GUI for Get-Service cmdlet
Chapter 46: URL Encode/Decode
Section 46.1: Encode Query String with `[System.Web.HttpUtility]::UrlEncode()`
Section 46.2: Quick Start: Encoding
Section 46.3: Quick Start: Decoding
Section 46.4: Encode Query String with `[uri]::EscapeDataString()`
Section 46.5: Decode URL with `[uri]::UnescapeDataString()`
Section 46.6: Decode URL with `[System.Web.HttpUtility]::UrlDecode()`
Chapter 47: Error handling
Section 47.1: Error Types
Chapter 48: Package management
Section 48.1: Create the default PowerShell Module Repository
Section 48.2: Find a module by name
Section 48.3: Install a Module by name
Section 48.4: Uninstall a module my name and version
Section 48.5: Update a module by name
Section 48.6: Find a PowerShell module using a pattern
Chapter 49: TCP Communication with PowerShell
Section 49.1: TCP listener
Section 49.2: TCP Sender
Chapter 50: PowerShell Workflows
Section 50.1: Workflow with Input Parameters
Section 50.2: Simple Workflow Example
Section 50.3: Run Workflow as a Background Job
Section 50.4: Add a Parallel Block to a Workflow
Chapter 51: Embedding Managed Code (C# | VB)
Section 51.1: C# Example
Section 51.2: VB.NET Example
Chapter 52: How to download latest artifact from Artifactory using PowerShell script (v2.0 or below)?
Section 52.1: PowerShell Script for downloading the latest artifact
Chapter 53: Comment-based help
Section 53.1: Function comment-based help
Section 53.2: Script comment-based help
Chapter 54: Archive Module
Section 54.1: Compress-Archive with wildcard
Section 54.2: Update existing ZIP with Compress-Archive
Section 54.3: Extract a Zip with Expand-Archive
Chapter 55: Infrastructure Automation
Section 55.1: Simple script for black-box integration test of console applications
Chapter 56: PSScriptAnalyzer - PowerShell Script Analyzer
Section 56.1: Analyzing scripts with the built-in preset rulesets
Section 56.2: Analyzing scripts against every built-in rule
Section 56.3: List all built-in rules
Chapter 57: Desired State Configuration
Section 57.1: Simple example - Enabling WindowsFeature
Section 57.2: Starting DSC (mof) on remote machine
Section 57.3: Importing psd1 (data file) into local variable
Section 57.4: List available DSC Resources
Section 57.5: Importing resources for use in DSC
Chapter 58: Using ShouldProcess
Section 58.1: Full Usage Example
Section 58.2: Adding -WhatIf and -Confirm support to your cmdlet
Section 58.3: Using ShouldProcess() with one argument
Chapter 59: Scheduled tasks module
Section 59.1: Run PowerShell Script in Scheduled Task
Chapter 60: ISE module
Section 60.1: Test Scripts
Chapter 61: Creating DSC Class-Based Resources
Section 61.1: Create a DSC Resource Skeleton Class
Section 61.2: DSC Resource Skeleton with Key Property
Section 61.3: DSC Resource with Mandatory Property
Section 61.4: DSC Resource with Required Methods
Chapter 62: WMI and CIM
Section 62.1: Querying objects
Section 62.2: Classes and namespaces
Chapter 63: ActiveDirectory module
Section 63.1: Users
Section 63.2: Module
Section 63.3: Groups
Section 63.4: Computers
Section 63.5: Objects
Chapter 64: SharePoint Module
Section 64.1: Loading SharePoint Snap-In
Section 64.2: Iterating over all lists of a site collection
Section 64.3: Get all installed features on a site collection
Chapter 65: Introduction to Psake
Section 65.1: Basic outline
Section 65.2: FormatTaskName example
Section 65.3: Run Task conditionally
Section 65.4: ContinueOnError
Chapter 66: Introduction to Pester
Section 66.1: Getting Started with Pester
Chapter 67: Handling Secrets and Credentials
Section 67.1: Accessing the Plaintext Password
Section 67.2: Prompting for Credentials
Section 67.3: Working with Stored Credentials
Section 67.4: Storing the credentials in Encrypted form and Passing it as parameter when Required
Chapter 68: Security and Cryptography
Section 68.1: Calculating a string's hash codes via .Net Cryptography
Chapter 69: Signing Scripts
Section 69.1: Signing a script
Section 69.2: Bypassing execution policy for a single script
Section 69.3: Changing the execution policy using Set-ExecutionPolicy
Section 69.4: Get the current execution policy
Section 69.5: Getting the signature from a signed script
Section 69.6: Creating a self-signed code signing certificate for testing
Chapter 70: Anonymize IP (v4 and v6) in text file with PowerShell
Section 70.1: Anonymize IP address in text file
Chapter 71: Amazon Web Services (AWS) Rekognition
Section 71.1: Detect Image Labels with AWS Rekognition
Section 71.2: Compare Facial Similarity with AWS Rekognition
Chapter 72: Amazon Web Services (AWS) Simple Storage Service (S3)
Section 72.1: Create a new S3 Bucket
Section 72.2: Upload a Local File Into an S3 Bucket
Section 72.3: Delete a S3 Bucket
Credits
You may also like