So in my last post, I shared a PowerShell script that enables you to enable devices to wake up computers. This script relies solely on a WMI interface, but despite the remote nature of WMI, I had provided no method of entering a remote computer name. That changes with the release of my first ever formal PowerShell module! I’ve taken the code from the “enable device wake” script and adapted it to a PowerShell advanced function. I also added the cmdlet binding attribute to it, which makes it an official script cmdlet.
This command more or less replaces the functionality that powercfg.exe -DeviceEnableWake offers.
It has full support for:
- Script example documentation
- Named and positional parameters
- Supports -WhatIf and -Confirm common parameters
- Configuring remote computers
Here is an example screenshot of the script’s execution. Please let me know if you have any feedback in the comments or at firstname.lastname@example.org! As I said before, this is the first PowerShell module that I’ve shared, and I want to make sure it’s done right!
Running on Multiple Computers
(Updated on 2010-09-28)
So, you might be wondering how you can deploy this to multiple computers. The ComputerName parameter only takes a single computer name, rather than an array. You basically have three options here:
- Run from management workstation: Wrap the Set-DeviceWake function in a foreach loop, and pipe a text file with a bunch of computer names into the ForEach-Object
- Run from management workstation: Wrap the Set-DeviceWake function with Start-Job and a list of computer names
- Run on each PC individually: Deploy the script to target workstations via GPO (if they’re Windows 7), or deploy via systems management software, such as ConfigMgr
I don’t have examples handy just yet, but just thought I’d share this information at least!