fig : PowerShell – “Windows PowerShell ISE” – executing first CMDLET – Get-Help
Topics
- What is PowerShell
- What are PowerShell CMDLETs
- To whom for PowerShell
- PowerShell features
- Why to use PowerShell
- PowerShell tools
- Writing our first PowerShell – Getting started
What is PowerShell
- Microsoft defines PowerShell – PowerShell is a cross-platform task automation solution made up of a
- command-line shell
- a scripting language and
- a configuration management framework
- PowerShell runs on Windows, Linux, and macOS
- PowerShell is commonly used for automating the management of systems
- PowerShell accepts and returns .NET objects. It works objects over texts
- PowerShell is built on .NET Common Language Runtime (CLR)
- Commands for PowerShell are known as CMDLETs(pronounced command-lets)
PowerShell CMDLETs
- Commands for PowerShell are known as CMDLETs(pronounced command-lets)
- PowerShell module is the collection of PowerShell CMDLETs
- PowerShell uses a Verb-Noun name pair to name cmdlets
- Examples –
- Get-Help – Here,
- Verb – Get : what action needs to perform and
- Noun – Help : resource on which CMDLET perform its actions
- Get-Help – Here,
PowerShell features
- Very good command-line history
- Intellisense – Tab completion
- Pipeline for chaining commands
- PowerShell scripting language is extensible through functions, classes, scripts and modules
- PowerShell scripting have built-in support for common data formats like CSV, JSON and XML
- Easy output formatting
- Built-in help system – Provides detailed information about commands and also integrate online help articles
- Aliases –
- Aliases are alternate names that can be used to run CMDLETS
- PowerShell supports the use of common aliases such as cls (clear the screen) and ls (list the files)
- This helps users from other frameworks and helps to remember PowerShell name for there familiar commands
For Whom
- Basically for all kind of administrators
- System administrators
- Cloud administrators (In case of Microsoft – Azure Administrator, Azure AD Administrator, SharePoint Online Administrators, Exchange Administrators and so on)
- Developers
- Deployment team
- Even for QAs as well for testing purpose
Why to use PowerShell
- To build, test and deploy the solutions and mostly in CI/CD environments
- PowerShell helps to automate administrative tasks
- To manage cloud – To manage cloud resources. Get / Update / Deploy – cloud resources
- Creating users in Microsoft 365
- Creating groups in Azure AD and so on
- CI / CD – used as part of a Continuous Integration/Continuous Deployment pipeline
- This list is very long, we will be keep exploring in upcoming articles of tutorial
PowerShell tools
- We can use following tools to execute PowerShell CMDLETs or scripts
- Visual Studio Code – https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell
- Windows PowerShell ISE
Writing our first PowerShell – Getting started
- We could see all PowerShell releases at – https://github.com/PowerShell/PowerShell/releases
- There are lots of available PowerShell CMDLETs we can use or we can write script as well as per our need
- Today as a first PowerShell CMDLET, I’ll discuss Get-Help CMDLET
- I’ll use Windows PowerShell ISE
- Following are the steps
STEP 1 – Choose the tool to execute CMDLET / write Script – Open the PowerShell ISE
fig : PowerShell – Opening “Windows PowerShell ISE”
- As PowerShell ISE opens it looks like as below
- There are two panes to – PowerShell ISE
- Script Pane
- Console
fig : PowerShell – “Windows PowerShell ISE” – executing first CMDLET – Get-Help
Step 2 – In console window use CMDLET – Get-Help as Get-Help
fig : PowerShell – “Windows PowerShell ISE” – executing first CMDLET – Get-Help
Get-Help – Displays information about PowerShell commands and concepts.