Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

creating a user in Active Directory: A device attached to the system is not functioning

Consider this code attempting to create an Active Directory account. It's generating an exception here with a certain set of data. It's not clear right now what's causing the exception.

 var user = new UserPrincipal(someValidUserContext,                               ".x-xyz-t-FooFooBarTest", "somePwd", true);   user.UserPrincipalName = "[email protected]";  user.SamAccountName = ".x-xyz-t-FooFooBarTest";           user.DisplayName = "Some String 16 chars long";  user.Name =  "Some String 16 chars long";  user.Description = "Foo BarBaz 12 more characters";  user.AccountExpirationDate = someDateInFuture;  user.UserCannotChangePassword = true;  user.Save();   // exception thrown on Save():   // A device attached to the system is not functioning 

alt text

PrincipalOperationException was unhandled by user code: A device attached to the system is not functioning

What's causing this exception, and how can you work around it?

like image 730
p.campbell Avatar asked Jun 22 '10 17:06

p.campbell


People also ask

What does not accessible A device attached to the system is not functioning?

This error means that your computer cannot properly communicate or transfer data with attached device. Thus, you are likely to get this error when your PC is connected with removable drives and there might be something wrong with connection, driver compatibility or USB port quality, etc.

How do I add a user to Active Directory?

To create a new user, follow these steps: Click Start, point to Administrative Tools, and then click Active Directory Users and Computers to start the Active Directory Users and Computers console. Click the domain name that you created, and then expand the contents. Right-click Users, point to New, and then click User.


1 Answers

The sAMAccountName attribute must be 20 characters or less.

like image 76
Germ Avatar answered Sep 19 '22 16:09

Germ