I received a lot of feedback and interest in my ConvertTo-Hashtable function. One question I received was “Why?” Well, one reason might be that you want to combine two objects into a single object. Joining them as two hashtables makes this an easier process. First off, combining two hashtables is as simple as adding them…
Tag: Scripting
Rename Hashtable Key
I use hashtables quite a bit. Often generating hashtables on the fly from other sources. But sometimes the hashtable keys that come from these external sources don’t align with what I intend to do with the hashtable. For example, one of the nifty things you can do with hashtables is splat them against a cmdlet…
PowerShell Graphing with Out-Gridview
I’ve received a lot of interest for my last few posts on graphing with the PowerShell console. But I decided I could add one more feature. Technically it might have made more sense to turn this into a separate function, but I decided to simply modify the last version of Out-ConsoleGraph. The new version adds…
PowerShell Console Graphing Revised
Many of you have been having fun with my PowerShell Console Graphing tool I posted the other day. But I felt the need to make one more major tweak. I wanted to have the option for conditional formatting. That is, display graphed entries with high values in one color, medium in another and low in…
PowerShell Screen Shots
Yesterday I posted a tool that creates a console-based graph. That command uses Write-Host which means nothing is sent to the pipeline. The only way you can really save the result is with a screen capture. Of course, you can manually use whatever screen capture program you like. If you have something like Snagit you…
Friday Fun: Edit Recent File
As you might imagine I work on a lot of PowerShell projects at the same time. Sometimes I’ll start something at the beginning of the week and then need to come back to it at the end of the week. The problem is that I can’t always remembered what I called the file. So I…
Friday Fun: Job Announcer
Last week I came across some people having fun with the SAPI.SPVoice COM object. This is the object that lets your computer “speak”. If you’ve never played with this, it is very simple to do in PowerShell. The voice quality in Windows 7 and 8 is quite nice, as far as synthetic voices go. $v…
Friday Fun – Get Happy Holiday
Today’s Friday Fun is my version of a script originally posted a few years ago by The PowerShell Guy. I’ll list the code but you really need to run it to enjoy it. #requires -version 2.0 #This must be run from the PowerShell console. NOT in the ISE. #this is based on a script originally…
Create PowerShell Scripts with a Single Command
One of the drawbacks to using a PowerShell script or function is that you have to write it. For many IT Pros, especially those new to PowerShell, it can be difficult to know where to start. I think more people would write their own tools if there was an easy way to automatically write them….
Copy and Mount a CD with PowerCLI
The other day I realized I needed to rebuild my SQL Server 2012 installation which I’m running on a virtual machine running on an ESX box. Given that I have PowerCLI and I like to do things from the command prompt when I can, I decided to mount the SQL Server 2012 ISO on the…
Friday Fun: A GridView Drive Report
I’ve been experimenting with different techniques to work with PowerShell in graphical ways, but without resorting to complex solutions such as WinForms or ShowUI. For today’s Friday Fun I have a little script that presents a drive usage report using WMI and Out-GridView. As always, my goal with these articles is to impart a nugget…
Variable Validation
In PowerShell v3 there is a new feature you might not be aware of that could save you pain and headaches. This is something you could use in scripting as well as the console. In fact, I think using it in the console is an especially smart idea. In PowerShell v2 scripts and functions we…
Friday Fun – Test PowerShell Command Name
Earlier this week I exchanged a few tweets with @jonhtyler about coming up with a proper name for a PowerShell function he was developing. The suggested best practice is to use the Verb-Noun naming convention, using an accepted verb. You can see the verbs with the Get-Verb cmdlet. So I figured why not automate this…
Hyper-V VHD Summary
When I made the move to Windows 8, one of my tasks was to migrate my test environment from VirtualBox to Hyper-V. Windows 8 includes a client Hyper-V feature that is easy to use and includes PowerShell support. Plus I needed to expand my Hyper-V skills anyway, especially from the console. After setting up a…
Counting Users by OU with PowerShell
I’ve been following a discussion thread in the PowerShell forum at ScriptingAnswers.com. The post is about counting the number of users in an OU. Well that sounds like fun. We got him started using the Quest AD cmdlets. I thought I’d share some of the code I posted. The test code he is posting is…