PowerShell

from Wikipedia, the free encyclopedia
PowerShell

PowerShell 5.0 icon
Windows PowerShell
Screenshot of powershell.exe 5.0 within conhost.exeunder Windows 8.1
Basic data

developer Microsoft
Publishing year November 14, 2006
Current  version 7.0.3
( July 16, 2020 )
operating system Microsoft Windows , from version 6 also Linux and macOS
programming language C #
category Command line interpreter
License Proprietary, MIT license
German speaking Yes
PowerShell

PowerShell (also Windows PowerShell and PowerShell Core ) is a cross-platform framework from Microsoft for the automation, configuration and management of systems, consisting of a command line interpreter and a scripting language .

PowerShell has been based on the .NET Core Common Language Runtime (CoreCLR) since version 6 and is available as a cross-platform open source project under the MIT license for Linux , macOS and Windows .

Windows PowerShell is based on the Common Language Runtime (CLR) of the .NET Framework and is supplied with Windows as part of the Windows Management Framework (WMF) under a proprietary license. Windows PowerShell has also been available as a Core Edition since 2016 , which, like PowerShell Core, is based on .NET Core and is supplied as part of Windows Nano Server and Windows IoT .

History of origin

command prompt

Every published version of MS-DOS and Microsoft Windows contained a command line or input prompt (see also command line interpreter ). These are COMMAND.COM(in DOS or DOS-based operating systems such as Windows 9x ) and cmd.exe(in operating systems of the Windows NT family). The command prompt provides some standard commands and allows you to run additional console applications . There is also a scripting language to automate tasks (see BAT file ). However, since not all functionalities of the graphical user interface can be accessed via the command prompt, not all tasks can be automated and the functionality of the scripting language is also limited due to its simplicity. With Windows Server 2003 , most of the functions were also available via command prompt, but the limitations of the scripting language and inconsistencies in the operation of different console applications remain.

Microsoft tried to overcome some of these limitations as early as 1998 with the introduction of Windows Script Host ( cscript.exe) and its support for JScript and VBScript in Windows 98 . With Windows Script Host it is possible to address all COM components, which enables the automation of large parts of the operating system. However, Windows Script Host is aimed more at script developers and less suitable for (ad-hoc) administration, the documentation was not easily accessible and it was prone to abuse by computer viruses . In addition, there are other command line interpreters in different Windows versions for special areas of application (e.g. netsh for network configuration or the Windows Management Instrumentation Command-line (WMIC)).

Monad Manifesto

Jeffrey Snover - a command line advocate who started at Microsoft in 1999 - initially supported Microsoft Windows Services for UNIX (SFU) in order to be able to use Unix tools under Windows. However, since Windows does not work in a document-oriented manner like Unix, but rather in an API-oriented manner, it ultimately could not be managed comprehensively (e.g. setting registry values). Snover also developed the Windows Management Instrumentation Command-line (WMIC). In 2002 he described a new approach to automation in Windows as the Monad Manifesto . In it, Snover describes Monad as a powerful, consistent, expandable and useful "next generation platform" based on .NET, with which the effort for administrators can be reduced and the lives of non-programmers can be significantly simplified. This should be achieved through the following points, among others:

  • Administrators can program commands faster and easier because Monad takes over many of the standard tasks of commands and offers consistency through a uniform parser .
  • Instead of text (unstructured data), objects (structured data) are transferred to the pipe , which simplifies further processing.
  • Execution of scripts on a large number of remote computers
  • The ability to use GUIs

The Monad idea was developed further. In 2003 at the Professional Development Conference in Los Angeles, the Monad Shell (MSH) was shown for the first time. In 2005 beta versions were released.

PowerShell is born and becomes part of Windows

In 2006 Microsoft announced that Monad would be renamed PowerShell. At the same time it was announced that Exchange Server 2007 would be administered via PowerShell and that the GUI would also be based on PowerShell. In the same year, PowerShell 1.0 was released and offered for download.

With the support of the Exchange and data center managers at Microsoft, PowerShell could be established in the group. In 2007, PowerShell became part of Microsoft's Common Engineering Criteria for 2009, a list of criteria that every Microsoft server product should meet. This effectively meant that by 2009 every server product from Microsoft should support PowerShell. This was the definitive breakthrough for PowerShell as the central management and automation unit in Windows.

In 2008, Windows Server 2008 became the first operating system to be shipped with PowerShell - but still as an optional component.

In 2009, PowerShell 2.0 was released as an integral part of Windows 7 and Windows Server 2008 R2 . At the beginning of 2010, PowerShell 2.0 was also available for older operating systems as an optional update via Windows Update .

PowerShell becomes open source and cross-platform

In 2016, Microsoft announced that PowerShell would be developed under the MIT license, open source and cross-platform. At the same time, a GitHub repository was created and the alpha version of PowerShell version 6.0 for Windows, Linux and macOS was published. The manufacturer justified this step in its cloud strategy. In Microsoft Azure not only Windows, but also a variety of Linux systems are provided. Microsoft offers PowerShell as a universal tool for all administrators, regardless of which operating system or application is to be administered.

construction

PowerShell is specifically designed for system administration and automation

It combines the philosophy of pipes and filters known from Unix shells with the paradigm of object-oriented programming . As before, the user can execute simple commands on a command line and link them with one another or write complex script programs with the specially developed PowerShell Scripting Language .

PowerShell allows access to WMI classes, COM objects and the entire .NET framework .

PowerShell Engine

The PowerShell Engine (also known as Shell , PowerShell Class or PowerShell Runtime ) is the command line interpreter that processes the input and is therefore the heart of PowerShell. The engine is a collection of .NET - classes that in a DLL ( System.Management.Automation.dllstored).

PowerShell host

The PowerShell Host is the user interface to the PowerShell Engine. Windows PowerShell (also called console ) ( powershell.exe, provided by conhost.exe) and Windows PowerShell ISE ( Integrated Scripting Environment , ISE for short ) ( powershell_ise.exe) are available by default in Windows . The ISE is a modern input window with, among other things, an integrated script editor, debugger and IntelliSense . Both hosts also allow conventional command line applications to be run, such as ipconfig.exe. However, the ISE does not allow interaction, such as with nslookup.exe. The ISE can be expanded with add-ons ; a well-known extension is ISESteroids . Management consoles, such as the Exchange Management Console (EMC) since Exchange Server 2007 , are also hosted. There are also other hosts on the market, such as PowerShell Plus from Idera. Although all hosts use the same engine, since the implementation can be different, it is also possible that the hosts behave differently among themselves.

PowerShell Scripting Language

The PowerShell Scripting Language is the language for developing scripts for the PowerShell Engine. From version 2.0 the scripting language can also be used to create your own cmdlets. With version 5, the script language was expanded to include classes .

In contrast to the previously existing object-oriented script interpreters ( BeanShell , Smalltalk , Python Shell ), the syntax of the PowerShell scripting language, which borrows from Perl , Unix Shells , SQL and C , is also designed for daily interactive use Use as a shell for administrative tasks such as file management.

Cmdlets

Cmdlets (pronounced commandlets ) are called the commands in a PowerShell environment. The term is intended to make it clear that we are dealing with very small, special commands, such as in commands . Unlike traditional commands, cmdlets are not stand-alone applications, which means that they cannot be run without PowerShell. Cmdlets can .NET - classes his or PowerShell scripts and a few lines of code to be written. Cmdlets generally do not parse input themselves, do not represent errors themselves, and return results unformatted as an object. The PowerShell engine or standard cmdlets relieve cmdlet developers of standard tasks and simplify and accelerate development. At the same time, the usability and readability of scripts and commands is guaranteed by very strict and detailed naming conventions.

The number of pre-installed cmdlets increases with each version. In version 5.1 of the Legacy PowerShell it is 489 cmdlets and 766 included functions and in the core version 6.1 it is 287 cmdlets and 145 included functions in the core package and 1900 cmdlets with additional modules.

Cmdlets follow the verb-noun naming scheme , for example Get-Helpor Set-Location. Cmdlets are task-oriented due to the preceding verb , they are supposed to fulfill a specific task and only output one type of object, such as, for example Get-Process, that lists all running processes and System.Diagnostics.Processoutputs them as an object of the type . Killing processes is a separate task and is therefore a cmdlet ( Stop-Process) of its own . The listing of services outputs different properties than processes and therefore has a different noun ( ). The resulting objects can then be further processed. It is possible to filter ( , ), convert ( ) or output ( , ) objects . Get-ServiceSelect-Object -Property Name,StatusWhere-Object -Property Status -EQ -Value StoppedConverto-JsonOut-FileOut-GridView

Microsoft has published a list of permitted verbs. Compliance with the verbs is not technically enforced. However, it is recommended to standardize operation. The list of approved verbs can be called up with Get-Verb.

Aliases can be stored for cmdlets , for example to create compatibility with old scripts, to make it easier to switch from other systems or to simply be able to execute commands with fewer letters. Some of these aliases are already predefined by modules. For example, the cmdlet is Set-Locationused to define the current directory of the host, but the aliases sl, cdand are also chdirusable.

The following table compares a selection of standard cmdlets with aliases and comparable commands from other command line interpreters.

PowerShell
cmdlet
PowerShell
version
PowerShell
alias
cmd.exe
Unix shell description
Get-Help 1.0 help, man help man Help on commands
Get-Command 1.0 gcm Lists all commands and aliases available in the current context.
Get alias 1.0 gal alias Lists aliases for commands.
Get location 1.0 gl, pwd CD pwd Output of the current directory
Set location 1.0 sl, cd, chdir cd, chdir CD Change the current directory
Clear host 3.0 cls, clear cls clear Clear the output
Copy item 1.0 cpi, copy, cp copy cp Copy one or more files / an entire directory tree
Remove-Item 1.0 ri, del, erase, rmdir, rd, rm del, rmdir, approx rm , rmdir Delete a file / directory
Rename item 1.0 rni, ren ren mv Renaming a file / directory
Move item 1.0 mi, move, mv move mv Moving a file / directory
Get-ChildItem 1.0 gci, you, ls to you ls List of all files / directories in the (current) directory
Write host 1.0 echo, write echo echo Output of strings, variables etc. in the console
Pop location 1.0 popd popd popd Change to the directory that was last placed on the stack
Push location 1.0 pushd pushd pushd Put directory on the stack
Set variable 1.0 sv, set set set Set value of a variable / create variable
Start process 2.0 saps begin Starts a program in its own window
Get content 1.0 gc, type, cat type cat Output of a file
Select string 1.0 sls find, findstr grep Search and filter defined strings
Get process 1.0 gps, ps tlist, tasklist ps List of all currently running processes
Stop process 1.0 spps, kill kill, taskkill kill End a running process
Stop computer 2.0 shut down shutdown, poweroff Shut down the computer
Restart computer 2.0 shutdown -r reboot, shutdown -r Restart the computer
Tea object 1.0 tea tea Redirect standard input to a file or variable and pass it along the pipeline ( standard output )
Get-NetIPAddress 3.0 gip ipconfig ifconfig Lists the network interfaces with configuration information
Get-Acl 1.0 acl Lists the access rights of a folder or document.
Get-Member 1.0 gm Lists the members ( member variables ) of an object.
Get-PSSnapin 1.0 gsnp Lists the active PowerShell extensions.
Export console 1.0 export Exports the active configuration of the console to a file.
A new PowerShell instance can -psconsolefile <String>load this configuration via the parameter at startup.

Parameters are -Parametername [Wert]specified after the cmdlet . A parameter can have different properties, for example it can have a default value, it can be required or position-related or it can accept values ​​from the pipe . Which parameters are available for a cmdlet and which properties they have can also be Get-Helpchecked (e.g. Get-Help -Name Get-NetIPAddress -Parameter *). In addition to cmdlet-specific parameters, there are also so-called common parameters , i.e. generally available parameters. This includes -Verbosethe output of detailed information, -ErrorActionto determine how to proceed in the event of an error, or -WhatIfto display what would happen if the command was executed without actually making changes.

Modules are the preferred way to publish cmdlets and load them into PowerShell. Modules consist of the cmdlet program code (as a PowerShell script or .NET class) and a manifest that describes the contents of the module. In PowerShell 1.0 it was only possible to load cmdlets using PSSnapins (snap-ins). However, this has been replaced by the function of the modules.

PowerShell Provider

PowerShell providers (also PSProviders ) provide access to data and components (namespaces) that otherwise would not be easily accessible via the host, and present the data in a consistent format as drives . The most common example of this is the file system , which has a partition as drive C represents. However, other providers are also possible, such as variables, the registry , Active Directory and the certificate store. In all drives (for example C:, D:, Env:, HKLM:or Cert:) alike Navigates or elements can be processed ( Set-Location, Get-ChildItem, Remove-Item...).

List of providers

The following list shows some of the default providers in PowerShell.

Surname Type task
Alias Container Integrates a logical drive with the name "Alias:". Alias ​​defined as key-value pairs (e.g. with ) can be called up via this drive . Get-ChildItem Alias:
Environment Container Mounts a logical drive with the name "env:". The environment variables can be queried via this drive .
FileSystem navigation Access to the file system is made possible via the FileSystem Provider. Drives, removable media, network drives, etc. can be accessed via the FileSystem Provider. Ä., as well as the files and folders located on it can be accessed. Drives are not integrated into PowerShell as a logical drive, but stored as a reference in the function provider.
Function Container Manages functions that were New-Itemcreated with or declared in a PowerShell script.
Registry navigation Provides access to the registry on Windows . The drives "HKLM:" (for HKEY_LOCAL_MACHINE) and "HKLU:" (for HKEY_LOCAL_USER) are created by default . If necessary, additional drives can be created with New-PSDrive(e.g. ). New-PSDrive -name HKU -psprovider Registry -root HKEY_USERS
variable Container Manages the variables created in the PowerShell host and their values ​​and integrates them as a logical drive "Variable:".
Certificate navigation Manages the system's security certificates and integrates itself as the logical drive "Cert:". The certificate provider is Get-PSProvidernot listed by.

Versions

Windows PowerShell 1.0

The first version of PowerShell appears in 2006 as a basic framework with the most important functions of PowerShell. The command line interpreter in particular is very powerful, so there is already an object-based pipe, its own scripting language and a security model. PowerShell can address so-called namespaces such as the file system, the certificate store or the registry. Cmdlets can only be written in .NET, scripts can only be executed on remote computers via WMI , the available console is kept very simple.

Windows PowerShell 2.0

With PowerShell 2.0, the creation of new cmdlets is drastically simplified. For the first time, cmdlets can also be written as scripts. Help based on comments in cmdlets is also introduced. Cmdlets can be grouped together as modules. In addition, the will Power Shell ISE introduced a powerful panel with built-in script editor. PowerShell Remoting is introduced to manage remote computers . In addition, PowerShell can now create jobs that are processed in the background.

Windows PowerShell 3.0

PowerShell 3.0 is becoming more mature and user-friendly. Workflows based on the Windows Workflow Foundation are introduced, which makes it possible to have tasks completed in parallel with limited resources. For the first time, CIM and JSON are supported. Modules available in the system are loaded automatically and are therefore immediately available to the administrator.

Windows PowerShell 4.0

PowerShell 4.0 introduces Desired State Configuration (DSC), a declarative language for configuring systems.

Windows PowerShell 5.0

In PowerShell 5.0, Desired State Configuration (DSC) is significantly expanded and improved. In addition, classes that allow scripts to be developed more formally and Oneget , a package manager for PowerShell, are introduced. In the PowerShell ISE , scripts can now also be changed in sessions on remote computers.

Windows PowerShell 5.1

PowerShell 5.1 is the current and probably the last Windows PowerShell version. It is still supported by Windows, but is no longer actively developed. PowerShell 5.1 remains the preinstalled PowerShell version on Windows Server 2019. PowerShell 5.0 is the first core version of PowerShell and only runs on Windows Nano Server 2016.

PowerShell Core 6

PowerShell 6.0 is the first cross-platform, open source version of PowerShell and runs on Windows, macOS and Linux. It is based on .NET Core 2.0 and has a very limited range of functions compared to .Net version 5.1.

PowerShell 6.1 is based on .Net Core 2.1 and extends the range of functions considerably with the support of many existing modules. On Windows, 432 cmdlets and included functions are now supported (PowerShell 5.1: 1264 cmdlets and functions), as well as another 1468 cmdlets via external modules.

The command line name of PowerShell 6 was renamed from powershell.exe to pwsh.exe, this allows easier differentiation when calling Powershell if both PowerShell Core and the classic Powershell are installed.

PowerShell 7

With PowerShell 7, both the Windows prefix and the Core suffix are removed, indicating that it is the successor to Windows PowerShell 5.1, as well as PowerShell Core 6. In particular, the compatibility with PowerShell modules supplied with Windows has been improved. PowerShell 7 is a Long Term Support (LTS) release.

Objects and the pipe

Other command line interpreters such as Cmd.exe , Bash or DCL are text-based, whereas PowerShell works with objects. Objects properties ( Properties ), methods ( Methods ) and events ( Events included). Get-Membershows the type as well as the properties and methods of objects.

For system management / administration, this means that the results of commands are no longer available as text (unstructured data) but as objects (structured data).

PowerShell works with dynamic typing . In this case, an extended type system is used ( English : extended type system , ETS ) for use in the .NET objects in the class PSObject are encapsulated. PSObjectrepresents the base class for PowerShell objects. It PSObjectcorresponds to a monad .

In C #:
using System;
using System.Management.Automation;

namespace PowerShell
{
    public class PSObjectExample
    {
        public void Main()
        {
            var time = DateTime.UtcNow;
            var powerTime = new PSObject(time);
        }
     }
}
In PowerShell:
# Aufruf einer statischen Methode mit [ClassName]::Method
# Variable $time ist explizit typisiert
[System.DateTime]$time = [System.DateTime]::UtcNow

# explizites Typecasting nach PSObject
# Variable $powerTime ist implizit typisiert
$powerTime = [System.Management.Automation.PSObject] $time

# Aufruf eines Konstruktors
$powerTime = New-Object System.Management.Automation.PSObject($time)

PowerShell provides implicit type conversion. Type converters are used, some of which are predefined:

Type Converts to method
zero String are back String.Empty
zero Char are '\0'back
zero Numeric are 0back
zero Boolean are falseback
zero Nullable <T> are nullback
zero Object reference are nullback
class Base class Boxing the class on the base class
object void are back AutomationNull.Value
object String are back value.ToString()
object Boolean are the result of back LanguagePrimitives.IsTrue(value)
object PSObject are back PSObject.AsPSObject(value)
object XMLDocument calls the method and passes the result to the XMLDocument constructor value.ToString()
object Nullable <T> the object is to be converted and as Nullable- Monad returned (T)value
Array Array Conversion of the individual array elements
IDictionary Hashtable are back new Hashtable(value)
String Char [] are back value.ToCharArray()
String RegEx are back new RegEx(value)
String Type Deserialization via RunSpaceConfiguration.Assemblies
String Numeric 0for . Tries to parse the value with . String.EmptyCulture.InvariantCulture
Integer System.Enum Returns the enum value assigned to the integer. if that is not possible. throw new PSInvalidCastException()

The fact that PowerShell is object-oriented also affects the pipe . The pipe in text-based command line interpreters connects standard output stdoutwith standard input of stdinthe subsequent command. In PowerShell, data is stored in the pipe and the pipe must bind the data to the subsequent cmdlet. Each cmdlet decides for each parameter for itself whether and how inputs are allowed from a pipe. This means that the pipe must check whether the subsequent command allows binding to a parameter. A distinction is made between two types of ties: ByValueor ByPropertyName. With ByValue, the object type in the pipe must match the required object type. With ByPropertyName, the name of a property of the object must match the name of the parameter of the subsequent command. ByValueis ByPropertyNamepreferred over.

If you work with conventional console applications in a PowerShell host, the standard output is converted stdoutinto an object of the type String.

This model is initially complex, but in practice it also has advantages when it comes to filtering and processing information, as the following examples are intended to illustrate.

Example 1: All stopped services of a remote computer are to be started, with an output indicating which services were started.

# Listet alle Dienste auf einem entfernten Computer auf
# Filtert die zurückgegebene Dienste nach denen, die gestoppt sind
# Startet all diese Dienste und gibt die verarbeiteten Objekte an die Pipeline weiter (-PassThru)
# Gibt die Eigenschaften MachineName, DisplayName und Status der gestarteten Dienste aus

Get-Service -ComputerName Server01 | Where-Object -Property Status -EQ -Value Stopped | Start-Service -PassThru | Select-Object -Property MachineName,DisplayName,Status

Example 2: The 10 Microsoft processes with the highest memory usage (in megabytes ) are to be saved in descending order in a CSV file on the local computer .

# Listet alle gestarteten Prozesse auf dem lokalen Computer auf
# Filtert nach Prozessen der Firma Microsoft
# Sortiert nach Arbeitsspeichernutzung (WorkingSet64) absteigend (-Descending)
# Filtert auf die Eigenschaften ProcessName und MemoryUsageMB, wobei MemoryUsageMB ein ''Custom Property'' ist, das zur Laufzeit die bestehende Eigenschaft WorkingSet64 in MB und auf ganze Zahlen gerundet darstellt
# Filtert auf die ersten 10 Objekte
# Das Objekt wird in ein CSV-Format umgewandelt
# und in einer Datei gespeichert

Get-Process | Where-Object -Property Company -EQ -Value 'Microsoft Corporation' | Sort-Object -Property WorkingSet64 -Descending | Select-Object ProcessName,@{Name='MemoryUsageMB';Expression={[math]::round($PSItem.WorkingSet64/1MB,0)}} | Select-Object -First 10 | ConvertTo-Csv | Out-File -FilePath $env:TEMP\TopProcesses.csv

Scripts

PowerShell scripts can be combined in a script file. Script files contain functions with an associated description in a comment block, as well as variables and commands. Script files have the extension .ps1and are .loaded and processed with the command followed by the full name of the file.

example
<#
.SYNOPSIS
    Hello World Application.

.DESCRIPTION
    This script is a more complex Hello World function that intends to show some of the syntax of PowerShell.
    To use it, write ". ./Write-Hello.ps1" (dot, space, filename) into your PowerShell first, so that the script gets loaded.

.NOTES
    File Name: Write-Hello.ps1

.EXAMPLE
    Write-Hello
    Hello World!

.EXAMPLE
    Write-Hello "World"
    Hello World!

.EXAMPLE
    greet "World"
    Hello World!

.EXAMPLE
    Write-Hello -Name "World"
    Hello World!

.EXAMPLE
    "World" | Write-Hello
    Hello World!

.EXAMPLE
    @("Jack", "Jill") | Write-Hello
    Hello Jack!
    Hello Jill!

.ALIAS
    greet

.LINK
    http://de.wikipedia.org/wiki/PowerShell

.INPUTTYPE
    Takes a name of type [string].

.RETURNVALUE
    Output a greeting of type [string].

.PARAMETER Name
    A list of names of the persons to greet. Greets the world by default.
#>

function Write-Hello
{
    [CmdletBinding()]
    param(
        # get name parameter from the pipeline or as a parameter
        [Parameter(Mandatory = $False, Position = 0, ValueFromPipeline = $True, HelpMessage = "The name to greet.")]
        [string]$Name = "World"
    )

    begin {
        # load assemblies from Global Assembly Cache (deprecated method)
        [void][System.Reflection.Assembly]::LoadWithPartialName("System.Exception")

        # cancel the execution if an error occurs
        $ErrorActionPreference = "Stop"
    }

    # process once for every input that was given
    process {
        try {
            if($Name -eq "Error") {
                throw New-Object System.Exception("The name must not be 'Error'.")
            }
        }
        catch [System.Exception] {
            Write-Error $_
        }

        # process the request
        [string]$Greeting = [string]::Format("Hello {0}!", $Name)

        # outputs a string object to the PowerShell pipeline
        # note: using write-host calls .ToString() method on the returned object
        Write-Output $Greeting
    }

    end {

    }
}

# setting an alias
Set-Alias greet Write-Hello

Examples

Enter the string "Hello world!" on the console :

  Write-Host "Hallo Welt!"


Kill all processes whose names begin with the letter "p":

  Get-Process p* | Stop-Process


Find and kill all processes that are using more than 10MB of main memory:

  Get-Process | where { $_.WS -gt 10MB } | Stop-Process


Calculate the total number of bytes of all files in a directory:

  Get-ChildItem | Measure-Object -Property Length -Sum


Wait for a particular process to finish:

  $processToWatch = Get-Process notepad
  $processToWatch.WaitForExit()


Change a string from lowercase to uppercase:

  "hallo welt!".ToUpper()


Add the character sequence "ABC" after the first letter of the word "string" to get the result "sABCtring":

  "string".Insert(1, "ABC")


Charging a particular RSS - web feed down and show the titles of the eight most recent entries:

  $rssUrl = "http://blogs.msdn.com/b/powershell/rss.aspx"
  $blog = [xml] (New-Object System.Net.WebClient).DownloadString($rssUrl)
  $blog.rss.channel.item | select title -First 8


Erase the entire hard disk without asking, equivalent to rm -rf / under Unix:

  Get-PSDrive -p "FileSystem" | % { ls -Recurse $_.Root | rm Force }

File extensions

  • .ps1 - Windows PowerShell Shell Script
  • .ps1xml - Windows PowerShell format and type definitions
  • .psc1 - Windows PowerShell console file (exported shell configuration)
  • .psd1 - Windows PowerShell data file
  • .psm1 - Windows PowerShell module file

Software support

The following systems, among others, are supported:

software version Cmdlets Provider Graphical user interface
Microsoft Exchange Server 2007 yes (402) Yes Yes
Microsoft Exchange Server 2010 Yes Yes Yes
Microsoft Windows Server 2008 Yes Yes No
Microsoft Windows Server 2008 Core No No No
Microsoft Windows Server Microsoft Windows Server 2008 R2 Yes No No
Microsoft SQL Server 2008 Yes Yes No
SharePoint 2010, 2013 Yes Yes No
Microsoft System Center Operations Manager 2007 yes (74) Yes No
Microsoft System Center Virtual Machine Manager 2007 Yes Yes Yes
Microsoft System Center Data Protection Manager 2007 Yes No No
Microsoft Windows Compute Cluster Server 2007 Yes Yes No
Microsoft Transporter Suite for Lotus Domino 02/08/0012 yes (47) No No
Microsoft PowerTools for Open XML 1.0 yes (33) No No
IBM WebSphere MQ 6.0.2.2 yes (44) No No
Quest Management Shell for Active Directory 1.1 yes (40) No No
Special Operations Software Specops Command 1.0 Yes No Yes
VMware Infrastructure Toolkit 1.0 Update 1 yes (125) No No
Internet information services 7.0 yes (54) Yes No
Microsoft Windows 7 Troubleshooting Center 6.1 Yes No Yes
Microsoft Deployment Toolkit 2010 Yes No No
LOGINventory 5.x Yes Yes Yes
Citrix XenApp since v5.x Yes Yes Yes
Citrix XenDesktop since v5.x Yes Yes Yes

literature

German
  • Ulrich Cuber: Windows PowerShell . Mitp-Verlag 2007, ISBN 978-3-8266-1673-0 .
  • Lee Holmes, Rolf Masuch: Windows PowerShell 3.0 in a nutshell . 3. Edition. O'Reilly, 2013, ISBN 978-3-95561-055-5 .
  • Peter Monadjemi: Windows PowerShell - Crash Course . Microsoft Press Germany 2007, ISBN 978-3-86645-617-4 .
  • Andy Oakley: A quick introduction to Windows PowerShell . O'Reilly Verlag 2007, ISBN 978-3-89721-487-3 .
  • Bruce Payette: Windows PowerShell in action . Hanser Fachbuchverlag 2007, ISBN 978-3-446-41239-2 .
  • Holger Schwichtenberg: Windows PowerShell . Addison-Wesley 2007, ISBN 978-3-8273-2533-4 .
  • Holger Schwichtenberg: Windows Scripting. Automated system administration with the Windows Script Host and Windows PowerShell . Addison-Wesley 2007, ISBN 978-3-8273-2423-8 .
  • Helma Spona: Windows PowerShell. Language basics, file system, database access, WMI control . Galileo Press 2007, ISBN 978-3-89842-880-4 .
  • Tobias Weltner: Scripting with Windows PowerShell - Beginners Workshop . Microsoft Press Germany 2007, ISBN 978-3-86645-620-4 .
  • Tobias Weltner: PowerShell scripting for administrators . Microsoft Press Germany 2008, ISBN 978-3-86645-635-8 .
English
  • Jerry Lee Ford Jr .: Microsoft Windows Powershell Programming for the Absolute Beginner . Course Technology Ptr 2007, ISBN 1-59863-354-6 .
  • Lee Holmes: Windows PowerShell Quick Reference . O'Reilly 2006, ISBN 0-596-52813-2 .
  • Don Jones: An Introduction to Microsoft® PowerShell ™ . Realtimepublishers.com 2006.
  • Don Jones, Jeffery Hicks: Windows PowerShell ™: TFM® . SAPIEN Press 2006, ISBN 0-9776597-1-2 .
  • Tyson Kopczynski: Microsoft Powershell Unleashed . Sams Publishing 2007, ISBN 0-672-32953-0 .
  • Andy Oakley: Monad - Introducing the MSH Command Shell and Language . O'Reilly 2006, ISBN 0-596-10009-4 .
  • Bruce Payette: Windows PowerShell in Action . Manning Publications, ISBN 1-932394-90-7 .
  • Andrew Watt: Professional Windows PowerShell . Wrox Press 2007, ISBN 0-471-94693-1 .
  • Ed Wilson: Microsoft® Windows PowerShell ™ Step By Step . Microsoft Press 2007, ISBN 0-7356-2395-3 .
  • Steve Seguis: Windows PowerShell 2 for Dummies , ISBN 978-0-470-37198-5
  • Arul Kumaravel, Jon White, Michael Naixin Li, Scott Happell, Guohui Xie, Krishna C. Vutukuri: Professional Windows PowerShell Programming: Snapins, Cmdlets, Hosts and Providers (=  Wrox Professional Series ). 1st edition. John Wiley & Sons, 2008, ISBN 978-0-470-17393-0 (standard work on PowerShell development with C #).

Web links

Quick references
introduction
Blogs
Cmdlets and modules
Ports
  • Pash. In: Github. Retrieved August 6, 2013 (English, mono porting from PowerShell).
BDD and Unit Testing Frameworks
  • Pest. In: Github. Retrieved April 16, 2014 .
  • PS Unit. In: CodePlex. Retrieved April 16, 2014 .
  • PsTest. Retrieved April 16, 2014 .
Automation, delegation & management with PowerShell scripts
Others

Individual evidence

  1. Release 7.0.3 . July 16, 2020 (accessed July 17, 2020).
  2. The powershell Open Source Project on Open Hub: Languages Page . In: Open Hub . (accessed October 30, 2018).
  3. a b PowerShell license on Github
  4. PowerShell Readme file on Github
  5. PowerShell on Github
  6. a b blogs.msdn.microsoft.com: PowerShell on Linux and Open Source
  7. msdn.microsoft.com: Windows Management Framework (WMF) 5.0 RTM - Notes on this version - Overview
  8. technet.microsoft.com: PowerShell under Nano Server
  9. PowerShell.org on YouTube: Snover Monad Manifesto Revisited
  10. jsnover.com: Monad Manifesto (PDF)
  11. blogs.msdn.microsoft.com: Windows PowerShell (Monad) Has Arrived
  12. blogs.msdn.microsoft.com: It's a Wrap! Windows PowerShell 1.0 Released!
  13. YouTube: Jeffrey Snover 2015 at the DevOps Enterprise Summit about The Cultural Battle To Remove Windows from Windows Server
  14. blogs.msdn.microsoft.com: PowerShell To Be Added to Common Engineering Criteria
  15. blogs.msdn.microsoft.com: Windows PowerShell 2.0 RTM
  16. blogs.msdn.microsoft.com: Windows PowerShell 2.0 on Windows Update
  17. azure.microsoft.com: PowerShell is open sourced and is available on Linux
  18. Windows PowerShell. (No longer available online.) In: Microsoft TechNet . Microsoft, archived from the original on December 21, 2007 ; accessed on September 3, 2016 .
  19. msdn.microsoft.com: Cmdlet Overview
  20. ↑ What's New in Windows PowerShell 5.0. Accessed January 30, 2019 (German).
  21. a b What's New in PowerShell Core 6.1. Accessed January 30, 2019 (German).
  22. ^ Approved Verbs for Windows PowerShell Commands. In: Windows Dev Center. Microsoft, accessed August 3, 2013 .
  23. a b c d e f g h i j k l m n o p q r s t u v w Tomoaki Yoshizawa: PowerShell 1.0 cmdlets. In: Microsoft TechNet. Retrieved September 3, 2016 .
  24. Windows PowerShell Core cmdlets. Windows PowerShell 3.0. In: Microsoft Developer Network. Microsoft, accessed September 3, 2016 .
  25. a b c Overview of Cmdlets Available in Windows PowerShell. In: Microsoft TechNet. Microsoft, accessed September 3, 2016 .
  26. a b Alphabetical List of Tools in the Windows NT 4.0 Resource Kit Supplement 4. Microsoft, accessed February 10, 2016 .
  27. TList. Microsoft, accessed February 10, 2016 .
  28. Tasklist. Microsoft, accessed February 10, 2016 .
  29. Kill Tool. Microsoft, accessed February 10, 2016 .
  30. Taskkill. Microsoft, accessed February 10, 2016 .
  31. Net TCP / IP cmdlets in Windows PowerShell. Windows Server 2012 and Windows 8. In: Microsoft Developer Network. Microsoft, accessed September 3, 2016 .
  32. msdn.microsoft.com: Understanding a Windows PowerShell Module
  33. msdn.microsoft.com PowerShell Reference: about_PSSnapins
  34. about_Windows_PowerShell_5.1. Retrieved January 30, 2019 (American English).
  35. PowerShell under Nano Server. Accessed January 30, 2019 (German).
  36. ↑ What's New in PowerShell Core 6.0. Accessed January 30, 2019 (German).
  37. More information about .NET Core. Accessed January 30, 2019 (German).
  38. https://docs.microsoft.com/de-de/powershell/scripting/whats-new/what-s-new-in-powershell-core-60?view=powershell-7#renamed-powershellexe-to-pwshexe
  39. Announcing PowerShell 7.0. March 4, 2020, accessed March 30, 2020 (American English).
  40. Microsoft Transporter Suite for Lotus Domino. Retrieved February 18, 2008 .
  41. PowerTools for Open XML. Retrieved June 20, 2008 .
  42. MO74: WebSphere MQ - Windows Powershell Library. Retrieved February 18, 2008 .
  43. PowerShell Commands for Active Directory by Quest Software. Retrieved July 2, 2008 .
  44. ^ PowerShell Remoting through Group Policy. Retrieved February 18, 2008 .
  45. VMware Infrastructure Toolkit for Windows. (No longer available online.) Archived from the original on November 21, 2008 ; Retrieved November 26, 2008 . Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. @1@ 2Template: Webachiv / IABot / www.vmware.com
  46. Windows PowerShell: IIS7 PowerShell Provider Tech Preview 2. Retrieved July 3, 2008 .