Archive for the ‘Software’ Category

Windows PowerShell 1.0 (continued)

This will probably be my last post about Windows PowerShell. I was really hoping that it would be the cat’s meow but I’m sorry to report that I don’t believe it is ready for prime time. It is no surprise to me that Microsoft chose to leave it out of the Vista release.

I have to say that it is pretty cool that you can access the .NET objects from the command line.

I still feel that the documentation is terrible. I am going to be more specific but it is hard to know where to start.

First of all, the primer needs an INDEX! How hard can that be?

  • Help files are a mixture of text files and xml files. This means that to search for a word in the help files, I first have to run the get-help cmdlet and pipe the output through some filter to find the word of interest. This makes scripts like apropos (http://www.leeholmes.com/blog/GetHelpMatchSearchHelpAproposInPowerShell.aspx) run quite slow.
  • I didn’t see any reference in the Primer about one of the most useful cmdlets… “select-string”.
  • Try to find out anything about “prompt”.
  • Cut and paste from the screen to the command line is primitive.
  • Neither the get-help cmdlet nor the command line editor have any facility for searching. With command lines approaching 200 characters or more this is painful if you made a typo.
  • There is not much about script writing. I finally discovered how to list the existing scripts like “help” by doing a “get-content” on the function. In analyzing the “help” script I see constructs that I have yet to find an explanation for in any of the documentation.

I could go on and on but I will spare the reader that agony.

In conclusion, there is a lot of potential here and maybe by version 5.0 it will really be the cat’s meow but for now I will stick to the older shells that have evolved over time to become quite powerful.

Advertisements

Windows PowerShell 1.0 Command Line Editing

Retrieving and Editing previous commands

I was going to be critical about the command line editing features but after playing around with it I find that it has all the features I am looking for. I am not fond of having to use function keys to manipulate the history list because I am a ‘vi’ user and don’t like to leave the home row on the keyboard.

Powershell still can’t compare to Unix shells which allows the user to chose Emacs or VI commands to edit the command line.

There is one HUGE omission in the help file ‘about_history’ where it talks about using the F7 key to pull up the history list then F9 to prompt the user for the command number of interest to place on the command line for editing. The omission is that all one has to do is use the arrow keys to scroll to the command of interest then press either the left or right arrow key to move the command to the command line for editing. This makes all the difference for me.

Irregularities with the History list

Get-History does not show the current command in the list. Of course, the current command will always be ‘Get-History’.

Pressing F7 also brings up a history list and it does show the most recent command but it only shows 50 commands even though the default MaximumHistoryCount is 64.

Interim thoughts

I have Cygwin installed on my Windows machine so I have a Bash shell available to me and it is pretty powerful. I am having second thoughts about spending the time learning PowerShell but I am intrigued by the object oriented concept. I’m not so sure it is a suitable tool for the IT professional that is running around with his hair on fire. (I heard that on one of the PowerShell webcasts)

Windows PowerShell 1.0

Congratulations to the Microsoft team that had the nerve to undertake writing yet another command line shell and giving it some thought to make it useful.

I just tried it and here are my first impressions:

The hyphenated commands

This has to be the worst idea so far this century. I would strongly recommend using the CamelCase naming convention for commands. Just take a look where the hyphen key is
located on the keyboard! Here is an example of what I mean:

“GetItemProperty” instead of “Get-ItemProperty”

They are already using the CamelCase notation in the latter half of the command.

 The HELP system

So far I don’t find it to be very intuitive.

I would like to see something like the Unix/Linux ‘apropos’ or ‘man -K’ commands.

Let’s say I want to find out how to change the prompt.
    man prompt               # doesn’t work
   $prompt                      # doesn’t work
    Get-Alias prompt     # doesn’t work

Turns out that the word ‘prompt’ is a function which is considered a command and is discovered with Get-Command. So I type:
    Get-Command -name prompt    # only shows truncated version of the function definition.

Finally, after painstakingly reviewing the syntax for ‘Get-Command’, I decided to try the ‘syntax’ parameter:
    Get-Command -name prompt -syntax    # Finally shows me what I was looking for.

        ‘PS ‘ + $(Get-Location) + $(if ($nestedpromptlevel -ge 1) { ‘>>’ }) + ‘> ‘

I guess now would be a good time to mention that I started this quest because I wanted to get rid of the ‘PS’ at the beginning of my prompt.

I still haven’t figured out how to change the prompt from the command line. I also can’t seem to find the intial profile file that PowerShell uses but I did read somewhere that if I create profile.ps1 in ‘My Documents\WindowsPowerShell’ it will be executed on start up.

In the end, this is what I ended up doing to remove the ‘PS’ from the prompt.

     ” + $(Get-Location) + $(if ($nestedpromptlevel -ge 1) { ‘>>’ }) + ‘> ‘

Don’t know why I couldn’t just get rid of everything up to the first dollar sign.

Microsoft’s ‘favorites.live.com’ Fiasco!

I am not a Microsoft basher, I have been using Microsoft software since the early ’80s and have come to expect it to be pretty solid and have a fairly consistent user interface by the time they release any new software.

For some time now I have been looking for a clean way to share my Bookmarks (Favorites) online and to have it synchronize automatically with my browser’s Bookmarks.

I am not impressed with sites like del.icio.us because there is too much going on. I just want one line per bookmark just like the browser presents it.

So I discovered Microsoft’s ‘favorites.live.com’. Not the most intuitive URL but oh well.

I signed up and imported my Favorites for IE7 without any problems.

Guess what? Nobody can see my links and I have to log in to see them, not very useful.

Now the instructions tell me that I have to create an account on ‘spaces.live.com’ and enable Favorites sharing.

OK, I do that but it turns out that all 250 bookmarks that I uploaded are marked as private. Should be no problem to change that, right?

Wrong! There is no way to select all the bookmarks and mark them as shared. You have do them one at a time. To make matters worse, if you have more than one screen full, each time you click the share button the screen resets to the top of the list so you have to scroll down to the page you were on to continue the sharing process.

But wait, there’s more! I have my Favorites organized in folders. I have yet to find a way to sort the folders in alphabetical order. You can sort the links within a folder but not the folders themselves.

OK. At least the folders are listed in a pane on the left and the contents are in a pane on the right and they are presented in the full browser window now I go over to ‘username.spaces.live.com’ and look at my Favorites and all the folders and files are mixed together and are presented in a little box in the browser. Not what I wanted at all.

I know I sound quite negative but I have to wonder if it is that hard to find good software QA people. I am a software engineer and I have done QA in the past and would be happy to do it for a reasonable price if Microsoft was interested and serious about getting it right.