Last week, a PowerShell scripting challenge was posted on the Iron Scripter web site. The idea was that when you run a Pester test, you can save the results to a specially formatted XML file. Invoke-Pester C:\scripts\sample.test.ps1 -OutputFile d:\temp\results.xml -OutputFormat JUnitXml I get this result. The challenge was to write a PowerShell command that could…
Tag: xml
Converting Lexical Timespans with PowerShell
I’ve been working on a few scripting projects and the data I’m working with contains lexical timespans. Say what? You have probably seen these things. This is a string like P0DT0H0M47S to represents a timespan. They aren’t difficult for humans to read. This one says “0 days 0 hours 0 minutes 47 seconds”. The format…
Updating Open Live Writer Auto Links with PowerShell
I’m sure it comes as no surprise to you that I do a fair bit of blogging and writing. This means I am always on the look out for tools and tricks to make the process easier. Recently Scott Hanselmen and others announced a resurrection of the old Microsoft Live Writer tool into an open…
Where Did the Time Go?
Like many of you the work day just seems to fly by. At the end of the day I start wondering what I really got accomplished and what I actually did all day. Well if you are willing to face the truth I have a way to help. Last year I wrote about a PowerShell…
Friday Fun: Open Last File in the PowerShell ISE
Over the last few articles I’ve been sharing some shortcuts to get most recently used or edited files. For today’s Friday Fun I thought I’d share something that I use in my PowerShell ISE profile. Whenever I start the ISE, I automatically open the last file I was working on. Instead of launching the ISE…
A PowerShell Weather Service
I’ve been having some fun this week sharing a few tools for getting weather information and forecasts using PowerShell. To complete the story, today I have one more technique. Using PowerShell, you can query a web service for weather information. In simple terms a web service is like an application you can “run” via a…
Getting the Weather Where On Earth
Yesterday I posted a popular article about using Invoke-WebRequest to get weather conditions. That function used the Yahoo web site but really only worked for US cities. So I also cleaned up and revised another set of advanced PowerShell functions (required PowerShell 3) that can retrieve weather information for probably any location on Earth. The…
Friday Fun: I’m with the band.
I like to have fun with PowerShell, as is hopefully evident with this Friday Fun serious, and today that is especially true. Perhaps you need a quick break from the end of the week grind. Or maybe you want to learn something new about PowerShell. Hopefully today’s fun will meet both requirements. Today’s fun will…
Find and Replace Text with PowerShell
I’ve just finished up a series of tweets with a follower who had a question about finding and replacing a bit of data in a text file. In his case it was a web.config file but it really could be any text file that you can view in PowerShell. In PowerShell 3.0 and later this…
Get PowerShell View Definitions
When you write objects to the pipeline in Windows PowerShell, at the end of the pipeline PowerShell’s formatting system handles displaying the results to the console. It accomplishes this by using a set of rules stored in XML configuration files. This is why when you run Get-Process you get a table with a pre-defined set…
Creating ACL Reports
I saw a tweet this morning that was a PowerShell one-liner for capturing folder permissions to a text file. There’s nothing wrong with it but it’s hard to be truly productive in 140 characters so I thought I would take the idea and run with it a little bit. Here are some ways you might…
Get GPO Backup
The GroupPolicy module from Microsoft offers a great deal of functionality from a command line. In terms of regular maintenance or administration it is pretty hard to beat, especially if you have 100s or 1000s of GPOs. When you have such a large number, backing them up is critical and easy to accomplish with the…
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…
PowerShell Weather Module
I first wrote a Windows PowerShell function several years ago to retrieve weather information via Yahoo’s weather service. I’ve been itching to rewrite it and finally found some time over the weekend. Turns out it’s a good thing I did because the method I had been using to query the Yahoo web service has been…