Updating Month of Lunches

Don Jones and I are often asked about our Month of Lunches books and when we are going to update them. This question seems to pop up more frequently now that Windows 10 is released to the wild and more of you are seeing PowerShell 5.0 for the first time. The short answer is no updates are planned. Here’s why.

If you are just getting started with PowerShell, which is the target audience for the set of books, the fundamentals haven’t really changed since PowerShell 3.0. In fact some fundamentals are unchanged since v2. Yes, there are a few new features in v5, but they are not features essential to you learning PowerShell. In fact once you understand the essential features, learning those new features on your own isn’t that difficult.

I realize potential buyers might look at the book and consider it “out-dated” but it isn’t. We developed these books to have a long shelf-life precisely because PowerShell fundamentals don’t change based on a version number. Sure, this might change at some point but so far we haven’t seen anything new in PowerShell that warrants revising the books for a beginning user.

Don and I have heard from many of you on how much you enjoy the books and how learning PowerShell has changed your career for the better. That is very humbling and I truly appreciate your support and trust. We hope you’ll continue to recommend these books to your friend and colleagues.

Friday Fun: Tickle Me PowerShell!

I work at home for myself which means I have to act as my own assistant, reminding me of important events and tasks. And sometimes I need a little help. So why not use PowerShell? In the past I’ve used and written about using a background job to wait until a certain number of minutes have passed and then display a popup message using the MSG.EXE command line utility. The drawback to my previous approach is that if I close my PowerShell session I lose the background job. For reminders in the next 10-30 minutes perhaps that’s ok. But for longer term reminders, I need a better solution.

I don’t know why I didn’t go this route from the beginning, but I can accomplish the same result using a PowerShell scheduled job. A PowerShell scheduled job runs via the task scheduler which means it persists outside of PowerShell. All I really need are three things:

  1. The time to kick off the task
  2. The command to run
  3. A registered scheduled job object

The time to kick off is the Job Trigger. Here’s how I can create a trigger for 30 minutes from now. My reminder only needs to run once.

The command will be the MSG.EXE command.

This needs to be in the form of a script block.

In my scriptblock I’m also going to delete the scheduled job. Finally I need to register it.

When the time arrives I get a popup message on my screen.

sample popup reminder
sample popup reminder

You can configure how long the message will be displayed before it is automatically dismissed. That’s the essential part of the process. Here is the complete script to define the function, including an optional alias.

Now I can easily set reminders for myself, even something tomorrow, next week or next month. I can use the scheduled job cmdlets to manage my reminders. I wrote this with the assumption that you are setting popup reminders for yourself.

Let me know what you think.

Measuring Folders with PowerShell One More Time

I know I just posted an update to my Measure-Folder function but I couldn’t help myself and now I have an update to the update. Part of the update came as the result of a comment asking about formatting results to a certain number of decimal places. I typically the Round() method from the Math .NET class.

So I added a parameter, Round, to automatically round to a certain number of decimal points. The default is 2 but you can enter any value between 0 and 10. If you use 0 the effect is to treat the value as an integer.

The other change I made was to simplify the code. My intention when creating a PowerShell tool is not have duplicate commands, or commands that are very, very similar. In last week’s version I used a Switch statement to dynamically create properties and values. But each item was practically the same except for the unit of measurement. So instead I came up with a hash table of units.

With this I can use the hashtable key as the part of property name, and the value for formatting the result.

The property name is created on the fly for anything other than the default “bytes”.

I use the same process if the user wants the average. Here’s the complete revised function.

The results are the same, with the addition of the rounding option.

I swear this is the last change. Unless someone gives me a cool idea! Enjoy.

Advice, solutions, tips and more for the lonely Windows administrator with too much to do and not enough time.