PowerShell

PowerShell is a Object Oriented command line shell and scripting language that is used for task automation and configuration management, which is built on the .Net and .Net Core.
PowerShell can interact with any Windows created software, sites, lists.
Some software configuration can only be accessed through PowerShell
Documantation for PowerShell: docs.microsoft.com

cmdlet

cmdlet (“command-let”) is a specialized .Net class that implements a specific task or operation and will have required and optional parameters.
Naming convention used to construct a cmdlet follows a verb-noun object name. Verbs are action oriented words, such as Add, Get, Set, Update; Nouns describe what will be acted on such as Get-Azure(Azure Cloud Service), New-ADUser (Active Directory User), Get-SPUser (Sharepoint User). The Nouns may represent core module objects and verbs may invoke methods/commands that were developed to be run as cmdlets. Example Microsoft.Sharepoint.PowerShell.dll includes over 800 commands.

Important cmdlets:

get-Command this will display all the cmdlets that are available in the current PowerShell Session. This can be filter using get-Command -noun [name] ([name] can use *wilcard* for searching and matching nouns)

get-Help displays help information for any cmdlet and can be set for 3 levels of details: Normal, Detailed, and Full

get-Member displays a list of all the methods and properties that are associated with any cmdlets using piplines

where-Object creates a filtered list of the objects where objects matches the criteria parameter

pipeline

The concept of passing of a result of a command to another command.
command-x | command-y |command-z
same as (command-z (command-y (command-x)))
Example get-Service | where-Object {$_.DisplayName -like “Sharep*”}
Returns objects where DisplayName starts with Sharep

parameter set

parameter sets are different ways to run a certain command which are mutually exclusive and can’t be combined. Listed in the get-Help result Syntax. This will list parameters can be run at the same time and list separate grouping called syntax for mutually exclusive parameter sets.

Variables

To create an Object variable in PowerShell use the $[object_name]

FolderBrowserDialog

PS C:\> $NanoFolderBrowser = New-Object System.Windows.Forms.FolderBrowserDialog
PS C:\> $NanoFolderBrowser 
ShowNewFolderButton : True
SelectedPath        : C:\Nano
RootFolder          : Desktop
Description         : 
Tag                 : 
Site                : 
Container           :

OpenFileDialog

$FileBrowser = New-Object 
System.Windows.Forms.OpenFileDialog
-Property @{ 
  Title = "Select Windows Server image"
  InitialDirectory = [Environment]::GetFolderPath('MyComputer') 
  MultiSelect = 'false'
  }
CheckFileExists              : True
Multiselect                  : True
ReadOnlyChecked              : False
ShowReadOnly                 : False
SafeFileName                 : Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO
SafeFileNames                : {Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO}
AddExtension                 : True
CheckPathExists              : True
DefaultExt                   : 
DereferenceLinks             : True
FileName                     : C:\Users\pc\Downloads\Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO
FileNames                    : {C:\Users\pc\Downloads\Windows_Server_2016_Datacenter_EVAL_en-us_14393_refresh.ISO}
Filter                       : 
FilterIndex                  : 0
InitialDirectory             : 
RestoreDirectory             : False
ShowHelp                     : False
SupportMultiDottedExtensions : False
Title                        : Select Folder for VHDX
ValidateNames                : True
CustomPlaces                 : {}
AutoUpgradeEnabled           : True
Tag                          : 
Site                         : 
Container                    :