Recently I shared a replacement function I wrote for Test-WSMan. That version addressed some of the shortcomings in the original command, at least for me. After using it for a bit I realized I wanted a few additional changes so I now have version 2. The new version now supports multiple computer names. I also…
Tag: Function
Friday Fun: A Better Test-WsMan
I saw a question on Facebook about how to get Test-WsMan to return a simple Boolean result. The Test-Connection cmdlet has a -Quiet parameter that makes this possible. But Test-Wsman does not. Certainly, you could script a comparable outcome. Here’s one way:
Finding Git Repositories with PowerShell
As part of my ongoing improvement process this year I am starting to use Git much more. Yesterday I posted an article with my PowerShell script to create a new project folder which includes creating a Git repository. My challenge has been that I don’t always remember what I have set up with Git and…
Managing PowerShell Functions
Most of you probably know I’ve been using PowerShell since its beta days which now means I have about 10 years worth of PowerShell files. I find it hard to throw anything away. Over this time frame my PowerShell profile scripts have also grown, often loading functions that I’ve come up with. The effect has …
A Better PowerShell More
In PowerShell, when I have a lot of output, I can use the legacy more.com command to page the results to the screen. Get-Process | more There’s not anything inherently wrong with this approach. Although one drawback is that it doesn’t work in the PowerShell ISE. For that reason alone I decided I needed a…
Friday Fun: Size Me Up
Part of day job involves creating training material, often in the form of video training for Pluralsight or articles for Petri.com. Since I usually am covering PowerShell I often need to capture a PowerShell session. And sometimes I want the screen to be a particular size. So over time I’ve created a few PowerShell tools…
Baby, It’s Cold Outside
I don’t know about your neck of the woods, but it is downright Arctic here. So I thought I’d polish up my PowerShell function to get weather data. #requires -version 3.0 Function Get-MyWeather { <# .Synopsis Get the weather for a US zip code .Description This command will query the Yahoo weather service and return…
Using Optimized Text Files in PowerShell
If you are like many IT Pros that I know, you often rely on text files in your PowerShell work. How many times have you used a text file of computernames with Get-Content and then piped to other PowerShell commands only to have errors. Text files are convenient, but often messy. Your text file might…
Look at Me!
Last week I posted some ideas on how to add notifications to your scripts. Those ideas were variations on the old school “Press any key to continue” prompt that I assume many of you are familiar with. Most of those concepts should work for you, but they assume you looking at the PowerShell window. I…
Pimp your Prompt
If you are like me and live in PowerShell, then you spend a great deal of your day looking at your PowerShell prompt. That little indicator in the console and ISE that usually shows where you are. That little part of your PowerShell world is defined by a built-in function called Prompt. You can easily…
Friday Fun: A Random PowerShell Console
This week I thought we’d have a little fun with the PowerShell console and maybe pick up a few scripting techniques along the way. Today I have a function that changes the foreground and background colors of your PowerShell console to random values. But because you might want to go back to your original settings…
Friday Fun: A Christmas Present for You
Over the years a number of people in the PowerShell community have shared Christmas and holiday related items. I’ve collected them and in some cases tweaked a little bit. This year I decided to wrap them all up in a module for you. This will work in PowerShell 2.0 and later. #requires -version 2.0 <#…
PowerShell Clean Up Tools
A few years ago I think I posted some PowerShell clean up tools. These were functions designed to help clear out old files, especially for folders like TEMP. Recently I decided to upgrade them to at least PowerShell 3.0 to take advantage of v3 cmdlets and features. I use these periodically to clean out my…
More PowerShell Trace Window Fun
On my last Friday Fun, I posted an article about using Internet Explorer as a trace window. The idea was to put debug or trace messages in a separate application. I received a comment on the post that suggested I could do a similar thing using the Debug View utility from Sysinternals. This application is…
A Better PowerShell Get Scheduled Job Results
Yesterday I posted a quick update on my code to get the most recent scheduled job result in PowerShell. I had been using a simple script. But the more I thought about it, the more I realized I really did need to turn it into a function with more flexibility. When creating a PowerShell based…