I've written a GUI for making changes in AD and I need every action logged. This GUI is used by multiple users at once and writes to one file but only first person that writes to the log file can actually write to it. Everyone else has access denied. I'm using streamwriter like this.
$File = "$LogPath\$LogDate.log"
$stream = [System.IO.StreamWriter] $File
$stream.WriteLine("----------------------------------------------------")
$stream.WriteLine("$LogTime $ExecUser | Set expire date for user $setenddateuser to $usernewenddate")
$stream.close()
What am I doing wrong here that the handle for this file is not released for someone else to use?
Using ACL commands helped to fix the issue as the newly created file was lacking perrmissions for write for other users.