csrutil disable
Restart computer
In the terminal, type
sudo open /Applications/TextEdit.app /System/Library/LaunchDaemons/com.apple.ManagedClient.enroll.plist
change
<key>com.apple.ManagedClient.enroll</key>
<true/>
to
<key>com.apple.ManagedClient.enroll</key>
<false/>
So that the changes take effect
@arnonate I had exactly the same problem as you are encountering. I was desperate... but at the end it worked.
I installed the new os monterey from a usb flashdrive. Before starting the MBP 2017 (same as yours), I turned off the wifi in the house. Then I got the admin mdm screen you are talking about. You have to say MANY times that you have no internet. I had to confirm at least 7-8 times then mdm gave up and installed the os normally. Hope this help.
@secured2k After editing the hosts file again (removing and adding a line), running sudo profiles remove -all, and finally restarting without any window open... it seems that the annoing popup does not come so often. It came only once in 2 days... maybe its last breath!