Windows Server 1.1 : powershell Partie1

PowerShell is an administration and automation tool used to manage servers and workstations. The first version, PowerShell 1.0, was released on 14 November 2006. It is the heir of MS-DOS but, unlike DOS, PowerShell is an object-oriented language based on Microsoft's .NET framework. You drive it with commands called cmdlets to manage and configure a machine from the command line. PowerShell is at once a command-line shell and a scripting language designed for system administration tasks, and it offers built-in remote management so you can execute commands on other systems as if they ran locally.

Out of the box you get two main hosts: PowerShell (a console where you type commands directly) and PowerShell ISE (a richer environment split in three panes: console, command module and script file). Notepad and Notepad++ work but are not recommended as editors because they lack the IntelliSense and execution features ISE provides. PowerShell scripts use the .ps1 extension and PowerShell ships natively in 32-bit and 64-bit on Windows Server and Windows.

Cmdlets, modules and aliases

  • Cmdlet names follow a Verb-Noun form. Microsoft publishes a list of approved verbs; the most common are Get, Set, New, Add. Examples include Get-Command, Get-Process, Get-Date. Use tab-completion in the console to speed things up.
  • Modules add extra capabilities to PowerShell. Microsoft provides many, the community contributes others. The most useful management cmdlets are Get-Module -ListAvailable, Find-Module (search the gallery) and Install-Module.
  • Aliases let you create shorter names for cmdlets. dir is an alias of Get-ChildItem; some Unix-style names such as ls or wget also work as aliases. Get-Alias lists the active ones.
  • The execution policy protects you against untrusted scripts. Query it with Get-ExecutionPolicy, change it with Set-ExecutionPolicy. Restricted is the most restrictive setting, Bypass the most permissive.

Why not just keep using the classic Command Prompt? Because cmd can only run commands — it has no scripting layer or unified syntax. Two classic commands illustrate this: ping tests network connectivity (use ping -t to ping continuously), and ipconfig shows your IP configuration (ipconfig /all for the full view, ipconfig /? for help). Each cmd command has its own syntax: there is no general grammar to learn, you must memorize each one. PowerShell solves exactly that by giving every cmdlet the same Verb-Noun shape.

Summary

This lesson introduces PowerShell as a powerful administration and automation tool for Windows Server and Windows operating systems, released November 14, 2006. It covers PowerShell's dual nature as both a command-line shell and scripting language, built on Microsoft's object-oriented .NET Framework, with remote management capabilities allowing commands to execute identically on local or remote systems. The lesson explains essential components including the PowerShell ISE editor, cmdlet conventions (verb-noun format), modules for extended functionality, aliases for command shortcuts, and execution policies for script security. Practical demonstrations include network testing and command discovery within the PowerShell environment.

Key points

  • PowerShell is an object-oriented administration and automation tool for Windows systems, inheriting from MS-DOS but adding modern scripting and remote management capabilities.
  • The PowerShell ISE (Integrated Scripting Environment) is the native Windows development platform with three sections: console for command execution, module management, and script editing for .ps1 files.
  • Cmdlets follow a verb-noun naming convention (e.g., Get-Service, Get-Process, Get-Help) and are discovered and executed directly in the console or through saved scripts.
  • Modules extend PowerShell functionality through commands like Get-Module, Find-Module, and Install-Module, enabling users to manage both official Microsoft and community-developed extensions.
  • Aliases provide command shortcuts (e.g., 'dir' for 'Get-ChildItem'), discoverable via Get-Alias, streamlining repeated tasks and reducing typing.
  • Execution policies are security controls that restrict script execution; common levels include Restricted (most limiting) and Bypass, managed via Set-ExecutionPolicy and verified with Get-ExecutionPolicy.

FAQ

What is the key difference between PowerShell and Command Prompt (cmd.exe)?

Command Prompt only executes command-line commands without scripting components or unified command-line functionality. PowerShell is both a command-line shell and a scripting language with object-oriented capabilities, comprehensive administration features, script execution via .ps1 files, and remote management—making it significantly more powerful for automation and complex tasks.

What is the role of modules in PowerShell, and how are they managed?

Modules add supplementary functionality to PowerShell through official Microsoft and community-developed extensions. Users can discover available modules using Find-Module, list installed modules with Get-Module, and install new modules via Install-Module. This modular architecture allows PowerShell to be extended with specialized capabilities tailored to specific administration needs.

Why are execution policies important, and how do they work?

Execution policies are built-in security mechanisms protecting Windows systems against untrusted scripts by controlling whether PowerShell scripts can run. The active policy is checked using Get-ExecutionPolicy and modified with Set-ExecutionPolicy. The most restrictive level (Restricted) prevents script execution, while more permissive levels allow controlled script usage while maintaining security safeguards.