![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | One thing to watch for when using assign values via a pipeline What ever is feeding the pipe _must_ always return a valid value for the type being assigned to. I have written a script which is almost ready for submitting to the script center it will allow you to find the members of any type Get-Framework-Help [some type] -typename will work on type literals where Get-Member doesn't. The format it returns is identical to Get-Member (please bare with me I'll get to the point) Here is my pseudo code Build_MemberDefinition { return MemberDefinitions _only_ for what maps to a PSMemberType } < Pipeline expression used to find the type, name, etc> | $description += Build_MemberDefinition $_ *** if ($description -eq $null) { return failure} The line starred is what took several hours to find in part because the failure didn't occur all the time. Even though the starred line evaluated to true; I could dump the contents of $description as well as verify see that the array had a number of element count was > 1 so I knew it wasn't NULL. In the back of my head remembered reading that -eq will enumerate the entire array or collection and TRUE if there is a match but it didn't click. Since I didn't instanciate a class for ctor/event, NULL was returned. Trouble is it's $null is very difficult to see. This is the only way I was able to find it $description | % {if ($_ -eq $null) {echo 'true'}} and this is why $description -eq $null returned true |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Assign a Comment | VB Script | |||
| Assign playback to WMP | Vista music pictures video | |||
| How assign extension to app? | Vista General | |||
| how to assign values to array and how to create array via variable | PowerShell | |||
| Cannot assign drive letter | Vista installation & setup | |||