The TM30 accommodation registration of EVERY foreigner is required by law. Regardless of the visa type he used to enter, and regardless the stay permit he go stamped.
Without being properly registered in an accommodation, you can expect not to be serviced for anything on Immigration.
The owner of a building who has the blue housebook, or a foreigner who has the yellow housebook, or the hotel or resort, can register the premises in the online TM30 system of Immigration. He will receive a Login-ID and a password.
So, when a guest arrives, the owner can register the guest with name and passport number in the TM30 system.
If you stay with a friend who is the owner of the premises, your friend must register you in the TM30 system within 24 hours of your arrival.
In case you sleep in your girlfriend’s house, she can register you per TM30 only if she is the owner of the premises.
She can only register you if she already has registered her house or apartment in the online TM30 system based on her blue housebook, and only if she has been issued a Login-ID and a password.
If your girlfriend is only renting the premises, the landlord or owner is required to register you per TM30.
Every hotel, guesthouse and resort is required to register you in the TM30 online system as soon as you check-in. They do it automatically, and you will often not even notice them doing it. In case you need a printout of the TM30, you can ask the hotel for it. However, they can only print it within 7 days after registering. After 7 days, you can only do a screenshot.
It is your responsibility to make sure the hotel, your friend or the landlord has TM30 registered you. This is because it will be you who will have to pay the fine, not the hotel or the landlord, if you get caught out without it.
Actually, if you get checked by the police anywhere in Thailand and they find out that you have no TM30, you can be fined for up to 5000 THB! Many people are not aware of this.
If you need any service from Immigration like a 30-days touristic extension, or an application to a 1-year Extension of the Stay Permit, you visit Immigration and they find you haven’t been TM30 registered, you can expect a fine of 2000 Baht.
You won’t be able to leave an Immigration office before you haven't paid the fine. After that, you are free to try to get that money back from the landlord or the hotel that didn’t follow the law.
You can theoretically dismiss the TM30 in case you don't have any business on Immigration during your stay.
When you exit Thailand, nobody will check if you had been TM30 registered before or not.