Windows PowerShell for UNIX shell addicted person

by Vivek Gite · 11 comments

Any seasoned admin will agree that command line is the faster as compare to GUI under Windows and UNIX.

As a part of my job some time I am forced to work in a Windows only environment and I do miss my bash shell very badly :(

Recently Microsoft announced Windows PowerShell. This new shell and scripting language helps IT Professionals achieve greater 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 :)

=> Supported Operating Systems: Windows Server 2003 Service Pack 1; Windows XP Service Pack 2

=> Download and more information about Windows PowerShell at msdn blog.

=> Complete information and documentation for Windows PowerShell

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 11 comments… read them below or add one }

1 Jonathan 11.15.06 at 2:44 am

There are two *way* better commandline options for Windows than the “Power Shell”:

1] JPSofts 4NT or TakeCommand. They’re pretty expensive @ US$75 each, but I’ve been using 4NT for a dozen years or more and would be lost without its power. http://www.jpsoft.com

2] Lately though I’ve become a real Cygwin addict. It’s a bit tricky to set up, but it is a very active group and they do a bang-up job of keeping the environment Linux compatible, right down to the latest controversial change where Bash doesn’t like CR/LF, just like on Linux:-) http://www.cygwin.com

2 nixcraft 11.15.06 at 2:59 am

Jonathan,

4NT or TakeCommand is new information for me. I was only aware of Cygwin which a quite good choice…

I am downloading 4NT/Take Command 30 days trial. We might end up purchasing few copies :)

Appreciate your post!

3 Joe 11.15.06 at 5:12 am

I’ve never heard of those two either, however, from the little I’ve used Powershell, I’ve enjoyed it.

There’s also IronPython which was just released not too long ago. With it, you can access all of .NET, WMI, and even interface with PowerShell through a Python environment.

4 Dmitry Kalashnikov 12.18.07 at 4:41 am

Hey guys, I’ve been a UNIX developer for a long time, mainly working on FreeBSD, OpenBSD and Linux platforms.

I am now working at Microsoft, and I do a lot of stuff with powershell. As far as Cygwin or JPSoft stuff being “way better” I’ll have to disagree:

* Powershell is much more powerfull: it doesn’t work on text streams, like unix shells. It (only) works on objects. So input/output pipelines are all .NET objects.

* Powershell, as language is much more expressive then any UNIX shell, period. The closest thing that can match it is Perl 6 or Ruby.

* For Windows scripting, it is the best choice because its specifically made for it. Its tied into Windows (registry, etc).

* It has built-in aliases for most common UNIX commands (ls, cat, ps … etc), so you don’t have to get used to Windows cmd.exe command alternatives. If you just open powershell terminal you should feel right at home!

Check out PowerTab sometime …

-Dmitry

5 Barry Kelly 01.15.08 at 3:19 pm

A big limitation with PowerShell, though, is job control. The pipes don’t work in a concurrent style. For the kind of scripts I write on my machines (all are at least 2-core, my main desktop 4-core), a careful bit of:


(
echo "Foos and bars:"
(
foo | foo2 | foo3 > foo.out &
bar | bar2 > bar.out &
wait
)
sort foo.out bar.out
) | baz2 | ... &

… etc. works wonders for running times.

6 Dunpeal 11.27.08 at 6:25 pm

I tested the new PowerShell which Windows copied from Unix, a lot of things are still missing. It has about 60% of it’s power, but it does not equal to the command line shell of unix. Linux has always been my choice for work, wouldn’t change it for Windows still. Unfortunately a lot of companies use only Windows, it can be a lot of unnecessary drag.

7 damion lusterman 05.07.09 at 9:20 pm

“PowerShell which Windows copied from Unix”

thats like saying Unix copied punch cards…or IBM terminals

you need to input things into a computer…a black screen with a promt is the easy way to do it. The features of the UNIX command shell are standard routines a computer should be able to do….

BASH (most popular unix around right now) has less features then windows powershell.

the only main problem is with job control, but they are adding that in with powershell 2.0

8 Johnny Wang 09.07.09 at 4:49 pm

Okay, so I want to count the number of commands returned by get-command cmdlet

get-command | WHAT THE FIRK DO I PUT HERE?

in unix it would be: ls /usr/bin | wc -l

in Powershell, you have to know a billion frikking options and dash this and dollar underscore that before you get something simple like commanline.

Microsoft has NEVER thought of commandline as the first class citizen and it still shows. MS people are going gaga over this because they have never felt the power of the unix commandline.

I can have a regular user be productive with a subset of unix shell commands.

in Powershell, either you’re a hotshot VB / .Net programmer (in which case you know the object hierarchy) or you’re screwed!

Tell me how I count th number of commands outputted by get-command?

is this get-command -text output -count ?

nope

is this get-command | get-count?

nope

WTF is it?

9 fez 10.07.09 at 5:24 pm

im a linux geek working in a microsoft shop. i’m just learning powershell, but i’ve been blown away by how capable it is. truly amazing. one thing that seems interesting is that powershell appears to have found all my cygwin commands as well. so from right in powershell i can use less, vim, tail, grep….

however for the command count thing i’d go with this:

$commands = get-command
$commands.length

or more concisely how about
$(get-command).length

10 Richard Berg 10.22.09 at 5:25 pm

(get-command).length

OR, for more complete processing,

get-command | measure

11 Ph 10.25.09 at 8:49 am

(get-command).count

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post:

Next post: