title: Get remote registry value
body: <p>I have the below script that I want it to go out to multiple servers and get the value of a registry. Unfortunately it is currently just posting back the local registry value of the machine that I am running the script on.</p>
  
  <p>How do I get the script to run against remote registry?</p>
  
  <p>SCRIPT:</p>
  
  <pre><code>clear
  #$ErrorActionPreference = "silentlycontinue"
  
  $Logfile = "C:\temp\NEWnetbackup_version.log"
  
  Function LogWrite
  {
      param([string]$logstring)
  
      Add-Content $Logfile -Value $logstring
  }
  
  $computer = Get-Content -Path c:\temp\netbackup_servers1.txt
  
  foreach ($computer1 in $computer){
  
  $Service = Get-WmiObject Win32_Service -Filter "Name = 'NetBackup Client Service'" -ComputerName $computer1
  
      if (test-connection $computer1 -quiet) 
      {
              $NetbackupVersion1 = $(Get-ItemProperty hklm:\SOFTWARE\Veritas\NetBackup\CurrentVersion).PackageVersion
  
              if($Service.state -eq 'Running')
              {
                  LogWrite "$computer1 STARTED $NetbackupVersion1"
              }
              else
              {
                  LogWrite "$computer1 STOPPED $NetbackupVersion1"
              }
      }
      else 
      {
          LogWrite "$computer1 is down" -foregroundcolor RED
      }
  }
  </code></pre>