Whenever I teach or speak about PowerShell, a recurring mantra is that there is no difference between running a PowerShell script and executing commands interactively in the shell, except that it saves you typing. You can create a PowerShell script by simply copying and pasting commands from the shell into a .PS1 text file. This…
Tag: Scripting
More WMI Dates – Win32Product InstallDate
I’ve written in the past about converting obtuse WMI datetime formats into more user friendly formats. The other day via Twitter I got a question about the InstallDate property that comes from the Win32_Product class. This property has a different format, than what I’ve written about previously. And while I think the format is easy…
Convert to Title Case
After a long holiday break, some travel and a few training classes its time to get back in the swing of things. Today I have a relatively simple function, that if nothing else demonstrates how to use object methods. The challenge is to take a string of text and convert it into title case; so…
Join Me in Orlando
I will be presenting 3 sessions at Techmentor Orlando 2011. The conference runs March 14-18, 2011 at the Disney Yacht Club. My sessions are all on Wednesday March 16. In addition to all the other fabulous material at the conference I will be presenting the following:
Out-CompressedFile
I’m not sure where this idea came from, but I thought it might be nice to redirect output to a compressed text file. I know disk space is cheap these days but perhaps you’re running PowerShell 2.0 on an older platform and you want to save output from a command that will generate a ton…
Friday Fun Quote of the Day
For this week’s Friday Fun post, I have another idea on how to brighten your PowerShell console. The concept of a message of the day or quote of the day in computing goes way back to the dark ages (ie before PowerShell). I thought it might be fun to see what we could do with…
Friday Fun – The Kitchen Sink Prompt
On my last Friday Fun post on PowerShell prompts, I got a terrific comment from Bart Vandyck about his prompt which has just about everything you would want. I too have a “kitchen sink” prompt, that is to say, one with the proverbial “everything but the kitchen sink”. Or you might consider this an extreme…
Friday Fun – More Prompts
Not too long ago I offered up a tasting of PowerShell prompts 3 ways. My first offering were variations on displaying the current date and time. But a PowerShell prompt can do much more. For today’s Friday Fun I present a duo of of calculating prompts.
Export Registry
Over the last week or so I’ve posted some functions for testing whether a given registry item exists or not, or even validating its value. To round this out, today I have an advanced function that makes it easier to export parts of the registry on the local computer.
Test Registry Item Revisited
I got some nice feedback on my original Test-RegistryItem function. I had been mulling some enhancements anyway and now have a more robust version that looks at individual values, accepts pipelined input and more The new version now lets you test if a given registry item exists as well as if the value meets some…
New Event Report
For a number of years I wrote the popular Mr. Roboto column for REDMOND magazine. When I first started the column, many of my scripts were written in VBScript. Then as PowerShell came along that became the preferred tool. Over time I realized there were some VBScripts that could be rewritten and even improved using…
Understanding PowerShell Background Jobs
Last night I spoke to the CNY .NET Developers Group about background jobs in Windows PowerShell. Even though the audience was primarily developers, I discussed jobs from an administrator’s perspective, that is, using cmdlets. The job feature in PowerShell 2.0 is pretty amazing and you don’t need any programming skills.
Friday Fun: Color My World
The end of another work week and time for a little PowerShell fun. When I first started using PowerShell, I was fascinated by Write-Host and the ability to write colorized text to the console. Visions of ANSI art danced in my head, but I’ve moved on. Using colors with Write-Host is a great thing, and…
PowerShell: The Ultimate Ginsu Knife
You don’t have to stay up until the wee hours of the morning looking for an amazing tool that slices and dices like the famed Ginsu Knife. Are you looking for a way to speed up your work? Are you tired of the same old routine? Would you be surprised that your answer is already…
New-PSDriveHere
I spend a lot of time, as you might expect, at a PowerShell prompt. Especially when training, presenting or doing demonstrations. Very often I’m in a folder with a long path like PS C:\users\jeff\Documents\Enterprise Mgmt Webinar. That takes up a lot of screen real estate and can be distracting. What I often will do is…