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

Home Posts Topics Members FAQ

Problems while creating groups in directory service

Hello everybody,

im trying hard to automate some tasks in a huge windows environment.
This lend me to bigger problems while trying to create new global
security groups within active directory. First I tried to add the groups
as discribed in article "Creating Groups" at Platform SDK:
System.DirectoryServices documentation. I figuerd out that something in
the article was missing, because groupcreation ended in an error: "A
constraint violation occured." The missing thing was to set the property
for "sAMAccountName". Now a new error occures wich bothers me: "A device
attached to the system is not functioning."

Anyone encountered similar problems or - even better- anyone solved this
problem?

Here a small codesnipplet for problemtracing...

----- snip ----------------------------------------------------------

public int createOuTree( ArrayList toAdd )
{
int returnValue = 0;
DirectoryEntries adsRoot = pubAds.Children;
DirectoryEntry newOu;
DirectoryEntry newSubOu;
DirectoryEntry genGrp;
foreach ( string addOu in toAdd )
{
try
{
newOu = adsRoot.Add("OU=" + addOu, "organizationalUnit");
newOu.CommitChanges();
}
catch( COMException e )
{
returnValue = 1;
exception = e.Message.ToString();
continue;
}
DirectoryEntries genChildOus = newOu.Children;
foreach ( string subOu in schemaDef )
{
try
{
newSubOu = genChildOus.Add( "OU=" + subOu, "organizationalUnit" );
newSubOu.CommitChanges();
Console.WriteLine( "\t|- {0} (subou)", subOu );
if ( subOu == schemaGroupentriesPrefixes[0] )
{
int i = 1;
while ( i < schemaGroupentriesPrefixes.Length )
{
string groupID = "CN=" + schemaGroupentriesPrefixes[i] +
addOu.ToString();
Console.WriteLine( "\t|\t|- {0} (securitygroup)",
schemaGroupentriesPrefixes[i] + addOu );
try
{
genGrp = newSubOu.Children.Add( groupID, "group" );
genGrp.Properties["groupType"].Value =
ActiveDs.ADS_GROUP_TYPE_ENUM.ADS_GROUP_TYPE_GLOBAL _GROUP |
ActiveDs.ADS_GROUP_TYPE_ENUM.ADS_GROUP_TYPE_SECURI TY_ENABLED;
genGrp.Properties["sAMAccountName"].Value = groupID;
genGrp.Properties["description"].Value = "Standard Group for OU "
+ addOu.ToString();
genGrp.CommitChanges();
i++;
}
catch ( Exception e )
{
Console.WriteLine( "Caught exception: \"{0}\", while adding group
{1}", e.Message, groupID );
i++;
continue;
}
}
}
}
catch( COMException e)
{
returnValue = 1;
exception = e.Message.ToString();
continue;
}
}
}
genGrp = null;
newSubOu = null;
newOu = null;
adsRoot = null;
return returnValue;
}

---- snap ------------------------------------------------------
Best regards

Sergej Pioch
Nov 16 '05 #1
0 1522

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

Similar topics

3
by: Bryan Meyer | last post by:
Hello Everyone: I have a PHP script that attempts to create a temporary file to be used during processing. The script is owned by my username (bryanrme) on the server. When the script attempts...
2
by: James Allan | last post by:
Hello -- I'm trying to get SQL Server 2000 on a Windows 2000 Server to be able to query an Active Directory. We've got two domain servers one Win2000 and one Win2003. However, I'm having...
55
by: drhowarddrfine | last post by:
I'm working on a web site that could use some control using js but am concerned about what problems I may have with potential users having their js turned off. Has anyone had any serious problems...
7
by: Jaydeep | last post by:
Hi, Anybody knows how to create virtual directory programmatically under root directory ofcourse from code-behind. I am developing web-based application where I need to create a folder and making...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
2
by: Adam Witney | last post by:
Forwarding to the mailing list, as I don't know how to fix it.... ------ Forwarded Message From: Henning Klein <kleinh@rz.uni-potsdam.de> Date: Tue, 22 Jun 2004 22:09:08 +0200 To:...
8
by: BARTKO, Zoltán | last post by:
Hello, folks, I am trying to install pgsql8 on winxp. I tried first to install "as is" with pginstaller beta2-dev3, no luck, it froze, switched off Nod32, froze a little later, ran through the...
15
by: David Thielen | last post by:
Hi; My ASP.NET app (C# calling J# under .net 2.0) creates a png file in a subdirectory to display as part of the created page. However, the bitmap will not display due to a security violation. ...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
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
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.