title: Put the knife down and take a green herb, dude. |
descrip: One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com Using 89% of the same design the blog had in 2001. |
FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white. As an Amazon Associate, I earn from qualifying purchases. Affiliate links in green. |
|
Friday, December 12, 2014 | |
Sometimes, as Don Jones alludes to in this thread, Powershell gets a little too clever in its attempts to "coerce" variables. In this case, it's the battle between ValueFromPipelineByPropertyName and ValueFromPipeline on a (string?) parameter. I think the quick upshot is that, if you want what's promised by ValueFromPipelineByPropertyName, you need to roll it on your own.
See this, from said Don Jones: Another option is to add an -InputObject parameter that accepts, ByValue, the exact object type being output by your first cmdlet. That way, it should bind without coercion. You'd KNOW you were getting that whole object, so you could grab the appropriate property internally. Make that part of a separate parameter set so that folks can do one or the other, but not both. Interesting discussion at that thread over whether the coercion is a bug (apparently not) and if that intended behavior is a good idea (not necessarily). Labels: powershell posted by ruffin at 12/12/2014 09:17:00 AM |
|
| |
MarkUpDown is the best Markdown editor for professionals on Windows 10. It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support. Features you won't find anywhere else include...
You've wasted more than $15 of your time looking for a great Markdown editor. Stop looking. MarkUpDown is the app you're looking for. Learn more or head over to the 'Store now! |
![]() |
|
|