Searching in the home windows API for that NetUnJoinDomain api call I discovered it confusing whether the lpServer parameter is supposed to retain the primary AD server the pc is attached to or maybe it is the title from the computer which the netunjoindomain function is going to be used (also known as from computer A send to computer B to get rid of computer B from the domain).
The api wording is a little fuzzy: lpServer [in] A pointer to some constant string that identifies the DNS or NetBIOS title from the computer which the function would be to execute. If the parameter is NULL, the neighborhood computer can be used.
P.S. This really is being designed in C# using .Internet 4 and pinvoke
It's the computer you want to unjoin in the domain. Because the documentation states, you may either specify some type of computer title to unjoin it or NULL to do the unjoin around the local computer.