The issue is the author ruined the output by including formatting commands in the function. This is easily discovered by simply inspecting the output with Get-Member
I’ve corrected the script by removing the calls to Format-Table (alias ft) and you can find it here
gistfile1.txt
<#
.SYNOPSIS
Removes ghost devices from your system
.DESCRIPTION
This script will remove ghost devices from your system. These are devices that are present but have an "InstallState" as false. These devices are typically shown as 'faded'
in Device Manager, when you select "Show hidden and devices" from the view menu. This script has been tested on Windows 2008 R2 SP2 with PowerShell 3.0, 5.1, Server 2012R2
with Powershell 4.0 and Windows 10 Pro with Powershell 5.1. There is no warranty with this script. Please use cautiously as removing devices is a destructive process without
an undo.
This file has been truncated. show original
3 Likes