Alta de usuarios en directorio activo

08/02/2005 - 17:37 por Worldjam | Informe spam
Hola!! Estoy haciendo una aplicacion en C# para dar de altas a usuarios en el
directorio activo, pero al intentar crear el usuario me da un error al poner
la contraseña. Mi codigo es el siguiente:

try
{
DirectoryEntry objDE;
StringstrPath="LDAP://OU=Admins,OU=acctZonaCanarias..";

if(args.Length>0)strPath=args[1];


// Create a new DirectoryEntry with the given path.
objDE=new DirectoryEntry(strPath);
DirectoryEntries objChildDE = objDE.Children;

DirectoryEntry myDirectoryEntry = objChildDE.Add("CN=prueba6", "user");
myDirectoryEntry.Properties["userPrincipalName"].Value = "prueba6";
myDirectoryEntry.Properties["name"].Value = "prueba6";

// myDirectoryEntry.Invoke("SetPassword", new object[] {"Pwd-appprueba6"});
// myDirectoryEntry.Properties["PasswordRequired"].Value = 1;

myDirectoryEntry.Properties["samAccountName"].Value = "prueba6";
myDirectoryEntry.Properties["description"].Value = "Descripcion del
Usuario";
//myDirectoryEntry.Properties["AccountDisabled"].Value = 1;
myDirectoryEntry.Properties["pwdLastSet"].Value = -1;

myDirectoryEntry.CommitChanges();

myDirectoryEntry.Dispose();

MessageBox.Show("Worked!!");

}
catch (Exception ex)
{
MessageBox.Show("error");
}
}


Asi me funciona y crea el usuario, pero poniendo las lineas que estan
comentadas me da un error.
¿Que puede ser?

Gracias

Preguntas similare

Leer las respuestas

#1 Octavio Hernandez
08/02/2005 - 21:04 | Informe spam
Hola,

No sé si será exactamente tu problema, pero he estado mirando en Internet y
en varios lugares he visto que para llamar a SetPassword hay que tener una
conexión SSL al servidor:

http://support.microsoft.com/kb/269190/en-us
"Worldjam" escribió en el mensaje
news:
Hola!! Estoy haciendo una aplicacion en C# para dar de altas a usuarios en
el
directorio activo, pero al intentar crear el usuario me da un error al
poner
la contraseña. Mi codigo es el siguiente:

try
{
DirectoryEntry objDE;
StringstrPath="LDAP://OU=Admins,OU=acctZonaCanarias..";

if(args.Length>0)strPath=args[1];


// Create a new DirectoryEntry with the given path.
objDE=new DirectoryEntry(strPath);
DirectoryEntries objChildDE = objDE.Children;

DirectoryEntry myDirectoryEntry = objChildDE.Add("CN=prueba6", "user");
myDirectoryEntry.Properties["userPrincipalName"].Value = "prueba6";
myDirectoryEntry.Properties["name"].Value = "prueba6";

// myDirectoryEntry.Invoke("SetPassword", new object[]
{"Pwd-appprueba6"});
// myDirectoryEntry.Properties["PasswordRequired"].Value = 1;

myDirectoryEntry.Properties["samAccountName"].Value = "prueba6";
myDirectoryEntry.Properties["description"].Value = "Descripcion del
Usuario";
//myDirectoryEntry.Properties["AccountDisabled"].Value = 1;
myDirectoryEntry.Properties["pwdLastSet"].Value = -1;

myDirectoryEntry.CommitChanges();

myDirectoryEntry.Dispose();

MessageBox.Show("Worked!!");

}
catch (Exception ex)
{
MessageBox.Show("error");
}
}


Asi me funciona y crea el usuario, pero poniendo las lineas que estan
comentadas me da un error.
¿Que puede ser?

Gracias
email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida