Save Powershell-console output to text file
Sometime it's very difficult to find error in Powershell script, especially if script is running in some dedicated session, for example, under SYSTEM account. There will be errors but you'll never know about them.
That's why I started to search a way to log output from Powershell-console to file. Here is the solution.
$( <some commands> ) *>&1 > "C:\out.log"
$( . "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-PowerCLIEnvironment.ps1" ) *>&1 > "C:\out.log"
Of course, you can place as many command as you want between brackets.
- Hits: 14945