All posts by Jeffery Hicks

Friday Fun: Another Christmas Prompt

christmastree In last week’s Friday Fun post, I shared with you a PowerShell prompt that would display a festive Christmas countdown clock. This week I have another holiday related prompt function. This one is pretty straight forward and is not that much different from the default PowerShell prompt function.

I included some logic so that my customization only happens during the month of December and before Christmas. The prompt changes the background color of your console between DarkRed and DarkGreen. The first time you run it, the prompt will randomly select a color. You might want to run Clear-Host, or CLS after loading the prompt.

After that the background color will toggle leaving you with an effect like this:

christmasprompt2014-redgreen

It is interesting to see how different commands write to the console. You could even combine both of my prompts if you are in an especially festive mood.

christmasprompt2014-everything

There’s probably no practical value in this other than having some fun and maybe understanding some PowerShell scripting concepts. Hope your holiday shopping is going well. Have a great weekend.

Why You Should Attend the PowerShell Summit

powershellorg-logo As you might be aware, registration is open for the PowerShell Summit North America 2015 to be help April 20-22, 2015 on the Microsoft campus in Charlotte, NC. You may be wondering why you should attend or even if you should attend. To begin, take a few minutes to read the Summit 2015 Education brochure.

Then let me add my thoughts on the subject.

First and foremost, if your day job involves PowerShell in any way and you are looking to learn more about PowerShell to do your job better or advance your career, then you should attend this conference. Given Microsoft’s move to larger conferences, finding hardcore PowerShell content is going to get harder and harder. The PowerShell Summit is intentionally small and intense. Sessions are rapid 45 minute presentations on topics that you won’t find covered at other conferences.

The speakers are all active and highly visible members of the PowerShell community. Probably many of the same people you follow on Twitter. Or if they aren’t speaking they will most likely be in attendance. This includes many PowerShell MVPs such as myself, Don Jones, Jim Christoper, Jason Helmick and Richard Siddaway. But wait…there’s more!

In addition, the PowerShell Summit includes presentations from members of the PowerShell team from Microsoft, including Jeffrey Snover. I’m not promising you’ll get an inside peek into anything new, but you will learn more about PowerShell that you ever thought possible. Even better, due to the intimate nature of the conference it is easy to chat with presenters, including members of the product team. In fact, it is encouraged.

I tell attendees that if you have a PowerShell question that doesn’t get answered at the Summit, assuming you ask it, it doesn’t have an answer. This is *the* place to get all of the practical, real-world and ready-to-use PowerShell knowledge you need to keep your boss happy.

Even if you feel you are just getting started with PowerShell, I would still encourage you to attend. There will be plenty of content to get you to the next level. And sometimes it helps to know where you can go with PowerShell, even if you aren’t ready yet.

If you are a seasoned PowerShell veteran, there’s always something new to learn. And access to the Microsoft team is priceless. Jeffrey Snover and the team are genuinely interested in how we are using PowerShell, what isn’t working and what do we still need. Your experience at the conference could help direct the future of PowerShell.

Registration is limited so you don’t want to wait to attend. Follow the registration link on the conference site to get started.

If you’ve attended a past Summit and found it useful, I hope you’ll post your experiences and reasons for attending in the comments. I hope to see you in Charlotte.

Friday Fun Christmas Countdown Prompt

christmaslights It’s that time of year again where PowerShell can make all your wishes come true. Ok, maybe that’s a bit much, but PowerShell is the gift that keeps giving all year long. Again, maybe too much. How about this? Here’s a revised version of my Christmas countdown prompt. I’ve posted this in the past. But some of you are new to PowerShell and may have missed it. Plus I’ve revised it a bit.

In PowerShell you have a built-in function called Prompt. It controls what you see in the console which is usually something like PS C:\>. But you can create your own Prompt function. Here’s my Christmas countdown prompt.

I’ve inserted plenty of comments so you should be able to understand how it works. In a nutshell, the prompt inserts a message that indicates how much time remains before December 25th of the current year. The text also includes some special characters to help embellish it and put you in the holiday mood. Finally, each character is written to the host with a random color. You can see that I used a Switch construct to evaluate the random number with an expression.

This function will work best in the PowerShell console. If you want to try it out you can copy and paste this function into your console session. Your PowerShell session will now look like this:

christmasprompt2014

The prompt will only last for as long as your PowerShell session is running. The next time you start PowerShell you will be back to your original prompt. If you enjoy this, put my Christmas prompt function in your PowerShell profile, but be sure it is called Prompt. When the holidays are over simply comment out the function. Or you could add some logic to your profile.

Ho-Ho-Ho! Have a great weekend.