TECHDIIP

  • Tech
  • Windows
  • Powershell
  • Scripts
  • News
  • Games

Powershell Learning

10 November 2020 admin Leave a Comment

If you are looking for a PowerShell learning website as a resource to learn Powershell quickly, then you are at the right place, this techdiip.com teaches you PowerShell exactly what is required to start off and the subject material you need to become a scripter, spare your 30 minutes of your time for two weeks on this website and I’m confident that one can understand, modify and write the PowerShell scripts, Let’s begin our journey! Let’s Discuss what is Powershell. Powershell is a task-based command-line shell interface and scripting language, built on .NET framework, the aim of Powershell enables administrators to automate the tasks, it could be related to Windows servers operations, desktop machines, Linux, or macOS. Powershell commands allow you to automate the manage every option available on the windows machines like active directory, IIS Administration, Sharepoint configuration, Windows GPO, Registry, applications configuration The Powershell release version has been started from 1.0 and the latest version available now is 7.0, our topics cover 5.5 and 6.0 and there is no difference in terms of commands you learn here, they all work on all the versions. Powershell Basics Here is a bit of Powershell Version history with respective windows platforms.
PS Version Windows Version
1 windows XP / Server 2008 2006-11-01
2 windows 7 / Server 2008 R2 2009-11-01
3 windows 8 / Server 2012 2012-08-01
4 windows 8.1 / Server 2012 R2 2013-11-01
5 windows 10 / Server 2016  2015-12-16
How to open PowerShell? Start menu, type PowerShell.exe, you will find the list of PowerShell components see the below screenshot and hit the Enter to open the PowerShell command-line application. Here is how PowerShell command-line interface window looks. Powershell ISE The powershell Integrated Scripting Environment (ISE) is a scripting console window for writing the command, testing, debugging and executing for final output, it’s a graphical user interface for editing the scripts. To Open ISE from the run command or from the command prompt just type Powershell ISE and hit enter, the ISE window will be opened. Windows powershell ISE is very powerful scripting environment which allows administrators to run multiple scripts simultaneously, scripts will be executes as jobs and run in the background, we will discuss more about background jobs in our next chapters. Here is how PowerShell ISE window looks.
Powershell Learning
How to check Powershell Version Let’s learn how to check the current Powershell version, there is a default variable $PSVersionTable available to check what version is currently installed on your machine. See the Output of this $PSVersionTable variable. Open PowerShell and type  $PSVersionTable, then hit enter. PS C:\Windows\system32> $PSVersionTable
Powershell Learning
You can also verify the same using the command get-host on the machines.

Powershell Learning

PowerShell Variables There are many types of variables in Powershell and we call variable is an address or box in the computer memory that has a name and these are used for storing the values. Powershell Supports variables like text strings, integers, decimals, arrays, and even advanced types like version numbers, see the syntax usage of these variables.
  1. [int] or [int32] Used for storing 32-bit signed integer
  2. [long] Used for storing 64-bit signed integer
  3. [char] Used for storing Unicode 16-bit character
  4. [string] Used for storing Fixed-length string of Unicode characters
  5. [single] or [float] Used for storing Single-precision 32-bit floating-point number
  6. [double] Used for storing Double-precision 64-bit floating-point number
  7. [decimal] Used for storing 128-bit decimal value
  8. [bool] Used for storing True/false value
  9. [byte] Used for storing 8-bit unsigned integer
  10. [array] Used for storing an array of values
  11. [hashtable] Used for storing Hashtable object (similar to a Dictionary object)
  12. [xml] Used for storing XML document object
  13. [DateTime] Used for representing Date & time object.
  14. [TimeSpan] Used for representing Time interval.
  15. [PsObject] Used for representing PowerShell object.
  16. [Switch] Used for representing the PowerShell Switch parameter.
  17. [SctiptBlock] Used for representing PowerShell Script object.
  18. [RegEx] Used for representing Regular expression.
Examples: 
1) [int]$var, [int]$raj = 12345 2) $arry = @(1,2,3,4,5), $raj = @ (“one”,”two”,”three”) 3) [string]$var1 = “raja”  , [string]$var2 = “powershell” 4) [char]$var7 = 0x265b ; [char]$var8 = 0x275b 5) [long] $var9 = 2345678903 6) [double]$var11 = 55888.5378 7) [decimal] $var12 = 23323.333456d 8) $var13 = get-date 9) $var13 = @{1=”one”; 2=”two”; 3=”three”} 10) [bool]   $var =$true; $raja=$false Powershell Default Variables: There are many default variables available in powershell, these are important and mostly used. 1) $Error : This variable gives an array of error objects that represent the most recent error, to get the most recent error use the array index as $Error[0] 2) $False :  This variable contains the False, we use this in our scripts to validate the functions. 3) $HOME : This variable contains the full path of user home directory and it is equivalent of the “$env:homedrive$env:homepath” 4) $Null :  This is also a default variable contains a null value. 5) $Profile :  this variable contains the full path of the current user. 6) $MyInvocation : This default variable contains the information about the current command and has other property values, it used for script path location.

You May Also interested in reading…

1.     Powershell-top-10-commands 2.     5-Best free YouTube video to audio converters in 2020 3.     Top-5-notepad-tricks-that-you-should-know-in-2021 4.     Zoom-Testing

Thank you for reading this article, if you have any questions please let us know. Thank you for visiting my site, please make sure you have tested this script in our lower environment before you run in production.

Powershell

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Techdiip © 2012 - 2020 | Please Read Our

  • Privacy Policy
  • Disclaimer – User Agreement
  • About Us
  • Contact Us