PowerShell Cookbook

Search

Categories

 

On this page

Enjoy the First Day of Spring
MS Connect - Please provide bugs and feedback on Monad!
Shoe tying revolution! Ian's Shoelace Site
How to get Monad Training?
Source Code and the Monad Community
Seattle Commute Times Visualilizer
Another big Monad blogger splash
Introduction to Cryptography
Pithy and Readable? Do tell!
MSN Search, without the carpal tunnel syndrome

Archive

Blogroll

Disclaimer
I work for Microsoft.

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

RSS 2.0 | Atom 1.0 | CDF

Send mail to the author(s) E-mail

Total Posts: 214
This Year: 14
This Month: 1
This Week: 0
Comments: 522

Sign In

 Monday, March 20, 2006
Monday, March 20, 2006 4:46:59 PM (Pacific Daylight Time, UTC-07:00) ( )

Today marks the first day of Spring – a date often hailed often as one with equal amounts of night and day.  This is untrue because most of us live somewhere other than the equator, because the Sun is larger than an idealized geometric point, and because our atmosphere causes refraction.  Truthfully, it is more of an Astronomical and geometric novelty than it is a practical one.

It’s still an interesting geometric novelty, though.  According to Wikipedia, the Vernal Equinox falls at 18:26 UTC.  Here’s a little trick to let you find that in your local timezone:

[C:\temp]
MSH:32 > [DateTime]::Parse("18:26 GMT")

Monday, March 20, 2006 10:26:00 AM

All pedantry aside, I hereby present to you this fluffy cute video of cats enjoying what could very well be spring days.  I do warn you, though – the video is a narcotic to small children.


 

[Edit: Monad has now been renamed to Windows PowerShell. This script or discussion may require slight adjustments before it applies directly to newer builds.]

[Edit: Here are the dates for other years: March (3/20/06, 3/21/2007, 3/20/2008, 3/20/2009, 3/20/2010, 3/20/2011, 3/20/2012, 3/20/2013, 3/20/2014, 3/20/2015, 3/20/2016, 3/20/2017, 3/20/2018, 3/20/2019, 3/20/2020)]

Comments [0] | | # 
 Wednesday, March 15, 2006
Thursday, March 16, 2006 1:07:35 AM (Pacific Daylight Time, UTC-07:00) ( )

I’m excited to announce that we recently added Monad to the list of supported products on the Microsoft Connect site – http://connect.microsoft.com.

On the Monad team, we pride ourselves in listening to customer feedback.  We used the BetaPlace feedback system in the past, and the Connect site now makes the process much more efficient.  This is especially true in helping us determine the magnitude of a given problem, or desire for a feature request.

To be very clear, the public Beta 3 build is (more or less) what we consider “done.”  We have a handful of product changes (and a few handfuls of bug fixes) in our current builds, but you are currently working with what is very nearly the finished product.

Have a bug?  Let us know.  Have a scenario that we poorly address?  Let us know.  Have a usability problem?  Let us know.  Don’t assume that the issue will go away in the next beta, as it very likely will not.  Any future changes to V1 of Monad will be driven entirely by strong customer and partner feedback.  In the absence of this, the product will remain as-is.

Of course, we will weigh this feedback against the other very real priority – getting V1 into your hands as soon as we possibly can.  If we can't accomodate your feedback for V1, it will prove very useful in helping us plan V2.

In order to help us weigh this feedback, please prefer voting over creating new feedback items.  A vote for existing feedback is actually more important than a new piece of feedback, as the number of votes helps us measure its impact.


How to register for our feedback database:

  1. Visit http://connect.microsoft.com
  2. Sign in with your credentials accepted by the Microsoft Passport Network
  3. Click “Apply” next to the item, “Windows Monad Shell”
  4. Agree to the Terms of Service
  5. Supply your personal information

How to submit a piece of feedback:

  1. See if your issue has already been covered:
    1. Select “Feedback” from the left-hand side of the screen
    2. Search for keywords that others may have used to describe your issue
  2. If you find an item that represents your feedback:
    1. Click its title
    2. Click “Vote Now” under the rating box to add your vote to the item’s rating
  3. If you do not find an item that represents your feedback:
    1. Select the “Submit Feedback” option from the left-hand side of the screen
    2. Complete the form, including as much detail as possible.  For this step, please see the detailed instructions available through the “Windows Monad Shell Home” section of the left-hand side of the screen

Looking forward to mountains of feedback!

[Edit: Monad has now been renamed to Windows PowerShell. This script or discussion may require slight adjustments before it applies directly to newer builds.]

Comments [0] | | # 
 Tuesday, March 14, 2006
Tuesday, March 14, 2006 3:13:53 PM (Pacific Daylight Time, UTC-07:00) ( )

Peter Provost unearthed this site the other day, and it’s really great. It’s called “Ian’s Shoelace Site,” and he’s got lots of cool things to do with your laces.  That’s all well and good if you are a knot fiend, but he’s also got two very practical knots:

Believe it or not, my daughter and I spent Sunday afternoon tying our shoes!

Comments [0] | | # 
 Friday, March 10, 2006
Saturday, March 11, 2006 12:03:59 AM (Pacific Standard Time, UTC-08:00) ( )

This question has come up several times internally, so I thought I'd post my answer for posterity.  "My customer would like Monad training -- are there any courses avialable?"

Usually, these customers are looking for a good introduction to Monad – and not really training on the scripting language or development.  The best thing is probably to introduce them to our 2 recorded Live meetings:

http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?culture=en-US&EventID=1032277851&CountryCode=US
http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?culture=en-US&EventID=1032277853&CountryCode=US


If you want to really make it a hands-on experience, you could ensure that everybody has Monad installed on their machine, and watch these webcasts together.  That way, you can play with it as you learn about it.

If you want to progress further into the scripting and development aspects of Monad, the “Monad Documentation Pack” is a great resource.  Start with the "Getting Started" guide.  You can also bring in a continental breakfast, a few urns of coffee, and go over the scripting, cmdlet, and provider labs from the PDC:

http://www.microsoft.com/downloads/details.aspx?FamilyID=6387c46b-4753-4eaf-8d8b-368074f39ccc&displaylang=en

For those that learn by book, O’Reilly’s Monad book is a great place to start:
http://www.amazon.com/gp/product/0596100094

[Edit: Monad has now been renamed to Windows PowerShell. This script or discussion may require slight adjustments before it applies directly to newer builds.]

Comments [0] | | # 
 Tuesday, March 07, 2006
Tuesday, March 07, 2006 11:04:23 PM (Pacific Standard Time, UTC-08:00) ( )

The Monad community is vibrant, and loves to write stuff.  Even better, is that they love to share that stuff.  Sometimes, even with source code.  Jeff’s JaMSH is one example of a project that has shared its source code, and Karl seems to have intentions to share the source for his MshAnalyzer.  Taken even broader, several of our resident newsgroup gurus have been bantering around the idea to create a shared workspace for MSH extensions – likely to be called “Community Extensions for MSH.” 

On the team, we love to play with these things – and even provide feedback on how they are implemented.  Sometimes, though, the licensing terms can prevent that.

If you contribute source code to the community (such as the Community Extensions for MSH workspace) and place it under an open source license, please be aware of the implications that the license type may have.  Some open source licenses (ie: the GPL) may prevent employees at Microsoft and other companies from being able to review or provide feedback on your source code.  The BSD style license is an example of an open source license type that will be easier for proprietary software companies to work with.

[Edit: Monad has now been renamed to Windows PowerShell. This script or discussion may require slight adjustments before it applies directly to newer builds.]

Comments [0] | | # 
 Wednesday, March 01, 2006
Thursday, March 02, 2006 7:06:00 AM (Pacific Standard Time, UTC-08:00) ( )

When I was first looking for a house, one of my primary constraints was commute times.  I started by asking people – “How long does it take you to commute to work?”  I started building a mental map, but then started thinking about putting pins on a real map to help me remember all of the data I was getting from people.

But then I thought, “Hey – computers are supposed to make this kind of stuff easier.”  And then, “Hey – I’m a software developer.  I’m supposed to make programs that make computers do useful things.”

So I did.  I built a website that allowed people to enter everything they knew about their commute times, and then another page that let them visually explore the data set.  For example, “Find me all commute times less than 30 minutes that let me commute to work by bus before 8:30 in the morning.”

With well over a thousand data points, it’s pretty useful.

When the Virtual Earth team stabilized their API a while back, I turned it into a mashup.  So if you’re thinking about commuting around the Seattle area, enjoy:

http://www.leeholmes.com/projects/commute

P.S: Although I wanted to use AJAX for the gimmick factor, it would have made the site perform terribly!  Given the expected usage pattern, it is much more efficient to download the entire data set at once.

Comments [3] | | # 
 Monday, February 27, 2006
Tuesday, February 28, 2006 6:51:13 AM (Pacific Standard Time, UTC-08:00) ( )

Without a doubt, we are blessed here on the Monad team with a community of very talented bloggers.  To add another to the list, we are now joined by Karl Prosser.  His first few blogs are doosies – integrating Monad with SQL server, and hosting Monad in an interface very similar to SQL’s Query Analyzer.

Keep up the great work!


 

[Edit: Monad has now been renamed to Windows PowerShell. This script or discussion may require slight adjustments before it applies directly to newer builds.]

Comments [1] | | # 
Tuesday, February 28, 2006 5:40:57 AM (Pacific Standard Time, UTC-08:00) ( )
Cryptography is one of the areas about security that many feel is difficult to approach.  Encryption, certificates, signatures, public keys, hashing -- these are terms that most people like to keep at arm's length.
 
That is until you've read a good introduction to the subject. Although the topic of cryptography is large and very deep, a good introduction easily provides the concepts in which to frame your thoughts and discussion on the subject.  At the very least, it can help give you an idea about what that big mess of text is at the bottom of types.mshxml :)
 
For this purpose, I've always held Phil Zimmermann's "Introduction to Cryptography" paper in high regard.  You can find it at ftp://ftp.pgpi.org/pub/pgp/6.5/docs/english/IntroToCrypto.pdf.
 
Phil Zimmermann created PGP, a very early suite of encryption software.

[Edit: Monad has now been renamed to Windows PowerShell. This script or discussion may require slight adjustments before it applies directly to newer builds.]

Comments [2] | | # 
 Wednesday, February 22, 2006
Wednesday, February 22, 2006 6:23:51 PM (Pacific Standard Time, UTC-08:00) ( )

A long time ago, Raymond Chen wrote about how to interact with the ShellWindows COM object using C++.  It was doable, but clumsy.  He then revisited his post, showing how much easier it was when accessed through a scripting language as its designers had intended.  As can be expected, the comments flowed fast and furious in illustration of the conciseness of various languages that the readers were fond of.

I’ve been meaning to show the Monad equivalent – not just because it is pithy, but because it is pithy and meaningful.  As MOW points out, it is amazing how frequently this happens.

The purpose: list the title and location of all open explorer windows:

[D:\Temp]
MSH:46 > (new-object -com "Shell.Application").Windows() | select LocationName,
LocationUrl

LocationName                            LocationURL
------------                            -----------
Smash Dance Hits                       
file:///H:/lee/My%20Music/Dance/Vari...
scriptomatic                           
file:///C:/temp/scriptomatic
Administrative Tools                    file:///C:/Documents%20and%20Setting...
The Old New Thing : Using script to ... http://blogs.msdn.com/oldnewthing/ar
...

Vivek makes a similar point in his latest post: It’s a one line world.  You don’t need to be a scripting guru to unleash the power of Monad:

When we started designing the Exchange cmdline and scripting interface, we made absolutely sure that 80% of our customers, who normally have little or no scripting experience, can still use Monad/Exchange cmdline to auotmate or perform their tasks.
(…)
You can write lots of complicated scripts, but the majority of time, you simply have to construct a one or two line pipeline.

 

[Edit: Monad has now been renamed to Windows PowerShell. This script or discussion may require slight adjustments before it applies directly to newer builds.]

Comments [1] | | # 
 Wednesday, February 15, 2006
Thursday, February 16, 2006 5:15:24 AM (Pacific Standard Time, UTC-08:00) ( )

As their blog  has so far failed to point out, it looks like MSN Search pushed a new release live today.  Unfortunately, I can’t find any mention anywhere on the internet about what’s new. 

I very much like the new colour scheme, though.  It’s light.  It’s fresh.  The old blue box made me feel constrained, but the impact goes deeper than that.

When I worked on Encarta, there was a MSN-wide effort to move to the white theme.  One of the major factors was perception: people feel that sites with minimalistic palettes load faster.  Even if the only change is to the background colour in a stylesheet.

When I implemented this change for Encarta, that was the majority of the work.  Here, try for yourself:

[Before]: http://web.archive.org/web/20050331084437/encarta.msn.com/
[After]: http://encarta.msn.com/

Oh, and Robert?  Rounded corners are so 2003 :)

Anyways, that’s a digression.

The topic often comes up at work (and online) about how much effort it takes to type search.msn.com.  It’s true – no matter which keyboard layout you use, it just feels awkward.

So, here is my contribution to the solution:

http://ouhn.net (for all Dvorak lovers out there – represent!) and
http://sfjl.net (for all of you mainstream types.)

All on the home row, and much quicker to type than Google.

Comments [0] | | #