Managing non-terminating errors

Most errors which occur in your working scripts are likely to be “non-terminating”.  This means that Monad just reports the error and the command keeps running.  (“Terminating” errors such as syntax errors will halt the command and, in some cases, the entire script; see http://blogs.msdn.com/monad/archive/2005/11/15/493102.aspx for more details.).  This Blog describes how to handle non-terminating… Read more

Getting MSDN help urls for .NET BCL types and Members

 Often when playing with .Net objects in Monad, I need to use MSDN class library reference to learn how to use a particular type and its members. Now, I have my bookmarks and favorite search engine but I always thought it would be cool if get-member cmdlet could provide me a help link/reference to go to. Thanks… Read more

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: http://blogs.msdn.com/monad/archive/2006/02/16/533522.aspx#574708 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