Hi all,

I do Exchange operations with powershell scripting driver (IDM AE and when I do Enable-Mailbox or other Exchange operations I
naturally get the standard output into script-trace.log. I also like to
do logging with idm_trace function which also logs stuff to

But now I was surprised to see that apparently these two have problems
writing to the same file. Sometimes when I do Enable-Mailbox followed by
idm_trace command I get this error:

Exception calling "Open" with "4" argument(s): "The process cannot
access the file 'C:\Program Files\Novell\WSDriver\logs\script-trace.log'
because it is being used by another process."

At C:\Program Files\Novell\WSDriver\scripts\powershell\IDMLib.ps 1:691
+ $fs = [System.IO.File]::Open <<<< ($tracefile,
[System.IO.FileMode]::Append, [System.IO.FileAccess]::Write,

Unless I am forgetting something there should be no other processes
accessing the file than the standard output redirection from the driver
and idm_trace command. Any ideas?


Just in case here is the corresponding function from IDMlib copy-pasted:

function idm_trace

if ($scripttracing) {
$time = Get-Date

if ($tracefile -eq $null -or $tracefile -eq "") {
$tracefile = "logs\script-trace.log"
# create FileStream that shares script log
$fs = [System.IO.File]::Open($tracefile,
[System.IO.FileMode]::Append, [System.IO.FileAccess]::Write,
$sw = New-Object System.IO.StreamWriter $fs
$sw.WriteLine($time.toString() + " " + $message)