Is there any way to programmatically change the workgroup a machine (XP, Vista, and Win 7) belongs to (ideally from a .NET language)? I've found code to help determine which workgroup a machine belongs to, but in some cases I may need to change this.
This sounds a bit weird, but I'm thinking about building an automatic recovery installation for our users (at 100+ different sites of 2 to 10 machines, each with their own "server"). A common scenario is, "Hey, my server died. Can you get our Point of Sale software running on another machine and make it our temporary/new server?". I end up having to manually configure their machine name (rename it to the old server's name - I have code for this already), then double-check the workgroup to make sure it's visible to the other machines on the network. I'd love to be able to automate this as much as possible.
(edit)
With the info posted I did a bit more searching and found that I can actually do this directly, without running the EXE (not that doing that was a big deal).
using System;
using System.Management;
// class stuff removed for brevity
ManagementObject manage = new ManagementObject(string.Format("Win32_ComputerSystem.Name='{0}'", Environment.MachineName));
object[] args = { "WorkgroupName", null, null, null };
manage.InvokeMethod("JoinDomainOrWorkgroup", args);