This is one of those questions that can go sprawling in all sorts of directions as there are many ways you could proceed.
First of all, name resolution in windows uses more than DNS. The command to use to see if DNS can resolve a name is nslookup, so you would use
nslookup myvm1.mycompany.com to see if it is in DNS for that domain.
ping myvm1 from a machine will use more than just DNS for name resolution, it may be using NetBIOS, WINS, or some auto-discover query like multicast DNS (mDNS) or DNS Self Discovery (DNS-SD), Ubuntu implements these through the avahi daemon. Even if it is doing a DNS lookup it may be using more than just the mycompany.com DNS search domain.
Given that it works most of the time, I'm guessing that the name myvm1 is being used with avahi with either mDNS or DNS-SD that the windows name resolver queries when you run ping. These zeroconf name resolution protocols do not use an actual DNS server and so do not need to authenticate themselves to an AD integrated DNS server. From my experience the zeroconf mDNS/DNS-SD protocols are not 100% reliable, which adds to my belief that these are being used in your case as it matches your situation.
You could go in multiple directions from here
- ensure avahi is working properly
- If the mycompany.com is a typical windows domain run by Active Directory it will require the machine to be part of the domain for it to push automatic DNS updates to the server. You could make a manual DNS entry into the mycompany.com domain and either
- make the ubuntu vm a static IP with either a fixed IP in its local config or a DHCP reservation. These are my 1st and 2nd preferences for a solution.
- allow insecure updates for the name myvm1.mycompany.com
- make the Ubuntu VM part of the AD domain so it can do authenticated automatic DNS updates. This may require samba version 4 or above.
As a couple of first steps I would check
- Check the DNS search domain order on your windows machine to see if it is even looking at the domain mycompany.com when you type in just a host name.
- On the Ubuntu VM ensure that you have set the full qualified domain name for the machine as described on this how to.