473,473 Members | 2,025 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Need help with joining a domain

This isn't really a question on .NET, although it is network related. There
doesn't
seem to be a way in .NET to work with domains in any case.

I am writing a C# program to automate the deployment of new notebooks the
first time they are booted after sysprep has done it's thing. I want to join
the notebook to our domain and give it a specific name based on user input.
The two functions I am using for this purpose are NetJoinDomain and
NetRenameMachineinDomain. This is basically what I'm doing:

NetJoinDomain("", domain, "OU=Notebooks,DC=ad,DC=acadiau,DC=ca", username,
password, NETSETUP_JOIN_DOMAIN | NETSETUP_ACCT_CREATE |
NETSETUP_DEFER_SPN_SET);

NetRenameMachineInDomain("", computerName, username, password,
NETSETUP_ACCT_CREATE);

The call to the first function works properly. The call creates a computer
account in the OU indicated and joins the computer to the specified domain.
The call to the rename function almost works as well. The domain account is
renamed with the new computer name, but the function returns error code 2221
and does not rename the local computer name to match the new domain name.
Error code 2221 is defined as "The username could not be found". There is no
indication what the username it's complaining about, but I can only assume
that it's the domain username and password, which is valid.

If I reboot the computer between calls to NetJoinDomain and
NetRenameMachineInDomain, the rename works properly. However, there is no
indication that a reboot is required after calling NetJoinDomain before
using
NetRenameMachineInDomain. I want to avoid excessive reboots to make the
process go more quickly for the user.

If anyone has used these functions in a similar situation and has any
suggestions, I'd appreciate hearing from you. Thanks.
Nov 22 '05 #1
0 965

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: B. Fongo | last post by:
I learned MySQL last year without putting it into action; that is why I face trouble in formulating my queries. Were it a test, then you would have passed it, because your queries did help me...
0
by: Paul Steele | last post by:
This isn't really a question on .NET, although it is network related. There doesn't seem to be a way in .NET to work with domains in any case. I am writing a C# program to automate the...
1
by: Paul Steele | last post by:
I am writing a C# program to automate the deployment of new notebooks the first time they are booted after sysprep has done it's thing. I want to join the notebook to our domain and give it a...
2
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at...
2
by: Dennis Gearon | last post by:
IPU, in place updates. -------------------------- 1/ Put a version numbers on each record represented by a byte/word sized number from a three version number list kept by the table header. This...
2
by: pv | last post by:
Hi everyone, I need help with following scenario, please: Users are accessing same web server from intranet (users previously authenticated in Active Dir) and from extranet (common public...
6
by: joseph speigle | last post by:
hi, Does anybody know offhand what is the correct way to use substr to extract the domain name from a client_referer column as logged by mod_pgsqllog (httpd module), by correcting the following: ...
2
by: jeremiah johnson | last post by:
I have a .net DLL that I've created (based on someone's post in this group, sorry I've forgotten who) and I need a little help with making it work. I want to provide the same functionality as...
3
by: sunbeam | last post by:
Short Description of the Project: we developed a e-learning system for our students. each student has a unique username/password to view the modules he/she should view and nothing more. since we...
2
by: Supermansteel | last post by:
I am joining these 2 tables together in Access 2003 and can't figure out the exact way of writing this script......Can anyone help? I have the following SQL: SELECT...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.