Slashdot Mirror


Microsoft PowerShell RC1

rst+ack writes "Microsoft has released RC1 version of PowerShell the .NET-based shell with perl-like syntax previously known as Monad or MSH. PowerShell (PS) has been covered a few times on Slashdot. Contrary to cmd.exe and Unix/Linux shells it operates on objects, not text when passing data between scripts and executables. Easy access to .NET classes allows users to create quite advanced solutions in short time. PS won't be shipped with Vista or Windows Server 2007 but it will debut with Exchange 12."

13 of 548 comments (clear)

  1. Is that like PowerGlove? by Orrin+Bloquy · · Score: 5, Funny

    If so, sign me and Fred Savage up!

    --
    "Made up/misattributed quote that makes me look smart. I am on /. and I must look smart."
  2. Re:The relevant quote... by bod1988 · · Score: 5, Funny

    I belive they have. It's called linux.

  3. On XBox Power platform? Passing Text Arrays? by expro · · Score: 5, Interesting

    I wonder if the trademark works. They will probably have to call it Power Microsoft Shell. People will likely want to have Unix-like piping of textual results. Does this mean a Text array gets instantiated, or is it a stream object?

  4. Re:Text by powerlord · · Score: 5, Insightful

    Well ... to take the position of "Devil's Advocate" for a minute, if they just extended bash to have C# scripting, then you'd have lots of people on this forum yelling how they are perverting the standard and that this is just aploy for them to embrace and extend the existing shell language.

    Look at it from MS's perspective:
    1) They know they need a shell like language to handle sys admin type functions.
    2) They've just put a lot of effort into .Net
    3) Most of the MS Admins out there believe VB is the tool of choice.

    Given those suppositions (feel free to argue about their reality, but remember that I'm discussing it from MS's viewpoint), a scripting language that fullfills (1), takes advantage of (2) and leverages (3) seems like a no brainer, even for them.

    Of course, considering that there are .Net bindings for Perl, that may be an even better choice for a scripting language.

    --
    This space for rent. All reasonable inquiries will be entertained at proprietors discretion.
  5. More like WMIScript by Anonymous Coward · · Score: 5, Interesting
    Seriously. Look at the sample scripts. Every last one of them looks like this:
    $strComputer = "."
     
    $colItems = get-wmiobject -class "Win32_UTCTime" -namespace "root\CIMV2" `
    -computername $strComputer
     
    foreach ($objItem in $colItems) {
          write-host "Day: " $objItem.Day
          write-host "Day Of Week: " $objItem.DayOfWeek
          write-host "Hour: " $objItem.Hour
          write-host "Milliseconds: " $objItem.Milliseconds
          write-host "Minute: " $objItem.Minute
          write-host "Month: " $objItem.Month
          write-host "Quarter: " $objItem.Quarter
          write-host "Second: " $objItem.Second
          write-host "Week In Month: " $objItem.WeekInMonth
          write-host "Year: " $objItem.Year
          write-host
    }
    So, we can query the Windows Management Interface, and we can write it to the console. Awesome.

    Guys, next time, think about making it do something before you put out a release candidate.
    1. Re:More like WMIScript by Anonymous Coward · · Score: 5, Informative

      Unfortunately a lot of the examples on ScriptCenter are direct translations of VBScript examples. This is good in the sense that it shows how a VBScript user can migrate stuff to PowerShell. It's not, however, a good illustration of how PowerShell works. The above script can simply be written as

      get-wmiobject Win32_UTCTime

      WMI is one of the reasons we needed an object-based shell - it presents Window management information as a collection of objects. Writing code to render those objects to strings and then parse them back into objects is not realistic. We needed a shell that could deal with them directly.

      Bruce Payette
      PowerShell Technical Lead
      Microsoft

    2. Re:More like WMIScript by YeeHaW_Jelte · · Score: 5, Informative

      I can't believe no one picked up on this comment. Mr Payette here is giving us interesting insight into the reasons for the object-orientatedness of the shell.

      As I understand it, the difference between PowerShell and your typical Unix shell is that the Unix OS is built around the shell and PowerShell is built around the OS.

      As text exchange of data is the de facto way of piping data between applications in a unix system and the shell has long been the de facto way of interacting with the OS and the applications running on it most applications and the OS itself have been built to interact very well with the shell.

      However, on windows, which hasn't been built around the shell and which presents objects as the standard way to share data, they had the choice of either
      a: adding functionality to all applications in order to allow it to interact in a text-based way with cmd.exe, which is rediculous because of the vast number of applications already out.
      OR
      b: writing a shell built to integrate with the OS and the objects it uses to exchange data, which they did with PowerShell.

      Basically, this seems a sound design decision which probably has it drawbacks (necessity for data type handling & such ) but seems like a good match for winOS'es. An object orientated shell would probably not work very well with a unix OS, if only for the fact that (most?) unixes are written in C, which does not do objects at all.

      Seems like a good solution for windows systems, too bad it isn't (won't be?) included with the OS by default. It might make windows a better place to live for all us CLI types, and it can't possibly be worse than cmd.exe, can it?

      --

      ---
      "The chances of a demonic possession spreading are remote -- relax."
  6. See! they admitted it! by brightloudnoise · · Score: 5, Funny

    Windows PowerS hell

    I knew it all along!

    --
    brightloudnoise.com
  7. Come kick the tires by jsnover · · Score: 5, Informative

    I encourage you all to come kick the tires and find out what PowerShell really does/does not do. I think you'll be pleasantly surprised by its power and simplicity and might even like it. Many of us on the team have a deep background in UNIX and brought that into our work. Even if you don't like what we've done, trying it out will allow you to know enough to throw your rocks accurately. :-)

    http://www.microsoft.com/downloads/details.aspx?Fa milyId=2B0BBFCD-0797-4083-A817-5E6A054A85C9&displa ylang=en

    If you'd like to learn more, you can read our team blog at:
    http://blogs.msdn.com/PowerShell

    Enjoy!
    Jeffrey Snover
    PowerShell Architect

  8. Re:Downloading by cybereal · · Score: 5, Informative

    It takes five minutes to setup a passport account associated with any arbitrary email address and thus far has generated absolutely zero spam to my email account. You can also sign-up with a "Limited" passport account, which means, you can sign up with no association with any actual email address whatsoever. You end up creating a fake @passport.com address for signing in.

    The contracts are not any different than what you would agree to with Google, Yahoo, or any other online service provider.

    Furthermore, with only accepting the passport license, it's a bit shorter than hotmail's. Try reading it yourself. The TOS is actually very short and easy to read if you're not illiterate: https://accountservices.passport.net/PPTOU.srf?x=4 .0.5610.0&cbalt=www&vv=400&lc=1033

    --
    I read the script, and I think it would help my character's motivation if he was on fire. -Bender
  9. Re:can you? by Fareq · · Score: 5, Informative

    while we're giving out CMD.EXE tips, try this:

    enter a few commands
    then press F7 for surprising results

  10. Obviously designed by programmers for programmers by RebornData · · Score: 5, Insightful

    Although I haven't played with it, I've read a bit about this shell, and there was something that bothered me about it, and I finally just put my finger on it: this thing was designed by programmers.

    I know that the line between "programmer" and "system administrator" is often blurry. And the line between "shell" and "interactive script interpreter" is as well. But when you start requiring people to understand concepts like objects (which may seem like old hat to a programmer), you're already presuming a relatively sophisticated understanding that an "average user" has no grasp of. And the .Net libraries are vast and complex... looking at some of the sample msh scripts, I understand how a windows programmer would think they were an amazingly powerful simplification, but damn there's a lot I have to know to get basic things done.

    Ye olde csh and sh are great because they provide a simple way to put programming logic around the set of operations users spend their entire day in and are already familiar with. The learning curve is very incremental: you can master the basic UNIX commands, and then start to add in variable subtitutions (!$ anyone?) and loops (foreach) and such as needed.

    In other words, the jump from basic UNIX user knowledge to simple scripting is very small, because the scripting is presented in *exactly* the same context and using the syntax the user does day-to-day work in. But as a competant windows admin who doesn't know VB and hasn't written a line of .Net code in my life, I see almost nothing familar when I read .msh scripts. It appears to require an entirely new body of knowledge to do simple things, and bears little or no relationship to the interfaces and paradigms I use day to day. Yes, I know those interfaces are graphical. Seems to me there's bound to be some way to do it (or would be if there were any logic or consistency to the organization of the everyday administative interfaces in Microsoft's products).

    Don't get me wrong... I understand that the goal of an intuitive scripting tool is in many ways at odds with providing a rich and powerful development environment that can complete with something like perl, but I had hoped there was something a little closer to "ground level" coming.

    -R

  11. Why?!? by A+nonymous+Coward · · Score: 5, Funny

    Why does the entire world have to look like a scripting language from an OS designed four decades ago?

    Wheels -- thousands of years old. Still work.

    Fire -- hundres of thousands of years under human control -- still works.

    And you -- still typing after all these years, over a hundred now, since the invention of the keyboard. Still using fonts, for pete's sake, on graphical displays, invented before UNIX, along with mice, still using silicon (60 years old) and rust (thousands of years old) and electricity, back before Mr Franklin's experiments with kites 250 years ago, still using bits for storage as characters, processed by computer instructions, over 50 years old. Why haven't you graduated to something modern?