error when running import

Feb 24, 2016 at 12:42 PM
Cannot convert argument "type", with value: "System.Drawing.Color", for "Add" to type "System.Type": "Cannot convert the "System.Drawing.Color" value of type "System.String" to type
"System.Type"."
At C:\Users\user\Documents\WindowsPowerShell\Modules\SLPSLIB\SLPSLib.psm1:3 char:1
  • $typeAcceleratorsType::Add('Color',"System.Drawing.Color")
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : NotSpecified: (:) [], MethodException
    • FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument
Jan 29 at 10:25 AM
Edited Jan 29 at 11:23 AM
It seems [System.Drawing.Color] exists in Powershell_ise.exe by default, but not in powershell.exe.

In the .psm1 file, put "Add-Type -Assembly System.Drawing" at the top.

In addition, it seems you have to cd into the module directory, for it to find the .dll files - alternatively, put the module in a "Modules" folder that is within a directory in your PATH variable.