title: "get-wmiobject win32_process -computername" gets error "Access denied , code 0x80070005"
body: <p>i'm trying to find processes on 3 terminal servers which have certain words in its $_.commandline property. Under my domain admin account, it worked OK. But I want this script to be usable for domain users, and doamin users get an error when runing  this script.</p>
  
  <p>What should i do, so that domain users can run this script just like domain admins? Thanks in advance!</p>
  
  <p>Error:</p>
  
  <pre><code>Get-WmiObject : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESS DENIED))
  At N:\FindWhoIsUsing\FindWhoIsUsing.ps1:7 char:18
  get-wmiobject &lt;&lt;&lt;&lt;  win32_process -computername $server -EnableAllPrivileges|
  CategoryInfo          : NotSpecified: (:) [Get-WmiObject], UnauthorizedAccessException
  FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.GetWmiObjectCommand
  </code></pre>
  
  <p>Powershell Code:</p>
  
  <pre><code>Write-host "Who is using this profile?"
  $profile = Read-host "specify profile name" 
  $servers = @("server-01","server-02","server-03")
  Foreach($server in $servers)
  {
      Write-host $server
      get-wmiobject win32_process -computername $server -EnableAllPrivileges|
      where{$_.name -like "*Processname*" -and
      $_.CommandLine -like "*$profile*"}|
      select @{n="Server";e={$server}},@{n="User";e={$_.getowner().user}},@{n="ProcessID";e= {$_.ProcessID}},{$_.CommandLine}|fl
  }
  Write-host "DONE Searching!"
  </code></pre>