Getting started with PowerShell

Getting started with PowerShell

Introduction

Like Bash scripting is commonly used in Unix-based systems, including Linux and macOS. similarly, PowerShell is indeed a powerful scripting language and automation framework primarily associated with Windows operating systems, It is One the Most Demanded Skill in now a Days used for automating the manual tasks.

Features

PowerShell is not just a Scripting Language, it is also a Command-line Shell. PowerShell is built upon .net framework. Provides Administrator friendly interface of .net framework. This language is not Case Sensitive.

Command Prompt VS PowerShell

Command Prompt (CMD) is a basic tool for running simple commands, PowerShell (PS) is a more versatile and powerful scripting language and automation framework. PowerShell's object-oriented approach, structured output, and extensive integration capabilities make it the preferred choice for many Windows administrators and developers.

User Interface:

⬛CMD: Command Prompt has a simple text-based interface. You type commands, and it displays text output.

🟦PS: PowerShell also uses text, but it outputs objects instead of plain text. This means data in PowerShell is structured and can be easily manipulated and passed around.

Commands :

⬛ CMD: Command Prompt uses commands and executables. Commands are typically single-purpose and don't always provide structured output.

🟦PS: PowerShell uses cmdlets (pronounced command-lets), which are small, focused commands designed to do specific tasks. These cmdlets output objects, making it easier to work with data.

Scripting:

⬛CMD: Command Prompt has limited scripting capabilities. It uses batch files with a .bat or .cmd extension, but these are less powerful and flexible.

🟦 PS: PowerShell is a powerful scripting language. Scripts can be written to automate complex tasks, and PowerShell code is more versatile and readable, especially for automation and system management tasks.

Object-Oriented vs. Text-Based:

⬛CMD: CMD deals primarily with plain text output, which can be harder to manipulate programmatically.

🟦PS: PowerShell deals with structured objects. This makes it easier to filter, sort, and manipulate data, making it more versatile for automation tasks.

Integration and Extensibility:

⬛ CMD: While CMD can run other programs, it doesn't easily integrate with other technologies or services.

🟦 PS: PowerShell can work with .NET objects, COM objects, WMI, REST APIs, and more. It has extensive integration capabilities, making it a powerful tool for system administrators and developers.

PowerShell ISE vs VS code

PowerShell ISE:

PowerShell ISE is specialized for PowerShell scripting, while VS Code is a general-purpose code editor with broader language support.

Purpose:

Specifically designed for PowerShell scripting and automation tasks.

Integration: Comes pre-installed with Windows and tightly integrated with PowerShell.

Features: Basic code editing features. Built-in PowerShell console for running scripts. Script pane and output pane for a simple interface. Limited extensibility and customization options.

VS code/Visual studio code

Purpose:

A versatile code editor for various programming languages and technologies.

Integration: Supports PowerShell through extensions available in the marketplace.

Features: Rich code editing features with syntax highlighting and IntelliSense. Integrated Git and extensive plugin support for various languages. Powerful extensions marketplace for adding functionalities like PowerShell support. Customizable and adaptable to different development workflows.