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…
Tag: WMI
Get IP Addresses with PowerShell
In celebration of World IPv6 Day, I thought I’d post a little PowerShell code to return IP addresses for a computer. This information is stored in WMI with the Win32_NetworkAdapterConfiguration class. This class will return information about a number of virtual adapters as well so I find it easier to filter on the IPEnabled property….
Query Local Administrators with WMI
I have a quick post today on using WMI to list members of the local administrators group. It is very simple to get the group itself with the Win32_Group class. PS S:\> get-wmiobject win32_group -filter “name=’Administrators'” Caption Domain Name SID ——- —— —- — SERENITY\Adminis… SERENITY Administrators S-1-5-32-544 But the class doesn’t have any methods…
Skipping WMI System Properties in PowerShell
One of my favorite techniques when using WMI in PowerShell is to pipe an object to Select-Object and select all properties. Try this: get-wmiobject win32_bios | select * It works, but it also gets all of the system properties like __PATH which I rarely care about. I also get other properties like Site and Options…
Friday Fun: 13 More Scriptblocks
In celebration of Friday the 13th I thought I would offer up a menu of 13 more script blocks. If you missed the first course, you can find the original 13 scrptblocks here. I’m not going to spend a lot of time going over these. Many of them are simple one liners. Some of them…
Scripting with PSCredential
I see this question often: how can I pass a parameter value for a PSCredential that might be a credential object or it might be a user name? In the past I’ve used code like this: begin { Write-Verbose -Message “Starting $($myinvocation.mycommand)” write-verbose -Message “Using volume $($volume.toUpper())” #convert credential to a PSCredential if a string…
Friday Fun: Get Next Available Drive Letter
A few days ago I saw on question, I think on Facebook, about using PowerShell to find the next available drive letter that could be used for mapping a network drive. Before I show you my approach, let me state that if you need to map a drive in PowerShell for use only within your…
Create HTML Bar Charts from PowerShell
I saw a very nice mention on Twitter today where someone had taken an idea of mine and created something practical and in production. It is always nice to hear. The inspiring article was something I worked up that showed using the PowerShell console as a graphing tool. Of course someone immediately wanted to know…
Morning Report Revised
Last month I posted a PowerShell script I called The Morning Report. I received some very nice feedback. One comment was about making it easier to use the script in a pipelined expression. For example, get a list of computers from a text file and create a single HTML report. That sounds reasonable to me…
The PowerShell Morning Report
I love how easy it is to manage computers with Windows PowerShell. It is a great reporting tool, but often I find people getting locked into one approach. I’m a big believer in flexibility and re-use and using objects in the pipeline wherever I can. So I put together a PowerShell script that I can…
WMI PowerShell Tricks for Windows Server…
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.
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…
Filter Left
When writing WMI queries expressions in Windows PowerShell, it is recommended to use WMI filtering, as opposed to getting objects and then filtering with Where-Object. I see expressions like this quite often: [cc lang=”PowerShell”] get-wmiobject win32_process -computer $c | where {$_.name -eq “notepad.exe”} [/cc] In this situation, ALL process objects are retrieved and THEN filtered….
Compress Files By Extension
I never seem to build my test virtual machines with enough disk space. Which means at some point I start dealing with space issues and resort to all sorts of hacks to buy myself a little time. One thing I do is look for files that I can compact using NTFS compression. For examples text…
Get Process Owner
I’ve been working on my second training course for Train Signal on managing Windows Server 2008 with Windows PowerShell, specifically the lesson on managing processes. I thought I’d share a little tidbit I worked out. In fact, I hope you’ll stay tuned for other little goodies over the next several weeks. The training video will…