Issues when trying to use Powershell script

Dec 12, 2013 at 9:42 PM
Not sure if anyone is actively watching this anymore, but I'm trying to use a powershell script to interact with the Dream Cheeky LED notifier and am having problems.

When I use the DreamCheekyLED.exe via command line it works fine - no problems at all. However, when I try to test the included powershell script I have problems.

When I run the script (after editing it to reflect the location of DreamCheekyLED.exe) I get the following errors:
New-Object : Exception calling ".ctor" with "1" argument(s): "Cannot find USB HID Device with 
DevicePath=\\?\hid#vid_1d34&pid_0004#6&1067c3dc&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"
At C:\Users\Rob\Desktop\DreamCheekyLED\DreamCheekyLED.ps1:22 char:9
+     $led = New-Object -TypeName DreamCheekyUSB.DreamCheekyLED (,$argArray)
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
 
You cannot call a method on a null-valued expression.
At C:\Users\Rob\Desktop\DreamCheekyLED\DreamCheekyLED.ps1:29 char:1
+ $led.TestBlink();
+ ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
You cannot call a method on a null-valued expression.
At C:\Users\Rob\Desktop\DreamCheekyLED\DreamCheekyLED.ps1:40 char:1
+ $led.Off()
+ ~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
So I tried working backwards and uncommented this line:
[HidLibrary.HidDevices]::Enumerate() | where { $_.Attributes.VendorHexId -eq "0x1D34" }| ft isConnected,isOpen,Description -AutoSize
and tracked down the problem. I get "IsConnected=True" and "IsOpen=False". I'm not sure what is causing this because as I mentioned, the exe works fine from the command line. I've tried it in Powershell (3.0) and Powershell ISE (3.0) - same problem.

I'm not a programmer so checking out the source code of the exe isn't an option for me. Does anyone have any suggestions or workaroundsarounds for this problem?

Thanks!