The machine I am trying to use is not Domain Joined(won't be) and would like to be able to remote reboot a VM(pfSense) with a PowerShell Script.

I keep getting this error trying test my connection to the server.

PS C:\WINDOWS\system32> Get-VM –computername 'LAB1' | Where { $_.State –eq 'Running' }
Get-VM : The operation on computer 'LAB1' failed: The WinRM client cannot process the request. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or 
the destination machine must be added to the TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. You can get more information about that by 
running the following command: winrm help config.

I tried this:

winrm set winrm/config/client '@{TrustedHosts="DESKTOP-K2GD11M"}'
Enable-PSRemoting -Force

but still get the error.

I also did check with get-item wsman:\localhost\Client\TrustedHosts and the hostname or computer name was added.

  • 1
    Check if trusted hosts has been updated on the remote machine - from a powershell prompt on your LAB1 box run get-item wsman:\localhost\Client\TrustedHosts That will tell you if it's been set. If it's empty, try the following where <ComputerName> is the name of the computer you want to add : set-item wsman:\localhost\Client\TrustedHosts -value <ComputerName> – Enigman Dec 7 '16 at 0:32
  • What if it has been updated? – Jason Dec 7 '16 at 2:20

Try the following from your domain machine: (This doesn't use use Powershell Remoting)

$cred = Get-Credential \LAB1\Username
Get-VM -Computername LAB1 -Credential $cred |  Where { $_.State –eq 'Running' }

Where Username is an account with access on your workgroup box and LAB1 is the workgroup box.

You will get a dialog box prompting you for the password for LAB1\Username

Now, what you need to do is have your client machine (domain) trust the server (workgroup).

You can use either

winrm set winrm/config/client '@{TrustedHosts="LAB1"}'


set-item wsman:\localhost\Client\TrustedHosts -value LAB1 -concatenate

on your desktop machine.

Then when testing, ensure you have included credentials that have access on your destination server:

$cred = Get-Credential \LAB1\Username
Get-VM –Computername 'LAB1' -Credential $cred | Where { $_.State –eq 'Running' }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.