Information about Windows Powershell

Windows PowerShell

Screenshot of a sample PowerShell session
Developer:Microsoft Corporation
Latest release:1.0 / November 14, 2006
OS:Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008
Platform:x86, x86-64 and Itanium
Available language(s):multilanguage
Status:Active
Genre:Operating system shell
License:MS-EULA
Website:Windows PowerShell


Windows PowerShell, previously Microsoft Shell or MSH (codenamed Monad) is an extensible command line interface (CLI) shell and scripting language product developed by Microsoft. The product is based on object-oriented programming and version 2.0 of the Microsoft .NET Framework. It is available for Windows XP, Windows Server 2003 and Windows Vista and planned for inclusion with Windows Server 2008.[1]

Windows PowerShell is the foundation of the administrative tools for Exchange Server 2007, System Center Virtual Machine Manager 2007 and System Center Operations Manager 2007 where everything is done via command line interfaces and the administrative GUI is layered on top of those commands.

History

Every released version of Microsoft DOS and Microsoft Windows for personal computers has featured a command line interface tool. These have been COMMAND.COM (in installations relying on MS-DOS) and cmd.exe (in Windows NT-based installations). These were not always capable of reproducing or automating all of the administrative functions available in the graphical user interface (GUI). This has been due to limitations within the command-line equivalents or to Microsoft not providing full fidelity command-line equivalents, although under Windows Server 2003, this situation was improved. Users have also been hindered by a lack of adequate documentation of command-line functionality.

Microsoft attempted to address some of these shortcomings by introducing the Windows Script Host in 1998 with Windows 98. The Windows Script Host was a new scripting layer which could implement a variety of scripting languages. However, the Script Host had its own deficiencies. It was not integrated with the shell, its documentation was not very accessible, and it quickly gained a reputation as a system vulnerability after several high-profile computer viruses exploited substantial weaknesses in its security provisions.

Windows Server 2003 and certain versions of Windows XP included a command-line-based script host called CScript.exe (essentially just a portion of the Windows Script Host introduced earlier), but it was not integrated into the existing shell (cmd.exe). These operating systems provided other ad hoc CLIs as well (netsh, for example), which were not fully integrated either.

By 2003 Microsoft had started to develop a new shell called Monad (aka MSH), a new extensible command shell with a fresh design which would be capable of automating a full range of core administrative tasks.

Microsoft published the first Monad public beta release on June 17 2005, Beta 2 on September 11 2005 and Beta 3 on January 10 2006.

Microsoft announced on April 25 2006 that Monad was renamed to Windows PowerShell, positioning it as a significant part of their management technology offerings.[2] Release Candidate 1 of PowerShell was released at the same time.

Release Candidate 2 of PowerShell was released September 26 2006.

Windows PowerShell v1.0 was released to web (RTW) November 14 2006.

PowerShell for Vista was released on January 30 2007.[3]

Microsoft has committed to building future GUI tools on top of PowerShell, ensuring that the core administrative functionality remains scriptable. Exchange Server 2007's management user interface, for example, is built on top of PowerShell. In most everyday tasks, PowerShell can be used in place of CMD.EXE and Windows Script Host (WSH). However, for backward-compatibility purposes both CMD.EXE and WSH will continue to be supported by Windows.

Central concepts

PowerShell's codename, Monad, alludes to Gottfried Leibniz's monadism,[4] a philosophy in which the universe is a composite of fundamental elements (monads) that are integrated in a "pre-established harmony." Similarly, PowerShell is a composite of the complex tasks of a series of components. These components are special programs dubbed cmdlets (pronounced "command-lets"), which are .NET classes designed to use the features of the environment. PowerShell's main distinction from standard UNIX shells is that, rather than creating a pipeline based on text streams, PowerShell cmdlets pass data as self-describing .NET objects.

If invoked individually from the command line, a cmdlet's output is converted automatically into text, but if its output is to be used by another cmdlet, it is converted into the appropriate object type for the receiving cmdlet. This eliminates much need for the many text-processing utilities that are common in UNIX pipelines, such as grep and awk, and allows things to be combined interactively (or in a scripting environment) without pressuring for the usage of a more complex programming language. For instance: a listing of processes internally consists not of text describing the processes, but of objects representing them; these objects can be directly manipulated from the PowerShell.

Features

The first version contains the following features:
  • A C#-like scripting language with support for hash tables, switch statements which can test on regular expressions, array slicing and anonymous methods (script blocks) which can be stored as data and then later executed. It also provides looping (for/foreach/while), conditional statements (if/switch), variable scoping (global/script/local) and the ability to define functions.
  • Cmdlets inherit certain options, allowing the user to choose things such as the level of interaction and how to deal with errors. Cmdlets which produce side effects support the options -WhatIf and -Confirm. -WhatIf informs the user what would have happened, but no action takes place. -Confirm informs the user what is about to happen and allows the user to control whether it takes place or not.
  • One option for dealing with errors is to invoke a "suspend" feature which allows the user to enter a new command shell, investigate a problem, and resume the original command. The user can define the prompts to be shown in such circumstances.
  • An extensible provider model allows access to and manipulation of the file system and other hierarchical data stores. Some examples: PowerShell comes with a registry provider which allows access to the registry via the "HKLM" and "HKCU" hives; with this, the registry can be browsed by executing commands like dir HKLM:\SOFTWARE\Microsoft at the shell prompt. PowerShell comes with providers for the certificate store, the environment, and shell functions and aliases. Like cmdlets, the provider model is extensible, allowing third parties to create their own provider model and plug it into PowerShell.
  • A concept called "execution policies" which allows coarse security constraints to be imposed upon PowerShell script execution. Execution policies define the restrictions under which PowerShell loads configuration files and runs scripts. The four execution policies are Restricted, AllSigned, RemoteSigned, and Unrestricted.
  • Support for the use of script signing to verify the identity of a script publisher and to validate the integrity of a published script using digital signatures.
  • The command-line options are generally whole words, but can be specified as the minimum number of letters necessary to disambiguate. For example, the option -show-detailed-information could be entered as -s if no other option begins with 's'.
  • Comprehensive, user-extensible tab completion features. The cmd.exe shell in current versions of Windows can only complete file or directory names, in contrast to the advanced completion in shells such as bash and zsh.
  • The ability to assign the output of a command to a variable, which will then be an object or array of objects inspectable in any way desired.

Cmdlets

The following table contains a selection of the more than 129 Cmdlets that ship with PowerShell as well as the equivalent commands in other command line interpreters.

Windows PowerShell
(Cmdlet)
Windows PowerShell
(Alias)
cmd.exe / COMMAND.COM
(MS-DOS, Windows, OS/2, etc.)
bash
(Unix, BSD, Linux, etc.)
Description
Set-Locationsl, cd, chdircd, chdircdChange the current directory
Clear-Hostcls, clearclsclearClear the screen
Copy-Itemcpi, copy, cpcopycpCopy one or several files / a whole directory tree
Get-Helphelp, manhelpmanHelp on commands
Remove-Itemri, del, rmdir, rd, rmdel, rmdir, rdrm, rmdirDelete a file / a directory
Rename-Itemrni, renrenmvRename a file / a directory
Get-ChildItemgci, dir, lsdirlsList all files / directories in the (current) directory
Write-Outputecho, writeechoechoPrint strings, variables etc. to screen
Pop-LocationpopdpopdpopdChange the current directory to the directory most recently pushed onto the stack
Push-LocationpushdpushdpushdPush the current directory onto the stack
Set-Variablesv, setsetsetSet the value of a variable / create a variable
Get-Contentgc, type, cattypecatGet the content of a file
Get-Processgps, pstlist[5], tasklist[6]psList all currently running processes
Stop-Processspps, killkill[5], taskkill[6]killStop a running process
Tee-Objecttee?teePipe input to a file or variable, then pass the input along the pipeline

Examples

  • Stop all processes that begin with the letter "p":
PS> get-process p* | stop-process
  • Find the processes that use more than 1000 MB of memory and kill them:
PS> get-process | where { $_.WS -gt 1000MB } | stop-process
  • Calculate the number of bytes in the files in a directory:
PS> get-childitem | measure-object -property length -sum
  • Determine whether a specific process is no longer running:
PS> $processToWatch = get-process notepad PS> $processToWatch.WaitForExit()
  • Change the case of a string from lower to upper:
PS> "hello, world!".ToUpper()
  • Insert the string "ABC" after the first character in the word "string" to have the result "sABCtring":
PS> "string".Insert(1, "ABC")
  • Download a specific RSS feed and show the titles of the 8 most recent entries:
PS> $rssUrl = "http://blogs.msdn.com/powershell/rss.aspx" PS> $blog = [xml](new-object System.Net.WebClient).DownloadString($rssUrl) PS> $blog.rss.channel.item | select title -first 8
  • Sets $UserProfile to the value of the UserProfile environment variable
PS> $UserProfile = $env:UserProfile

File extensions

  • PS1 – Windows PowerShell shell script
  • PS1XML – Windows PowerShell format and type definitions
  • PSC1 – Windows PowerShell console file

List of Microsoft projects using PowerShell

  • Exchange 2007
  • System Center Operations Manager 2007 (SCOM 2007)
  • System Center Virtual Machine Manager 2007 (VMM)
  • System Center Data Protection Manager 2007 (DPM)
  • Microsoft Transporter Suite for Lotus Domino
  • Windows Compute Cluster Tool Pack
  • Windows Server 2008

See also

References

1. ^ Windows Server 2008: Windows PowerShell: Now Part of Windows Server 2008 Beta 3. Microsoft (November 13 2006). Retrieved on 2007-05-16.
2. ^ Snover, Jeffrey (April 25 2006). Windows PowerShell (Monad) Has Arrived. Windows PowerShell team blog. MSDN. Retrieved on 2006-04-26.
3. ^ Snover, Jeffrey (November 15 2006). Windows PowerShell : Windows PowerShell & Windows Vista. Windows PowerShell team blog. MSDN. Retrieved on 2007-01-26.
4. ^ Snover, Jeffrey (March 19 2007). Monad Manifesto – the Origin of Windows PowerShell. Windows PowerShell team blog. MSDN. Retrieved on 2007-03-24.
5. ^ Available in Windows NT4, Windows 98 Resource Kit, Windows 2000 Support Tools
6. ^ Available in Windows XP Professional Edition and later
7. ^ Available in Windows NT4, Windows 98 Resource Kit, Windows 2000 Support Tools
8. ^ Available in Windows XP Professional Edition and later

Books

External links

Official websites

Windows PowerShell team

3rd-party tools

  • Powershell.com - Powershell Analyzer and Powershell Plus - Powershell Hosting, Editor and Debugging Products.
  • Admin Script Editor IDE - Commercial script editor with support for PowerShell and VBScript.
  • PrimalScript - Example of a commercial Windows PowerShell editing environment
  • PowerGUI Community - PowerGUI is an extensible graphical administrative console for managing systems based on Windows PowerShell.
  • PowerShell Remoting - a light-weighted server-client application to connect to remote PowerShell host and run script interactively.
  • PowerGadgets - Desktop reporting and monitoring for IT/DB professionals.

PowerShell providers

Users groups and communities

  • PowerShellCommunity.Org - an independent, open community dedicated to increasing the awareness and use of Microsoft Windows PowerShell.
  • Get-PSUGUK - UK PowerShell Users Group
  • PowerScripting Podcast - PowerScripting Podcast - A podcast for people learning Windows PowerShell with segments covering cmdlets, tips, resources, gotchas etc

Tutorial









Software development is the translation of a user need or marketing goal into a software product.[1][2] Software development is sometimes understood to encompass the processes of software engineering combined with the research and goals of software marketing
..... Click the link for more information.
Microsoft Corporation

Public (NASDAQ:  MSFT )
Founded Albuquerque, New Mexico, USA (April 4 1975)[1]
Headquarters Redmond, Washington, United States

Key people Bill Gates, Co-founder and Executive Chairman ;
Paul Allen, Co-founder ;
..... Click the link for more information.
Code complete redirects here. For the Microsoft book, see Code Complete.

A software release is the distribution, whether public or private, of an initial or new and upgraded version of a computer software product.
..... Click the link for more information.
November 14 is the 1st day of the year (2nd in leap years) in the Gregorian calendar. There are 0 days remaining.

Events


..... Click the link for more information.
20th century - 21st century - 22nd century
1970s  1980s  1990s  - 2000s -  2010s  2020s  2030s
2003 2004 2005 - 2006 - 2007 2008 2009

2006 by topic:
News by month
Jan - Feb - Mar - Apr - May - Jun
..... Click the link for more information.
An operating system (OS) is the software that manages the sharing of the resources of a computer. An operating system processes system data and user input, and responds by allocating and managing tasks and internal system resources as a service to users and programs of the
..... Click the link for more information.
Windows XP
(Part of the Microsoft Windows family)
Screenshot

Screenshot of Windows XP Service Pack 2
Developer
Microsoft
Web site: Windows XP: Homepage
Release information
Release date:
..... Click the link for more information.
Windows Server 2003
(Part of the Microsoft Windows family)
Screenshot

Screenshot of Windows Server 2003 Enterprise Edition
Developer
Microsoft
Web site: www.microsoft.
..... Click the link for more information.
Windows Vista
(Part of the Microsoft Windows family)
Screenshot

Screenshot of Windows Vista Ultimate
Developer
Microsoft
Web site: Windows Vista: Homepage
Release information
Release date:
..... Click the link for more information.
This article or section contains information about computer software currently in development.
The content may change as the software development progresses.


(Part of the Microsoft Windows family)
Screenshot
..... Click the link for more information.
In computing, a platform describes some sort of framework, either in hardware or software, which allows software to run. Typical platforms include a computer's architecture, operating system, or programming languages and their runtime libraries.
..... Click the link for more information.
The generic term x86 refers to the "CISC" type instruction set of the most commercially successful CPU architecture[1] in the history of personal computing, used in processors from Intel, AMD, VIA, and others.
..... Click the link for more information.
x86-64 is a 64-bit superset of the x86 instruction set architecture. The x86-64 instruction set natively supports Intel's x86 and was designed by Advanced Micro Devices (AMD), who have since renamed it AMD64.
..... Click the link for more information.
Itanium 2
Central processing unit

Itanium 2 logo
Produced: From mid 2002 to present
Manufacturer: Intel
CPU Speeds: 733 MHz to 1.
..... Click the link for more information.
In the philosophy of language, a natural language (or ordinary language) is a language that is spoken, written, or signed (visually or tactilely) by humans for general-purpose communication, as distinguished from formal languages (such as computer-programming
..... Click the link for more information.
Computer software can be organized into categories based on common function, type, or field of use. A list follows of common software categories.

Categories of software

  • Applications

..... Click the link for more information.
In computing, a shell is a piece of software that provides an interface for users. Typically, the term refers to an operating system shell which provides access to the services of a kernel.
..... Click the link for more information.
A software license comprises the permissions, rights and restrictions imposed on software (whether a component or a free-standing program). Use of software without a license could constitute infringement of the owner's exclusive rights under copyright or, occasionally, patent law
..... Click the link for more information.
Microsoft Corporation

Public (NASDAQ:  MSFT )
Founded Albuquerque, New Mexico, USA (April 4 1975)[1]
Headquarters Redmond, Washington, United States

Key people Bill Gates, Co-founder and Executive Chairman ;
Paul Allen, Co-founder ;
..... Click the link for more information.
worldwide view.




A software license agreement is a memorandum of contract between a producer and a user of computer software which grants the user a software
..... Click the link for more information.
A website (alternatively, Web site or web site) is a collection of Web pages, images, videos or other digital assets that is hosted on one or several Web server(s), usually accessible via the Internet, cell phone or a LAN.
..... Click the link for more information.
Microsoft codenames are the codenames given by Microsoft to products it has in development, before these products are given the names by which they appear on store shelves.
..... Click the link for more information.
command line interface or CLI is a method of interacting with an operating system or software using a command line interpreter. This command line interpreter may be a text terminal, terminal emulator, or remote shell client such as PuTTY.
..... Click the link for more information.
Scripting redirects here. For other uses, see script.


Scripting languages (commonly called script languages) are computer programming languages that are typically interpreted and can be typed directly from a keyboard.
..... Click the link for more information.
Microsoft Corporation

Public (NASDAQ:  MSFT )
Founded Albuquerque, New Mexico, USA (April 4 1975)[1]
Headquarters Redmond, Washington, United States

Key people Bill Gates, Co-founder and Executive Chairman ;
Paul Allen, Co-founder ;
..... Click the link for more information.
Object-oriented programming (OOP) is a programming paradigm that uses "objects" and their interactions to design applications and computer programs. It is based on several techniques, including inheritance, modularity, polymorphism, and encapsulation.
..... Click the link for more information.
.NET Framework is a software component that can be added to or is included with Microsoft Windows operating system. It provides a large body of pre-coded solutions to common program requirements, and manages the execution of programs written specifically for the framework. The .
..... Click the link for more information.
Windows XP
(Part of the Microsoft Windows family)
Screenshot

Screenshot of Windows XP Service Pack 2
Developer
Microsoft
Web site: Windows XP: Homepage
Release information
Release date:
..... Click the link for more information.
Windows Server 2003
(Part of the Microsoft Windows family)
Screenshot

Screenshot of Windows Server 2003 Enterprise Edition
Developer
Microsoft
Web site: www.microsoft.
..... Click the link for more information.
Windows Vista
(Part of the Microsoft Windows family)
Screenshot

Screenshot of Windows Vista Ultimate
Developer
Microsoft
Web site: Windows Vista: Homepage
Release information
Release date:
..... Click the link for more information.


This article is copied from an article on Wikipedia.org - the free encyclopedia created and edited by online user community. The text was not checked or edited by anyone on our staff. Although the vast majority of the wikipedia encyclopedia articles provide accurate and timely information please do not assume the accuracy of any particular article. This article is distributed under the terms of GNU Free Documentation License.
Herod_Archelaus


page counter