Wednesday, July 22, 2015

Powershell Script - Get-ServerHDDinfo - Remotely pull hdd size info quickly

I wrote two versions of this function for different scenarios.  The first version is much faster but requires PS remoting enabled on all target servers.  the second version will work with any server with remote WMI enabled which means it will support older 2003 servers much more easily.

The core of the functions is the same: pull the Win32_Volume WMI class and build a report from hdd information.  The first function remotely executes a script block which builds it's own report and then sends it back to the calling computer, while the second version calls each computer's WMI directly and builds one report for all servers.  Even with Get-WmiObject's ability to query multiple servers at once, it still can't match the speed of Invoke-Command, which leverages the faster CIM framework.


Version 1 - Much faster Invoke-Command Version


Version 2 - Slower WMI

No comments: