title: Get-Counter on Remote Server
body: <p>I'm trying to use the Get-Counter function to get performance counters on a remote Windows Server 2012:</p>
  
  <pre><code>Get-Counter -ComputerName "serverName" -Counter '\SQLServer:SQL Statistics\Batch Requests/sec'
  </code></pre>
  
  <p>I am getting the error:</p>
  
  <blockquote>
    <p>Unable to connect to the specified computer or the computer is offline.</p>
  </blockquote>
  
  <p>I know the server is online and I have the appropriate permissions, because sending this code as a scriptblock and using Invoke-Command works just fine. I have a feeling this is the same issue when I try to connect to 2016 remote computer via Computer Management and it takes minutes to connect.  This happens for all 2012/2016 servers I've tried, but not 2008 R2.</p>
  
  <p>What could be causing the inability to communicate?</p>