title: Powershell Deployed via SCCM Issue
body: <p>I am writing a powershell script to be deployed by SCCM via a package. The aim of this is to remove an account with a specific name then write to a file stating if the account exists or not. The code is below:</p>
  
  <pre><code>$Computer = hostname
  foreach ($C in $Computer) {
      if (Test-Connection $C -Quiet) {
      Write-Verbose "$C &gt; Online"
          $Users = Get-WMIObject Win32_UserAccount -Filter "LocalAccount=True" -ComputerName $C
  
          if ($Users.Name -contains 'test') {
              Add-Content \\SERVERNAME\SHARENAME.$\$computer-found_$(get-date -Format yyyymmdd_hhmmtt).txt "User 'test' found, Disable 'test' found"
              net user test /active:no            }
          else {
              Add-Content \\SERVERNAME\SHARENAME.$\$computer-notfound_$(get-date -Format yyyymmdd_hhmmtt).txt "User 'test' not found"
          }
      }
      else {
      Write-Verbose "$C &gt; Offline"
      }
  }
  </code></pre>
  
  <p>I have also tried replace <code>Write-Verbose</code> with <code>Write-Host</code> and <code>Add-Content</code> with <code>Out-File</code> but the problem I having is that no content / file is created when I use the full network path or share e.g. <code>\\SERVERNAME\SHARENAME.$</code> the path identified has all the correct permissions and is being ran locally using the System account.</p>
  
  <p>I wanted to see if the issue occured when writing the file locatlly consequently this does not happen when written to <code>C:\Temp\</code></p>
  
  <p>Does anyone have any ideas on to solve this.  </p>