title: Powershell: Invoke-Command Permissions Issue
body: <p>Summary: Running a "get-wmiobject" on another computer works properly. But when I "invoke-command" "get-wmiobject", I get access denied. </p>
  
  <p>Detail: I have a workstation (Computer-Central) at our central site, from which I run an inventory script. The inventory script loops through several "get-wmi" commands for each IP on all our remote sites. If I log onto Computer-Central as a domain admin, the script works properly.</p>
  
  <p>I'm now at one of those remote sites. My current workstation is (Computer-SiteA). So I can't log into Computer-Central directly; I have to RDP in. The trouble is, the RDP session times out before the script finishes (it takes about 12 hours). So I can't RDP in, start the script, and walk away. For various reasons, making a Scheduled Task is also out.</p>
  
  <p>Powershell Remoting is enabled. I logged onto Computer-SiteA with my domain admin account and ran the following command:</p>
  
  <pre><code>invoke-command -computername Computer-Central {dir c:}
  </code></pre>
  
  <p>This worked properly. So I kicked off the inventory script with the following command (again, run as domain admin on Computer-SiteA):</p>
  
  <pre><code>invoke-command -computername Computer-Central -filepath c:\inventory.ps1
  </code></pre>
  
  <p>The script started and ran overnight. But the get-wmi commands all produced "Access Denied" errors. 
  I RDP'd into Computer-Central and ran the following command:</p>
  
  <pre><code>get-wmiobject -class win32_computersystem -property name -computername Computer-SiteB
  </code></pre>
  
  <p>This worked properly. I got the WMI information back.</p>
  
  <p>Then I logged onto Computer-SiteA and ran the following command:</p>
  
  <pre><code>invoke-command -computername Computer-Central {get-wmiobject -class     win32_computersystem -property name -computername Computer-SiteB}
  </code></pre>
  
  <p>This failed with "Access Denied." I logged on as Domain Admin and even did a "Run As Different User" to make sure the PS console was open as my domain admin account. </p>
  
  <p>I'm very confused by this. "Invoke-Command" should start the Powershell.exe process on the remote system with the credentials I've used on the local PC. The "get-wmiobject" command should pass the WMI query from the remote PC to the target PC, again with the same credentials. But that doesn't seem to be the case. </p>
  
  <p>Any ideas?</p>
  
  <p>EDIT: I ran this command to make Computer-Central query itself.</p>
  
  <pre><code>invoke-command -computername Computer-Central {get-wmiobject -class     win32_computersystem -property name -computername Computer-Central}
  </code></pre>
  
  <p>That worked. If I invoke "get-wmiobject" on the remote system targeting itself, it works. If I invoke "get-wmiobject" on the remote system targeting a third system, it fails. I hope this helps.</p>