Lesson-2 : Introduction to Windows Powershell

Check the version of poweshell

 

$psversiontable - press tab else just press enter

PS C:\WINDOWS\system32> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.26100.7462
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.26100.7462
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

The core version of powershell version must be installed from github. You can jump between these two versions after installing the core version.

Command line fundamentals

I might want a record of everything that I have typed in the current session including the errors that I received

Start-Transcriptstar


The PowerShell ReadLine module refers to PSReadLine, a built-in module that enhances the command-line experience in PowerShell.

Get-Process
Get-Service -Name c  -- Ctl + space (button) navigate with the highlighter

History backward 

Ctl + R 

Introduction to Windows Terminal

New Powershell Console

Alt + Shift + Plus  -- Opens up another console horizontally

Alt + Shift + Plus -- Opens up another console virtically

 Ctl +  ( = or the plus button) -- to enlarge the 

 Ctl +  ( - or the Minus button) -- to enlarge the  

 Atl + Arrows to jump from one pane to another pane

 Atl + Shift + Left arrow  -- to enlarge the pane to the left 

Atl + shift + right -- to enlarge the pane to the right

 Ctl + Shift + W -- to close down the current pane

 

 Understanding Cmdlet Structure

verb-noun 

Get-Services 

 


 


If you want to query a remote system you can use comma to seperate services in this case computer names as well.

 

Getting Help  

Get-Help Get-Service

help Get-Service 

help Get-Service -Full

Press - Enter Key to scroll page by page if using - help

Press Space Key to scroll down page by page

Press "q" to exit

Another way to show full window

help Get-Service -ShowWindow

 

HELP UDPATE 

The help module data is pretty much empty you may have to update the help

>>> update-help 

          Using Wildcard characters

          >>> help abou* 

          >>> help *user* 

you can also use Get command

         >>>  Get-Command *user* -module ActiveDirectory


Some commands are not installed in your system and will not be found on the system 

find command -- reaches out to power shell galary 

filter out 

       >>> find-command -tag NTFS

The other way we will get information about our commands

>>> show-commands 

>>> show-command Get-Hotfix



Working with Powershell Modules

How do I extend poershells functionality with these additional commands. Modules are these way we add new functionality into powershell 


>>> Get-Module -- tells me which modules are loaded in my sesssion it doesnt tell you what modules you have installed in your computer

 >>> Get-Module --ListAvailable 

>>> Find-Module Az

>>> Find-Module Az -AllVersions

It lists all available versions of the Az PowerShell module that are published in the PowerShell Gallery (online repository), not just the latest one

>>> Install-Module Az



Comments