I am trying to suppress the output of a command so I was piping it to ‘Out-Null’ but I lose the object by doing this so the variable I assign the command to is null.
If I run the above then $dstSite is null. Can I allow the object to still exist (and be assigned to $dstSite) but just not show output, I have also tried > $null but I guess this does the same thing and actually deletes the return value altogether.
Thanks for the replies, I guess it does not behave like a typical Microsoft cmdlet. I will also try piping to Tee-Object and specifying an output file as that looks promising.