WMI PowerShell Tricks for Windows Server Management* My first article for @petri_co_il on WMI PowerShell Tricks http://bit.ly/rx1YrD Get-WMIObject – PowerShell Tricks Windows Server Management Get-WMIObject in Windows Powershell makes it easier to utilize Windows Management Instrumentation (WMI) and makes managing windows servers much easier.
Domain Controller PowerShell Prompt
The other day I passed on a tweet I came across about creating a PowerShell prompt that displayed the domain controller that authenticated you. The original post was in a NetApp forum. Later I realized what was posted was something specific to NetApp’s PowerShell Toolkit. But you can use the same idea in a regular…
Turning IPConfig DNSCache into PowerShell
Lately I’ve been writing about techniques to turn command line tools into PowerShell tools. Although I suppose the more accurate description is turning command line output into PowerShell pipelined output. The goal is to run a command line tool and write objects to the PowerShell pipeline so I can do other operations with them. Today…
Friday Fun Perf Counters with Write-Progress
While working on my course for TrainSignal on managing Windows Servers with PowerShell, I came up with an interesting use of the Write-Progress cmdlet. I was working on the performance monitoring lesson and realized I could use Write-Progress as rudimentary graphing tool. The cmdlet has a parameter that lets you specify a value that shows…
ForEach or ForEach-Object
I came across a post the other day that explained differences when using the ForEach enumerator and the ForEach-Object cmdlet. They both essentially do the same thing but as the post mentions there are potential performance differences. One other difference I want to highlight is that the ForEach enumerator doesn’t write to the pipeline at…
Ping IP Range
Last week I came across a post on using PowerShell, or more specifically a .NET Framework class, to ping a range of computers in an IP subnet. The original post by Thomas Maurer is here. I added a comment. And after looking at this again I decided to take the ball and run with it…
Running Remote Processes Here is a video…
Running Remote Processes Here is a video clip from my upcoming course for TrainSIgnal, "Windows Server 2008 PowerShell Training". This clip shows how to work with processes on remote computers.
Export Registry Printer Information I came…
Export Registry Printer Information I came across this post http://www.oncallpros.com/2011/11/02/powershell-export-your-print-configuration-from-registry/ on exporting printer information from the registry in PowerShell. I wanted to offer some constructive suggestions but could find no way to comment so I'll do so here. First, the article introduces some good PowerShell concepts. I like that he is using Test-Path. Although I'd…
My video interview with PowerShell Magazine…
My video interview with PowerShell Magazine about the state and future of PowerShell. Recorded during the PowerShell Deep Dive in Frankfurt. http://www.powershellmagazine.com/2011/11/02/an-interview-with-powershell-expert-jeff-hicks/
ISE Scripting Geek Module
Over the last year I’ve posted functions I’ve written to extend the Windows PowerShell ISE. I have finally pulled everything together into a module I’m calling the ISE Scripting Geek. Download and extract the zip file (below) to your modules folder. You should end up with a path like ‘C:\Users\Jeff\Documents\WindowsPowerShell\Modules\ISEScriptingGeek’. In the ISE, import the…
Simple Where Filters
The comment about how awkward it is in PowerShell to filter out folders with Get-ChidlItem, or its alias dir, came up the other day on Twitter. I’ll be the first to admit that running a DIR command and wanting to skip folders, or perhaps you only want top level folders, is more cumbersome than we…
Convert Text to Object
Today I have another tool in my new battle regarding turning command line tools into PowerShell tools. The bottom line is we want to have objects written to the pipeline. At the PowerShell Deep Dive in Frankfurt there was a suggestion about providing tools to help with the transformation from CLI to PowerShell and this…
Re-Use PowerShell Scriptblocks
//Re-Use PowerShell Scriptblocks// I commented on a blog post today that showed how to use a hash table with Select-Object to format file sizes say as KB. dir $env:temp -rec | select fullname,@{Name="KB";Expression={$_.length/1kb}} Since you most likely will want to use something similar for other directories, don't feel you have to re-invent the wheel. Save…
Turning CLI Tools into PowerShell Tools Deep Dive Demos
Last week I did a presentation at the PowerShell Deep Dive in Frankfurt about turning command line tools into PowerShell tools. A video recording should be posted later. But in the meantime, here is a copy of my slide deck, in PDF and a zip file with my demos and scripts. I have some followup…
Friday Fun Convert Object to Hash Table
I’ve been working on a few PowerShell projects recently and one requirement I had was to turn an object into a hash table. I thought this was something that was already handled in PowerShell but I couldn’t find a cmdlet or an easy .NET technique. So I wrote my own function, ConvertTo-Hashtable. The function is…