title: Creating registry DWORD entry with PowerShell
body: <p>I am trying to create registry entries for some time now.</p>
  
  <p>Enviroment:</p>
  
  <ul>
  <li>Offline environment (No Domain)</li>
  <li>1 Windows Server 2012&nbsp;R2</li>
  <li>200 Windows 7 clients</li>
  </ul>
  
  <p>The following entry should be created on several computers:</p>
  
  <pre>
  [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system]
  "LocalAccountTokenFilterPolicy"=dword:00000001
  </pre>
  
  <p>For this I would like to use the following script</p>
  
  <pre class="lang-bsh prettyprint-override"><code>$Computers = Get-Content "C:\Scripts\Clients.txt"
  $Path = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
  $Name = "LocalAccountTokenFilterPolicy"
  $PropertyType = "DWord"
  $Value = 1
  $results = foreach ($computer in $Computers) {
      if (Test-Connection -ComputerName $computer -Count 1 -Quiet) {
          try {
              Set-ItemProperty -Path $path -Name $Name -Value $Value -Type $PropertyType -ErrorAction 'Stop'
              $status = "Success"
          } catch {
              $status = "Failed"
          }
      } else {
          $status = "Unreachable"
      }
      New-Object -TypeName PSObject -Property @{
          'Computer' = $computer
          'Status'   = $status
      }
  }
  $results | Export-Csv -NoTypeInformation -Path "./error.csv"
  </code></pre>
  
  <p>The script is executed, no error appears, but the entries were not created.
  Where is my error?</p>