title: Powershell: Update CSV at logon
body: <p>I have a script that runs at logon that is implemented through group policies. This script scans for a particular file type and then passes that to a remove-item cmdlet. Once this is done the script should then be going to a network stored CSV and add a new row containing the computername and username of the currently running session. The problem here is that the search and destroy portion works great but the script never updates the CSV. The CSV has been setup with full control to everyone.</p>
  
  <pre><code>Get-ChildItem -Path c:\ -Filter *.pst -force -Recurse -ErrorAction SilentlyContinue | Remove-Item –Force -ErrorAction SilentlyContinue
  
  $Path = "\\corp-fs\Public\Alfa\Confirmation.csv"
  
  $newLine = "{0},{1}" -f $env:COMPUTERNAME,$env:USERNAME | Add-Content -Path $Path
  </code></pre>
  
  <p>Any advice or help with this would be greatly appreciated.</p>