October 7th, 2008 at 5:08 pm by David Potter

$NestedPromptLevel

Since my boss decided to switch from cmd.exe to PowerShell (yay!), I’ve been working on setting up a set of standardized profile scripts for everyone.  One of his first questions was how to change the prompt.  Since we’re using the PowerShell Community Extensions, we’ve been not only learning PowerShell but also the community extensions.  One of the things that some of the PSCX profile scripts do is to include the current prompt level in the prompt string.

In cmd.exe, I typically set my prompt to include an indicator of how deep my current directory stack was using pushd/popd.  Nested prompt level in PowerShell is not the same thing.  The next thing I thought was maybe if I executed another instance of PowerShell within the console by typing powershell at the prompt.  Nope, that just starts another process.

The real answer has to do with how commands are managed in PowerShell.  An article on Microsoft Technet called about_Automatic_Variables gave me the answer:

Contains the current prompt level. 0 indicates the original prompt level. The value is incremented when you enter a nested level and decremented when you exit it.

Cmdlets and functions can open a nested prompt for the user. For example, when you use the $Host.EnterNestedPrompt() method, select "Suspend" in response to a confirm prompt, or hit a breakpoint in the Windows PowerShell debugger, windows PowerShell presents a new command prompt that is nested within the original command prompt.

When you enter a nested prompt, Windows PowerShell pauses the current command, saves the execution context, and increments the value of $NestedPromptLevel. To create additional nested command prompts (up to 128 levels) or return to the original command prompt, complete the command or type "exit".

$NestedPromptLevel helps you track of the prompt level. You can create an alternate Windows PowerShell command prompt that includes this value so that it is always visible.

To summarize, a nested prompt level is created when you:

  • Use the $Host.EnterNestedPrompt() method.
  • Select "Suspend" in response to a confirm prompt.
  • Hit a breakpoint in the Windows PowerShell debugger.

I’ll probably add something to prompt to represent this, but I’ll also admit that I haven’t done enough in PowerShell to warrant it yet.  Maybe all in good time.
:-)

October 6th, 2008 at 8:29 pm by David Potter

Fixes to PowerShell Community Extension 1.1.1

I’ve been using the Community Extensions for PowerShell for some time now but for various reasons haven’t had the time to really dive in and learn it (or PowerShell) the way I’d like.  My company (well, the IT department at my company) is now standardizing on using PowerShell in place of cmd.exe and using the community extensions.  In the process I found a couple glitches with it that I wanted to share with the community (that would be you).

Bug in CD

There is a bug in the CD command that causes the new location to always be displayed.  It has apparently been fixed in the forth-coming 1.2 release.  Here is what you need to do to fix it in the current release.

  1. In the "$Env:ProgramFiles\PowerShell Community Extensions" folder edit the cd.ps1 script.
  2. On line 202, change the check from:
    if (!$PassThru) { (Get-Location).ProviderPath }
    to
    if ($PassThru) { (Get-Location).ProviderPath }
  3. Restart PowerShell.
Using a shared profile

We are planning to write shared profile scripts that everyone executes which will include the default PSCX profile script.  Here are some problems I found with doing this.

  1. The script expects you to edit it to specify the EyeCandy script to execute.  My suggestion to the PSCX developers was to not execute any script or allow it to be bypassed.  I had to edit the profile script to comment this code out.
  2. The script sets the ProfileDir and UserProfile variables based on the location of the script.  In our case, this is in a directory that is managed by source control.  I ended up removing those variables and redefining them in our company-specific profile script.  I suggested that the PSCX developers define them based on the value of the $profile variable, which is what I do.  Hopefully they will do that in the upcoming release.
Resources

You can read my previous article on the Community Extensions and my series on PowerShell here:

October 5th, 2008 at 7:26 pm by David Potter

Problem Installing Service Packs

On some of my machines I noticed that I was having trouble upgrading to the latest service pack for some of the products I have installed (e.g. Visual Studio 2005, SQL Server 2005, etc.).  It wasn’t a critical problem and I didn’t have the time to spend on tracking it down at that time so I just let it go.  A friend of mine (Paul Erickson) had a more immediate need to solve it and he shared the solution.

It turns out that there is a bug in the Windows Installer.  For some reason Microsoft has not made the fix available via Windows Update, so you have to install the patch manually.  Note that this only applies to Windows Server 2003 and Windows XP Professional (at least according to the article).

Once the patch was installed and I rebooted, the service packs from Windows Update installed successfully.

I don’t typically like to do this, at least not publicly, but I’m going to do it now.

[RANT]

I find Microsoft’s Windows Update solution to be extremely useful, especially when there are no problems, but when a problem occurs, it is extremely difficult to find out what is wrong.  Maybe there are some users who don’t want to be bothered, but by withholding the error information from everyone, they make it way too difficult to troubleshoot problems.  I find that so very frustrating.

[/RANT]

Okay, there, I did it.  I feel better. :-)

October 4th, 2008 at 4:27 pm by David Potter

ctfmon.exe

I was doing some cleanup on my server and ran across the ctfmon.exe process.  I’ve investigated this process before and at that time there didn’t seem to be definitive information available on it.  At one point there was even a virus that was being installed on people’s machines posing as ctfmon.exe.

When I searched today, I found a lot of great info on it.  From Microsoft’s web site:

What Is the Ctfmon.exe (Ctfmon.exe) File?

Ctfmon.exe activates the Alternative User Input Text Input Processor (TIP) and the Microsoft Office Language Bar.

What Does the Ctfmon.exe File Do?

Ctfmon.exe monitors the active windows and provides text input service support for speech recognition, handwriting recognition, keyboard, translation, and other alternative user input technologies.

Well clearly I don’t need to be running that on a server.  The page referenced above says that it applies to Office 2002 (aka Office XP), so I rooted around for information that would apply to a more recent version and found this one:

The instructions on that page are virtually identical as on the Microsoft page, but it specifically refers to Office 2003 (the version I had installed) and refers to Windows XP and Windows Vista.  It also has screen images which make it much easier to follow.  Microsoft could sure learn a thing or two about providing this kind of information from sites like this.

October 1st, 2008 at 5:20 am by David Potter

FeedBurner

I decided to try out FeedBurner on my site using the FeedSmith plugin.  I happened to subscribe to someone else’s blog through FeedBurner and I kind of like the result as a reader.  It’s an amazingly rich solution for publishing feeds of a site, connecting many different applications together for publishing.  I hope it proves to be a useful solution for folks that visit this site.

One thing I noticed about the FeedSmith plugin - it says it only supports WordPress versions up to 2.5 and that it doesn’t support tag feeds.  A while ago (May of 2007) the original author handed over development of the plugin to the FeedBurner folks (owned by Google).  I’m a little dismayed that they aren’t keeping up with the latest releases and features of WordPress, although I’m not too surprised.  Oh well; the plugin still works with WP 2.6.

October 1st, 2008 at 5:06 am by David Potter

Notifixious

I just learned about a service from Weblog Tools Collection called Notifixious for allowing visitors to be notified via IM, email, or SMS when a new post is published to a blog.  This is a pretty slick tool that is easy to add to a WordPress blog and really simplifies these kinds of notifications.  The plugin provides a widget that can be added to a sidebar which allows the visitor to select how they want to be notified.  Clicking the Follow button sends them to the Notifixious web site to confirm their subscription.  I’ve added it to a couple of my sites.  We’ll see how well it works.

October 1st, 2008 at 3:15 am by David Potter

DVDSpot is Closing

I’m so disappointed!  DVDSpot.com is a great site for cataloging DVDs and for finding something to watch, but now it is closing.  Here is the notice on their front page:

On Wednesday October 15th DVDSpot will be closed permanently. This decision was made to allow us to focus on other great web properties. We sincerely appreciate everyone’s contribution to the DVDSpot community and hope you enjoyed the free services it provided. We understand many people will not want to lose their personal collection data, so we remind you that you can export that data to file by going to Membership Tools while logged in and clicking the Export to File button. This will create a file with all movies in your Owned and Watched lists.

I guess I shouldn’t be surprised.  There has been almost no development on the site for a long time.  But I’m still disappointed.  Any suggestions for a replacement?

September 17th, 2008 at 3:29 pm by David Potter

Google Chrome

I decided to try the Google Chrome web browser when it came out recently.  I’d been using Opera for a while and liked a number of things about.  Here’s a brief summary of my experiences with Chrome.

  • It installed and configured itself very quickly.
  • I really liked that it pulled all my favorites over from IE, including setting up the bookmark bar.
  • I absolutely LOVE being able to drag tabs out to create another window to another Chrome window.  Finally, a browser that allows me to manage tabs the way I want.  I’m no longer held hostage by which browser window I happened to browse to.  One reason it’s able to do this is that it creates a separate process for each tab.
  • I don’t like that it doesn’t give me a drop-down list of my tab history, like IE and Firefox do.  I can even set up Opera to do that.
  • I kind of like the History and Downloads pages it generates and displays as a separate tab.
  • It doesn’t support ActiveX controls, so some Microsoft properties (parts of Live Mesh, for example) don’t work.

I may have to switch back to IE sine Chrome isn’t as compatible with all the applications that I need/want to use.  Of all the features that is making me hesitate, being able to drag tabs to where I want them is at the top of my list.  Every browser should have this feature, even previously released ones :-) - if only it were possible.

September 16th, 2008 at 5:50 am by David Potter

Booting Windows XP from a USB Flash Drive

I’m pretty much a Windows Vista devotee at this point - I really like the user interface and overall user experience even with its warts.  However, this article caught my eye:

How to install and run a FULL Windows XP from a USB drive

How cool is that!  I might just have to try it.

September 15th, 2008 at 6:54 pm by David Potter

Microsoft Office Compatibility Pack

I’ve been using Microsoft’s latest version of Office (2007) for quite some time now, but I frequently run into people using the previous version (2003) that cannot read the files I produce. With 2007, Microsoft changed the default format of the file to be based on XML for Word, Excel, and PowerPoint. I like that it is text-based, but it’s very hard to build this kind of forward-compatibility in to a product. As a result, most people can’t read the newer format.

Fortunately, Microsoft has released a compatibility pack that allows users of previous versions as far back as version 2002 to read the new formats. For a while I would just publish versions of my files in the old .doc, .xls, or .ppt format, but now that Office 2007 has been out for a while, I don’t think it’s too much to ask to have people at least install compatibility pack, even if they are unable to upgrade.

Resources: