Leveraging expression blocks within a hashtable for the "Parameters" switch fails


isq "select @d" -Parameters @{d=(get-date)}

gives you this error:

No mapping exists from object type System.Management.Automation.PSObject to a known managed provider native type.
Closed Jun 26, 2015 at 3:44 PM by Robet Martin


wrote Jun 26, 2015 at 3:44 PM

This has been fixed in  We added coded to loop through each key in the Parameters Hashtable.  We checked to see if the value for the key was of type PSObject.  If it was, we replaced the existing value with the value.baseObject.

So for cases where an element in the hashtable was being constructed through a Powershell expression, for instance (get-date), Powershell wraps the value in PSobject, by returning the baseObject we avoid the error.

wrote Jun 26, 2015 at 3:45 PM

Associated with changeset 41629: Fixed 1585, issue with parameter switch.