Displaying Services on a remote computer

Hello everyone,
I am trying to run a PowerShell script that displays Windows Services on a Remote Computer using the correct security credentials however, I am being presented with the Error Response below; does anyone know why this is happening?, thank you in advance …

PowerShell Code
$cred = get-Credential -credential domain\user_name
$computer = “Remote_Hostname”
Get-WMIObject Win32_Service -computerName $computer -credential $cred

Error Response
Get-WMIObject : Call was canceled by the message filter. (Exception from HRESULT: 0x80010002 (RPC_E_CALL_CANCELED))
At line:3 char:1

  • Get-WMIObject Win32_Service -computerName $computer -credential $cred
  •   + CategoryInfo          : InvalidOperation: (:) [Get-WmiObject], COMException
      + FullyQualifiedErrorId : GetWMICOMException,Microsoft.PowerShell.Commands.GetWmiObjectCommand

This appears to be a WMI issue on the machine to which you’re trying to connect

Try RDPing into the server and making the call locally - if should still fail if its a WMI issue on that server

then try restarting the WMI service and run get-wmiobject again

if it still fails try running wbemtest

if you don’t get any success you may have to rebuild the WMI repository

You can try get-ciminstance instead, if wsman works instead of dcom.