title: Powershell Output to my log location not working
body: <p>I am looking to log the output of my script to a log file. But not able to get the output to a file.</p>
  
  <pre><code>Set-ExecutionPolicy RemoteSigned
  
  $server_names = Get-Content "E:\Bibin\Copy\complist.txt"
  
  $Folder=$((Get-Date).ToString('yyyy-MM-dd'))
  
  $Logfile = "E:\Bibin\Copy\copy.log"
  
  Function LogWrite
  {
     Param ([string]$logstring)
  
     Add-content $Logfile -value $logstring
  }
  
  Foreach ($server in $server_names)
  {
      $FileExists = Test-Path "\\$server\C$\temp\TEST\*"
      If ($FileExists -eq $True)  
      {
          New-Item "\\$server\C$\temp\TEST\$Folder" -type directory 
  
          Move-Item "\\$server\C$\temp\TEST\*" -Destination "\\$server\C$\temp\TEST\$Folder" -force
  
          Copy-Item "\\DC1NAS02P00\data\IT\CPS\Projects\NGNet\CpsServerUpgradeFiles\Upgrade Version 2.0\2003_Files\*.*" -Destination "\\$server\C$\temp\TEST" -Recurse
  
      }
      Else
      {
          New-Item "\\$server\C$\temp\TEST" -type directory
  
          Copy-Item "\\DC1NAS02P00\PDSdata\IT\CPS\Projects\NGNet\CpsServerUpgradeFiles\Upgrade Version 2.0\2003_Files\*.*" -Destination "\\$server\C$\temp\TEST" -Recurse
      }
  }
  </code></pre>
  
  <p>Also I want some time gap between New_item and Move-item, since it is saying file is already in use ..</p>
  
  <p>Thanks
  Bibin</p>