Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# VB.NET
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 31-Mar-11 4:17am
Edited 3-Apr-11 19:48pm
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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.
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 248
1 Maciej Los 210
2 Sergey Alexandrovich Kryukov 160
3 Peter Leow 155
4 George Jonsson 135


Advertise | Privacy | Mobile
Web04 | 2.8.140709.1 | Last Updated 4 Apr 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid