About

I’m a husband, a father, an environmentalist, and a Product Manager.  When I was 10 years old when my dad brought home a TRS-80 computer and I started developing an interest in programming.  That really dates me, doesn’t it?  There was something about the power of those one-liners in Compute! magazine that really got my attention back then.  Little did I know then that I was starting down the road towards my future career.  Years later I went to university, earned a Bachelor’s Degree in Computer Science,  and then worked first as a software developer and later an architect for 13 years.  During my years working as software developer and architect I became more interested in the big picture and driving the direction of software than actually creating it which led to roles of Product Manager and most recently Director allowing me to do just that.

I’m very passionate about very few things.  For many years this list has only included my family, anything green, and the user experience.  In early 2007, PowerShell started taking a very prominent place on that list, so much so that I decided to completely redirect my career towards it, and I haven’t looked back since. It is through this work with PowerShell that I have received the Microsoft MVP award every year since 2008.  These days I continue to work with PowerShell along with many other technologies in my role of Director of Learning Innovation at Learn on Demand Systems.

My personal motto is: “Do better, in everything that you do”.

If you want to contact me, leave me a note in the comments or use the form on my contact me page.

Kirk Munro

13 thoughts on “About

  1. Hello,
    Nothing whatsoever to do with PowerShell except that at the seminar recently at OWSUG there were, in your exposition, many references to JK Rowling characters. My preference would be for HDM by Philip Pullman. This trilogy is, for me, better written and my 11 year old read the whole lot, which was a wonder. Better still, now that the first volume has been filmed, the Church is wanting the books removed from libraries. This in Ontario. Hollow laughter, but congratulations for an interesting evening.

    Like

  2. hi

    i use function New-LocalUser from your Network.powerpack. Very nice code !!

    however, when i call it, the first parameter which is a string array of users ( i think), has the value “A,””,FullName 102,description 102, ,”False” ,”False” ,”True”, “False”, @(“RDN5V197″), $null”, corresponding to all the parameters.

    i call it with the following way :

    $password = “mypassword” -asSecureString
    $tempCredential = New-Object System.Management.Automation.PsCredential “administrateur”,$password
    $password = $tempCredential.GetNetworkCredential().Password

    New-LocalUser @(“A”),”passwordUser” , “FullName 102”, “description 102″ ,”False” ,”False” ,”True”, “False”, @(“RDN5V197”), $tempCredential

    is it possible for you to answer me with an exemple call of this function ?

    Like

    1. Hi Arnaud,

      The reason your parameters are being treated as part of the array is because of the commas you use between them. In many programming languages, commas are used to separate parameters in function calls. This is not the case for PowerShell. You can separate parameters with spaces, or you can pass in the parameters by name. Also switch parameters are not the same as boolean parameters. If you want them, you include the switch. If you don’t, you simply leave it out. For the New-LocalUser function, with the values you have specified, you would do this:

      $password = ConvertTo-SecureString -String passwordUser -AsPlainText -Force
      New-LocalUser -Name @(‘A’) -Password $password -FullName ‘FullName 102’ -Description ‘Description 102’ -PasswordNeverExpires -ComputerName @(‘RDN5V197’) -Credential administrateur

      This will prompt you for a password for your administrateur account when you run it. If you don’t want the prompt, you could replace administrateur with $TempCredential as you have in your example script.

      I hope this helps. Let me know if you have any additional questions.

      Kirk out.

      Like

  3. hello,

    many thanks

    Another question. I tried the error handler with the try catch block. if we have 2 command in the try block,and the first command in try generates an error, process execute the block catch but execute after the 2 command.

    Should there be a specific process to go into catch block and not execute next command in block try?

    try{

    command 1
    command 2

    }catch{
    write host …

    }

    Like

    1. You need to be aware that there are two types of errors in PowerShell: terminating errors and non-terminating errors.

      Terminating errors are errors that result in an exception being raised. When an exception is raised the current script block will immediately stop. Those errors are the kinds of errors that are caught using the catch part of the try/catch statement. An example of a terminating error is if you divide by something by 0. i.e. if you run this script block:


      {
      1 / (1-1)
      'This will never execute'
      }

      you will never see the ‘This will never execute’ string because the script terminates when it attempts to divide a value by zero.

      Non-terminating errors are errors that do not cause a script to terminate. These types of errors are not catchable using try/catch statements unless you specifically tell PowerShell that you want them to be treated as terminating errors. For example, consider this script block:


      {
      Get-Command -Invalid Value
      'Hello'
      }

      If you did not want the second command to execute if the first command returns an error you would either have to add “-ErrorAction Stop” to the end of the first command (instructing PowerShell to treat errors from that command as terminating errors) or you would have to insert “$ErrorActionPreference = ‘Stop'” before the first command (instructing PowerShell to treat all errors in that script block as terminating errors). Either of these will allow you to catch those errors in the catch portion of your try/catch statement. The only other alternative is to specifically check to see if a command raised an error or not, like this:


      {
      Get-Command -Invalid Value
      if ($?) {
      'Hello'
      }
      }

      Hope this helps.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s