Book Image

Learn PowerShell Core 6.0

By : David das Neves, Jan-Hendrik Peters
Book Image

Learn PowerShell Core 6.0

By: David das Neves, Jan-Hendrik Peters

Overview of this book

Beginning with an overview of the different versions of PowerShell, Learn PowerShell Core 6.0 introduces you to VSCode and then dives into helping you understand the basic techniques in PowerShell scripting. You will cover advanced coding techniques, learn how to write reusable code as well as store and load data with PowerShell. This book will help you understand PowerShell security and Just Enough Administration, enabling you to create your own PowerShell repository. The last set of chapters will guide you in setting up, configuring, and working with Release Pipelines in VSCode and VSTS, and help you understand PowerShell DSC. In addition to this, you will learn how to use PowerShell with Windows, Azure, Microsoft Online Services, SCCM, and SQL Server. The final chapter will provide you with some use cases and pro tips. By the end of this book, you will be able to create professional reusable code using security insight and knowledge of working with PowerShell Core 6.0 and its most important capabilities.
Table of Contents (26 chapters)
Title Page
Dedication
Packt Upsell
Contributors
Preface
Index

Chapter 3


  1. In an object-oriented language, every object that is being used and returned is of an explicit object type. You have the benefit of encapsulation, polymorphism, and inheritance, which makes programming easier and fault-tolerant.
  2. # singleline comment  and <# multiline comment #>.
  3. With regions, you can divide your code into separate blocks and name them. It is a good way to hide unnecessary code. #region newregion code #endregion
  4. You can use the same cmdlets for every PSProvider and list all objects.
  5. $stringvar = 'string' or [string]$stringvar = 'string'.
  6. Get-, Set-, New-, Remove- 
  7. Get-Command
  8. Get-Helpcmdlet
  9. In general, a pipeline sends the output of the preceding function or cmdlet to the next one. Its output is bound to the parameters of the following cmdlets, by type. The pipeline always executes from left to right. 
  10. [String][Char][Byte], [Int][Long][Decimal][Single], [Double],[Bool], [DateTime][XML], [Array][Hashtable]

  11. if...else, if...elseif, switch
  12. for loop – iterates values do until – executes code until a condition is fulfilled do while – executes code while a condition is fulfilled - at least one iteration while loop – executes code while condition is fulfilled  foreach loop – iterates through all objects in a list or array