troubleshooting Question

powershell pipeline

Avatar of sirbounty
sirbountyFlag for United States of America asked on
Shell ScriptingPowershell
4 Comments1 Solution413 ViewsLast Modified:
I have a script that combines some data and creates an output object on each pass through the results.
I'm attempting to utilize some of the functionality from this out-sql script:

But, it's failing.

In my script, I have a function, Get-Logs, that produces output in the following format:
foreach ($item in $datacollection){ 
            $obj = new-object psobject
            $obj | Add-Member NoteProperty EntryDate $item.startdate
            $obj | Add-Member NoteProperty Username $item.User
           #...etc, etc...
            write-output $obj

I call this function piping it to the out-sql function:
get-logs | out-sql

That results in
out-sql : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and
its properties do not match any of the parameters that take pipeline input.

I've event attempted a simple out-test function that attempts to create the $properties variable.  If I step into this function, $_ and $properties are both empty...  What am I missing?
function out-test {
  $properties = $
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros