I have to create/maintain a lot of batch processes that are the glue for keeping diverse systems working together. I currently use lots of different tools to get things done and I'm looking to PowerShell to help me simplify what I do.
One thing that I do is make small specific purpose scripts and programs that read and write using stdio. I have been able to configure powershell so that when run from cmd.exe or a batch file to redirect it's output. I can use things like this from cmd.exe:
.\GrabSomeData.ps1 | more
.\GrabSomeData.ps1 >saveforlater.txt
It seems that I should be able to do these things from the Powershell console, but I can't.
.\GrabSomeData.ps1 >saveforlater.txt
when the above is run from PowerShell, it displays the output to the screen. Some output will be redirected (ie. measure-command) but the output I care about doesn't get redirected. I'm even using $host.UI.WriteLine and it doesn't get redirected from the PowerShell console.
I like to redirect using stdio because it gives flexibility. If I create small useful things, I can then rearrange them and put them back together easily in a batch file, script, or command line without having to rewrite them.
Bruce