I have been tasked with changing the WORKGROUP name to something different on several computers. Unfortunately, it can take upwards of 10 minutes to do this manually. It is time to use an administrative script to do the job for me!

Make sure to change NEW_WORKGROUP_NAME to the actual name of the Workgroup that you want to have the computer be a part of (and yes, the quotes are required in order for the command to work).

To change the WORKGROUP from the command line, open an elevated command promt and copy-paste this text in the CMD box:

Wmic computersystem where name="%computername%" call joindomainorworkgroup name=”New_Workgroup_Name”
**Make sure to change NEW_WORKGROUP_NAME to the actual name of the Workgroup that you want to have the computer be a part of (and yes, the quotes are required in 
order for the command to work).
This command works in Windows XP, Windows Vista, Windows 7, Windows Server 2003 (including R2), Windows Server 2008 (including R2), and Windows Server 2008 Core editions.

EDIT: By the way, NETDOM doesn't work with Workgroups so don't even bother. NETDOM is now strictly for use with Windows Domains.