This method is the easiest to implement.
Note : The following images were taken from Windows XP Pro machine, but other operating systems can still apply this method.
1. Right-click My Computer , select Properties
2. Click the Change button in the Computer Name tab. Then, change the Member of choice in the Active Directory domain to Workgroup
3. Enter the workgroup name, then click OK
4. Immediately after that, you will have to fill in the confirmation from the administrator
5. Next is a confirmation message.
6. Restart the computer.
After restarting, log in and join the domain.
Method 2: use the command
You can use the netdom.exe tool.
Note : In Windows Server 2008 or Windows 7, netdom is available on the system, no need to download more.
Open the command prompt , type netdom.exe remove winxp cl1 /Domain:petrilabs.local / userd: petrilabsadministrator / passwordd: ***************
At this point, the computer account will display a red X in the Active Directory Users and Computers tab.
Using netdom.exe will not have to restart
Then type: netdom.exe join winxp-cl1 /Domain:petrilabs.local / userd: petrilabsadministrator / passwordd: ***************
Restart the device.
Now you can use the computer as usual.