Programming Playground

Powershell Playground

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of printing and typesetting.

images
What is PowerShell?

PowerShell is a task automation and configuration management framework from Microsoft. It consists of a command-line shell and an associated scripting language built on the .NET framework. Here are some key features and uses of PowerShell:

Key Features of PowerShell

Command-Line Interface (CLI):

PowerShell provides a command-line interface where users can run commands interactively.

Scripting Language:

It is also a powerful scripting language that allows for the automation of administrative tasks and configuration management.

Cmdlets:

PowerShell commands, known as cmdlets, follow a Verb-Noun naming convention (e.g., Get-Process, Set-Location). Cmdlets perform specific operations and can be combined in scripts for more complex tasks.

Pipelining:

PowerShell supports pipelining, allowing the output of one cmdlet to be passed as input to another cmdlet. This enables efficient data processing and task automation.

Object-Oriented:

Unlike traditional text-based shells, PowerShell works with objects. This allows for more powerful manipulation of data, as cmdlets can pass .NET objects between each other.

Access to .NET Framework:

Since PowerShell is built on the .NET framework, it can leverage .NET classes and methods, enabling complex operations and integration with other .NET applications.

Cross-Platform:

PowerShell Core, the open-source version of PowerShell, is cross-platform and runs on Windows, macOS, and Linux.



Play with PowerShell

Basic PowerShell commands

  • To check the installed version of PowerShell:
$PSVersionTable.PSVersion
  • To get help for a specific cmdlet:
Get-Help Get-Process
  • To list all running processes:
Get-Process
  • To stop a process by its name:
Stop-Process -Name notepad
  • To list all files in a specific directory:
Get-ChildItem -Path C:\Example\Directory

Feel free to explore and practice different PowerShell's commands. Happy coding!