Click here to Skip to main content
15,896,467 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi,
How to change computer name and join domain by C# or VB.
And I had vb script about the join domain and change computer name,it takes some time to change the computer name and join domain, I wanna a efficient way to do this.
Thanks in Advance.
Posted
Updated 3-Apr-11 19:48pm
v3

That would be a security violation of the highest magnitude, and the user would need admin privileges to do it, but you'd have to make calls to SetComputerNameEx. Go to PInvoke.Net[^] and find the appropriate interop prototype for the method.
 
Share this answer
 
v2
If you are not intemedated by WMI then look at this rename function. http://msdn.microsoft.com/en-us/library/aa393056.aspx[^]

Given right privilege that should help you to rename the computer, as to how to join a domain from code, I am not sure, but there many be something for you, again in WMI
 
Share this answer
 
You can get the general idea of joining a domain from here[^]. It's just another WMI method call, like any other. But, of course, the user running this has to have Domain Admin permissions, or the domain account already has to be setup for the machine name.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900