Synchronizing machine time with domain controller

Sometimes when joining a machine to a new domain, you might get an error saying "The time on your machine does not match with the network time". On getting this error while logging in, the machine will not allow you to log in to the domain. I just got this error today when setting up a new virtual machine for the environment. 

The basic issue here is that the time on the machine is not automatically synched with the time on the domain controller. (Not sure why this matters, great if somebody can clarify).

But anyways, to resolve this problem, simply login as a local account and sync the time with the domain controller using the Net time command.

To do this, goto the command prompt and run the following -


NET TIME /domain:mydomainname /SET /Y


This will synchronize the machine time to that of the domain controller. After doing this, you can simply log off and log on again with the domain user.