When working in PowerShell, and especially when scripting, you might want to give the user a choice of actions. For example, you might develop a configuration script that another admin or technician will run. Perhaps one of the steps is to configure networking depending on their location so you want to give the person running…
Thursday Treat – A PowerShell Word Find Game
Now for something completely different but hopefully a little fun. I’m a big fan of word games and puzzles. Tim Bolton has assembled a few PowerShell themed crosswords, which you can find on his blog. I’ve always like word finds so I put together a pretty simple one using 16 common PowerShell cmdlet names. You…
Friday Fun – Get Ranked Object
Earlier this week on Google Plus, Hal Rottenberg posted a PowerShell idea he had. His goal was to identify a group of objects that would be statistically significant. For example, given a collection of files, group the files by size but ranked by size so that you might have a group for the largest files,…
Updating Multi-Valued Active Directory Properties Part 2
A few weeks ago I posted about updating multi-valued attributes in Active Directory. Part 1 covered how to accomplish this in PowerShell using ADSI. In Part 2 I’ll show you how to accomplish this using the free Active Directory cmdlets from Quest Software. As you’ll see, the over all process isn’t that much different. Except…
Friday Fun Is It Today?
I was testing out the PowerShell cmdlets that ship with Backup and Replication from Veeam Software. I was using the cmdlet to return backup jobs and realized I needed a way to only get those objects where the date was today. Because the property was a complete date time object, I couldn’t simply check if…
Friday Fun Drive Usage Console Graph
I think you’ll like this. Normally, I prefer my PowerShell commands to write objects to the pipeline. But there’s nothing wrong with sending output directly to the console, as long as you know that the output is intended only for the screen. What I find frustrating is the use of Write-Host when really, pipelined objects…
Updating Multi-Valued Active Directory Properties Part 1
Yesterday on Twitter, I got a tweet from @Docsmooth regarding how to update a multivalued property in Active Directory. There are a number of ways to handle this, especially from PowerShell naturally, so I tweeted one way in a series of tweets. But that’s a hard way to learn something, and anyone jumping in the…
Background Performance Counters
Windows Powershell makes it relatively easy to collect performance counter information via the Get-Counter cmdlet. Because I’m assuming you want to collect more than a few seconds of performance information, you’ll need to take advantage of PowerShell background jobs if you want your prompt back. Of course, you can always open a second session, but…
Add WhatIf Support to Your PowerShell Scripts
In one of my recent articles for SMB IT, I included a PowerShell module. In the article I referenced that I included support for -Whatif in one of the functions. I was asked on Twitter to explain what I meant and how it works. So here goes.
New Petri Author
New Petri Author I trust many of you are familiar with the Petri web site. This has long been a very valuable site for IT Pros. You can always find a wealth of reliable and practical information. Starting in December, I will be adding my voice to the mix. I will be contributing content that…
Friday Fun – A Christmas Prompt
Over the last few weeks I’ve read about other people’s PowerShell prompts and offered a few suggestions of my own. This week’s Friday Fun creates colorful holiday prompt that counts down the number of days until Christmas.
Test-Subnet WinForm
Recently, I posted an entry on how to ping an IP subnet with PowerShell. Using objects in the PowerShell pipeline is a good thing. But sometimes we want a GUI and I figured the ping subnet script would make a good WinForm script.
Friday Fun – Get Number Object
You most likely know that I’m all about the object and the PowerShell pipeline. Everything in PowerShell is an object. Pipe something to Get-Member and you can discover all of the object’s properties and methods (ie its members). Some objects, like strings, have many methods but very few properties. Some objects, like numbers have very…
Finding Files in the Path – A Pipeline Perk
I’ve been chipping in on a forum post about finding if a given file exists in any folder within the system environmental %PATH% variable using Windows PowerShell. There are several ways you might approach this. But the best way in my opinion is to leverage the PowerShell pipeline. Perhaps you don’t really need the solution…