Basic fundamentals of PowerShell made easy.

In this session will start from when, what, where and cover the basic fundamentals of PowerShell that will get you started on the right track. If you ask what PowerShell is to people around you, you will get variety of answers. Do not get confused. I will take you step by step with appropriate examples.
Windows user/admins has never enjoyed the magnificent shell scripting environments that Linux have. This phenomenal change happened with addition of PowerShell as a feature within Windows Server 2008, and now the inclusion of PowerShell as part of the Windows as Microsoft’s command-line shell and scripting language.
Time when I thought to try PowerShell, and it was a hard time to get answer o
What to write? Where to write? AND many more….
Let’s start answering top 10 questions one by one that has arrived at first time.
- What is PowerShell?
PowerShell is Microsoft in-built Command Line Interface feature of Windows Operating System.
- How to Open Interface?
Fig 0.1 Start
Fig 0.2 Right Click
- How it Look?
Fig 0.3 Console and ISE
- Which host to use for writing scripts?
The Windows PowerShell Console and Integrated Scripting Environment (ISE) are two hosts for the Windows PowerShell engine and language. With ISE you can write, run, and test scripts in ways that are not available in the Windows PowerShell Console. The ISE adds syntax-coloring, tab completion, IntelliSense, visual debugging, and context sensitive Help.
Console pane is attached to ISE.
- What is the version I am using?
Command to get PowerShell version is $PSVersionTable.PSVersion.
Fig 0.4 Version
PowerShell 1.0 is the first version released on November 2006 for Windows Server 2008.
Latest version of PowerShell is PowerShell 5.1 as shown above which is the first version to come in two editions of “Desktop” and “Core”. Latest in core is PowerShell Core 6.0.
- What are other Operating Systems which support PowerShell?
PowerShell uses .NET on Windows OS, you can run PowerShell on any operating system that has the Common Language Runtime (CLR).
For other operating systems (Like Linux), you can use the CoreCLR, an open-source, cross-platform subset of the .NET Framework.
- Which Sample Command I should Run?
PowerShell Commands are called Cmdlets and pronounced as command-let (not CMD-let)
Cmdlets are in the form of singular Verb-Noun syntax such as Get-Service is pronounced Get Service ignoring the dash
As a first command you can start with Get-ChildItem, gci, dir, ls in any folder location.
Fig 0.5 Sample Command
- How to get Help?
Get-Command
The Get-Command is one of the most useful cmdlets in the whole of PowerShell, as it will help you getting to grips with PowerShell by letting you search for certain cmdlets.
Fig 0.6 Get-Command
Get-Help
Once you have found the cmdlet you are looking for using Get-Command, you would want to know the syntax of that specific cmdlet. This is where Get-Help comes in picture.
Fig 0.7 Command Help
And if you want to find CMDlets related to disk.
Fig 0.8 Word Help
- How to change format of result?
Let’s use Get-Service cmdlet.
Default Result –
Fig 0.9 Default Table Format
Table Format – Desired column sequence
Fig 0.10 Table Format
List Format
Fig 0.11 List Format
Format Wide
Fig 0.12 Wide Format
HTML Format
Fig 0.13 HTML Format
HTML Output as a File
Fig 0.14 Out Put as HTML File.
- What PowerShell uses from Windows System?
- Administer processes — To list, monitor, stop, and start processes.
- Manage the file system — To create, delete, modify, and set permissions for files and folders.
- Administer services — To list, stop, start, restart, and even modify services.
- Manage the Registry — To list, monitor, stop, and start processes.
- Use Windows Management Instrumentation (WMI) — To manage other platforms such as IIS and Terminal Services.
- Use existing Component Object Model (COM) objects — To complete an extensive variety of automation tasks.
- Administer several Windows roles and features — To add or remove roles and features.
PowerShell modules bring extendibility to the systems administrator, DBA, and developer.
In my next article I will talk about
What is WMI?
How to write Scripts?
How to automate daily work?
Happy Coding.
Thanks for reading
Keep reading , share your thoughts, experiences. Feel free to contact us to discuss more. If you have any suggestion / feedback / doubt, you are most welcome.
Stay tuned on Knowledge-Junction, will come up with more such articles / news
You must be logged in to post a comment.