Goverlan Reach: Systems Management Simplified

Full Disclosure: This is a sponsored post from a valued partner, Goverlan. All content is my own and the only input Goverlan has had to this article is to clarify technical inaccuracies and a minor comment on the user interface. As a PowerShell developer, I’ve been in the business of creating PowerShell scripts to manage systems for years. I’ve built remote systems management scripts and modules to do just about everything you can think of. It’s what I make my living doing. Although the payoff feels great when I’m done with a script, the time required to write up some level of automation for a task can be intense. Writing PowerShell scripts to query WMI across hundreds of machines, running reports or to making enterprise-wide changes can be hectic. Most IT professionals are on the boat I was just a few years ago – wearing lots of hats, extinguishing fires, […]

Read more

How to Find Monitor Size for a Local or Remote PC

Here’s a pretty cool script that will get you the monitor size for a local or remote device via WMI. If will work with both single monitor devices as well as multiple monitors.

$output = [PSCustomObject]@{ComputerName = $ComputerName;MonitorSizes=”} $oWmi = Get-WmiObject -Namespace ‘root\wmi’ -ComputerName $ComputerName -Query “SELECT MaxHorizontalImageSize,MaxVerticalImageSize FROM WmiMonitorBasicDisplayParams”; $sizes = @(); if ($oWmi.Count -gt 1) { foreach ($i in $oWmi) { $x = [System.Math]::Pow($i.MaxHorizontalImageSize/2.54,2) $y = [System.Math]::Pow($i.MaxVerticalImageSize/2.54,2) $sizes += [System.Math]::Round([System.Math]::Sqrt($x + $y),0) }##endforeach } else { $x = [System.Math]::Pow($oWmi.MaxHorizontalImageSize/2.54,2) $y = [System.Math]::Pow($oWmi.MaxVerticalImageSize/2.54,2) $sizes += [System.Math]::Round([System.Math]::Sqrt($x + $y),0) }##endif $output.MonitorSizes = $sizes $output

Read more

WOL via Powershell Without Bothering the Network Guys

WOL via Powershell I love Powershell and I’m sure a lot of you do too. I geek out over nearly every script I create but there are some that I get as giddy as a schoolgirl over; this is one of them. I work at a client’s site that has hundreds of IP networks and with network admins that don’t want to open up multicasting. I’ve attempted to mess with WOL unicast but I just couldn’t ever get it working so I decided to figure out how to get this to work via Powershell. If you’re familiar with WOL, you’ll know that the WOL magic packet is not routable. It either has to be subnet-directed out which a lot of network admins won’t allow or sent from a device on the same logical network as the device you’re wanting to wake up. You end up only being able to wake […]

Read more

Powershell: Search all Event Logs Within a Specific Timeframe

There are times when I’m asked to help troubleshoot some random, obscure problem that only occurs on the third Tuesday of every other month. No one can figure it out and no one has a clue what’s going on. The only thing they know is that it happened at some certain time. One of the first activities any good admin does is check the logs at that time. What went on? What went wrong? Here’s how I do that with Powershell. This is a script to find all events in all event logs on a Windows Computer that are within between two times. This is one I’ve used numerous times.

Read more

Find Out How To Get Idle Time from a Group of PCs

The time comes when a manager walks into your office and says “We’re tightening the belt this year. One way we’re looking to save money is to remove unused PCs from 1 area and move it into another area. Give me a list of all PCs that haven’t been used in X days.” You agree to do it without thinking as usual and think no big deal. After a few minutes of looking into it you then think “…ummm, what really does “unused” mean anyway?” Does “unused” mean users aren’t working on it and just use it as a Facebook machine? Does “unused” mean X application isn’t being executed on it or does it simply mean no keyboard or mouse activity at all? After you grill the manager a little bit you find out that he wants all PCs that haven’t had any kind of keyboard or mouse activity for […]

Read more

Use Powershell to Append Data to an Excel Spreadsheet

As you learned in my previous post my client has a change management process. It includes filling in forms in a PDF and appending a row to an Excel spreadsheet. Here’s the code I’ve used to append to the spreadsheet. This was pretty straightforward other than finding the first row to add to and stopping the Excel process. This spreadsheet has a border around all the cells. The Excel COM object treats this as being “in use”. This means you’ve got to get the value of the cell “in use”. If it’s $null, then I know there’s no text in it. When I went to close the COM object, excel.exe would never stop. This is why you see three different ways of killing it off; the Quit() method, releasing the COM object and finally I just kill the process completely.

Read more

You Can Use Powershell to Fill Forms in a PDF

Whenever I first started using Powershell, I thought it’d only be used for IT admin stuff. I was expecting it to manage Windows services, start/stop computers, add users to Active Directory, etc. I didn’t even fathom doing other routine tasks like filling in PDF forms. It just goes to show you expect the unexpected with Powershell. Here’s a script I created to automate making a change request in my client’s environment. They have a pretty rudimentary process that entails filling out a PDF and then adding a row in an Excel spreadsheet. I wanted a single place to do both of these tasks so I decided to write a quick script. This is the piece of the script that fills in the PDF fields. I could never have even attempted this if it weren’t for the iTextSharp PDF library. The library did all the heavy lifting. I was just a […]

Read more