PowerShell is a new command shell and scripting language for Windows. It is cool for a lot of reasons:
The language is sane, especially when compared to CMD.
Scripts and command line share a language. CMD had many small but important differences. CScript and Windows Scripting Host are not interpreted.
Command line usage can be quick while scripts can be readable, thanks to the combination of aliases and smart command argument processing. For example, dir -r .
is the same as Get-ChildItem -Recurse -Path "."
Consistent command argument syntax, across all cmdlets and custom scripts (in V2.0).
Powerful interaction with other technologies, most notably .NET. Also, WMI is suddenly convenient and accessible. COM is there, too. V2 makes Win32 interop easy, too.
An integrated script editor/interactive shell in V2 that is very cool.
Command pipelines work on objects, not strings, which means you don't need to parse, and you can format text for humans not the next command. In bash I did a lot of cut
, but in PowerShell I don't have to. The objects are real .NET objects, which is very powerful.
Before PowerShell I managed to become an expert in CMD script writing, but now I can start erasing that part of my brain. Thank goodness.
EDIT: It's worth mentioning that lots of Microsoft products are adding PowerShell support, especially for server products. For example, Exchange ships with PowerShell cmdlets, so you can administer your Exchange server via PowerShell.
In my opinion, the big deal is PowerShell passes around objects. It takes a while to realize just how powerful this is. For example, instead of munging the text output of a utility, looking for what you want in characters 7 through 18, you can just access a property of an object. That's much faster to use, and it's not going to break if a new version adds an extra character to the output.
Microsoft PowerShell is Microsoft's new commandline utility that was designed to provide greater control and flexibility to IT administrators.
You can think of it as a really complicated version of the command prompt designed for repeatable tasks.
From Microsoft's website:
Microsoft Windows PowerShell command line shell and scripting language helps IT professionals achieve greater control and productivity. Using a new admin-focused scripting language, more than 130 standard command line tools, and consistent syntax and utilities, Windows PowerShell allows IT professionals to more easily control system administration and accelerate automation. Windows PowerShell is easy to adopt, learn, and use, because it works with your existing IT infrastructure and existing script investments, and because it runs on Windows XP, Windows Vista, and Windows Server 2003. Windows PowerShell is now included as part of Windows Server 2008 and can be evaluated in Windows Server 2008 Beta 3. Exchange Server 2007, System Center Operations Manager 2007, System Center Data Protection Manager V2, and System Center Virtual Machine Manager also leverage Windows PowerShell to improve administrator control, efficiency, and productivity.
Here's one of the cool effects of the .NET integration / object hangling: calling webservices from the command line and handling the results as .NET objects that can be manipulated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With