'WinRM Cannot find the computer using DNS name

We have a machine which has a DNS mapping.

When we try to do a new PS session using the mapped name, like this:

New-PSSession -ComputerName DNSMappedMachineName

Get this error:

WinRM Error. Cannot find the computer. Verify that the computer exists on the network and that the name provided is spelled correctly.

By the way, tried the fully qualified network name as well and still didn't work. And we flushed DNS cache too. Still same result.

However, if we do this:

New-PSSession -ComputerName ActualMachineName

It works fine.

Is there something specific that has to be done so that PS Windows automation can find the computer through its DNS name?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source