Sunday morning drive with my hair on fire: Types/Community/Synthetic types/Democracy/Cool XML tricks

Exploring types is a pain! Monad provides Get-Member which makes it pretty nice to explore an OBJECT but if you want to explore that object’s type, you have to use the capabilities of the System.RuntimeType class. Let me make that distinction a little clearer.  Imagine that I’ve got some xml:$x=[XML]”<a><b>TEST</b><a>” I can explore this object… Read more

Comparative Examples in MSH and KSH

  Most shells (such as Windows CMD.EXE and the UNIX shells SH, KSH, CSH, and BASH) operate by executing a command or utility in a new process, and presenting the results (or errors) to the user as text. Text-based processing is the way in which system interaction is done with these shells. Over the years,… Read more

Verb-Noun vs Noun-Verb

Kurt asked the question “why not Noun-Verb vs Verb-Noun” in his post: There are lots of answers to this some better than others.  Let me rattle off a couple of them: VMS DCL/AS400.  Issac Newton once said that if he could see farther, it was because he was standing on the shoulders of giants.  So… Read more

Finding out what determines which properties are displayed

MoW, a Monad newsgroup regular, asked why only the Caption, Name and PeakUsage properties were displayed from the command “get-WMIObject Win32_PageFileUsage” while the output object had a lot more properties. I think it is worth it to explain in details how to find out which properties are displayed.First, I would look at which view defined… Read more

Is it safe to use ALIASES in scripts?

In our newsgroup (Microsoft.Public.Windows.Server.Scripting) , Mark Ayers asked the question:> Shouldn’t best practice for scripts be full command name? The answer is YES, NO, and MAYBE. YES – Full names provide the most readable experience for scripts.  This is very important.  People often throw the rock at Perl saying that it is a “write-only language” meaning that… Read more

Working with Sort-Object Cmdlet

In this blog I will try to explain different features of sort-object(Sort) cmdlet. For the purpose of this blog, I assume the following objects exist:   MSH C:\temp\monad> $a,$b,$c,$d                                     Score Name                                   —– —-                                     100 John                                      90 Henry                                      90 Tom                                      80 David     From the definition Sort looks… Read more

How does Select-String work with Pipelines of objects?

<Edited to convert Match-String to Select-String 7/9/2006> In our newsgroup (Microsoft.Public.Windows.Server.Scripting) , Vasu asked about how Select-string works in pipelines: Here is what I observe:1. MSH C:\> get-alias ..truncated..Alias           ri                                   remove-itemAlias           rni                                  rename-item..truncated..2. MSH C:\> get-alias | select-string ririMSH C:\> The question is why did the string “ri” get emitted instead of the alias record. So what… Read more

Check Spelling Script

After reading Marcel’s introductory piece on ScriptBlock, I decided to rewrite an old script of mine that checks the spelling of all text files in a directory. Here is what I came out with. #region Parse a line to a list of words $StringFind ={param ($str, $start, $cond)  if ($start -ge 0 -and $start -lt $str.Length) {    for($i = $start;… Read more

Base64 Encode/Decode a string

Today I came across  . This sight is focused on Monad and MSH and is starting a collection of scripts at: .  You should visit their site and let them know what type of scripts would be useful to you.  I particularly liked their entry on how to Base64 encode a file.  This is… Read more


Monad provides a way to create new com objects with new-object $ie = New-Object -ComObject InternetExplorer.Application$ie.Navigate2($ie.Visible=1 Great but what about if you want to bind to an existing object?  Where is the equivalent of GetObject()? This is one of those good new/bad news stories.  First the bad news.  Monad does not provide a Cmdlet that… Read more