title: NLog used into powershell
body: <p>I developed a pretty long ps1 script(s) and I decided to move from Write-* to use Nlog for logging.
  It is working great, but than I realized that I wanted to preserve the writing in the console, since it is more friendly if I'm not trobuleshooting.
  So I added a new target, (tried both <a href="https://github.com/NLog/NLog/wiki/Console-target" rel="nofollow noreferrer">ConsoleTarget</a> and <a href="https://github.com/NLog/NLog/wiki/ColoredConsole-target" rel="nofollow noreferrer">ColoredConsoleTarget</a>) to see what I was seeing before moving to NLog.
  Unfortunately I saw nothing.</p>
  <p>This is my NLog.config (that work perfectly for the file target):</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
  &lt;nlog xmlns=&quot;http://www.nlog-project.org/schemas/NLog.xsd&quot;
        xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
        autoReload=&quot;true&quot;&gt;
    &lt;targets async=&quot;true&quot;&gt;
      &lt;!-- text file - absolute directory e.g. not using &quot;basedir&quot; variable --&gt;
      &lt;target name=&quot;logfile&quot;
              xsi:type=&quot;File&quot;
              fileName=&quot;C:\logfile.txt&quot;
              layout=&quot;${longdate}|${message} ${exception:format=tostring}&quot;/&gt;
      &lt;target xsi:type=&quot;ColoredConsole&quot;
            name=&quot;ColoredConsole&quot;
            layout=&quot;${longdate}|${message} ${exception:format=tostring}&quot;
            useDefaultRowHighlightingRules=&quot;true&quot;
            errorStream=&quot;true&quot;
            detectConsoleAvailable=&quot;true&quot;
            detectOutputRedirected=&quot;true&quot; /&gt;
    &lt;/targets&gt;
    &lt;rules&gt;
      &lt;!-- log only info and above --&gt;
      &lt;logger name=&quot;*&quot; minLevel=&quot;Trace&quot; writeTo=&quot;logfile&quot;/&gt;
      &lt;logger name=&quot;*&quot; minLevel=&quot;Trace&quot; writeTo=&quot;ColoredConsole&quot;/&gt;
    &lt;/rules&gt;
  &lt;/nlog&gt;
  </code></pre>
  <p>Once I launch my script (with a batch in this case), the logfile works great, but the console stays empty.</p>
  <p><a href="https://i.stack.imgur.com/JPcAX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JPcAX.png" alt="enter image description here" /></a></p>
  <p>Ideas?</p>
  <p>Thanks!</p>