Category Archives: Scripting

The CIM-ple way with PowerShell and Event Logs

I’m always on the lookout for new ways to do things. Often I’m trying to find a way to create something that is easy to use without requiring a lot of PowerShell scripting.  I also like using the final result as teaching aids so even if you don’t need the end product, I hope you’ll pick up a trick or two that you can use in your own scripting projects. The task I had in mind today is a better way to get event log information. Not the events themselves, but rather the event log file. How many entries are in it? How big is it? How much of the configured log is being used? Here’s what I came up with.

Continue reading The CIM-ple way with PowerShell and Event Logs

PowerShell Sessions and VS Code

If you do any amount of PowerShell scripting you have most likely heard about Visual Studio Code. This is a free cross-platform light-weight editor from Microsoft. VS Code supports multiple languages and is extensible. I’ve tried different versions since it was first released but never found a reason to jump from the PowerShell ISE. For my purposes the ISE works just fine plus I’ve customized it so much that it would be hard to abandon. But there is a new version of VS Code that is at least making it more tempting.

Continue reading PowerShell Sessions and VS Code

More Improvements to my Test-WSMan Replacement

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 replaced the ProductVersion property with separate properties for the OS, Service Pack and Stack numbers. Continue reading More Improvements to my Test-WSMan Replacement

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: Continue reading Friday Fun: A Better Test-WsMan

Memory Reporting with PowerShell

I’ve started a new project and I’m hoping a few of you will give it a spin and let me know how it works for you. I’ve created a PowerShell module called MemoryTools that uses a few WMI classes and performance counters to provide insight into memory utilization and configuration on your servers. The module has several commands including one that skips the pipeline (exception to the rule!) and uses Write-Host to display memory status in living color.

show-memoryusage

The project is up on GitHub at https://github.com/jdhitsolutions/MemoryTools if you’d like to give it a try. The Readme file should give you a overview of what to expect. Use GitHub to report any bugs or feature requests. I know I still need to add command help.

The module should work on any computer running v3 or later. Note that the Get-PhysicalMemory command, which queries the Win32_PhysicalMemory class, may not show results for some properties. There are a few new class properties that require Windows Server 2016 but I decided to include them anyway.

I look forward to hearing about your experiences.