I am doing some parallel SQL Server 2005 database restores in powershell. The way I have done it is to use cmd.exe and start so that powershell doesn't wait for it to complete. What I need to do is to pipe the output into a log file with append. If I use Add-Content, then powershell waits, which is not what I want.

My code snippet is

```
foreach ($line in $database_list)
{
<snip>
    # Create logins
    sqlcmd.exe -S $instance -E -d master -i $loginsFile -o $logFile

    # Read commands from a temp file and execute them in parallel with sqlcmd.exe
    cmd.exe /c start "Restoring $database" /D"$pwd" sqlcmd.exe -S $instance -E -d master -i $tempSQLFile -t 0 -o $logFile

    [void]$logFiles.Add($logFile)
}

```

The problem is that sqlcmd.exe -o overwrites. I've tried doing this to append:

```
    cmd.exe /c start "Restoring $database" /D"$pwd" sqlcmd.exe -S $instance -E -d master -i $tempSQLFile -t 0 >> $logFile

```

But it doesn't work because the output stays in the SQLCMD window and doesn't go to the file. Any suggestions?

Thanks,
Mark.